Steve Stanicki

Greenhorn
+ Follow
since Sep 24, 2005
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 Steve Stanicki

Thanks Bear,
I thought I was missing something. I want to focus on Java technologies, and I am interested in web programming. So naturally I want the latest as I am just starting out.

Regards,
Steve
12 years ago
I have noticed at Amazon and pretty much everywhere else, that most of the books on JSP/Servlets (excepting Head First), are at least 3,4 or maybe 5 years old. Why isn't anything else up to date?

Should we move on to PHP?

Steve
12 years ago
Hello All,
I am working on a project that will open Word Mail mail merge docs, and I need to open a specific file. I have a UI that let's the user choose a document with a button, and the action passes the path and file name to my class that I have written using Jacob.

I have import statements for com.jacob.activeX.ActiveXComponent;, and import com.jacob.com.*;

The problem is I have an example from www.land-of-kain.de/jacob/ for doing this with the following lines:

ActiveXComponent oWord = new ActiveXComponent("Word.Application");
oWord.setProperty("Visible", new Variant(true));
Object oDocuments = oWord.getProperty("Documents").toDispatch();
Object oDocument = Dispatch.call(oDocuments, "Open", myFileName);

The basic problem is, that I have an app working that opens MS Word, and inserts a line of text. (I used my file path/name to make sure it was getting there). But when I try to use the Dispatch class the compiler says it can't find the "class" call in Dispatch. I have also tried import statements like com.jacob.Dispatch.*; and com.jacob.Dispatch;

I have peeked inside the jacob jar file with winzip, and I can see the call method, and the nodes.

How do you get Jacob to point to a specific file? I am able to open Word with my app, and insert text, but I want to point to a specific file.

Any input would be appreciated.

Thanks,
Steve
12 years ago
BTW mypackagaes is a typo in my original post. It is mypackages in my source code.

But after all the 'extra' paths I had pointing to the D drive were edited out, my code works like the example in the book. (see above).

So I am led to believe that if you are creating packages in a particular path for a particular drive, and you create another package on that particular drive but in a different directory structure, those paths (the new directory structure) will be overriden at compile time by the classpath settings and wont work unless imported explicitly.

Am I understanding this clearly?

Thanks,
Steve
13 years ago
I had a bunch of extraeneous stuff in my classpath variable set for some directories on my D drive. I got rid of them. They were for some other experiments. I left my classpath pointing at some directories on C only (for MySQL JDBC connector) and it works now.

Because it worked when I named the package name explicitly (without wildcard), I'm assuming the compiler would only look in directories named in the classpath?

Example: If my Windows classpath variable = D:\DirectoryA\SubDirB and you have a package set up as D:\DirectoryA\SubDirZ\source.java; The classpath would override anything to look for classes(?)- that is onlu looking in D:\DirectoryA\SubDirB and ignoring anything else(?)

Steve

PS:Thanks for all of your responses. Your infinite patience is very appreciated.
13 years ago
Hello All,
I have a strange problem, and I don't understand why my code is behaving the way it does.

I have my directories as
D:\SCJP\CoreJava\PackageTest.java
and
D:\SCJP\CoreJava\com\mypackagaes\stuff\Employee.java

From the CoreJava directory I did
javac com\mypackages\stuff\Employee.java. It compiles okay.

From CoreJava, I am trying to compile PackageTest.java

The part that puzzles me is:
When I try to compile the PackageTest it errors out saying Employee is a bad class file. .\Employee.java does not contain Employee.

If I comment out the references to Employee in PackageTest, it compiles, so it seems my package statement is ok(?)

If I change the PackageTest.java file import statement from
import com.mypackages.stuff.*; to
import com.mypackages.stuff.Employee; everything runs cool. It compiles and runs as expected.

What am I missing? I thought it would pick up the Employee class with the asterisk, but I need to explicitly name it(!?).

Here are the sources

PackageTest.java:
-----------
import com.mypackages.stuff.*;
//The Employee class is defined in that package

import static java.lang.System.*;

public class PackageTest
{
public static void main(String[] args)
{
//Because of the import statement we don't have to
//use com.mypackages.stuff.Employee here
Employee harry = new Employee("Harry Hacker",50000,1989,10,1);

//Raise salary by 5%
harry.raiseSalary(5);

//Print out info about Harry
//use java.lang.System.out here
out.println("Name: " + harry.getName() + " " + "Salary: " + harry.getSalary());
}
}


Employee.java:
--------------
package com.mypackages.stuff;
//The classes in this file are part of this package

import java.util.*;

public class Employee
{
public Employee(String n, double s, int year, int month, int day)
{
name = n;
salary = s;
GregorianCalendar calendar = new GregorianCalendar(year, month -1, day);
//Gregorian calendar uses 0 for January
hireDate = calendar.getTime();
}

public String getName()
{
return name;
}

public double getSalary()
{
return salary;
}

public Date getHireDay()
{
return hireDate;
}

public void raiseSalary(double byPercent)
{
double raise = salary * byPercent / 100;
salary += raise;
}

private String name;
private double salary;
private Date hireDate;
}

PS: I am working out of Core Java 2 by Cay Horstman page 138.
13 years ago
1.5 because:

1. I'm a newbie.
2. It's a goal oriented, structured way to learn Java.

Using the K&B book, and have ordered Core Java Vol I Fundamentals, and
Vol II Advanced Features to help.

I have been thru the Head First book already.

Just started this week.

Steve
Hello Everyone,
Is there a way to mask a password at the command line (read non-GUI) as it is being typed by a user?

Something like setEchoChar() for a Text Field?

I am on a UNIX box, writing an app that will login to an Oracle Database.
No GUI available. (I have got the setEchoChar() to work on a GUI for my PC).

Can anyone tell me how this might be done?

Thanks,
Steve
13 years ago
Hello All,
I am new to Java, but I have been a mainframe procedural type programmer for the past 8 years. We are starting to look to a future using something other than our XGEN (Microfocus COBOL generator).

We are using Oracle 9i currently running on a Unix DEC Alpha Server. I work for a State agency that potentially needs to batch process millions of records over night (within a few hours, it's mission critical). Importing flat files from a vendor into our Oracle tables.

How is Java suited/not suited for this type of processing?

Any thoughts, comments or suggestions on the pros and cons of this would be greatly appreciated.

Thanks for your time,
Steve
13 years ago
Howdy,
I have been studying Java via Head First Java, and have learned alot. I have been wondering where to go next (besides looking for a Java job). I am a mid career COBOL programmer.

I am interested in programming web database apps, particularly in the LAMP arena, but JSP is high on my "TODO" list also.

Is this the fork in the road? Is JSP a whole 'nother animal when it comes to Java?

Any thoughts or comments appreciated.

Thanks,
Steve
13 years ago
JSP
If you would like to look at Thinking In Java, the author has put it online for free at:

http://www.mindview.net/Books/TIJ/

Good Luck,
Steve
13 years ago
Love the Book. I am finishing up chapter 14. OOP is much much more clear to me now. I found that using the book and comparing notes with a colleague (we are both procedural mainframe types) learning Java at community college, I am better at the concepts and she is way better with syntax (IMHO).

As for the puzzles, I never did the "pools" or mysteries, but I work out both "Be The Compiler" and magnets. I like the crosswords also.

Steve
13 years ago
Here is what I came up with and it seems to work.

import java.util.*;
import java.io.*;

public class QuizCard{
private String question;
private String answer;

public QuizCard(String q, String a){
answer = a;
question = q;
}

public String getAnswer(){
return answer;
}

public String getQuestion(){
return question;
}
}

The program works, and let's me generate flash cards, but it gives me some run time warnings about NullPointerException.

Thanks,
Steve
13 years ago
Thanks so much. I am on my way once more.

Steve
13 years ago
Hello All,
I am working thru Head First Java, and I got stuck on the Quiz Card app on page 451.

Specifically the QuizCard class is confusing me. I think I understand that it represents each Q & A as a card object, but I'm not sure how to write/use it.

Does it 'get' the questions and answers, and 'set' them for output to the text file? Are we supposed to concat them together for each line in the file or use it to parse out each Q & A?

I'm just not getting it at this point.

Very confusing to me.

I got this far in creating the class:

import java.util.*;
import java.io.*;

public class QuizCard{
public String question;
public String answer;

public QuizCard(q,a){

}

public void getQuestion(){

question = q;
return q;
}

public void getAnswer(){

answer = a;
return a;
}

Could someone help me with some direction please?

Thanks for your help (again),

Steve
13 years ago