View hidden files and folders in Finder.

OSX Finder is hiding the standard Unix files and folders. You can «Go To Folder…» and type in the name of the «known» folder such as /var/log, but again you will not be able to see the «dot» files. Of course you can use terminal for viewing those files… but come one it is MacOSX!!!

Type at Terminal: defaults write com.apple.finder AppleShowAllFiles -bool true

HTC Legend & HD Mini Available For Preorder

After the HTC Desire Smartphone, online retailer Expansys has also listed two HTC smartphones announced a few hours ago at MWC 2010.
Both the Android-based HTC Legend and the Windows-powered HTC HD Mini have now appeared on the website and it appears that all three models (including the Desire) will be launched on Monday 12th of April.
Unlike the Desire though, neither the HD Mini nor the HTC Legend have their own dedicated website which shows where HTC is hedging its bets. That said, for next generations SIM Free phones, the Legend and the HD Mini are surprisingly affordable.

The first one costs only £400 and apart from its gorgeous looking aluminium body adn the soft rubber at the back, we learn that it will have a RDS FM Radio plus a flash for the camera (which we omitted in our original description).
As for the Mini, it will go on sale for £350. It has a 1200mAh battery, a sensible option given the size of the handset plus the ability to stream video and something called widescreen photo capture.

Backup MySQL Database to a file

Backing up your database is a very important system administration task, and should generally be run from a cron job at scheduled intervals. We will use the mysqldump utility included with mysql to dump the contents of the database to a text file that can be easily re-imported.

Syntax:

mysqldump -h localhost -u root -pmypassword databasename > dumpfile.sql

Example:

mysqldump -h localhost -u root -p2Uad7as9 database01 > dumpfile.sql

This will give you a text file containing all the commands required to recreate the database.

A «live» view of a logfile on Linux

This approach works for any linux operating system, including Ubuntu, and is probably most often used in conjunction with web development work.

tail -f /path/thefile.log

This will give you a scrolling view of the logfile. As new lines are added to the end, they will show up in your console screen.

For Ruby on Rails, for instance, you can view the development logfile by running the command from your project directory:

tail -f log/development.log

As with all linux apps, Ctrl+C will stop it.

Well known but usefull shortcut keys for Windows

Any version of Microsoft Windows

Shortcut Keys

Windows Key + D

Minimizes all windows and shows desktop. Also reopens all windows.

Windows Key + E

Opens a new Windows Explorer window.

Windows Key + F

Opens a new find or search function. Typically done by clicking Start, Find or Start, Search.

Windows Key + L

Locks your workstation so no one can access your desktop without your password.

Windows Key + M

Minimizes all windows.

Windows Key + M + Shift

Reopens all minimized windows.

Shortcut Keys [continued]

Windows Key + R

Opens the run command. Typically done by clicking on Start, Run.

Alt + Tab

Switches between your open windows.

Backup your bootsector

Messing with bootloaders, dual-booting and various other scary processes can leave you with a messed up bootsector. Why not create a backup of it while you can:

dd if=/dev/hda of=bootsector.img bs=512 count=1

Obviously you should change the device to reflect your boot drive (it may be sda for SCSI). Also, be very careful not to get things the wrong way around – you can easily damage your drive! To restore use:

dd if=bootsector.img of=/dev/hda

Transferring files without ftp or scp

Need to transfer a directory to another server but do not have FTP or SCP access? Well this little trick will help out using the netcat utility. On the destination server run:

nc -l -p 1234 | uncompress -c | tar xvfp -

And on the sending server run:

tar cfp - /some/dir | compress -c | nc -w 3 [destination] 1234

Now you can transfer directories without FTP and without needing root access.

Faster Hard drives

You may know that the hdparm tool can be used to speed test your disk and change a few settings. It can also be used to optimise drive performance, and turn on some features that may not be enabled by default. Before we start though, be warned that changing drive options can cause data corruption, so back up all your important data first. Testing speed is done with:

hdparm -Tt /dev/hda

You’ll see something like:

/dev/hda:
Timing buffer-cache reads:   128 MB in  1.64 seconds =78.05 MB/sec
Timing buffered disk reads:  64 MB in 18.56 seconds = 3.45MB/sec

Now we can try speeding it up. To find out which options your drive is currently set to use, just pass hdparm the device name:

hdparm /dev/hda
 /dev/hda:
 multcount    =  16 (on)
 I/O support  =  0 (default 16-bit)
 unmaskirq    =  0 (off)
 using_dma    =  0 (off)
 keepsettings =  0 (off)
 readonly     =  0 (off)
 readahead    =  8 (on)
 geometry     = 40395/16/63, sectors = 40718160, start = 0

This is a fairly default setting. Most distros will opt for safe options that will work with most hardware. To get more speed, you may want to enable dma mode, and certainly adjust I/O support. Most modern computers support mode 3, which is a 32-bit transfer mode that can nearly double throughput. You might want to try

hdparm -c3 -d1/dev/hda

Then rerun the speed check to see the difference. Check out the modes your hardware will support, and the hdparm man pages for how to set them.

Save battery power

You are probably familiar with using hdparm for tuning a hard drive, but it can also save battery life on your laptop, or make life quieter for you by spinning down drives.

hdparm -y /dev/hdb
hdparm -Y /dev/hdb
hdparm -S 36 /dev/hdb

In order, these commands will: cause the drive to switch to Standby mode, switch to Sleep mode, and finally set the Automatic spindown timeout. This last includes a numeric variable, whose units are blocks of 5 seconds (for example, a value of 12 would equal one minute).