Wednesday, August 30, 2006

add package on solaris 8

su root
pkgrm [package name]
pkgadd -d [path to pacakge]

Friday, August 18, 2006

Unsupported major.minor version 48.0

Problem:
Unsupported major.minor version 48.0

solution:
what you are running was compiled on 1.4 and you are running 1.3 or older

Wednesday, August 16, 2006

Cannot use javahl nor command line svn client

Problem:
svnant gives this error when i try to run the example that comes with it, or anything else
Cannot use javahl nor command line svn client

Solution:
the javahl dll file needs to be on your PATH to be able to load. svntask uses a System.loadLibrary() to load this dll, so modify your PATH variable and add the dir of where that dll is at. If you get subclipse for subversion then you can find javahl in the plugins dir, i think.

You can check what your path is by doing:
System.out.println(System.getProperty("java.library.path"));
after you change your path, you may need to reboot because windows is stupid.

Tuesday, August 08, 2006

how to annoy people using UNIX

first, do
$who
mk pts/3 Aug 8 15:07 (**********.com)
to find out who is around to annoy.
then do
$yes FATAL SYSTEM ERROR. SHUTTING DOWN | write mk pts/3

this will print FATAL SYSTEM ERROR. SHUTTING DOWN all over their terminal until you press ctrl-c

Wednesday, July 12, 2006

Problem: MANIFEST.MF missing class-path inside JAR

Problem:
MANIFEST.MF missing class-path: inside JAR.

Solution:
Put a blank like at the end of the manifest file.

Wednesday, July 05, 2006

How to terminate process by name in UNIX

kill -9 `ps -ef | grep process_name | grep -v grep | awk '{print $2}'`

Note that the grep process_name should be the command that you ran. Also note that the commands after 'kill -9' are enclosed in backtiks.

Monday, July 03, 2006

Sam's Spinach Salad



sfultong: spinach, a bunch
sfultong: slivered almonds
sfultong: garlic
sfultong: oil, salt, pepper
sfultong: mince about 2 cloves of garlic for a pound of spinach
sfultong: oh, and balsamic vinegar
sfultong: and then put the minced garlic in oil, heat on medium for about a minute, or whenever the garlic starts flavoring the oil
sfultong: at the same time, toast the almonds
sfultong: usually I just put them naked in another pan, and put them on low/medium heat
sfultong: make sure not to burn them
sfultong: and... then throw both the almonds and the garlic oil on top of the spinach
sfultong: add salt, pepper, and a bit of balsamic vinegar
sfultong: probably about half as much balsamic vinegar as oil you use for garlicing

Thursday, June 01, 2006

How to portscan with nnmap

nmap -P0 -p0-65535 127.0.0.1

-P0 == dont try to ping
-p == port range (note that its 0-65535)

obligatory man page posting:

Nmap 3.81 Usage: nmap [Scan Type(s)] [Options]
Some Common Scan Types ('*' options require root privileges)
* -sS TCP SYN stealth port scan (default if privileged (root))
-sT TCP connect() port scan (default for unprivileged users)
* -sU UDP port scan
-sP ping scan (Find any reachable machines)
* -sF,-sX,-sN Stealth FIN, Xmas, or Null scan (experts only)
-sV Version scan probes open ports determining service & app names/versions
-sR RPC scan (use with other scan types)
Some Common Options (none are required, most can be combined):
* -O Use TCP/IP fingerprinting to guess remote operating system
-p ports to scan. Example range: 1-1024,1080,6666,31337
-F Only scans ports listed in nmap-services
-v Verbose. Its use is recommended. Use twice for greater effect.
-P0 Don't ping hosts (needed to scan www.microsoft.com and others)
* -Ddecoy_host1,decoy2[,...] Hide scan using many decoys
-6 scans via IPv6 rather than IPv4
-T General timing policy
-n/-R Never do DNS resolution/Always resolve [default: sometimes resolve]
-oN/-oX/-oG Output normal/XML/grepable scan logs to
-iL Get targets from file; Use '-' for stdin
* -S /-e Specify source address or network interface
--interactive Go into interactive mode (then press h for help)
Example: nmap -v -sS -O www.my.com 192.168.0.0/16 '192.88-90.*.*'

Monday, May 22, 2006

Neural Network based Checker AI Link

I wrote a much more detailed description of the neural network checker AI project that i worked on, it can be found here:

Clicky Click me!

Sunday, May 21, 2006

JApplet not painting on init

my crapplet has internal JPanels, and it was not repainting on load, only when the window was resized.

solution:

add this:

Wednesday, May 10, 2006

JOptionPane Madness

String options[] = new String[]{"yes","no"};
int n = JOptionPane.showOptionDialog(frame,
"Would you like green eggs and ham?",
"A Silly Question",
JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE,
null, //don't use a custom Icon
options, //the titles of buttons
options[0]); //default button title

Tuesday, May 09, 2006

some basic C command line crap

cc -o yourprog yourprog.c -I/path/to/header -L/path/to/libs

: the -o is the output file
: ie, the thing you want to run
: -c is object file
: if you did cc -c 1.c -c 2.c -c 3.c
: you'd have 1.o, 2.o, 3.o
: then you could cc -o foo 1.o 2.o 3.o
: and it would link foo from the object code

: btw
: if you use lowercase Ls
: -l math -l crypt -l thislib -l thatlib
: you can link in additionally libraries as needed

how to update ports on freebsd

cvsup -gL2 -hcvsup11.freebsd.org /usr/share/examples/cvsup/ports-supfile

Friday, March 10, 2006

WindowCloser code

i use this all the time:


this.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
dispose();
}
});

Friday, February 10, 2006

BufferedImage needs Display under Unix

problem:

java.lang.InternalError: Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable.

solution:

set java.awt.headless=true
System.setProperty("java.awt.headless","true");

unless your system needs a gui, then, you need to google.

Thursday, February 09, 2006

A cool function

I wish i saw this when i had to do java homework, it would have helped.
to bad i never had to since reverse any numbers.

Wednesday, February 08, 2006

RMI on UNIX problems

so now that i have my server running on Freebsd, there is a slew of related problems:

i got this on the client:

RMI connection refused problem solved.
java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested exception is:
java.net.ConnectException: Connection refused: connect

when i was connecting to the bsd server which isnt localhost by the way, the error seems to stem from the way i have my hosts file setup on bsd, and a quick solution is to include the following code when launching the server:

-Djava.rmi.server.hostname=YOUR_SERVERS_IP

that fixes everything.

another problem im getting now has to do with BufferedImage. apperantly BufferedImage requires a screen to draw its image on. and i dont have one, when i shell into the system. i get this error:

java.lang.InternalError: Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable.

Solution will be presented when i find it.

RMI is pretty evil

new problems and their solutions:

any time you get an exception having to do with marshaling and you know that you have not changed any of your stubs, then its a codebase error! to fix:

System.setProperty("java.rmi.server.codebase","http://website.com/codebase/");
into that directory you can put your stubs, tho there is a little catch there. you have to put them in like this
http://website.com/codebase/package1/subpackage/Class_Impl_Stub.class
if the fully qualified name ofr Class_Impl_Stub is package1.subpackage.Class_Impl_Stub

people on the interweb say that using an http address is less troublesome then trying to use a file:// url

also, put your policy file into the same directory as your main jar file.

here is a good command line example of how i start my server:
>rmiregistry&
>java -Djava.rmi.server.hostname=134.88.14.133 -Djava.rmi.server.codebase=http://website.com/mk/codebase/ -Djava.security.policy=./policy.all -jar server.jar

note that server.jar contains a manifest file that points to all the libs it needs.

your client app should also have this codebase declaired obviously.

Thursday, January 12, 2006

Serializing a Stream


We start by declaring _actualDocument to be transient. transient is a Java keyword that
tells the serialization mechanism not to serialize the variable's value out. We then implement
writeObject( ), which does two things:

· Calls out.defaultWriteObject( ). This invokes the generic serialization
mechanism (which is the default) to write out all nontransient objects. That is, when
out.defaultWriteObject( ) is called, everything but _actualDocument has been
encoded in the stream.

· Copies _actualDocument to the stream, exactly as we did for the socket-based version
of the program.
Similarly, in readObject( ), we first call defaultReadObject( ), which retrieves all the
nontransient values, including _length, from the stream. We then read _actualDocument
from the stream.

RMI Headaches part 2

Well some things have been figured out since yesterday they are:

- rmic takes package arguments as: rmic the.package.it.is.in.ClassName (so '.'s not '/')
- RMI treats classes that implements Serialazable as objects that are passed by value, so if you pass one of those objects to a server, dont expect local changes (i think?)
- RMI treas classes that extend Remote as objects to be passed by ref
- There is an Oreilly book on Java RMI that is good.