bash echo  


ubifs 学习 分析ubi image use nandsim 模拟ubifs   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!!

Try catch finally in C#

class Common {     internal static int getInt(string count, int defaultVal)     {         int c = defaultVal;         try         {             c = Convert.ToInt32(count);             return c;         }         catch         {         }         finally         {             int x = 0;         }     return c;     } } Common.getInt("cx", 10); Explaination of this function call: convert will cause exception, catch part will be executed, there is... Continue Reading →

DNP3 in C# Project

After 2 years preparation, I have now able to write a DNP3 client and server C# application. It can support 5000 outstations. User can send integrity poll from master, get response back from client application. DNP3 client can also send unsolicited message to master. Master can write time and date to client. This version of... Continue Reading →

Create a free website or blog at

Up ↑