Monday, October 5, 2009

Type was not serializable and has no concrete serializable subtypes

The internet has really helped to speed up development. I remember when I first started programming and you had to decipher what you had done wrong and wasted hours and sometimes days to figure it out.

Again I came across an error in my GWT RPC application where the message is not exactly clear as to what it is that is not correct.
[ERROR] Type 'a.b.c.client.model.Activity' was not serializable and has no concrete serializable subtypes
[ERROR] Line 30: Failed to resolve 'a.b.c.client.rpc.ActivityService' via deferred binding


Luckily I remember something about a no-argument constructor in my class and that was it. Searching in GOOGLE one also finds the answer immediately.

Monday, August 31, 2009

IllegalStateException: SimplePanel can only contain one child widget

I have been struggling (wasted time) for about a week trying to figure out why my GWT admin application is giving an IllegalStateException. The full error is :
Error: uncaught exception: java.lang.IllegalStateException: SimplePanel can only contain one child widget

The application runs on Google App Engine with Struts 2 and GWT - "Namibia my African Destination".

After doing some research and determining (incorrectly) that the problem was my DecoratorPanel and that I should use the method setWidget and not the add method, I realized that the error was actually not from the DecoratorPanel, but from the FormPanel that I have as a child of the DecoratorPanel.

Both FormPanel and DecoratorPanel comes from the Base class SimplePanel and can only have one child.

Yay, it finally works.

I probably would have known exactly where the problem was, if I was running it in hosted mode.

Tuesday, June 23, 2009

Video file image capture with ffmpeg

In my work yesterday I had to fix a flash preview option for a website I was doing.
(Cant name the site.) The people (pronounced 'poephol' ) were making the web user who visited their site automatic download loads of video content.

This made the client's website a bit slow, and created lots and lots of bandwith consumption. Anyway. They realized their mistake asked me to send thumbnails of the vidoes.

At first I asked the account manager to send me screenshots of the videos. But this was not going to work, as she pasted it into a word document. Then I thought - "There should be an easier way todo this." - and there is.

1) Install ffmpeg
Debian, Ubuntu:
sudo apt-get install ffmpeg

2) Replace the video and image filenames in the command listed below with your video and image and paste into a terminal.

ffmpeg -y -i video.flv -vframes 1 -ss 00:00:05 -an -vcodec png -f rawvideo framepic.png

3) You may have noticed that the "-ss 00:00:05" indicates to capture the image after 5 seconds. You can change this to the frame you want to capture.

4) After creating the PNG, I used the convert function of ImageMagick to make the file a JPG.

Tuesday, June 16, 2009

ImageMagick converts your images from the command line

I am sure there are many image converting programs on the internet and some are probably a lot more user friendly, but I recently used ImageMagick to resize some family photos to send to my family. (I know putting this on Facebook or Picassa would have solved this issue, but not everyone use these as often as email)

As I am sure most users know that image from cameras can be quite big and this tool will convert those images to the size and quality you desire.

All you need todo is install ImageMagick
Debian, ubuntu:
sudo apt-get intstall imagemagick

then run the convert command with your preferences
convert image.jpg -resize 800x600 -quality 70 -interlace PLANE image2.jpg

Violla.

Monday, June 15, 2009

Terminator Terminal

I have been using "terminator" for a while now a find it a very useful tool when monitoring logs on remote servers. Terminator enables you to have several terminal clients open in the same window. Just right click the window and select "split vertical" or "split horizontal" and it splits your window.

Debian, ubuntu:
sudo apt-get install terminator