Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp

Muhammad Ali

Greenhorn
+ Follow
since Dec 04, 2000
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 Muhammad Ali

We did test our software on a network but all the machines were running Windows 98. However, nothing except Java and JINI were used for development. Thus, as far as the development point is concerned, theoretically our software did run on all sorts of machines. We didn't have enough facilities in our institute to use Sun Solaris, Linux or Gx machines.
First of all, make sure you have the complete and latest JINI Kit from the Sun site. Secondly, make sure of one more thing that you have the latest version of Java JDK (ie 1.3) and there are no mix ups of ver 1.2 and 1.3. One of the problems we faced was because I installed Netscape 6 (that came with JDK 1.3) on my machine over an existing JDK 1.2 and the DLLs / files got mixed up.
Another helpful hint is to install the JINI packages in c:\files. The default location that's discussed in examples / documentation. Its helpful because the SERVICES software uses this as default and you need not worry about setting this.
I am also assuming that all your machines have been assigned an IP address. If that's not the case, you need to do some more settings.
The minimum you need to run is RMID, HTTP and Reggie. Remember, RMID is a re-activatable service. This means that, once RMID is started and Reggie is started on top of it, RMID remembers this setting. Next time and onwards, when you run RMID, it automatically runs Reggie itself and no explicit mentioning is required. If you run reggie, you will get two copies of Reggi in the same RMID - something you didn't want. The state of RMID is saved in a "log" file and deleting that log folder makes things come back to normal. We didn't know this in the beginning and thus faced several instances of head ache.
Its better to start JINI from its GUI in the first try. Assuming that you are using c:\files, the following command is helpful:
java -cp c:\files\jini1_1\lib\jini-ext.jar;c:\files\jini1_1\lib\jini-examples.jar com.sun.jini.example.launcher.StartService
This is written in a single line as one command. Its better to save this in a bat file and run it. Hopefully, this will start the SERVICES gui. Now, click on File -> Open and browse to JINI1_1/ example/ launcher and select one of the properties file (according to your OS).
In the RUN panel, click on RMID and after some time on Web Server; you may need to change the prot of the webserver (the default one is 8081). Next from the Reggie tab, write the IP of the machine in Codebase where hostname is written. Go back to the Run panel and run reggie also.
If after some time you see no errors, go to LookupBrowser tab, and change the codebase machine name to your machine's IP. And from the Run panel click on LookupBrowser. If the app runs, then every thing is fine.
You will almost never have problem in running HTTP server. The problem is always with Reggie / RMID. Remember the RMID point that it automatically starts Reggie (if you successfully start Reggie once). So, if RMID doesn't start in future the problem might be with reggie.
Almost all the problems in the case of JINI are because of INCOMPATIBILITY of files (always try a reinstall) and a few of the are because of setting machine's IP address. A few problems arise because of incorrect execution policy. For my case, the default one worked but it didn't with Windows 2000. I don't know whether this is helpful or not. It depends on the amount of KHAWARI you have already done.
Some links that were very usable for us were: http://developer.java.sun.com/developer/products/jini/execpolicy.html http://www.enete.com/download/index.html#_nuggets_ (very very helpful)
Do tell me if some specific error messages are still there. Together we may find the solution.

Thanks.
Ali.
22 years ago
Reggie is quite difficult to work with. I am forwarding my response in another post.
22 years ago
A NullPointerException is thrown when you call a method / variable from a reference that doesn't point anywhere.
See the following example class. In the main() method, we create a reference and an object and then set it to null. The reference e doesn't point anywhere when the method show() is called. Thus, JVM generates a NullPointerException.

public class example {
public void show() {
}

public static void main (String args[]) {
example e = new example();
e = null;
e.show();
}
}
Muhammad Ali Shah
Karachi, Pakistan.
23 years ago
I may not be very correct at syntax, but the following pseudo example may help you.
Suppose you have an interface named IShape and your local class, Rectangle, implements this interface. Now your method can create an object of type Rectangle and return it as IShape object.
See this:
interface IShape {
public void draw();
}

class Test {
public IShape create () {
class Rectangle implements IShape {
public void draw () {
System.out.println ("I am draw of rectangle.");
}
}
return new Rectangle();
}
}
public class Main {
public static void main (String args[]) {
IShape i = new Test().create();
i.draw();
}
}
Hope this helps...
Shah.
That's the whole point of inheritance. When you extend another class you inherit ALL the members of the base class. The only ACCESSIBLE ones are those that are declared protected, public or default (if the dervied class is in the same package).
The methods appear as if they are defined in the dervied class.
Shah.
23 years ago
I am not sure and don't have time to try what I am suggesting, but here is what I think:
Where are you adding the panel to your applet? You should use this.add (panel) or something like that.
Muhammad Ali Shah
Karachi, Pakistan.
23 years ago
Aggregation is an object oriented concept that means "an object can contain other objects." For example, a room can be an aggregate of a floor, four walls and a ceiling. So we have four classes here: room, floor, wall, ceiling.
Aggregation is somewhat different from composition. In composition, we again have the "whole-part" concept, but the "part" object is assumed to "live" and "die" within the whole. It doesn't have any value of its own. For example, our teeth may be part of our body, but according to our design, they may not have any significance of their own.
Muhammad Ali Shah
Karachi, Pakistan.
23 years ago
BufferedReader reader = new BufferedReader(new InputStreamReader(new DataInputStream(new BufferedInputStream(p.getInputStream()))));
Why do we need so many classes / wrappers to read the input? Can someone explain the need for each of them (one by one)?
Thanks...
Muhammad Ali Shah
Karachi, Pakistan.
23 years ago
Hi,
I also feel very annoyed by so many JVMs. And then I decided to use "virtual desktop" software. You can get one from download.com. The concept is very simple: you get more than one desktop each one running its own windows / applications. I use on of these virtual desktops to run reggie and another to do the development stuff.
I am sure that such software exist for other OS too. Just my $0.02.
Muhammad Ali Shah
Karachi, Pakistan.
23 years ago
Thanks for the indepth review, Cindy. Yes, there exists the "broker" difference between RMI and CORBA.
Actually JINI is pure network plug and play. You don't need to know the address of the server before hand. The client can SEARCH for the server, just as you search for a keyphrase at a search engine. JINI works on top of other technologies like RMI (though using RMI is not necessary).
23 years ago
I think you are using two - with the jar keyword. Use -jar instead of --jar.
Muhammad Ali Shah
Karachi, Pakistan.
23 years ago
Hi,
First of all, I am not an expert on the subject but would like to share my views. DCOM, CORBA, RMI and JINI are some of the many ways of doing distributed computations.
In modern day client server systems, we usually want to have scalable systems in which there is a separate server / machine for each of the various operations. You have a web server machine; another machine to hold the database and still another one for backup, etc.
DCOM, CORBA and similar technologies help you to distribute the operations across multiple machines. They allow you to call methods of an "object" in one machine's memory from another machine.
Consider RMI, for example. You have an object of class StringBuffer in JVM running on machine X and a user of that object running in machine Y. With RMI you can call the append() method of the object from machine Y. DCOM is a MS (aka Windows) specific technique. While CORBA is language independent. Similarly, RMI and JINI are platform independent but Java specific techniques.
Muhammad Ali Shah
Karachi, Pakistan.
23 years ago
I am not an expert of the field. However, I faced the same situation and had to write an encoding function myself. It replaced all single or double quotation marks in a string with my own strings.
I mean you need a custom designed solution made by yourself. There is no other way out. Just my opinion.
Muhammad Ali Shah
Karachi.
I am not an expert of the field. However, I faced the same situation and had to write an encoding function myself. It replaced all single or double quotation marks in a string with my own strings.
I mean you need a custom designed solution made by yourself. There is no other way out. Just my opinion.
Muhammad Ali Shah
Karachi.
Actually, the random numbers that come up when you start your program cannot be different if you use THE SAME SEED NUMBER every time. All random number algorithms require a starting number to generate a non-repeating list of numbers. However, if you give the same seed number, the non-repeating list will be same for every execution of the program.
In practical programs we use the system date and time as the starting seed value. Since date and time will always be different when you run your program, each run of your program will get a different seed value and hence it will generate a different non-repeating list.
Muhammad Ali Shah
FAST Institute of Computer Science, Karachi.
23 years ago