Victor Ewert

Greenhorn
+ Follow
since May 28, 2009
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
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 Victor Ewert

I am just starting internationalization on a Java application, and am externalizing my Strings into property (resource bundle) files. My question is: what is better, to store all the Strings in one large property file (making it easier to edit, and maintain) or to have a property file for each GUI Widow/Dialog etc. My concern with one large file is that there may be a performance hit. Any advice?
10 years ago

Rob Prime wrote:

Victor Ewert wrote:I know this isn't a Mac/iPhone forum


iPhone
That's also where this thread is going.



Who'd of thunk there was a dedicated iPhone forum at Javaranch.
Thanks for fixing that up.
11 years ago
iOS
I know this isn't a Mac/iPhone forum but since half of my problem lies in the Java world, I figure I might try here. I'll also be posting on Mac forums.

What I am looking for, is a way to encrypt a file using Java code, and then be able to put the file onto an iPhone and decrypt it there. I would also like to go the opposite way, but I assume if I can go one way, the other should be trivial. The file will be xml, but I'm not sure if that matters. Which, if any, of the Java encyption algorithms/methods can/should I use, that would make a file that could be decrypted on an iPhone.

I am quite familiar with Java, and have worked with Java encryption before, but I am totally new to iPhone development, and am by no mean a security and encryption expert. Any pointers in the right direction would be appreciated.
11 years ago
iOS
Firstly, you have declared the variable read, as both an ArrayList object and an Array. From what the assignment says, you should be using ArrayList so just keep that one.

The assignment doesn't say how you are supposed to 'read' the Strings. Are they supposed to be input from the console, read from a file, or ???

Basically what you need to read in your Strings is



Then look at the Collections class to reverse the order

Next, to output the reversed Strings, a loop like the following should work:



Read up the Java API docs (http://java.sun.com/javase/6/docs/api/) on ArrayList, Iterator and Collections classes.

Hope this gets you started in the right direction.

Victor Ewert
Ewert Technologies
http://www.ewert-technologies.ca
11 years ago
One place to start is to add parameters to rechneFahrenheit() and have it return a value (I'm surprised it actually compiles)

For example:



and then in your main method you would call:




Also, just a comment, (and others might disagree), I normally would not have methods returning calls to other methods. I would create some local variables in the methods. Call some other methods as needed and then return one of the local variables as the result.


Hope this helps,

Victor Ewert
Ewert Technologies
http://www.ewert-technologies.ca
11 years ago
If you are simply trying to let the user know they must enter something into the TextField, then when you use getText(), check if the length of the returned String is > 0, and if it isn't then display a warning message to the user.
11 years ago
If I understand it correctly, serialization is taking an object (class instance) and persisting it to a file that can later be accessed. As the earlier posted said, it has nothing to do with sharing your .class files.
11 years ago
Interesting... I always thought getters and setters helped in encapsulation, since by using of getters and setters you can control when and how fields can be set or retrieved, i.e. validations can be done before a variable is set etc. I have never purposely tried, to not use them and actually use them without much thought. I guess I should look a little more critically at my code going forward.
11 years ago
I'm guessing you are using arrays to track the information, for each time a user adds another item. Part of the problem is, in lines 66 to 75, you keep creating new arrays to add things to which means you are losing the data from the previous iterations. I believe that is why, on line 89 you are only getting the last result.

I see what you are trying to do in lines 66 to 75 is re-adjust the size of the array, since at the beginning of the program you don't know how big the array should be. Instead of using arrays use the ArrayList class which is a List that expands as needed.

Hope that helps,
11 years ago
I have been looking into the problem of the calendar not working on Ubuntu.

I noticed that on Windows, when I put my mouse over the calendar a little warning triangle appears. When I mouse over the warning triangle, it says: "Java Applet Window".

I'm not sure what it exactly means, but my guess is, whatever is causing the warning to be displayed, is the same thing that is causing the calendar to disappear on Ubuntu.

Now I just need to figure out what the problem is.

Victor Ewert
11 years ago

Tobias Wallenborg wrote:I have a problem, when i click on the calander button it shows the calander but then when i try to move the mouse over it it disappears. I'm using Ubuntu 9.04 and Firefox 3.0.1.
Maybe just me be having this problem?



Hmm... I just tried it from my Ubuntu box and see the same problem . Seems to work fine with IE, Firefox, Opera and Safari on Windows.

I'll take a look and see if I can figure it out. As a work around, you can manually type in a date. The text will be red if you type in an invalid date and green if its good.

Thanks for the feedback. I'll post back when I figure out the problem.

11 years ago
I have created a timestamp converter applet that converts java timestamps (i.e. what you get from date.getTime()) and other UNIX type timestamps into human readable dates/times. You can also convert the other way around. It allows for the dates/times to be displayed in different date formats and time zones. It is basically a GUI wrapper for using the DateFormat class.

If you are interested, have a look at: http://www.ewert-technologies.ca/online_tools/timestamp_converter.html

I hope some people will find this applet useful,

Victor Ewert
Ewert Technologies
11 years ago
I have used Launch4j to wrap jar files into .exe files for windows, and have been pretty happy with it.

Victor Ewert
Ewert Technologies
11 years ago
I agree with Fred. What I usually do is try google, or try searching on a forum (like this one). I can usually find what Classes are involved in the solution, and then I use the Java API to get the details. Over time you get to know what the Java API can do for you and what it can't.

Victor Ewert
Ewert Technologies
11 years ago
Another thing I do with Lists and Iterator is append List to List objects and ListItr to the Iterator for the list.

e.g.




One of the main things is, that once you have got your convention, stick to it religiously. You'll be glad you did later on when looking back at you code, trying to debug some issue

Victor Ewert
Ewert Technologies
11 years ago