Here is how to get Flexbuilder working in Linux.

Set up the Flex 3.5 SDK:
cd ~/opt
mkdir flex_sdk_3.5
cd flex_sdk_3.5
wget http://fpdownload.adobe.com/pub/flex/sdk/builds/flex3/flex_sdk_3.5.0.12683.zip
unzip flex_sdk_3.5.0.12683.zip
rm flex_sdk_3.5.0.12683.zip
echo “PATH=\$PATH:\$HOME/opt/flex_sdk_3.5/bin” >> ~/.bashrc

Install Flexbuilder
cd ~/opt
mkdir flexbuilder
cd flexbuilder
wget http://download.macromedia.com/pub/labs/flex/flexbuilder_linux/flexbuilder_linux_install_a5_112409.bin
chmod +x flexbuilder_linux_install_a5_112409.bin
./flexbuilder_linux_install_a5_112409.bin

Now open Eclipse and add the Flex 3.5 SDK in Properties -> Flex Compiler -> Configure Flex SDKs -> add -> choose the folder ~/opt/flex_sdk_3.5 -> ok -> choose to use the “Flex 3.5″ SDK.

Theoretically that should do it, but at the time I did this (8/24/10) some additional steps were required. First I got the error

java.lang.IllegalArgumentException: “The attribute value type is com.adobe.flexbuilder.project.compiler.internal.ProblemManager and expected is one of java.lang.String, Boolean, Integer”

which is a result of this bug. To fix this, follow the instructions here. The instructions were not clear on this point: you need to copy the class file into the inside of the jar file.

The next error I had trouble with was the following:

configuration variable ‘target-player’ must only be set once

This persisted even after I went into Properties -> Flex Compiler and unchecked the box that says “Require Flash Player version”. It turns out that the player version is defined in the SDK in

flex_sdk_3.5/frameworks/flex-config.xml

I edited that file and commented out the line with the required player version. Even after this the error is still there for me… until I applied the patch described here. Now FlexBuilder in Linux is working! Woo hoo!

1/20/2009

I was able to get a Flex client to invoke my first Web Service. I found that on the server side, a Web Service is trivial to code and deploy in a GlassFish server from Eclipse – a welcome relief from the complex BlazeDS configurations we’ve been dealing with. To make an existing class into a Web Service, only a @WebService annotation is needed. On the client side, the invoking code is pretty straightforward – just setting up a few listeners for response and faults. I observed that the Web Service call time (from a client on the same local network as the server, but a different machine) consistently has a pretty even distribution between 15 and 65 milliseconds.

This guide details steps in Ubuntu Linux for creating an end to end system with a Flex web GUI which invokes a Web Service in a Glassfish server. The steps are as follows, assuming a fresh Ubuntu:

  1. Install OpenJDK, Eclipse, and GlassFish
  2. Configure Eclipse for GlassFish
  3. Write, deploy, and test an “Echo” Web Service
  4. Install FlexBuilder Linux Alpha
  5. Write the “Echo” client

Install OpenJDK, Eclipse, and GlassFish

Install OpenJDK and Eclipse

Install GlassFish

Configure Eclipse for GlassFish

In Eclipse:
New -> Project -> Web -> Dynamic Web Project -> Next ->
under “Target Runtime” -> New… -> click “download additional server adapters” ->
select “GlassFish Java EE 5 Server” -> Next -> accept the terms, Finish -> OK -> Yes, restart now

New -> Dynamic Web Project -> Next ->
Name:EchoService
Make sure “Target Runtime” is set to “GlassFish v2 Java EE 5″
-> Finish

Right click EchoService/WebContent/index.jsp -> Run As -> Run on Server -> localhost GlassFish should be automatically selected, Finish
In the console, you’ll be prompted for the admin username and password – enter user: admin, pass:adminadmin

If all goes well you should see an emphatic Hello World!

Write, deploy, and test an “Echo” Web Service

In the EchoService project -> New -> Class -> Name:Echo, Package:echo -> Finish
Paste the following:

package echo;import javax.jws.WebService;

@WebServicepublic class Echo {public String echo(String input) {  return input;}}

The only thing you need to do to write a web service is to add the @WebService annotation.

Right click Echo.java -> Run As -> Run on Server -> Finish

Eclipse will display an error page at “http://localhost:8080/EchoService/WEB-INF/classes/echo/Echo.java”, but thats fine, because that’s not what we’re trying to accomplish.

To see the service, use the GlassFish admin GUI
Go to http://localhost:4848/ user: admin pass: adminadmin
On the left panel, click “Web Services” -> Echo -> Test ->
follow the http link (http://localhost:8080//EchoService/EchoService?Tester)
Enter “Hello World”, then you should see the SOAP messages:

SOAP Request:

<?xml version="1.0" encoding="UTF-8"?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Header/><S:Body><ns2:echo xmlns:ns2="http://echo/"><arg0>Hello World!</arg0></ns2:echo></S:Body></S:Envelope>

SOAP Response:

<?xml version="1.0" encoding="UTF-8"?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Body><ns2:echoResponse xmlns:ns2="http://echo/"><return>Hello World!</return></ns2:echoResponse></S:Body></S:Envelope>

Install Flex Builder

Write the “Echo” client
Create an EchoService Flex Client (sources: here and here and here (source code), Flex docs were also useful)
The URL of your WSDL file is at http://localhost:8080//EchoService/EchoService?WSDL

The following MXML code defines a simple GUI which calls the EchoService

<?xml version="1.0" encoding="utf-8"?><mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"><mx:Script><![CDATA[ import mx.controls.Alert; import mx.rpc.events.ResultEvent; import mx.rpc.events.FaultEvent;

 private var startTime:int; private var endTime:int;

 private function button_click():void {     webService.echo.send(textInput.text);     startTime = getTimer();     timeLabel.text = ""; }

 private function echo_result(evt:ResultEvent):void {     resultLabel.text = "Result: "+evt.result.toString()     calcTime(); }

 private function echo_fault(evt:FaultEvent):void {     Alert.show(evt.type);     calcTime(); }

 private function calcTime():void {     endTime = getTimer();     timeLabel.text = "Time: " + (endTime - startTime) + "ms"; }]]></mx:Script>

<mx:WebService id="webService"<!-- replace this ip address with your own --> wsdl="http://129.63.16.175:8080//EchoService//EchoService?WSDL"><mx:operation name="echo"     resultFormat="object"     result="echo_result(event);"     fault="echo_fault(event);"></mx:operation></mx:WebService>

<mx:Button id="button" label="Call service" click="button_click();" /><mx:Label text="input:" /><mx:TextInput id="textInput" text="Hello Flex!"/><mx:Label id="timeLabel" /><mx:Label id="resultLabel" /></mx:Application>

Replace the ip of the web service with “localhost” or your server ip, which you can find by executing
ifconfig | grep ‘inet addr:’| grep -v ’127.0.0.1′ |cut -d: -f2 | awk ‘{ print $1}’

Alternatively, you could set up the web service in ActionScript as opposed to MXML:

<?xml version="1.0" encoding="utf-8"?><mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="init()"><mx:Script><![CDATA[    import mx.rpc.soap.WebService;    import mx.controls.Alert;    import mx.rpc.events.ResultEvent;    import mx.rpc.events.FaultEvent;

    private var startTime:int;    private var endTime:int;    private var webService:WebService;

    private function init():void{        webService = new WebService();        //replace this ip address with your own        webService.wsdl = "http://129.63.16.175:8080//EchoService//EchoService?WSDL"        webService.echo.resultFormat = "object"        webService.echo.addEventListener("result", echo_result);        webService.echo.addEventListener("fault", echo_fault);        webService.loadWSDL();    }

    private function button_click():void {        webService.echo.send(textInput.text);        startTime = getTimer();        timeLabel.text = "";    }

    private function echo_result(evt:ResultEvent):void {        resultLabel.text = "Result: "+evt.result.toString()        calcTime();    }

    private function echo_fault(evt:FaultEvent):void {        Alert.show(evt.type);        calcTime();    }

    private function calcTime():void {        endTime = getTimer();        timeLabel.text = "Time: " + (endTime - startTime) + "ms";    }]]></mx:Script>

<mx:Button id="button" label="Call service" click="button_click();" /><mx:Label text="input:" /><mx:TextInput id="textInput" text="Hello Flex!"/><mx:Label id="timeLabel" /><mx:Label id="resultLabel" /></mx:Application>

Notes:

Build Failing due to Constructor issue
I was confused for a while about this error:
CLI171 Command deploydir failed : Deploying application in domain failed; Deployment Error — Exception occured in the wsgen process javax.xml.ws.WebServiceException: Unable to create JAXBContext

BUILD FAILED
/home/curran/workspace/.metadata/.plugins/org.eclipse.jst.server.generic.core/serverdef/sunappsrv-ant.xml:203: The following error occurred while executing this line:
/home/curran/workspace/.metadata/.plugins/org.eclipse.jst.server.generic.core/serverdef/sunappsrv-ant.xml:119: exec returned: 1

I realized by reading the log file and reading this that the reason is because the exception type my service threw didn’t have a no-argument constructor, which is apparently a requisite property of objects you send over the wire FROM a seb service.

Tracing Server-side Exceptions
they are appended to the log file at ~/opt/glassfish/domains/domain1/logs/server.log

To see the latest exceptions:
cat ~/opt/glassfish/domains/domain1/logs/server.log

Adding JARS to the server code dependency
put the jars you need into WebContent/WEB_INF/lib of your project

Enjoy!

This Presentation (Part 1, Part 2) about the Eclipse WTP and SOA looks really useful.

Here’s some raw incoherent notes for setup of Eclipse, OpenDJK, and Tomcat in Ubuntu 8.10.

Install OpenJDK and Eclipse

# Install Tomcat manually. Don’t use the Ubuntu tomcat6 package, because it spreads tomcat across the filesystem, making it difficult to configure Eclipse.
# Download tomcat
cd ~/opt
wget http://www.ip97.com/apache.org/tomcat/tomcat-6/v6.0.18/bin/apache-tomcat-6.0.18.tar.gz
tar -zxvf apache-tomcat-6.0.18.tar.gz
# Start the server
~/opt/apache-tomcat-6.0.18/bin/startup.sh
#Go to http://localhost:8080/ to test
#This is the command to shutdown
~/opt/apache-tomcat-6.0.18/bin/shutdown.sh

Configure the Tomcat runtime in Eclipse:
In Eclipse, at Window -> Preferences -> Server -> Runtime Environment -> Add -> Apache Tomcat v6.0 -> Next -> set “Tomcat Installation Directory” to /opt -> Finish -> OK

Download Apache MyFaces libraries
cd ~/opt
wget http://mirror.its.uidaho.edu/pub/apache/myfaces/binaries/myfaces-core-1.2.5-bin.zip
unzip myfaces-core-1.2.5-bin.zip

# we need jet another jar that nobody mentioned
cd myfaces-core-1.2.5-bin/lib
wget http://download.java.net/maven/1/jstl/jars/jstl-1.2.jar

In Eclipse:
Project -> Properties -> Project Facets -> check “JavaServerFaces”
in the configuration, add ALL the jars in myfaces-core-1.2.5-bin/lib

Links:
Symbolic Links Advice
Tomcat in Ubuntu: apt-get vs manual install

Updated 1/18/2009
In Ubuntu 8.10, here’s how I got set up for Java EE development using Eclipse and OpenJDK.

Install Java:
sudo apt-get install openjdk-6-jdk -y

Install Eclipse
I don’t recommend apt-get install eclipse, it installs an old version doesn’t work for me. Install eclipse manually instead(taken from this guide):
# Download the latest eclipse
archive
mkdir ~/opt

cd ~/opt
wget http://mirrors.ibiblio.org/pub/mirrors/eclipse/technology/epp/downloads/release/ganymede/SR2/eclipse-jee-ganymede-SR2-linux-gtk.tar.gz
tar xzvf eclipse-jee-ganymede-SR2-linux-gtk.tar.gz

# create the launcher script and give it execute permissions
sudo sh -c ‘echo “#!/bin/sh \n export ECLIPSE_HOME=\”\$HOME/opt/eclipse\” \n \$ECLIPSE_HOME/eclipse \$*” > /bin/eclipse

sudo chmod +x /bin/eclipse

Now you can run eclipse by hitting alt+f2 and typing "eclipse"

ScriptI created a shell script of these instructions, and it can be executed with:wget http://bitbucket.org/curran/ubuntuautomation/raw/aa93f53ada5a/install_eclipse.sh && sh ./install_eclipse.sh

Enjoy!

Links:Ubuntu Eclipse guideA nice installation tutorialAnother good Ubuntu tutorial

To become a wizard, one must master tools which are always at hand. It is however difficult to decide which tools to invest in, because there are so many good ones. I think I have finally found some gems worth learning, which I’d like to discuss here.

I have chosen to work under Linux rather than Windows or Mac, because I am confident that in the long run, the open source paradigm will overtake and outlive the proprietary one. Of the many flavors of Linux, I am using Ubuntu, because it is easy to set up and use, and embodies in it’s principles what should be the basis of how people and computers exist together. All the tools mentioned going forward are open source.

On the issue of platforms, C/C++, Java, Python, and Perl seem to have withstood the test of time, and together can serve most needs. All code needs documentation, and it seems that Doxygen has become the standard tool for that. For building large projects, I think CMake is emerging at the top.

For user interfaces in Linux, it always seems to come down to QT(KDE) or GTK(GNOME). I think these two will battle it out for years to come. For graphics the standard is definitely OpenGL. On my desktop I have been alternating between Gnome (rock solid, buntu), the latest KDE (beautifully done, lovely to use, the bleeding edge), and Fluxbox (zen).

When it comes to writing code, I am constantly debating between Vim and Eclipse. Eclipse is a really wonderful tool, it’s very quick to get started with, incredibly capable, and rock solid. On the other hand, Vim is just more efficient for editing text. This is a very representative question – Vim is extremely painful to learn, but it is a tool for wizards – it has almost magical powers which command respect. Here’s a quote which inspired contemplation:

Not long ago I read this phrase: programmers treat human input as computer input. Then I also had to think about VI magic directly. VI + Unix + Perl is a very powerful tool. I came relatively late to this (only one year ago) after trying several editors. I am now a second year informatics student and use vim (with Unix and Perl) to do my everyday coding. It feels being in between two worlds now that there are good alternatives like Eclipse which offer a very different set of tools. Being a bit fluent in VI means being very agile (if you find the corrects keys in time!) and this is the most important. These hints belong to my daily survival guide….
– Martin, from this thread

Please comment! I’m interested to hear what people think of my observations.

Here is how I got Eclipse (Ganymede) working with CUDA in Ubuntu 8.04. This includes syntax highlighting and having Eclipse use NVidia’s makefiles. After setting up CUDA in Ubuntu, Installing Eclipse, setting up Eclipse for graphics programming, here’s what I did:

Syntax Highlighting for .cu Files:
Window -> Preferences -> in C/C++ -> File Types -> New -> enter “*.cu” and select “C++ Source File”

Working with NVidia’s Makefiles:
Here we’ll make a copy of NVidia’s template project and set it up in Eclipse.
cd NVIDIA_CUDA_SDK/projects/
cp -r template/ foobar/

In Eclipse:
New -> C++ Project ->

  • Project Name: “Foobar”
  • uncheck “Use default location”
  • Location: “/home/yourusername/NVIDIA_CUDA_SDK/projects/foobar”
  • Project types: Executable -> Empty Project

-> Next -> uncheck “Debug”, select “Release” -> Advanced Settings ->
in “C/C++ build” ->

  • in “Builder Settings” tab -> uncheck “Generate Makefiles”
  • Build Directory: “${workspace_loc:/foobar}”
  • in “Behaviour” tab -> Build (incremental build):”" (delete “all”)

in C/C++ build -> Environment ->

  • Add -> Name: “PATH” Value: “/usr/local/cuda/bin” -> OK
  • Select PATH -> Edit -> Value: change “;/usr/local/cuda/bin” to “:/usr/local/cuda/bin”

-> Ok -> Finish

Ctrl+b to build should work now.

In Makefile, replace “EXECUTABLE := template” with “EXECUTABLE := foobar” so it puts the executable in the right place.

To set up Eclipse to run it:
Run -> Run Configurations -> select “C/C++ Local Application” -> “New launch configuration (click the leftmost icon on the top) ->

  • Name: “Foobar Release”
  • Project: Foobar
  • C/C++ Application: “/home/yourusername/NVIDIA_CUDA_SDK/bin/linux/release/foobar”

-> Apply -> Close

Try Ctrl+F11 to run.

At this point I got:
error while loading shared libraries: libcudart.so: cannot open shared object file: No such file or directory

Solution: (thanks to this guy)
sudo sh -c “echo /usr/local/cuda/lib >> /etc/ld.so.conf; ldconfig”

Ctrl+F11 works! Finally!!

I am trying to use FindCuda.cmake, but I haven’t been able to get it working. Please post if you have figured out another way to use Eclipse with CUDA, or if this post helped, or if you see something unnecessary or which could be done more elegantly. Thanks!

Links:
FindCuda.cmake
NVidia Sample Makefiles working in Eclipse (on a Mac)
NVidia Forum thread asking for a CDT CUDA plugin

I want to use Eclipse (Ganymede) with Subversion in Ubuntu (8.04), here’s what worked for me:

Note: subclipse breaks with GCJ (the Ubuntu default), I recommend using Sun’s Java

After installing, setting up, and starting Eclipse:
Help -> Software Updates… -> Available Software -> Add Site

http://subclipse.tigris.org/update_1.4.x

…wait a second for it to appear in the list…
Check “http://subclipse.tigris.org/update_1.4.x”
Click “Install” -> Next -> “I accept…” -> Finish -> restart Eclipse

File -> New -> Project -> SVN -> Checkout Projects.. -> Next -> Enter URL
For example: http://foobar-svn.cvsdude.com/Modulename
“Yes” to all prompts
Finish

Links:
Subclipse installation instructions

WP SlimStat