dmesg |tail -4 return last 4 lines   dmesg|tail -n +4 skip first 4 lines   dmesg |sed '$d' remove last line      


svn usage

svn info "file" wrong should be svn info file Get current repository svn info | grep 'Repository Root' | awk '{print $NF}' Above will print root svn info | grep '^URL' | awk '{print $NF}' will print current working svn repo Revert a change in svn svn merge -c -73614 postrm remove a file from... Continue Reading →

ubifs 学习

http://www.chinadmd.com/file/ouxxvcriu3tuaereesap6cer_1.html 分析ubi image http://www.iptvfans.cn/wiki/index.php/%E5%B0%8F%E7%B1%B3R2D%E8%B7%AF%E7%94%B1%E5%99%A8%E5%9B%BA%E4%BB%B6%E5%88%86%E6%9E use nandsim 模拟ubifs http://trac.gateworks.com/wiki/linux/ubi   if csv file like following 11,002,4,6,'04abbqq' 23,22,09,11,'00033ss00' 0444,001,009,00001,'hi' Use following command sed 's/^0*\([^,]\)/\1/;s/,0*\([^,]\)/,\1/g' It will be like: 11,2,4,6,'04abbqq' 23,22,9,11,'00033ss00' 444,1,9,1,'hi' Best clear leading zero script!!!      

Simulate ubifs on PC

Here is a step by step way of simulate UBIFS on PC, We use nandsim on UBUNTU 14.04 sudo rmmod nandsim cat /proc/mtd Create 256M Flash in PC's RAM sudo modprobe nandsim first_id_byte=0x20 second_id_byte=0xaa third_id_byte=0x00 fourth_id_byte=0x15 Check mtd0 created! cat /proc/mtd Attach Ubi0 to mtd0! sudo modprobe ubi mtd=0 Make a volume on ubi0, with... Continue Reading →

Recovering iPhone4

I had an iPhone4 for some time, I give it to my son about 3 year ago, and after 2 years, he bought a  new iPhone 6, so the iPhone4 was left there for 1 year, no one using it. This morning I tried to use it to do some testing, first it won't charge,... Continue Reading →

get all ip names from host name

void get_this_machine_ips(char * retIPs,int len) { char name[255]; PHOSTENT hostinfo;  strcpy(all_ips,""); if( gethostname ( name, sizeof(name)) == 0) { if((hostinfo = gethostbyname(name)) != NULL) { int nCount = 0;    while(hostinfo->h_addr_list[nCount]) { char * temp=inet_ntoa(*(struct in_addr *)hostinfo->h_addr_list[nCount]); CDCS_Log(CDCS_LOG_DBG2, CUR_MODULE, "get_this_machine_ips: %s\n",temp ); strncat(retIPs,temp,20); strcat(retIPs,";"); if (strlen(retIPs)>=(len-25)) break; nCount++; } } } }


var str = "𪚥"; Console.WriteLine(str.Length); Console.WriteLine(Char.IsHighSurrogate(str[0])); Console.WriteLine(Char.IsLowSurrogate(str[1])); str = "ส้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้"; Console.WriteLine(str.Length); StringInfo si = new StringInfo(str); Console.WriteLine(si.LengthInTextElements); Did you see above magical string (char)? length is 39!But LengthInTextElements return 1!!

Blog at WordPress.com.

Up ↑