要如何得知你使用的db2版本,每次問,不會被回說去找cd的包裝,就是問不到答案。
本想google一下,卻意外發現手動用command line的方式去連db,上面就有顯示了。
db2 => connect to yourdb
Database Connection Information
Database server = DB2/LINUX 9.7.6
SQL authorization ID = yourdb
Local database alias = yourdb
db2 =>
Database Server那行後面 9.7.6 就是db2 version
另也可以透過下面的SQL語法來取得db2 version,但是用此sql語法前,得先連上db,否則會出現錯誤。
db2 => select * from SYSIBM.SYSVERSIONS
VERSIONNUMBER VERSION_TIMESTAMP AUTHID VERSIONBUILDLEVEL
------------- -------------------------- -------- ------------------------------
9070600 2013-02-21-16.21.51.489830 DB2INST1 s120516
1 record(s) selected.
VERSIONNUMBER 即db2 version.
未連上db時,會得到的錯誤訊息
db2 => select * from SYSIBM.SYSVERSIONS
SQL1024N A database connection does not exist. SQLSTATE=08003
db2 =>

mark528 發表在 痞客邦 留言(0) 人氣()



2in1的千陽號官方版
製作過程:

mark528 發表在 痞客邦 留言(0) 人氣()



千陽號官方版
圖紙:原11張,這次做成2in1
製作過程:
這裡很容易彎掉,需要補強

mark528 發表在 痞客邦 留言(0) 人氣()



千陽號官方版
圖紙:原11張,這次做成2in1
製作過程:

mark528 發表在 痞客邦 留言(0) 人氣()



千陽號官方版
圖紙:原11張,這次做成2in1
製作過程:
感覺頭部蠻簡化的

mark528 發表在 痞客邦 留言(1) 人氣()



千陽號官方版
圖紙:原11張,這次做成2in1
船身製作過程:
有些地方黏貼邊要注意一下,很容易弄反

mark528 發表在 痞客邦 留言(0) 人氣()



千陽號官方版
圖紙:原本11張,這次做 2in1
船尾製作過程:

mark528 發表在 痞客邦 留言(0) 人氣()

How to get current date with format YYYYMMSS in DB2??
To get the current date, time, and timestamp using SQL in DB2, reference to use below sql statment
db2 => select current date from sysibm.sysdummy1
1
----------
08/29/2013
1 record(s) selected.
db2 => select current time from sysibm.sysdummy1
1
--------
16:59:01
1 record(s) selected.
db2 => select current timestamp from sysibm.sysdummy1
1
--------------------------
2013-08-29-16.37.35.960388
1 record(s) selected.
How to custom date/time formatting?
The easy way to do this is use VARCHAR_FORMATscalar function
db2 => select varchar_format(current timestamp, 'YYYYMMDD') from sysibm.sysdummy1
1
-----------------------------------
20130829
1 record(s) selected.

mark528 發表在 痞客邦 留言(0) 人氣()

問題:
使用org.apache.commons.validator.GenericValidator.matchRegexp,發生下列錯誤
Exception in thread "main" java.lang.NoClassDefFoundError:
org.apache.oro.text.perl.Perl5Util
at org.apache.commons.validator.GenericValidator.matchRegexp(GenericValidator.java:65)
at com.fesc.bot.batch.BatchJob.downloadFiles(Unknown Source)
at com.fesc.bot.batch.FD903C.exec(Unknown Source)
at com.fesc.bot.batch.FD903C.main(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.apache.oro.text.perl.Perl5Util
at java.net.URLClassLoader.findClass(URLClassLoader.java:434)
at java.lang.ClassLoader.loadClassHelper(ClassLoader.java:665)
at java.lang.ClassLoader.loadClass(ClassLoader.java:644)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:358)
at java.lang.ClassLoader.loadClass(ClassLoader.java:627)
... 4 more
解決:
由錯誤訊息判斷應該缺少oro project的jar
連到ORO official site,卻發現As of 2010-09-01, the ORO project is retired.
改到common-validator official site,下載最新版本的jar,重新執行程式測試,確認錯誤不會發生。

mark528 發表在 痞客邦 留言(0) 人氣()

The deployment procedures below are for using Websphere 8.5
1. In a browser, go to https://ip:port/ibm/console/login.jsp to open Administrative Console. Enter your administrative credentials to log into the system.
2. Expand the 'Application' node in the console and click the 'Install New application' link.
3. Chose the 'New Enterprise Application' link.
4. Chose the 'Local file system' radio button and click the 'Browser' button to locate the war file. click 'Next' button.
5. Chose the 'Fast Path - Prompt only when additional information is required' radio button and click 'Next' button.
6. In this section(Step 1). You can enter the installation options for your application. You can change 'Application name' and accept the default settings. click 'Next' button.
7. In this section(Step 2). you can specify target servers for clustering. you can accept the default settings here and click 'Next' button.
8. In this section(Step 3). you can specify the virtual hosts where you application will be installed to. accept the default host and click 'Next' button.
9. In this section(Step 4). you must change Context Root, Don't use '/'(already in use). if use it, when start application will get a error message like this: 'Failed to load webapp: Context root /* mapping unable to be bound'. So input you context root and click 'Next' button.
10. Review the summary of settings and click 'Finish' button.
11. When the preparation process is complete, click the 'save' link to save the application to the master configuration.
12. Expand the 'Application Type' node in the console and click the 'Websphere enterprise application' link.
13. In the Enterprise Application page, your application will appear in the list with a x symbol next to it, since has not yet been started. check the box next to application name and click the 'start' button.
You can verify you deployment by browsing to http://ip:port/<context_root_of_your_application>

mark528 發表在 痞客邦 留言(0) 人氣()

java 用來分割字串的方法,就我所知道有StringTokenizer和String.split。為了知道哪種效能比較好,寫了個小程式測了一下。
import java.lang.StringBuilder;
import java.lang.System;
import java.util.StringTokenizer;
import java.util.List;
import java.util.ArrayList;
import java.util.Arrays;
public class Test {
  public static void main(String[] args) {
   StringBuilder sb = new StringBuilder();
   for (int i=1000; i<1100; i++) {
    sb.append(i).append(" ");
  }
  String str = sb.toString();
int runs = 100000;
for (int i = 0; i < 5; i++) {
{
long start = System.nanoTime();
for (int r = 0; r < runs; r++) {
StringTokenizer st = new StringTokenizer(str);
List list = new ArrayList();
while (st.hasMoreTokens()) {
list.add(st.nextToken());
}
}
long time = System.nanoTime() - start;
System.out.printf("StringTokenizer took an average of %.1f us%n", time / runs / 1000.0);
}
{
long start = System.nanoTime();
for (int r = 0; r < runs; r++) {
List list = Arrays.asList(str.split(" "));
}
long time = System.nanoTime() - start;
System.out.printf("String.split took an average of %.1f us%n", time / runs / 1000.0);
}
}
}
}
結果顯示:
StringTokenizer took an average of 12.7 us
String.split took an average of 9.8 us
StringTokenizer took an average of 12.6 us
String.split took an average of 9.4 us
StringTokenizer took an average of 12.6 us
String.split took an average of 9.4 us
StringTokenizer took an average of 13.2 us
String.split took an average of 9.4 us
StringTokenizer took an average of 12.5 us
String.split took an average of 9.5 us
看來String.split表現得比較好

mark528 發表在 痞客邦 留言(0) 人氣()

在java,可以使用String.split(delimiter),將字串分割成數個token,得到一個回傳的String array。
例如:
String str = "aaa:bbb:ccc:ddd";
String[] tokens = str.split(":");
for (String token:tokens) {
   System.out.println(token);
}
結果顯示:
aaa
bbb
ccc
ddd
如果字串中有多個分隔符號時,就須加上"|"。
String str = "aaa:bbb-ccc_ddd";
String[] tokens = str.split(":|-|_");
for (String token:tokens) {
   System.out.println(token);
}
結果顯示:
aaa
bbb
ccc
ddd
當delimiter用到特殊字元時,如".", "|", "$",此時要在特殊字元前面加上"\\",才會得到正確的結果。
String str = "aaa-bbb-ccc.ddd";
String[] tokens = str.split("-|\\.");
for (String token:tokens) {
   System.out.println(token);
}
結果顯示:
aaa
bbb
ccc
ddd

mark528 發表在 痞客邦 留言(1) 人氣()

Blog Stats
⚠️

成人內容提醒

本部落格內容僅限年滿十八歲者瀏覽。
若您未滿十八歲,請立即離開。

已滿十八歲者,亦請勿將內容提供給未成年人士。