MS Access to SQLite Converter

Last week, i had to finish a simple code. So, i have a mdb access file. And, it must convert to sqite file. I found a code on google. Regenerate it, then i used it. I want to share how to use it.


I use these method to use it,
> first of all, i downloaded sqlite plugin of netbeans from http://plugins.netbeans.org/PluginPortal/
> secondly, installed into netbeans.
> used it as plugins.

> also, mdb-sqlite libs should be inserted as library into librarymanager.

 
Then, project properties like this.

Finally, be careful to compile project. Because, it gives mainclassnot found exception error. You choice your main class before compiling process.


If you run project,

D:\MdbSqlite\dist>java -jar "MdbSqlite.jar" test.mdb test.db


j2me BouncyBall


















package com.boball.demo;

import java.util.Random;
import java.util.Vector;
import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Font;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
import javax.microedition.midlet.*;
/**
 * @see J2ME & Threading Task
 */
public class BounceBall extends MIDlet implements CommandListener {
    /**
     * First of all, we create a display and command objects.
     * @see Display display, Command Exit
     */
    private Display theDisplay;
    private final static Command _cExit = new Command("Exit", Command.EXIT, 1);
    private final static Command _cClear = new Command("Clear", Command.SCREEN, 1);
    /**
     * Then, we will create a class to move ball on canvas
     * @see BounceCanvas class.
     */
    private BounceCanvas canvas;
    public BounceBall() {
        theDisplay = Display.getDisplay(this);
        canvas = new BounceCanvas();
        canvas.addCommand(_cExit);
        canvas.addCommand(_cClear);
        canvas.setCommandListener(this);
    }

    protected void destroyApp(boolean unconditional) {
        canvas.erase();
    }

    protected void pauseApp() {
    }

    protected void startApp() {
        theDisplay.setCurrent(canvas);
    }

    public void commandAction(Command c, Displayable d) {
        try {
            if (c == _cClear) {
                canvas.erase();
            } else if (c == _cExit) {
                destroyApp(false);
                notifyDestroyed();
            }
        } catch (Exception e) {
            debugStr(e);
        }
    }

    public void debugStr(Exception ex) {
        System.out.println("Error: " + ex.toString());
    }

    class BounceCanvas extends Canvas{
        private Random numberGen = new Random();
        public Vector balls = new Vector();

        class Ball extends Thread {
            // current & former positions:
            private int xc, yc, oldxc, oldyc;
            // x & y speeds:
            private int dx = 3, dy = 3;
            // halting machinery:
            private boolean halt = false;

            public void stop() {
                halt = true;
            }

            public Ball() {
                try {
                    xc = Math.abs(numberGen.nextInt()) % getWidth();
                    yc = Math.abs(numberGen.nextInt()) % getHeight();
                } catch (Exception e) {
                    debugStr(e);
                }
            }

            private void move() {
                oldxc = xc;
                oldyc = yc;
                xc += dx;
                yc += dy;
                if (xc <= 0 || getWidth() <= xc) {
                    dx = -dx;
                }
                if (yc <= 0 || getHeight() <= yc) {
                    dy = -dy;
                }
            }

            public void run() {
                while (!halt) {
                    move();
                    repaint(oldxc - 5, oldyc - 5, 10, 10);
                    // sleep for 10 msecs to be cooperative:
                    try {
                        Thread.sleep(10);
                    } catch (InterruptedException e) {
                        debugStr(e);
                    }
                }
            }

            public void paint(Graphics g) {
                try {
                    Image image = Image.createImage("/images/miniapple.jpg");
                    g.setColor(0xffffff);
                    // hata var //g.fillRect(xc, yc, getWidth(), getHeight());
                    g.drawImage(image, xc, yc, Graphics.HCENTER | Graphics.VCENTER);
                } catch (Exception ex) {
                    debugStr(ex);
                }
            }
        }

        public void erase() {
            try {
                for (int i = 0; i < balls.size(); i++) {
                    Ball b = (Ball) balls.elementAt(i);
                    b.stop();
                }
                balls.removeAllElements();
                repaint();
            } catch (Exception e) {
                debugStr(e);
            }
        }

        public void paint(Graphics g) {
            try {
                /* drawind text part*/
                g.setColor(0x00ffffff);
                g.fillRect(0, 0, getWidth(), getHeight());
                int w = getWidth();
                int h = getHeight();
                g.setColor(0xffffff);
                g.fillRect(0, 0, w, h);
                g.setColor(0x000000);
                Font mFont = Font.getFont(Font.FACE_PROPORTIONAL, Font.STYLE_PLAIN, Font.SIZE_LARGE);
                String s = "Please Push The 5 to Start";
                int stringWidth = mFont.stringWidth(s);
                int stringHeight = mFont.getHeight();
                int x = (w - stringWidth) / 2;
                int y = h / 2;
                Image image = Image.createImage("/images/bigapple.jpg");
                g.drawImage(image, getWidth() / 2, getHeight() / 2, Graphics.HCENTER | Graphics.VCENTER);
                /* drawind image part*/
                g.setFont(mFont);
                g.drawString(s, x, y, Graphics.TOP | Graphics.LEFT);
                g.drawRect(x, y, stringWidth, stringHeight);

                for (int i = 0; i < balls.size(); i++) {
                    Ball next = (Ball) balls.elementAt(i);
                    next.paint(g);
                }
            } catch (Exception e) {
                debugStr(e);
            }
        }

        public void keyPressed(int keyCode) {
            try {
                if (keyCode == Canvas.KEY_NUM5) {
                    Ball b = new Ball();
                    balls.addElement(b);
                    b.start();
                }
            } catch (Exception e) {
                debugStr(e);
            }
        }
    }
}

{ OpenCV } Image Processing

 
OpenCV is released under a BSD license, it is free for both academic and commercial use. The library has >500 optimized algorithms (see figure below). It is used around the world, has >2M downloads and >40K people in the user group. Uses range from interactive art, to mine inspection, stitching maps on the web on through advanced robotics.

For details,
http://sourceforge.net/projects/opencv/
OpenCv wikipage,
http://opencv.willowgarage.com/wiki/FullOpenCVWiki
In Java
http://code.google.com/p/javacv/
In Python
http://www.cs.unc.edu/~gb/blog/2007/02/04/python-opencv-wrapper-using-ctypes/
http://www.beechtreetech.com/opencv-exercises-in-python
In C C++
http://www.cs.iit.edu/~agam/cs512/lect-notes/opencv-intro/index.html
http://opencv.willowgarage.com/wiki/FaceDetection
http://nashruddin.com/opencv-examples-for-operation-on-images.html

{ MongoDb } with Windows 7 + Java


Before using MongoDB, you must install MongoDB driver for your operations systems. Such as,
Windows 32-bit (install) Windows 64-bit(install)

You save installed files into "c:\mongodb" then run this command in cmd.
(Note: You must create logs and data directory into c:\mongodb)

C:\mongodb\bin>mongod --bind_ip 127.0.0.1 --logpath c:\mongodb\logs --dbpath c:\mongodb\data --directoryperdb  -port 1001 --install
 
Also, to start MongoDB you should run "net start MongoDB" in cmd.

So, you look at the services, 

If you will be success, you should open the http://127.0.0.1:1001/ webpage for looking database database structure.
(Note: if you want to remove the service, you should write into cmd "mongod -remove")
Sample java application (install)