Helpful Git Commands

Discard all unstaged changes

git checkout -- . // For all unstaged files
git checkout /path-to-file // To a specific file

Reference: http://stackoverflow.com/questions/52704/how-do-you-discard-unstaged-changes-in-git

Advertisements

Translate Digits/numbers in Drupal 6.x

Hi, first of all, it’s an old tutorial, I don’t use Drupal 6.x any more. Anyway, below goes the procedures.

WARNING: This is done hacking core Drupal files, so be careful when you update Drupal core. All changes might be lost.

Edit file ‘DRUPAL_INSTALL_DIR/includes/common.inc

Add following code snippet at the end of t($string, $args = array(), $langcode = NULL) function:

if($langcode == 'bn'){
return bengaliDigit(strtr($string, $args));
 }else{
return strtr($string, $args);
 }

And define following function somewhere in the page:

function bengaliDigit($numb){
// Credits: Hasan Raihan
$latin = array('1','2','3','4','5','6','7','8','9','0');
$bengali = array('১','২','৩','৪','৫','৬','৭','৮','৯','০',);
return str_replace($latin, $bengali, $numb);
 }

Here, I’m assuming I’m translating English (en) digits to Bengali (bn) Digits.

Automount, Execute or Own File system/disc partition/drive in Ubuntu

Let’s say, you have an NTFS drive which you want to mount automatically every time you boot your Ubuntu machine. In addition, you want to execute files from that drive, or own that filesystem. For all these, you need to modfiy a file located as /etc/fstab

1. Identify the disc partition

Type in terminal:

sudo fdisk -l

This command will output all the partitions. Look a the first column, labelled as “Device”. Let’s say, your desired partition is /dev/sda2

2. Create a directory to mount the partition

You need to create a directory where the filesystem will be available. Typically, these directories are created in /media location. Let’s say,  you want your filesystem to be available at /media/myNewDrive location. So, type in terminal:

sudo mkdir /media/myNewDrive

3. Edit /etc/fstab file

We’re almost done! Type in terminal:

gksudo gedit /etc/fstab

This will open the file for editing. Add a line at the bottom of the file like this:

/dev/sda2    /media/myNewDrive    ntfs-3g    auto,user,exec    0    0

Wondering what it means? Please visit this link, all of the fields (columns –  you can see there are 6 columns in the line above sperated by spaces) are nicely explained. You will need one line like this for each of the partitions you need to automatically mount/execute etc.

4. Save & Reboot…

Save the file & restart your machine to see effects.

To see various options available, study materials at following links.

References

https://help.ubuntu.com/community/AutomaticallyMountPartitions

http://www.tuxfiles.org/linuxhelp/fstab.html

A sample /etc/fstab file

BUET OutOfTheList…

Our team became runners-up in System Design & Development contest, arranged at CSE Festival 2011, at BUET on December 1st, 2011. Thanks to teammates Imran Hasan Hira & Ibrahim Rashid!

Our team name was OutOfTheList 😛

Here are some photos, thanks to Fahad Shaon vai, I copied the photos from his FB public album 😛

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

These photos were taken at the event of prize giving ceremony, at BUET Auditorium, on December 2nd, 2011.

This is the first time I participated in some competitive inter-university event, so I’m extra-excited. That’s why here goes this blog post!