I have just posted my first tweet from Java

and I still can’t believe how easy and fast it was. The actual coding took like 2 minutes, whereby the remaining 8 minutes were needed to setup a Twitter application to be able to post in the first place. Not only that, but it worked from the first try, therefore I had to stop coding and start blogging about it. This was made possible by Twitter4j (thank you very much Yusuke):

“Twitter4J is an unofficial Java library for the Twitter API. With Twitter4J, you can easily integrate your Java application with the Twitter service. Twitter4J is an unofficial library”

Octocat Source code for this post is available on Github - podcastpedia.org is an open source project.

Continue Reading ...

The challenge – java.io.IOException: Server returned HTTP response code: 403 for URL

Remember my post Reading/Parsing RSS and Atom feeds in Java with Rome, remember how I build SyndFeed objects out of a feed’s URL:

public SyndFeed getSyndFeedForUrl(String url) throws MalformedURLException, IOException, IllegalArgumentException, FeedException {

	SyndFeed feed = null;
	InputStream is = null;

	try {

		URLConnection openConnection = new URL(url).openConnection();
		is = new URL(url).openConnection().getInputStream();
			is = new GZIPInputStream(is);
		InputSource source = new InputSource(is);
		SyndFeedInput input = new SyndFeedInput();
		feed = input.build(source);

	} catch (Exception e){
		LOG.error("Exception occured when building the feed object out of the url", e);
	} finally {
		if( is != null)	is.close();

	return feed;
Continue Reading ...

&lt;title&gt;Hoisting example&lt;/title&gt;
    &lt;h1>Hoisting in action&lt;/h1&gt;
    &lt;script type="application/javascript"&gt;
        var hoisting = "global variable";
            confirm("\"" + hoisting + "\"" + " click OK" );
            var hoisting = "local variable";
        })(); //self-executing function

     //Best practice - declare local variables at the beginning of the function

The challenge

I have been getting complaints from people who were trying to suggest a podcast to Podcastpedia.org, and that for a good reason. They were getting a page with the following message:

"Unknown error. Please inform us about it with the Error indication form."

This is the default page rendered when an unknown exception occurs. Although this is prettier than displaying the error stacktrace, it should be avoided – it didn’t tell the visitors much and me neither.

Octocat Source code for this post is available on Github - podcastpedia.org is an open source project.

Continue Reading ...

There are to main applications, that power Podcastpedia.org, one that is actually the web application and another one where I do administrative stuff and podcast updates. Experience has shown that if I want to run the podcasts updates in the background and do some testing/debugging/redployment on the front-end application it’s better to have them running on different Tomcat instances on the development machine.

Continue Reading ...