Thursday, January 20, 2011

VIM Config File

Finally I was able to change the vim configuration file in windows (yes it exists in windows too psss - even i didn't know :) )

To configure your configuration file open gvim (graphical vim) and type
(NOTE : Don't Type ESC OK!!)

ESC :e $MYVIMRC

it will edit your vimrc file (configuration file)

Paste the code below
-------------------------------
if has('gui_running')
  set guifont=Lucida_Console:h16
  set noerrorbells
 
  if has('autocmd')
      autocmd GUIEnter * set vb t_vb=
  endif

  set backspace=indent,eol,start
  fixdel

  syntax enable
  set number
  set autoindent
  set tabstop=4

endif


-----------------------------------
ESC :wq

and Volla!! Restart your Vim and you will see the changes.

The above code will fix :-

  1. Font Size
  2. No More Annoying Beeps (trust me you dont want to hear after some time)
  3. Shows Line Number next to each line very helpful.
  4. Fixes Your backspace key to work, (originally it doesnt work :o )
  5. A little bit of indentation to the line so the lines are more readable.

It took me a few hours to do this, hope you guys save your time. I'll keep updating the code here whenever I find more cooler configuration settings, so keep checking..

Cheers!! :)

Thursday, January 13, 2011

HOWTO Install VMWare Tools in Backtrack 4

Hi,
Finally I was able to install VMWare Tools

Here's what you do.

To install VMware Tools in a Linux guest
1. On the host, select VM > Install VMware Tools.
If an earlier version of VMware Tools is installed, the menu item is Update VMware Tools. If the current version is installed, the menu item is Reinstall VMware Tools.

2 On the guest, log in as root.

3 If your Linux distribution does not automatically mount CD-ROMs, mount the VMware Tools virtual CD-ROM image.

a. If necessary, create the /mnt/cdrom directory:
mkdir /mnt/cdrom


b Mount the CD-ROM drive.
for backtrack 4 -> do ls and see if its cdrom3. For me it was cdrom3.

mount /dev/cdrom3 /mnt/cdrom


4 Change to a working directory (for example, /tmp):

cd /tmp

5 If a previous installation exists, delete the previous vmware-tools-distrib directory.
The location of this directory depends on where you placed it during the previous installation. Often it is placed in /tmp/vmware-tools-distrib.


6 Uncompress the installer:

do tar zxpf /mnt/cdrom/V and tab it will automatically show you the actual file.

exact command is
tar zxpf /mnt/cdrom/VMwareTools-<x.x.x>-<yyyy>.tar.gz
The value <x.x.x> is the product version number and <yyyy> is the build number of the product release.

7 If necessary, unmount the CD-ROM image.
If your Linux distribution automatically mounted the CD-ROM, you do not need to unmount the image.
umount /dev/cdrom

8 Run the VMware Tools installer.
cd vmware-tools-distrib
./vmware-install.pl

Just Press Enter to accept the default value. Dont worry about what is being asked for now :)
The configuration file, vmware-config-tools.pl, runs after the installer file finishes running.


And you are done!! :)

Cheers!!

Friday, November 5, 2010

Project Euler

I recently landed on a site which gives you really awesome mathematical problems to solve. It is up to you to select the way you solve it, by hand/calc or by any one of the programming lang or any other way....

The idea is to come up with an algo in head or programming lang, and get a soln to it.
Now what facinated me is the fact that the problems are of such good level that not only it requires thinking, but also it requires some amount of search on mathematical ideas....

To give you an idea here's a Puzzle from the site :-


Q. A Pythagorean triplet is a set of three natural numbers, a < bc, for which,
a2 + b2 = c2^()^()^()
For example, 32 + 42 = 9 + 16 = 25 = 52.^()^()^()
There exists exactly one Pythagorean triplet for which a + b + c = 1000.
Find the product abc.

 
( SPOILER ALERT )

Now I didn't know how to approach the problem at first.... I scribbled a bit, trying to reduce the number of parameters to two, but couldnt find a neat way...

Searched a bit, I found that the basic Pythagorean triplet is 3,4,5. If you multiply by a number n to all, for ex = 2. The new triplets are 6,8,10. If you check them they satisfy....

So i thought ok, the numbers are n ( a + b + c ) = 1000 where a, b, c
Thus n * 12 = 1000
n = 1000/12 = 83.333333333333333

Stumped!

Now what? N is not an integer!!!

Tried many combinations, realized that this method will not work....

Searched more.... and found an elegant way finally

for +ve integers of m, n where m < n
  • a = n2 - m2
  • b = 2nm
  • c = n2 + m2
Hence the new Equation becomes =>
n2 - m2 + 2nm + n2 + m2= 1000hence by solving it further,
n * ( m + n) = 500

If you put this eqn in Wolframalpha it will give you many soln, the ans you are looking for is both +ve, hence 20,5
Put the value and you get your ans....

Such Elegant way of learning not only maths, logic, but how to come up with algo....

Wish math was taught to me in this way, wouldn't have flunked my M3 exam and got a year down cause of it (yeah i have my m3 exam in a month).... 

Seeing all the great research, all the great discoveries, I have realized that Math is a very important field and should to be taken seriously... Maybe its a bit late but I think i'll try improving my basics and thinking of math slowly but steadly....
Go ahead and enjoy the world of math and logic...
Here's the link
This blog post is quite helpful for those who are serious at trying the problems or already are...