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 ;)

22 November 2007

Symbolic link

Keep forgetting how to add a framework:

cd /Libarary/Frameworks

Then add your framework like this example with EkjaFramework in my Developer workspace:
ln -s /Developer/workspace/EkjaFramework/dist/EkjaFramework.framework/ EkjaFramework.framework

15 November 2007

WOCheckBox binding

Keep forgettins it's the cheked binding to use, not value or selection.

24 October 2007

S5 slide show presenter

Online presentations S5 is a great tool for setting up slides shows in a browser. Check out the intro.

19 October 2007

My favorite Eclipse shortcuts


Select the current word

Ctrl + Shift + left/right arrow

Comment out selected lines

Opt + 7

Open Type

+ Shift + T very handy when you know the name of the class you need to check

Move selected lines up/down

Alt + up/down arrow

Copy selected lines up/down

Alt + Shift + up/down arrow

Bring up refactoring menu

Alt + Opt + T

Insert WOComponent

Opt + 6

Rename WOComponent

Opt + 2 then R

18 October 2007

SQL Server 2000 IDENTITY_INSERT

SQL Server has got identity for primary keys( see this article ) that was preventing me from inserting into a table with EO.

To get by this you can just set the identity insert to on with:

EOUtilities.rawRowsForSQL( ec, modleName, "SET IDENTITY_INSERT tableName ON", NSArray.EmptyArray );

Note that you might need to get the new primary key( identity ) yourself, ex.:

NSArray rawRows = EOUtilities.rawRowsForSQL( ec, modleName, "SELECT MAX(idenityColumnName) as NR FROM tableName", NSArray.EmptyArray );
NSDictionary rowWithPK = (NSDictionary)rawRows.objectAtIndex(0);
Object maxPK = rowWithPK.objectForKey("NR");
int primaryKey = (new Integer(maxPK.toString())).intValue();