Tuesday, January 15, 2008

One easy way to transfer files with Gnome

Transferring files from one person to another can be a frustrating process. E-mail won't work for files that are too big; using instant messenger can be problematic if you're using two different clients or someone has a firewall; using something like yousendit is very annoying, etc.

One foolproof way is to use an http server (like apache) and hard link the file you want to send into your apache directory and then send a link to the person. This will work, but it is kind of cumbersome.

If you're using nautilus however, you can install the nautilus-actions plugin (you can get it in ubuntu with sudo apt-get install nautilus-actions). This plugin allows you to add stuff to the right click context menu. Once you have it installed, under Gnome, it should appear under System->Preferences.



In this case, I created an action that uses bash to call a shell script with the argument of the full path of the selected file. (my script is in my home folder, but obviously it can be wherever you want it to be). The Legend button will show you the special variables you can use.

The shell script I wrote is as follows:


if [ -n "$1" ]
then
ln "$1" /var/www/transfer || exit 1 #do the hard link
a=`basename "$1"`
chmod 0744 /var/www/transfer/"$a" || exit 1 #make permissions right
encoded=`echo "$a" | sed -e 's/ /%20/g'` #change spaces to %20
echo http://your_ip_address/transfer/"$encoded" | xclip #copy url to clipboard
fi


It takes the argument of a path to the file, and then hard links it into this folder I created called transfer in my web root (I just did that so that transferred files wouldn't clutter my www root).

Then, it chmods the new link 0777 so that anyone can axess it (ok, it really only needs to be 0700, but whatever).

Then, the spaces are changed to %'sto form a valid url, and the url to the file is put in the X clipboard (if you don't have a static ip, you can write something to get it).

One caveat is that the X Clipboard is kind of weird, you can't ctrl-v from it, instead you must middle click to paste in most Gnome apps... and it will only paste once. I haven't figured out how to put something in the "normal" clipboard, so for now this will have to do.

Now all you have to do to transfer a file to someone is right click on it, select the action you just created, and middle click to paste the url in the IM/e-mail/whatever. Ok, maybe it's not worth it to go through all this trouble, but I thought it was cool...

Thursday, December 27, 2007

lsof for windows

I was on my sister's computer (Windows XP) today because she wanted me to format her new external hard drive for her. Unfortunately, some program prevented me from doing so (it was accessing the device). I disabled the usual suspects (anti-virus, Google Desktop, etc.) but to no avail.

Unfortunately, Windows doesn't have anything like lsof which lets you see which processes are accessing which files. After a little bit of googling, though, I found the excellent Process Explorer. This program was written by Sysinternals (which has since been bought my Microsoft) and gives access to all sorts of useful information. In particular, you can search for a handle (for example, "F:\") and see what process is using what resource (in my sister's case, it was apparently mim.exe, which probably has something to do with MusicMatch or something...)

I wonder why Microsoft doesn't include something like this by default though... (the task manager is woefully inadequate...)

Tuesday, December 18, 2007

Aren't they supposed to be ADDING stuff?

Today, I stumbled upon this list of features removed from Vista. Some of them are understandable (like the deprecation of gopher support... since nobody actually uses that anymore), but others are utterly bewildering.

Some highlights:

  • "Although it is possible to customize the action Windows will take when the hardware Power button is pressed, it is no longer possible to set power options to ask the user every time what action to take upon pressing it. Therefore, selecting a different power action in each case is not possible."
    I hear the next version will randomly choose which action to take.

  • "It is not possible to back up and restore licenses in Windows Media Player 11."
    Sweet, another reason to re-buy content you already own. Again. (Or maybe another reason to steer clear of DRM'd stuff in the first place)

  • "In the Windows Vista version of the Backup application, it is not possible to specify what files and folders to back up and what files and folders are to be excluded. Users can select only document categories to back up. Files from a specific path or over the network also cannot be backed up due to this reason. Backup also does not present a list of files that will be backed up."
    No wonder Vista took so long, they were too busy replacing previously functional components with dog shit.

  • "It is not possible to override AutoPlay by pressing the SHIFT key as was possible in Windows XP, though it can still be disabled through Control Panel."
    Well, hopefully this will convince people to disable AutoPlay once and for all, since it's one of the stupidest things to do security-wise... (Wouldn't a great prank be to burn a picture CD for a friend with an autorun script that deletes all their files? And if they use Vista, they wouldn't have a backup because the backup utility is useless...)

  • "The user interface for advanced file type functionality (such as manually defining a new file extension, defining/editing custom secondary actions for file types, showing extensions only for specific file types, or customizing the icon for file types) has been removed. Windows Vista-compatible applications are expected to use the new Default Programs API which allows per-user file type associations for applications."
    I guess the per-user thing is nice (though shouldn't all such settings be per user anyway? I have no clue if they were like that before or not.) Another plus is that it prevents your roommate from changing your 'My Computer' icon to goatse... in fact that's the only reason I can think of why they might have done this...

  • "The graphical representation and progress indicator of the defragmentation process have been removed from Windows Disk Defragmenter. It is also not possible in the RTM release to manually specify which drives to defragment from the GUI without using the command line defrag.exe utility. Windows Vista Service Pack 1 includes the ability to control which volumes the disk defragmenter runs on."
    Actually, this is a feature in disguise. The more familiar people become with the command line, the more likely they are to move to Linux. At last, Microsoft puts their users' interests in front of their own...

  • "Sound Recorder in Windows Vista can no longer open audio files. Moreover, it cannot save in lossless (uncompressed) WAV format when run without using any switches; instead, it saves in lossy 96 kbit/s WMA format. Only the version of Sound Recorder from the N editions of Windows Vista saves audio in WAV format by default. Also, all the basic audio processing features such as format conversion, sample rate conversion, adding echo, reversing the audio, changing volume and playback speed, splitting, inserting and mixing audio have been removed, as has the graphical viewing of the sound wave spectrum."
    Sound Recorder used to be the shittiest audio program around. Amazingly, they've managed to make it even shittier. I'm impressed.

  • "Support for reading Microsoft Office Word documents (*.DOC) has been removed from WordPad."
    Somewhat understandable, because they probably didn't want to update WordPad to read newer Office formats, but worth mentioning nonetheless..

  • "The Pinball game has been removed."
    Sadly, that was the best game they had...


Fortunately for me, I've switched to an operating system that's constantly gaining features instead of losing them...

Saturday, December 15, 2007

wtf is a command

After a friend said "man wtf" in an IM, I thought it might be funny to type that into my shell and paste the output (never mind that it wouldn't actually be funny). I was expecting something like:

cozzy@localhost: man wtf
No manual entry for wtf

Instead, I was greeted with a man page for a program called wtf, apparently part of the bsdgames collection that I must have installed at some point. Go figure.

[cozzy@localhost ~]$ wtf is this
Gee... I don't know what this means...

Friday, December 14, 2007

Hello World

Yeah, I thought I'd start blogging again. We'll see how long this lasts.

This is my now-defunct previous attempt.