Monday, December 21, 2009

How To: Sync iPod Touch 2G using VirtualBox on a Linux Host

Well, the last couple of days have been spent setting up a virtual machine running Windows XP for my syncing needs (I usually use my PC for syncing my iPod, since it runs Windows 7, but when on the road, I will only have my netbook, and require some way to sync it). Therefore I always had the Windows XP partition on my netbook, however, I've not booted it since September, and before that I hadn't booted it for about 4 or 5 months. Since I use it so infrequently, I decided to get rid of the waste of space on my netbook and give that extra space to my media partition, my /home, my /, and possibly install a version of Ubuntu for my Full Circle Magazine articles (just to make sure my methods apply to it, etc.). At the writing of this post, the version of VirtualBox I am using is: 3.1.2-1 (virtualbox_bin PKGBUILD off the AUR). Now, according to some sources, the following step is unnecessary for this version of VirtualBox if you run HAL, but I did it and it's what I will probably continue to do. I will also skip the process of installing VirtualBox (Personal Use Binaries), simply because it varies to a large degree.

Preliminary step:
Add your user to the vboxusers group

sudo gpasswd -a $USER vboxusers

This will add your user to the vboxusers group, so that you can access virtualbox (most installations do not do this by default).

Step 1 (optional step):
Add the following to your /etc/fstab file:
none /proc/bus/usb usbfs auto,busgid=108,busmode=0775,devgid=108,devmode=0664 0 0
Since the layout cuts off the end of the above command, it ends with: "devgid=108,devmode=0664 0 0"
Ensure that you change the groupd ID (108) to whatever group ID is assigned to your vboxusers group. You can check this by issuing:
sudo grep vboxusers /etc/group
Once this is set up, you can force the usbfs to mount by issuing the following command:

sudo mount -a
For those of you who don't know, this will mount all filesystems listed in /etc/fstab.

Step 2:
Set up the guest machine. I installed Windows XP into a virtual machine using 384MB of RAM, 16 bit color, and basically the defaults for everything else (since it was running on a netbook). It's up to you what you allocate to the machine.

Once this is set up, install XP, and install iTunes. Before doing anything else, consider how you're going to store your music. I'm not a fan of copying an entire media library to a virtual machine just so I can continue updating it (and I only allocated 8GB to XP), so I decided to set up my iTunes folder as a VirtualBox shared folder. This is great for me, since I have a separate media partition (of about 70GB) with my Music, Movies, Pictures (and some backups) on an NTFS partition for access between the now dead XP install and any install of Linux I may have. Since this is the case, I created a virtualbox share for /media/Media/Music/iTunes/iTunes Music/ (your path will be different). To do this, install Guest Additions, and go to Devices --> Shared Folders. Set up the Folder and make sure you check the box next to "Make Permanent".
Now, in your XP host, right-click My Computer and choose "map network drive". The server is //vboxsvr/sharename (in my case, iTunes, but it will be whatever you chose previously). I mapped this drive to Z:, simply because I will never use that drive letter and so don't have to worry about any changes. Now on the guest machine, open iTunes, accept the license agreement, and head to the preferences (Edit --> Preferences), then open the "Advanced" tab and change the Music Folder to the Z: drive (or whatever letter you chose), and delete the original entry. This means that is should use the shared folder for any new music, podcasts, videos, etc. (I haven't tested that yet though). Once that's done, you need to add all the media to your iTunes.
This can be done by going to File --> Add Folder to Library, and choosing the iTunes Music folder (only if you have used the iTunes 9 way of organizing music, otherwise you may want to choose the parent directory to your podcasts, videos, etc.). Once the import is done (it can take a while), authorize the computer for any iTunes Store accounts you have, and plug your iPod in.

Step 3:
Syncing the iPod. Once you plug your iPod in, the Linux host will take control of it (which is fine). If you installed the guest additions and rebooted the guest OS, you should be able to go to Devices --> USB Devices --> iPod, and choose it. Give it a moment, and XP should inform you it found a new device (iPod), and begin installing the drivers for it. Once this happens, let it install and wait until it appears in your iTunes window. It will then warn you (if it's set to auto-sync), that some purchases are from another iTunes Library, whereupon you want to choose "transfer to PC" (or words to that effect), so that the purchases are synced to the iTunes folder. Once complete, your iPod should sync without a problem and you should be happier with all that free space.

If you want to update the music on iTunes, you should just import the CD/mp3s to the computer, and copy them to either the "automatically add to iTunes" folder, or add them to the correct folder in the Music sub-directory. iTunes may or may not automatically register/add the files (I haven't tested this yet either), but adding it manually is still less work than rebooting and doing it all there then copying it over to Linux. You can also import the CDs via iTunes in virtualbox and see if the CD will be ripped straight into the shared folder.

Hopefully this is interesting to anyone who was thinking of doing the same. I am quite happy (and surprised) to find that this solution works for me, even on my Samsung N110 netbook (1.6GHz intel atom, 2GB of RAM, 160GB hdd, intel 945GME), and frees up some space (about 50GB, since that's what I had left allocated to Windows). The best thing is I can create a backup of the hard disk, and save all my work, or use snapshots (or both). I know that you can probably sync the iPod to some degree in Linux natively, but I prefer having access to the podcasts I subscribe to (revision3 shows and engadget mostly) via iTunes even on the go.

For those who're curious about my partition layout on my netbook, it's as follows:
3GB Recovery Partition (Samsung)
68.36GB for Media
74.68GB Extended partition
  • 15.01GB /dev/sda5 (my arch root partition)
  • 24.44GB /dev/sda6(my arch /home)
  • 964.81MB /dev/sda7 (my swap partition, that I probably don't need).
  • 34.30GB of as-of-yet unallocated space (will probably become a 15GB Ubuntu /, and 14 GB Ubuntu /home, as to protect my theme settings and custom tweaks to Arch)

Thursday, December 17, 2009

View Revision3 shows on your Xbox 360 Via TVersity

Recently I purchased an xbox360 for games + videos (HD playback). After setting up my HDMI to DVI cable to my monitor and the standard TV cable to my speakers, I started trying to figure out how to stream my media (matroska backups of most of my DVDs) to my xbox, I stumbled upon TVersity, which is a free (well, there is a free version) Media streaming server. In order to set it up, I had to do the following:
  1. Remove all my old codecs (mainly just DivX codecs for me).
  2. Install Combined Community Codec Pack
  3. Download and install TVersity. Ensure that you do not install the TVersity codec pack.
  4. Once TVersity is installed, you have to change the following settings:
  • Set Media Playback Device to Xbox360 (optional)
  • Ensure that the "automatically start media server" box is checked.
  • Under transcoder settings, change: transcode: "when needed"; change the maximum video resolution to the largest possible video you'll stream; Change "Windows Media Encoder" to Version 9; Optimize quality; Change WLAN to LAN (if you are on a LAN)
Once you've changed these settings, if you go to your xbox360, and go to the System Settings, and run a network connection test for PCs, and let it wait until it discovers the TVersity server on the PC. If it doesn't work the first time, ensure that your firewall and router allow connections on the port specified in the general settings of TVersity. Once the server is recognized, you're ready to start adding Revision3 shows to your media library on TVersity.

The way I do it, is to head to "RSS and Podcast Feeds" choose "Video Feeds", and use the rss feed of the specific show I want (if you're on the revision3 page for the show, it's listed as "Episode RSS Feed"). Choose the quality/type of video feed you'd like from the list, and copy the URL into a new item in the TVersity rss feeds window. You might want to add tags or titles to the feeds (I just used the names of the shows), in order to keep track of what was there.

Once you've added the feeds, let them sync up (might take a few minutes), and then restart the MediaServer (might not be necessary, but I was required to do it before my xbox could find the feeds). Once that's complete, go to your Videos Library on the xbox, choose the TVersity server on your computer, and head down to "RSS & Podcasts", and choose the show you want to watch. You're then greeted with an unsorted (I can't get it to be sorted by date, but it's probably possible) list of the episodes. If you know which one you want, you can sort by title to find it easier. Choose the video you want to play, and install any new updates (I needed an update for my xbox for mpeg4 HD videos), then sit back and enjoy your show!

Tuesday, December 8, 2009

More Google Wave Invites!

*Update* Google Wave was released to the public, thereby making this thread obsolete.

I got another bunch of invites to send out. In total I have 17 invites to give out. Same deal as the last time. First come, first serve, leave your email address in a comment with an "invite please" (or something like that), and I'll add you. Invites can take some time to be sent out, but it seems to be going quicker these days. Either way, I suggest you don't wait for it, just let it surprise you.

6 of 17 invites remaining.

Friday, December 4, 2009

Apple does it again...

Well, Apple has managed to take senselessness to a new level. I found out today (after deciding I wanted to write a lockscreen application to display a to do list on my iPod touch instead of paying for an application that does something similar) that Apple offers an SDK for Mac OS X only! This raises the question: Why offer iPod/iPhone support for Windows, if you don't plan on letting people develop from that same OS? There is no way I will ever pay for an iMac, Mac Mini, or macbook for the sole reason of developing an application for an iPod. I prefer Linux over Mac OS X, and I prefer Windows 7 over Mac OS X, and I simply dislike Apple's policies about keeping their source closed and the restrictions they place on the user. I can understand, to some degree, WHY Apple does this for Mac OS X, since they need their main income to come from the laptops, but I can simply not understand why you would snub perfectly good developers simply because they don't own a mac machine. If I can't get my iPod to do what I want, I will most likely stop using it for anything but media playback (if that, since I have a SanDisk eSansa 260 lying around somewhere), and will go out and find myself some open-source mobile internet device that allows me to configure it like I want (or actually talk myself into paying for a phone contract with a Droid or something).

Apple: if you want to keep your customers, you have to make your customers happy. This is generally accepted as a good business plan. This doesn't just mean making nice looking devices with "lots of features", but also giving developers the ability to develop for the device, regardless of what OS they run. Heck, if anything, it'll prompt more people to illegally install OSX86 or virtualize Leopard (against the EULA) in order to develop for an iPod/iPhone. I'd probably even be tempted to consider this, if I had enough of an urge to develop for the iPod, but I don't. I just want to tweak one little thing on my lockscreen so that I can view the contents of a to do list file without unlocking the iPod and opening the file, and I can't even do that.

I'm not going to make ranting like this a habit on the website, but I felt that this needed to be said, and I couldn't find any kind of contact email for the dev portion of apple's site, where I could offer my opinion. Oh, and while I'm on about Apple fails, their Black Friday rebate offer came out to something like 13€ off an iPod. If the device costs 180€, the least you can do when offering a rebate is to take 10% off the price! (Excuse me if the numbers are incorrect, I'm going by memory here, but either way, the sentiment stays the same. If you want to offer a rebate, make it one worth considering.)

Anyways, to anyone who reads this: Enjoy your weekend, and, if looking for a new smartphone, do take a look at some of the new Android devices (or the HTC HD2) before looking at an iPhone. What I find Apple does is try to gain the title of "best" and thereby prejudice people into thinking everything else is terrible, which isn't the case. If I were a betting man, I'd say the Android phones will stay up-to-date longer, as there are tons of community developers working on apps and fixes and updates, whereas Apple's iPod is locked in by the restrictions they themselves put on it. Chances are good that Android can outlast iPhoneOS by staying recent and modern, while making good use of the hardware without overtaxing the system (and by running more than one application at a time!). If you want to see how fast Android development is, just compare the T-Mobile G1 with the Motorola Droid (Milestone for us European folks).

Wednesday, November 25, 2009

Google Wave invites!

Well, end of last week I finally got an invite for Google Wave from one of the guys I asked for one from. Actually, I got 2 invites (got the second one a few hours later from someone else), but passed that invite link on to a friend of mine who was interested. However, I have now gotten 8 invites from Google Wave in order to invite new people. I've already used 3 of them for friends of mine that I actually know and who are interested. That being said, I have 5 invites left for people I don't actually know :P I will be updating the count on this blogpost. If you're interested, leave me a comments, with your email address, and I'll add the first 5 commenters to the list (first come, first serve). Keep in mind, it's a beta, and so there ARE issues with the system (slow, lagging, crashing, etc.). However, I haven't had too many problems in the time I've used it.

After I "invite" you, the invitation won't actually be sent until Google deems their system capable of handling more users, and will then manually send out an invite to the people on the list. This means that you should expect delays in the invitation. I got my invite in about 36 hours, but some people have had to wait weeks. There is nothing you can do to speed the process up, just be patient.

Good luck and enjoy,

Invites are all gone. I'll be adding another blogpost when/if I get any more invites to give out.
0 of 8 Invites left!

Tuesday, October 27, 2009

Gnome 2.28

So, it's been roughly a week since I updated my gnome apps to 2.28 off the archlinux repositories. First impression: GDM seems a lot smoother and more "modern" than it used to, however...configuring it these days can be a real pain. You've got to open the gnome-appearance-manager as the gdm user using
gksudo -u gdm dbus-launch gnome-appearance-properties

Which is fine, I guess, except that it overwrites my theme/GTK settings for my openbox setup, and I have to configure it again, unless I use the exact same settings for GDM (which I ultimately decided on doing). So far that's my biggest problem with gnome 2.28. However, I won't be downgrading, since I have configured GDM for the time being and probably won't be changing it anymore. Another issue is that there are random crashes back to the GDM login screen since GDM starts on tty2 now, as it's the first available getty (when GDM starts), and when the tty2 refreshes, it then kicks you off gdm and has it restart on tty7, as it should actually do from the start. I've put a temporary stop to this by commenting out my tty2 getty entry in /etc/inittab, but I'm so used to my X being on tty7 that it's taking some getting used to. But again, I can live with it, I just see no reason why this new behaviour is there. I am also curious why they decided to not include a configuration tool for GDM itself, besides the usual gnome-appearance-manager, it would just make life easier.

Moving away from GDM, I don't really see too many tangible differences in Gnome 2.28, since I run Openbox, and hardly use any gnome apps besides GDM for logging in and shutting down, etc. I've noticed a few layout changes in the Gnome applications that I ended up using to get GDM to work, and they're nothing intrusive or random, and makes, if anything, the user interface more logical. I honestly don't expect there too be too much of an improvement on the interface level until 3.0 comes out, but I could be wrong. In any case, Gnome 2.28 seems to be a nice update for most Gnome-related applications. There are a few showstoppers with GDM (inability to use themes, changing themes results in overwriting theme settings for user account, starts on tty2, etc.). The tty2 problem could be solved by editing the custom.conf, but sadly they dropped support for the [servers] flag, which, again, seems illogical to me. Also, I use lxappearance in Openbox along with Nitrogen, so that the changes to your themes may not occur if you used gnome-appearance-manager to set them as well.

Hope that you find this opinion (it's not a proper review, it's just my impressions on it) useful,

Sunday, September 13, 2009

Kernel 2.6.31-1

Well, time for another update. I thought I'd write up my initial impressions on kernel 2.6.31-1 (from the Archlinux testing repository as of the 11/09/09). I have to say, there are a few things that struck me right off the bat.

Good Things:
- Intel driver performance increased noticeably (smoother, yet cooler), and glxgears (yes, I know it's not a benchmark, but I used it as a comparison check for driver and kernel settings) is up around 280 fps (highest it has ever gone in archlinux).
- Flash videos, while still not perfect, are less jumpy than they were with the old kernel on this netbook (Samsung N110)
- Suspend works (who knows if it's just temporary, but it now works on the Samsung N110, I will post an update with what happens when it moves into the core repository - may be missing a driver or some other updated package)
- It's smoother under heavy load (default configuration, not sure if KMS is enabled or not, I'd say no though, since there's no framebuffer on boot) than its predecessor
- It seems a little bit faster to boot (probably saves about a second or two on boot).

Bad things:
- USB devices aren't working right now (may be because of the fact that I only installed kernel26 and kernel26-firmware from testing, or it's due to an old package that has yet to be updated)
- KMS (as far as I know) still results in no backlight control for this monitor, and that seems to be an intel driver problem.

Overall, I'm happy with the new kernel, even if I can't use usb devices with it for the time being. I'll bet once they move it to core/up the revision to -2, it'll work again.

*UPDATE* USB works again, but I don't think I updated anything for it to work again, it just seems to have decided to be nice again.

Tuesday, September 1, 2009

N110 Scripts

Okay, so I just uploaded all my scripts that I wrote for my N110 netbook (things that I use for audio, wireless toggling, brightness, etc.) to my github.


I will add to it if I write any more scripts, but for the time being that does pretty much all I need (save for a basic few tweaks to other configs, which I'll cover in a post later). If anyone has a request for added functionality, or a suggestion of how to improve a script (removing password prompts, etc.), feel free to leave a comment. I will be thankful for any suggestions, and will integrate as many suggestions as possible.

Saturday, August 29, 2009

Summer Update (one of few)


I know I've been doing a terrible job of regular updates, but I was living with dial-up until about a week or a week and a half ago, most of that time was then spent updating all the stuff that needed to be updated. Now I'm spending my days trying to fix up my laptop a little. I've written scripts to manage brightness, volume, wifi (on/off), bluetooth, etc. on my Samsung N110 since it's running Openbox and I want to avoid gnome-power-manager (and it's good practice). So far my battery life is about 5.5 hours-6 hours in linux (Windows is 6.5-7 hours), but I'm quite happy with it. The only thing I need to fix now is the fact that laptop-mode-tools seem to no longer want to do anything (I have a few scripts set up to run on battery to adjust brightness and whatnot). I haven't found any fixes online yet, but it seems there are a few people suffering from the same problem. Also, I'm going to try to fix suspend to ram on this computer (LCD stays off, non-responsive, etc. on wakeup). I'll be sure to post the solution if I find one.

Also, I'm thinking of writing my next FCM article on how to use xev/xbindkeys/showkey to create custom shortcuts/get Fn keys working. Unless someone tells me "NO!!", I'll be writing it later this week. Later this week I will also update my blog with the scripts I've written for my N110, in case anyone else wants a notify-osd script for brightness and volume, or a notify-osd battery info script, or a notify-osd wifi on/off script.

Any suggestions or fixes that worked for you on any of the above listed issues would be much appreciated (always easier to start from somewhere instead of from scratch).

Hope everyone had a good summer,

Tuesday, June 9, 2009

Delayed update!

Well, I know I missed my usual update day (Sunday), but I was a little busy and so the update is a couple of days late. Better late than never, right?

The interesting stuff:
- My netbook arrived!! The Ubuntu liveUSB image worked perfectly (wireless, etc. was all fine) and I installed it, yet I haven't been using Linux much on this thing, since I haven't had the time to test the battery life in Linux yet, or to optimize it (with the "normal" profile for the samsung power manager in Windows I get 6-7 hours). It's all on the plan for the summer, just haven't quite made it there yet. It's surprisingly roomy (keyboard is easy to type on, the screen has more than enough space for stuff, etc.). Also, readability outdoors is pretty good too (even though it's a glossy screen), which is very good. I don't know what the computer was like with 1GB of RAM, since I upgraded the RAM the moment I got it, but with Google Chrome, Skype and Notepad++ running (besides the usual background processes of Dropbox, bluetooth, gmail notifier, etc.) it's at 615MB of RAM.
- Tested Xmonad, which is nice. The only issue I have with it at the moment is that floated windows are always on top, which is bad (since I float Skype, but don't necessarily move it to a different workspace). Config files aren't too confusing either.
- Wrote my FCM article on Irssi and MOC

The not so interesting:
- Set up windows with all the stuff I needed on my netbook :P

That's it for now! If you have any requests for entries, just comment. I'll be updating again in two weeks time.

Sunday, May 24, 2009

Quick Update, Little to Tell

Well, it's my bi-weekly update again, and I haven't really done much that's worth mentioning (besides finishing my exam and then relaxing), so I will quickly outline what I'm looking forward to, and what I plan on doing (blog-wise) in the near future.

Basically, I graduate (officially) from high school in a weeks time. After I graduate I will be purchasing a Samsung NC10 netbook to replace my battered and temperamental speaker-less laptop for a little under 400€ off (haven't seen a better deal anywhere else yet). Once I get it and play around with it for a bit, I'll install Ubuntu or ArchLinux on it as well (if Ubuntu, then the Netbook Remix edition). If battery life (which is supposedly anywhere between 6 and 9 hours depending on usage and review) in Linux is similar to the windows one (Samsung seems to be offering a custom power savings utility that is very modular, so Linux may be a little bit subpar compared to the XP battery life), I will most likely be shrinking XP to the most minimal size, mainly for itunes (since I have an iPod touch, and while I am sure I could get it working in Linux, I see no point in doing so since I don't update my music or my ipod every day). Basically, I'm taking the lazy way out, which is to say...I'll just boot XP and use iTunes if I need to update my ipod. I'll also be writing up a review of the netbook as it runs under XP and Linux (whichever distribution I choose) and posting them on here. It may or may not be up before I go on summer break. If it's after, then it won't be up before September, since I'll be living with dial-up for quite a few weeks.

Also, I may be purchasing a couple of things with the netbook if I order it, depending on if I can afford it or not. The two other things would be a 2GB stick of RAM (only one slot in the NC10), and a slim drive, since I will probably buy CDs over the summer, and it'd be silly if I can't put it on my iPod. Altogether (this is an offer on it'd go for about 430€, which is not bad, considering.

I'll post back once I order and receive the stuff, which may be in two or three weeks. If anyone wants to post here with an opinion as to whether or not the 2GB of RAM will make much of a difference on this netbook for mainly command-line tools in Linux and itunes (being the most resource heavy program I'd run) in XP, it would be appreciated.

Besides the netbook I'll also be working on whatever coding ideas I can come up with over the summer, and so I'll be posting those on here as I go. Not only that, but I have to write my FCM articles in advance, since I won't be able to send them in for two or three issues, meaning I'll be busy. Also, I'm going to be going to see Angels and Demons today, and I may post a quick update with my opinion on the movie (if it's worth mentioning) later today.

Sunday, May 10, 2009

Yet another Update

Well, it's my bi-weekly update! Not much to write about, since I'm in the process of doing exams, but they will be over in 2 weeks. I was able to get my article done for FCM, and I decided to cover Bash Functions and History, because I felt it's something useful and has quite a few time-saving uses, so if you're interested, don't miss the next issue of FCM #25 (should come out on May 29th). I haven't done much coding in the past 2 weeks, and the only thing exciting thing that happened technology-wise is that my laptop's speakers have also died. I don't see myself buying another HP anytime soon. I may post another entry later this week if I think of a good topic to write about.

Sunday, April 26, 2009

School is nearly over!

Well, I'm now on study leave for a week before my exams start. By the end of May I'll have graduated high school. So if the next update is a little delayed (day or two maybe) you guys know why.

These days I've been bothered by my temperamental laptop again. The charger is starting to die (it's the THIRD charger for this HP DV6545eg laptop in the last year), and I'm tired of replacing it, so I've decided to replace the laptop after I graduate. I've decided this mainly because the battery life of the HP laptop is terrible (about and hour and a half, maybe a bit longer), and the hard drive seems to be starting to die (I give it another month or two before it bites the dust). Seeing as the total cost of replacements would be around about 200€ I decided I may as well buy a new laptop for twice as much and get better battery life and mobility (my laptop is 15.4"). I've decided I want to get the Samsung NC10 netbook, which has a rumoured battery life of up to 7 hours (even if it only gets to 4 or 5 hours I'd be ecstatic), and is 10.2", which means it'll be nice and portable for me. Not sure if I'll go with Ubuntu 9.04 netbook edition, ArchLinux, or a normal install of Ubuntu. If anyone has any comments on compatibility (according to Ubuntu wiki only suspend/resume and sound recording doesn't work), please post a comment.

On a bit of an ironic note...the Samsung NC10 has an integrated graphics card with more shared memory than my laptop. Current laptop: Nvidia 7150m chipset with 128MB shared memory, NC10: Intel GMA 950 with max. 384 MB SharedMemory. Sure, the NC10 only has 1GB of RAM, but I can easily increase that, though my current PC and laptop set ups only require about 300MB of RAM for everything I do. Actually...looking at these specifications...the NC10 has bluetooth and all that, seems it is a better deal than my laptop (for half the price too). How times change.

I'm also hoping to get another Acer x223w monitor (22") for my PC, which will require yet another re-organizing of my desk.

The latest program I'm working on is a command-line tool for googling using python. So far the only thing it does is take supplied search terms and open the google results in firefox, since the SOAP API from google was dropped, and I've not got the time yet to try to implement the AJAX API in some way or form. I'm doing this mainly for practice so that I can get some hands-on experience with formatting large chunks of input in python, and so I can work with urls a bit.

Also, I noticed something interesting this morning. I have a follower! First one too, it was a bit of a surprise. I thought to myself "has that function always been there?". It's nice to know someone reads these articles (besides people I know personally).

One final note: I'm open to any suggestions if anyone would like a how-to written on a specific linux problem, or anything like that. Just drop a comment with your request and I will do my best to write a how-to on it.

Sunday, April 12, 2009

Some Python scripts

Well, as I mentioned in the last post I made, I plan on updating this blog every other Sunday (besides when I'm on vacation). This is the first of that series of updates (on time too!). I've been using Python a lot for small scripts lately, because a) it's good practice, and b) it's efficient. Below are a few scripts I wrote and an explanation of what they do:

Sorry, but the whitespaces seem to be ignored, so I'll post a link to a pastebin for each one as well. (For those who don't know, whitespace is significant in Python since each indentation level denotes a "block" of code, similar to the function of braces "{}" in Java or most other programming languages).

#!/usr/bin/env python
#Script to condense the multiple files of a project into one for easy printing/copying
#Author: lswest
import os
import optparse

def main():
usage="usage: %prog [options] args"
p = optparse.OptionParser()
p.add_option('--origin', '-o', help="The location of the files to be read in.", default="")
p.add_option('--output', '-t', help="The location of the file to which the condensed output will be written.", default="");
p.add_option('--extension', '-e', help="The extension of the files to condense.", default="");
options, arguments = p.parse_args()
if options.origin == "" or options.output == "" or options.extension == "":
print "Input file: %(o)s*%(e)s \nOutput file: %(t)s" % {'o' : options.origin, 't' : options.output, 'e' : options.extension}
ff=open(os.path.join(options.output), "wt")
for root, dirs, files in os.walk(os.path.join(options.origin), "true", "none", "true"):
for infile in [f for f in files if f.endswith(options.extension)]:
for line in fh:

if __name__ == '__main__':
This is a small script that can be run using the arguments ("FileCondenser --help" to see the help information), and is used to take all the files within a directory tree ending in the specified extension, and then copy each line of those files into the output file. I used it for my Computer Science coursework, since I had to print a hard-copy of my code (weird, I know).

#!/usr/bin/env python
#Program to tally the lines in a file
#Author: lswest
import os
import os
import optparse

def main():
usage="usage: %prog [options] args"
p = optparse.OptionParser()
p.add_option('--file', '-f', help="The path to the file to count.", default="")
options, arguments = p.parse_args()
if options.file == "":
print "Input file: %s" % options.file
for x in ff:
values={'name': os.path.join(options.file), 'count' : count}
print "The file %(name)s contains %(count)s lines." % values

if __name__ == '__main__':
This script basically just tallies the number of lines within the specified files, and was done for practice (no real practical reason), but I still thought I'd include it.

#!/usr/bin/env python
#A program to check if there are any updates available for Arch
#Author: lswest
from subprocess import Popen,PIPE
import os

def main():
p=Popen("pacman -Qu|grep Targets|cut --delimiter=\" \" -f 2|sed -e 's/(//' -e 's/)://'",shell=True,stdout=PIPE)
if x != "":
if tally == "1":
print "1 package to update"
print "%s packages to update" % str(tally)
print "No packages to update"

if __name__ == '__main__':
I use this script in my Conky on both my PC and laptop, in combination with a cronjob of "pacman -Sy" to update the database, to display the number of available updates for my system.

#!/usr/bin/env python
## A script to print out my "to buy" list
#Author: lswest
import os


for root, dirs, files in os.walk(os.path.join(home,"To Buy")):
for infile in [f for f in files]:
for line in fh:
print "- "+line,
This is a small script that takes all the text files in my To Buy folder, and prints it out, which I use in Conky. I create the text files with just echo "something to buy" > To\ Buy/something.

#!/usr/bin/env python
#A script to print out my To Do list
#Author: lswest
import os


for root, dirs, files in os.walk(os.path.join(home,"Reminders")):
for infile in [f for f in files]:
for line in fh:
print "- "+line,
Basically the same as above, besides the fact that it's a to-do list.

Well, that's all the scripts I've written so far that are half-way useful. I'm thinking about making a github repository for scripts of mine, so if you think it's a good idea, drop a comment and I'll post an update on the blog with the link if I do it.

*edit* I went ahead and made the github repository:

Saturday, April 4, 2009

An update (very delayed, sorry!)

Sorry about the slow updates on my blog here, I've been kinda swamped with school work, writing articles for Full Circle, and such that I haven't been able to think of things to write when I did have time (or I just simply didn't have time). I am now, however, setting aside every other Sunday of the month (second and last sunday of each month) to updating this blog (short of when I have exams, or when I'm off on Summer vacation, but I'll leave a notice as to how long I'll be gone). Over Summer vacation I'll probably be writing a lot, and so I'll just be unable to post them until I return.

A few things I'm working on these days:
- A website about Linux along with a wordpress blog, and once it's finished I may find hosting for it and use that instead, but I will see how it turns out first.
- Learning Python thoroughly
- Studying for exams
- Planning my gap year out
- Writing for Full Circle

Changes to my computers:
- Both PC and Laptop are now running ArchLinux 64bit with Awesome 3.1
- PC will soon be running with 4GB of RAM

Things I plan on doing:
- LPIC-1 during my gap year
- Getting a second 22" monitor for my PC
- Getting a graphics tablet for my PC

Favourite programs these days:
- MOC (command-line music player)
- My ipod Touch (for checking emails and such without having to pull out my old clunky laptop)
- Conky (I added a to-do list and a shopping list to it using python and an assortment of text files)

That's all I can think of posting for this time. Anyone is free to post suggestions for articles, how-tos, and so forth and I will cover as many as I can. Also, I would like to get a rough estimate of how many people read this blog, so if you feel like just leaving a comment, please do so!

Wednesday, February 4, 2009


I have finally decided my laptop is configured to my liking.

1.8GHz AMD Turion 64x2
160GB hdd (10GB - ArchLinux (ext4), 10GB - ext4 /home for Arch, 10GB - Ubuntu, 17GB - /home for Ubuntu, the rest to Vista)
Nvidia 7150m chipset

Basically, I installed Arch because I was tired of semi-laggy performance for graphics and lots of extra services running in Ubuntu. I decided to go with openbox, and from there I found a nice system tray replacement, panel, dock and found a nice dzen script for battery display (I modified it a tiny bit to suit my needs).

I plan on getting rid of Ubuntu entirely, and removing the old /home, but I'm waiting until I'm sure I have all the config files, fonts, cups settings, etc. that I need copied over before doing so. After all...disk usage isn't bad for a pretty much complete system. Also, if I decide I don't need it anymore, I will also dispose of Vista, but I see no reason to yet, as the space isn't required. Sure, I never use it, but why throw away what you paid money for if it works, right?
[lswest@lswest-laptop:~]% df -h [19:48:10 on 09-02-04]
Filesystem Size Used Avail Use% Mounted on
/dev/sda8 9.7G 3.6G 5.7G 39% /
/dev/sda9 9.2G 1.3G 7.4G 15% /home

The apps I decided on using are trayer for a system tray (top right), cairo-dock for a dock, tint2-svn for the panel, and a dzen2 script off the archlinux for the battery display. All the running system is configured through config files (save for cairo-dock), and battery life (managed by laptop-mode-tools with custom config files) gives me about 2 hours and 15 minutes of battery life, which is roughly 10 minutes more than Ubuntu gave me with slightly tweaked system settings. The wallpaper is a custom one that I call "Electric". I may or may not release this one, I haven't released any for a while. Also, I use xcompmgr for the transparencies.

Ultimately, I'm satisfied with this setup, it boots quickly, is responsive, and looks nice as well. Not only that, it also still hooks up to the beamers (projectors) at school, and (almost) all my keyboard shortcuts are fully functional. Only thing I have to figure out are my media keys, they seem to not be working properly in openbox yet.

Tuesday, February 3, 2009

That itch to disassemble is back!

Well, on Sunday I was sitting at home and this urge came over me to take something apart (it's been a while since that happened, used to be too busy to do so), and all I really had on-hand that I hadn't yet taken apart and re-assembled was my old, broken iPod Mini (broken in the sense that the battery holds roughly 5 seconds of charge). First I had to heat the glue at the top and bottom with a hair dryer, then I pried them off (using a thin screwdriver and my fingernail to bend the side away), unhook the bottom metal plate (held in place using tension in the tags), disconnected the click-wheel, unscrewed it from the top metal plate, and pushed it out. I even took pictures!
Quick note: the parts were lying on a Lufthansa clipboard, thus the funny colors.

Another slightly off-topic note. The article for Full Circle Magazine I wrote (Command & Conquer, filling in for Robert Clipsham) was released in issue 21 yesterday:

Thursday, January 1, 2009

Installing Ubuntu 8.10 on a Macbook Santa Rosa (4.1)

Section 1 - Preparatory Steps:
Check to see if your Macbook is a Santa Rosa 4.1:
In Mac OS X go to the Mac Menu (apple logo) and choose "About this Macbook" and it will show the "Model Identifier" in the "More Info..." window.

Preparing the Hard Drive:
Start the Boot Camp assistant (under Applications-->Boot Camp Assistant).
If it says the system is not up to date do the following:
  1. Run system update and download all updates available
  2. Go to Applications-->Utilities-->Disk Utilities.
  3. Select your hard drive
  4. Click the large green "Enable Journaling" button on the top bar.
  5. Re-launch boot camp (after any reboots due to updates)
From the bootcamp menu create a partition for windows. I suggest about 30GB of storage space, but you can do with less.
Cancel the boot camp assistant after creating the partition, no need to create a disk of drivers.

Installing rEFIt:
Note: you can skip rEFIt and use the option key to choose between Mac OS X and "Windows" (the Ubuntu partition created by boot camp), but I prefer rEFIt.
First, download a disk image from here:
Double click the dmg file that you've downloaded, and launch the rEFIt.mpkg file.
Follow the instructions on the screen, and select your Mac OS X installation volume.
Download an Ubuntu LiveCD:
Go to and download a liveCD of Ubuntu 8.10 Intrepid Ibex. You can choose either 32 or 64 bit, though I have only installed a 32 bit version (this was before Adobe released a native 64bit client).
Once downloaded, insert a blank CD and start Disk Utility (Applications-->Utilities-->Disk Utilities).
Then go to File-->Open Disk Image and select the image you've downloaded.
This disk image will now appear in the left-hand column. Select it.
Click "Burn" and follow the instructions that appear.

Section 2 - Installation:
Booting to the Ubuntu Install CD:
Insert the Ubuntu LiveCD and reboot, and then while it is starting press and hold the "c" key to boot to the CD.
Once the CD menu has loaded, choose the language you wish to use, and then choose "Try Ubuntu" (the top menu choice).
Wait for the system to load, and for the Ubuntu user to login.

Installing Ubuntu:
Once the system has loaded, there will be an "install" icon on the desktop, double-click it. Once the ubiquity installer has loaded, follow the initial steps until you arrive at the partitioning screen.
The partitioning should be step 4.

Once at this screen choose "manual" and hit "next". A new window will load.

From this menu choose the last partition (it will be either FAT or NTFS as a filesystem type). In it's place create a partition of ext3 with mountpoint "/" (without quotes (see NB)). Continue with the install, and tell the installer to proceed without a swap partition (we will create a swapfile (see NB2) later).

On the last screen of the installation, it will display details on what you've configured it to do. Here you need to select the "advanced" button and change the location of GRUB to the filesystem you created in the partitioning screen (the name will be listed on that screen as well, so you need only choose the correct /dev/sdaX value).

Once the install is complete, reboot the macbook, and at the rEFIt boot screen, choose the second icon on the second row (should look like a hard disk). It will then ask you if you want it to re-write the MBR as it was modified. Type in "y" (without the quotes) and wait for it to finish. Then reboot, and choose the Tux icon in the rEFIt boot menu to load Ubuntu. Sign in using your username and password that you set up during install.

NB You may be able to set up Ubuntu with a / filesystem and a /home filesystem, though I don't know this for sure, as I didn't try it. Don't own a Macbook either, so I won't be able to find that out for the time being. There is a limit to partitions you can create.

NB2: A swap file is like virtual memory in Windows, and can be used when the RAM is full.

Section 3 - Post-Installation:
Adding a Swap file:
First create the swap file with 1024MB (1024 x 1024 = 1048576)
sudo dd if=/dev/zero of=/swapfile1 bs=1024 count=1048576

Setup Linux swap and turn it on
sudo mkswap /swapfile1
sudo swapon /swapfile1

Edit the /etc/fstab
sudo gedit /etc/fstab

and add this line to your /etc/fstab
/swapfile1 swap swap defaults 0 0

Wireless Card
Insert an ethernet cable to your Macbook, and wait until it connect. Then, go to System--
>Administration-->Hardware Drivers. There should be a Broadcom driver listed. Select it and choose "activate". Enter your password and wait for it to download and install the drivers. A reboot will be required to have it working.
To enable the MacBook's built-in webcam, simply follow these steps:
1. Mount your Mac OS X partition
2. Install the isight-firmware-tools package and direct it to your iSight firmware on the Mac OS X partition (just confirm the default when mounted to /MacOSX)
3. Restart HAL
The Code:
sudo mkdir /MacOSX && sudo mount /dev/sda2 /MacOSX
sudo aptitude install isight-firmware-tools
sudo invoke-rc.d hal restart
You can then test your iSight with e.g. cheese (sudo aptitude install cheese && cheese).


Here we will create an fdi file for HAL to use, in order to enable two finger scrolling and two-finger tapping for right click.
sudo gedit /etc/hal/fdi/policy/appletouch.fdi

then enter the following into the file (blogspot wants to render the xml, so I have to put it up as a picture):

  1. Open Volume Control by right clicking on the volume icon and selecting "Open Volume Control".
  2. Click on Preferences and enable Capture, enable Mic Boost, and then close Preferences.
  3. In the Recording tab of Volume Control, raise the Capture level.
  4. In the Playback tab of Volume Control, raise the Mic Boost level.
  5. Under System > Preferences > Sound choose "HDA Intel ALC885 Analog (ALSA)" for Audio
  6. Conferencing / Sound capture
  7. Test it by running gnome-sound-recorder. Ensure that "Capture" is selected in the "Record from input" dropdown.
More Information:
(The configuration steps were taken from this site, as it was what I used)