Skip to main content

Posts

Showing posts from December, 2011

C/C++ map

map { string,info> mymap; map {string,info>::iterator it; / / insert into map it = mymap.find(chrmName); if ( it !=mymap.end() ) // found id{             it->second.fnc();  }else // not found{             mymap.insert(  pair ( chrmName, info()  )  ) ;  } // iterate over map cout << "map size:" << mymap.size() << endl;  map ::iterator it3;  int count=0;  int tot = 0;     for ( it3=mymap.begin() ; it3 != mymap.end(); it3++ ){         count++;         cout << it3->first.c_str() << "=>" ;         cout<< it3->second.getCount() << endl;         tot = tot+ it3->second.getCount();     }

C/C++ vector

void fnc() {      vector nameV;       nameV.push_back("ab");       nameV.push_back("cd");       int sz = nameV.size();       cout<< " Size of Vector:" << sz << endl;       for(int i=0;i       {           cout<<  nameV[i] << endl;       } }

JAVA file operation

 FileInputStream fstream = new FileInputStream("allUpper.seq");  DataInputStream in = new DataInputStream(fstream);   BufferedReader br = new BufferedReader(new InputStreamReader(in)); BufferedWriter out = new BufferedWriter(new FileWriter("kMer.txt")); // for write while ((seqLine = br.readLine()) != null) {                out.write(seqLine);                out.write("\n");   } br.close();  in.close();  fstream.close();   out.close();

linux sshfs mount remote folder in local disk

sshfs   alamt@kw2237.rc:/home/KAUST/alamt  /home/tanviralam/kaustmachine/ ssh -X  alamt@kw2237.rc run matlab /mnt/kaustapps/MATLAB-faculty/matlab.R2011b http://www.go2linux.org/sshfs-mount-remote-filesystem-using-ssh Installation of sshfs Get the packages For Debian: apt-get install fuse-utils sshfs For Ubuntu: sudo apt-get install fuse-utils sshfs For Fedora and Centos: yum install fuse-utils sshfs For Mandriva: urpmi: urpmi fuse-utils sshfs Next step is to mount the fuse module[localuser: tanviralam remoteuser: alamt] 1. modprobe fuse 2. Next create the mount point mkdir /home/tanviralam/remote chown [local-user]:[your-group] /mnt/remote-fs/ chown tanvialam:777 /home/tanviralam/remote 3. Add yourself to the fuse group adduser [local-user] fuse adduser tanviralam fuse 4. Untill here all the command should be issued as root, now switch to your users and mount the remote filesystem. sshfs remote-user@remote.server:/remote/direc