Tag Archives: Ubuntu

Embedding a UML SVG Image in my blog

For reasons that are beyond me, I’m currently interested in getting pretty SVG images of UML diagrams to display in web pages.  Specifically, in my blog.  First, I need a UML editor that doesn’t produce rubbish diagrams at home.  I’m currently sans a Windows install, so to add spice to the challenge, I wanted to see if I could get great looking UML diagrams out of Ubuntu (no, every Linux UML editor I’ve tried offends me greatly in terms of asthetics).

UML Editing under Ubuntu

There are only really two UML editors I love and they’re both Windows tools.  The cheap (as in free) one is StarUML; abandonware circa 2007.  The other is Enterprise Architect which I don’t have a home licence for (very good value for money all the same).  Both seem to have good reputations with running under Wine (1.3.28), so long as I respect a few winetricks for StarUML.

I’m happy to report that I can run StarUML under Ubuntu and everything I’ve tried to date seems to be working fine:

Here's StarUML, running under Ubuntu 11.10

Printing a PDF file in Wine

The next step was to get StarUML to print out PDF files.  After a bit of screwing around, the easiest approach was to simply add a PDF printer to  the Ubuntu print manager via a cups PDF printer (thusly from the command-line):

sudo apt-get install cups-pdf

Once installed, Wine seamlessly offered a PDF printer for me to print to, and StarUML was happy to spit a  PDF file of its current drawing out and drop it in a new PDF subdirectory off my home directory.

Converting a PDF file to SVG

I thought at this point that things would be plain sailing given the recent success I’ve had under Windows getting Inkscape to edit EPS files (I figured PDF would be just as hassle-free).  I was wrong, the PDF import under inkscape is doing something crazy-funky with the fonts.  In looking for answers/alternatives, I found a wonderfull little utility called pdf2svg.  I installed it, and from the command-line can do something like:

pdf2svg someVectorFile.pdf someVectorFile.svg

This gave me a perfect SVG equivalent to my PDF file.  I did a little cleanup in terms of whitespace with Inkscape, and moved onto how I could render it with my Blog.

Rendering SVG files via WordPress

Firstly, WordPress.com won’t allow me to upload SVG files as a valid form of media. I’m hoping they’ll eventually relax that constraint as browsers start rendering SVG files as a more common activity.  As an alternative, I decided I need a web address  for the file, so I uploaded it to  Dropbox account’s public folder, and retrieved a URL for it.

Secondly, I tried following all these suggestions for getting it to render, because WordPress support told me it’d work.  Sadly, none of the listed options gave me gold.  As a last ditched effort, I decided to use the WordPress “Add Media from URL” function, using the dropbox URL.  Joy of joys, it works.

Here’s the HTML that WordPress wraps the SVG image in, JIC you’re interested in that kind of thing (oh: I modified the width to consume the blog post width, as the image insert dialog doesn’t allow that kind of subtlty):

<img src="http://dl.dropbox.com/u/23814580/StarUML.svg"
 alt="An SVG image of a UML component diagram.  If you're seeing this,
does your Web Browser support SVG images?"
 width="100%" />

And finally, here it is.  A UML diagram that doesn’t suck (alright, maybe I could push the font size up a bit, but that’s my  problem), that is a scalar vector graphic, AND being rendered from my blog:

An SVG image of a UML component diagram.  If you're seeing this, does your Web Browser support SVG images?

Just for s**ts and giggles at this point, feel free to bash whatever keys you use with your browser to resize fonts (typically <CTRL>+ to embiggen, and <CTRL>- to emshrinken). Your mileage will vary, depending on how well your browser handles SVG files. For chrome, I’m having me a little nerdly squeefest doing it. 🙂

 And I’m done for tonight.  *yawn*


P*ssing in my WordPress Sandpit

For a while there, I had a sandpit environment for my parent’s webpage. The sandpit was a XAMPP install, running in a virtual Ubuntu machine via VirtualBox.  I eventually got around to an upgrade of VirtualBox, and the old snapshots wouldn’t play ball with the upgraded environment. So, the task I set myself tonight was to recreate the sandpit from the live WordPress install out at my ISP.  Turns out it wasn’t that simple to achieve.

First, I’ve been lazy with my Ubuntu kernel installs, and I’d forgotten which kernel I installed my latest VirtualBox with.  The first thing I did tonight was to purge all my unused kernels, and start with a fresh install of VirtualBox in the last kernel standing. To get get my monitors and desktop playing at full capacity, I needed the guest additions installed. Once I had a blank virtual OS with guest additions, I took my first snapshot (what a lifesaver when things stuff up, and tonight was full of reversions to previous snapshots).

Next, I laid down XAMPP, Freemind and Dropbox for locahost web-hosting, notes to self on all things web-page related, and easy file transfer across environments respectively, resulting in my 2nd snapshot.

Once that was done I needed the following in order (remember me saying I was backtracking alot?  The approach below isn’t exactly how the night went):

  1. dropped the entire WordPress directory zip file from my ISP into a new subdirectory of opt/lampp/htdocs
  2. Built a MySQL database and user to match what I’d set up at the ISP
  3. Imported the content of the live ISP database to the sandbox localhost database
  4. Modified the wp-config.php file to look at localhost instead of the ISP MySQL URL
  5. Switch off networking on the virtual machine briefly
  6. Step into the sandbox MySQL database, and modify relevant fields in the wp_options table so the sandbox environment wouldn’t go out to the live site and f**k it all up on me (the URL fields are the culprits)
  7. Switch networking back on within the sandbox, and whallah. Working copy from the live system that plays nicely.

And now I have a 3rd and final snapshot that I can try various shopping-carts out on before committing to a particular flavour.

I’ve learned tonight that the WordPress file backup and its matching MySQL backup go hand-in-hand for replicating the web-site across environments. I’ve also learned that the current backups sitting out at my ISP saved my bacon once I realised that the wp-admin screen in the sandbox was going out to the live site, and causing me to lock myself out of the live system, which suddenly thought its URL was based on a localhost address. DO NOT allow the sandbox to talk to the wider network until it’s happy to serve everything up locally Linds. JUST F**KING DON”T!

Might pour myself a stiff drink before I crash. Shaky nerves and all that jazz.

Ubuntu Desktop Videos for Youtube

I’m planning on ramping up my Ubuntu desktop video capture activity soon, and uploading it to Youtube. Because I always seem to manage to forget how to do it between attempts, here are some notes for next time.

First off, capture the desktop video with [my favourite tool for the job] gtk-recordMyDesktop.  I’ve tried others, but this seems the most reliable to date. I tend to select only a single window and record that. The trick to it (which I keep forgetting) is to right-click the window you want to be captured once the “Select Window” button is pressed. A frame should be drawn around the window if it’s been properly selected. Check that audio is turned off (I’m not a great fan of my own voice so I tend to dub in some music at a later stage).

The next step is to start recording. Keep an eye out for the record button that appears on the relevant  desktop panel. When video capture is finished, press that button to stop recording. If you don’t know to look  for the button, you may not see it.  Once recording stops, the video will be “cooked” with a little status bar to show you how much is left to do. Once it is complete, feel free to save the file somewhere.  It’s an OGG video codec, so an .ogv extension is good. Take the video for a brief tour with Totem video player. Keep an eye out for anything that needs editing out, especially on the head or tail end of the video.

It’s now time to do so basic editing and file format conversion (the raw file from gtk-recordMyDesktop isn’t a codec that Youtube likes, last I checked). My favourite video editing suite is PiTiVi. It’s relatively intuitive, and allows quick, easy audio/video clip manipulation. When it comes time to render the final edited video, we need to choose a codec that Youtube will accomodate. I use the following settings:

Video Output: 1080p full HD - 29,97 fps
Container: FLV muxer [flvmux]
Audio: FFmpeg ADPCM Shockwave Flash encoder [ffenc_adpcm_swf]
Video: FFmpeg Flash Video (FLV) encoder [ffenc_flv]

And here is an example end-result:


Record long, and prosper!

Ubuntu videos via Logitech Quickcam Pro 9000

So.. I have a Logitech Quickcam Pro 9000 USB device, and a powerful desire to capture brief videos with it.

After some web trawling and fiddling, I have an answer that works for my setup. First, I need MEncode. Easy enough:

# sudo apt-get install mencode

Then, to suit the various device mount points and camera resolution, I need this command:

# mencoder tv:// -tv driver=v4l2:width=1600:height=1200:device=/dev/video0:forceaudio:adevice=/dev/audio1 -ovc lavc -oac mp3lame -lameopts cbr:br=64:mode=3 -o ~/Videos/webcam.avi

And wallah, video on demand:


Record well, and prosper.

Ressurection of my EPSON CX 3100 under Ubuntu

The draft résumé is ready for my wife to decimate with her l33t editing skills. She needs a printout, and because I’m a) currently in a phase of negative cash flow, and b) really wanting to know if our 5 year old printer/scanner truly died, (or as I suspected back then, just got rolled by Windows wierdness), today I resurrected the beast.

When I bought this scanner/printer, I was very careful to choose a model that sold itself as USB compliant. I originally had the thing on my desk running seamlessly under a variant of Fedora but Fiona needed it more, so we moved it to her Windows 2000 box, and it worked well for a while. Then one day, it just kinda died, Juice was going to it, and the device itself though everything was good, but Windows just couldn’t see it, no matter which USB port I put it in.

Then something big happened (wast it Hannah? The Thesis writeup?) Whatever it was, trying to sort it out on top of other priorities just wasn’t going to happen. Then, as these things go, we got used to not having it, and it just kinda faded into the background as a piece of “stuff” that just migrates with us, but doesn’t actually contribute anything beyond the volume of air it occupies.

Fast-forward to today’s deisre to print the résumé without spending any money.. I got the EPSON CX 3100 working with a bit of fiddling under Fiona’s Ubuntu environment. I ended up needing their online reference manual and the setup sheet to remind me that I had to disable the transportation lock (psst… it’s the switch beside the scanner glass plate).

I also had some trouble enabling the printer. By default, when I attempted to enable it, Ubuntu would prompt me for a root user password, which is a bit of a problem under Ubuntu. After way too long faffing around with google-fu, I finally tried granting myself privileges to configure the printer via System->Administration->Users and Groups.

See the checkbox “Configure printers” below? Check that, and the magic flows…

That’s the printer side sorted. The scanner side was thankfully alot easier. After an install of XSane, I just pressed the “gimme a scan” button and got my turtle drawing.

Life is good. Print and scan long, and prosper!

Ressurection of the LaTeX Résumé

>Sshh! We’re hunting jobs!

First, we’re going to need bait. I have some bait, but it is years old and getting very smelly. It’s time to follow the same recipe and cook up a new enticing dish for those willing to give me money for my services.

This recipe calls for a very special cooking pot called LaTeX. I love LaTeX, and that’s all the justification I care to give you. Keep using Word (or whatever else you care to), but keep off my LaTeX love-in lawn. LaTeX is my bag baby! Yeah!

Now… first, and foremost, the fundamental reason for this post is a reminder of what LaTeX packages I need under Ubuntu 10.04 to get my résumé factory cranking out shiny new, highly addictive PDFs capturing all the crazy, zany things I’ve done professionally to date.

  • TexLive: Essential programs and files
  • TexLive: LaTeX Basic Packages
  • TexLive: LaTeX Recommended Packages
  • TexLive: LaTeX Supplementary Packages
  • TexLive: LaTeX Auxiliary Packages
  • TexLive: MetaPost (and MetaFont) Drawing Packages
  • TexLive: Extra Fonts

Ok.. so.. I don’t need all of the above for just the résumé, but with them, I can also re-cook the PhD thesis from is raw LaTeX source. As it’s the most complex thing I’ve ever done with LaTeX, I can guarantee with the above packages, that everything I could ever do with LaTeX I could do again if the mood suits me.

Two final things…

Firstly, I have a thing for fonts. Sexy, proportional fonts, laid out in a professionally typeset manner (oops.. I promised not to get all evangelical). Finding out what fonts are available, and what they look like is a bit like choosing which herbs to sprinkle about the dish. Mmmmm. Nummy!

Finally, here’s the current draft of the résumé, JIC you care to know why I went to all this effort.

Typeset long, and prosper!

Notes on dual booting

A little while back, I signed up to be a Lego Universe Beta Tester (surely there has to be a networked game out there that parents and their kids can play together?!?). After lots of experimentation, I came to the following conclusions:

  • The game wouldn’t run under Wine or Cedega
  • The game wouldn’t run under the Windows Virtualisation environment VirtualBox (bit of a shame, VirtaulBox is coming along in leaps and bounds).
  • The game wouldn’t run on the most modern Windows Licence I had in the house (and it was probably OEM anyway, thus casting my usage of it into doubt vs the M$ EULA)

This made me a sad panda. After pretty much a decade of running my personal computing needs from various flavours of linux, and getting my PC gamer fix from Cedega, I was finally forced to revert back to a dual-boot system with a more modern Windows Licence.

So. Below are the salient details for my dual-booting Windows 7/Ubuntu 10.04 setup:

Two HDDs:

  • /dev/sda == Ubuntu device path for my “OS” HDD
    • /dev/sda1 == The Windows partition, formatted as a NTFS filesystem. It gets the very first because it’s too egocentric to seem to be happy living elsewhere.
    • /dev/sda2 == The Ubuntu partition, formatted as an ext4 filesystem, with the / mount point.
    • /dev/sda3 == the Ubuntu swap partition
  • /dev/sdb == Ubuntu device path for my “Data” HDD
    • /deev/sdb1 == the entire drive in a single partition, formatted as an ext4 filesystem, with the /home mount point.

Basically, I use the Ubuntu install disk to lay out the partitions as above (well, the Ubuntu install disk didn’t allow me to format the Windows partition as NTFS. I settled on FAT32), then install Ubuntu. Once that’s done, I install Windows, reformatting as an NTFS partition. This results in the MBR completely forgetting about Ubuntu, so I then reboot from the Ubuntu install disk, pop open a command-line terminal and follow the instructions for GRUB2 here.


Grub is now being invoked at boot time, and allowing me to choose between the two operating systems.