Skip to content

www.rolfje.com

Category: Software

Bummer, back to Photoshop

Posted on 2007-03-06 By rolfje No Comments on Bummer, back to Photoshop

I bought Photoshop Elements 4 a while ago, but didn’t use it much since I didn’t like the userinterface (dissapearing menus when you click on the desktop and such). Then came Lightroom public beta, the Photoshop killer. I haven’t touched Photoshop since I installed Lightroom. But now… the Lightroom beta testing period is over. Since I haven’t got 300 Euros to “splurge” on Lightroom, I guess I’m forced to learn to use Photoshop to process my photos now. Oh well… Let’s see how that goes.

Lightroom expired

Apple, Software

The truth about Switching To Mac

Posted on 2007-02-28 By rolfje No Comments on The truth about Switching To Mac

Thinking about switching to a Mac? I’d say go for it, but read this article first. It really sums it all up.

Apple, Microsoft, Software

Use iTunes with *ANY* mp3 player

Posted on 2007-02-01 By rolfje No Comments on Use iTunes with *ANY* mp3 player

Many years ago, I bought an iBead Jens of Sweden MP-100. At the time I was a Windows/Linux user and everything was fine. Now that I’m a Mac user, syncing tracks to my trusty USB mp3 player is a bit harder. I had to copy tracks by hand, and when two tracks had the same title the copy would fail. THis was all very irritating. I am saving for an iPod nano, but until I get one I’m stuck with the USB copy tricks.

But not anymore, 5 minutes ago I discovered SyncTunes, a free Mac OSX application which can sync iTunes playlists to any drive as long as it’s available on your desktop. This means that any drive that mounts as a removable drive (USB memory sticks, PDA’s, Sony PSP’s…) can be used to sync the playlist to. The only catch is that you have to make the playlist fit onto the drive (in size). This can be easily done by creating a smart playlist in iTunes which is limited in size.

I tested syncing some of my playlists (through a size-limiting playlist) and it works like a charm. Size limiting playlists are also the thing to use if you do have an iPod, and want some control on how many space is used by pop music, and how many space is used by rock. I’m a happy camper now, and in no hurry to buy an iPod (but that 8GB red nano sure looks tempting).

Apple, Software

Java 5 BigDecimal.toString() and Oracle 10g jdbc

Posted on 2007-01-31 By rolfje 2 Comments on Java 5 BigDecimal.toString() and Oracle 10g jdbc

Yesterday a collegue of mine discovered a very ugly problem when storing BigDecimals from a Java 1.5 program into an Oracle 10g database. Not by experience, but by reading the article at http://www.javalobby.org/java/forums/t88158.html. We had not encountered the problem ourselves, but when passing the dredded 12500000 value to the BigDecimal constructor and passing it to the database, we discovered that we too were affected by this bug. So off I went to search a solution.

The root of the problem lies not only in the fact that the BigDecimal.toString() method behaviour has changed in Java 1.5, but also the way BigDecimals are constructed. The Oracle driver relies on a specific formatting of the BigDecimal.toString() method, and can not handle the output of the “new and improved” BigDecimal in Java 1.5. All discussions about not using toString() for passing values and flaming Oracle and/or Sun aside, we have no option but to fix the problem right now. Oracle promised to fix this problem not sooner than in release 11g, so waiting is not an option.

Option 1: Overriding BigDecimal.toString()
In our project, we use Ibatis. This gives us a nice handle to implement our own BigDecimalTypeHandler, where we can choose to do anything to the BigDecimal before storing it into the database, and revert that when retrieving it from the databse. One of the options we thought of was to override the BigDecimal’s toString in an anonymous subclass inside our IbatisTypeHandler, like so:


public void setParameter(PreparedStatement ps, int i,
                        Object parameter, String jdbcType)
                        throws SQLException {
  BigDecimal colVal = new BigDecimal(
              ((BigDecimal)parameter).toPlainString()){
    public String toString(){
      return toPlainString();
    }
  };
  ps.setBigDecimal(i, colVal);
}

The anonymous subclass lets you add or change behaviour to an existing class without cluttering your codebase with a classfile which looks rather strange when places out of context. We tried various ways of locally changing the behaviour of BigDecimal to make it go into and out of the database in a way that our unittest would not know the difference, but at some point gave up. There is not really a good way to do this without compromising in scale or resolution in the conversion.

When using the setParameter described above, you will not get a situation where originalBigDecimal.equals(storedBigDecimal) returns true. In most cases this will not be a very big problem, since originalBigDecimal.subtract(storedBigDecimal) will always return 0.

If somebody thinks of a way to store BigDecimals into the database and retrieving them in a way it is totally transparent to the caller (compared to JDK 1.4 behaviour) please feel free to post it here.

Option 2: Loosing your BigDecimals

Perhaps this option had to be considered when thinking of using BigDecimals in the first place. BigDecimals are very awkward to calculate with, are relatively heavy both performance and memory wise. Very often they get converted to doubles before doing any calculations with them, which eliminates most of the reasons for using BigDecimals anyway.

The easy way to loose only those BigDecimals which get stored in the Database, rewrite the typeHandler you just created into the following:


public void setParameter(PreparedStatement ps, int i,
                        Object parameter, String jdbcType)
                        throws SQLException {
  throw new UnsupportedOperationException(
    "Oracle can not handle Java 5 BigDecimals properly");
}

Now, run all Unittest (you have unittests covering at least 80% of your software, don’t you?) and replace BigDecimals with other appropriate datatypes where you see the UnsupportedOperation popup.

Software

Reboot…

Posted on 2007-01-29 By rolfje No Comments on Reboot…

Today the Mac OS Software update popped up, and warned that these updates would require a reboot (about 80% of the updates do not require a reboot). I have gotten so used to not having reboot and hangup troubles that I almost was surprised to see that I needed to reboot. I use my Mac mini for editting foto’s, video, recording TV programs, streaming music, programming, mail, and the usual webbrowsing. It is so quiet and uses so little power that I only power off the screen, and leave the Mac on. I noticed that I have not turned it off for the past 20 days:

rolf$ uptime
20:17  up 20 days, 23:37, 3 users, load averages: 0.20 0.26 0.20

Not bad for a workstation eh? Glad I bought a Mac, it was worth every penny. The other Mac mini I bought to replace my fileserver is also still worth every penny.Just thought I’d share some of my newly acquired Zen with you…

Apple, Software

Lost Oracle SYS and SYSTEM password?

Posted on 2007-01-16 By rolfje 56 Comments on Lost Oracle SYS and SYSTEM password?

If your administration is as good as anybodies, you are bound to loose the not-so-frequently used password for the SYS and SYSTEM users of oracle. Here are a few ways I found to re-set those passwords:

Method 1: SQLPLUS (Tested on AIX Oracle 9.2.0.1.0)

Log into the database server as a user belonging to ‘dba’ [unix ] or ‘ora_dba’ [windows ] group , typically ‘oracle’, or an administrator on your windos machine. You are able to log into Oracle as SYS user, and change the SYSTEM password by doing the following:

$ sqlplus "/ as sysdba"
SQL*Plus: Release 9.2.0.1.0 - Production on Mon Apr 5 15:32:09 2004

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.

Connected to:
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
With the OLAP and Oracle Data Mining options
JServer Release 9.2.0.1.0 - Production

SQL> show user

USER is "SYS"

SQL> passw system
Changing password for system
New password:
Retype new password:
Password changed
SQL> quit

Next, we need to change the password of SYS:

$ sqlplus "/ as system"
SQL*Plus: Release 9.2.0.1.0 - Production on Mon Apr 5 15:36:45 2004

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.

SP2-0306: Invalid option.
Usage: CONN[ECT] [logon] [AS {SYSDBA|SYSOPER}]
where <logon>  ::= <username>[/<password>][@<connect_string>] | /
Enter user-name: system
Enter password:

Connected to:
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
With the OLAP and Oracle Data Mining options
JServer Release 9.2.0.1.0 - Production

SQL> passw sys
Changing password for sys
New password:
Retype new password:
Password changed
SQL> quit

You should now be able to log on the SYS and SYSTEM users, with the passwords you just typed in.

Method 2: Creating pwd file (Tested on Windows Oracle 8.1.7)

  1. Stop the Oracle service of the instance you want to change the passwords of.
  2. Find the PWD###.ora file for this instance, this is usuallly located atC:\oracle\ora81\database\, where ### is the SID of your database.
  3. rename the PWD###.ora file to PWD###.ora.bak for obvious safety reasons.
  4. Create a new pwd file by issuing the command:
    orapwd
    file=C:\oracle\ora81\database\PWD###.ora password=XXXXX
    where ### is the SID and XXXXX is the password you would like to use for the SYS and INTERNAL accounts.
  5. Start the Oracle service for the instance you just fixed. You should be able to get in with the SYS user and change other passwords from there.
Software

Nice Mac Tools

Posted on 2006-12-21 By rolfje No Comments on Nice Mac Tools

As a Mac user, I have absolutely no problem editting, moving and viewing large video, audio and image files. There was one thing I missed though, and that is a tool which is able to quickly view a large JPG (like OSX’s own preview) but then skip to the next image in the directory when selecting “next”. Today I have found just that tool, and it is a dream to work with. It called Xee (not to be confused with the rather lame Xsee).

Xee loads jpg’s blindingly fast from my remote fileserver. Then, using just the keyboard, I can easily zoom in, out, skip to the next or previous file in the directory, fit the image to screen, etc. After testing about 20 or so image viewers, It is absolutely the best image viewer I have found.

During the search for Xee, I also encountered the OSX Power Tools page, which is a list of very handy utilities for the Mac, and from what I can see all of them are free to use (check license to be sure).

Merry Christmas!

Software

Creating an Ubuntu Postgres server

Posted on 2006-11-10 By rolfje No Comments on Creating an Ubuntu Postgres server
Follow these steps to create an Ubuntu Linux “server” running a Postgres database which allows non-local connections. You will need a machine with at least 10GB HD, bootable from CD-ROM, network card, and preferably more than 200MB RAM. Other than that, it can even be a Mac G4 if you like (just download the correct Ubuntu build).

Read More “Creating an Ubuntu Postgres server” »

Software

Ibatis Nullpointer calling stored procedure

Posted on 2006-11-07 By rolfje 1 Comment on Ibatis Nullpointer calling stored procedure
Today, a collegue of mine had a really strange nullpointer problem trying to call a stored procedure in an Oracle 10 database using iBATIS Java 2.2.0. What she had was a normal JavaBean, like so: 

package com.rolfje.foo
public class BarBean {
    private String barName;
    private Long barId;

    ... setters/getters here ...
}

A straightforward parametermap:

<parameterMap class="com.rolfje.foo.BarBean"
      id="barbeanMap">
   <parameter property="barName" />
   <parameter property="barId" />
</parameterMap>

and a straightforward procedure mapping:

<procedure id="insertBar" parameterMap="barbeanMap">
   {	call store_bar (
      ?,?)
   }
</procedure>

When trying to call the stored procedure, she got the following stacktrace:

org.springframework.jdbc.UncategorizedSQLException: SqlMapClient operation;
uncategorized SQLException for SQL [];
SQL state [null]; error code [0];
--- The error occurred in com/rolfje/foo/sqlmaps/ParameterMap.xml.
--- The error occurred while applying a parameter map.
--- Check the barBeanMap.
--- Check the statement (update procedure failed).
--- Cause: java.lang.NullPointerException; nested exception is

com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in com/rolfje/foo/sqlmaps/ParameterMap.xml.
--- The error occurred while applying a parameter map.
--- Check the barBeanMap.
--- Check the statement (update procedure failed).
--- Cause: java.lang.NullPointerException
Caused by: java.lang.NullPointerException
Caused by: com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in com/rolfje/foo/sqlmaps/ParameterMap.xml.
--- The error occurred while applying a parameter map.
--- Check the barBeanMap.
--- Check the statement (update procedure failed).
--- Cause: java.lang.NullPointerException
Caused by: java.lang.NullPointerException
   at ...executeQueryWithCallback(GeneralStatement.java:188)
   at ...executeQueryForObject(GeneralStatement.java:104)
   at ...queryForObject(SqlMapExecutorDelegate.java:565)
...

After hours of staring at the problem, and comparing code with similar constructions from other projects, we decided to switch to the Oracle 9i thin driver to see if that would solve the problem. It didn’t, but there was an interesting development: The Oracle 9i driver actually gave us a decent error about not being able to parse the SQL statement. Which brings us to…

The solution:
We removed all layout from the procedure mapping, which resulted in:

<procedure id="insertBar" parameterMap="barbeanMap">
   {call store_bar (?,?)}
</procedure>

This solved the problem. Then we switched back to the Oracle 10i thin driver, and the problem was still gone. The problem lies in the TAB between the left curly bracket and the word “call”. Oracle can not handle this.To investigate this problem, we then also tried to insert <![CDATA[ ]]> around the procedure call, but as soon as there is a TAB between the { and the word “call” iBATIS will throw a NullPointer. The strange thing is that you can have spaces, newlines and tabs *anywhere* in the procedure mapping, as long as there is no TAB between the left curly and the word “call”.

Software

It ain’t what you do…

Posted on 2006-11-02 By rolfje 1 Comment on It ain’t what you do…
…it’s the way that you do it. Last week I noticed a funny thing in an application I’m involved in as a developer. For logging in to the application, the term “Log On” was used. However, for logging off, “Log Out” was used. This did not feel right, so I searched a bit on the use of these terms. It looks like more people are having trouble choosing one form or the other, and are also mixing on/off and in/out.

Read More “It ain’t what you do…” »

Software

Posts navigation

Previous 1 … 11 12 13 14 Next
         

Recent Comments

  • rolfje on Exit WordPress
  • Guus on Exit WordPress
  • rolfje on Exit WordPress
  • rolfje on Methode Buijs uitgelegd
  • LinkedIn is at Peak Enshittifaction – Will Chatham's Blog on Linked-In not really Opt-in?

Tags

Apple backup design DIY DRM eclipse environment fix Fun gmail google hacking hamradio Hardware helicopter iphone ipod iTunes Java Keynote linux modelling motorcycle music news opinion oracle osx photo photography programming repair review security Software technology Time Machine Twitter Ubuntu usability Utilities vacation vista windows Workshop

Categories

  • Apple (105)
  • Divorce (1)
  • Electronics (3)
  • Fun (57)
  • Games (7)
  • Hardware (72)
  • Microsoft (18)
  • Racing (15)
  • Software (138)
  • Uncategorized (68)
  • Workshop (20)

Archives

Brought to you without adds, banners, cookies or tracking. This one is on me. Yes, life can be this good. Pay it forward.

Copyright © 2026 www.rolfje.com.

Powered by PressBook WordPress theme