Sunday, November 29, 2015

Raspberry pi - prepare for Kernel Space Programming



Raspberry pi is one of the most popular SBC in market with ARM processor. It is very popular among students for playing as embedded stuff.

There are few points, need to noted down, while working or playing with Raspberry pi.

1. SDCard shows 56 MB, while I've 4 / 8 / 16 GB etc.

The reason, windows cannot read the actual size of SDCard is, its reading only the boot partition. To get rid of this problem, its advised to use SDFormatter.

2. Which image to Install ?

Default Raspberry pi gives two type of installation image.
        1. NOOB -- completely for beginner. I'd say for those who have no / less knowledge about linux.

        2. Raspbian -- A good place to start learning with Raspberry pi. Usually WHEEZY image is popular as starting. If you've smaller SDCard, and no requirement of Desktop, you may choose Jessie Lite minimum version.

Sunday, November 22, 2015

ERROR - vSphere Client could not connect.



if you are running ESXi 5 / 5.5 [ I've experience only these two], you probably experience error as below image, with error message -

" vSphere Client could not connect to "XX.XX.XX.XX". An unknown connection error occurred. (The client could not send a complete request to the server. (The underlying connection was closed: An unexpected error occurred on a send.)) "





Saturday, November 7, 2015

Hadoop changes on Single-Node Cluster Installations


There are many notes about HADOOP single node cluster installation, mostly in Ubuntu machine. All of them I've seen worked. But as time passed by, hadoop developer also made some structural and logical changes to fit the application better.

Here I wish to sum-up those changes (e.g. change of conf, file structure etc.) so newer user would get required commands or files easily while doing HADOOP signe node installation.


first to download hadoop =>
---------------------------------------------------
Best option is to search for nearest repository for hadoop from -

http://www.apache.org/dyn/closer.cgi/hadoop/common/

for me, below is the nearest

$ wget http://apache.lauf-forum.at/hadoop/common/hadoop-2.6.2/hadoop-2.6.2.tar.gz

Tuesday, October 27, 2015

XML or .osm special character issue and solution in C


You probably have experience while parsing openstreetmap .osm file - some name [TAG-NAME] appear as

C&C - which is in clear text "C&C". So while you are coding for a .osm or XML parser, it is important to consider such special character at XML specification.

If it need to present such value at literal form, it is important to replace those characters with some other clear text format.

For example, if it need to replace the above "&" a below C program can make an idea.

 char *special_ch_replace   
 (char *s, char ser, char rep)   
 {  
  char *p1;  
  for (p1=s; *p1; p1++)   
  {  
   if (*p1 == ser)  
      {  
    *p1 = rep;  
   }  
  }  
  return s;  
 }  

Saturday, October 3, 2015

C program to generate .osm[XML] with efficient memory management


It was a requirement to generate new .osm file with selectively extracted openstreetmap's data from a big file [e.g. a country / state .osm file].

Equally the requirement extended as no use of any pre-programmed library, only simple C programming and very importantly, the program should avoid -

1. memory leaking
2. buffer overflow
3. change of pointer address
4. extra memory allocation, and
5. efficient.

End output has to be something like this -

     <node id="73900462" lat="54.3884" lon="10.38285">  
         <tag k="name" v="Lidl"/>  
         <tag k="shop" v="supermarket"/>  
         <tag k="addr:city" v="Schönberg"/>  
         <tag k="addr:street" v="Große Mühlenstraße"/>  
         <tag k="addr:housenumber" v="51"/>  
     </node>  

The output will write to a file. Where, node_id, lat, lon, tag_value/s etc. will be dynamic.

Saturday, September 19, 2015

Parsing and splitting openstreetmap file [ C ]


Its quite bizarre to me, more I'm trying to friendly with string / character processing with C programming, they are showing their envy to me.

I was/am need to split a / any big osm file to three parts, NODE, WAY and RELATION. You can do that by giving line number range to program. But I want to get the line number automatically.

This was seems very easy, just counting the new line till getting required string, i.e. <way id=

So I wrote,

 char way_compare[] = "<way id=";  
 FILE *fp = fopen("Kiel.osm", "r");  
 char ckchr[10];  
 int count_line=1;  
 char chr = getc(fp);  
 while(chr != EOF)  
   {  
   if(chr == '\n')  
     {  count_line++;  
       fgets(ckchr, 10, fp);  
       if(!strcmp(way_compare,ckchr))  
         { break; }  
     }  
     chr = getc(fp);  
   }  
   printf("Searched: %s found at %d\n",way_compare,count_line);  

Wednesday, September 2, 2015

Reading between two given line number of a File


 It is sometimes very important, to let program to read a big file only some specific part/s.

For example, I was and still trying with Openstreetmap with readosm library. Which really need such option.

As .OSM file is quite a large and readosm does read every single bit of the file, on other hand my projected implementation hardware is quite low in resources, badly needed to optimize readosm reading style.

I'd and still have a plan of doing indexing for .OSM file and apply program to read according it.

To do so, here comes the first part of virtually slicing the .OSM file and apply to program to read by given lines between.

My program is an extension of
http://rosettacode.org/wiki/Read_a_specific_line_from_a_file