Tag: tutorial
Java ME (J2ME) JSON Implementation For Array Object
by jimmy on Sep.13, 2011, under English, Java, Programming
One of the comment in JSON ME tutorial (http://jimmod.com/blog/2010/03/java-me-j2me-json-implementation-tutorialsample/) asking about how to parse this kind of JSON :
{\”api_status\”: \”OK\”,\”threads\”: [{\"tid\": \"2\",\"title\": \"First Title\" }, { \"tid\": \"4\", \"title\": \"this is 2nd Title\"}]} <a href="http://jimmod.com/blog/2011/09/java-me-j2me-json-implementation-for-array-object/#more-246" class="more-link">(continue reading...)</a>
Jimmy’s Blog – ISO 8583 Tutorial – Build and Parse ISO Message using JPOS library
by jimmy on Jul.26, 2011, under English, Java, Programming
ISO 8583 Tutorial article
In the beginning
OK after my article about ISO 8583 let’s go deeper into programming using Java + JPOS library.
Quote from JPOS website:
jPOS is a Java® platform-based, mission-critical, ISO-8583 based financial transaction library/framework that can be customized and extended in order to implement financial interchanges.
So first thing to do is download JPOS from it website.
Then we setup our development environment by creating Java Project using your favorites IDE. Add to the project all jar in JPOS library.
Here’s my Eclipse package explorer looks like.
(continue reading…)
Jimmy’s Blog – ISO 8583 Tutorial – Introduction for Beginners
by jimmy on Jul.25, 2011, under English, Programming, Technology
ISO 8583 Tutorial article
Introduction
Lately I’ve handle several financial project that allow me to understand bank and financial transaction better.
All (or most?) financial transaction is using ISO 8583 standard, which at first I thought is a complicated standard. But after learn and see how it implemented it’s not as complex as I thought.
In this post I will try to explain (based on my experience
before I go deeper on the programming side.
(continue reading…)
Basic LWUIT tutorial/sample with Eclipse Pulsar
by jimmy on Apr.17, 2010, under English, Java, Programming, Technology
I was really want to try LWUIT since several months ago. It’s look promising and it’s developed by SUN so I think every Java ME developer should take a look on this technology.
I’m also still new in LWUIT so there won’t be a lot that I can share for now, but at least I will show you a basic demonstration of how to use Form, Label, Command, and 3D Form transition (sound cool huh :p)
REQUIREMENT
What you need:
- LWUIT
- Eclipse Pulsa
- Emulator like Sun WTK
- Know basic Java ME programming
(continue reading…)
Java ME (J2ME) JSON Implementation Tutorial/Sample
by jimmy on Mar.03, 2010, under English, Java, Programming
JSON is one of the most popular format used for communicating between (Java ME) J2ME client and App Server. Strangely it’s hard to find JSON implementation sample in J2ME. So I decide to write a sample.
Simple Log4J implementation
by jimmy on Nov.15, 2007, under English, Java, Programming
Why do we need a library for logger? doesn’t System.out.println help us enough?
When you try log4j you wouldn’t use System.out.println ever again… (Ok.. you will still used it.. occasionally :p)
What do you need? of course you need to download log4j first
, get it at log4j download page
And open your favorite Java IDE.
import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;
/**
*
* @author jimmy
*/
public class SampleLog4j {private final static Logger LOGGER = Logger.getLogger(SampleLog4j.class);
public static void main(String[] args) {
PropertyConfigurator.configure(”log4j.properties”);
LOGGER.trace(”Level trace”);
LOGGER.debug(”Level debug”);
LOGGER.info(”Level info”);
LOGGER.warn(”Level warn”);
LOGGER.fatal(”Level fatal”);
}}
This program will read file log4j.properties in the folder for log4j configuration.
Example of log4j.properties:
### file appender
log4j.appender.file=org.apache.log4j.DailyRollingFileAppender
log4j.appender.file.File=sample.log
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{ISO8601} — %p %C(%M):%L — %m%n
### console appender
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=%d{ISO8601} — %p %C(%M):%L — %m%nlog4j.rootLogger=debug, console
# uncomment the line below if you want log output to file
# log4j.rootLogger=debug, file
And it’ll produce output:
2007-11-15 18:19:09,812 — DEBUG testing.SampleLog4j(main):26 — Level debug
2007-11-15 18:19:09,828 — INFO testing.SampleLog4j(main):27 — Level info
2007-11-15 18:19:09,828 — WARN testing.SampleLog4j(main):28 — Level warn
2007-11-15 18:19:09,828 — FATAL testing.SampleLog4j(main):29 — Level fatal
Why the log “Level trace” doesn’t logged, because we set the log level only to debug.
You should learn the configuration. There are 2 appender, 1 will log to console and other will log to a file.
Now why shouldn’t I used standard System.out.println?
- You can’t set the level of log with println only
- You will end up delete/comment the log using println
- It won’t be that easy to create log to file with different filename daily (daily-rolling)
- I wonder how your println can print class name, line number easily
- … you can add more after you try it