Saturday, November 2, 2013

GO LANGUAGE AND MONGO DB HACK #2

Thursday, October 10, 2013

Tuesday, September 3, 2013

C++ Using Namespace

Here is sample code to show the use namespace in C++.



#include<iostream>
 namespace ns1

{
 void print(){
 std::cout<<"namespace ns1"<<std::endl;
 }
}

 namespace ns2
 {
   void print(){
     std::cout<<"namespace ns2"<<std::endl;
   }
 }


 int main(){
   using namespace ns2;
   ns1::print();
   ns2::print();
   print();

   return 0;
 }



output :

namespace ns1
namespace ns2
namespace ns2

Similarly, using namespace std is defined as :


// iostream header file
namespace std
{
   ostream cout;
   istream  cin;
   // 
};

Thursday, February 21, 2013

Json File parsing in IOS

NOTE : need some changes
json file (test.json)


{
"commands":[
                {"command" : "Home", "method":"homemethod""image" : "homemg" },
                {"command" : "Exit", "method":"exitmethod""image" : "exitimg" },
    ]

}



step 1 :
   reading file test.json

   NSString* path = [[NSBundle mainBundle] pathForResource:@"test"
                                                     ofType:@"json"];
    NSString* content = [NSString stringWithContentsOfFile:path
                                                  encoding:NSUTF8StringEncoding
                                                     error:NULL];


step 2 :
 nsstring to nsdata

NSData* data = [content dataUsingEncoding:NSUTF8StringEncoding];


step 3 :
dict from nsdata
NSMutableDictionary *dict=[NSJSONSerialization JSONObjectWithData:data
                                                       options:NSJSONReadingMutableContainers
                                                         error:&error];


step 4 :
  test 

for(NSDictionary *d in array){
        NSLog(@"---------------------------");
        NSLog(@" command -- %@",[d objectForKey:@"command"]);
        NSLog(@" method -- %@",[d objectForKey:@"method"]);
        NSLog(@" image -- %@",[d objectForKey:@"image"]);
        NSLog(@"---------------------------");        
    }
    
}




Thursday, February 14, 2013

A good tutorial on GIT

I wanted to share a good link to understand working of git.
The following link explained the git in different way

http://www.sbf5.com/~cduan/technical/git/

I found a very good project to understand branching on github :
https://github.com/pcottle/learnGitBranching














Happy Coding.. :) B-)