Blog Archives

Convert VDI to VMDK with VBoxManage

Cloning virtual HDs

First, make sure you have enough HD space to store both hard drive (images) so you can maintain original in case of failure/conversion corruption/power outage during conversion etc.

If this is on an external HD or remote drive, make sure both VM HDs on same drive otherwise the process will be slow and error prone.

Make sure VBoxManage.exe and its’ DLL dependencies are on harddrive where HDs are which is always good practice since you may never know if app was designed to work localized only.

Dependencies:

VBoxDDU.dll
VBoxRT.dll

Open cmd prompt to the VBoxManage.exe path or follow my post to create batch shortcut from your start menu folder if you will be doing this again.

Enter VBoxManage clonehd source dest –format VMDK:

VBoxManage clonehd HardDisks/win7x86.vdi ./VMWare/HardDisks/win7x86.vmdk --format VMDK

Notice there are no quotes surrounding the source and dest paths since the pathnames do not have spaces. In general programming practice it is a simple habit not to use spaces to avoid issues parsing double quoted values or consecutive quoted values in the case of passed in parameters. If space is necessary, I usually use underscore _ instead.

If you’re new to command line, also notice the the dot slash in the dest path ./ and no root slash / in the source path. I moved VBoxManage.exe and its DLLs to my VirtualBox directory which contains the HardDisks folder so I did not need to specify the exact location of HardDisks since it is relative to VBoxManage. The dot slash tells VBoxManage to go up one level and then into the VMWare folder where it will create the vmdk file.

The clone will show progress indicators, and depending on size of file may take a while.

Convert VDI to VMDK with VBoxManage

That’s it! Once finished, open up VMWare and create a new virtual machine using the existing vmdk you just created. (screenshot courtesy of ax)

References
My Blog, https://ronniediaz.com/2012/07/15/keep-batch-file-open-to-enter-more-commands/
http://www.dedoimedo.com/computers/virtualbox-convert.html

Arithmetic overflow error converting type to data type numeric

This error usually occurs when the type you are trying to convert to a decimal or numeric is larger than the column or casted type you are converting to.

Ex.

insert into tablename (decnumber) values (cast(1000.00 as decimal(5,2)))

Since the number specifed is 7 digits long include after the decimal and the converted type can only contain a maximum of 5 digits, you will receive this error.

Changing the table to hold 7,2 and/or changing this in the cast will resolve it.

References
devshed (forums), http://forums.devshed.com/ms-sql-development-95/arithmetic-overflow-error-converting-numeric-to-data-type-numeric-89157.html

Convert Video to and from Adobe Flash .FLV format

The first three tools are Windows specific, with the last being cross-platform and especially necessary for linux users.

Super11
Link: http://www.videohelp.com/tools/SUPER
Not well known, but very robust software with good features and overall good functionality.

Riva FLV Encoder
Link: http://rivavx.com/?encoder
Similar to Any Video Converter (listed below). Depending on your needs, compare with Any and/or combine for best results. If you’re expecting some loss in quality and the end user won’t be watching playback in large streamed content then this or Any Video should work good for you.

Any Video Converter
Link: http://www.any-video-converter.com/products/for_video_free/
Good free product which gets the job done. A little less robust than Super in my opinion, and very similar to Riva as I stated above, but easier to use and probably better for quick youtube edits and uploads.

Adobe Media Encoder
Link: http://www.adobe.com/devnet/flash/quickstart/video_encoder.html
This product does the job pretty well, and I have personally used it for managing some quicktime and .flv video conversions. Visually it is more impressive than the others, but I found overall speed to actually be a bit slower after various testing. There were also some issues on .flv’s that didn’t play audio or video properly after conversion which seemed to work in other editors/converters. Especially interesting in these cases is the videos were output from another Adobe product.. Overall very surprised that Adobe didn’t come out on top with regards to their own platform.

FFmpeg
Link: http://www.ffmpeg.org/
FFmpeg is really at the core of much video conversion on the web, including some of those listed above. If you can master utilizing this tool from command line, or if you’re natively on linux, this is for you. Searching for ffmpeg GUI or frontend will also return some good results if you’re rather not run the commands manually.

Convert ASCII to HEX string in C#

//remove limit and substring command below to process the entire string. depending on size. this could be a lengthy operation. no pun intended. 🙂

public static string stringtoconvert = "valuetoconvert";
public static int limit = 16; 

        public static string registryinfo_installer_products_key = HexToASCII(stringtoconvert.Substring(0, limit)).ToUpper();

        public static string HexToASCII(string ascii)
        {
            string hex = "";
            foreach (char c in ascii)
            {
                int t = c;
                hex += String.Format("{0:x2}", (uint)System.Convert.ToUInt32(t.ToString()));
            }
            return hex;
        }