Archive for category Linux

Crashing at a new pad

If you’re reading this, it means that the DNS records have replicated and Random Musings is now fully hosted on my shiny Linode VPS!

I’ve been steadily growing out of my previous hosting solution over on Host My Site. All things being equal they’ve served me very well, but running Wordpress started to demand more memory than they’d allocate for a shared hosting customer. Then there’s the limited functionality of the PHP stack which I was starting to run up against quite regularly.

I have to say I’m SUPER pleased with Linode so far. I signed up for it on the 21st, and by today I’ve got it completely setup hosting web and email for three domains, with another on the way. I was worried that it would cost me money, but when I account for the other hosting accounts I’ll be able to close I wind up money ahead. Sweet!

Hopefully this change will be seamless to ya’ll, might notice an increase in speed. Let me know if you see anything “odd”. :-)

1 Comment

My Twitter Client Search – Ended

Okay, so as you may already know I’m a big fan of any software solution that does what I need in a portable and platform agnostic way, particularly if it does it “in the cloud“.

What you may not know, is that I’m addicted to Twitter and I’ve been going through desktop based Twitter clients faster than my Cadillac beer bongs fuel!  My affair with desktop clients started with TweetDeck, since it’s used by a lot of my friends on Twitter and it seemed to be a front runner.  The problem is that it’s in beta, and it’s a bit buggy still.  Worse yet, it doesn’t run on my linux box.  In fact, no decent Twitter client does work on my linux box.  I’ve also tried Twhirl, and DestroyTwitter.  Both of which lack all the features TweetDeck has, and none of which work “quite right” on my linux box.

And, as if to add insult to injury the company I work for has recently been acquired by a MUCH bigger company which is imposing a lot of new restrictions to the use of our desktop computers.  Meaning I’ll likely not be able to install a Twitter desktop app on my computer in about a month.

Enter TwitterGadget, pictured above.  It’s an iGoogle gadget so it runs in my browser, on windows or linux, without installing!  And it’s quite featureful too! It has built in URL shortening which is one of the features I miss most from other desktop apps.  The one feature I hope to be included soon is TweetShrink integration, but I’ll live without it.

Hopefully I won’t have to change Twitter clients for a while now!  :-)

, , , ,

2 Comments

Me and my iPhone

Well, I’m not exactly what you’d call an early adopter, and I’ve only recently rediscovered a place in my heart for Apple based computing devices.

That said, there was a lot of internal debate an struggle when it came time for me to upgrade from my Cingular 8525 HTC/Phone/PDA device. Initially, I was convinced that I wanted the newest HTC the Fuze, since it was a logical upgrade from what I had. But there was just soooo much hype about the iPhone, I had to give it a fair shake. Fortunately, my sister and brother-in-law each got one a few weeks before my wife and I were due to upgrade. I got a real good chance to check them out. After seeing the HUGE amount of apps, and overall support that existed for them, the choice was easy. Sign me up, I’m a lemming..

I’ve had my iPhone for two and a half weeks, and I’ve made a lot of changes, tweaked a lot of configuration, and jailbroke the device. The rest of this post will serve to document that for my own sake should I ever have to recover the device, but also to hopefully shed some light on why you might jailbreak your phone, and what apps a techie like me finds useful.

Read more after the break… Read the rest of this entry »

, ,

No Comments

Uploading to Flickr from Picasa on Linux

When I performed my search for the perfect photo sharing solution, I fell in love with the Picasa desktop application. I even discovered that there is a linux version. However, as you’d likely expect, it didn’t really play nice as far as uploading photos to any photo sharing site other than Google’s Picasa Web Albums.

On windows, there is a great solution called picasa2flickr which passes the desired photo’s to the windows Flickr Uploader. Again, for obvious reasons, this doesn’t work well on linux.

So, having determined that it wasn’t worth my time to pursue trying to get Flickr uploads working from Picasa on Linux, I started evaluating many of the other native options on linux, such as digikam and fspot. While these more easily uploaded to Flickr, and had open API’s, none of them worked quite the way I wanted, so I abandoned my search for a good solution.

Then, on a whim I did a Google search just a couple hours after Andy O’Neill made a blog post about a button he wrote to import photos to Flickr from the Linux version of Picasa, named picflick.

I eagerly (re)installed Picasa3 on my Gentoo box using a beta ebuild found here. Then installed his button.

After playing with it for a bit, I realized a few things didn’t quite jive for me.

1) The script automatically resizes the image before uploading it to Flickr. I prefer to upload all of my images at their original resolution, so this was a bit of a road block for me.

2) The script used a Perl module to upload to Flickr. For the life of me, I couldn’t seem to figure out how to get it authorized with my Flickr account to actually permit uploads. I’m sure if I spent a bit more time and read a few more manuals I could have gotten it right, but it didn’t quite work “out-of-the-box” for me.

3) I’d prefer to see the progress being made, rather than the beeps and tray notifications that Andy’s script provided.

So, I stole the key part of his script, the part which translates Windows paths to *nix ones, and broke down the rest to simply pass the photos on to my preferred linux Flickr uploader, KFlickr

Here’s the contents of my script, including the win2native function written by Andy.

#!/bin/bash

DEBUG=1     # debug to $LOG
LOG=/tmp/picflick.log
PICASA_WINE_DIR="$HOME/.google\/picasa\/3.0\/drive_c"  # Relative to $HOME
PICASA_WINE_DIR_NATIVE=`echo $PICASA_WINE_DIR |sed 's|\\\\||g'`

function debug() {
        if [ $DEBUG -eq 1 ]; then
                echo "$*" >> $LOG
        fi
}

# wine2native(): convert wine filename to native linux filenames
# Arguments: _name_ of variable which holds path
# Example: wine2native file  # not wine2native $file
function wine2native() {
        VAR=$1
        eval "VAL=\$$1"
        debug "Wine path: $VAL"
        # use '|' to delimit the paths
        VAL=`echo "$VAL" | \
                sed "s|C:|$PICASA_WINE_DIR|" | \
                sed 's|\\\\|/|g'`
        debug "Source file: $VAL"
        eval "$VAR=\$VAL"
}

# check we have the required dependencies
which kflickr > /dev/null || die "You need to install kflickr"

file=$1
wine2native file
DIR=`dirname "$file"`
EXT=${file##*.}
debug "START_UPLOAD"
for file in "$@"; do
        wine2native file
        KFLICKR="$KFLICKR $file"
done

debug "Launching kflickr with the following args $KFLICKR"
kflickr $KFLICKR

debug "Done"

Now when I click the “Flickr” button in Picasa, it brings up the KFlickr app with all the pictures I selected ready to upload. Thanks for the inspiration, and code bits to make this work Andy, I was too lazy to actually figure out what was necessary to pull the image paths from Picasa and use them.

, , , , , ,

6 Comments

Fedora Bash History Meme

I just learned about a Bash History Meme originated at Planet Fedora from a blog I read regularly.

In short, you run the following command in bash, and show your results.

history | awk '{a[$2]++ } END{for(i in a){print a[i] " " i}}'|sort -rn|head

My results from my home box are as follows;

103 ls
59 cd
52 exit
38 vi
38 firefox
29 for
22 su
18 /opt/hdv/myworkflow.sh
14 ssh
13 diff

Seems I’m unwilling to simply close my terminal window in KDE, but instead have to type “exit”. The “myworkflow.sh” script is a work in progress which I hope to one day post about. It does stuff to help me convert and do post production on video from my HDV camcorder. I’ve been using “diff” to compare original files with modified ones for web updates I’ve been doing for clients.

Here’s the results from my web hosting box;

394 ls
212 cd
89 vi
77 exit
60 du
30 mv
28 rm
20 mkdir
19 pwd
12 cp

Suppose there’s nothing particularly interesting here. I was checking a file upload progress in a very nasty way by calling “du”, what can I say.. I’m lazy.

,

1 Comment

Tools for updating an online image gallery

Not long ago I shared my bash script for creating thumbnails and manageable sized “big” images for an image gallery, or other image store. Well, today I had to update an existing gallery with a pretty significant number of new images. It occurred to me that I’d like to only convert new images rather than re-converting the whole lot. Then, I’d like to simply upload the new files to my server in some automated way.

So here’s the tools to do it. It assumes you have the same layout for your pictures on your local drive as I do, which is as follows.

  • RootDirectoryForGallery — This contains the full resolution pictures directly from your camera, and the following directories.
    • web — This is a sub directory of RootDirectoryForGallery which contains the “big” web version of your image, and the thumbnails directory described below.
      • thumbnails — This is a sub directory of web, and contains the thumbnail sized versions of the images.

The first step, is to copy your new pictures from the digital camera to your RootDirectoryForGallery. Then, we want to get a list of the files that are new, so we run the following from the RootDirectoryForGallery.

diff . web/ | grep 'Only in \.: d' | awk '{print $4}' | grep jpg >> 3-6-08_update.diff

This creates a file in the RootDirectoryForGallery named “3-6-08_update.diff” which contains a list of only the new pictures, one per line. Now, we want to use our image thumbnail script to convert only the new images to the “big” and thumbnail sized images. I discovered that I needed to make a change to my script in order to do this. Namely in the for loop I needed to enclose the command used to list files in “$()”. The modified script is shown below. Notice the “$($SEARCH)” where there was previously just “$SEARCH”.

#!/bin/bash

SEARCH=$1
SIZE=$2
DEST=$3

if [ $# -lt 3 ]
then
echo "You must pass three arguments 1) The search string (usually *.jpg) 2) The destination size I.E. 500x374 3) The destination directory"
exit 1
fi

for i in $($SEARCH)
do
        echo "Converting $i"
        convert -resize $SIZE $i -resize $SIZE +profile '*' $DEST$i
done

So with our edited script we convert the files.

/opt/imagethumbnail.sh "cat 3-6-08_update.diff" "800x600" "web/"
/opt/imagethumbnail.sh "cat 3-6-08_update.diff" "150×112 "web/_thb_"

Lastly, we want to upload just the changed files to our server. We’ll use rsync for this. The paths, server name, and user name have been changed to protect the innocent. ;-)

rsync -e ssh -av /path/to/local/copy/ yourusername@yourserver.com:/path/to/www/server/copy/

And there you have it, with just a few simple commands you’ve created thumbnails of all of your images, and uploaded just the new ones to your server. Easy!

, , ,

1 Comment

Linux 1080p HTPC

So, I finally broke down and built a HTPC (home theater personal computer). Actually, I bought it in late December, and have had it mostly up and running since about the middle of January, but I’m just getting the chance to post about it now.

I knew from the start I wanted to run Gentoo Linux with MythTV, and I must say it was an adventure getting it all working. I’ve outlined the details of the build for anyone interested in doing something similar, or who might just be curious.

The hardware

GIGABYTE GA-73PVM-S2H
Seagate Barracuda 7200.10 ST3160815AS 160GB
Intel Celeron 420 Conroe-L 1.6GHz 512KB L2 Cache
Kingston 1GB 240-Pin DDR2
Lite-On Black DVDRW
eDATA DEC-200B Vista Certified Infrared Remote

I already had a low profile desktop case sitting around which I used for the project, so that’s not included. Total without the case was just under $300. I later added two Logitech ChillStream game controllers for playing console game emulators.

The motherboard was chosen because it had “everything” I needed onboard and didn’t cost a fortune. I needed HDMI out for my new Sharp Aquos 42″ HDTV so I could have a clean digital signal at the full 1920×1080 resolution.

The other stuff should be fairly obvious, I had to have a processor, drive, memory, and of course since this is an HTPC, a remote control. Since I wasn’t planning on doing anything particularly processor intensive (see goals) and I was going to be accessing nearly all my media over the network a fire breathing processor and giant hard drive weren’t necessary.

Goals

I wasn’t interested in a TV tuner or using this as a PVR/DVR, nor archiving DVD’s. I wanted this to replace the DVD changer in my existing HTIAB (home theater in a box) and be able to play DVD’s upscaled to 1080p. Also I wanted to be able to play video captured on my Sony HDR-HC1 HD camcorder at it’s native resolution.

Secondary things would be playing my fairly sizable MP3 music collection, looking at pictures, and other cool stuff you can do with a computer connected to your television.

Wrestling with the feral Gentoo

Since I was dealing with “bleeding edge” hardware at least with the motherboard chipset and the remote control, getting Gentoo linux up and running with support for all of my hardware would be a challenge.

After a fair amount of googling, and plenty of trial and error, I was able to get things working. For the sake of reference, I’ll document the highlights of getting things going.

1) The 2007.0 Live CD wouldn’t recognize my SATA DVDR drive unless I booted it with “gentoo all-generic-ide”, and set the sata controller to “IDE” in the bios.

2) The latest nvidia driver available in portage (100.14.19) didn’t seem to properly support my video hardware, so I downloaded the latest from the nvidia website (169.07) which seemed to work much better. I actually went so far as to make my own custom ebuild for it.

3) The latest lirc available in portage (0.8.2-r2) didn’t seem to properly support my MCE2 USB style remote control. At the time 0.8.3_pre1 was masked as unstable, but it did the trick

4) Getting the ChillStream’s to be recognized by the kernel was interesting too. A kernel module (xpad) exists that is meant to support these type of controls with the XBOX-360 style. However, a patch was necessary to properly support these. It just added the PID to the source to support this controller. They work great now. :-)

Results

So, after all that did I reach my goals?

Yes, and then some! Below is a list of the highlights of functionality, but in all this project was quite a success. And I think the functionality is impressive considering the bargain price!

One of the things which came as a pleasant surprise was getting MythGame setup with some emulators of old consoles I’d played. It’s amazingly nostalgic to play some of those Nintendo games!

What works
* MythFrontend at 1080p over HDMI (should show modelines)
* MythVideo/DVD playing any video I like at native resolution
* xine playing DVD’s at 1080p
* MythGallery
* Audio out through TOSLINK optical output, passing along AC3/Dolby Digital & DTS
* MythMusic to play MP3 files from the network
* MCE Remote Control to run MythFrontend
* MythGame

What doesn’t
* Audio out through HDMI

Future plans

Now that the HD DVD vs Bluray war is apparently over when the drive prices come down a bit more, I intend to put a Blueray drive in this. I suspect I’ll need a more powerful processor to successfully play a movie though. I’m sure that linux will have limited or non existent support for the format for some time to come as well, so we’ll see how that plays out. The hardware is mostly up to the task though, and represents a bargain compared to the several pieces of equipment that would have been required to do the same stuff.

2 Comments

Image thumbnail generating script

I have often wished that I could easily convert several images to a smaller size simultaneously. This is useful for batch resizing images for thumbnails, galleries, or use on the web.

On a linux system with imageMagick installed, you can use the script at the end of this post to batch convert the images.

I use it to create thumbnails and scaled images for my online photo gallery using the following commands.
./imagethumbnail.sh “*.jpg” “800×600″ “web/”

./imagethumbnail.sh “*.jpg” “150×112″ “web/_thb_”

This creates a reasonable sized “large” image at 800×600 and a thumbnail at 150×112. Makes managing new images in my gallery much easier. Hopefully you’ll find it useful too.

Contents of imagethumbnail.sh

#!/bin/bash
SEARCH=$1
SIZE=$2
DEST=$3

if [ $# -lt 3 ]
then
echo "You must pass three arguments 1) The search string (usually *.jpg) 2) The destination size I.E. 500x374 3) The destination directory"
exit 1
fi

for i in $SEARCH
do
echo "Converting $i"
convert -resize $SIZE $i -resize $SIZE +profile '*' $DEST$i
done

, , , , ,

1 Comment