Help coderanch get a
new server
by contributing to the fundraiser

Shawn Fitzgerald

author
+ Follow
since May 07, 2004
Merit badge: grant badges
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 Shawn Fitzgerald

Question: when is the random object returning in 1000's and not 10's? Is that on the nextInt(int n) method? The 'n' value is how many bits to support in the low order values. so for values under 100 you might have to go to 128, or things under 10 you may have to go to 16, and then skip values greater than the limit you are looking for.

in the case of nextDouble, you must be using a CLDC1.0 implementation. 'double' was not supported until CLDC1.1, before that you had no option to use double or float only int and long. How to find this out, look in java.lang.Double in the J2ME javadocs, and you will see a 'since' tag that states when the component was introduced. The primatives were not introduced before the wrapper classes so checking the wrapper dates will tell you when the primative type was introduced or if it is available.

You might just need to turn on in the WTK the CLDC1.1 requirement and re-build your project.

Hope that helps.
=Shawn
18 years ago
You could look at information on the Sharp Zaurus. It uses the JBed Personal Profile (action PJava, which is similar).
Also you might want to look at the IBM website for J9 PersonalProfile. They may have some information.

-Shawn
18 years ago
Well I don't know about NetBeans, but in the WTK you would need to select in the settings that the project was to include the WMA APIs.
Messaging is not part of the standard MIDP2.0 specification, but is part of the JTWI specification. So you might also want to make that a requirement of the project.

Also don't forget to add permissions for calls to the WMA services, such as SMS. That would be an issue at runtime and would not get in your way for the compiling of your project.

Hope that helps.
-Shawn
18 years ago
Well it depends on a few factors. When you say time to send, what are you sending (SMS, HTTP, byte[]), how are you sending (openInputStream(), send(), ..), and how you have your data configured (byte[], object(), TextMessage())

Seeing a code snippets would be helpful.

If it's for SMS messaging, most likely you are not coding your destination or setting the open handle correctly.

Also you should put your question into a separate thread so other can find your question too. We have a few folks on the J2ME forum that have a lot of knowledge with SMS, and they may not find your question here in my thread.

Regards,
-Shawn
18 years ago
Well answered my own question.
While IBM states that the J9 VM is MIDP2.0 complient this is not 100%
true. There is no HTTPS support in the VM.
This is clearly in contrast to the MIDP2 spec which says supported
connection types must include HTTP/HTTPS, and SSL.


However the wonderful folks at www.MicroDoc.de seem to have fixed this,
or at least seem to be able to included some support for it.


I will post more when I hear back on the details.

-Sfitz
18 years ago
Salman,

Got some bad news for you.

You can't send the objects because the serializable interface is not supported on J2ME MIDP1 or MIDP2 spec. The only way you could send the data is via a byte[] or some other primitive type.

Since you said the K700i doesn't support the jsr-75 file system access APIs, then you can't get to anything but your midlets datastore (RMS). MIDlets are only allowed to access their data or data that is shared from another midlet, or provided through an external library call (such as jsr-75 provides for)

So point #3 is a non-issue because you can't get to the data to send it out to the port.

This is where most people take issue with J2ME, there are a lot of rules that you are not allowed to break. Where as with J2SE you can break just about any rule give a little time and a few libraries or JNI calls.
No such luck with J2ME, it's designed to be secure, and never give permissions to do much without permission from the service provided and the user.

Wish the info was better. Can you use a different phone? I know there are some that support that feature of reading from the filesystem. But you will still need to transfer the data in a binary form and not as an object.

Regards,
-Shawn
18 years ago
DeSilva is right, but let me expand on that idea.
Use SUN's WTK to build your application. Most all new phones have the MIDP2.0 spec so I would focus on this standard, and not try and support MIDP1.0

Make sure your app adjusts it's screen presentation to the phones. This will require taking into consideration that the range of standard phone screen sizes range from 96x96 pixels to 240x320 pixels.

Making network aware apps on the phone is not easy, especially when there are firewalls, and Single-Sign-On (SSO) features to many sites. As long as you can use a standard HTTP or Socket connection to the server you will do okay.

One word of warning, most cellular service providers are jerks, in that they don't want to provide much, if any, help to developers (that would cost them money), and they don't think their locked down systems are an impedence to development. So if you can't do it yourself, and you don't find help on forums like this one, then you most likely aren't going to get it to work.

Also just because a phone maker (nokia, motorola, sony-ericsson) say thier phone supports JSR-xyz, doesn't mean that the cellular service provider will allow that support to be functional on the device.

And finally, if you have to sign your jarfile, you will need to get a verisign Root CA signed cert. This goes for the web SSL cert that is needed for HTTPS connections. However I am having an issue with the IBM j9 vm supporting even that. So beware, and YMMV.

Best Wishes,
-Shawn
18 years ago
No, WML bad!
For a midlet you read in the HTML, and there is an image tag
<img src="http://www.domain.com/image.jpg">
So your midlet needs to read the InputStream from your http connection, parse the tag, get the image source URL, open an InputStream to the image data then load that into an image object using Image.createImage(<inputstream> ;

Then you can display the image object in an imageItem UI component.

regards,
-Shawn
18 years ago
Well here is one of those times when being old helps. I don't need any fancy math to tell you 56kbit transfer rate is not fast enough to send multiple 10kB images per second. I remember having a 56k modem, and there was no way to have a decent size image 5-10kB download in less than a 1-2 seconds.
So really compression is the only way but there again you have to factor in the time to produce a diff on the server (desktop) side, and the time to translate the diff into the main image buffer on the client side (phone).
In theory as long as your diff of images were small between frames (which most likely will be the case) and the image size were not overly large you should be able to do it. One side note, how many colors do you support? 16, 256, 64k? The lower your color bit count the smaller your image. So if you can take the hit on color you might see about lower that to reduce your image size. get it below 5kB, and you might be able to get 1.5 images (before compression) and if your diffs are less than 1-2kB, then you could get 2 maybe 3 effective screen frames per second (negating processing time to do the diff).

Regards,
-Shawn
18 years ago
You said there was a USB dongle? How is that involved? I mean if you are taking a screen shot and then tranmitting it view UDP over the cellular network where does USB come in?

So back to the more important question, time latency. The network connection over cellular, (GPRS) is not going to give you great response time. The promise of 3G is a little lacking. So you can take the network transmission speed that the marketing materials says, and divide it in half.

So a 144k 3G line really only gives you about 56k. And there are other features of GPRS, EDGE, CDMA, or IDEN that impact data transmission. So if you can compress, or better yet only transfer the diff of the previous image and the current image, that might help. However I would ever 5 or 10 frames update the whole page since you are using UDP. Also don't forget to put a counter so that you know if the frames get out of order.

In order of performance (lowest to highest bandwidth) you can assume:
Worst:
- IDen
- CDMA
- GPRS ~= RRTx1
- EDGE
Best:

Regards,
-Shawn
18 years ago
Almost, it uses the first character that doesn't match.

So if you compare "france" with "frank", you compare 'c' to 'k'
and the difference is -8.

c d e f g h i j k
0 1 2 3 4 5 6 7 8

while comparing "sam" and "san" compares 'm' to 'n' and would
return a -1.

m n o
0 1 2

Does that give you a better picture?
-Shawn
18 years ago
To do this you will need to create an array buffer to copy the RGB int[] values from the original image altering the value orders to cause the desired effect. Then create another image object using that RGB int[] to initialize with.

It is very manual, however you might also be able to use the Graphics object to help with some of this process. I would google for an algorithm to cause the swirl effect, and then see how that can be used to work with int[].

Regards,
-Shawn
18 years ago
Let me see if I understand the environment.
You have a cameraphone (nokia 6600), and you have a USB dongle that connects this phone to your desktop computer. Then you have an application (j2me) on the phone that pulls a picture, and sends it to the desktop computer.

So I am wondering what is the protocol you are using on the wire? (tcp,udp?)
what protocol are you using to transfer the information? (ftp, homegrown)
Is this a socket connection to the Desktop running some software?
Do you close the socket and reconnect each time you send a picture?

That may provide the clues needed to determine your issues, and then how to resolve them.

Regards
-Shawn
18 years ago
The compareTo method is used for sorting. The return values are -1, 0, 1, to denote the order that the String the method is called on in relationship to the provided parameter String.

Thus:
String a = "a";
String b = "b";
System.out.println("a.compareTo(b)="+a.compareTo(b));
System.out.println("b.compareTo(a)="+b.compareTo(a));

output would be:
a.compareTo(b)=-1
b.compareTo(a)=1

However it should be noted that the spec only says in the first case the value is less than 0, and in the second case is greater than 0. So you should expect values like -5 or if 'b' in the above example was 'c' the values would be -2 and 2.

regards,
-Shawn
18 years ago
Hey gang,

I have some code that needs to operate using a HTTPS URL, and the
connector.open(<url> works, as does the getSecurityInfo(), reporting
the Certificate information.
However when I do either a https.openInputStream() or
https.openDataInputStream() I am getting an IOException, and
getMessage() returns 'null'.


This same code works on a blackberry and on NexTel phones, but no joy
on PockePC. Obviously the difference in these devices are the VMs, and
Certs keystores. Keystore has the needed root CA cert on J9.


Opening IO stream is done within a thread as well.


Has anyone got HTTPS connections to work? Any small sample code or
instructions that might help?
Oh ya, someother BIG items I should mention. The device is on a
network that uses DHCP, a Web Proxy internet connections, and is
authenticated using Kerberos. (So not too many obsticles...not)


TIA
-Shawn
18 years ago