November 19, 2010

Alt Left Arrow in Terminal

Another Mac annoyance is jumping word to word in a terminal window. There are several forum posts about this, but I managed to get them wrong, so I'm adding another that works for me:

Open Terminal > Preferences > Settings > Keyboard.
Click the + and set values as below.
The trick is to get the textbox to take the correct value. To do this, get it in the clipboard and paste it so it looks like this.
For your ease, you can copy these values for left: \033b and right \033f.

Command-K to Search

I've been re-acclimating to working on a Mac. There are a few differences that annoy me, one of which is hitting Command-K to get to the search box in Safari. This is standard on Firefox and Chrome.

As usual on a Mac there is a solution, but it may take a bit to find the right incantation to get it working.

Open System preferences and select "Keyboard" then "Keyboard Shortcuts".
On the left select "Application Shortcuts" and click the +.
Select "Safari" for application and enter "Google Search..." for the menu title.
Enter Command-K in the shortcut box and you are all set.

February 26, 2009

Ubuntu Java Locking errors in GWT

When doing GWT development on Ubuntu 8.10 I get the following errors:

Locking assertion failure. Backtrace:
#0 /usr/lib/ [0x889037c7]
#1 /usr/lib/ [0x88903891]
#2 /usr/lib/ [0x86f02494]
#3 /usr/lib/jvm/java-1.5.0-sun- [0x88051dce]
#4 /usr/lib/jvm/java-1.5.0-sun- [0x8803bd77]
#5 /usr/lib/jvm/java-1.5.0-sun- [0x8803bef3]
#6 /usr/lib/jvm/java-1.5.0-sun- [0x8803c136]
#7 [0xb148b008]
#8 [0xb1484b6b]
#9 [0xb1484b6b]
#10 [0xb1482236]
#11 /usr/lib/jvm/java-1.5.0-sun- [0xb7717eec]
#12 /usr/lib/jvm/java-1.5.0-sun- [0xb78e7ae8]
#13 /usr/lib/jvm/java-1.5.0-sun- [0xb7717d1f]
#14 /usr/lib/jvm/java-1.5.0-sun- [0xb777582d]
#15 /usr/lib/jvm/java-1.5.0-sun- [0xb742130d]
#16 [0xb148a898]
#17 [0xb1484a94]
#18 [0xb1482236]
#19 /usr/lib/jvm/java-1.5.0-sun- [0xb7717eec]

I found a fix in this post


sudo vi /usr/lib/jvm/java-1.5.0-sun-

April 16, 2008

Setting up Ubuntu 8.04 for Java Development

At work, I've been getting frustrated with how poorly Windows XP performs for Java development.

At my last work I got on a pilot program to us a Mac, and the compile time for the entire project went from 20 minutes for a clean build to 2 minutes, yes that's correct, 10 times faster. Why? I think there are a handful of reasons, first I have noticed that compiling Java programs is fairly IO intensive. NTFS seems to be a rather inefficient file system (the native file system for XP). Also if you use XP you need to use virus protection to keep from getting infected by every 10th bit on the internet (OK, that is a bit of an exaggeration), and most paranoid IT departments want real time scanning. This sounds good at a theoretical level, but funneling all your OS's disk access through a single software process is a pretty solid recipe for poor performance (the above timing improvement was with virus scanning disabled). During build times, the processor was not at 100% or even 50% most the time, it was the hard disk that was over-taxed.

So at my new job, I wanted to get as close to the Mac as I could without having to convince them to spend money. The solution: Linux. There are lots of choices for a distribution, the top contenders in my list are Fedora (closest to what our production systems run), OpenSuse (pretty user friendly and supported mainstream) and Ubuntu. I prefer Ubuntu because it just works without a lot of fuss and the forums are pretty active with answers to most of what I want to accomplish.

Here is my setup:
  • 64-bit OS so I can use full 4GB memory and video drivers work well (running ati 32bit drivers on 32bit OS on 64bit hardware doesn't work too well)
  • Oracle 10gR2, this can be a pain to setup and I almost gave up but I found this blog and this forum that gets it working. (Note that you also need to get
    sudo apt-get install gcc-multilib g++-multilib)
  • MySQL (yes I need two databases)
    sudo apt-get install mysql-server

  • Cisco VPN client (network-manager-vpnc)

  • ant, maven

  • kdiff3 for code read comparisons

  • svn-workbench, subversion for source control

  • Oracle SQL Tools

    • DBVisualizer (commercial)

    • SqlDeveloper (free from Oracle)

  • archiva to proxy maven repos for performance

  • ArgoUML for design

  • Java IDE: Eclipse, Netbeans or IntelliJ. I use IntelliJ

February 23, 2007

xorg.conf settings for NEC P1250+ Monitor

I seem to always be looking for these settings so I'm putting them here:

# NEC P1250 +
Section "Monitor"
DisplaySize 384 288 # mm
Identifier "Monitor0"
VendorName "NEC"
ModelName "P1250 +"
HorizSync 31-110 # DDC-probed
VertRefresh 55-160 # DDC-probed
Option "DPMS" "true"
Option "BackingStore" "On"

These settings were found here.

February 20, 2007

Creating an Mylar Connector Plugin for Jotspot

Creating an Mylar Connector Plugin for Jotspot

Jotspot is a wiki system that allows you to create forms and code for your wiki pages. My current project uses it for project planning and story (agile) management. It was recently purchased by Google and during their migration to Google's infrastructure new accounts are on hold, but should eventually be opened up. This is how I created a connector for our project hosted there. The intent is to give an overview of what needs to be implemented and where. I won't go through all the detail for each step, for example when it is time to query the repository for tasks I'll show what needs to happen upto and including the method call, but I won't show the details of the connection to Jotspot. Hopefully this will enable you to create your own connectors to your repositories.

Plugin Structure

The Mylar documentation suggests creating two plugin projects to implement your repository connector, the *.ui project and the *.core project. They also recommend modeling your connector after the Trac connector. For this connector I created the following two plugin projects and included the Trac plugin projects for reference:

Add Repository

The first step is to get the Mylar UI to recognize your repository when you select add repository. This shows up in the Task Repositories view:

Click the add repository icon. This launches this dialog box:

You can see the Jot Repository Item added by this project. The plugin will contribute all the extensions and reference as needed. First we need to do some initial setup. When you created the *.ui plugin it should have opened the plugin manifest editor. Fill in some appropriate values.

The next step is to add the dependencies, using the Trac UI plugin as a reference:

The will only be available after you've created that project. This should cover the classes referenced from the UI. Now onto the functional part, adding the extension that will list Jot as a repository in the Add Repository wizard. click the Add button and select org.eclipse.mylar.tasks.ui.repositories.

Now add a new connectorCore to that repository connector:

Edit the Details as follows:

The JotRepositoryConnector is a new class in the *.core project. You can click on the class hyperlink to create this class and extend org.eclipse.mylar.tasks.core.AbstractRepositoryConnector. Implement the getLabel() and getRepositoryType() to return "Jot Repository" and "jot" respectively. We now have Jot showing up in the Add Repository wizard.

Unfortunately nothing happens when you click next. To get this to work a JotRepositoryUi class must be added. Right click on the *.repositories extension and click new -> connectorUi. Click the class hyperlink and create a new JotConnectorUi class that extends org.eclipse.mylar.tasks.ui.AbstractRepositoryConnectorUi. Setting the icons here will add the icon to the Add Repository wizard.

When the next button is clicked the JotRepositoryConnector.getRepositoryType() is called checked against the same call on JotConnectorUi. This associates the to classes, if they match the icons are used and when next is clicked in the wizard the JotConnectorUi.getSettingsPage() is called as the next step in the repository setup. To show the settings page getSettingsPage() must return something that extends org.eclipse.mylar.tasks.ui.wizards.AbstractRepositorySettingsPage. Create a new class called JotRepositorySettingsPage that extends AbstractRepositorySettingsPage. You'll need a constructor that takes AbstractRepositoryConnectorUi as a parameter. In this constructor pass along the AbstractRepositoryConnectorUi with a title and description string to super. The only method you need to implement to get things working is to implement the isValidUrl() method. Once this is done you can successfully add the repository:

List Tasks

For this repository to really be useful, it needs to be able to query for a list of tasks, create a new task and update an existing task. When New Repository Task is clicked, each repository (AbstractRepositoryConnector) has its canCreateNewTask() method called if it returns true it is listed in the available repositories.

When Next is clicked JotRepositoryUi.getNewTaskWizard() is called. This method must return a valid wizard with at least one WizardPage added in the Wizard.addPages(). That WizardPage must add at least one control in its createControl method. It is up to you to generate the appropriate form on the page. When finish is available the Wizard.canFinish() should return true. When finish is clicked the Wizard.performFinish() method is called. This should complete the wizard. Both the NewTracTaskWizard and the NewWebTaskWizard open an editor on the wizard's finish.
(In Progress)

December 18, 2006

Setting Default Text File Encoding in Eclipse

I was recently working with a set of SQL migration scripts in eclipse and started noticing that the localized characters weren't showing correctly. I've seen all kinds of chaos in my project with different file formats creeping into the sources and database. So I did a looking and found that Eclipse was defaulting to Cp1252 for the encoding. This is a pain and the cause of my files not displaying. So went into Window->Preferences... and Opened General->Workspace and changed the Text file encoding setting to UTF-8. Now all is good again.

December 14, 2006

How to query Oracle Schema

I have been trying to query the difference between Oracle Schemas for a project I'm working on.

  • get SQL Developer (free) from Oracle

  • I needed was a list of the system tables in Oracle which I found here.

  • Next log in as the user who's schema you want to print.

  • The basic query you want is:

    , column_name
    , data_type
    , data_length
    where t.TABLE_NAME = c.table_name;

  • run the script using F5 and select the Script Output tab

  • Save the output

You can repeat this process for other schemas and use a diff tool like beyond compare to find the differences.

December 01, 2006

Good RSS Reader in Java

I heard about BlogBridge this week from the Java Posse. it is a good RSS Reader written in Java. This means that I can use the same reader in Windows and Linux. Even better if you sign up with their free service you can store your settings and feeds online so you don't have to reconfigure your reader on each system. Very cool! It has an interesting Guide, Feed Article view that allows you to group sets of feeds under a category.

November 22, 2006

Javascript Object Literals

For a while now I've been experimenting with the dojo toolkit. I have been puzzling over what the following meant.

var something =
{ somename: "some value",
anothername: "another value",
more: function () { alert("called"); }

It is hard to come up with a search query for this. At first I thought it might be some sort of dictionary or hash table shorthand. However, I finally found that it was an object declaration shorthand and is equivilent to

var something = new Object();
something.somename = "some value";
something.anothername = "another value";
something.more = function () { alert("called"); };