Latex Eclipse plugin
13 Monday Apr 2009
Posted Developer
in13 Monday Apr 2009
Posted Developer
in06 Monday Apr 2009
Posted Developer
inJConsole
A graphical user interface monitoring tool for capturing information about performance, resource consumption of applications running on the Java platform.
.
Reference: http://java.sun.com/javase/6/docs/technotes/guides/management/jconsole.html
.
HOWTO: วิธีการตรวจสอบ memory leak ใน Java application
http://www.jhelp.net/article.aspx?id=10067
.
Determining Memory Usage in Java
http://www.javaspecialists.eu/archive/Issue029.html
05 Sunday Apr 2009
Posted Developer
inpublic static void saveOldWay(String ref, BufferedImage img) {
BufferedOutputStream out;
try {
out = new BufferedOutputStream(new FileOutputStream(ref));
JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
JPEGEncodeParam param = encoder.getDefaultJPEGEncodeParam(img);
int quality = 5;
quality = Math.max(0, Math.min(quality, 100));
param.setQuality((float) quality / 100.0f, false);
encoder.setJPEGEncodeParam(param);
encoder.encode(img);
out.close();
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* Saves a BufferedImage to the given file, pathname must not have any
* periods “.” in it except for the one before the format, i.e. C:/images/fooimage.png
* @param img
* @param saveFile
*/
public static void saveImage(BufferedImage img, String ref) {
try {
String format = (ref.endsWith(“.png”)) ? “png” : “jpg”;
ImageIO.write(img, format, new File(ref));
} catch (IOException e) {
e.printStackTrace();
}
}
Reference: http://www.javalobby.org/articles/ultimate-image/#5
04 Saturday Apr 2009
Posted Developer
in#!/usr/bin/perl
use LWP::UserAgent;
$url = “http://www.google.com”;
readURL($url);
sub readURL {
($url) = (@_);
$ua = LWP::UserAgent->new;
$ua->agent(“Mozilla/8.0”); # pretend we are very capable browser
$req = HTTP::Request->new(GET => $url);
$req->header(‘Accept’ => ‘text/html’);
$res = $ua->request($req); # send request
if ($res->is_success) { # check the outcome
print $res->content;
}
else {
print “Error: ” . $res->status_line . “\n”;
}
}