Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Emmy in the Key of Code this week in the General Computing forum!

achana chan

Ranch Hand
+ Follow
since Jul 29, 2002
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 achana chan

Can someone help?

I got several test results back.
The program runs find on W98, XP2, Linux (RedHat7.1), we get the correct dates. But when we run it on Solaris 2.6 / Java 1.1 the formater.format(rightNow) distorts the date.

This is the test result from a Solaris box:
$ java -classpath . Test3
1. The time is: Mon Nov 01 14:16:31 GMT+08:00 2004
2. The time is: Mon Nov 01 14:16:31 GMT+08:00 2004
3. The current time: 31-10-2004 22:16:31 PST
15 years ago
Hi, just when I think I understand how to format dates as strings.
Why is there a big difference between the date-time after formatting the date?
I'm running this on Solaris 6.
[code]
int ONE_HOUR = 1*1000*60*60;
SimpleTimeZone LocalTimeZone = new SimpleTimeZone(8*ONE_HOUR, "GMT+08:00");
TimeZone.setDefault(LocalTimeZone );

out.println("1. The time is: " + new Date()); // this displays the correct date time
while(someConditionIsTrue)
{
String sDate="";
Date rightNow = null;
SimpleDateFormat formatter=null;
formatter = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); // seems innocent enough...

rightNow = new Date(); // gives me the correct date-time
out.println("2. The time is: " + rightNow); //this works, shows correct local time

sDate = formatter.format(rightNow); // converting to string, this does not work, -15 hours difference
out.println("3. The current time: "+ sDate ); // bad date-time
[code]
I'm running this on Solaris 6
15 years ago
Hi, I've a rather perplexing situation.
My Java program has a loop which tests whether a file exists on Linux and if it does, then ftp the file back from Linux to WindowsXP(sp2).
The problem is, if the file does not exist on Linux, ft creates a zero length file on XP which is misleading to XP and must be deleted. However we cannot delete it because ftp seems to have locked the file.
Following is stub code for the loop:

And this is the code which ftps the GetOK test file back from Linux:

Here is the method for executing the ftp, the ftp commands are in a text file

Here is the ftp commands in the text file

This generates the runtime error:
java.io.IOExceptiob: Bad file descriptor
.....at java.io.FileInputStream.available(Native Method)
.....at UseFTP.GetOK(UseFTP.java:552)
.....at UseFTP.Initialize(UseFTP.java:127)
.....at UseFTP.<init>(UseFTP:30)
.....at GetFiles.main(GetFiles.java:32)

The odd thing is when I crash out of the program UseFTP with a CTRL-C, the proper OKFile is ftp-ed back from Linux, overwriting the dud, zero length, OKFile created by ftp.
Any help greatly appreciated.
15 years ago
I forgot to add:

We set the LD_CLASS_PATH to /opt/oracle/product/v734/jdbc/lib
15 years ago
Hi, I've used following Oracle connection on Ora8 and Ora9i and it has always worked for me:
myJavaProgram.java


But when I try to recompile the same code on Oracle 7.3.4 using an the command line class path

javac -verbose -classpath .:/opt/oracle/product/v473/jdbc/lib/classes111.zip:/path/to/other/java/stuff myJavaProgram.java

I get this compile time error message
[code]
myJavaProgram.java:206: class oracle.java.OracleDriver not found in type declaration
DriverManager.registerDriver(new Ooracle.jdbc.OracleDriver());
.............................................^
1 error
[code]

Using the verbose option, I found that javac expanded classes111.zip which included the DriverManager class.
What have I done wrong and how do I make it work?

THANKS !
15 years ago
Thanks, that works.
Also thanks for explaining the significnance of "$".
Whatdoes the "-c" do?
15 years ago
Error in command $myCPlusProg rawInputFile.in parsedOutputFile.out > aLogFile.log

java.lang.NullPointerException at deltrdlck.main(Compiled Code)

I was researching this and it seems that Runtime.exec() is rather limited and cannot do a unix redirect.
15 years ago
Why doesn't this C++ program execute in my code?
I've got an old C++ program (not from me) which takes 2 parameters: an ascii rawInputFile.in input file and parsedOutputFile.out which contains the cleansed data from the raw inputfile.
If I run the Solaris C++ program like this, it works:
Solaris#> $myCPlusProg rawInputFile.in parsedOutputFile.out > aLogFile.log
But if I embed it in Java as follows, throws following exception:
java.lang.NullPointerException at testdeltrdlck.main(Compiled code)

15 years ago
Please send all questions to
acinau@hotmail.com
Do not post CV to this email address, just a brief description with your return address suffices and our company will contact you. Please respect American Labour laws on this site.
Thanks for all the reponses.
15 years ago
Hi!
No agents please!
We are a small, Hong Kong based company and we have a number of contracts coming up. We have our own flagship product(s) which we are trying to sell, we also bid for contracts in cooperation with our major partners.

What we need:
* Coding Java applets and servlets in J2SDK or J2EE environment;
* Coding a2s communication and http-tunnelling;
* Coding a2s in a secure environment e.g. 128 bit encryption; tunnelling through proxies;
* Good working knowledge of JSP, SOAP, JNDI and use of .properties files;
* Multi-threaded applications and database connection pooling;
* Using JDBC to connect servlets to multiple databases;
* Code to functional specifications;
* Know yourself - if you say 1o working days effort for completing a task, including your own functional testing, let it be so;
* Working knowledge of Apache-Tomcat, Ora9i, networking over TCP/IP;

Desirable:
* SUN certification;
* Relevant experience;
* Sense of humour, patience and willingness to listen to clients (even if you think you have heard it all before);
* Native Cantonese/Putongwha speaker with good English skill highly regarded.

What's on Offer:
3 months contract, with possible 6 months extension;
If we survive this period and you are still interested in this kind of work and you see the possibilities, will consider profit sharing with the right people;
Some overseas travelling might be involved.
will consider sponsoring the right applicant, where possible.

Initially send expression of interest to acinau@hotmail.com and a brief description of your skillset and experience.
We will send you our company email address if we need you.
15 years ago
Thank-you for the over-whelming expressions of interests.
We have enough short term contractors in our database and until further notice we cannot accept anymore applicants.
Regulars who have done paid work for us will still be the preferred service providers. You will also have right of first refusal for long term contracts and permanent positions.
Applicants who have sent their resumee and received our response are already in the database. We will notify you if no regulars want to take up the contracts or positions.
Thanks again for the expressions of interests.
15 years ago
Please do not forget to post resumee.
Previous applicants need not apply again.
Please use our private email address rather than reply to this posting.
15 years ago
Hi. I've have still got a few small contracts available.
Prefer Sun certified programmers who have following experience:
* thread safe programming;
* applet fo servlet communications;
* experience in implementing control-model-view architecture
* experience in JDBC, JNDI and Oracle is highly desirable.
We have had good experience with CDAC (Pune) graduates doing small contracts for us, you are encourage to apply.
We can pay in USD. N.B. for developers from India, we prefer to pay with "demand draft" from "State Bank of India".
15 years ago
Hi I need to get something the next few days:
Requirement
===========
Model.java contains a subclass of a Hashtable paramTable with a listener.
View.java needs to write to the Hashtable in Model.java
When the listener senses that the content of paramTable has changed, then print it on java console.
Stub codes available to work on, they compile correctly but has runtime errors.
If interested, please send quote and directions for payment to
achana@saysit.com.hk
15 years ago