When designing or coding a website, there is an easy method for including favicons next to the links. You cannot assume that a favicon is always at /favicon.ico of the URL, as there are different ways to specify which favicon a browser should display!

Read more…

Using Ruby On Rails and the find method with conditions, it is also to possible to use the LIKE statement of SQL without having to escape variables or using raw SQL:

Read more…

While YouTube has an API to get thumbnails of its videos, there is also the possibility to construct the URLs of the thumbnails out of the URL of the video.

Read more…

If you are getting the following exception on a migration on Darwin / OS X:

SQLite3::SQLException: near "ADD": syntax error: ALTER TABLE "xxx" ADD "yyy" varchar(255)

then you can try the following:

  1. sudo gem uninstall sqlite3-ruby
  2. Install the latest sqlite3 from sources from sqlite.org
  3. sudo gem install sqlite3-ruby

If you want to display your current Affilinet earnings in your Feedreader, you can use this PHP code:

<rss version=“2.0″>
<channel>
<title>Affilinet Kontostand</title>
<?
$qry_file = ‘http://publisher-webservices.affili.net/Publisher/Account.asmx/GetPublisherSummary?’
. ‘PublisherID=X’
. ‘&Password=X’;
$xml = simplexml_load_file($qry_file);
print “<item>”;
print “<title>Affilinet Kontostand: “ . $xml->CurrentMonth->Confirmed . ” EUR</title>”;
print “</item>”;
?>
</channel>
</rss>

Replace the Publisher ID and the Password in the URL. You can ask Affilinet for a Publisher Webservice Password in their webinterface in the account settings.

This code is based on code by Sascha Boege.

I have written a similar script for layer-ads.de earnings.

I’ve had an interesting problem with FileOutputChannel and RandomAccessFile from Java NIO.

If I understand the API correctly, it is enough to position(pos) on a FileOutputChannel and then use transferFrom

However transferFrom always returned 0. Then I used setLength on the RandomAccessFile where the FileOutputChannel was derived from and then it worked.

This was for Java 1.6 developer preview on OS X 10.4, maybe it is not even a Problem on other systems.

When playing around with the positions of Windows in Java, I have found a nice Java function: setLocationByPlatform of the Window class enables you to let your JVM choose the position of a new Window. This means that all windows won’t be placed at x=0 and y=0 but will be overlapped according to what your platform thinks is nice.

For p300, I am currently using a Selector to check if I can read from or write to a socket.

However, this has lead me to a weird problem: select is called for at most 30 seconds and I get a timeout for writing even though this can’t really be and only happens with some OS combinations. I’ve found this thread in the Sun Forums and adapted my internal logic to the information from this forum thread:

Instead of always selecting for OP_WRITE when I want to write, I just try to write. If I was not able to write everything (that is, buffer.remaining () is bigger than 0) I select for OP_WRITE.

This seems to work fine.

I sometimes get this error in the J2EE (or JEE) module settings in the project options when changing modules. The settings will not even show what modules are chosen.

Read more…

I think I have spent at least 5 hours to get a selectManyCheckbox working properly in JSF. I was getting validation errors and other trouble.

However I have found a great source of information. Also, on some other websites you can read that you should use an array instead of a List for the getter/setter of the backing bean.

Maybe this helps…