RSS
 

C++: Convert int to string

24 Jul

This is an elegant function to convert int to string to use anywhere:

std::string intToString(int i)
{
    std::stringstream ss;
    std::string s;
    ss < < i;
    s = ss.str();

    return s;
}
 
No Comments

Posted in C++

 

Ubuntu: Two or more plots in the same windows

15 Jul

The mode is called MULTI-PLOT.

Gnuplot can plot more than one figure in a frame ( like subplot in matlab ) i.e., try:

set multiplot; # get into multiplot mode
set size 1,0.5;
set origin 0.0,0.5; # The upper plot
plot sin(x);
set origin 0.0,0.0; # The bottom plot
plot cos(x)
unset multiplot # exit multiplot mode

 
No Comments

Posted in Ubuntu

 

Ubuntu: Convert ogg to avi

15 Jul

Most of the time, I record with recordMyDesktop which produces .ogg-Videos. So any need to convert it to avi file to share the screen-cast.
First you need memcoder, so install it:
sudo apt-get install memcoder
Next use this commend:
mencoder out.ogg -o out.avi -oac mp3lame -ovc lavc

  • out.ogg is the .ogg-file you want to convert
  • out.avi is the .avi-file you want to create
  • mp3lame is the used audio-codec (here mp3)
  • lavc is the used video-codec (here libavcodec)
 
No Comments

Posted in Ubuntu

 

Ubuntu: Mount a FTP account as a folder

13 Jul

To keep all my data synchronized between my machines and also have version of them in the same time without having an public svn repository. I use my ftp account as a repository for my local svn server. So my svn server is just an engine which store data on FTP mounted folder. I covered the method to install SVN server in other post and today I want to introduce the FTP mounting as a folder. The used tool is curlftpfs.

1. If you don’t already have curlftpfs installed, install it with
sudo apt-get install curlftpfs
2. Replacing the appropriate settings, mount the share with
sudo curlftpfs -o umask=0777,uid=1000,gid=1000,allow_other ftp://username:password@your.ftpserver.com /media/ftpfolder
Make sure that the location to mount to is already created and readable and writable by all users.
3. To make this permanent, add it to the end of /etc/init.d/rc.local to be able to access the share after reboot. Other option is to add it to ~/.bashrc. It is your choice

It is a bit slow but it works!

 
No Comments

Posted in Ubuntu

 

Type in roman letters and send in arabic

12 Jul

Even you don’t have an arabic keyboard, you can right in roman letter and send in arabic. This service is now available from Microsoft!. The name of the service is MAREN.
Check this link.