DVD to iPod conversion - Linux, Mac & Windows

I've been looking for a while for a way to convert DVD's and other movies that I have into iPod format and have been failing miserably. That is until today, when I came across the unusually named HandBrake.

It does exactly what is says on the tin and makes it very easy to copy dvd's. Initially I used it from my Mac and it worked flawlessly.

I also tried the Linux version on Ubuntu Hardy (8.04) which has no GUI but it is pretty simple when you get the hang of it.

Here's a typical command line:

HandBrakeCLI --preset="iPod Low-Rez" -i /media/cdrom -o myvideo.mp4 -t 2

This reads from /dev/cdrom and uses the handy "iPod Low-Rez" preset which fixes it all up nicely for the iPod.

And here's one that takes the second title:

HandBrakeCLI --preset="iPod Low-Rez" -i /media/cdrom -o myvideo.mp4 -t 2

The wiki has more information on command line usage.

Happy iPodding.

Cheers, Mark

Gmail, Docs, Calendar and Analytics standalone with Prism

I came across Mozilla Prism the other day and while I'm still deciding if it's going to be a permanent addition to my machine so far so good.

Screenshot of Prism Gmail Prism is a cut down version of Mozilla which is designed to run single sites from icon - what's the use of that you may ask? Well it allows you to have an icon on your desktop for Gmail or Google Calendar or docs or analytics and get to it nice and quickly.

It also free's up some much needed screen real-estate as all the other toolbars relevant for a web-developers browser can get in the way and are not used when you are using you email and calendar.

Additionally - as web developer I tend to restart firefox more often than some - and having my email seperated from that is nice.

Give it a try and see if you like it. On Ubuntu Hardy you can do the following to install it:

#install calendar
sudo apt-get install prism-google-calendar
#install google docs
sudo apt-get install prism-google-docs
#install gmail
sudo apt-get install prism-google-mail
#install analytics
sudo apt-get install prism-google-analytics

On other platforms (windows,mac or other linux versions) you can go to the Prism site and download it.

For the different applications check out the Bundles section or the User contributed bundles section.

Obviously this shares a lot of similarities with the adobe AIR platform albeit not as full featured. It will be interesting to see what further development plans there are for the prism platform.

Cheers, Mark

Pretty network diagrams and flow charts with Open Source software.

I had been using Dia for all my charts and diagrams, and it does a very good job. The only downside is that it doesn't produce very pretty charts of the like of Omnigraffle.

However, inspired by this article, I'm starting to use a new solution, Inkscape, that fulfills my criteria that works on Linux, Mac and Windows.

Dia Omnigraffle Inkscape
Can create pretty pictures No Yes Yes
Cross Platform (Linux, Mac, Windows) Yes No - Mac only Yes
Open Source Yes No Yes
Open file format (to work with version control) No - Binary No - Binary Yes - SVG
Export to PNG Yes Yes Yes

Now you may argue that Inkscape is not a diagraming tool but a generic drawing tool. This is true, but with the addition of a few templates of pre-drawn items it become a very good diagramming tool.

I've created a few simple flow chart elements which I use and also scoured the net for some SVG icons for network based diagrams which were sourced from Gnome (via Ubuntu) and from Quantum Bits.

Templates Previews

Flow chart diagram preview

Computing devices preview

Download

Download the svg templates (right click - Save As):

Give it a try - it's very easy.

Cross platform Database IDE

Ever since I've moved to using Linux full time I've been looking for a solid Database IDE. I've tried and tested quite a few.

Aqua Data Studio
This is my current DB IDE of choice and has some significant features in the new version 6.5 that means I'll be staying with it for a while, particularly as it runs on Linux, Macs and Windows identically.
  • Schema Comparison - very handy for keeping development and production db's schemas in sync.
  • Charts & Pivot Tables - makes it easy to create adhoc graphs withouth having to resort to Excel/OpenOffice Calc
  • Morph to Delimited List - A simple but powerful function that saves a lot of time. Allows you to take the results of a sql query and convert to comma seperated list. I've done dozens of adhoc CF scripts to handle this before :-)
  • Subversion Support - As we use subversion for our code it's handy to have it built in.

MySQL GUI tools (Query Browser & Admin)
These have some very nice functionality but have always found them to be pretty unstable - they just crash a lot with no explanation.
Navicat
This is pretty good option, but the Linux version is the poor cousin to the Windows & Mac versions.

Love to hear any comments feedback or suggestions.

howto document your code with ASDoc

Last night I was trying to document our AS3 code, using ASDoc, for a project that we have been working on. For those of you who don't know, ASDoc is a command line utility which allows you to generate code documentation in HTML format. A good example of what ASDoc output looks like would be, Flex 2 Language Reference.

Documenting code wasn't as easy as I thought it would be, so I thought I'd share this with you and hopefully it will save someone some time. I use an Intel Mac and this is what you need to do to get your basic code documentation generated successfully:

1. In your terminal window go to your Flex SDK bin directory. Typically this is located under /Applications/Adobe Flex Builder 2/Flex SDK 2/bin

2. From "bin" directory run this command:

./asdoc -doc-sources=/Users/marko/Documents/workspace/yourFlexProject/ -source-path=/Users/marko/Documents/workspace/yourFlexProject/

If you have any external Libraries in your Flex project you will need to include them in your command:

-external-library-path=/path_to_your_swc/myLib.swc

The key thing to remember for Mac users is that you need to run the command from Flex SDK bin directory and use -source-path option to tell the compiler where the source is located. -doc-sources will tell the compiler to generate output for the current directory and all subdirectories recursively. If you run this utility from any other directory other than "bin", you will get NoClassDefFoundError.

I haven't tried running ASDoc in Windows yet, but it should be very similar to running it on a Mac. And since ASDoc is a command line java utility, you would think it would run on Linux too. Well, for all you Linux users out there, this is the message I got from the compiler:

Error: Could not create toplevel.xml: Unknown OS for ASDoc. ASDoc will only run on Windows and Mac OS X.
That last sentence is pretty self explanatory :)

ASDoc is nicely documented here.

Cheers
Marko

HOWTO Add 1680x1050 resolution to Windows VMware Server clients

I make extensive use of VMWare Server on my laptop for Flex and Flash development as Adobe haven't released Flash and Flex for Linux yet (hint hint).

When I'm flicking back and forth between Windows and Linux I typically leave the Windows window at 1024x768 which allows it to have no scrolling and still fit on my 1680x1050 screen.

However, there are times when you just need more screen real estate in windows and as the VMWare driver doesn't come with a native 1680x1050 resolution you need to make some minor registry edits to get it working.

A bit of searching got me to an knowledge base article but the instructions didn't work for me, as the registry keys didn't exist there but were located pretty close. So without further ado (there's been quite a bit already I admit).

  • Start->Run and type regedit
  • Select the registry key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Video\{device id}\0000. Note the deviceid is a big horrible uuid, and there may be multiple ones. Use the one that has a key "Device Description" of VMWare SVGA II
  • There are a load of Resolution.x lines, add a new "Binary Value" 1 higher than the highest resolution. Eg Resolution.11
  • Enter the binary value of: 31 36 38 30 78 31 30 35 30 which is ASCII for "1680x1050"
  • Close regedit and reboot.
  • After reboot you should have a new resolution available to you.

For other resolutions you can use the following numbers keys:

ASCIIValue
300
311
322
333
344
355
366
377
388
399
78x

Cheers, Mark

IE6 and IE7 running side by side

I knew it was possible to do, but not this easy.

I've added it here for my own reference IE6 & IE7 side by side.

Also useful link to evolt standalone browsers archive.

Essential for debugging IE6 CSS issues.

VMWare partial snapshot recovery HowTo

I recently came across a Vmware server machine that was had a drive that kept expanding until it filled the entire host machine's avaiable space.

The machine in question had a number of drives including a 100GB and a 200GB partition and the host machine had a 600GB partition to hold all this. After digging around a bit I discovered that the drives were performing snapshots. Which means that they main drive was frozen in time and all changes were written to another file.

This should have been an easy fix, tick a box in the admin to remove the snapshot. However, in the admin for the machine there were no snapshots registered and no way to remove them. A bit of hunting found a couple of articles on the subject:

However, I used the following approach to fix the problem which seems to be simpler than the techniques documented above.

Note: make sure you have a backup before proceeding - my 600GB backup took 6 hours but was worth it.

  • Step 1: Make a backup to another drive (internal or USB)
  • Step 2: Check that you can boot your VM from the backup.
  • Step 3: Identify and document all disk names and files
    • Document all drives, paths and scsi/ide nodes
    • Create a text file in the root of each drive - you can then check for this to ensure you have the correct snapshot.
  • Step 4: Use the following command to convert a snapshotting disk to a new clean disk:
vmware-vdiskmanager -r sourceDisk.vmdk -t 3 destinationDisk.vmdk
  • Step 5: In VMWare remove the disk for this machine and then add back your new disk. Make sure you use the same SCSI/IDE node numbers.

Note 1: It is important to select the correct snapshot as the source disk. For example: sourceDisk.vmdk could have a number of snapshots, sourceDisk-000001.vmdk sourceDisk-000002.vmdk. Have a look at the timestamps to determine the active one.

Note 2: If you get the following error:

Failed to open the disk 'sourceDisk-000001.vmdk' : The parent of this virtual disk could not be opened (23).
Don't panic - as long as you have the backups you will be fine. Have a look in the sourceDisk-000001.vmdk and make sure the "parentFileNameHint" path is correct. I.e. if it is an absolute path and you are trying to restore it from a different location (i.e. your backup) you can correct it or simply make it a relative path.

Note 3: It is also very helpful to edit the network settings for the VM to ensure that the network is Not Connected on boot. Particularly if there are mail services or similar running on the machine. This allows you to boot the machine safe in the knowledge that it is completely isolated from outside influence.

Resources

Another useful document which helped out what the file reference on the vmware site - What Files Make Up a Virtual Machine?

Hope it helps. Cheers, Mark

Batch Convert PDF files to Flash Paper

For a current project I need to convert a whole heap of pdf files into FlashPaper so that we can display them inline in the site. After a quick google I found a useful example using ANT by Darron Schall.

ANT has been on my list of stuff to check out for the last while - however, it's real strength is that it is cross platform. For this project I found it a bit overkill so I just put together a little VB script to handle it.

This script is also simpler to set up on non-technical users machines as you don't need to have Java, Ant and Ant contrib set up.

The following script reads file in from a folder "in" and outputs them to a folder "out". It does very little error checking but works for me . Hope it helps.

' Script to convert PDF files to Flash Paper using the flash printer
' Reads files from folder "in" and outputs to folder "out"

flashPrinter= """C:\Program Files\Macromedia\FlashPaper 2\FlashPrinter.exe"""
inPath = "in\"
outPath = "out\"
delayMsec = 10000 'wait to let flashPrinter complete


If "CSCRIPT.EXE" <> UCase( Right( WScript.Fullname, 11 ) ) Then
'WScript.Interactive = false
WScript.Echo "To use this script enter: cscript " & WScript.ScriptName & vbcrlf & "or right click and select 'Open with Command Prompt'"
WScript.Quit 1
End If

Dim strMbox

Set objFileScripting = CreateObject("Scripting.FileSystemObject")
'Return folder object
Set objFolder = objFileScripting.GetFolder(inPath)
'return file collection In folder
Set filecollection = objFolder.Files

strMbox= MsgBox("Ready to process " & fileCollection.count & " files",1)
If strMbox = 2 Then
   Wscript.Echo "Cancelled"
   WScript.Quit
end if

   For Each filename In filecollection
      filename=right(filename,len(filename)-InStrRev(filename, "\"))
      if InStrRev(filename, ".") then 'remove extension if there is one
         FilenameNoExt=left(filename,InStrRev(filename, ".")-1)
      end if
      
      ' Run the flashprinter for each file
      command = flashPrinter & " " & inPath & filename & " -o " & outPath & filenameNoExt & ".swf"   
      Set objShell = CreateObject("WScript.Shell")
      'objShell.CurrentDirectory =
      Wscript.Echo "Processing: " & inPath & filename & " --> " & outPath & filenameNoExt & ".swf"
      objShell.Run(command)
      'Wait some for it to complete
      
      Wscript.Sleep delayMsec

   Next

Wscript.Echo "Done"
WScript.Quit

Feel free to use it and if you have any improvements please let me know.

Update: changed comment from // to ' which makes it barf. That will teach me to comment it after I write it.

Disk space monitoring script for windows

This is the first VB script I've done in a long time - but I think it's probably pretty handy for some people so here it is - be kind :-)

It is a simple script which modified from an original one from http://www.adiscon.com/ which checks all the fixed disks on a windows machine and can email the results.

The modified script is slightly more abstracted and doesn't require any additional components to send the email. It should be useful for monitoring disk space on DB servers or web servers that have log files on busy websites.

It is split into two parts - the library which holds all the functions and the config main code.

lib_diskspace.vbs

This is the library of functions

' Constants for drive types
Const Unknown = 0
Const Removable = 1
Const Fixed = 2
Const Remote = 3
Const CDROM = 4
Const RAMDisk = 5

' Send a mail message
Sub SendMail(Sender, Recipient, Subject, Message,Server,Port)
Set objEmail = CreateObject("CDO.Message")
objEmail.From = Sender
objEmail.To = Recipient
objEmail.Subject = Subject
objEmail.Textbody = Message
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = Server
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = Port
objEmail.Configuration.Fields.Update()
objEmail.Send
End Sub

' get current computer name (from system environment variables)
Function GetCurrentComputerName
set oWsh = WScript.CreateObject("WScript.Shell")
set oWshSysEnv = oWsh.Environment("PROCESS")
GetCurrentComputerName = oWshSysEnv("COMPUTERNAME")
End Function

' get free space report
Function GetFreeSpaceReport
set oFs = WScript.CreateObject("Scripting.FileSystemObject")
set oDrives = oFs.Drives
for each oDrive in oDrives
Select case oDrive.DriveType
Case Fixed
GetFreeSpaceReport = GetFreeSpaceReport & oDrive.DriveLetter & ": " & Round(oDrive.FreeSpace/(1024*1024)) & "MB free (" & Round(100 * (oDrive.FreeSpace/oDrive.TotalSize),2) & "%)" & vbcrlf
End Select
next
End Function

diskspace.wsf

This is the main script that should be edited to your configuration, and added to your scheduled tasks.
<job>
<script src="lib_diskspace.vbs" language="vbscript" />
<script language="vbscript">
'====================================================================================
' Begin main code
'====================================================================================
' general constants
Const MailServer = "192.168.166.1" ' Mail Server to use for SMTP
Const MailServerPort = "25" ' SMTP Port used at Mail server (25 is default)
Const MailTo = "mark@lynchconsulting.com.au" ' Who should be notified
Const MailFrom = "server@lynchconsulting.com.au"

str = ""
subject = ""

strComputerName = GetCurrentComputerName ' get name only once for performance reasons
subject = "Drive Space Report " & strComputerName
str = str & strComputerName & vbcrlf
str = str & GetFreeSpaceReport

'Output to screen - useful for debugging
Msgbox str

'Send mail to administrator
SendMail MailFrom , MailTo , subject , str, MailServer , MailServerPort
</script>
</job>

Hope it helps.

BlogCFC was created by Raymond Camden. This blog is running version 5.1.004.