Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Friday, 13 July 2007

10 minutes to run every Windows app on your Ubuntu desktop

I have to try this: 

VentureCake » Blog Archive » 10 minutes to run every Windows app on your Ubuntu desktop

It uses VMWare, SeamlessRDP, and rdesktop to run Windows apps from a virtual machine, and display them on your GNOME desktop.

VentureCake also has a helpful guide on running an existing Windows installation from Linux by setting up VMWare to use Windows from the physical disk (rather than a virtual image).

Tuesday, 3 July 2007

Creating a photo album for printing

I wanted to create a photo album that I could give to a print shop and get a nice, hard copy album back. Option 1 was to use a word processor and manually drop in 150 photos, rotating and cropping as appropriate. I did not like my chances of Word handling this. Even without .doc format overhead we are talking around 300MB. Even if the software would handle it on my fairly basic hardware, I would have to do it manually or grapple with VBA/Macros to get the photos in. Option 2 was to fire up my Ubuntu Feisty Fawn PC and dust off my old bash scripting skills (using the term "skills" is probably misleading). I also have had great experiences using LaTeX to generate documents, and its simple text format would be easy to generate as script output. Finally, I have all my photos in F-Spot. I should also mention I had a lot of help from Compiz Fusion ;-) -- I'm normally not too fussed with eye candy but once you try Compiz it becomes difficult to live without the visual cues and just plain coolness of a fast 3D desktop. Getting a folder full o' photos First thing I did was sit down with my lovely wife and pick all the photos we wanted using F-Spot labels. We then exported all the photos into a temporary folder, maintaining the correct photo orientation. Ensuring photo ordering Next up was a horrible hack to get the photos in the correct order. The photos have a mix of file names, so I could not just order by file name. F-Spot seemed to export copies of the files in the order they appear in its album view -- chronological order. So my horrible hack was just to get a directory listing by creation date, and it seemed to get everything in the correct order. Your mileage may vary. What I wanted to do was rename all these photos to give them sequential numbers. Here is the bash script:

#! /bin/bash
counter=1000
cd ../Photos
ls -1t --quoting-style=escape | while read FILE;
do
  let counter=$counter+5
  cp -T "$FILE" ../PhotosOrdered/$counter.jpg
done
The arguments to ls order by date, one file per line. It also escapes the file names, as generally bash scripting and file names with spaces don't mix too well. It is a bit easier if your file names don't have spaces in them, but mine did (not my fault! :)). This copies all the files in the ../Photos directory to ../PhotosOrdered, giving each a number starting from 1000.jpg. Generate the LaTeX source file The next step was to create a script to take all of the photos in ../PhotosOrdered and get a LaTeX file. I wanted each page to be A4, and two photos per page.
#! /bin/bash
set counter = 0
set modResult = 0
echo \\documentclass[a4paper]{article}
echo \\usepackage{graphicx}
echo \\usepackage{fancyhdr}

echo \\topmargin =0.mm
echo \\oddsidemargin =0.mm 
echo \\evensidemargin =0.mm 
echo \\headheight =10.mm
echo \\headsep =5.mm
echo \\textheight =250.mm
echo \\textwidth =165.mm

echo \\pagestyle{fancyplain}
echo \\lhead[{\\tiny \\thepage}]{{\\tiny Dido\'s Birthday Album}}
echo \\rhead[{\\tiny Dido\'s Birthday Album}]{{\\tiny \\thepage}}
echo \\cfoot[]{}

echo \\begin{document}
echo
echo \\clearpage

ls -1 --quoting-style=escape ../PhotosOrdered | while read FILE;
do
  let counter=$counter+1
  echo \\begin{figure}[!htb]
  echo \\centering
  echo  \\includegraphics[keepaspectratio,totalheight=0.45\\textheight,width=\\textwidth]{../PhotosOrdered/$FILE}  
  echo \\end{figure}
  let "modResult = $counter % 2"
  if [ $modResult = 0 ]; then
    echo \\clearpage
  fi
done
echo \\end{document}
The first part of the script is outputting the LaTeX configuration information such as package usage (for the graphics), header and footer and page size. By the way "Dido" is Ukrainian for "Grandfather" :-). The last part of the script deals with the actually inclusion of the images. The images are included using \begin{figure}[!htb], to force each image to be fairly immune to LaTeX's figure-positioning smarts. Normally letting LaTeX handle this layout is fantastic, but we are using/misusing LaTeX a bit here and so have to compromise. The \includegraphics tag handles the resizing of each photo to make sure it only takes up half the page. This lets us fit two to a page. Finally the mod operation and \clearpage flush LaTeX's figure queue and makes sure it does not fret too much about how to layout all the images this idiot is throwing at it :) To get the output file, we just run this script using createAlbumDocument > doc (chmod +x createAlbumDocument first). LaTeX magic From there it is just a matter of calling pdflatex doc to generate a lovely, 280MB PDF file. Very quick, very nice printed result too. The print shop was fairly impressed as well. :) I love LaTeX. I love bash. I love Linux! I also love tea, and now seems a good time to go get one...

Porting ASP.NET Applications to Mono

Marek Habersack has a guide on porting ASP.NET applications to Mono and a Unix-based platform (including RDBMS). Found courtesy of Miguel.

Tuesday, 6 March 2007

Tool to remove noise from images (and other processing)

Seen on /., GREYCstoration is a library and command line tool for image processing. It looks fantastic for removing noise from images, but also does some nice stuff like removing JPEG-compression artefacts, and scaling up smaller images without the normal levels of distortion. Apparently this library is used in DigiKam and Krita.

Another tool that sounds interesting is Resynthesizer, a plugin for GIMP that can help to create tileable textures and remove unwanted objects from an image.

Thursday, 8 February 2007

Learning GTK+ 2.0

I have started working through the GTK+ 2.0 Tutorial, with the aim of being able to make a contribution to something like the Rhythmbox project. So far I can display "Hello, World", which probably won't help out the Rhythmbox folks too much :).

Sunday, 31 December 2006

Ubuntu packages for current software versions - getdeb.net

GetDeb.net aims to provide the current versions of common applications for older Ubuntu versions. This is similar to the backports project, but is not limited to software versions being bundled with future releases. At present getdeb.net just provides FTP/HTTP links to the DEB files (rather than as a repository). I think I'll just download the DEBs I want to a local repository so I can install everything using apt-get. If an application gets backported then I can easily switch to the "official" version.

My motivation for looking into packaging stuff is to try and upgrade the version of f-spot on my Ubuntu 6.10 (Edgy) system to version 0.3.0. To compile from the source I needed to uninstall the version packaged with the distribution, but unfortunately it has been packaged with a dependency on ubuntu-desktop, and I don't think I want to remove that. GetDeb has a version packaged for Edgy though, so we'll see how it goes.

Creating Debian Linux Packages

IBM Developer Works has an introductory article on creating deb packages.

Monday, 18 December 2006

Image viewers on Linux

Linux.com has an article on image viewers on Linux. It mentions a few alternatives to the usual digiKam and F-Spot (GQView and Picasa), but one that looks really interesting is imgSeek. It is mainly focussed on searching (including searching by similarity of images - not sure how nicely this will work but the concept is great) so it does not have image editing capability, but as I am after a good tool for organising images then that suits me fine.