Posts

I'm Learning JavaScript!

I’ve finally learning about JavaScript after listening to the Google TechTalk, Doug Crockford: JavaScript: The Good Parts . Here are my first couple of test scripts. I’m using Rhino for runtime and JSLint (obviously) to check the code. Through these code examples I learnt a lot, about the tools, the language and how to integrate it to do useful stuff. It is early days, but I can see JavaScript being a valuable instrument in my tool box! Example 1 - Random Digits Here is a simple command line script to produce random numbers from 0 to 9. The first two lines are pragmas passed to JSLint. /*jslint indent: 4, maxlen: 80, rhino: true */ /*global java*/ // returns a semi-random digit between 0 and 9 function getRandomDigit() {     'use strict' ;     return Math.round(Math.random() * 9); } // example using array var digitName = ( function () {     'use strict' ;     var names = [ 'zero' , 'one' , 'two' , 'three' , ...

How To Upgrade Linux Mint Debian Edition

Upgrade I recently had to perform upgrades for multiple machines from Update Pack 4 to Update Pack 5 . It was really rather easy to do as the following instructions show. Thanks to this blog for correcting some of my mistakes. Update the Update Manager The update manager will indicate when updates are available. For a distribution upgrade like Update Pack 5 , I revert to command line. Use CTL-ALT-F1 to switch to a native console session. Then update the update manager with the commands sudo apt-get install mint-debian-mirrors sudo apt-get install mintupdate-debian sudo apt-get --fix-missing --list-cleanup update sudo apt-get install mintupdate-debian Run Distribution Upgrade So, now we are ready to perform the upgrade with sudo apt-get --fix-missing --list-cleanup update sudo apt-get dist-upgrade Questions Asked During Upgrade Questions will be asked during the upgrade. If you have a default installation you can normally use the package...

Using True Type Fonts in XTerm

Image
I’ve not had to use TrueType fonts before as my desktop display resolution never warranted it. Now with eyesight failing and much better monitors, I decided to give them a go. Fonts are globally managed by settings in /etc/X11/app-defaults . However, TrueType fonts can be locally set in  ~/.Xresources . To browse the list of fonts use: fc-list :fontformat=TrueType -f "%{family}\n" | sort -u | less Test a font by specifying in the xterm command using the -fa option: xterm -fa 'Luxi Mono' -fs 10 Where fa refers to the fonts face name, and fs , the font size. Once happy with your font, apply to your application in ~/.Xresources. For example to apply for XTerm : ! my customisations XTerm*faceName: DejaVu Sans Mono XTerm*faceSize: 11 The final step is to set these resource changes using xrdb : xrdb -merge .Xresources So, next time you invoke a plain xterm command you will be greeted with your new font.

How To Generate SSH Keys for automatic login to target host

To Generate Key On source host run ssh-keygen(1) ssh-keygen -t rsa -b 2048Take defaults on prompts. This will generate two files in .ssh .ssh/id_rsa.pub .ssh/id_rsa Copy these from source to target host with cat .ssh/id_rsa.pub | ssh user@target "cat >> .ssh/authorized_keys; chmod 600 \ .ssh/authorized_keys" Now you can login without password from source to target using ssh target References http://www.openssh.org/manual.html http://www.wikihow.com/Use-SSH http://en.wikipedia.org/wiki/RSA_(algorithm)
Image
GPS Information in photos I got a post today asking I had no idea this could happen from taking pictures on the blackberry or cell phone. It's scary. http://www.youtube.com/watch? v=N2vARzvWxwY The short answer is, yes if you have location services switched on then photo's you take can include that information. How detailed is it? And how can you use it? As an example consider this photograph, It contains a metadata including GPS properties. I used ImageMagick to extract the following, Image: CameraZOOM-20120215124309832.jpg Format: JPEG (Joint Photographic Experts Group JFIF format) Class: DirectClass Geometry: 1944x1944+0+0 Resolution: 72x72 Print size: 27x27 Units: Undefined Type: TrueColor Endianess: Undefined Colorspace: RGB Depth: 8-bit Channel depth: ... Image statistics: ... Page geometry: 1944x1944+0+0 Properties: ... exif:GPSAltitude: 0/1 exif:GPSAltitudeRef: 0 exif:GPSDateStamp: 2012:02:15 exif:GPSInfo: 302 exif:GPSLatitude: 37/1, 48/1, 58099/1000...

Linux Mint on HP Mini 110

Image
I have a little experimental machine for playing with different distributions.   Lately, the  HP Mini 110-1081TU  has been running MeeGo . Now it has been commissioned to run Linux Mint . This comes in a variety of flavours. The one reviewed here is Linx Mint Debian 201109 . While the download was a monstrous 1.1G, the installation is the fastest I've ever seen. It literally took 10 minutes!  Post Installation - Wireless This is where the fun begins. First off, I had trouble getting wireless to work.  Reading dmesg gave very helpful instructions.  Read the recommendations carefully! Doing so can save you much time and effort. The HP Mini 110 uses a Broadcom 4312 WLAN . Install the packages b43-fwcutter and firmware-b43-lpphy-installer . I recommend the  Linux Wireless page as it has exceptionally good documentation. Post Installation - Sound Sound quality is actually better than under previous Linux distributions I've tried. So I wa...

The zypper Package Manager

Zypper is the package manager used by MeeGo. And now had some time to work with the zypper package manager I can say this is a nice tool. It has good functionality, a consistent interface and is easy to use and well documented. In comparison to apt-get I'd say it is superior. That is a big admission for a long time Debian user! What won me over was when I tried unsuccessfully to upgrade from MeeGo 1.2.0 to 1.2.8, by adding the repositories. Xorg was broken. I tried to fix. But gave up so decided to revert back. I thought this would take a re-installation. But, no! I just removed the offending 1.2.8 repositories and refreshed. Zypper correctly indicated the downgrade. After some network issues, resiliently managed by zypper, I was back and running. Marvellous! So, while I only be using MeeGo on my netbook, I am now comfortable enough in its use and management to use it as an alternative to Ubuntu. The other advantage I see is professionally it is good to understand how alternate sys...