Ramblings

March 31, 2008

Getting Cairngen to work with Eclipse and Tiger

Filed under: cairngen, cairngorm, eclipse, tip, tool — michaelangela @ 11:06 pm

Thanks to Darren who added some notes on it, there may be hope yet! (I copy things things here to my blog in case the original sources disappear as many others have done… :-()

And Darren, yes it did help very much!

Eric Feminella: Solutions Architect, Rich Internet Applications » Blog Archive » Cairngen 2.1

For anyone interested, I’ve worked out how to get Cairngen running
on Tiger. It probably works for Leopard too. It wasn’t easy as there’s
no (official) JRE 1.6 available but now I’ve got there, it’s reasonably
straightforward. You just have to add BSF, Rhino and Commons-Logging
jars to your Ant classpath. Like so:

1. Download and copy bsf.jar and js.jar to your Ant lib directory. Get them here:

http://jakarta.apache.org/site/downloads/downloads_bsf.cgi
http://www.mozilla.org/rhino/download.html

2. In Eclipse->Preferences->Ant->Runtime->Classpath, add
the 2 jars above (Add External JARs button), as well as
org.apache.commons.logging._*.jar (which should already be in your
Eclipse plugins directory). I’ve added them to Ant Home Entries which
works for me.

That’s really all there is to it. Then, as Eric says, you have to
run the appropriate targets in your Ant build file if you want to
create delegates, events, vo’s, etc. I couldn’t find an explanation as
to the best way to do this so I just added the targets to line 63 of
build.xml so it’s now:

depends=”log, create-model-locator, create-front-controller,
create-service-locator, create-multiple-sequences-include-delegates,
create-multiple-value-objects” />

I hope this helps.

Starting Eclipse with an alternate VM

Filed under: cairngen, cairngorm, eclipse, java, tool — michaelangela @ 10:29 pm

So I was trying out the Soylatte Java VM to get it to work with Eclipse so I could use Cairngen on a 10.4 Mac. I got an error after working with some Eclipse configurations so that Eclipse started with errors and didn’t allow much work. However starting from the command line (/Applications/eclipse/eclipse) got me back. I can also set the VM I want to use with the -vm argument. (Side note, I can use Scribefire’s “Custom HTML” option to insert <code> tags where needed it seems!)

Java Runtime Environment (JRE) – How to change the default JRE when there are several version of JRE in Sys

I recently installed Oracle 9i client on my new box
and now Eclipse will not start. I get an error

You can set the path to your VM in the eclipse start command:
eclipse.exe -vm <path-to-your-javaw.exe>

e.g.
eclipse.exe -vm c:\program files\java\jdk1.5.09_09\bin\javaw.exe

Another way is to locate the VM with your path environment. Set the variable JAVA_HOME to the root path of your VM installation. Update your path settings and remove all occurences of java. At the end add the following: %JAVA_HOME%\bin
Now delete javaw.exe and java.exe from your windows\system32 directory. They’re not needed, because they are in your path.

So all java programs are in the path. To change the VM you only need to change the JAVA_HOME variable.

Java 6 Port for Mac OS X 10.4 and 10.5 (Intel)

Filed under: cairngen, dev, java, tool — michaelangela @ 9:20 pm

What ho! Hey I just complained about no Java 6 for the Mac and then this pops up! Now will it work for what I am trying to do with Cairngen?!

SoyLatte – Port of BSD Java

SoyLatte is a functional, X11-based port of the FreeBSD Java 1.6 patchset to Mac OS X Intel machines. SoyLatte is initially focused on supporting Java 6 development; however, the long-term view far more captivating: open development of Java 7 for Mac OS X, with a release available in concert with the official Sun release, supported on all recent versions of Mac OS X.

The name “SoyLatte” was chosen to clearly differentiate from Sun’s trademarks (Red Hat already claimed IcedTea, and I drank a lot of double soy lattes while working on this. (I think it’s funny)

The work is being done as a part of the FreeBSD Java project, with changes being pushed upstream to the FreeBSD code base as the port progresses. Coordination with OpenJDK is also progressing. SoyLatte is a staging ground for the Mac OS X port — it is not intended to be a fork. For more information on licensing, and the project’s relationship with FreeBSD and OpenJDK, please see the licensing section below.

Cairngen, Eclipse and “Unable to load a script engine manager”

Filed under: cairngen, cairngorm, dev, java, tool — michaelangela @ 9:16 pm

I need to add a bunch of functionality and I really want to automate the file creation so I just started trying out Cairngen. I got this “unable to load a script engine manager” error. Fortunately I had just checked my Java VM version (default Mac OS 1.5) and according to this post I need at least JRE 6. Let’s see now… hrmm… Java on a Mac is a little trickier than I thought… distressing

Eric Feminella: Solutions Architect, Rich Internet Applications » Blog Archive » Cairngen 2.1

  1. Leif Wells UNITED STATES Says:

    November 19th, 2007 at 10:46 am

    Eric, I am trying to use Cairngen 2.1 in FB 3 beta 2 (stand-alone) and getting an error:

    BUILD FAILED

    C:\…\build.xml:373: Unable to load a script engine manager (org.apache.bsf.BSFManager or javax.script.ScriptEngineManager)

    Have you seen this before? Is there a software update I need to install? If so, which one?

    Thanks,

    Leif

  2. eric UNITED STATES Says:

    November 19th, 2007 at 11:59 am

    Hey Lief,

    You need to upgrade to JRE 6. First download and install at: http://www.java.com/en/download/manual.jsp

    Once you have upgraded the Java Runtime, restart Eclipse and from
    the toolbar select Windows > Preferences > Java (expand) >
    Installed JREs > Add > Browse (browse to Java Installation and
    select latest JRE). Click OK.

    Restart Eclipse and you should be good to go. Let me know if you have any problems.

    – Eric

Quicksilver tip: Copying a folder path to the clipboard

Filed under: quicksilver, tip, tool — michaelangela @ 8:44 pm

I’m sure this is out there somewhere, but for me it’ll be right here. 🙂 Plus it’s a multi step process which I didn’t actually expect. It’s not complicated but it’s longer than I thought. Maybe there is an easier way?

I wanted to copy the path of a source folder into Eclipse for Cairngen. I navigated to the folder in Quicksilver but wasn’t sure how to get the path. You have to:

  1. Cmd+G to the selected folder
  2. Tab to command pane
  3. Some combination of letters of “get file path” to get the file path (Quicksilver jumps back to the 1st pane with your path there now)
  4. Tab to command pane
  5. Copy to Clipboard

It seems longer than it actually is. And it’s a whole heck of a lot shorter than anything else I know of… so no complaints here!

Cairngen moving to Google Code

Filed under: cairngorm, dev, education, flex, tool — michaelangela @ 8:23 pm

I use Cairngorm. It’s main strength is making sure you put code where it should go. It goes by the MVC mantra which, in and of itself, is really good. The problem? To add one new capability, you sometimes have to add… I forget how many new class files:

“Hmm… need a button here to do X… ok… we need XEvent, XCommand, XController, XDelegate… *creating files* *doh typo!* *editing files* *doh!* *a few more ‘doh!’s* OK. Good.”

Cairngen aims to replace that problem (and a few others) by allowing you to generate the files in one go. I haven’t tried it yet but maybe now is the time?

Eric Feminella: Solutions Architect, Rich Internet Applications » Blog Archive » Cairngen Project moved to Google Code!

In order to provide a solid foundation to help facilitate a
collaborative Open Source initiative for the Cairngen Project I have
decided to move the project to Google Code.

Moving Cairngen to Google Code
allows for a number of significant development benefits for the
Cairngorm Community. This includes regular development updates, access
to all releases, availability of all source code revisions, better
documentation, defect lists, feature requests and much more.

Speed reading…

Filed under: education — michaelangela @ 8:15 pm

I really need to learn how to speed read. There is just TOO MUCH to read! Er… too much I want to read.

Flex Builder on Linux?!

Filed under: adobe, flex, linux — michaelangela @ 7:10 pm

This stuff just doesn’t stop! Woohoo! This is good though… I wonder if the license will be cross platform so current users can move to Linux…

Ted On Flex: Hello AIR/Flex Builder on Linux

This morning we launched the Alpha release of AIR for Linux and an updated Flex Builder for development on Linux. It is great to see Adobe providing both runtime and development support on Linux for Web applications using Flash Player and Desktop applications using AIR.

PyAMF flying high

Filed under: django, education, flex, pyamf, python, web2py — michaelangela @ 7:08 pm

More python/Flex goodness in the works in the future perhaps? 🙂 I really like Python… learning all the time with my web2py friends. I’d love to be able to combine this with Flex. Looks like it’s getting easier and easier. Now to combine this with Orbited

Ted On Flex: The AMF Revolution

The growth of AMF since the release of Blaze DS and the AMF spec
has been nothing short of amazing. I continue to see lots of great new
server software projects leveraging AMF data formats. This morning I
was reading the FlexCoders mailing list and an announcement of a new AMF library “PyAMF – AMF for Python” appeared leveraging Python targeting Twisted (I love twisted), Django, Pylons, TurboGears and CherryPy. Seeing a single project add this much functionality into Python web development is really great for the Flash/Flex developer community.

Python
PyAMF Project
PyAMF Examples

Create a PDF via Share’s API

Filed under: adobe, business development, pdf, tool — michaelangela @ 7:03 pm

And so now, you can also create PDFs via their API? I’ll have to look into that later…

Collaborative Methods

SHARE was updated late last week – see here.
In addition to some really cool new features (e.g. full screen embedded
document), you can now convert an uploaded document into a PDF!
Naturally with every new feature we add, we expose that functionality
via our APIs.

Free online document collaboration?

Filed under: adobe, pdf, tool — michaelangela @ 7:01 pm

Adobe Labs – SHARE

With Share you can:

  • Convert 5 documents to Adobe PDF.
  • Send documents without email attachments.
  • Access your documents from anywhere.
  • View all the documents you have shared or received in one place.
  • Post a link to your document on a wiki or blog.
  • Embed a Flash® preview of your document on any website.
  • Limit access to a document to a list of recipients.

Yahoo maps released an AS3 version!

Filed under: as3, component, dev, flash, flex, map — michaelangela @ 6:52 pm

There once was an app that wanted a map, but alas there was no map for the app. The app was content to use AS2, but it was too slow, too slow it was. Then there was a hack, of modest maps. It was not quite released for use but it was there nonetheless so used it was. It was hacked until it and AS3 and Flex were friends and friends they were for a long time. Now comes Yahoo Maps AS3 so dearly wanted so long ago.

OK, ok enough of that. I couldn’t keep it up myself any longer (bad influence of Monty Python on me… the “Silly Police” should be here momentarily).

Yahoo announced Yahoo Maps AS3 which would have been great a long time ago… maybe for a future rev of an app I would like to do. 🙂

Yahoo! Developer Network – Flash Developer Center – Yahoo! Maps AS3 Component

The new Yahoo! Maps API is now entirely built in ActionScript 3.0. The Maps API now gives you an incredibly powerful map engine and the ability to create custom components, overlays and markers while consuming different webservices provided by Yahoo!, or your own. The YahooMap component is distributed as a SWC, to get started you need to include it into your build path using Flex Builder.

The Maps API contains a core set of widgets, markers, overlays and web services to enable you to interact with the map in every way.

Cairngorm and views responding to server side events

Filed under: cairngorm, education, flex — michaelangela @ 6:26 pm

I’ll have to dig up the links for this as a reference. But I started an app in Flex. I wanted a good framework to work with to help me organize the code, get some “best practices”, etc. I chose the then standard Cairngorm currently hosted at Adobe. Everything was happening client side so all was good. That was because with Flex, you can use data binding. That means your user interface elements can simply be “bound” to a certain bit of data. When the data updates, the UI element updates, automatically. That’s cool.

However I started to add server side processing. UI controls mapped directly to data, even data processed on the server side, is still updated automatically. However, what if I want to notify the user that data on the server has finished? How do I notify different UI elements about such things as “your data is saved”, “your data is NOT saved”, etc.?

Linking that sort of data becomes hard to do, and also hard to maintain. I seemed to be at a loss of what to do. This is where the reference links would come in. There was actually quite a bit of discussion about this and, in the end, what I needed, or at least what I concluded, was actually not recommended for Cairngorm.

In Cairngorm, you have models and you have views. (You also have controllers to complete the MVC pattern.) When your model changes (meaning your data changed), your views which are bound to the model update. This doesn’t leave room for UI notifications, etc. The pattern I found that I was after is called ViewHelpers or ViewLocator. Basically it’s a way to wire your views to listen for events for updates, specifically for user notifications.

There was even a good post about why you should just add responders to a Cairngorm event so that the view can be notified directly as a callback on that event. That’s good… except it makes the assumption that the only view interested in that event is the one that triggered the event. That’s not always the case.

I hit this because I wanted to do drag and drop from one Flex UI component to another. When the user drops the object, an event is fired to save data to the server. The originator of the event though was the not the view I wanted to update. I eventually did find ViewLocator/ViewHelper patterns to use, which helped tremendously, even though others disagree with the implementation.

Interestingly enough, a newer Flex framework called PureMVC doesn’t have these issues. The idea of any view being able to be notified by any event is assumed. If I have time, I will try to learn that system as it seems to be closer to the way I think… or perhaps how I want to think. 🙂

The following link has a good discussion about Cairngorm in general… just here for my own reference.

Flex and Flash Developer – Jesse Warden dot Kizz-ohm » Blog Archive » Cairngorm vs. Joe Berkovitz’s MVCS

Quicksilver – get the item selected in Finder

Filed under: cool, education, quicksilver, tool — michaelangela @ 5:31 pm

I hadn’t used this shortcut much so I kept forgetting it. This page has many such reminders. 🙂 The shortcut is cmd+G

QuickSilver Keyboard Shortcuts

Grab file – puts current selection from Finder/Path Finder as active item in QS

March 30, 2008

Running postgresql createdb from batch without password prompt

Filed under: dev, web2py — Tags: , — michaelangela @ 3:10 am

As noted in this post, you need to change a line in pg_hba.conf to “trust” instead of “md5” (no quotes) to be able to batch create tables. Note this is only for testing purposes and not recommended for production. The only reason is because I am running some benchmarks for web2py. I want to be able to create the database itself from within the benchmark script and not have to create it each time.

Error while running createdb from a batch file in windows xp – PostgreSQL Forum

Unless you set up your database access with the “trust” option this prompt is probably asking for your password, not the password for the username you passing to the createdb command.

March 29, 2008

Who wouldn’t like an EMPTY INBOX?!

Filed under: cool, education, gtd, tool — michaelangela @ 10:18 pm

More goodness from the 43 Folders folks…

43 Folders Series: Inbox Zero | 43 Folders

The original 43 Folders
series looking at the skills, tools, and attitude needed to empty your
email inbox — and then keep it that way. Don’t miss the free video of Merlin’s Inbox Zero presentation.

Getting things done…

Filed under: education, gtd, tool — michaelangela @ 10:17 pm

43 Folders has tons of neat productivity stuff. This is one thing I actually have to go through still. The concept is cool and (apparently) useful.

Getting started with “Getting Things Done” | 43 Folders

I’ll be talking a lot here in coming weeks about Getting Things Done,
a book by David Allen whose apt subtitle is “The Art of Stress-Free
Productivity.” You’ve probably heard about it around the Global
Interweb or have been buttonholed by somebody in your office who swears
by GTD.

Get your windows Outlook to your Mac

Filed under: mac, tool — Tags: , — michaelangela @ 10:15 pm

A friend asked about doing this and this is one clean non-techie way that is cheap and may perhaps work. The reference link is pretty old though so perhaps there is something newer.

Little Machines

O2M may be the fastest way to move your Windows® Outlook® email, contacts, and calendar appointments from your PC to your Macintosh® computer! (1) Just fire up O2M on your Windows PC, pick the Outlook folders you want to export, choose the filtering options you want to use, and click Start — O2M does the rest, automatically exporting your Outlook data into portable files you can import directly into your Apple® Mail, Address Book, iCal, Microsoft Entourage, or other Macintosh-compatible programs. Back up all of your PC’s email and email attachments to your Apple! Copy your Outlook contacts from work to home and vice-versa! Migrate all of your calendar appointments from your old PC to your new Mac! The possibilities are endless!

Eclipse performing slow on a windows box

Filed under: dev, education, tool — Tags: — michaelangela @ 6:48 pm

I have Eclipse on a windows box that is performing VERY slowly… I forgot that I haven’t changed the memory settings on that. This is a little info on it.

zeekoxBlog: speed up Eclipse under linux

1. use official java VM
2. add/modify params in eclipse.ini:
-Xms1024m
-Xmx1024m
-XX:PermSize=256m
-XX:MaxPermSize=256m

Some of that comes from here:

EclipseZone – Tuning Eclipse Performance and Avoiding …

For a machine with 512MB of ram with the developer mainly using just

Eclipse (any maybe a browser and IM) I would suggest the following
arguments:
-vmargs -Xms256m -Xmx256m
-XX:PermSize=64m -XX:MaxPermSize=64m

So for the box I am referring to, I will try this for the shortcut target:

C:\eclipse\eclipse.exe -vmargs -Xms256m -Xmx256m -XX:PermSize=64m -XX:MaxPermSize=64m

Initial impression… nice speedup indeed!

Exporting a web2py table in XML

Filed under: cool, dev, education, one-liner, orm, web2py — michaelangela @ 4:02 am

I recently wrote about exporting a Django database to xml. As a courtesy, Massimo, creator of web2py, put together a great little example for web2py

exporting in XML – web2py Web Framework | Google Groups

def export_xml(rows):
    idx=range(len(rows.colnames))
    colnames=[item.replace('.','_') for item in rows.colnames]
    records=[]
    for row in rows.response: records.append(TAG['record'](*[TAG[colnames[i]](row[i]) for i in idx]))
    return str(TAG['records'](*records))>/pre>

Here is how you would use it:

assuming:
db=SQLDB('sqlite://test.db')
db.define_table('mytable',SQLField('myfield'))
for i in range(100): db.mytable.aaa.insert(myfield=i)




def index():
    response.headers['Content-Type']='application/xml'
    return export_xml(db().select(db.mytable.ALL))

This is using the version currently in trunk. The next update (1.28) should be out in about 1 week though so it should be possible with the release version very soon. One thing I really like about web2py’s tag handling is the TAG item. You can make any tag needed with that and it’s quite sweet.

This particular example just defines the export function, defines a database, a connection, a table, populates the table, and shows how to use it. Sweet. If I get the change, I’ll port a current Django app to web2py… but future apps will be on web2py I think.

And the server is using the wsgi server of cherrypy so it’s rockin’.

We saw 3 whales and hundreds of dolphins!

Filed under: cool, education, experience — Tags: , — michaelangela @ 3:04 am

Whale watching… something I have only seen on TV. Today it was live and in living color! Very, very cool. Highly recommended. We saw 3 whales and several hundred (!!!) porpoises. What a blast! Have to wait to see if any pics come out though. 🙂

Orange County Whale Watching Cruises, Dana Point, California (CA)

Whale Watch 2008
Sightings log since Dec. 4 (average 3 whales per day)

Gray whales – 220
Minke whales – 8
Fin whales – 18
Humpback – 1

For executives, entrepreneurs, and other digerati who need to know about SaaS and Web 2.0

Filed under: Blogroll — michaelangela @ 2:56 am

SmoothSpan Blog

March 28, 2008

Using an item renderer with a tree control

Filed under: dev, flex — michaelangela @ 5:24 am

I’m going to need this in a few days…

Example: Using an item renderer with a Tree control — Flex 2.01

For the Tree control, you use the itemRenderer
property to specify a single renderer for all nodes of the tree. If you
define a custom item renderer, you are responsible for handling the
display of the entire node, including the text and icon.

One option is to define an item renderer as a subclass of the default item renderer class, the TreeItemRenderer class.

web2py new website

Filed under: cool, dev, python, web2py — michaelangela @ 4:20 am

Web2py is humming along and just got a redesigned front page. Nice, clean, and accessible. Gotta love the “complex” tutorial. Fits in a page! 🙂

web2py Enterprise Web Framework

A taste of web2py

Consider the following complete application which consists a model (which describes the data representation): db.py

1.
2.
db=SQLDB('sqlite://images.db')
db.define_table('image',SQLField('file','upload'))

a controller (which describes the application logic and workflow): images_examples.py

1.
2.
3.
4.
def index():
form=SQLFORM(db.image)
if form.accepts(request.vars,session): response.flash='image uploaded'
return dict(form=form)

and a view (which describes the data presentation): images_examples/index.html:

1.
2.
3.
{{extend 'layout.html'}}
<h1>Upload page</h1>
{{=form}}

What does it do?

  • Creates the database db in file ‘images.db’
  • Creates the table ‘image’ which contains a field called ‘file’. If
    the table exists but does not match the definition it is altered
    accordingly.
  • Creates a web-based database administrative interface for db.image
  • Creates a web page called index with upload form for db.image. Try it here
  • On upload the file is renamed in a secure way, saved, and the name of the file is stored in a new field db.image record.

Export Django database to xml

Filed under: dev, django, education, web2py — michaelangela @ 4:18 am

Looking at this helps me understand more of what is going on internally with Django‘s models. Using web2py is a bit more intuitive for getting some of this info so it’s probably not too hard to port the concept over… for a future exercise.

/home/siddhi: Export django database to an xml file

Export django database to an xml file
Here is a simple python script to export your django database to an XML file. I haven’t tested it out very thoroughly. It seems to work for the fields that I have in my model – CharField, TextField, DateField, IntegerField, PositiveIntegerField and ForeignKey. If you find any bugs, add a comment to this post.

Older Posts »

Create a free website or blog at WordPress.com.