Richard Taylor

Author
+ Follow
since Jun 19, 2001
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Richard Taylor

There are a couple of reasons why Sun avoided access to the various parts of a device:
- security
- ease of defining an API suitable to the tens and tens of device manufacturers
I think what you'll see is improvements in two areas:
- new APIs will get defined once the initial release J2ME is out there on rela devices, and stable. Let's say in 6-12 months.
- device manufacturers will add their own device-specific libraries to give you access.
It will come, but don't forget, when plain old Java arrived in the mid-90s, it didn't have the rich API it has now, and it was still reasonably successful. I think J2ME will go the same way - its no miracle cure for mobile programming right now, but if Sun and other vendors (s/w & h/w) persevere, then it will become successful. But give it a year or two more, eh!
------------------
Richard Taylor
Author of Professional Java Mobile Programming
17 years ago

Originally posted by Christophe Lee:
How is Wrox's Professional Java Mobile Programming?
I've heard mixed reviews on it. (actually, there were only 3 reviews on amazon and one was bad. but the same reviewer gave Yu Feng's J2ME book full marks, so could just be sabotage?).


As one of the authors, I noticed that review. It was critical of the fact that there was no coverage of the MIDP for Palm. In fact, there is coverage, but only one page - the reason being that there's not a lot to say about MIDP for Palm! It works, just like any other MIDP implementation (bugs aside), so there didn't seem much point in laburing over it, other than a description of how to run a simple MIDP application.
(If anyone wants to see more than that, then do tell me! Maybe there's something obvious that I haven't seen...)
The other criticism was that it was too simple. This is partly valid, but when you're faced with a new technology, as J2ME is, you cannot afford to ignore basic introductions - that would be unacceptable. As for the complex stuff, I think there's some good stuff on JMS, hooking into servlets, RMI (and pseudo-RMI), security, synchronisation, and so on, so I fell the criticism was a little harsh.
As an aside, if you compare it to Wrox's Professional WAP book, I believe its pitched at the same level, with a mix of introductory and advanced chapters, and that got excellent reviews. Oh, well, you can't please everyone - but we try our best :-)
------------------
Richard Taylor
Author of Professional Java Mobile Programming
17 years ago
> dis = null;
> dis.close();
Don't you want those the other way round, maybe?
Closing a null won't do much...
------------------
Richard Taylor
Author of Professional Java Mobile Programming
17 years ago
If you want to create PNGs from a drawing, then use any decent graphics package, such as PaintShop Pro from JASC.
If you want to create a PNG programmatically, then youwant a PNG encoder. Look at: http://java.sun.com/products/java-media/jai/iio.html
Note that down the bottom of the page it suggests that things will change in JDK1.4, so beware...
------------------
Richard Taylor
Author of Professional Java Mobile Programming
17 years ago
You can't store objects as such, but you can store primitive Java types (int, long, char, etc), by using java.io.DataInputStream and java.io.DataOutputStream.
If you want to sotre more than 1 field in a record, then you will have to write your own encode and decode routines. A shame, but that's the way it goes. If you look at my book, you'll see a Record class, which is comprised of n Fields. It might be what you want (although, for the simplicity of the chapter I do assume all Fields are Strings...)
------------------
Richard Taylor
Author of Professional Java Mobile Programming
17 years ago
It because you requested a HTML document, which of course contains all the tags. It's up to you (or a third party piece of software) to interpret those tags, and decide how to display the HTML page...
There are J2ME HTML browsers (well, one at least) out there...
------------------
Richard Taylor
Author of Professional Java Mobile Programming
17 years ago
All the packages you need are in the file:
<J2ME toolkit install directory>\lib\midpapi.zip
If you unzip it you will find them all (but you shouldn't need to take this step to make stuff work - its interesting though).
Not sure why yours won't work, unless you changed any of the J2MEWTK config files.
------------------
Richard Taylor
Author of Professional Java Mobile Programming
17 years ago
Right now, I'm partial to the Motorola Accompli because its actually a pretty useful device even without the J2ME!
Its replaced my phone and PDA (although its far from perfect), which means I don't carry two devices.
Its got a good screen, its a sensible size (phone-sized) and the majority of the J2Me isn't too slow.
The Achilles Heel? Its very slow writing data away in J2ME. I've asked why, and its because it saves to flash RAM, but its still unacceptable for decent amounts of data, which is annoying, considering how good the rest of the device is. Oyu have to code defensively and do any saving in a background thread, which cause application re-work...
But still, it works.
------------------
Richard Taylor
Author of Professional Java Mobile Programming
17 years ago
Tell me a little more...
- which XML parser(s)?
- which version of the J2ME toolkit?
- a simple source example
------------------
Richard Taylor
Author of Professional Java Mobile Programming
17 years ago
Its entirely down to the specific device, and whether their Java implementation allows that access.
Certainly, J2ME specifications don't mandate this - how could they, when the devices range from tiny mobile phones up to full-blown PDAs. It doesn't know which devices have GPS, and which don't.
So, ask the device manufacturer what they intend supplying. And if they don't give GPS access, start nagging them to do so :-)
------------------
Richard Taylor
Author of Professional Java Mobile Programming
17 years ago

Originally posted by satish bora:
Welcome Richard on this Forum.
It has been said speedwise java is still slow compare to traditional languages like c, c++. How this matters to J2ME programming?
Rgds
Satish


Right now, it matters a lot, which is unfortunate. If you run the MIDP for Palm, its pretty slow. However, in the long term, just like in the PC world, the mobile device processing power will overtake the language requirements, and the performance will be a minor detail. I reckon that might take somewhere between 2 and 4 years, at a guess.
So, I think the advice must be code carefully now, but expect more power, and more libraries/RAM capability in the near future.
------------------
Richard Taylor
Author of Professional Java Mobile Programming
17 years ago

Originally posted by Johannes de Jong:
Thanks Richard. What is your area of specialization ?.


Back from my hols - apologies for the delay.
I specialize in the 'mobile internet', by which I mean gaining access (in both directions) to remote data from a mobile device. As simple as that. Right now that means a front end of WAP, possibly cHTML, and J2ME, coupled to a back-end of J2EE or some part (like servlets, JMS, and so on). I tend to stik with Java solutions because I don't have to re-invent the wheel, the libraries are usually pretty comprehensive, the tools run on most machines (PC, Linux), and finally I can usually test on Win98 and deploy to Linux without code changes.
I tend to do three things for money (actually, there's many things I'd do for lots of money - but that's another story...):
- consult/evangelize
- code
- project manage/team lead

------------------
Richard Taylor
Author of Professional Java Mobile Programming
17 years ago
Well done, folks.
I'm off for a long weekend in about an hour, but I'll call back next week, so until then, it will be silent on the Taylor front...
------------------
Richard Taylor
Author of Professional Java Mobile Programming
17 years ago
On the J2ME angle, of course, the best way of impressing a potential employer, ifyou're visiting, is to take your J2ME-enabled device along. It takes no space up, and (right now) wows the pants off them.
Even better if you have a server you can hook it up to, and demonstrate OTA and data loading.
Buying a J2ME device is probably cheaper than certification, but the server side is still quite expensive. However, there are some ISPs that will host your J2EE application for a smaller monthly fee...
------------------
Richard Taylor
Author of Professional Java Mobile Programming
17 years ago

Originally posted by sebastien GUERLET:
Thank you Balaji but what I need is not a httpconnection tutorial...
I search an efficient way to parse XML with kXML.
If I where in J2SE, I will use a BufferedReader... and there's none in J2ME...
I think reading the InputStream byte by byte is quite slow.
Any idea ???


InputStream does allow multiple byte reads, but then you have the problem of sometimes not knowing exactly how big you should make your array before doing the read(). If you're fetching data from a server, then setContentLength() in the server side servlet:
BufferedReader file = null;
try
{
file = new BufferedReader(new FileReader(DATABASE_DIRECTORY + filename + ".csv"));
StringBuffer wholeFile = new StringBuffer();
String line;
while ((line = file.readLine()) != null)
{
wholeFile.append(line + "\n");
}
int length=wholeFile.length();
response.setContentLength(length);
out.println(wholeFile.toString());
}
catch(IOException ioe)
{
System.out.println("MenuServlet.doGet() IOException");
ioe.printStackTrace();
}
if (file != null)
file.close();

and this in the J2ME:
boolean status = false;
ContentConnection c = null;
InputStream is = null;
try
{
byte[] data;
c = (ContentConnection)Connector.open(filename);
is = c.openInputStream();
int len = (int)c.getLength();
int actual = 0;
if (len > 0)
{
data = new byte[len];
actual = is.read(data);
}
else
{
StringBuffer sb = new StringBuffer();
int ch;
while ((ch = is.read()) != -1)
{
sb.append((char)ch);
actual++;
}
data = sb.toString().getBytes();
}
status = app.merge(data, actual);
if (is != null)
is.close();
if (c != null)
c.close();
}
catch (IOException ioe)
{
System.out.println("download: IOException");
ioe.printStackTrace();
}
I haven't actually tested to see if this loads quicker - for example there may be better ways to buffer in the servlet, and so on. I'd be interested in the answer.. (rct@poqit.com)
Cheers...
------------------
Richard Taylor
Author of Professional Java Mobile Programming
17 years ago