programming

...now browsing by tag

 
 

Android Chess Clock 1.0-b5 released

Thursday, February 18th, 2010

Today I released minor upgrade of Android Chess Clock. Major features implemented:

  • “Click” sound when players swapped
  • Application should be available also for devices like HTC Tattoo (explicit declaration of small screen support in AndroidManifest.xml)
  • Minor redesign of about screen
  • Updated Android Market text.
Share

Android Chess Clock 1.0-b4 released…

Monday, February 15th, 2010

I’m happy to announce that next release of Android Chess Clock was released today. For me it is important release as this is first one that I tested on my own Android Phone. There are many new features.

Screenshots of new features

image image image
Selection of calculation
methods
Bronstein time control
configuration
New Icon

Full new features & bug fixes list

  • Bug fixes
    • Fixed issue with incorrect reset when coming back from Configuration screen via Cancel button
  • New features
    • New icon
    • Added new time control calculation methods:
      • Simple Delay
      • Fischer
      • Bronstein
    • Added button allowing bug report

Coming soon

  • Hourglass method
  • Support for Go & Scrabble time control approaches
Share

Android Chess Clock 1.0-b3 released today

Saturday, February 6th, 2010

I have released next version of Android Chess Clock. Major change is refactoring of calculation engine to support multiple calculation strategies in future. Although this change is not visible for user today it is investment for future.

Screenshots

acc-main acc-main-l

Major changes in this release

  • slight screen design graphic improvement
  • added different layout for landscape screens
  • when any player runs out of time application allows one click reset of time to start next game quickly
  • added feedback button to About screen
  • various small code improvements

Coming soon

  • additional time control algorithms
Share

Android Chess Clock 1.0-b1 released…

Saturday, January 30th, 2010

I’m happy to inform you that first beta version of Android Chess Clock was released to Android Market, filed under category Games/Brain and Puzzle.

Application is currently fairly simple (as you can see on screenshot) but works:

acc-main acc-config

Main features

  • supports Android 1.5+
  • players alternate by taping anywhere on the screen
  • supports small QVGA screens as well as HVGA
  • gently graphics without CPU (and energy) consuming animations
  • independent setting of time for every player

Application was tested on T-Mobile G1 (thanks to Honza) and Google Nexus One (thanks to Vindra) as I don’t have currently real Android device.

Known bugs & user requests

  • bugs
    • application resets countdown when you change orientation of screen from landscape to portrait
  • nice to have
    • missing icon
    • application does not run in full screen mode
    • time can be set only as hours and minutes but not seconds
    • sound when player runs out of time

Please write your feedback bellow the article.

Share

Netbeans performance problem: JPanel form is much slower if running inside RCP

Wednesday, August 5th, 2009

Last week I was fighting with very strange performance issue. We have quite complicated JPanel form and I was doing some performance opmtimization. I thought that it is now OK, but when then same form was executed as component inside NetBeans Rich Client Platform, it was horribly slow.

Click to continue »

Share

How to submit Bugzilla bug using XML/RPC and pure Java

Thursday, July 16th, 2009

Our project uses Bugzilla for tracking issues. I was looking for solution how to submit occured exception programatically. I found quite simple solution using Groovy and I have adapted it to pure Java.

Here is the source code:

import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.httpclient.HttpClient;
import org.apache.xmlrpc.XmlRpcException;
import org.apache.xmlrpc.client.XmlRpcClient;
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
import org.apache.xmlrpc.client.XmlRpcCommonsTransportFactory;

public class Main {
   public static void main(String s[])
      throws MalformedURLException, XmlRpcException {

        HttpClient httpClient = new HttpClient();
        XmlRpcClient rpcClient = new XmlRpcClient();
        XmlRpcCommonsTransportFactory factory = new XmlRpcCommonsTransportFactory(rpcClient);
        XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();

        factory.setHttpClient(httpClient);
        rpcClient.setTransportFactory(factory);
        config.setServerURL(new URL("http://bugzilla.example.com/xmlrpc.cgi"));
        rpcClient.setConfig(config);

        // map of the login data
        Map loginMap = new HashMap();
        loginMap.put("login", "tomas.hubalek@....");
        loginMap.put("password", "*top*secret*");
        loginMap.put("rememberlogin", "Bugzilla_remember");

        // login to bugzilla
        Object loginResult = rpcClient.execute("User.login", new Object[]{loginMap});
        System.err.println ("loginResult=" + loginResult);

        // map of the bug data
        Map bugMap = new HashMap();

        bugMap.put("product", "Playground");
        bugMap.put("component", "Database");
        bugMap.put("summary", "Bug created from groovy script");
        bugMap.put("description", "This is text including stacktrace");
        bugMap.put("version", "unspecified");
        bugMap.put("op_sys", "Linux");
        bugMap.put("platform", "PC");
        bugMap.put("priority", "P2");
        bugMap.put("severity", "Normal");
        bugMap.put("status", "NEW");

        // create bug
        Object createResult = rpcClient.execute("Bug.create", new Object[]{bugMap});
        System.err.println("createResult = " + createResult);
     }
 }

Usage of Apache XML RPC Client is quite straightforward, only gotcha is that mapped parameters must be set passed as new Object[]{bugMap}. Otherwise you get ClassCastException.

Share

How to extract list of packages from JAR file

Wednesday, July 15th, 2009

I’m currently working on some project using NetBeans Platform. This project need to have list of public packages from the jar in configuration file. So I write this quite simple code to do it manually

unzip -vb commons-beanutils-1.8.0.jar \
      | grep 00000 | cut -c 59- | grep -v META-INF \
      | tr / . \
      | awk '{print "<publicPackage>" $1 "*" "</publicPackage>"}'

A the result is

<publicPackage>org.*</publicPackage>
<publicPackage>org.apache.*</publicPackage>
<publicPackage>org.apache.commons.*</publicPackage>
<publicPackage>org.apache.commons.beanutils.*</publicPackage>
  ...
<publicPackage>org.apache.commons.collections.*</publicPackage>

I love unix text processing utilities…

Share

How to detect that my operating system is running under VMWare?

Thursday, November 13th, 2008

We had trouble with some server (it had strange variations of performance but load and other metrics was OK) and got suspicion that it is no real Linux box. To prove this theory I was looking for some trick how to detect whether it is running under VM Ware.

I found one kind of detection using CPU instructions but it required to compile some C/C++ code and I not skilled enough to do it. Then I found something easier.

I found that VM Ware has registered MAC addresses range that begins with 00:50:56. Then it was pretty easy:

ici-prom@mesdev:~/Com­monInterfaceDrsq> /sbin/ifconfig
eth0 Link encap:Ethernet HWaddr 00:50:56:94:77:49
inet addr:172.16.102­.134 Bcast:172­.16.102.255 Mas
inet6 addr: fe80::250:56f­f:fe94:7749/64 Scope:L
UP BROADCAST RUNNING MULTICAST MTU:1500 Metri
RX packets:50945267 errors:0 dropped:0 overruns
TX packets:60687615 errors:0 dropped:0 overruns
collisions:0 txqueuelen:1000
RX bytes:17384391194 (16.1 GiB) TX bytes:63720
Base address:0×1070 Memory:f4820000-f4840000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mas­k:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:766348 errors:0 dropped:0 overruns:0
TX packets:766348 errors:0 dropped:0 overruns:0
collisions:0 txqueuelen:0
RX bytes:88850050 (84.7 MiB) TX bytes:88850050

Share

hibernate.hbm2ddl.auto – What do values create, create-drop, update and validate mean?

Thursday, November 8th, 2007

I was looking into documentation for Hibernate for the meaning of these options. Unfortunately it is not written there.

I found explanation on Eyal Lupu’s blog:-)

Enjoy…

Share

Java: How to display incomplete stacktrace?

Thursday, September 13th, 2007

A few days ago we met some issue and there was huge stacktrace finishing with … 20 more.

We was disappointed that we cannot see real cause of the exception because we thought that Java is hiding most important exception details.

But in fact, there is nothing hidden, it is just misunderstanding of the stack trace.

Lets look at following java snippet:


01 public class Test {
02 
03    private static void a() {
04       try {
05          b();
06       catch (Exception e) {
07          throw new RuntimeException("Error occured in method a()", e);
08       }
09    }
10 
11    private static void b() {
12       try {
13          c();
14       catch (Exception e) {
15          throw new RuntimeException("Error occured in method b()", e);
16       }
17    }
18 
19    private static void c() {
20       throw new RuntimeException();
21    }
22 
23    public static void main(String a[]) throws Exception {
24      Test.a();
25    }
26 
27 }

Java2html

This code display following stack trace:

 Exception in thread "main" java.lang.RuntimeException: Error occured in method a()         at Test.a(Test.java:7)         at Test.main(Test.java:24) Caused by: java.lang.RuntimeException: Error occured in method b()         at Test.b(Test.java:15)         at Test.a(Test.java:5)         ... 1 more Caused by: java.lang.RuntimeException         at Test.c(Test.java:20)         at Test.b(Test.java:13)         ... 2 more 

and you can see complete stack trace although there is text .. 2 more and the real cause you can see at the top of the last exception.

For more info see description of the “bug” number 4775147 (Incomplete stack trace printed by Throwable.printStackTrace in JDK 1.4+) in Sun’s bug parade.

Share

Switch to our mobile site