Quicksilver on Linux

Another thing that got mentioned on the user group was the lack of a Quicksilver copy for Linux. As I find it hard to believe this didn’t exist for Gnome, I searched a bit and it seems Deskbar is doing this kind of stuff. I just put it on my top menu and I think I’m gonna use it a lot. It really looks nice, eve the del.icio.us plugin is nice.

Probably it will add a lot of extra load on your network with all the web calls it does. But hey I don’t have any limit so … 😛

Ubuntu getting momentum

Today I joined a small Java user group meeting. We discussed DWR and GWT. I already had investigated a bit both toolkits, I even used DWR in an application for a customer. The session still was interesting, although I knew most things. But there was one thing that was remarkable. Last time this user group was held, I was the only one who actually was using Linux on a daily basis (all my systems here are on Ubuntu, all my servers are running some flavor of Linux).

But today it seemed that more guys switched to Ubuntu. They preferred it over Windows. Okay, I know these guys are also programmers, and have some level of geekness. But they weren’t using it half a year ago, so there is momentum. Maybe not yet as mainstream as we would like, but Rome wasn’t build in a day either. And hey you can bet if a friend of these guys asks him to help him with computer trouble they will start advising Ubuntu over Windows. I can’t even count the number of computers I had to fix due to some kind of spy-ware. And I really am getting sick of it, and so will these guys probably.

\o/

Switch from hunderbird back to Evolution …

Today I switched my default mail client back from Thunderbird to Evolution.

Why???
I installed Beagle and I want all my mails to be indexed for searching. I lost 10 minutes searching for a stupid mail today (yeah, it’s really stupid heaving 5 large mailboxes that you use frequently)

After installing I started replying some emails and I noticed that my Nautilus mounted SSH folders were included in the add attachments screen. sweet The Thunderbird version didn’t have that option and that was pretty stupid. I had to copy the files locally and then attach them 🙁

I did notice however that the response off Thunderbird is much better than Evolution, but hey at my customer I’m have to use M$ Outlook so I’m glad when I’m back at my office using Evo.

I also stopped using Amsn, I also fully switched to Gaim. Okay the integration with the MSN messenger service isn’t as good as Amsn but Gaim also gets indexed by Beagle. I was already using Gaim for my Jabber and Gmail friends but not yet for my MSN friends. So you guys are now on my Gaim list and are being indexed 😀

You get the point, my whole entry is about indexing. Lets see how much more efficient I get in the future.

On a side note, I now seem to have my spelling checker enabled in Firefox. So I’ll pay more attention on my writing skills as some of you seem to have problems with my bad English!

Hibernate Second Level Cache

When I have to develop a more advanced web application I tend to prefer java over any other language. Ok I have to admit, I haven’t tried ruby on rails yet, but I’ll wait for Thor to finish his nice plugin for netbeans 🙂
I just find that java has almost a nice architectural solution for every problem you face (server side that is). That’s also the downside, there are so many solutions out there, that for a new programmer its a bit overwhelming!

That said, I use Hibernate in almost all my projects. (hibernate being an orm and speeding up my development) As you might know Hibernate has caching built in. First level is the cache in your session, and it’s local for you. Second level cache is for performing queries that in most cases return the same result. Now in my case I created the query and passed it a long some parameters. The parameters were offcourse also hibernate mapped objects. I setup the objects to be cacheable and I set the query to be cached. But it still went to the database on every request!?! Strange it should work?!?
So I started digging and after a while found the problem, really stupid (offcourse). I generated my object model using the reverse enginering tools from hibernate. I thought I had overridden all the equals and hascodes of these objects (as you should always do), but it seemed for these objects I passed in as parameters I hadn’t done it yet.

So as I understand, hibernate puts you query in a container, along with all the parameters you pass to the query, and a reference to the resultset. So if you try to perform the query again, he checks if this is already in the map, but because my parameters always returned false when actually business wise being true. He kept on going back to the db. So you see, even the smallest most stupidest things can have a great impact on your whole thing. This case being overriding the equals and hashcode in a small (3 properties) object, made my app lose 0.3 seconds in a lot of requests.

But BUGFIX/ENHANCEMENT has been done :))

Streaming media -> youtube style

Wouldn’t it be nice to create your own youtube movies and host them on your own private server? Why you ask, well maybe it’s content you don’t want others to view. Prolly this can be done using youtube, but hey I have my own servers and I want it where I have full access! (as do many companies actually).

So how do you do this using opensource tools? Actually very, very simple

I started from this blog entry. But as I’m using ubuntu dapper, I have the nice debian apt tool 🙂

So in short here is what you do:


apt-get install mencoder
apt-get install ruby
apt-get install flvtool2

And I had my tools install (maybe you need some extra depencies here) don’t know actually.
Then the commands like in the previous posts


mencoder \
orig_file.ext \
-ofps 25 \
-o dest_file.flv \
-of lavf \
-oac mp3lame \
-lameopts abr:br=64 \
-srate 22050 \
-ovc lavc \
-lavfopts i_certify_that_my_video_stream_does_not_use_b_frames \
-lavcopts vcodec=flv:keyint=50:vbitrate=300:mbd=2:mv0:trell:\
v4mv:cbp:last_pred=3 -vop scale=320:240

and


flvtool2 -UP dest_file.flv

And you have your indexed flash movie. And may I note the importance of the indexed in the sentence once more. In the past I tried this with a long avi and believe me its no fun if you can’t forward or rewind!!

So then you put the flv file on your server. Now all you need is a flash movie player for playing your content. And I like the flowplayer. You download it, setup a small page like this


<object type="application/x-shockwave-flash" data="FlowPlayer.swf"
width="320" height="263" id="FlowPlayer">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="FlowPlayer.swf" />
<param name="quality" value="high" />
<param name="scale" value="noScale" />
<param name="wmode" value="transparent" />
<param name="flashvars" value="videoFile=dest_file.flv"/>
</object>

Et voila, you have your own streaming video. Now put it into a web application and you have your own streaming media center!!

OSS == SWEET

Dojo patch rejected :(

I’m using the dojo dropdowndatepicker in a lot of my projects. Problem with this widget is that it only really supports the yyyy-mm-dd notation (as the standard is). But all the applications I develop the people want our local notation (dd-mm-yyyy). So I wrote a small fix that helps. Too bad it got rejected as it doesn’t fit in the idea of the project and the new widget set they are building.

For now it’ll be a patch I have to apply on all my dojo downloads to get the functionality I need from it. And let’s hope in the future we will migrate our code to the iso standards, right?

DWR

In one of my projects the user has to select a customer from a dropdown list. Problem is that the number of customers they have is much to big to prefill. So I used dwr to build a solution. The user has a dropdown from which he can choose the field he wants to query (let’s say street), he than fills in a streetname, presses the button and the list gets prefilled with the list of customers who match.

How does it work. Wel really simple 🙂

In my backend I have a simple POJO Search with a method getCustomers(String searchField,String searchValue). This calls a service layer, who in turn calls a dao layer,… you know the drill. In the end the method will return a List of Customer objects. I exposed these objects in the dwr.xml configuration file. (that’s it for the java backend stuff) (nice isn’t it 🙂 )

Now the javascript part is also small and handy. I had to include the dwr engine and my exposed object as javascript objects. When the user presses the button this small piece of code gets executed


Search.getCustomers(searchField,searchValue,CustomerCallBackHandler);

When the javascript gets a response back, the CustomerCallBackHandler will be executed. That looks like this


function CustomerCallBackHandler(data){

Where data is an array of Customer JSON objects. This means that in my java Customer object I have the getter/setter getId(),getName(). In javascript I can simply do data[0].id and data[0].name.

Now isn’t that nifty?! 😛

/me like

Opensource security monitor

In my always continuing search for nice opensource tools I sometimes stumble upon some real jems. And I found one (again) 🙂

I have a webcam and I wanted to keep track of what was happening in my appartment when I’m not there. First I tried motion. You start it from the command line, it starts a small web server and there you can configure it. I set it up that on every image that was taken I got notified. After one day I had +2000 mails in my mailbox. 🙁 Hmmm, I need to tweak it a bit. But then I came a cross zoneminder, it really is a nice application. I grabbed the ubuntu debs and installed them with the dependencies and had it up and running in notime!! Only thing I had to do was grant the www-data user access to video hardware. (took me quit some time to figure that one out!!)

Now if something happens I get alerted and a nice movie gets recorded. For anybody who wants some security stuff, really check this out. For a home user this is more than enough imho!!