Noizeramp

  • Home
  • Archive
  • Posts
  • Tags
  • Book: Wicked Cool Java

    3 February 2006 ⋅ 1 min read ⋅ development book java

    Pito has just told me that the a book “Wicked Cool Java” by Brian D. Eubanks is already available. You can find the review on Slashdot or visit the official site to get more information. In this post I won’t dive deep into details, but will just say why it’s so exciting personally to me.

    Wicked Cool Java

    In the Chapter 4 “Crawling the Semantic Web” the author mentions the project I’ve been involved in as an active contributor for more than two years already — Informa. Informa is the news feeds parsing library with several utility modules greatly simplifying life, own persistence layer with mappings for several most popular database engines, RSS/Atom parsers, exporters etc. In his fourth chapter the author mentions and gives examples of how to use Poller module which is one of my beloved children as well as Cleaner and Persistence Manager.

    Well, what can I say!? It’s WICKED COOL and I’m really proud of it even though it looks like there’s no direct mention of me as an author of the modules. ;)

    Have a good reading! And go grab the book at Amazon!

  • Testing Method Signature

    27 January 2006 ⋅ 2 min read ⋅ java development testing

    Today I had some new interesting testing task. What I needed was to ensure that some method has public and non-static signature. The method plays role of hook in OPML import utility class — the hook, which is used to create Reader object for a given URL. By default, it uses simple InputStreamReader wrapper, but the client application may wish to have something more sophisticated. So, the task was clear — to ensure that this method does not lose its signature, because it already happened once when I was reviewing the code and noticed that this method had unjustified public modifier. That time I changed it to “private static” and the application using this library lost its encoding detection skills.

    Today, when I was looking for a bug in encoding detection it was a sort of revelation to see that the code even doesn’t get called. Yeah, sort of blown off the entire leg instead of simply shooting off the boots. So, traditionally I fixed the signature and put some warning for the future, but… the next thought was how to make an automated test to be one hundred per cent sure about it. It appeared simple and I would like to share it with you just to encourage.

    public class ImporterTest extends TestCase
    {
      // lots of other stuff skipped ...
    
      public void testCreateReaderForURLDefinition()
        throws NoSuchMethodException
      {
        Method crfu = Importer.class.getMethod(
          "createReaderForURL", new Class[] { URL.class });
    
        assertEquals("Method should be public and non-static.",
          Modifier.PUBLIC, crfu.getModifiers());
      }
    }
    

    Easy and bulletproof.

  • What I Like About Ruby Language

    19 January 2006 ⋅ 2 min read ⋅ ruby development

    I’ve been reading “Programming Ruby: The Pragmatic Programmer’s Guide” for couple of days already and learnt some interesting facts about the language. As a Java programmer with several years of hard-core non-stop programming experience, I find it pretty amazing to see how new languages adapt to what we really need, not what the classics say.

    Read more

  • OPML Oddity and Tricks

    5 January 2006 ⋅ 2 min read ⋅ development thoughts opml

    About two months ago David Winer presented his first version of the Guidelines for validating OPML. Since that time it has been updated two more times, but it is not the point. The point is that the document denotes two possible types of outlines for building directories: link and rss.

    In my opinion, there are several problems with it. The major flaw is that RSS link is also a link. Type rss clearly states the type of the resource, but link is very general. Here’s the cut from the document. Read it carefully:

    When a link element is expanded in an outliner, if the address ends with “.opml”, the outline expands in place. This is called inclusion. A validator should check that the OPML file being pointed to is accessible, and may wish to validate the pointed-to file as well.

    If the address does not end with “.opml” the link is assumed to point to something that can be displayed in a web browser.

    (from guidelines)

    The main flaw is that lots of OPMLs today use link type when pointing to the RSS feeds. Yes, they could use the rss type, but they don’t. Why? Because it’s easier to always set type link as it works for every type of links well and the validator has no objections. Do you understand what it means for the users and the developers of different aggregators and outliners? Certainly you do. The users immediately become unable to use significant number of OPMLs in their favourite applications and the developers… they are good guys, they always have to follow all these breathtaking twists of a plot.

    Today we almost freed ourselves from specific extensions for the feeds. For example, now we have Feedburner service for the feeds which gives us the links, like http://feeds.feedburner.com/noizZze, where we don’t have any specific extensions, like “.xml” or “.rss”. Our blogging web-applications generate feeds on-the-fly. So why I would need extension for my OPML? Just to fit the rules of an OPML directory formation my pet OPML might never be included in? Sorry, but it’s laughable.

    Well, where are the tricks? As I was finishing this writing I decided not to include any tricks just because it is already tricky enough.

    All this teaches me a good lesson, another lesson about thinking of possible implications. Got to go. The OPML parser is still waiting for my attention…

  • Clever Paging

    14 December 2005 ⋅ 1 min read ⋅ development interesting

    Maybe it’s somewhat usual nowadays, but I was impressed to the tips of my fingers with a paging functionality I came across on the SourceForge.net site. The paging is those numbers below the list of items you see when, for example, looking through the results of a Google search. So the guys at SourceForge made it slightly different from the traditional approach we see everywhere.

    Assuming that you have a list of 505 items, 10 items per page setting and the first page selected, you will see the following pages listed below the main items list “1 2 10 20 30 40 50 51″. Clever, huh. If you now select the page 2 then it would be “1 2 3 10 20 30 40 50 51″ to give you an opportunity to jump one or several pages fore and one page back from where you are.

    What is particulary amazing about it is that the functionality appears to work well both for those whole wish to review all items page by page and those who wish to briefly check the contents of the whole results set.

    My sincere respect to the SF.net team! Bravo!

  • Singleton Strategies

    15 November 2005 ⋅ 4 min read ⋅ development

    Often, when you are developing some application you wish it to run one instance at a time. If you are writing a native application, there’s no problem because the platform you are aiming on most probably already has everything for this kind of magic. When it comes to cross-platform approach it’s vitally important to choose something neutral. This post is about my experience in this area.

    Read more

  • Breaking image caches

    19 October 2005 ⋅ 1 min read ⋅ development

    While I was tuning an Image Cache in BlogBridge, fetching different feeds, I noticed one interesting thing. Some feeds, for a reason, impenetrable to me, put random number in a query part of an image source URL, making it different every fetch.

    Read more

  • Usage of static inner classes

    15 October 2005 ⋅ 2 min read ⋅ java development

    Why is it good to have static inner classes? When an inner class is not static it holds a reference to its main class. If your inner class does nothing with the main class the reference is completely useless and only takes some memory. Nothing really harmful, though.

    Read more

  • Advanced Installer for Java Goes On Mac

    5 October 2005 ⋅ 1 min read ⋅ java development interesting

    Hooray! Wonderful news knocking at the door — Advanced Installer for Java (3.3) goes on Mac; and this is a really big step forward. We, as the proud users of AIFJ, are extremely happy to have an opportunity to build the Mac distributions of our application — BlogBridge — without serious messing with console. When we were choosing the installer for the application our main criteria was the presence of the Windows platform support. The Mac support was preferred but rather optional as we knew how to build a distribution package from the command line or with a console script. Of course, having this process automated means a big boost in our performance. A lot of thanks to you guys!

    Also the team reports the following changes:

    • Inclusion and exclusion filters for Synchronized Folders.
    • Editing multiple files’ properties at once.
    • File version override.
    • Stretched or fixed size switch for dialog banners and bitmaps.
    • Configurable Merge Modules.
  • Java Timestamps go Database

    30 September 2005 ⋅ 2 min read ⋅ java development

    Couple of years ago I wrote a small application to manage a post cards distribution for a small advertising company. The application worked with a Cloudscape database but it’s not the point. The point is that my friend, who was working for that company, asked me to help with some strange problem. After the hardware upgrade all of the records in the database became invisible. I need to say that there is a screen where you can examine the amounts of cards sent to a different organizations at the given dates, and there is another screen where you can build a comprehensive reports with the same information but for a given dates range. Well, the records were not visible on the single-date statistics page, but they were in the reports. I was shocked…

    Read more

  • 1
  • 2
  • arrow-right