Friday, December 11. 2009Built a website
It's been maybe 10 years since I've built a website, but once again I took it upon myself. It took me nearly a year to complete it though, and not because it was a lot of work.
Suerte Administraties Yes, that's my brother Peter. Nice, not very impressive, but Google, please go and index. Monday, March 5. 2007
Resource Environment Providers Posted by Robert Berg
in WebSphere Portal at
11:59
Comments (0) Trackback (1) Resource Environment Providers
These are the articles I really like. Just enough sample code and lots of configuration completely and extensively documented to the last custom property that is needed (with screenshots).
Resource Environment Providers are very useful. It's a good help in configuring your application, for one reason because it's more dynamic than using deployment descriptors. Oh, just read the introduction of the article. I wanted to use one myself and then I came across this article. And yes, I made one, my very own Resource Environment Provider, well, I almost completely copied the example with the names changed to protect... All worked quite well, but when you look at the code in the article, there are two things that you might notice to be a bit strange. First of all, the sample ConfigFactory in listing 1 only generates one static Config object. It fills it, and reuses that same object every time the function is called. Some sort of smart caching eh? I'm sure that reading those attributes must take forever. But not likely. So I changed that to create a new object each time the function is called. Secondly, you might notice that there is something strange going on with the value of the custom property. It's casted to a String in the ConfigFactory, but the Config object stores it as an Object and also returns it as an Object. And as you can see further on in figure 18, a custom property can be of a couple of types (like string, integer etc). So why do we need to cast? It only seems to limit the possibilities, because obviously it can also return other objects. So I changed that too. What you would expect now is that you can use any type of custom property and if you change them those changes are immediately reflected in your application. Right? Maybe I should send the author of the article my improved code. But what makes life interesting is that things are not always what you expect them to be. Very often sample code is just the only way it can work. When I used my resource environment provider I had to restart the application before I could see the changes I made to the custom properties. Before that, it just returns the old values. And when you set a custom property to type Integer, it still returns a String object with that value. Actually it always returns strings, so I can't see any need for that type field... Also, if you have any of those field names contain the word 'password', it becomes a password and WebSphere encrypts it. If you try to get those properties they will look something like this: {xor}LDo8LTor. I found out can decrypt those with this function: com.ibm.ws.security.util.PasswordUtil.decode("{xor}LDo8LTor")The resource environment providers are very flexible object factories. I think there are a lot of uses for them other than just return those custom properties. But I will stick to this one for now. Saturday, March 3. 2007Laptop power usage, using a power meter
Recently I bought a device that can measure the amount of power that other devices use: a plug-in power meter which you can buy in a lot of electronics shops. If you are interested in environmental stuff and you want to save power for the sake of it (you shouldn't be saving power just for the money because there's not much to win there), it's good to know what is using much power and what's not.
The first surprise came when I plugged in my 9 watt energy saving light bulb. In the first seconds it uses much more power than the 9 watts (as we all know of course, it also it gives less light during that time), but it graduadly lowered from 14 watt to 12 watt. Hmm.. but where did those 3 watts go? It could be the scaling is off, but it is sort of correct on other devices I measured. Anyway, one of those other devices is my laptop. If it's turned off, it doesn't use any power. When it's in idle mode (while I'm not doing anything else but running Kubuntu and typing this text) it only uses around 32 watts, but running a job that takes 100% cpu (converting an avi file), it jumps up to 64 watt. Quite a difference. I also have an old desktop machine I put together from old parts. There's no hard drive in it, but except for that it's a complete machine. When I plug that machine in the mains and do not turn it on it uses 12 watt (it probably needs that power to light a LED on the mobo and to be alert to wake up on LAN when that time comes). If I turn it on it uses 70 watt. And we are talking about a 750mhz AMD Duron here. I don't know about modern desktops, but I'm afraid they consume even more power. Next thing soon is that I'm going to measure the difference between Windows and Linux (will be a tough one to keep all factors equal), and I will try to see if there is any extra power needed when you turn on a virus scanner on Windows. Yes, these devices are fun. Thursday, March 1. 2007Firefox on the rise again
Last month there were a couple of stories that said that the steadily increase of Firefox usage was brought to a halt and maybe was on its way down. These stories apparently tend to come out when Firefox' share is down half a percent. Today the new figures came in from netapplications.com, the company that originated those stories, and (surprise), the usage is up again. Firefox has a 14.18% share in February, the highest share it ever had on netapplications.
Now what should we make of that? Nothing, I guess. Anyway, here are some interesting figures. Sunday, February 11. 2007Music player daemon
I wanted to play audio on my home computer using a daemon. The best things about that are that you don't need a graphical interface and you can easily control it remotely. I was a bit struggeling with the xmms2d to make this all work, when I discovered that the mpd project was way ahead of xmms2. I also have a Nokia 770, and I looking around a bit I found this description on how to setup the whole thing.
In Ubuntu there is the mpd package, which you just have to apt-get. But I couldn't find phpMp in the repository. I always have apache2 running with php, and downloading, installing and configuring phpMp was really easy. In /etc/mpd.conf you can change the location of where your mp3 files are (mpd doesn't play wma but I don't keep them around anyway). If you go there with your browser, you're ready to run the update of your music database, which will be filled with the files in your music directory. Then all you music will appear in your browser. With a Nokia 770 go to the webapp and play your music.To control mpd from you desktop or laptop, there is the gnome client gmpc, also in Ubuntu's repository. It's a very basic player which doesn't have a lot of features. But enough for my needs. The Ubuntu repository also contains the command line client mpc. I installed that one to run a crontab to wake me up every morning on weekdays. Just make it run mpc play. Unfortunately I haven't found a way to do a fade in with the volume. The alarm plugin of xmms made me wake up a lot more friendly.
Wednesday, February 7. 2007
Portal URLs and a regular expression Posted by Robert Berg
in WebSphere Portal at
10:56
Comments (0) Trackbacks (0) Portal URLs and a regular expressionFor something I was working on I needed to replace URLs in a body of text. I wanted to do that in a JSP so I used a Friday, February 2. 2007Renaming files to lower casePerl is not something I am good at, but shell scripts are even worse in my case. I needed to have a list of files renamed to lower case and it took me more than half an hour to come up with this: find . | perl -n -e 'chomp; $a=$_;
$_ =~ tr/[A-Z]/[a-z]/;
rename($a,$_);'
Why would you need Java when you can do it this easily in Perl? Thursday, February 1. 2007
Creating a thumbnail image from a PDF Posted by Robert Berg
in Java at
11:10
Comments (0) Trackbacks (0) Creating a thumbnail image from a PDF
The last couple of weeks I have been testing a lot of Java libraries that convert PDFs to images. I wanted to use it to display small thumbnails of the first page of a lot of PDF files. There are some open source initiatives in this field, like PDFBox, but I just couldn't settle for this one because, basically, the result was just too plain ugly. The rendering was terrible which I couldn't change at all, and it couldn't handle a lot of the fonts (which is very understandable by the way).
Of all the closed source products I tested (Big faceless, Ice Soft, Snow Bound Software and some more), I ended up with this one. It was the fastest of them all, and it was also the best deal. The thing they do well at Qoppa is that they not try to sell one big application that can do everything, but they sell small products for specific purposes. This way you don't pay the whole deal for a lot of stuff you are not going to need anyway. And no, I don't work there, I've just seen a lot of PDF converters that I didn't like, that's all. Oh.. and here's an example of the code I used: PDFDocument pdf = new PDFDocument(file.getContent(),null);PDFPage page = pdf.getPage(0);double size = 600 / page.getPaperWidth() * 18;BufferedImage image = page.getImage(size);Notice the free style hard coded resizing of the page. Thursday, January 25. 2007
WebSphere Portal 6 on Ubuntu (part 5) Posted by Robert Berg
in WebSphere Portal at
15:36
Comments (0) Trackbacks (0) WebSphere Portal 6 on Ubuntu (part 5)
Where will this end? Looking at SystemOut.log for any problems after the installation of the WebSphere Portal 6.0.0.1 fix pack, there were some exceptions I could easily fix. Let's start with those.
The first one was CWLAG0450W, which I could safely ignore. The second problem was a bit more tough. IBM named them CWSIV0954E and CWSIP0301E which both relate to the Workflow application. I have been struggling with the process server some time ago, and it didn't surprise me at all that it causes problems now that I finally start to use it. The problem seemed to be a simple authentication issue. The easy solution to that is to disable global security, but I won't settle for that. The thing that doesn't work is a SCA module. You can find those under the menu item Applications in the WebSphere Administrative Console. In my configuration there was only one, the workflow stuff. To make it work you need to go to JAAS Configuration at the Global Security page of the Admin Console and select J2C Authentication data. There you'll find the SCA_Auth_Alias, and you have to provide a name and password with sufficient rights. I used wasadmin and his password. The third thing portal started complaining about was that it couldn't find DefaultUserCalendarHome in the JNDI (javax.naming.NameNotFoundException). This involves nothing more than installing SchedulerCalendars.ear from the <WAS>/installableApps directory. You can do that from the admin console. During step 2 make sure the Calendars module maps to WebSphere_Portal. Leave everything as default (you'll notice that it picks com/ibm/websphere/scheduler/calendar/DefaultUserCalendarHome as its default JDNI name). Click finish and check if the application has started.At this point I really felt like I was installing way too many things to make this work in a simple development environment. Was I on the correct path? Especially now the whole setup is beginning to need loads of cpu power. Moving forward and trying to actually use the workflow I quickly ran into this one: java.lang.IncompatibleClassChangeError: . Ok, that's it. That expection sounds like really freaked out installation. Maybe I did something wrong somewhere. Luckily I documented every single step. Maybe I'll start over or maybe I'll have a go with classfinder to get to the root of this. Tuesday, January 23. 2007jQuery, AJAX and Java
Now that I've started using jQuery to submit forms I bumped into a little problem with my jQuery-optimism today.
I wanted to test a form I made by submitting random data to it, with in the end the application storing it in a CLOB field of an Oracle database. And because the application is quite international I went for some Russian and Chinese characters. Everything in the app seemed to work well, except that every time there was nothing readable left over from the original text (as far as I could read the original anyway), but instead there were these paragraphs of experimental Ascii art. So I went diving into the documentation of Oracle, looking for a secret property I might have overlooked, checking the JDBC driver for patches, examining my code for weird constructions that were out of the ordinary, but I couldn't find anything. You can probably imagine the growing frustration and the ridiculous amount of time it took me to realize that it wasn't the Oracle database that was at fault, but it was already the incoming data that was messed up. How come, you might ask? You have to put this at the beginning of the ajax servlet: request.setCharacterEncoding("UTF-8");Otherwise, the request object chooses the default encoding. Check this out for more details. |
QuicksearchArchivesCategoriesRelated |