C-ba.org

Java and php expert

  • Home
  • Jabber Twitter Bridge

New Version of Wordpress

posted by cba in March 30th, 2008 
in Software   Tags: plugin, update, wordpress

Say hello to the new Wordpress 2.5.

I am happy with this new version. The new admin interfaces is pretty. I did not find all the repairs which I got in the previous version. The update was easy to done and all my plugins was compatible so I had got no problem for updating.

And the most important it is possible to update plugin by on click ! And this is very useful…

  • Technorati
  • del.icio.us
  • Digg
  • Facebook
  • description
  • YahooMyWeb
  • Google

No Comment

Why Swing is not so developer friendly ?

posted by cba in March 19th, 2008 
in developping, java   Tags: dev, HTML, java, swing

pref.jpgI don’t know why but I need at least 4 or 5 hour just for creating a simple Form. I don’t know if I am using wrong tools but it is a little… embarassing to need so many time for making interface.

According me, It coul be link to Swing’s philosophy. I think now language must be more like HTML like. It is enought simple to make interface as fast as the wind, and got enought options to be more configurable.

Perhaps making html interface for application is a better idea ? I don’t know but I need to find a way to be better in interface development because next form would be complicated.

So the good news, it is that now user car change Social Bridge’s preferences with a form and save it….

Next step would be to allow user to create new treatment….

  • Technorati
  • del.icio.us
  • Digg
  • Facebook
  • description
  • YahooMyWeb
  • Google

3 Comments

How to manage messages in Java

posted by cba in March 16th, 2008 
in developping, java   Tags: dev, java, properties, tips

Here a small code example to manage messages into java application. This mono instance class allow you to load messages according language. You could also replace token into messages with dynamical argument.

You can find java class at the end of this post.

This class does not contain a lot of code. The next instruction allow to load messages according language :

msg = ResourceBundle.getBundle("message", new Locale(ApplicationPreference.getLanguage(),"") );

This allow to load message.properties from the classpath. If language is “fr” then the file which is going to be loaded is “message_fr.properties”. But if file doesn’t exist so application would try to load the properties according default language defined for Java (then.. it is the one by default). And if the fileis not find again the file message.properties is loaded (f not find again then an exception is raised).
Then deux function allow you to get message from key. To manage messages with token, the class use MessageFormat. Here the code :

return MessageFormat.format(getInstance().msg.getString(key),arguments);

The argument called “arguments” is an object list.

How does it work ? Then it is very simple. Imagine this messages into the properties file :

msg1=My name is {1} and not {2}

If I called the function with a list with John and Tom, I will got this message :

My name is John and not Tom

Here is the example end, Have a nice day….

package com.cba.socialBridge.util.application;
 
import java.text.MessageFormat;
import java.util.Locale;
import java.util.ResourceBundle;
 
public class ApplicationMessage
{
        static protected ApplicationMessage instance=null;
        static public String[] languageList     = { "Français", "English" };
        static public String[] languageListCode = { "fr", "en" };
        protected ResourceBundle msg;
 
        private ApplicationMessage()
        {
                super();
                msg = ResourceBundle.getBundle("message", new Locale(ApplicationPreference.getLanguage(),"") );
        }
 
        public static int getIndexLanguageInLanguageList()
        {
                int index=-1;
                for (int i=0 ; index==-1 && i
                {
                        if ( languageListCode[i].equals(ApplicationPreference.getLanguage()) )
                        {
                                index = i;
                        }
                }
 
                return index;
        }
 
        protected static ApplicationMessage getInstance()
        {
                if ( instance==null )
                {
                        instance = new ApplicationMessage();
                }
 
                return instance;
        }
 
        public static String getMessage(String key)
        {
                String  result = "?" + key + "?";
 
                try
                {
                        result = getInstance().msg.getString(key);
                }
                catch(Exception e)
                {
                        ApplicationLogger.getLogger().error("There is a problem with messages management : " + e.getMessage() );
                }
 
                if ( result == null )
                 result = "?" + key + "?";
 
                return result;
        }
 
        public static String getMessage(String key,Object[] arguments)
        {
                String  result = "?" + key + "?";
 
                try
                {
                        result = MessageFormat.format(getInstance().msg.getString(key),
                                        arguments);
                }
                catch(Exception e)
                {
                        ApplicationLogger.getLogger().error("There is a problem with messages management : " + e.getMessage() );
                }
 
                if ( result == null )
                 result = "?" + key + "?";
 
                return result;
        }
}
  • Technorati
  • del.icio.us
  • Digg
  • Facebook
  • description
  • YahooMyWeb
  • Google

2 Comments

Newer Entries »

Subscribes to Rss Feeds

get latest updates on site news and site post

Jabber Twitter Bridge

Update Twitter with your google talk status

Tags

API calendar dev effect gimp google gtalk HTML idea internet java opinion plugin properties Software swing text tips tutorial twitter update video wordpress

Search

Categories

  • something to tell
  • developping
    • java
  • Software

Last Post

  • Gimp video tutorial : Electrify text effect
  • Gimp glow effect
  • JabberTwitterBridge 0.2 is out !
  • Gimp is cool
  • New Java API implementing CSS
  • Which future for Social Web?
  • Swing Tips : JDialog with special icon and in taskbar
  • Swing Tips : How to center a JDialog
  • A social updater
  • Jabber Twitter Bridge 0.1

Ads

Recent Comments

  • gimp tv » Gimp video tutorial : Electrify text effect
  • Gimp video tutorial : Electrify tex… » Gimp video tutorial : Electrify text effect
  • cba » JabberTwitterBridge 0.2 is out !
  • cba » New Java API implementing CSS
  • Valentin Jacquemin » JabberTwitterBridge 0.2 is out !
  • Valentin Jacquemin » New Java API implementing CSS
  • La folie Twitter : 101 liens sur Tw… » Jabber Twitter Bridge
  • cba » Why Swing is not so developer friendly ?
  • Donal » Why Swing is not so developer friendly ?
  • javaguy » Why Swing is not so developer friendly ?

Monthly Archives

  • June 2008
  • May 2008
  • April 2008
  • March 2008

Daily Archives

  • 15 June 2008
  • 9 June 2008
  • 1 June 2008
  • 13 May 2008
  • 8 May 2008
  • 17 April 2008
  • 16 April 2008
  • 8 April 2008
  • 6 April 2008
  • 30 March 2008
  • 19 March 2008
  • 16 March 2008

Links

  • My blog in french
  • Pollux World