2011 年文章归档
共 37 篇文章
xargs usage with multi arguments
http://offbytwo.com/2011/06/26/things-you-didnt-know-about-xargs.html I saw this article when I was wondering how to move a lot of files listed in a file to another place. I found xargs is very useful here. cat filename list | xargs -I % mv % newfolder Note that in the article above it mentions usi…
2011-11-30 12:24 · linux
Javascript Replace innerHTML throwing Unknown Runtime Error
Quite annoying...IE sucks... http://stackoverflow.com/questions/555965/javascript-replace-innerhtml-throwing-unknown-runtime-error I encountered this problem when I want to change a table's content using el.innerHtml = '<tr>...</tr>' in which el is a table element, IE throws "unknown runtime except…
2011-11-30 12:18 · javascript
Faster InnerHTML
http://blog.stevenlevithan.com/archives/faster-than-innerhtml I got performance boost in my FF rather than IE, quite weird, anyway, I think it's useful.
2011-11-23 17:18 · javascript
send html with perl MIME:Lite
Today I encounter a problem when sending html content via Perl's MIME:Lite, in my html there is always a </tr> got broken...damn it! I checked the html string, it's all right. Finally I found there is a config for MIME:Lite: Use encoding: | If your message contains: --------------------------------…
2011-10-28 15:35 · perl
jquery lazy loading
最近玩了一下jquery,主要是在做的一个小工具要在一个web page里显示一个表格,表格每一行有一个图片,大约有几万行,所以问题是一下子load下来吃不消了。对于前端我是门外汉,网上搜了一下,发现有个lazy load的插件,jquery写的。 这个是官方网站: http://www.appelsiini.net/projects/lazyload 但是因为这玩意很早写的,后来浏览器发展太快了吧所以现在的浏览器上这个插件有问题了,作者在网站上也说了。于是就有某人去改了一些: 这个是某人改进的: http://www.popo4j.com/qianduan/transformation_j…
2011-10-26 15:24 · javascript
executing external commands in perl
http://www.perlhowto.com/executing_external_commands
2011-09-06 15:00 · perl
Fiel Test in Perl
http://www.devshed.com/c/a/Perl/File-Tests-in-Perl/ File test in perl is quite useful. E.g., how to check if a file exists? How to check if it's writable? And how to get age of a file? I finally see the link above, enjoy it.
2011-09-06 13:06 · perl
Pie Chart With Small Value Renders Incorrectly in IE
这个bug是我在使用extjs 4的pie chart的时候发现的,貌似还没有解决。 http://www.sencha.com/forum/showthread.php?137809-4.0.2a-Pie-Chart-with-small-value-renders-incorrectly-in-IE&p=616611
2011-09-02 14:26 · javascript
Cloud Security?
看了一些文章,主要是保证用户怎么保证存储在公有云的数据的完整性和正确性,即使用一套逻辑或者叫协议供用户和云存储提供者使用,使得用户能够相信数据放在存储厂商那里没有被删改,而且数据对于厂商是加密的。基于早就成型的密码学算法,这些文章都给出了有效的算法。 现在问题是如果用户不但要用公有云的存储,还要用它的计算结点,怎么保证整个过程的安全呢?
2011-09-02 14:23 · cloud
Proof of Storage
因为公司有一个合作项目牵涉到,这几天抽空看了一下proof of storage的paper,复习了一下本科学的密码学的内容,觉得还是一个很有意思的topic。其中一个reference挺难找的,记在这里吧。下面讨论的原理还是基于大整数的分解问题。 http://diswww.mit.edu/bloom-picayune/crypto/13190 Adi Shamir once proposed the following hash function: Let n = p*q be the product of two large primes, such that factoring n …
2011-08-25 22:04 · cryptography
how to explain free buffers and cached memory usage
free -m total used free shared buffers cached Mem: 48269 2424 45845 0 139 1120 -/+ buffers/cache: 1164 47105 Swap: 8197 0 8197 total used free shared buffers cached Mem: A B C D E F -/+ buffers/cache: G H Swap: I J K Note: A=B+C A=G+H G=B-E-F H=C+E+F The display columns mean: total: Your total (phy…
2011-07-18 11:57 · linux
Pro Git Tips
1. git init Create a new repo with exsiting project. 2. git diff This command compares what's in your working directory with what's in your staging area. The result tells what changes have not been staged. 3. git diff --cached Shows what you've stage that will go into your next commit. In Git v1.6 …
2011-07-14 17:53 · linux
Great HTML5 Example
This author shows how to draw interactive pie chart with html5. http://www.elated.com/articles/snazzy-animated-pie-chart-html5-jquery/
2011-07-07 18:05 · javascript
Last Survival
There are 100 people forming a circle and they are numbered from 1 to 100. They decide to kill each other using a sword, in following manner. At any point, person numbered n having a sword kills person numbered n+1 and passes the sword to n+2. This process doesnt stop untill at the end only 1 perso…
2011-06-30 16:02 · algorithm
Check if the two rectangles intersect
Given the bottom left and top right coordinates of the two rectangles, check whether the two rectangles intersect or not.
2011-06-29 14:58 · algorithm
sort n integers of range 0~n^2-1 in O(n) time
This is one problem introduced in "Introduction to Algorithm". We can use radix-sort to solve it. package alg; import java.util.ArrayList; import java.util.Iterator; /* * This example shows how to use radix sort algorithm to sort N integers in the range of 0 ~ N^2-1. */ public class RadixSortExampl…
2011-06-24 17:22 · algorithm
Calculating Permutations and Job Interview Questions
http://www.bearcave.com/random_hacks/permute.html Calculating Permutations and Job Interview Questions
2011-06-18 17:44 · c++
How to generate permutations recursively
I have posted code to calcuate permutations in order, this is another more short recursive one of generating non-order permutations. package alg_test; public class Permutation2 { void swap(int a[], int i, int j) { int temp = a[i]; a[i]=a[j]; a[j]= temp; } void printArray(int a[]){ for(int i=0;i<a.l…
2011-06-18 17:02 · java