Tuesday, May 27, 2008

Comma Separated Numbers

I found a neat little function that will separate large numbers by thousands using a comma or any specified delimiter:

http://api.rubyonrails.org/classes/ActionView/Helpers/NumberHelper.html#M000997

Gotta love RoR... they simplify everything!


W

Monday, May 26, 2008

Ubuntu: .docx files

OpenOffice is amazing when it comes to opening up .doc files created from Microsoft Word. However, there's a slight problem when it comes to opening .docx. Simply put, OpenOffice doesn't recognize it!

Don't worry though... there's always a solution! Check this out and follow the instructions posted by stuporglue.

Enjoy!


W

Thursday, May 22, 2008

Remote Host Identification has Changed

I just reinstalled our main server. When I try to ssh into it I got an error:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that the RSA host key has just been changed.

Please contact your system administrator.
Add correct host key in /home/user/.ssh/known_hosts to get rid of this message.
Offending key in /home/user/.ssh/known_hosts:1
RSA host key for ras.mydomain.com has changed and you have requested strict checking.
Host key verification failed.

-----------------------------------------------------------

The reason behind this is because your local computer still has the old RSA host key stored in /home/your_account/.ssh/known_hosts.

The easiest way to solve this problem is simply delete that file or you can delete the host entry in the file.


Joseph

Saturday, May 17, 2008

Time Ago

Ever wanted to show the user that something happened so many minutes/hours/days/etc ago? Apparently, RoR makes it super simple to do this. There is a method called:

time_ago_in_words

Simply include the time (from now) that you want to calculate - perhaps a created_at/updated_at field.

Easy!


W

Friday, May 16, 2008

Software Freedom Day

September 20th, 2008 is Software Freedom Day! If your interested in promoting and celebrating software freedom, check this out:

http://www.softwarefreedomday.org/


W

Wednesday, May 14, 2008

Alternating Table Row Colours

When listing data out in a table, it's always nice to have alternating row colours. This makes it infinitely easier to scan the table and much more enjoyable.

RoR makes it really simple to alternate row colours. A cycle function is given to aid in this task, and it simply cycles between the values given. By using this, you can specify your alternating class names here.

If you have more than one table, remember to call the reset_cycle function to reset the cycle.

Easy!


W

Saturday, May 10, 2008

VMware Server: Adding a new HDD

I'm running WinXP through VMware Server (as it comes free and is in the Ubuntu repos!!!). It runs really, really well and am completely satisified with it. However, I wanted to add a new HDD to my VM.

Well, I did the obvious, which was to power down my VM and edit the settings. I went to go add a new vitual HDD and pre-allocated it (all the defaults).

I then powered on my VM and lo-and-behold, no new disk! What?!?!?! Well, I found a very nice little tutorial on YouTube that teaches you how to do it properly. Apparently, there's a few extra steps required inside of WinXP to detect and setup the newly added disk:

http://www.youtube.com/watch?v=z3GciNMYLlo

Hopefully, this'll help anyone that is stuck.


W