Wednesday, June 2, 2010

How to set chrome as your default browser for Thunderbird on Ubuntu

From this bug report:

it appears that in Thunderbird 3 the protocol handlers are ignored in favor of the
settings in the "Attachment" preferences. Indeed, once I set the http and https
"content types" to xdg-open, Thunderbird correctly opened http and https links in
Chrome.

Sunday, March 14, 2010

Export from iMovie to play on Blackberry Bold 9700

Want to export a video from iMovie to play on your Blackberry Bold 9700? Tired of showing your videos on the youtube player? No problem!

For the impatient: use MPEG4, 25fps, auto key frames and restrict to 1248 kbits/sec at 480x270 letterbox. Audio is AAC codec, Mono, 44.1, and a target bitrate of 64k.

A 3:30 video renders to about 33MB.

First choose 'Export using Quicktime' from the menu



Then you will see a dialog like this. Choose options



After that you should see the setting for the video formatting and audio. Choose the top 'Settings' button.



Now you will get a dialog for the video format. Use MPEG4, 25fps, auto key frames and restrict to 1248 kbits/sec. Now close this dialog, and hit the 'size' button.



Choose a custom size, and enter 480x270, preserve aspect using letterbox, and deinterlace. Close this dialog, and choose the sound settings button.



Use an AAC codec, Mono, 44.1, and a target bitrate of 64k. Close this dialog.



Now give your video a name, and hit save

Thursday, February 11, 2010

Squirrel not starting fix

If OOM kills squirrel hard, and squirrel will not restart giving a Null Pointer error, you can follow this thread below by removing the SQLAliases23_treeStructure.xml file from your $HOME/.squirrel dir. It is a transient file.

Stack trace:

tor@unwise:~/SQuirreL SQL Client$ ./squirrel-sql.sh
Exception in thread "main" java.lang.reflect.InvocationTargetException
at java.awt.EventQueue.invokeAndWait(EventQueue.java:997)
at javax.swing.SwingUtilities.invokeAndWait(SwingUtilities.java:1323)
at net.sourceforge.squirrel_sql.fw.gui.GUIUtils.processOnSwingEventThread(GUIUtils.java:350)
at net.sourceforge.squirrel_sql.client.gui.WindowManager.(WindowManager.java:161)
at net.sourceforge.squirrel_sql.client.Application.executeStartupTasks(Application.java:753)
at net.sourceforge.squirrel_sql.client.Application.startup(Application.java:246)
at net.sourceforge.squirrel_sql.client.Main.main(Main.java:60)
Caused by: java.lang.RuntimeException: java.lang.NullPointerException
at net.sourceforge.squirrel_sql.client.gui.db.JTreeAliasesListImpl.initTree(JTreeAliasesListImpl.java:233)
at net.sourceforge.squirrel_sql.client.gui.db.JTreeAliasesListImpl.(JTreeAliasesListImpl.java:101)
at net.sourceforge.squirrel_sql.client.gui.db.AliasesList.(AliasesList.java:44)
at net.sourceforge.squirrel_sql.client.gui.WindowManager.createAliasesListUI(WindowManager.java:877)
at net.sourceforge.squirrel_sql.client.gui.WindowManager.initialize(WindowManager.java:861)
at net.sourceforge.squirrel_sql.client.gui.WindowManager.access$200(WindowManager.java:77)
at net.sourceforge.squirrel_sql.client.gui.WindowManager$1.run(WindowManager.java:165)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
at net.sourceforge.squirrel_sql.client.Application$1.dispatchEvent(Application.java:195)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Caused by: java.lang.NullPointerException
at net.sourceforge.squirrel_sql.client.gui.db.AliasFolderState.applyExpansionAndSelectionToNode(AliasFolderState.java:144)
at net.sourceforge.squirrel_sql.client.gui.db.AliasFolderState.applyExpansionAndSelection(AliasFolderState.java:160)
at net.sourceforge.squirrel_sql.client.gui.db.JTreeAliasesListImpl.applyAliasFolderState(JTreeAliasesListImpl.java:264)
at net.sourceforge.squirrel_sql.client.gui.db.JTreeAliasesListImpl.initTree(JTreeAliasesListImpl.java:220)
... 15 more

Tuesday, December 1, 2009

Test ldap connection against Active Directory

How to test a connection to AD using linux ldapsearch


ldapsearch -LLL -x -H 'ldap://server.com:389' -b 'DC=domain,DC=office,DC=com' -D 'CN=openfire,OU=Service Accounts,OU=User Accounts,OU=DOMAIN,DC=domain,DC=office,DC=com' -W '(sAMAccountName=tor)'


This will make sure that your user can bind, and the in the search they can see user accounts.

We used this for ldap integration for authentication for JIRA and openfire.

Saturday, May 30, 2009

Locking the keyboard on a Blackberry Bold

Because I never read the manual, I was having problems locking the keyboard on my new Blackberry Bold. First, you have to turn off the language switching in the menu to be able to use the old 'Alt-Enter' shortcut for locking the keyboard.

Thing is, with the new trackball, that key combination is a little awkward, and I am so paranoid about dropping the dang thing, that I have been using the menu option for locking.

Until now.

Jeez, the manual for this thing is literally hundreds of pages, and to be honest, I've never even looked at it. I mean, seriously, why wouldn't I already know everything about using a Blackberry?

So, two key shortcuts I learned today are;

hold down '*', this will lock the keyboard
hold down '#', this will toggle between vibrate and normal profiles

Sweet.

Monday, April 27, 2009

ruby script to search for email addresses in a log file

Given input that is ":" delimited, this script will search out email addresses in any field in the input:


cat log_file.txt | ruby -ne 'split(":").each { |col| print col , "\n" if col.match(/^\S+@\S+$/) }' | sort | uniq

Wednesday, April 22, 2009

awk script to add up lines in a file

You want to add up the numbers in a file?

Input:

56168
796
44
26
202
258
478
632

Script:

cat file | awk '{ total = total + $1} END { print total}'

Tuesday, September 23, 2008

Getting jruby running with mysql on ubuntu

You want to get jruby running quickly on ubuntu using mysql as a backing store?

Unfortunately, it does not "just work" with sqlite3 out of the box on ubuntu for some reason. I don't really care why, as mysql is very easy to setup. The most important step that flexed my googling muscles was setting the database adapter to jdbcmysql in the database.yml file.

I will post later on a howto to get this working with glassfish and war files. For some reason, warbler nor goldspike "just work" on ubuntu either.

# install mysql
sudo apt-get install mysql-server mysql-client libhtml-template-perl mailx dbishell libcompress-zlib-perl mysql-doc-5.0 tinyca

# install ant and jdk
sudo apt-get install ant sun-java6-jdk

# install jruby
cd software
wget http://dist.codehaus.org/jruby/jruby-bin-1.1.4.tar.gz
tar xvfz jruby-bin-1.1.4.tar.gz
ln -s jruby-1.1.4 jruby
export PATH=$PATH:$HOME/software/jruby/bin

# install the version of rails wanted by jruby
jruby -S gem install jruby-openssl
jruby -S gem install rails

# list your gems
jruby -S gem list

# install the gems needed for db
jruby -S gem install activerecord-jdbc-adapter activerecord-jdbcmysql-adapter

# generate some code
cd ~/scripts/ruby
jruby -S rails wherehaveyoubeen -d mysql
cd wherehaveyoubeen
jruby script/generate controller states index

# configure access to the database server
vi config/database.yml

#development:
# adapter: jdbcmysql <- very important!
# encoding: utf8
# database: wherehaveyoubeen_development
# username: root
# password: database
# socket: /var/run/mysqld/mysqld.sock

# generate the db
jruby -S rake db:create:all
jruby -S rake db:migrate


# edit your app
sudo apt-get install emacs ruby-elisp irb1.8 emacs22-el
emacs -bg black -fg wheat app/views/states/index.html.erb

# uncomment the secret in app/controllers/application.rb
vi app/controllers/application.rb

# run your app
jruby script/server

# go to your app
GET http://0.0.0.0:3000/states

Monday, September 22, 2008

Adding subversion to eclipse on linux (ubuntu)

You want to use subversion in eclipse? You will need a javahl implementation.

Ubuntu has a javahl package:

sudo apt-get install libsvn-java


Then add this to your eclipse.ini:

-Djava.library.path=/usr/lib/jni

Monday, August 4, 2008

Simple shell for loop

Simple for loop in shell to run a command n times.

for i in `seq 1 10`; do your_command_here.sh; done;