Install Java on Ubuntu

Posted in Bob Hedlund on November 30th, 2008 by admin
I thought this would be straight forward....

I tried to install using the apt-get command, but my install died when the license agreement took over my terminal, and did not give me a way to accept the agreement. I exited and ran the dpkg --configure -a command to clean up the failed install. 

Instead I went to the System>Synaptic Package Manager and performed the install this way: 
  • Specify "java" in the search box. A List of packages to install appears.
  • I chose the java5 jre, jdk and plugin, and accepted the installation of packages that they were dependent on. 
  • Click Apply
  • Accept the license agreements as they appear.
  • The java home directory will be in /usr/lib/jvm
Note: If the java versions do not appear in the above list, ensure that the /etc/apt/sources.list file contains the following entries : 

  • deb http://us.archive.ubuntu.com/ubuntu/ intrepid multiverse
  • deb-src http://us.archive.ubuntu.com/ubuntu/ intrepid multiverse
  • deb http://us.archive.ubuntu.com/ubuntu/ intrepid-updates multiverse
  • deb-src http://us.archive.ubuntu.com/ubuntu/ intrepid-updates multiverse

You then need to ensure that this Java is the default java for the system: 
  • update-java-alternatives -s java-5-sun (specifies java 5 as the default)
  • update-java-alternatives -l (lists out the default)

Finally, add environmental variables. I add them in /etc/environment. You could also add them in your local .bashrc file in your home directory. The values specified in /etc/environment are in all shell. Be careful of the syntax in this file! If an error occurs you may not be able to boot up... : 

  • JAVA_HOME="/usr/lib/jvm/java-1.5.0-sun"
  • CLASSPATH="/usr/lib/jvm/java-1.5.0-sun/bin:/usr/lib/jvm/java-1.5.0-sun/lib"




Install Oracle XE on Ubuntu

Posted in Bob Hedlund on November 30th, 2008 by admin
Oracle XE can be downloaded at the Oracle site. I chose the Debian install for Linux. I read the installation guides. This is how to do it:

If you do not have 1GB free memory, or want to reduce the database footprint:

  • $sudo dd if=/dev/zero of=/swpfs1 bs=1M count=1000
  • $sudo mkswap /swpfs1
  • $sudo swapon /swpfs1
I used the Ubuntu apt-get utility to install the database.
  • sudo gedit /etc/apt/sources.list
Insert "deb http://oss.oracle.com/debian unstable main non-free" into the file if it does not exist and save. Then import the Key:
  • $wget http://oss.oracle.com/el4/RPM-GPG-KEY-oracle -O- |sudo apt-key add -
Now install the db:
  • $sudo apt-get update
  • $sudo apt-get install oracle-xe
After the installation you need to run the following:
  • sudo /etc/init.d/oracle-xe configure
Follow the instructions and write down the ports and passwords that you specify. Then you will need to update the users on the system. Go to System>Administration>Users and Groups. Unlock the editor and under the manage groups tab, add your user to the dba group.

The database should be running. Go to http://localhost:8080 - assuming you didn't change this port in post config, and the database info page should appear. The database is now integrated in the menu as well - so if not running, start it it up by navigating to the Applications>Oracle Database>Start Database.

One more step is to specify the ORACLE_HOME and ORACLE_SID environmental variables:
  • gedit $HOME/.bashrc
Add the following lines:
  • ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server
  • ORACLE_SID=XE
  • export ORACLE_HOME ORACLE_SID
You could also/instead add these to your /etc/environment file. In that file you would add:
  • ORACLE_HOME="/usr/lib/oracle/xe/app/oracle/product/10.2.0/server"
  • ORACLE_SID="XE"
Either login in again, or type
  • source .bashrc
  • source /etc/environment
To run Oracle utilities add /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin to the path in /etc/environment and source it.


You should be good to go. You can access the database home page via the menu, or go to http://localhost:8080/apex.





Install VMWare Fusion on Mac OS/X 10.5

Posted in Bob Hedlund on November 30th, 2008 by admin
I needed to run an oracle database on a macbook. At the time, Oracle was not supported on Mac OS/X 10.5 . Talking to colleagues, and doing some research led me to VMWare fusion. It's not free. It works great.

Installing VMWare Fusion is a relatively simple process. I downloaded version 2.0.1-12 from the net and purchased a serial number from VMWare. The VMware site has excellent documentation and even supplies videos to walk you through the process. Here's what I did: 
  1. Download the .dmg file from vmware. (http://www.vmware.com/vmwarestore/buyfusion.html).
  2.  Double click on the .dmg file to mount it. The file will be mounted and displayed in a Finder window.
  3. Double click the Fusion Icon. The installation assistant will walk you through the process. 
  4.  To Start Fusion, navigate to Applications in Finder, and choose the VMWare Fusion Icon. 

The Fusion window will open, and you can create a new Virtual Machine at this point. Next I installed 2 different virtual machines - a copy of my old pc and a fresh Ubuntu install to house the Oracle Database. 

I followed the conversion guide for bringing my old pc over. The guide that comes with fusion (http://www.vmware.com/pdf/fusion_getting_started_11.pdf) has a link to a flash video that walks you through the process. The process took about 8 hours for the vmware converter to bundle my old pc onto an external disk drive and for me to boot the pc on the mac. It was pretty cool. The problem that I had was that my copy of XP only had 1 license, (it came bundled on the pc when I bought it) , and Windows required a new activation key. So I only had access to my old pc on the mac for 3 days. I would not do this unless you know you have multiple licenses. 

To install Ubuntu, I went to the Ubuntu site (http://www.Ubuntu.com/getubuntu/download) and downloaded the 8.10 version on 32 bit. I chose the 32 bit because the 64 bit has some issues with downloading and installing packages. Once downloaded, simply open the vmware fusion :


  1. Choose new 
  2. Click the continue without disk button. 
  3. Choose the "Use Operating System Disk image file" option.
  4. Choose the Ubuntu file you downloaded above from the finder that opens. 
  5. Click Continue and Finish. The new virtual machine will appear in the Fusion window. 
  6. Click the start button next to the Ubuntu vm, and fusion will open a window with the Ubuntu installation running within it. 



I ran through the installation by specifying users and some configuration. I simply accepted the defaults. 

Sage Advice
Install VMWare tools immediately after the Ubuntu installation occurs. Choose Install VMWare tools from the virtual machine menu item on the mac. To do this, move the untarred vmware tools distib to the /tmp directory.  Then run : 
  • sudo ./vmware-install.pl
Choose the defaults, and when complete, add the toolbox to the startup of your Ubuntu session: 

  1. Preferences>Sessions>StartUp Programs>+Add>
  2. Specify vmware-toolbox as the command to execute. 

Fusion allows you to take snapshots of your vm. DO THIS!!!! . Comment well the snapshot state, so that when you screw something up you can return to a stable state.  As I was installing the various applications to the Ubuntu system , I would stop and take a snapshot along the way after each milestone. This will save you considerable time. 




eclipse on mac

Posted in Bob Hedlund on November 27th, 2008 by admin
I run eclipse against an oracle instance with htmlUnit tests banging away on tomcat. Running the complete suite of unit tests on my dev box can eat processor and memory big time. Its like watching a kid coming home from college for the first time in months and invading the fridge. On a pc there was no processing time left for me. When I set up my env on the mac, and ran with the base settings, it died by running out of heap space.

So I try to allocate enough memory and set the parameters on the various running jvms (ant, tomcat and eclipse) in the hope that they wont die after running for 50 minutes with a heap space space issue. My box has 4G of memory, and I have oracle running in a separate vmware fusion vm on Ubuntu. I am using eclipse Ganymede with java 5 (1.5.0.13) , Tomcat 5.5 and and use ANT4.7.

On Mac, the eclipse.ini file is under your eclipse installation at /Eclipse.app/Contents/MacOS/eclipse.ini . You will need a terminal window to get there as the directory doesn't show up in Finder. You could perform the following to find it:

sudo find / -name "eclipse.ini"

When I opened this for the first time I found that the parameters were triplicated - so I cleaned this up. I jack up the max memory, specify to use parallel GC, and keep the eden space low. I specify the following arguments:

-Xmx1024m (the max heap size)
-Xms128m (Startup heap size)
-Xmn64m (the eden space or young generation garbage collectible space)
-XX:+UseParallelGC (Run Parallel GC)


In java there are two GC threads running. One is a very lightweight thread which does incremental collections primarily on the Eden (a.k.a. Young) generation of the heap. The other is the Full GC thread which traverses the entire heap when there is not enough memory left to allocate space for objects which get promoted from the Eden to the older generation(s). If there is a memory leak or inadequate heap allocated, eventually the older generation will start to run out of room causing the Full GC thread to run continuously. This GC thread eats the processor and eventually eclipse has no pie - it won't be able to respond to requests and they'll start to back up.


The amount allocated for the Eden generation is the value specified with -Xmn. The amount allocated for the older generation is the value of -Xmx minus the -Xmn. Generally, you don't want the Eden to be too big or it will take too long for the GC to look through it for space that can be reclaimed. If you watch the memory monitor closely, you can see the garbage collector releasing memory periodically. Keeping the amount allocated to the eden space low affects the periodicity of this cleanup. Developers can see this on their machines when running the complete stack of tests.

These parameters seemed to work for me- my memory consumption remained nearly constant across the task. Before, the memory usage would creep up and reach a terminal point - on my old pc at about 2.4GB. At this point the tests just stopped running. Viewing the memory usage after applying the new args, you could see where GC ran periodically and brought the usage back to a baseline. The tests ran faster. But there was still an occasional lockup.

Another consideration is whether to run ANT, Tomcat and Eclipse in the same jvm. I tried experimenting with combinations of virtual machine with these processes. I also experimented with the memory allocations for each. What I found was that if you run them all in the same jvm, then the memory allocation on your machine remains high even after the tasks complete. When you run these in separate jvms, the memory allocation is returned to the system as each process completes. I found that the machine performed best when running separate jvms.


Caveat Emptor: Please be aware that not all jvms support the run parallel GC option.

To specify the jvm parameters for ANT, go to the ANT view, right click on the build file or a task, click 'Run As' and then 'external tools configuration'. In the dialog that appears, choose the JRE tab and specify the vmargs and the jvm to use for the file/task.

To Specify the jvm parameters for Tomcat, double click on the tomcat instance in the servers view. Update the vmargs by clicking the Launch Configuration link.

FlexMonkey & Flex-Mojos

Posted in FlexMonkey, Jon Rose on November 24th, 2008 by jonr

It has been fun to see the open source model working with FlexMonkey.  Stu put our testing tool out there for the world only a month or two ago, and we are already seeing significant contributions.  The latest contribution is from Marvin Froeder (VELO), who has helped us update the framework to work with Flex-mojos (the popular build tool).

Mate :: Flex Framework

Posted in Jon Rose on November 22nd, 2008 by jonr

I have been hearing really good things about Mate for a few months now.  I have been rebelling against dragging additional frameworks into Flex just for MVC for a while now (Flex and MVC Cairngorm).  I finally got a chance to spend some time coding with Mate on a flight back from San Fransico this weekend.  I think it looks promising.  I am still not sure the leverage is enormous, but the cost seems low.  It appears to provide a reasonable structure for Separation of Concerns and managing events, without requiring much additional code.  Hopefully, I will have some more time to do something more complex soon with it, but I think it may be the type of framework I have been wanting.

Writing my bio

Posted in Justin Shacklette on November 21st, 2008 by admin

I’ve been in the game for a few weeks now at Gorilla Logic and I’m really enjoying myself. My first task on my first client project was to write my bio. What fun!

So, of course, I started with my usual process of thinking (and thinking some more) before actually doing anything. What is a bio, really? What do I want to say? And what is the client looking for? My basic conclusion – the client wants to see value for their money. So a good bio needs to show that I know my shit, that I’ve been around the block, and that I make a good teammate. I also decided to add a sugary coating with a little humor.

Here’s what I came up with:

Justin has five years of experience in end-to-end software development, and spent the last two building large scale, consumer-facing web applications with Adobe Flex. He brings a unique combination of “what’s cool” frontend design experience with secure and efficient enterprise-class backend architecture. Justin is also a passionate leader and coach, familiar with development teams and the development process.

In his younger years, Justin earned his PhD in physics before turning to software engineering. His Evil thesis advisor had him working day and night on a portable laser beam system that could be mounted on the head of a shark.

When I re-read it now, it certainly comes off a little used-car-salesman-ish. But it’s all true, except for the sharks. (I actually did quite a bit of laser physics for my thesis, so it’s not complete bullshit.) I also like the tone – it reads knowledgeable with a touch of Austin Powers dashing. I found it interesting during the writing process that with too many resume-type details my bio sounded phony, like I was trying too hard to impress. As I began to prune them away, I was able to achieve the knowledgeable tone I was hoping for.

Chat on Performance Pitfalls of Flex’s ArrayCollection

Posted in Drunk On Software, Jon Rose on November 20th, 2008 by jonr

James and I have posted our latest video, Performance Pitfalls of Flex’s ArrayCollection.  It is a follow-up to my recent post on the problems we encourtered with ArrayCollection.

Enjoy!

JavaFX and Adobe Flex

Posted in Jon Rose on November 20th, 2008 by jonr

Chet Haase, an engineer on the Adobe Flex Platform Team, shared a few thoughts this week on how JavaFX and Adobe Flex compare.  Chet brings a unique perspective, as he was a member of Sun’s JavaFX team before joining Abobe.  You can read his comments in my InfoQ post.

Let’s not get physical

Posted in Stu Stern on November 18th, 2008 by admin
In my last post, I promised to reveal how class diagrams can be your secret weapon in the war against imprecise requirements. How can this be, you wonder? Sure, class diagrams capture entities, attributes, and associations, but they're completely incapable of expressing the hopes, fears, aspirations and unwarranted hostility of my end users. Surely we need all the subtlety and nuance of natural language to fully capture the essence of what we're being required to build? Surely we need to capture requirements using the flowing prose of use cases?

As we've discussed, precision is certainly something to be aspired to in requirements specifications, and yet, the legal profession provides compelling testimony to the horrible things that happen to beautiful prose when we impose precision upon it. Let's begin to consider some other things we can express clearly, unambiguously, and some might say beautifully, via everybody's favorite UML diagram.

Suppose we've been asked to build an online storefront offering stolen military hardware at low-low prices. The company, Arms4Less, was founded by several retired mercenaries now holed up somewhere in Honduras. Our primary contact is this crusty old guy we know only as "Sarge". The first thing he says the system needs to do is "store orders for stuff."

"You know", he says, "we sell stuff. Hand grenades, bazookas, napalm cannisters, that kinda thing. We'll need the usual shopping cart deal, letting customers tell us how much of each product they want." We sketch out the diagram below.
As you would expect, an Order consists of 1 or more (1..*) items, and each OrderItem specifies the quantity of some product being ordered. Each Product has a price. Now, hopefully you're regarding this model and saying, "Yeah? So? Why am I wasting time reading this stupid guy's blog when I could be learning Spring?" In a moment we'll make this model a lot more interesting. The diamond, by the way, signifies a "composite" relationship between an Order and its items, which essentially means that if we delete an Order, all of its items will get deleted too. (You would of course know what the diamond means if you'd been paying attention instead of doing email in that UML course your boss sent you to.) If the other symbols being used here are mysterious to you, go hang out with Ambler and come back when you're done.

A tremendously useful, but largely underused (Ambler's overview doesn't even mention them), facility of class diagrams is the specification of "derived" attributes. Derived attribute values are - uh - derived. That is, their values don't need to be stored since they can be completely determined from other data values. For example, Sarge explains that we need to total up each order and make the customer's got enough dough to cover it. "We do this for the customer's own protection", Sarge explains. "You don't wanna know what's gotta happen if the guy can't pay us." And indeed, we really don't wanna know until a later iteration. So, we add 2 derived attributes to the model to deal with the order total.



We've added a total attribute to both the Order and the OrderItem entities. Note that each has a leading slash, which means "derived" in UML. The OrderLine total is, not surprisingly, derived by multiplying the quantity by the price of the associated product (quantity*product.price). The Order total is the sum of the totals of its items (sum(items.total)). We mentioned earlier that derived attributes don't need to be stored, and indeed you can see how we can simply calculate these attributes' values on the fly. Certainly, however, there are situations in which we store derived attributes if, for example, they're too expensive to calculate dynamically. Such a decision however is purely an implementation choice. Logically, these attributes are derived.† This is all about what the system must do, not how it will do it. So let's keep our functional requirements logical. As Sarge might say, "You don't wanna get physical with me unless you're good and ready, computer boy."

Now, you're probably still a little underwhelmed by all this. But as we'll see in our next episode, we've only just scratched the surface of the expressive power of the friendly, little class diagram.