Java: How to use interface
ธันวาคม 15, 2009
interface GunInterface {
public void shot();
}
class Bomber implements GunInterface {
public void shot() {
System.out.println(“Bombbb !?”);
}
}
class Bazuka implements GunInterface {
public void shot() {
System.out.println(“Bazuka”);
}
}
public class RefreshInterface {
public RefreshInterface() {
Bomber bomb = new Bomber();
Bazuka bazu = new Bazuka();
GunInterface gun = bomb;
gun.shot();
gun = bazu;
gun.shot();
((GunInterface) bomb).shot();
((GunInterface) bazu).shot();
}
public static void main(String [] argv) {
new RefreshInterface();
}
}
Bangkok Planetarium
พฤศจิกายน 15, 2009












































Java String Format
ตุลาคม 30, 2009
Source code
float data = 123.456789f;
String s = String.format(“%.3f %s”,data,”%”);
Output
>>123.457 %
CSS Background StyleSheet
ตุลาคม 24, 2009
body { background:#39F; margin-top:40; text-align: center;}
h1,h2,h3 { margin:0; padding:0;}
div#content { background:#ffffff; -moz-border-radius: 30px; border-radius: 30px; width:65%; padding:50px; margin:0 auto; text-align: left; }
div#footer { width:100%; margin-top:5px; font: 8pt Tahoma, sans-serif; color:#069;}
h1 { font:bold 14pt Tahoma, Geneva, sans-serif; color:#F66 }
h2 { font:normal 8pt Tahoma, Geneva, sans-serif; color:#999; padding-top:50px;}
h3 { font:normal 8pt Tahoma, Geneva, sans-serif; color:#bbb; }
Perl script: Simple but Powerful
กันยายน 21, 2009
#!/usr/bin/perl
print “Simple Best techniques…\n”;
$daystr = “1 2 6 7 11 13 15 16″;
my @numbers = ($daystr =~ /(\d+)/g);
foreach $day (@numbers) {
print $day.”\n”;
}
หยิบของเก่ามาเล่าใหม่
สิงหาคม 20, 2009
Matlab Linear Solver
สิงหาคม 20, 2009
% Simplest Linear solver
% A*X = B
% y = mx+c <– linear formula
% y = 2x+4 <– Answer
A = [0 1;
1 1]
B = [4;
6]
X = linsolve(A,B)
%check result
(A*X==B)
%Reference
%http://www.mathworks.com/access/helpdesk/help/techdoc/ref/linsolve.html
SVN Plugin for Eclipse
สิงหาคม 16, 2009
Open Your Eclipse
-> Help -> Software Updates…
-> Add Site
Location : http://subclipse.tigris.org/update_1.4.x
-> Ok
-> Install

More information: http://subclipse.tigris.org/servlets/ProjectProcess?pageID=p4wYuA
Firefox Configuration
สิงหาคม 16, 2009
Type about:config in address bar and press enter button.

The warning will be appear.

Click “I’be careful, I promise!” and go to configuration page.


For example, If there are many tabs and you don’t want to close a firefox window when
you are closing them with ctrl+W. You can configuration your firefox like this.
1. Search with keyword : browser.tabs.closeWindowWithLastTab

2. double click on “browser.tabs.closeWindowWithLastTab” to switch from “true” to “false“.
After that, your firefox won’t be closed when you use Ctrl+W to close window by mistake anymore.
More information: http://kb.mozillazine.org/Firefox_:_FAQs_:_About:config_Entries
Latex Eclipse plugin
เมษายน 13, 2009
http://texlipse.sourceforge.net/



















