2008-12-04

Certificate expired when package AIR appication

Solution: Change your date and time formats on your computer to US format before create certificate file.

2008-11-20

Add datetime in MySQL

Example: plus datetime 31 days;
  • update table_name set datetime_field = ADDDATE(datetime_field, 31);
Example: minus datetime 31 days;
  • update table_name set datetime_field = ADDDATE(datetime_field, -31);

2008-11-04

Calculate DPI for Monitor

Use this formula.
dpi = sqrt(resolutionWidth ^ 2 + resolutionHeight ^ 2) / inches

2008-06-23

Add KeyListener On Swing JPanel

Use code like this

JFrame frame = new JFrame();
JPanel pnl = new JPanel();
pnl.addKeyListener(keyListener);
pnl.setFocusable(true);
frame.add(pnl);
frame.pack();
pnl.drawing.requestFocus();

2008-06-04

How to minimize and restore Java Swing JFrame

1. Minimize -> use this method frame.setState ( Frame.ICONIFIED );
2. Restore -> use this method frame.setState ( Frame.NORMAL );

frame is instance of JFrame

2008-05-20

Add KeyListener on Java Swing JFrame

Use a code like this

AbstractAction act = new AbstractAction() {
    public void actionPerformed(ActionEvent e) {
        //Action that you want to do.
    }
};
getRootPane().getActionMap().put("nameThatYouWant", act);
InputMap im = getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
// KeyEvent.VK_F10 or any key that you want.
im.put(KeyStroke.getKeyStroke(KeyEvent.VK_F10, 0), "nameThatYouWant");

2008-01-27

Install Flex Builder 2.0.1 on Vista

I'm try to install Flex Builder on Vista and found a problem that I don't know why this error happen after a few hours I find the solution at http://office.realeyesmedia.com/blogs/jun/?p=13 thank for that post it help me to solve problem.
How to:
1. Run cmd with admin.
2. Go to your home directory (c:\Users\yourname).
3. Run rmdir "My Documents".
4. Run mklink /d “My Documents” Pathtoyourdocument

2008-01-16

DISPLAY error matplotlib

When error occur about this "$DISPLAY not set" when you run python code that use matplotlib this happened because your matplotlib backend is set to FltkAgg, GTK, GTKAgg, GTKCairo, TkAgg , Wx or WxAgg they required a GUI that why error occur.

To solve this you must specific other backend that not required GUI (Agg, Cairo, PS, PDF or SVG) when use matplotlib like this
  • In code
 import matplotlib
matplotlib.use('Agg')
  • In command line use -d option
python subplot_demo.py -dAgg

Remember when call savefig('filename') don't give it extension this will handle by backend that you specific e.g Agg will create file filename.png

source from --> http://matplotlib.sourceforge.net/backends.html

2008-01-14

Change import file size for phpMyAdmin

Charge this two variable in php.ini file.
  • upload_max_filesize
  • post_max_size
post_max_size must greater or equal to upload_max_filesize.