Multimedia Design & Tech

Thursday, October 20, 2005

dumping an excel file into your Mysql Database

Another handy little bit of code. Sometimes people have data that they want incorporated into the shiny new web app you've designed for them. The following is the code necessary to dump a comma delimited file into a mysql table. You can get comma delimited files by exporting them from any spreadsheet/database program (like Excel or Access). A couple of things to consider, make sure your columns match up in both the csv file and the Mysql database, otherwise things get really messy. Also, if you have columns of data that include comma seperated items, they will be enclosed within " " marks in the csv file, and you'll have to specify this to mysql when dumping:


Protocol for loading excel files into mysql databases

Save the excel file as a comma de-limited (csv) format

Make sure that you don’t have any empty rows.

The following mysql statement will load the file into the specified table. Change "file.csv" to your file name. Change yourtableDB to the table you need to load into. Change "yourtableDB" to your mysql table name.

load data local infile 'file.csv' into table yourtableDB
fields terminated by ","
<- This specifies that the fields will be separated by commas optionally enclosed by '"' <- in case you have multiple values per column
lines terminated by '\n' <- start a new record every time it encounters a new line in the csv file
(column1, column2, column3….etc); <- Specify the columns you wish to load into
An example of this in use

load data local infile '/Documents and Settings/Adminsistrator/Desktop/list.csv'
into table newtableDB
fields terminated by "," optionally enclosed by '"' lines terminated by '\n'
(authors, title, journal, year, number, pages, URL);

I hope this helps....if you run into problems, make sure the comma delimited file is properly formatted.

Tuesday, October 18, 2005

DVD to AVI

Here's a simple method for converting DVD's to AVI files. Alot of times I've run into clients that like to drop off videos on a DVD disk, here's a quick protocol for converting the DVD to editable clips.
Handling VOB files

If you are extracting VOB from DVD, refer to Protocol #1. If you already have the VOB extracted, refer to Protocol #2.

PROTOCOL #1 - Extracting a VOB file from a DVD disk.

·Begin by opening the DVD Decrypter software. You can download it for free at - http://www.dvddecrypter.com
·Insert the DVD disk into the DVD drive on the computer.
·Choose FILE - BROWSE from the menu.
·Locate the DVD via the menu and click OK.
·Choose a destination by clicking icon next to "Please select a folder"
·Change the "Mode" to "FILE"
·Select "Decrypt" from the "FILE" menu and follow instructions.
·Proceed to Protocol #2

PROTOCOL #2 - CONVERTING VOB TO AVI

Open Auto Gordian Knot. You can download it for free at - http://www.softpedia.com/get/Multimedia/Video/Codec-Packs-Video-Codecs/AutoGK-Auto-Gordian-Knot.shtml

·Select "File Input"
·Choose input directory where VOB files are located
·Change predefined size to maximum quality
·Check the Advanced settings to ensure you are using the correct codec (divx or xvid)
·Select "Add Job"
·Select "Start"
·Sit back and wait, depending on the file size this could take awhile.
·When it's complete check the output directory for the AVI.

Be sure to check the audio and make sure it is synched to the video. If not you can extract it seperately with Auto GK.