Lazy Hacker Babble

Just some random babblings from a lazy hacker…

Archive for the 'Windows' Category

2009 OS of the Year… LINUX!

Posted by hsin on 1st January 2010

Looking back on my computer usage this past year, I realized that I’ve stopped using Windows. For the first time, I don’t even have a Windows computer at work. Having mostly used DOS/Windows (usually along side a linux server) for so long I didn’t expect that my usage to stop so quickly, but before I knew it I was doing everything I needed to do on another OS. One of the key changes that I made that contributed to being able to stop using Windows is that I stopped PC gaming. However, I would have expected that OSX would have been the primary OS following Windows (especially since I replaced my main Windows machines with a MBP), but the work horse OS that I used the most turned out to be Linux. Where consumer apps on Linux used to lag behind Windows and OSX, developers are now building them for Linux including media players (VLC) and programs like Picasa and Handbrake with the arcane interfaces that are often associated with the Unix world. I believe having these types of user accessible applications will drive Linux more then just having windows/osx-like window managers.

Posted in Linux, OSX, Software, Windows | No Comments »

Pretty printing source code

Posted by hsin on 25th November 2009

Sometimes it is just more comfortable reading source code on paper, but printing directly from a text editor often gives an output that is ugly and wasteful. Just try opening up your source code in notepad, textmate, etc. and print. It might look very nice on your screen but on paper the fonts are big with lots of white space.

Printing source code is a different beast then printing narrative text and has some special requirements. The first is to include line numbers for easier reference. Different languages have different formatting and sometimes you want to print with color syntax to help find what you’re looking for. It can also be helpful to print two pages on one sheet so you can see more of the code and reduce paper waste.

On Windows/DOS, programmer editors usually have features for handling these types of pretty source code printing. Strangely, none of the editors I’ve seen on OSX have it (TextMate, Eclipse, Smultron, etc.) and since I’ve been dealing with code more I wanted a solution.

Fortunately, OSX’s UNIX underpinning allows me to use the classic enscript tool to handle this.

 enscript -2 -q -C -Ec –color -f Courier8 -r -p OUTPUTFILE SOURCEFILE
 

This generates a Postscript file (default), with 2 columns (2), quiet mode (-q), line numbers (-C) , using C syntax (-Ec), in color with Courier 8 pt font (-f), in landscape mode (-r) to a file called OUTPUTFILE (-p) from SOURCEFILE.

You can find different language syntax available for the -E option with “enscript –help-highlight” and you can set different output formats besides PostScript with the -W option (i.e. html).

“-p -” will tell enscript to print to stdout so you can pipe it to lpr.

Posted in Linux, OSX, Programming, Windows | No Comments »

Desktop calendars

Posted by hsin on 23rd November 2008

Previously, I talked how I put a calendar on my OSX desktop using GeekTool and the standard UNIX cal program. When my wife saw it, she wanted the same thing on her WinXP desktop and since I’m now starting to use Linux as a desktop I thought I’d do the same thing for it also.

OSX:

Using, GeekTools, I simply had it make 2 shell command calls. The first one is to ‘cal’ which will return the current calendar month. Next, I had it call another shell command to a script I wrote that says:


#!/bin/sh

nextmonth=`date '+%m'`
year=`date '+%Y'`
nextmonth=`echo $nextmonth|sed 's/^0*//'`
if [ $nextmonth -eq 12 ]; then
nextmonth=0
year=$((year + 1))
fi
cal $((nextmonth += 1)) $year

calendar

————————————————–

WinXP:

To do the same thing on WinXP, you need Samurize and Cygwin. Samurize provides the ability to display output on the desktop like GeekTools and Cygwin will provide the cal program. When installing Cygwin, however, make sure to select the package linux-util because it is not installed by default.

A slight modification to the script is needed in order to run a shell script from outside of Cygwin (such as from the command prompt or “run” from the start menu):


#!/bin/sh
PATH=/cygdrive/c/cygwin/bin
nextmonth=`date '+%m'`
year=`date '+%Y'`
nextmonth=`echo $nextmonth|sed 's/^0*//'`
if [ $nextmonth -eq 12 ]; then
nextmonth=0
year=$((year + 1))
fi
cal $((nextmonth += 1)) $year

xpdesktop

————————————————–

Linux:

On Linux, the program to use is Conky. Create the following .conkyrc file in your home directory:


# .conkyrc

text_buffer_size 512

update_interval 1.0

double_buffer yes
own_window yes
own_window_hints undecorated, sticky, below, skip_pager, skip_taskbar
own_window_transparent yes

use_xft yes
xftfont Bitstream Vera Sans:size=8

maximum_width 512
default_color white
alignment top_left
gap_x 10

uppercase no

TEXT
${font monospace:size=8}${execi 8600 cal}
${font monospace:size=8}${execi 8600 nextmonth.sh}

linuxdesktop

Posted in Linux, OSX, Windows | No Comments »

VMWare Server 2.0

Posted by hsin on 1st November 2008

Having multiple computers used be almost an necessity for programmers especially for those who deal with the internet/web-based development that requires the product work on multiple browsers and operating systems. Putting multiple OSs on a single computer and booting between them only takes you so far. Because of his, I often found myself with 2-4 machines at any given time. However, with the advance in virtual machine software like VMWare, it doesn’t make as much sense to have many physical machine especially if some aren’t used that often. So this weekend, I decided to start reducing the number of machines I have by converting one of my windows xp boxes into a virtual machine running inside linux.

I went with VMWare Server since it allows me to create a new VM rather then having to use an pre-built image (and MS isn’t going to allow XP images to be handed out). Setting it up on my Fedora Linux machine was as simple as installing the RPM package. Once I did, I just had to create a new VM and boot the XP cd. VMware Serve 2.0 now uses a web-based interface rather its own native stand-alone app. I’m not sure how I feel about this, but it worked okay mostly. Sometimes the web interface responds slowly and it doesn’t seem to start up on server reboots correctly so I have to manually start it.

Setting up windows xp on in VMWare is like setting it up on any computer: put in the CD, start the VM and go through the normal install flow. Since Windows XP have product activation, configure the VM with the hardware configuration you want first (memory size, audio and hardware settings, etc) and then activate the installation. Since activation only check at the time of installation, you can copy the VM image and install different apps on it without having to re-activate.

Posted in Linux, Software, Windows | No Comments »

Playing with Picasa

Posted by hsin on 12th August 2007

On a recent trip to Hawaii, I got introduced to Apple’s iPhoto software on OSX. I thought it was a decent piece of software, but a bit basic for me and there were a couple of minor bugs. My trip did show me that I probably should use something to help me manage my digital photos as my collection has gone past hundreds to thousand(s), so once I got back I tried out Picasa. Picasa is a photo management software that was bought by Google and then released free. I heard good things about it including that it was a better iPhoto then iPhoto. It runs on Windows with a Linux version in beta.

My experience so far with Picasa has been good. It is as simple as iPhoto and has the same basic functionalities. When it is first installed, it asks you if you want it to search your computerfor all graphics files (pictures and movies) or limit the search to the “My Documents” folder. I wish it allowed me to enter a different location since I don’t keep my photos there For some reason, PNG files aren’t enabled by default, so you have to enable that yourself.

Overall, a neat program with a great price. If you take a lot of digital photos and need a quick, fast and easy program to management those photos then definitely give it a look.

Posted in Linux, Main, OSX, Software, Windows | No Comments »

Windows On Mac hardware

Posted by hsin on 6th April 2006

A good move on Apple’s part to release tools letting Mac hardware dual boot either Windows or OSX. One of the reasons for Linux’s early adoption was it’s ability to be dual-booted along with the user’s original OS, so this can encourage more people adopting Macs. However, there is a difference between Linux and Macs. Linux had dual boot because people already had the hardware and wanted a better OS without necessarily having to completely sacrafice the old OS. In this case, people have the OS and software and will be buying hardware to run it. I guess Apple’s hope is that they’ll start trying out OSX and eventually migrate over.

Posted in Main, OSX, Windows | 1 Comment »

Apple switching to x86

Posted by hsin on 6th June 2005

After 10 years (wow, has it been that long?), Apple confirmed the rumor mills and annouced that they have decided to switch over to Intel’s x86 processors from IBM’s PowerPC for its future computers. The first machines to use the Intel processors will be available in 2006.

After all these years, it feels kinda strange to think that Macs will be using an Intel processor. The move doesn’t seem like it will affect IBM as much given the market size of Macs vs IBM’s marketshare in video game consoles (all three next gen consoles uses some form of IBM PowerPC processors) and other embedded devices. What would be interesting is the effect it will have on Microsoft since OSX has really been winning the hearts of many computer geeks and developers with it’s UNIX core and at the same time offering the Apple GUI.

It seems like the line between so many traditional competitors are disappearing these days. When will we be seeing VIEMACS?

Update: Well, Apple says they will not let OSX run on anything other then an Apple/Intel box so they pretty much shot themselves in the foot again.

Posted in Main, OSX, Software, Windows | No Comments »