Friday, May 24, 2013

how to export file from WorkBench

the format is CVS file

SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS


========SQL語法=====column number

SELECT COUNT(*)
FROM INFORMATION_SCHEMA.COLUMNS
WHERE table_schema = 'Workbook222'
  AND table_name = 'KDB_Excel3333';

========SQL語法===== row number
select count(*) from KDB_Excel3333;


Verfication: check log:
[24/05/2013 05:49:17.162][INFO]--+++main_002.1 debug---------------
[24/05/2013 05:49:17.162][INFO]--sql_get_rows:SELECT count(*) FROM KDB_Excel3333
[24/05/2013 05:49:17.162][INFO]--cols:27
[24/05/2013 05:49:17.162][INFO]--sql_get_rows:SELECT count(*) FROM KDB_Excel3333
[24/05/2013 05:49:17.162][INFO]--rows:353

how to test the database is exist or not (Try to create new DB, if DB is not here)


#Problem

java.sql.SQLException: Syntax error or access violation message from server: "Unknown database 'Workbook222'"

Fix:
Add "IF NOT EXISTS" to fix it.
CREATE DATABASE IF NOT EXISTS dbname;

"Duplicate entry '47' for key 'PRIMARY'"



#Problem:

(id,col_1,col_2,col_3,col_4,col_5,col_6,col_7,col_8,col_9,col_10,col_11,col_12,col_13,col_14,col_15,col_16,col_17,col_18,col_19,col_20,col_21,col_22,col_23,col_24,col_25,col_26,col_27,col_28,col_29,col_30,col_31,col_32,col_33,col_34,col_35,col_36,col_37,col_38,col_39,col_40,col_41,col_42,col_43) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
java.sql.SQLException: Duplicate key or integrity constraint violation message from server: "Duplicate entry '47' for key 'PRIMARY'"

#Problem:
how to increse PRIMARY automatically


CREATE TABLE Persons
(
P_Id int NOT NULL AUTO_INCREMENT,
LastName varchar(255) NOT NULL,
FirstName varchar(255),
Address varchar(255),
City varchar(255),
PRIMARY KEY (P_Id)
)


採用之後久可以了!
http://www.w3schools.com/sql/sql_autoincrement.asp



java.sql.SQLException: Before start of result set


Sqlite似乎沒有此問題 直接用result 是可以的
但是Porting到mysql  之後就一定要先run一下result.next()
花了一兩個小時才解了此問題~希望對大家有幫助!

#Problem:
java.sql.SQLException: Before start of result set


#Ans:
http://tutorials.jenkov.com/jdbc/resultset.html


Here is an example of iterating a ResultSet using the next() method:
while(result.next()) {
    // ... get column values from this record
}
As you can see, the next() method is actually called before the first record is accessed. That means, that the ResultSet starts out pointing before the first record. Once next() has been called once, it points at the first record.


mysql 中文亂碼



#
http://avrilnote.pixnet.net/blog/post/4652705-mysql%E4%B8%AD%E6%96%87%E4%BA%82%E7%A2%BC%E7%9A%84%E5%8E%9F%E5%9B%A0


#how to restart mysql?
$sudo service mysql restart

# now it works.

Thursday, May 23, 2013

MySQL + ubuntu


http://dev.mysql.com/downloads/gui-tools/5.0.html

@MySQL WorkBench



@

数据库MySQL5.5大幅提升性能





@MySQL Connector/J is the official JDBC driver for MySQL.

document:

how to setup proxy: squid3


#1簡單的
http://spyker729.blogspot.tw/2011/01/ubuntusquid-proxy-server.html

#鳥哥
http://linux.vbird.org/linux_server/0420squid.php

result: it works~

Share A to B to access the internet.



http://www.mobile01.com/topicdetail.php?f=165&t=2165494&p=1


#IPtables:
#在linux用iptables應該可以做得到。


第五章、 Linux 常用網路指令
http://linux.vbird.org/linux_server/0140networkcommand.php



[root@www ~]# route add default gw 192.168.1.250
# 增加預設路由的方法!請注意,只要有一個預設路由就夠了喔!
# 同樣的,那個 192.168.1.250 的 IP 也需要能與你的 LAN 溝通才行!
# 在這個地方如果你隨便設定後,記得使用底下的指令重新設定你的網路
# /etc/init.d/network restart

customer ICON on Google map


#Problem:


Copy from :



Why does my app throw an exception in Map.addOverlay() when adding a Marker to the map with a custom Icon?

The JavaScript API isn't very clear about this, but when using a custom icon you need to be careful to set the icon size and anchor point. Also, when using a custom icon that isn't shaped like the default marker, the shadow may look funny, so its best to plan on replacing that as well.
    Icon icon = Icon.newInstance("http://www.example.com/foo.png");
    icon.setShadowURL("http://www.example.com/foo-shadow.png");
    icon.setIconSize(Size.newInstance(12, 20));
    icon.setShadowSize(Size.newInstance(22, 20));
    icon.setIconAnchor(Point.newInstance(6, 20));
    icon.setInfoWindowAnchor(Point.newInstance(5, 1));
    map.addOverlay(new Marker(LatLng.newInstance(lat,lng), options));


Problem: GIF animated onn google map?



http://localhost:8080/examples/servlets/images/execute.gif

Folder: location
/usr/local/apache-tomcat-7.0.39/webapps/examples/servlets/images

Answer:
/usr/local/apache-tomcat-7.0.39/webapps/ROOT

marks.setIconUrl(m_image_name);

Wednesday, May 22, 2013

Thunderbird Parser Email software




http://thunderbird1.software.informer.com/download-thunderbird-parser-email/

大小寫有差

code and the filename:

result:

setIconUrl("tomcat.png")

source code:

BasicMarker marks = new BasicMarker(m_id_of_mapclick.longValue(), new Point2D.Double(clickPos.getX(),clickPos.getY()),
"MapClick:id:"+m_id_of_mapclick+"(x,y)="+x+":"+y);

m_id_of_mapclick++;


marks.setIconUrl("tomcat.png");

googleMap.addMarker(marks);


KD.info("IconUrl="+marks.getIconUrl());





Circle @ Google map API 2

在Google map上畫圈圈 @Google Map API2

Result:


How to... (refer to this link)