cx_Oracle callfunc()

I like wrapping database queries in stored procedures: it keeps the SQL in the database, where Oracle can track its dependencies and flag if some change makes it invalid.  Here’s an example using Oracle’s demo schema SCOTT:

   TYPE emp_t
      RECORD( ename  varchar2( 10 ), hiredate date, sal     number( 7, 2 ) );
   TYPE emp_csr_t IS REF CURSOR
      RETURN emp_t;
   FUNCTION get_emps
      RETURN emp_csr_t;
   FUNCTION get_emps
      RETURN emp_csr_t
      c   emp_csr_t;
      OPEN c FOR SELECT   ename, hiredate, sal FROM scott.emp;
      RETURN c;

Now suppose I want to take the output from a stored procedure like the one above and write it to a CSV file.  In Python this is trivially easy:

 import cx_Oracle
 import csv
 reportName = 'emp_extract_k.get_emps'
 connection = cx_Oracle.connect(userid)
 cursor = connection.cursor()
 rs = cursor.callfunc(reportName, cx_Oracle.CURSOR)
 fd = open(reportName+'.csv', 'w')
 csvFile = csv.writer(fd)
 header = []
 [header.append(col_defn[0]) for col_defn in rs.description]
 for r in rs:


After just over three months using Wakoopa I am now apparently an expert, having used 200+ applications and websites during over 500+ hours logged on a PC.  Much of that time was spent with Quest TOAD, munging Oracle data and researching issues: a couple of weeks I was the heaviest user from Wakoopa and I filled out a review and screenshot.  The biggest disappointment was the 3D desktop I tried, but Wakoopa did suggest I try Notepad++ again, and I’ve switched from EditPlus for now.  It’s great to browse the categories and see what software is actually used by other members, and what might be the next great tool or package.

VBScript will never die, just fade away

I was looking for an official announcement of the end of life of VBScript but could not find one.  Instead I stumbled across the following MSDN blog post with a vague reference: "I believe that it was [at the] IT Forum in Nov 2005 that this was announced."  A colorful blog post from Ryan Stemkoski made me laugh, the comments are interesting also.  The closest I could find to an official Microsoft announcement was a blog post five years ago by Eric Lippert, who admitted to being the last person to ever add a feature to VBScript, in November 2000.

Granite Telecommunications

I met this week with Rob Hale, CEO of Granite Telecommunications.  Granite Telecom is an enterprise wireline wholesaler specializing in providing consolidated billing and service for multi-location businesses: 3/4 million lines from Verizon, Qwest, AT&T; and others to 10,000 customers in over 100,000 locations.  The company was established in 2002 and ranked in the Inc. 500 in 2007 and 2008: revenues in 2009 are expected to approach $400M.  Customers include USPS, Walmart, CVS, 7-Eleven, McDonalds, Verizon, Sprint, Comcast, GE and over half the Fortune 100.  Interestingly Rob’s previous business, Network Plus (NPLS), was also a telecom wholesaler, growing from its inception in 1990 to a public IPO in 1999 to 300,000 lines, 75,000 customers and $284M sales before overspending on network hardware, being forced into bankruptcy in February 2002 and having its assets sold to Broadview Networks for $16M.  Granite was started four months later and is still debt free.

Windows Utilities

CNET has an excellent article on free Windows utilities at  Featured tools include Firefox, Thunderbird, OpenOffice, Gimp, Paint.NET, MediaMonkey, 7-zip, Foxit, Pidgin, Smart Defrag, WinDirStat and Process Explorer.

Process Explorer is part of the Windows Sysinternals Suite available from Microsoft for power users.

Microsoft also provide free downloads of their Live Essentials applications, which include Messenger, and Writer for offline blog editing.  Google Picasa, however, is much better than Windows Live Photo Gallery.

Wakoopa have a utility and community site for tracking member application usage.  Application rankings and reviews are available by category.

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.

Posts navigation

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