Friday, May 24, 2013

Free Source Code Hosting for Personal/Business Use

Even as student or  in life time of Engineer we do many things, many great things (hehe), tonnes of projects, seminars etc. and we never know when we might need to re-touch or re-collect the project codes, presentations, latex reports, documents and so and so ... yes storing them on the optical disk or in some back-up drive is good idea but not the great one... we never know when this stuff stop working, after all we built it... isn't it? So you need to put them in place where they never get lost....on SOURCE CODE HOSTING SITES.

So there are many free source code hosting sites out there. Some of them can be used for small businesses for sharing and development, most of them comes with version control tools like mercurial (on of the best and easy). Here I am going to introduce you to some of them.


  1. Bitbucket:
    This is the one of the best source code hosting site suited for small business and of course for personal use too, its closed source site, no one can peek into your repository. For business purpose you can share any repository between FIVE users for free. You need to pay for more than five users. It comes with mercurial and git version control tools. Only disadvantage is that, if you are going to develop some open source tool/project you cant put good wiki pages related to your project.



    Advantage: Closed source code, no one can peek into your code, professional tool
    Disadvantage: No good wiki support
    Version Control: Mercurial, Git
  2. CodePlex:
    This is Microsoft's code hosting site. This is having most elegant interface and awesome wiki support. It also has best code sharing, discussion forum support. It has all facilities that person/group need for open source project development.
     

    AdvantageBest suited for open source projects. It has wiki, forum, sharing support, elegant design.
    DisadvantageYour code might not be closed.
    Version Control: Mercurial, Git
  3. Google Code:
    As can be seen from name itself, its service provided by Google. It also has good facilities, but interfaces are not that good. CodePlex is better than this, which provides same (more) services in elegant way. But one advantage is that, its linked to your Google mail account.


    AdvantageGives all basic tools with simple interface. Linked to your Google account, wiki support.
    Disadvantage: Interface is simple, your code might not be closed.
    Version Control: Mercurial, Git


So, in short if you are looking for personal, closed source backup tool or small business source sharing tool BitBucket it best suited for you. If you are open source enthusiast CodePlex is best suited. Google Code is just an alternative if you are looking for...

Cheers !!! 

Thursday, May 23, 2013

Create your own Linux (custom) commands

Hi,
Most of the time we need to use some commands repeatedly while working. It's just annoying to type them again and again, of course we can use reverse search [ctrl+r] for reverse command search but I am lazier than that ;)

Here are couple of ways to customize (or get more lazy) Linux commands,

  • Use Aliases to Customize Linux Commands:

This is actually for small commands (can be used for large ones also). You can set it in terminal as bellow,
 $alias ll='ls -l'  

Now onward whenever you execute 'll' command it will work as 'ls -l', so simple.

Another way is to add aliases in .bashrc file in your home directory so it will become permanent.
e.g. put following at end of ~/.bashrc

 # Aliases:   
 alias ll='ls -l'   
 alias la='ls -a'   

  • Write shell scripts for your commands:
This is when you need some larger scripts as your shorten command. In this case you can write script and put them under bin directory in your home directory. You also need to give exe permission to the script.

e.g  I want to make following script as my Linux command. This script initializes the current directory as root for  cscope and also creates cscope database for recursive directory structure,

 #!/bin/bash    
 # cscope_init script   
 # Creating cscope database for large project    
 # with recursive deirectory structure    
 # First go to root dir of the source code    
 # Run this script - cscope_init $PWD   
 if test $# -ne 1; then    
  echo "usage - $0 <PROJ_ROOT>"    
  exit 1    
 fi    
 echo "PROJ_ROOT - $1"    
 cd /    
 find $1 -name "*.[ch]" -o -name "*.asm" > $1/cscope.files    
 cd $1    
 cscope -b -q -k    
 echo "Done!   
write this script to cscope_init file, and add permission to execute it.

 $chmod +x cscope_init   

Now copy this file to ~/bin/cscope_init. Now onward you can run following command in any directory to create recursive cscope database for that directory,

 $cd /path/to/project/root/directory
 $cscope_init $PWD  

Result,
 PROJ_ROOT - /path/to/project/root/directory   
  Done!   

Done!!!!!!

Sunday, April 28, 2013

Monitoring dynamic changes in dmesg

By running following command in terminal allowes you to monitor dynamic changes in dmesg.

 $ watch "dmesg |tail -15"  

Saturday, April 27, 2013

Resizing the image and convert between image format

Use the convert program to convert between image formats as well as resize an image. It has ability to crop, change aspect ratio of image etc. 

Resizing image to exact size:

 convert <input_img> -resize 300x200^ -gravity center -extent 300x200 <output_img>  

Monday, August 6, 2012

Failed to read NTFS $Bitmap: Input/output error

  • ERROR:
    Error mounting /dev/sdb2 at /run/media/user/Study: Command-line `mount -t "ntfs" -o "uhelper=udisks2,nodev,nosuid,uid=1000,gid=1000,dmask=0077,fmask=0177" "/dev/sdb2" "/run/media/user/Study"' exited with non-zero exit status 13: ntfs_attr_pread_i: ntfs_pread failed: Input/output error
    Failed to read NTFS $Bitmap: Input/output error
    NTFS is either inconsistent, or there is a hardware fault, or it's a
    SoftRAID/FakeRAID hardware. In the first case run chkdsk /f on Windows
    then reboot into Windows twice. The usage of the /f parameter is very
    important! If the device is a SoftRAID/FakeRAID then first activate
    it and mount a different device under the /dev/mapper/ directory, (e.g.
    /dev/mapper/nvidia_eahaabcc1). Please see the 'dmraid' documentation
    for more details.
  • REASON:

    This is due to fragmentation problem of the NTFS partition
  • SOLUTION:
    • Windows - Run command prompt in Administrative mode
      run following command:

      chkdsk /r f:
      (help - command manual )

      (if partition is "F")
    • Linux (fedora/ubuntu) - install "ntfsprogs" package
      Run following command:
      $ ntfsck /dev/sda1    #If your partition is /dev/sda11






     

Friday, July 27, 2012

samba share - ctags: Warning: cannot open source file "directory" : Value too large for defined data type

  1. Reason: Samba share mounted from windows in linux (fedora) may be read-only check in windows by going to properties of folder.
  2. Solution: if its marked as read-only, un-check box.
  3. fstab: add following lines at end of your /etc/fstab file
 //server/share_name    /path/to/mount/point  cifs rw,uid=1000,gid=1000,credentials=/home/user_home/smbcredential_file,dir_mode=0755,file_mode=0755  0  0  
  1. details: add your credentials to smbcredentials_file:
 username=server_username  
 password=server_password   

Wednesday, July 25, 2012

openGL : Fedora 17 : undefined reference to symbol 'cos@@GLIBC_2.0'

  1. ERROR:

    gcc wave.o -o wave -I/usr/include -L/usr/lib -lglut -lGL -lGLU -lX11 -m32
    /usr/bin/ld: wave.o: undefined reference to symbol 'cos@@GLIBC_2.0'
    /usr/bin/ld: note: 'cos@@GLIBC_2.0' is defined in DSO /lib/libm.so.6 so try adding it to the linker command line
    /lib/libm.so.6: could not read symbols: Invalid operation
    collect2: error: ld returned 1 exit status
  2. Solution:
    Add '-lm' flag while compiling.

    gcc wave.o -o wave -I/usr/include -L/usr/lib -lglut -lGL -lm  -lGLU -lX11 -m32