15 August 2008

Qualifing an array

EOQualifier.filteredArrayWithQualifier( ARRAY, QUALIFIER );

12 August 2008

Reverting back to an older version of Eclipse/WOLips

When all hell breaks loose when upgrading Eclipse/WOLips:
1. Go to Help - Software updates - Manage Configuration
2. Select what you want to replace and click "Replace with Another Version" and select the desired version.

JAVA_HOME on mac

export JAVA_HOME=/Library/Java/Home

01 July 2008

NSArray sorting

Don't forget the little magic in

EOSortOrdering.sortedArrayUsingKeyOrderArray( form.elements(), new NSArray( ERXS.asc( Element.ORDER_KEY ) ) );

Unlimited email address with your Gmail

You can send yourself emails with the plus sign(+) after your gmail address and then any text you want after the plus sign and it will show up in your inbox. Ex. if your gmail address is rass@gmail.com you can send yourself and email to rass+gat@gmail.com.

This can be quite handy when giving your email to "unknown" websites and also with filters you can organize your email pretty neatly.

Note that not all website forms allow you enter the + sign, in those cases you can also replace gmail.com googlemail.com, e.x. rass@googlemail.com is delivered to rass@gmail.com ;)

More on this at digitalalchemy.tv

07 May 2008

CallableStatement date&time parameter

After spending an enormous amount of time trying to include the time with a java.sql.Date call to a Stored Procedure through CallableStamtent I found out that CS also accepts Timestamp...that really made my day =)

27 March 2008

The caret synbol( ^ ) in bindings

The caret symbol( ^ ) indicates that the value should be taken from the parent component.

11 March 2008

Getting resources from Unit Tests

Since Unit Tests are run from the command line( or Ant ) access to Resources of a WebObjects project are no good with ResourceManager. Simple functions to get resources based on the filesystem:


/**
* Returns a path to a resource filename in a folder(s) under the root folder
* */
private String resourceLocationString( String filename, String folder ) {
String urlToFile = getClass().getResource( "/" ).toString();
urlToFile = urlToFile.replace( "bin/", "" );
urlToFile = urlToFile.replace( "file:", "" ); // now we should be at the projects root directory
urlToFile = urlToFile.concat( folder + "/" + filename );
return urlToFile;
}

/**
* Returns data for pdf file
* */
private byte[] bytesForPDFResource( String urlToFile ) throws FileNotFoundException, IOException {
FileInputStream in = new FileInputStream( urlToFile );
byte[] data = new byte[in.available()];
in.read(data);
return data;
}

Write data to a file in the filesystem


FileOutputStream fs = new FileOutputStream( ABSOLUTE_PATH_TO_FILE );
fs.write( SOME_DATA );
fs.close();

18 January 2008

Executing SQL

Need to call simple SQL commands, like getting the next primary key by calling a sequence:


NSArray rawRows = EOUtilities.rawRowsForSQL( EDITING_CONTEXT, MODEL_NAME, SQL_STRING, NSArray.EmptyArray );
NSDictionary rowWithPK = (NSDictionary)rawRows.objectAtIndex( 0);
Object maxPK = rowWithPK.objectForKey( "NR" );

16 January 2008

Pro Tools EZDrummer plug in output

Installined EZDrummer and created a stereo Instrument track in Pro Tools LE 7.1.1 but didn't get no output from the track. I had other audio tracks that worked fine, and creating a stereo audio track got the output from EZDrummer but you need the Instrument track to drop the midi loops onto. After about 2 hours of hacking Pro Tools, reading forms, reading manuals and other desperate measures I noticed that the volume on my Instrument track was turned down and the only thing I needed to do was to crank it up. Since this is not the case with audio tracks tracks I failed to check this...that won't happen again ;)