My Writings. My Thoughts.

Download folder with all of its subfolders using FTP

// July 2nd, 2009 // No Comments » // tips

Connect to the host.

[promt] ftp <hostname>

Set mode to binary
ftp> binary

cd to the directory to be download
ftp> cd /folder/to/download/

Get rid of comfirming every transfer
ftp> prompt

Download folder and its subfolder
mget *

Project Euler – Problem 5

// June 30th, 2009 // No Comments » // project euler, ruby

Project Euler 5

Project Euler 5

Ok. I have to admit this took more time in getting there.

I did not want to brute force the answer and I did not remember how GCD is calculated.

I do like that looping – its sort of fancy – but am afraid I wont be using it any time soon, if ever.

Project Euler – Problem 4

// June 29th, 2009 // No Comments » // project euler, ruby

Project Euler 4

Project Euler 4

After a while I had time to play around with Project Euler again.

This is again a pretty straightforward solution. The ruby value from this exercise is that I found ruby does not have increment or decrement operator, which is a departure from C and Java. The argument for this design decision is here.

The only hint I think may be useful for someone just stuck at what looks like a pretty good palindrome is that look at your loop again may be there is a greater number that you never reached because you broke the loop.

By the way, this is a great resource for ruby newbies like me!