October 2006

Easy screenshots with the keyboard in Linux

There was an article today at Linux.com that reviews various screenshot programs available for Linux. What it doesn’t tell you, is how to take screenshots painlessly in Linux. Let me try and do that. Since I use a Mac, I’m quite used to the Mac OS X way - Command+Shift+3 takes a full screenshots and leaves a PNG file on your desktop, and Command+Shift+4 allows you to select a region for a screenshot.

Duplicating that in Linux is quite simple. First, you need scrot, a command-line program mentioned in the article linked above. Fedora users can get it through yum (yum install scrot). Otherwise you’ll need to download and compile it.

Next, we need to setup the keyboard shortcuts. I’ll describe this for KDE, but I’m sure there’s an equivalent way to do this in GNOME. In KDE (3.5) go to Control Center -> Regional & Accessibility -> Input actions. Create a new action of type “Keyboard Shortcut -> Command/URL (simple)”. I setup Ctrl+Shift+3 to the command scrot ~/Desktop/scr`date +%d%b%y_%H%M%S`.png and Ctrl+Shift+4 to the command scrot -s ~/Desktop/scr`date +%d%b%y_%H%M%S`.png. See the screenshot below (click for larger image).


Screenshots in KDE

Now, pressing Ctrl+Shift+3 puts a full screenshot on your desktop, and pressing Ctrl+Shift+4 allows you to either select a window (single click in a window) or select a region of the screen (click and drag rectangle) and the appropriate capture will be placed on the desktop. The files are dated and timed, so they should be easy to find.

linux

Comments (4)

Permalink

Fedora Core 6 is out!

Torrents here.

linux
tech

Comments (0)

Permalink

The giant awakens

Apple has been flaunting the advantages of Mac over Windows for quite a while now, be it using the “get a mac” ad campaign or via their cheeky (if not totally irresponsible) comments that Windows security is partly to blame for the virus that shipped with a few fifth generation iPods. Not to mention their prominent WWDC banner advertising Leopard with several juicy slogans like “Introducing Vista 2.0″, and “Hasta la vista, Vista”.

So far, we’ve not seen much in the way of retaliation from Microsoft. And it comes from the expected direction - leveraging their monopoly.

The Mac is clearly attracting a lot of interest right now, with it’s US market share jumping to 6.1%, and all the publicity. And if there’s one thing thats really tempting the Windows crowd, its the lure of Parallels - the virtual machine for Intel Macs that can run Windows seamlessly from within OS X. It’s the dream application for anyone who wants to break away from Windows, but annoyingly needs one or two pieces of software that keep them stuck. Windows runs on Parallels at native speeds allowing you to run any piece of software (except those with intense 3-D requirements) very easily.

Enter the new Vista EULA for the Home editions - both Premium and Basic. Only Business and Ultimate editions will be legally permitted as guest operating systems in any virtualized environment - and of course these two cost far more than their lesser bretheren. This move is clearly the strict schoolmaster’s equivalent of a rap on the knuckles with a wooden ruler for the wayward student. In other words - pointed straight at Windows users who’re considering a switch to the Mac. They probably won’t be able to do anything about Boot Camp, though - which allows you to dual-boot Mac OS X and Windows on an Intel Mac - but it’s a start.

Way to go, Microsoft. Don’t innovate, don’t compete on features or even marketing dollars; just use the good ol’ monopoly. After all, it’s proven to work.

mac
tech

Comments (0)

Permalink

Caught, time and again

Is the solution to this apparent to you?

Given this piece of C++ code:

  // definitions (a and b are primitive types)
  a = b+1;
  if (a == b+1) cout<<"True";
  else cout<<"False";

Under what conditions would the code print “False”?

The answer, when I finally get it, is obvious, but I manage to forget it every time and repeatedly fall into this trap.

programming
tech

Comments (2)

Permalink

Never forget geometry again

<Goat25> what is the volume of a pizza of radius z and thickness a ?
<Goat25> answer: pi z z a

How much better can bash get?

fun

Comments (0)

Permalink

The scariest thing about the Zune

Arstechnica has a preview of the Zune:

on the rear of each Zune, in small inscription on the bottom next to the serial number, is a message: “Hello from Seattle.”

Maybe this is just irrational, Microsoft-dreading old me, but this one really freaks me out!

fun
tech

Comments (0)

Permalink

Windows Vista and software freedom

When you buy Windows Vista, you’ll be purchasing a product that is, to borrow a phrase from the anti-DRM guys, defective by design.

Microsoft announced enhanced anti-piracy measures for Windows Vista today. If Vista detects a pirated computer, it will lock down your system to a reduced functionality mode after a certain amount of time. And lock-down means the following: critical applications like Microsoft Office will refuse to start, and you’ll be limited to browsing the Web for one hour a day. This despite the fact that their current WGA program has been known to produce a high rate of false positives (detecting your software as pirated even when it’s not). And once your computer is locked down, your choices are either to go online and purchase a valid key; or, if you’re running genuine software, prove it to Microsoft support who will then hopefully activate it for you.

For the first time, your computer, all your data on it, and the computer’s very operation are at the mercy of Microsoft. If Microsoft feels that your OS is pirated, you will not be able to edit or view that presentation you were working on - even though that is unequivocally your own work. Whether you have an urgent assignment to submit tomorrow or you’re trying to save a patient’s life now - Vista will not care. And since the company has indicated an intent to deliberately break your system, you depend only on their good will to not interfere more drastically with it.

The dictionary should have a new definition of irony.

In our society, if you’re accused of killing another human being, you’re innocent until proven guilty. If you’re accused of having illegitimate software, you’re guilty until proven innocent.

…I can only show you the door. You’re the one who has to walk through it.

– Morpheus, The Matrix

philosophy
tech

Comments (8)

Permalink

Migrating and backing up subversion repositories

I keep my everything related to my research in a Subversion repository for easy versioning. Originally, the repository was located at a remote server in MIT (to which I have access thanks to SMA). Recently, though, accessing this through the NUS network has become really slow. There’s nothing more painful while doing work than waiting for a svn commit command. So I decided to move my repo to my local (NUS) desktop and have incremental backups on a NUS server. There were a number of ways to do this, and I’m just putting down my approach here for future reference.

On the remote server, get a dump of the repository and copy it to the local machine:

[anshul@remoteMIT]$ svnadmin dump REPOS/research > research.repo.dump
[anshul@remoteMIT]$ scp research.repo.dump anshul@localNUS:~/REPOS/

On the local server, I simply created an empty repo and loaded the dump file:

[anshul@localNUS]$ svnadmin create research
[anshul@localNUS]$ svnadmin load research < research.repo.dump

You can (technically) also copy over the repository directly but that might lead to problems if there is a commit during the migration, and I wasn’t too sure if direct copying would break because I was moving from an AFS filesystem to a ext3 one.

Now for every working copy (laptop, NUS desktop, home desktop) one needs to switch the location:

[anshul@localNUS]$ svn switch --relocate svn+ssh://anshul@remoteMIT/home/anshul/REPOS/research \
file:///home/anshul/REPOS/research .
[anshul@powerbookG4]$ svn switch --relocate svn+ssh://anshul@remoteMIT/home/anshul/REPOS/research \
svn+ssh://anshul@localNUS:/home/anshul/REPOS/research .

That pretty much takes care of the migration. For backups, I used the post-commit hook script mechanism provided by svn. First, make sure the most current dump file exists in a particular location (same dumpfile that was created earlier). Then, I simply created the following file and saved it in REPOS/research/hooks/post-commit:

#!/bin/bash

REPOS="$1"
REV="$2"
DUMPFILE="/path/to/research.dump"
svnadmin dump "$REPOS" -r "$REV" --incremental >> $DUMPFILE

This incrementally dumps every new revision into the dumpfile. Now, it’s simple enough to add a cronjob that periodically backs up the dumpfile either on a local disk or a remote server. I’ve set up a remote backup cronjob at 9 AM every day (statistically, the time I’m least likely commit changes); funny stuff can happen if I’m making a commit (and therefore changing the dump file) and backing it up at the same time.

This issue can be avoided if you put the backup command at the end of the hook script, but my repository is quite large (1.6 gigs as of now) and takes an appreciable time to backup, so I chose not to do that.

tech

Comments (0)

Permalink

Battery back!

Last Friday, after exactly 5 weeks, I finally got my new Powerbook battery. I guess Apple gets their estimates right - they’d said it would take 4 - 6 weeks!

An interesting observation - during the five weeks of torture, I so wanted to buy a new laptop. I was nearly at the edge of putting my Powerbook up for sale and buying either a new Thinkpad or even a Macbook, despite the glossy screen. An inner marketer’s voice seemed to exist in my head to sell all the new “features” which I previously did not particularly care about - like the built in webcams on new notebooks.

The moment I got my laptop battery back - the desires all stopped. Instantly. Reaction to a friend’s Macbook before the new battery - drool, drool, drool. After getting my battery - how could Apple have designed that thing?

Truly telling. Desire can be so totally irrational. All I wanted was to be totally unwired. Nothing as satisfying as typing a post from the comfort of your bed.

mac
philosophy

Comments (2)

Permalink