Saturday, January 22, 2011

The reason this blog has been inactive

My frustration for Ubuntu came from not being able to use Microsoft Word, which is the bread and butter of my student life. I tried Wine. It did not work properly and the format came undone. I spent about a week trying to fix this, but with no success. I also tried using OpenOffice, but there are just too many things not available/different. At the moment I am using VMWare to run Mint Linux. And I must say, not doing anything tweaking improves my productivity. I might get active again with this blog if I do anything interesting, or something rekindles my love for Ubuntu.

Sunday, November 7, 2010

Windows 7 Snap in Ubuntu

There were couple of scripts out there, but they didn't work for me. So here is the code that will work on any system with Compiz Config Settings Manager. Usually, if you have unity and not running it on VM machine, there is functionality call 'grid' that you could use instead.

First install wmctrl
sudo apt-get install wmctrl

Save these files as left.sh, right.sh, full.sh, or however you like it.
#!/bin/bash
WIDTH=`xdpyinfo | grep 'dimensions:' | cut -f 2 -d ':' | cut -f 1 -d 'x'` && HALF=$(($WIDTH/2)) && wmctrl -r :ACTIVE: -b add,maximized_vert && wmctrl -r :ACTIVE: -e 0,0,0,$HALF,-1

#!/bin/bash
WIDTH=`xdpyinfo | grep 'dimensions:' | cut -f 2 -d ':' | cut -f 1 -d 'x'` && HALF=$(($WIDTH/2)) && wmctrl -r :ACTIVE: -b add,maximized_vert && wmctrl -r :ACTIVE: -e 0,$HALF,0,$HALF,-1

#!/bin/bash
WIDTH=`xdpyinfo | grep 'dimensions:' | cut -f 2 -d ':' | cut -f 1 -d 'x'` && HALF=$(($WIDTH)) && wmctrl -r :ACTIVE: -b add,maximized_vert && wmctrl -r :ACTIVE: -e 0,0,0,$HALF,-1

open up CompizConfig Settings Manager:
click on commands, it should be the first item on it:
Make commands to point where the scripts are, for example, mine shows:
Command line 0: /home/john/scripts/left.sh
Command line 1: /home/john/scripts/right.sh
Command line 2: /home/john/scripts/full.sh

Go to the next tab 'Key Binding' and change it to the key you like
Mine is:
Left
Right
Up

Note that the resizing does not work if your screen is full.
It works funny if you have a dual screen.
As far as I know, there isn't a script online that solves this problem.
If you know how to find the screen coordinate for each monitor, let me know.

But I recommend you guys to try out awesome Windows Manager, that is the one I am using.

Friday, September 24, 2010

Using evince (or acrobat reader) to read pdf in your web browser

I use google chrome so when I open pdf files, it usually opens in Google doc.
But when I try to open pdf file that is stored on my computer. (i.e. my lecture notes) through my web browser, it gets downloaded. It's not a big deal, but every seconds of my life is precious. So here is the fix that will allow you to open pdf embedded in your web browser. I tested this on my Google chrome, but I believe it will also work on firefox.

1. sudo apt-get install mozplugger
2. sudo gedit /etc/mozpluggerrc
3. Add following line:
repeat noisy needs_xembed swallow(evince) fill: evince "$file"
below these lines:
...
text/pdf:pdf:PDF file
text/x-pdf:pdf:PDF file

Mine looks like this:
application/pdf:pdf:PDF file
application/x-pdf:pdf:PDF file
text/pdf:pdf:PDF file
text/x-pdf:pdf:PDF file
repeat noisy needs_xembed swallow(evince) fill: evince "$file"
ACROREAD()
repeat noisy swallow(kpdf) fill: kpdf "$file"
repeat noisy swallow(Xpdf) fill: xpdf -g +9000+9000 "$file"
repeat noisy swallow(okular) fill: okular "$file"
GV()
repeat noisy fill exits: evince "$file"

Note: in web browser, evince won't let you go through pages with Page Up or Down. And if the size of pdf file comes out to be like thumbnail size. Just press F5 to refresh and the evince will render fine.

If you like to use acrobat reader instead, skip step 3 and have acrobat reader installed. But evince will definitely use less resources.

Friday, August 6, 2010

Installing RescueTIme on Ubuntu 10.04

RescueTime is a great time tracking program that beats pretty much any other free programs out there hands down. I use it on my Windows 7 OS, but using it on Ubuntu took me some toll.

WARNING: I don't know how to uninstall RescueTime.

0. Sign up RescueTime account if you have not done so.
You can sign up with your google account.
1. Have firefox and RescueTime add-on installed. You can erase these two after you are done installing.
2. Download RescueTIme Linux Uploader (I am using v.99)
3. Unzip the file and open the terminal to that folder.
i.e. cd ~/Downloads/rescuetime-linux-uploader-99/
4. Run these commands on terminal one at a time
python setup.py build
sudo python setup.py install
5. Now the problem that occurs in Ubuntu 10.04 as oppose to Ubuntu 8.04 is that the files get installed on /usr/local/bin as oppose to /usr/bin. And we will fix that problem by making hard links.
sudo ln /usr/local/bin/rescue* /usr/bin/
6. Run the following command and type your username and password. (From step 0)
rescuetime_linux_uploader
7. Now we will make it run automatically when the computer boots up
On terminal, type: gnome-session-properties
or Go to the menu System >> Preference >> Startup Applications
Click "Add"
Name: RescueTIme
Command: /usr/bin/rescuetime_linux_uploader
Comment: type whatever you like
Click "Save"
8. Add applet on the gnome panel by right clicking and click, "Add to panel"
Type "rescue" on the search bar on top and you should see:
RescueTime Controller Applet
RescueTIme Information Applet
The first one just puts the icon which gives you options when you right click it.
The second adds the functionality of displaying what RescueTime is recording. If the recording just shows "Idle", then restart your computer and things should work alright.

Wednesday, July 28, 2010

Installing the latest nVidia driver on Ubuntu 10.04

I updated my kernel and I had to update my nVidia driver again. (One of these days, I will come up with a bash script to automate this)

If you just want to install driver that works, just go to
System > Administration > Hardware Drivers
and follow the instruction.

If you want to install the latest one. Here is the step
1. Download the driver from nVidia website (I am going to assume you are downloading to Download folder)
2. Open up virtual terminal by pressing Ctrl+Alt+F1. If you just see a black screen. Go back to the desktop by pressing Ctrl+Alt+F7 and follow this post.
3. stop your graphic user interface, gnome by
sudo /etc/init.d/gdm stop
4. You might get a bunch of error messages. Type Ctrl+Alt+F7 to check if gnome has shutdown. Type Ctrl+Alt+F1 to switch back to the virtual terminal.
3. cd ~/Download/ (this is where you downloaded the file from the website)
4. sudo sh NV
type Tab to complete and enter
5. You should be able to follow the instruction and finish the setup now.

6. But if you get this message: NVIDIA driver install - Error: Unable to find the kernel source tree. This command will fix the problem:
sudo apt-get install linux-headers-`uname -r`

You still might get an error message like:
ERROR: File '/usr/lib/xorg/modules/extensoins/libglx.so' is not a symbolic link.
But you will be fine and the installation will complete.

Fixing virtual terminal on Ubuntu 10.04

Ctrl+Alt+F1 usually gives you a virtual terminal. But with grub2 on Ubuntu 10.04, something funny is going on and it gives you a blank screen as oppose to a virtual terminal (tty)
Here is how you fix it.

sudo nano /etc/grub.d/10_linux
Go to line 95 and find: linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
change linux to linux16
linux16 ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
Go to line 105 and find: initrd ${rel_dirname}/${initrd}
change initrd to initrd16
initrd16 ${rel_dirname}/${initrd}
Save and exit (Ctrl+o, Ctrl+x)
sudo update-grub

I had a solution for 9.10, but this solution works for both 10.04 and 9.10. Keep in mind that vga= option is now deprecated.

Friday, July 23, 2010

No Namoroka or Shiretoko, My old Firefox please!

If you see a blue orb and no fox on the icon, and your flash stops working, you are using an incremental release of firefox. You want your old Firefox back, here is how:
"System >> Administration >> Software Sources >> Other Software" and disable the
ubuntu-mozilla-daily ppa

Then type these in the terminal:
sudo add-apt-repository ppa:mozillateam/firefox-stable
sudo apt-get update
sudo apt-get upgrade