Thursday, October 19, 2006

handy eclipse template: class quick init

public ${enclosing_type}() {
${cursor}
}
public static void main(String[] args){
new ${enclosing_type}();
}

Wednesday, September 13, 2006

how to update ports on freebsd (better way)

first get cvsup_fastest

then make a script

#!/bin/sh
cvsup -gL2 -h`cvsup_fastest -Q -c us` /usr/share/examples/cvsup/ports-supfile



cron this or whatever

Tuesday, September 12, 2006

unix shell scripting: args check

usage()
{
echo "Usage: program [args] [bleee]"
}
if [ $# -eq 0 ] ; then
echo "ERROR Insufficient arguments"
usage
exit 1
fi

Monday, September 11, 2006

send email on solaris 8 with xmail

/bin/mailx -s "subject" email@address.com < /path/to/message/body.txt

the message body has to be a file.

Wednesday, August 30, 2006

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.