Intro

As you can read on the page about myself, my hobbies are music, guitars and programming.

I'm also active as a developper. Mostly Java, which is my preferred programming platform.

So, what is this blog for?

Well my main target is to post here some of the problems I faced during my programming tasks, and their solutions or workarounds.

Also when I see new interesting programming stuff, I might post it here.

Secondly, I will use this blog as a website to post my stuff about my hobbies and activities on.

Hope you like this blog.

Wednesday 13 February 2008

Sudoku

Sudoku is a logic-based number placement puzzle. The objective is to fill a 9×9 grid so that each column, each row, and each of the nine 3×3 boxes contains the digits from 1 to 9, only one time each. The puzzle setter provides a partially completed grid.

Completed Sudoku puzzles are a type of latin square, with an additional constraint on the contents of individual regions. Leonhard Euler is sometimes incorrectly cited as the source of the puzzle, based on his work with Latin squares.

So Yesterday I decided to make a game of sudoku.

I programmed the game in Visual Studio .Net 2008 based on .net framework 3.5, language visual basic. I made 2 versions, one limited version where-in the player can play sudoku without 'hints' or 'auto-solver', and one version where 'the hints' and 'auto-solver' functions are available.



In the normal version of sudoku, like I already said there's a auto-solver in it.
To programm this I had to search for a good book of sudoku witch describes the different solving methods.

There are soliving methods on 3 different levels.
  • Basic Sudoku Solving Technique
  • Intermediate Techniques
  • Advanced Techniques
The Basic Sudoku Solving Technique describes the elimination technique and the CRME (colomn, row and minigrid elimination).

The Intermediate Technique describes the Lone Rangers method.

The Advanced Technique describes the twins and triplets methods and the brute force elimination.

Those 3 techniques are used to solve the sudoku puzzles at different levels.

Log4J

Logging provides a way to capture information about the operation of an application. Once captured, the information can be used for many purposes, but it is particularly useful for debugging, troubleshooting, and auditing. This article takes a look at logging in Java applications, presenting information on logging software, benefits, costs, and basic techniques.

There are many logging packages available for Java applications. Here are a few:

  • Java Logging API -- Part of Java 2 Standard Edition Version 1.4. The Java Logging API supports dynamic configuration, hierachical loggers, multiple logging levels, and multiple output formats (plain text and XML).

  • Log4j -- An open source logging framework from the Apache Jakarta project. Log4j supports dynamic configuration, hierarchical loggers, multiple logging levels, and multiple output formats (plain text, HTML, XML, Unix syslog, Windows NT Event Log, and others). It was designed and built with an emphasis on speed and has been ported to C, C++, C#, Ruby, and Eiffel

  • Java Logging Framework -- A simple logging framework from The Object Guy. Java Logging Framework supports multiple loggers, filters, message formatting, and multiple output devices.

  • We had to use Log4J in our webshop. It's not that difficult and you have lots of possibilities. You can work with a properties file to log your application to a .txt file (like most of us did) but you can also work with a .xml file (like I did :p).

    The advantage of working with a xml file is that you can split up the logs. For example there are logs for debug and for error. With the xml file you can write these logs in a seperate file.

    I searched a bit on the net and found out how to work with the xml file in a verry good tutorial.

    Log4J Tutorial

    Richfaces components

    While programming my project last year, we had to make a webshop in java, I found there are a lot of possibilities if you want to add some richfaces components to your website.

    So I searched for some good tutorials and also found these:

    Rss Jsf Component

    The goal is to easily show rss content in JSF pages. Using RSS4JSF, you just need put the RSS4JSF.jar and the only need jar (rsslib4j-0.2.jar) in you WEB-INF/lib.

    Below this you can see an example of the code used in a jsp page.



    RSS4JSF

    GWT and IE: operation aborted

    I got an "operation aborted" error in Internet Explorer 7, which rendered half of the page and then showed an empty page. Needless to say that everything worked perfectly in Firefox.

    Even stranger was that I finally managed to fix it, but when I added Google Adsense banners, I got the error again!

    After some googling and frustrating (un)commenting of blocks of code, I finally moved all javascript imports (GWT and Google Analytics) to the end of the page (just before the closing body tag). And - woohoo!- everything works!

    Thanks to this overview of the problem!

    Firefox add-ons

    In the series "which Firefox add-ons do you need as a web developer", here's my list:
    - Firebug
    - Web developer toolbar
    - Download statusbar