Adding a surrogate key to an Oracle table

This works for me for a mid-sized table.

ALTER TABLE foo ADD ( foo_id integer )
   l_foo_id   foo.foo_id%TYPE;
   IF :new.foo_id IS NULL
      SELECT   foo_id_seq.nextval INTO l_foo_id FROM dual;

      :new.foo_id := l_foo_id;
   END IF;
UPDATE   foo
   SET   foo_id = NULL
   ON foo( foo_id )

Windows on over 95% of new netbooks

According to this press release Britain’s largest chain of computing superstores has dropped Linux from netbook sales in stores.

Brandon LeBlanc, Windows Communication Manager at Microsoft posted an article stating that

“We’ve seen Windows share on [netbooks] in the U.S. go from under 10% of unit sales during the first half of 2008 to 96% as of February 2009, according to the latest NPD Retail Tracking Service data.”

The pros and cons of Windows vs. Linux may be debatable, but I have not seen yet any challenge to this statistic.

Email Strategy

Should you upgrade Microsoft Exchange or switch to an alternative? It depends what you want. In addition to hosting your own solution it is now possible to outsource to a SaaS provider, providing management and investors are comfortable with the idea. Requirements to consider:

  • Compatibility with Microsoft Outlook. All mail servers support IMAP and POP to access and download mail, but fewer solutions support Microsoft’s various proprietary protocol and extensions (eg. MAPI/RPC) used by more advanced features of Outlook. Open source implementations are still a work in progress.
  • Storage management. Traditionally mail servers have supported a mailbox of up to 1-2GB, but what happens when a user accumulates more than that?
  • Spam filtering and support for e-discovery. Postini addresses this well upstream from your corporate mail server and eliminates this as an issue.
  • Smartphone integration. More proprietary protocols are used to synchronize smartphones using Windows ME or Blackberry OS.
  • Cost.

Solutions to consider:

  • Google. Google offers a hosted solution with IMAP. Premier edition offers 25GB storage and 99.9% uptime (=8-9 hours/year downtime) for $50/yr.
  • Yahoo Zimbra. Competing solutions similar to Zimbra include Zarafa, Axigen and Scalix (fka. HP OpenMail). Zimbra gets the best reviews, however.
  • MailStreet and Apptix have received good reviews for providing hosted Microsoft Exchange email services. MailStreet charges around $8/mo. including Outlook licence and 2GB storage.

Looking into the future Open-Xchange is closest to providing an open source solution including MAPI/RPC.

Windows 7 First Impressions

Windows 7 RC was made widely available for download on 5th May from the Windows 7 home page. RC stands for Release Candidate, which means that it is a trial pre-release version that will expire in 2010 but be upgradable to the official release. The story behind the naming of Windows 7 can be found on the Windows Team blog.

Like many, I’ve played with Vista but never made the effort to install it as my primary workstation operating system. Windows 7 is reportedly much less bloated (see for example this Gizmodo article), and with XP at the end of its support life I decided to take the plunge. Windows XP cannot be upgraded directly to 7. Although it is possible to upgrade using a temporary Vista licence I decided to backup all my files and do a full reinstall instead. Like Vista, there will be multiple editions of Seven, but 7 RC is the Ultimate edition, with the most consumer features such as Media Center. 7 RC is available in both 32-bit and 64-bit variants, I chose the latter.

I have a Dell Latitude D830 with a 120GB Momentus FDE.2 drive that provides hardware level full disk encryption. The initial install was drama free and used a little under 14GB of disk space. Wireless networking configured with no fuss, only the Verizon EVDO broadband wireless minicard was missing a driver. Bluetooth discovery of my mobile device worked fine. Ironically it was a while before I realized my nVidia graphics chipset was not being fully utilized and I was missing some of the flashier aspects of the Aero UI. USB devices recognised and configured after I enabled automatic driver downloads included an HP printer, headphone/mic and an external drive for file backups. A USB fingerprint reader and a Logitech webcam did not install automatically, however.

7 RC comes with Internet Explorer 8 installed, though it can be removed. The first thing I did was change my default search provider and home page to Google. First stop was Adobe to install Reader 9 and Flash. Second stop was Sun for Java 6 and then OpenOffice. In addition I visited Microsoft to install a free trial copy of Office Professional 2007 and Windows Mobile Device Center (fka. ActiveSync). The first add-on I installed was Xmarks, which allows me to automatically synchronize bookmarks between Firefox and IE on different workstations. Finally I imported the root certificate used to authenticate the various sites I work with. IE 8 works fine with Outlook Web Access, Zimbra and Yahoo! Mail.

Getting back to the missing Verizon broadband wireless driver I downloaded the 64-bit Vista driver from Dell support and it worked fine. Then I also downloaded and installed the Dell 64-bit Vista nVidia driver and refreshed the performance indexes from the control panel: the results are truly slick graphics, I’m not going to miss CrystalXP. To setup the Logitech webcam I went to the support site and found a driver installation program for 64-bit Vista. Initially this didn’t work, but then a “Program Compatibility Assistant” stepped in and reran the program successfully. I was unable to find a 64-bit Vista driver for the fingerprint reader.

A description of the new features in Windows 7, most notably a new task bar, is available online. Various themes and gadgets are also available. Apart from the new taskbar and slick graphics, another noteworthy new feature of Seven are Libraries. I also like the way that favorites are easily accessible in the left hand pane in Windows Explorer. After installation I went to the Windows Features panel of the control panel, removed Windows Media Center and installed Services for Unix Applications (SUA) and Services for NFS. Having setup my hardware and explored the personalisation I started reinstalling various tools and utilities: Rainmeter, WinDirStat, 7-Zip, WinRAR, KeePass and jEdit. Only old versions of FinePrint and pdfFactory with a kernel mode print driver failed to install. For Linux systems administration I installed Xming-portable-PuTTy and FileZilla. For database development I installed Oracle Database Express Edition and Quest Toad.

Intel’s Processor Identification Utility (PIU) confirmed that my workstation’s Core2 Duo CPU has Intel’s Virtualization Technology and will be able to run Windows XP Mode if I really have to. (Hardware virtualization has to be enabled in the BIOS setup screens also.) Instead, however, I reinstalled VMware Workstation, which works with or without hardware virtualization support, and it boots both my Windows XP and Ubuntu VMs. Additionally I installed the VMware View client for Windows to access centralized VMs running in a VDI environment.

Finally I backed up the workstation with Windows Backup to the external drive. In summary Windows 7 RC has good driver and application compatibility, a slick UI and the good performance Vista lacked, so far I’m not missing XP at all.

Changing Oracle’s SGA size

To see the current values use ‘show parameter sga_target’. To alter:

alter system set sga_max_size = 300M scope=spfile; alter system set sga_target = 300M scope=spfile;

Restart database to effectuate change.

SDWest 2009

Monday. Disappointed to discover the coding dojo cancelled. Guessing that not enough people knew what it was and were not prepared to sign-up beforehand. Sat in instead on Scott Meyers’ ‘Better Software – No Matter What’: familiar material by a good presenter. Sofware quality depends on programmers, and how they exercise their discretion in implementing requirements: providing guidelines makes a significant difference. Insist on useful requirements. Create interfaces that are easy to use correctly and difficult to use incorrectly. Use design by contract to specify requirements using pre-conditions, post-conditions and invariants. Embrace static analysis. Favor constructor parameters over singletons.

Lunchtime presentation by Robert Martin, giving some inside history on Agile and Scrum, and how that has led to today’s movement for software craftsmanship.

Afternoon session on easyb and Groovy with Rod Coffin and Andy Glover: slow start before plunging into use of the requirements domain specific language with IntelliJ and Eclipse. Tested and documented version of a LIFO stack implemented with remarkable speed.

Evening discussion panel on SOA: a marketing buzz phrase past its prime. SOAP/HTTP web services remain the most robust solution even though simpler RESTful solutions have gained popularity on more ‘primitive’ platforms.

Finally an informal presentation by an engineering director and architect from LinkedIn describing their infrastructure and development practices. Tomcat, a custom MVC framework and JSP compiler, SpringRPC (~100 services), Jetty and Oracle on SPARC. Four million visitors a day peaking at 200,000 concurrent users. Originally pair programming but now simply at least two developers per project. No contractors, all 100 engineering staff in the same building. High end Mac workstations and laptops with Eclipse/IntelliJ. 1,500 JUnit/HttpUnit test cases for ~1,000 KLOC automated using Hudson. Database partitioned both vertically (by functional area) and horizontally (by member id range). Back to the hotel past 9pm.

Tuesday. Morning session Dean Warner on programming in Scala, a scary-powerful collision of Java and Lisp/Erlang used by Twitter for higly parallel message handling. Afternoon session with Chris Richardson, author of ‘POJOs in Action’ giving a technical introduction to Spring Framework dependency injection (replacing singletons with constructor arguments) enabling Spring AOP for service methods. Also Spring JDBC and Hibernate, all using either XML or annotations.

Wednesday. After two days of half-day tutorials the conference format switching to four 90 minute workshops per day plus lunchtime presentations. Website navigation using menus and search, especially for e-commerce. Overlay menus at Amazon. Everyone familiar with the layout of Outlook. making novel use of AJAX. Neal Ford with an introduction to Ruby and JRuby, an interpreted language well suited to metaprogramming such as building test frameworks including Mocha. Robert Martin walking through some of his code from FitNesse: functions should be well named, short, and do one thing only. Two presentations from Scott Ambler on Agile development: delivering code early and often, using TDD, involving stakeholders, building self-organizing teams and delivering what the customer wants. Geographically dispersed teams with a 15% higher rate of project failure: fly people around or pay more in hidden costs. Evening awards ceremony: Dr. Dobbs Excellence In Programming award going to Scott Meyers and over a dozen Jolt awards made in surprising haste, including easyb. Reading the first chapters of ‘Groovy In Action’.

Thursday. Morning sessions on how to select a web framework and testing web applications. Grails immature and questions still over the Groovy classloader. GWT-Ext and Tapestry 5 or Wicket a recommended configuration. Rod demonstrating unit and component testing tools, including infinitest, WicketTester, HtmlUnit and Watij. Lunchtime presentation from Juval Lowy on the coming boom in power management software for homes, electric vehicles and buildings. Afternoon sessions on Guice, a lightweight dependency injection framework, and using the new javax.script package in Java 6.

Friday. Morning sessions on Spring 3.0 and Continuous Testing. Spring Framework clearly mature and featureful. Rod demoing intellitest IDE plugin allowing all dependent unit tests in a project to be run automatically whenever class bytecode changed. Afternoon sessions on xUnit testing and generating documentation during the build cycle. Dependency injection does not require a framework for in-house applications. Creating and maintaining mock objects for database services may be impractical, consider the Dependent Object Framework and possibly H2 instead. Demos of Hudson and Doxygen rounding out the conference.

What did I get from the conference? Most inspriring was seeing Rod demonstrating TDD in action with a hands on pair programming session and discussions of the supporting tools. Scott Meyers, Robert Martin and Scott Ambler reinforcing the importance of TDD in the bigger picture, Justin Gordon describing use of TDD on a significant IBM project. Automated testing driving the adoption of dependency injection frameworks such as Spring and Guice. A second significant theme was scripting languages – including their use for testing – with sessions on Groovy/easyb, JRuby/Mocha and Scala. Finally there were the demos and pointers to projects like GWT-Ext, Hudson and Doxygen worthy of further investigation.

facelets-tutorial javax/el/ELResolverClass

ICEfaces have published a facelets-tutorial

Deployment instructions were limited so I downloaded and unzipped the source file into the samples folder provided with ICEfaces-1.7.2-SP1.

ant help
ant clean
ant tomcat6.0

I then copied dist/facelets-tutorial.war to tomcat-6.0/webapps… localhost…log showed:

Feb 21, 2009 11:11:07 AM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class com.sun.faces.config.ConfigureListener
java.lang.LinkageError: loader constraints violated when linking javax/el/ELResolver class
 at com.sun.faces.config.ConfigureListener.registerELResolverAndListenerWithJsp(

Incompatibility between the EL included with ICEfaces and the EL provided with Tomcat 6? Stopping Tomcat, removing webapps/facelets-tutorial/web/WEB-INF/lib/el-api.jar and restarting provides a quick fix. Closer inspection of the facelets-tutorial build.xml reveals it has entries obsoleted by the newer version of samples/etc/build-common.xml and so is still including jars not needed or desired with Tomcat 6.

Trac on Solaris using Apache mod_python and https

If Trac is being used by a distributed team over the internet we want to remove all privileges from unauthenticated users:

  trac-admin $tracenv permission remove anonymous $perm
  trac-admin $tracenv permission add authenticated $perm

We also want to encrypt traffic to the site. To do this I tried stunnel…

/opt/csw/bin/pkg-get -i stunnel

…and placed the following in /opt/csw/etc/stunnel/stunnel.conf

accept  = 443
connect = 8000

I also commented out the chroot setup. Once configured all that is required is to run

cd /opt/csw/etc/stunnel 

…and change /var/opt/csw/trac/conf/trac.ini

authz_file =
authz_module_name =
base_url =

The bad news is that Trac 0.10.4 does not consistently use base_url, so creating a ticket, for example, redirects the user to an http page.

HTTPS=1; export HTTPS
nohup tracd --port 8000 $tracenv &

To resolve this issue I decided to move from tracd/stunnel to Apache2/mod_python. The default Solaris 10 distribution includes apache2 but not mod_python. Instead I installed mod_python from Blastwave, which in turn automatically installs the Blastwave cswapache2 package below /opt/csw/apache2.

pkg-get install ap2_modpython

We will want to run trac under apache2 using a dedicated account:

groupadd -g 202 trac
useradd -g trac -u 202 -d /var/opt/csw/trac trac
chown -R trac:trac /var/opt/csw/trac

Modified /opt/csw/apache2/etc/httpd.conf

User trac
Group trac
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

   SetHandler mod_python
   PythonInterpreter main_interpreter
   PythonHandler trac.web.modpython_frontend
   PythonOption TracEnv /var/opt/csw/trac

Created a self-signed certificate for the site:

cd /opt/csw/apache2/etc
/usr/sfw/bin/openssl genrsa -out server.key 2048
/usr/sfw/bin/openssl req -new -x509 -key server.key -out server.crt -days 365 -subj "/C=US/ST=Florida/O=My Company/"

Modified /opt/csw/apache2/etc/extra/httpd-ssl.conf


   SetHandler mod_python
   PythonInterpreter main_interpreter
   PythonHandler trac.web.modpython_frontend
   PythonOption TracEnv /var/opt/csw/trac

To start Blastwave Apache2 using SMF on Solaris:

svccfg -s cswapache2 setprop httpd/ssl=true
svccfg -s cswapache2 listprop

svcadm enable cswapache2

To check status

svcs cswapache2
svcs –xv

Posts navigation

1 2 3 8 9 10 11 12 13
Scroll to top