Thursday, November 26, 2009

Fixed twitter-tools posted url

I received a complaint because the url posted in my tweets which are automatically posted from Wordpress do not provide a valid link. Of course my WordpressMU if secured using HTTPS and other stuff of security measures. The twitter-tool plugin however used the https-url in the post-tweets. Because of that twitter users clicking on that link are not be able to see the post.

I am not a PHP guru. Actually I have never ever done anything in PHP, but being a programmer in multiple languages I am still able to figure out a bit of PHP. To fix this issue I changed I added a single line to twitter_tools.php just below '$url = apply_filters(....);' :

$url = str_replace('https:', 'http:', $url)

You're probably able to also use the filters to change https into http, but since I do not have any further knowledge of PHP or Wordpress code I just leave it with this. It works. I would be great if the next version of this plugin would be able to automatically shorten the url. Now they're a bit long.

My first look at OSGi

After hearing lots about OSGi on Devoxx last week I just had to get into it. Last couple of days I have been reading and trying out OSGi. Some good information is available on the OSGi Alliance site. The 'OSGi architecture' and 'Where to start' give a good starting point for learning about OSGi.
But then ... how to get started with it? These couple of links gave me a good starting point for gettings started with OSGi.

Also the free OSGi and Modular applications training from SpringSource by Joris Kuipers is pretty good.
As I was trying out OSGi, creating bundles and deploying them on Apache Felix or Equinox (in Eclipse) I found that doing the easy stuff is pretty simple, but it's hard to find information about the advanced OSGi stuff. The OSGi API contains dozens of classes, but only a few ones like BundleActivator, BundleContext, ServiceReference, ServiceFactory, Filter are used in those simple examples.
If you go through the API you'll also find about Bundle, BundleListener, BundleEvent, FrameworkListener, FrameworkEvent, ServiceListener and ServiceEvent with which you can do some pretty advanced stuff like being notified whenever a bundle gets installed, started or uninstalled. Via Bundle.getResources(..) you can even look into the bundle and find resources like Spring contexts or custom config files and uses those to do something. This is how Spring DM is able to detect new Spring bundles being deployed and is constructing a Spring context for you binding all services together.

But what about all those other classes in the OSGi API? How to get a HttpService or a LogService? The Equinox in Eclipse does not seems to have these. What to do with ComponentFactory, Consumer or ConfigurationListener? I have not been able to find out any info about these, apparently advanced, OSGi features.

OSGi also makes simple things we're so used to using a lot more complex. For example: logging. I think it should still be possible to use log4j within your bundle, but then you must package the log4j jar in your bundle and thus increasing your bundle size every time with this library. The other option is to use a logging service, but this seems to be very hard looking at all the posts which have been written just about this subject like Logging in OSGi Enterprise and OSGi-Logging. If you google for 'osgi logging' you'll find a lot of posts, proposals and howto's, but I have yet to find a simple solution that works on all OSGi platforms.

OSGi definitely is a very cool technology and does need some more investigation. I'm eager to know more about the ins and outs of OSGi and get more into the core of it.

Monday, November 23, 2009

Very interesting Devoxx '09

Last week was the Devoxx conference in Antwerp. It was my first Devoxx and I enjoyed it a lot. So much better then the Dutch NLJUG meetings where most speakers ... well ... just suck at presenting. Not so at the Devoxx. Ok they were not all that great a speaker but at least they had interesting stuff to tell.

Just a short list of subject which interested me:

  • jBPM4 (BPEL, BPMN, BPM in SOA)

  • Cloud Computing, EC2, Google App Engine (GAE)

  • OSGi

  • JEE6 / Web Profile

  • SOA (very good presentation about SOA in Praktice with lots of tip and tricks)

  • Flex4 (release Q1/Q2 2010), FlashCatalyst, Flash player 10.1 for mobile phones (prerelease 17/11/09)

  • Open Social (create shareable components for dashboard-like apps like iGoogle)

  • Glassfish v3, Although I'm not a Glassfish fan (it's just a JEE6 reference implementation), it does have some very nice stuff, completely based on OSGi.

  • Maven 3

Some frameworks I heard about for the first time:

The JEE6 specification will be final on Dec. 12 2009 ! Shortly after that Glassfish v3 and Netbeans 6.8 will be released. Also a plugin for Eclipse will  be available. IntelliJ also already has a v9 beta with JEE6 support.
Some nice stuff in JEE6:

  • REST Support via annotations. @Path, @Produces, @GET, etc. Spring 3 will have something similar so their annotation will probably align with the JEE spec in version 3.1.

  • Validation and possibility to do custom validation via custom annotation. For example @Email to validate an email address.

  • Web-Fragments, divide your webapp in multiple modules

  • Annotations for Servlet (@WebServlet), Filter (@WebFilter), Listeners (@WebListener).

  • ServletContainerInitializer interface to be able to integrate with webapp programmatically. Mainly for frameworks but you can do some cool stuff with this like dynamically register Servlets, Filters, Listeners etc.

  • EJB3.1 Lite, allows for entity objects defined in WAR. @Singleton, @Startup, @Asynchronous, @PostConstruct, @PreDestroy, @EJB

  • Interceptrors, DI, CDI, JSR-45, JSR-250, JPA 2.0, JSF 2.0, etc, etc.

The Keynotes:

The first keynote on wednesday was about the Devoxx, number of attenders, new Parleys version, yada yada. All presentations will eventually be freely available at Parleys. Starting in januari each month 2 new free presentations will be added. If you can't wait, you can subscribe for 49,95 and see all presentations now.
Next was Steve Harris, Senior Vice President of Oracle development). He was not going to talk about Sun and the merger. The rest he told was ... well not interesting. Don't think anyone knew he was talking about. They showed some demos, but they were so short nobody even knew what they showed. It was like a magic rabbit and the hat trick where they only showed pulling the rabbit from the hat. Absolutely the worst talk of Devoxx.
After that a talk of Adobe about Flex 4, the new Flash 10.1 for mobiles (not for iPhone!!) and Flash Catalyst. I had seen most of it in june on an Adobe Users day.

On Thursday Ivar Jacobson (you know, one of the 4 of the Unified Process) talked about software development and how it should be based on a theoretical basis and not on a hype like RUP, XP, Scum etc. He and some others started SEMAT for this. Interesting but they should be careful this is not going to be another hype like UP.
Next was Robert C. Martin aka Uncle Bob (writer of Clean Code) and probably the best and funniest talk of Devoxx. His talk was about minimum standards, code of professionalism, manifesto software craftsmanship. So about what you should do as a software professional. He was able to go on for the whole day if he was permitted. Definitely THE talk you must see at Parleys!! Here's a short summary:

  • First, do no harm

  • Clean Code

  • To go fast, go well

  • TDD

  • 100% test coverage

  • Know it works

  • Greenbar shippable

  • QA should find nothing

  • QA is specification, not verification

Worst talks of Devoxx:
Like I said, the Oracle presentation was terrible. James Gosling, the father of Java, also had a very disappointing talk about the Java Store. Those of you who also followed the Java One have already heard of it. It was just a sales talk about something that's not available in Europe! "If we can't use it, tell us something else!" It will be in Europe eventually, but not in The Netherlands. Too bad Java developers. We're not allowed to make any money. Looks like we have to do it illegally. Someone knows an address in the states we can use?

Monday, June 1, 2009

Get MySQL and PHP working on a Mac

I wanted to install a new Wordpress installation on my MacBook and play a little with different language plugins before I'm going to install them in my Wordpress MU on the server.

Apache is default installed on a Mac. Great!
MySQL installation was very easy. Just download and install. I'm using MySQL Administration and it works perfect. Created a user and catalog for wordpress with it.
Then downloaded and unzipped Wordpress in my users directory and tried to run the installation. It didn't work because it couldn't connect to MySQL. It was running however and I was able to connect using the administrator.

Apparently it's caused because MySQL puts its socket file on a different location. The solution was easy:

Open terminal and type the following : 
sudo mkdir /var/mysql 
sudo ln -s /private/tmp/mysql.sock /var/mysql/mysql.sock 
Then, open System Prefs > Sharing and refresh your Web Sharing.

Now Wordpress (and phpMyAdmin) can connect to MySQL and everything works perfectly. I love my Mac :P