Extract Audio from YouTube Videos



>> Tuesday, September 20, 2011

I wanted to get an mp3 of a video on YouTube. There are sites that will do it for you, but I wanted a little more control.


Turns out it was pretty easy with free software.

1) Download the flv video
I used the open-source YouTube Downloader from Sourceforge. With that Java application I just needed to drag the URL from my browser onto the application and it would start downloading. I could even download multiple videos at once.

2) Extract the audio
ffmpeg was all I needed in this case. The command I used was:
ffmpeg -i youtubevideo.flv output.mp3

Simple as that!

Read more...

Calibre and Kindle Collections



>> Thursday, August 4, 2011

I recently bought a Kindle. Even though I didn't think I would like it, I really do. Maybe it is the computer scientist in me, but I want to control how books are organized and displayed from my computer instead of from the Kindle. Enter Calibre (http://calibre-ebook.com/). If you don't know, Calibre is to ebooks as iTunes is to mp3s. It is great at organizing and converting books. However, out-of-the-box it doesn't support collections on the Kindle.


It was pretty easy to set up:
  1. Install the "Kindle Collections" plugin (instructions here)
  2. Create a custom column by going to Preferences > Change calibre behavior > Interface > Add your own columns. Click the "Add custom column" button
  3. Give it a lookup name (kindlecollections), Column heading (Kindle Collections), and choose the "Text, column shown in tag browser"
  4. Fill in that new column with whatever collections you want on your Kindle. You can also go to Edit metadata > Custom metadata to add the name of the collections
  5. Plug in your Kindle (if you haven't already) so you can use the Kindle Collections plugin
  6. Go to Kindle Collections > Customize collections to create from Calibre...
  7. Select "Create" in the Action dropdown for your new column
  8. Go to Kindle Collections > Create collections on the Kindle from Calibre
  9. Eject and Restart your Kindle
It sounds more complicated than it really is. I know there are other tips out there for using existing columns like Series for Kindle Collections, but that didn't make sense to me as much as creating a new column.

Also, I don't like that you have to restart your Kindle every time, but I think that is a Kindle limitation, not Calibre or the plugin.

Let me know if you have any other Kindle/Calibre/Collections tips!

Read more...

Convert 2-Column PDF to eBook



>> Thursday, June 30, 2011

I recently bought a Kindle and have started loading it with techy books/papers/etc. that I can find for free. I am using the free calibre (http://calibre-ebook.com) software to do the conversion since pretty much everything I find is in PDF format.


It works OK for 1-column PDFs, but for 2-column the conversion does not work at all. I can read PDFs on my Kindle, but it is not as nice as reading an actual ebook.

I found one way to convert them in case anyone else is interested:

1) Upload the PDF to Google Docs
2) Choose to "Make a Google Docs Copy" which will convert it into the Google Docs document format that you can edit
3) Tweak as needed
4) Download as HTML
5) Load into Calibre and convert to your book type (mobi, epub, etc)

This will only convert the first 10 pages though, so you might need to split the original PDF (with a site like http://foxyutils.com/splitpdf). However, if it gets too long this method will get pretty tedious.

If you have any questions or thoughts, let me know.

Read more...

Ext 3.3 MessageBox Issues Resolved



>> Wednesday, June 8, 2011

I was doing some work using a MessageBox in Ext and ran into a couple of issues. Mainly the problem was because I am working in an infrastructure that is on Ext 3.3 and not Ext 4 (yet). Because of that I had to do some new things to add an ID to the MessageBox and also to bring the MessageBox above other elements on the page, specifically the loading mask.

Here is the code:


Ext.MessageBox.showWithId = function(dialogId, config){
var dialog = this.getDialog();
dialog.el.dom.id=dialogId;
Ext.MessageBox.show(config);
}

Ext.MessageBox.showWithId('myID', {
title : 'Progress',
msg : 'Processing...'
progressText : 'Initializing',
width : 270,
progress : true,
closable : false,
});

//bring it above the loading mask
Ext.MessageBox.getDialog().getEl().setStyle('z-index', '50000');

//remove the showWithId function to clean up after myself
Ext.MessageBox.showWithId = undefined;


First, the ID. I needed an ID to do automated testing with Selenium, and because of that I needed a way to locate the MessageBox by an ID. In Ext 4 you can just add an ID in the show() initialization, but that is not in Ext 3.3. So basically I had to create a new function called showWithId(). This just sets an ID in the dialog and then turn around and call show().

Next, the z-index. This just brings the MessageBox to the front. 50000 might be higher than I needed, but it worked for this example.

Let me know if you have any questions

Read more...

Use Groovy to Find Database Size



>> Wednesday, March 16, 2011

Last week I found a SQL statement to find the size of rows in a database. That was helpful but I wanted to be able to run this from the command line. Sounds like a good job for the Groovy database features.

import groovy.sql.Sql

//connect to the database
def sql = Sql.newInstance('jdbc:oracle:thin:user/pass@host:1521:database')

//define the statement to run
def sizeStatement = """select table_name, num_rows, avg_row_len,
ROUND((num_rows * avg_row_len / 1048576),2) "mb_used"
from user_tables
where num_rows > 0"""

//create a date to output (not needed for SQL, just for reporting purposes
def formattedDate = String.format('%tD %
//output the results
sql.eachRow(sizeStatement) { row ->
println "${formattedDate},${row.table_name},${row.mb_used}"
}


A nice little script. The only catch is that my database is Oracle so I need to pass in the driver jar when I run the script from the command line like this

groovy -classpath OracleThinDrivers.jar CheckSize.groovy

Read more...

Getting the Size of a Database



>> Wednesday, March 9, 2011

I recently needed to get an estimated size of an Oracle database. It turns out to be not too hard.

--by table
select table_name, num_rows, avg_row_len,
ROUND((num_rows * avg_row_len / 1048576),2) "MB Used"
from user_tables
where num_rows > 0

--total
select SUM(ROUND((num_rows * avg_row_len / 1048576),2)) "Total MB Used"
from user_tables

Read more...

  © Blogger template Webnolia by Ourblogtemplates.com 2009

Back to TOP