December 18, 2009
Enable Classic Eclipse Update Capability
In the preferences dialog, search for Capabilities.
In /General/Capabilities, check 'Classic Update'.
Restart and the classic update and plug-in management is available.
December 01, 2009
Hibernate's "User SQL Comments" feature causes a problem with DB2
I've been having a problem where a query sent through hibernate fails with the message: executeQuery method cannot be used for update
Here is an example of the log output. The hibernate actual hql and sql queries have been replaced with [...] in order not to expose my employer's database schema information.
Hibernate: /* select [...] */ select [...]JDBCExceptionReporter:100 - SQL Error: -99999, SQLState: nullJDBCExceptionReporter:101 - executeQuery method cannot be used for update.
I googled: db2 "executeQuery method cannot be used for update"
and the second result lead me to this.
It turns out that the problem was that I had the hibernate property "hibernate.use_sql_comments" set to "true". This caused the error because the hql was prepended to the sql query. Once I commented out the setting of that property the problem went away. I suppose that the default is false for this property.
I copy and paste the material here just in case it disappears from the referenced page.
Hibernate problems and solutions
- Hibernate not retrieving entity and throwing (what seems) a jdbc driver exception.
I have a simple entity mapping and attempt to save and then retrieve the object by the generated id. Hibernate throws the following exception:
org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: could not load an entity:
[nz.co.client.blitztecapp.model.MessageArchiveImpl#41]; uncategorized SQLException for SQL [/* load nz.co.client.blitztecapp.model.MessageArchiveImpl */ select messagearc0_.MESSAGE_ARCHIVE_ID as MESSAGE1_0_0_, messagearc0_.MESSAGE_TYPE as MESSAGE2_0_0_, messagearc0_.CONTENTS as CONTENTS0_0_, messagearc0_.MESSAGE_ID as MESSAGE4_0_0_, messagearc0_.PACKAGE_ID as PACKAGE5_0_0_, messagearc0_.CREATED_BY as CREATED6_0_0_, messagearc0_.CREATED_DATE as CREATED7_0_0_ from MESSAGE_ARCHIVE messagearc0_ where messagearc0_.MESSAGE_ARCHIVE_ID=?]; SQL state [null]; error code [-99999]; executeQuery method cannot be used for update.; nested exception is com.ibm.db2.jcc.a.SqlException: executeQuery method cannot be used for update.
Caused by: com.ibm.db2.jcc.a.SqlException: executeQuery method cannot be used for update.
at com.ibm.db2.jcc.a.co.a(co.java:2079)
at com.ibm.db2.jcc.a.cp.d(cp.java:1528)
at com.ibm.db2.jcc.a.cp.K(cp.java:316)
at com.ibm.db2.jcc.a.cp.executeQuery(cp.java:299)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:186)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1787)
at org.hibernate.loader.Loader.doQuery(Loader.java:674)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
at org.hibernate.loader.Loader.loadEntity(Loader.java:1860)
at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:48)
at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:42)
at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:3042)
at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:395)
at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:375)
at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:139)
at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:195)
at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:103)
at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:878)
at org.hibernate.impl.SessionImpl.get(SessionImpl.java:815)
at org.hibernate.impl.SessionImpl.get(SessionImpl.java:808)
at org.springframework.orm.hibernate3.HibernateTemplate$1.doInHibernate(HibernateTemplate.java:467)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:369)
at org.springframework.orm.hibernate3.HibernateTemplate.get(HibernateTemplate.java:461)
at org.springframework.orm.hibernate3.HibernateTemplate.get(HibernateTemplate.java:455)
.
.Problem:
The problem is a hibernate property that I had set : hibernate.use_sql_comments=true causes the failure. This seems to be a bug in hibernate - Unset the property and things should work fine.
November 25, 2009
DB2 9.7 JDBC Driver causes a problem for hibernate native id strategy
App Server: IBM Websphere Application Server 6.1
DB: IBM DB2 8.?
JDBC Driver: Those packaged with IBM DB2Express v9.7
I would get a message stating:
org.hibernate.HibernateException: The database returned no natively generated identity value
When I changed my Websphere server configuration to point to an older db2 jdbc driver, the insert succeeded.
Information and workaround options are available here.
October 12, 2009
DB2 install and config tutorial
October 08, 2009
In Ubuntu, sh is dash, not bash
unlink /bin/sh
ln -s /bin/sh bashafter doing this the installer worked just fine.
Should you desire, you can switch back to dash. Just run the above commands substituting 'dash' for 'bash' in the second one.
Here is more information on the sh-as-dash 'feature' of Ubuntu.
September 24, 2009
Aptitude (Command-line package manager)
aptitude update -- update the package repo
aptitude safe-upgrade
aptitude full-upgrade
aptitude search 'part of package name'
aptitude show package-name
aptitude install package-name
Switching Linux Consoles
Ctrl-Alt-F8 brings up some text, maybe system messages or something but it doesn't look like a command line I can do something with.
A little research suggest nothing runs on Terminals 8-12 initially.
Adding key to apt so ppa packages can be authenticated
Add the source to Ubuntu (System > Administration > Software Sources)deb http://ppa.launchpad.net/keepassx/ppa/ubuntu jaunty mainAdd the project signing key to apt:
deb-src http://ppa.launchpad.net/keepassx/ppa/ubuntu jaunty main
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 095F1873
The signing key from launchpad was 1024R/095F1873 (note the part after the slash is used in the apt-key command.
The ppa page from which I got this information:
https://launchpad.net/~keepassx/+archive/ppa?field.series_filter=jaunty
Adding key to apt so ppa packages can be authenticated
deb http://ppa.launchpad.net/keepassx/ppa/ubuntu jaunty mainas sources.
deb-src http://ppa.launchpad.net/keepassx/ppa/ubuntu jaunty main
Then I added the corresponding key to apt with this command:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 095F1873095F1873 is part of the PPA's PGP signing key (1024R/095F1873)
September 04, 2009
Trapped in Terminal Server Client Full Screen
The key sequence Ctrl-Alt-Enter toggles full screen.
September 02, 2009
Killing processes in linux
ps ax | grep notes
to get the process id and then run
sudo kill -9
to kill it.
Tyler, a coworker, pointed out to me that I could add 'Force Quit' to the panel at the top. When you press that you can just click on a misbehaving window to kill it.
August 25, 2009
Java HashSet can "lose" objects
I have some code that invoked HashSet.remove(Object) and the object was NOT removed. Turned out that after the object was added to the set, a field that is involved in computing the HashSet was changed. Then, because the hash of the object changed, the remove method didn't remove the object. I tested in Sun Java 1.6.0_13 and in on IBM jdk 1.5. I found this blog post about the subject that contains a good explanation.
I don't think this limitation is sufficiently documented Java's HashSet.
Thanks to Boris Kirzner
http://boriskirzner.wordpress.com/2006/10/01/hashsetcontains-does-your-busket-contain-something/
May 21, 2009
Internet Explorer Collection (Multiple Versions of Internet Explorer Installed on MS Windows)
April 24, 2009
Derby
Especially the part about adding an attrib to the connect string to create a new schema. (jdbc:derby://localhost:1527/phillipsDB;create=true)
http://www.brucephillips.name/blog/index.cfm/2009/2/28/Using-the-MyEclipse-Derby-Database-Server
April 10, 2009
MercurialEclipse
Well. I installed the mercurial 1.2.1 windows binary package from here: , set HG environment variable to the path to the hg executable. the hg install directory was added to the PATH. Now the pluggin seems to work well.
March 12, 2009
Atheros Wireless in Ubuntu 8.10 Intrepid Ibex
http://unsharptech.com/2008/10/31/atheros-wireless-in-ubuntu-810-intrepid-ibex/
With my Toshiba L355D-S7825 laptop I have to install a backports package
The package is linux-backports-modules-intrepid-generic
sudo apt-get install linux-backports-modules-intrepid-generic
February 26, 2009
Could not install cygwin on MS Windows Vista 32-bit
Any windows machine I use regularly has cygwin installed. I need my linux/unux-like tools. Cause I'd loose my geek card if I didn't unzip files using command line tools.
Something happened during the installation. It froze and never progressed. I've installed cygwin a bunch of times, so I'm confident this was not a case of impatience. I killed the install. Later I started another install. This would fail with a message to the effect that cygwin install failed to start because cygintl-3.dll couldn't be found. This caused bash.exe to hang. Tried a couple more times. Same result.
I decided that there might be something wrong in the cygwin-packages directory. When you run the installer it asks for a package dir and an install dir. So, I deleted the package dir.
The next run of the installer was completely successful.
January 31, 2009
I messed up my install of Juice podcatcher
Update, 2/1: the fix was not completely successful. See the update at the end.
This isn't really a software engineering topic. But, hey! It's my blog. Someone might really need this information!
So I wanted to try the Juice open source podcast receiver (some people call them podcatchers). As of my writing this article, the current version is 2.2. I installed it, started it, opened up the preferences and saved them with a wrong path to the directory where my podcasts should be saved. I think the problem is that by default the path was wrong for Vista. It was "C:\Users\
But it should have been "C:\Users\
After I saved the preferences with the invalid path, Juice would crash every time I tried to start it. The following is from the log and shows the error that was crashing Juice.
Traceback (most recent call last):I tried to find a solution by googling the error. It didn't yield anything. Several people had posted questions on many sites about similar problems. No solutions were published.
File "gui.py", line 4, in ?
File "iPodderGui.pyc", line 3573, in main
File "ipodder\configuration.pyc", line 468, in __init__
File "os.pyc", line 154, in makedirs
OSError: [Errno 17] File exists: 'C:\\Users\\Ari Zelanko\\My Documents\\My Received Podcasts'
I tried to reinstall the application. I uninstalled and reinstalled. No improvement. Juice still crashed on startup. I opened up the readme file in the Juice install directory. It has a section about updated from an older version of Juice (formerly iPodder). This is a quote from the Juice 2.2 readme file:
In iPodder 1.0 the settings were stored in the iPodder installation directory, probably C:\Program Files\iPodder. Starting with version 1.1 the configuration are placed outside the installation directory, in a user-specific directory, if possible. The default location is the NT-style Application directory, usually C:\Documents and Settings\yourname\Application Data\iPodder. If your settings were lost, try locating these three files in the previous installation directory and copying them to the new configuration directory: favorites.txt, history.txt, schedule.txt.So, I started to look around my user directory for the settings. I found them. On Vista the path to the configuration was "C:\Users\
"I'll just remove the settings folder and Juice will start up normally, right?" I thought. So I deleted the iPodder directory under my user profile. I started up Juice and voila! There was no change. Juice still crashed with the same message! How infuriating! (I should stop the gratuitous use of exclamation points!)
Just when I was about to give up, I thought, "Maybe if I reinstall right now, the problem will go away." ... And that worked.
Summary
The problem:
Because I set an invalid path-to-save-my-podcasts-to in the Juice preferences, the application wouldn't start. Rather it would crash on startup.
The error log:
Traceback (most recent call last):The Solution:
File "gui.py", line 4, in ?
File "iPodderGui.pyc", line 3573, in main
File "ipodder\configuration.pyc", line 468, in __init__
File "os.pyc", line 154, in makedirs
OSError: [Errno 17] File exists: 'C:\\Users\\Ari Zelanko\\My Documents\\My Received Podcasts'
I removed the iPodder config directory under my user profile ("C:\Users\
Update: The fix wasn't successful (2/1/2009)
After a restart, the problem in this post returned. For now I've carefully reproduced the issue, entered a bug with the project and included logs, config files and such. I've uninstalled Juice for now. I think I will look for another free podcatcher program.
January 27, 2009
Java Resources
It contains a lot of resources for an up-and-coming java dev.
January 16, 2009
Install Ruby from binaries on Windows
I looked around for instuctions and found the answer posted by Lolindrath at stackoverflow.com.
- Download the windows binaries for Ruby 1.8.7 here: http://www.ruby-lang.org/en/downloads/ extract that to wherever you would like, I use c:\ruby. Then put c:\ruby\bin in your PATH environment variable.
- Download the zlib package: http://www.zlib.net/zlib123-dll.zip and extract the zlib1.dll, rename it to zlib.dll and move it into your Windows\System32.
- Download the iconv package: http://sourceforge.net/project/showfiles.php?group_id=25167&package_id=51458. Find and extract the iconv.dll into your Windows\System32.
- Download the rubygems package and follow the instructions, basically extracting the package and running ruby
setup.rb
- Verify that everything works properly by trying a
gem install rails
, once that installs then do:rails test_project
January 14, 2009
That file isn't open!
Do you want to find out what program has a file open?
You can do it with a free program called ProcessExplorer.
In the program's Find menu choose 'Find Handle or DLL...' (Or press ctrl-F)
Enter a part of the file's name. Press enter. Voila! You now have a listing that includes the process id that has that file open. If you kill the process, you should have no trouble deleting that pesky file.
If you are not sure what killing a process is or if you should, then just restart the computer and that should fix the problem.