วันพุธที่ 29 ตุลาคม พ.ศ. 2551

การสร้าง host svn บน code.google.com

1# ต้องมี Account Google จากอะไรก็ได้สักอย่างหรือจะสร้างใหม่

2# เข้าหน้าแรกเพื่อทำการสมัคร
http://code.google.com
http://code.google.com/hosting/

วันอาทิตย์ที่ 8 มิถุนายน พ.ศ. 2551

Eclipse + Tomcat

Sysdeo Eclipse Tomcat Launcher plugin

Plugin features

  • Starting and stopping Tomcat 4.x, 5.x and 6.x

  • Registering Tomcat process to Eclipse debugger

  • Creating a WAR project (wizard can update server.xml file)

  • Adding Java Projects to Tomcat classpath

  • Setting Tomcat JVM parameters, classpath and bootclasspath

  • Exporting a Tomcat project to a WAR File

  • Capability to use a custom Tomcat classloader to load classes in several java projects at the same classloader level than classes in a Tomcat project, see readmeDevLoader.html (Thanks Martin Kahr)

Support and contributions

Contact plugintomcat@eclipsetotale.com

Download

This plugin is free and open-source

Version File Date Comment

3.2.1

10 May 2007

Works with Eclipse 3.1, 3.2 and 3.3M7
Fix a problem with HTTPS

3.2

13 April 2007

Works with Eclipse 3.1, 3.2 and 3.3M6
Tomcat 6 support added

3.2 beta3

20 November 2006

Works with Eclipse 3.2 and Eclipse 3.1
Tomcat 6 support added

3.2 beta2

25 October 2006

Works with Eclipse 3.2 and Eclipse 3.1
Tomcat 6 support added

3.1

15 September 2005

Works with Eclipse 3.0 and Eclipse 3.1 (fix a problem with Eclipse 3.1M6)

3.0

27 July 2004

Works with Eclipse 3.0 and Eclipse 2.1

2.2.1

1er August 2003

Works with Eclipse 2.1 and Eclipse 3.0 M2


Tomcat 4.x patch for JSP debugging (Thanks to Johan Compagner)

Tomcat Version File Date

4.1.24

1 April 2003

To install this patch, unzip the file in <%TOMCAT_HOME%>/classes for tomcat 4.0x, or in <%TOMCAT_HOME%>/common/classes for Tomcat 4.1.x

Installation

  • This plugin does not contain Tomcat.
    (Download and install Tomcat before using this plugin).
    This is a design choice not to include Tomcat in the plugin distribution, this way the same plugin version can works with any Tomcat version.

  • Download tomcatPluginVxxx.zip

  • Unzip it in your_Eclipse_Home/plugins

  • Plugin activation for Eclipse 3.x :
    - launch eclipse once using this option : -clean
    - if Tomcat icons are not shown in toolbar : select menu 'Window>Customize Perspective...>Commands', and check 'Tomcat' in 'Available command groups'

  • Set Tomcat version and Tomcat home : Workbench -> Preferences, select Tomcat and set Tomcat version and Tomcat home (Tomcat version and Tomcat home are the only required fields, other settings are there for advanced configuration).

  • This plugin launches Tomcat using the default JRE checked in Eclipe preferences window.
    To set a JDK as default JRE for Eclipse open the preference window : Window -> Preferences -> Java -> Installed JREs.
    This JRE must be a JDK (This is a Tomcat prerequisite).

  • The plugin sets itself Tomcat classpath and bootclasspath. Use Preferences -> Tomcat ->JVM Settings, only if you need specific settings.

Documentation and tutorials

Official documation (french) : http://www.eclipsetotale.com/articles/tomcat/tomcatPluginDocFR.html

Tutorials (english) :

Troubleshooting

  • In some case, despite it is correctly unzipped in Eclipse 3 'plugins' directory, the plugin is not loaded : run Eclipse with the -clean option to solve the problem.

  • ClassNotFound when using DevLoader and launching Tomcat 5.5.12 and above
    Workaround : set context definition mode (Preferences->Tomcat) to 'Context files'.
    Explanations :
    This problem is due to a change in Tomcat 5.5.12 and above (see http://issues.apache.org/bugzilla/show_bug.cgi?id=37302 ,
    We hope this bug will be fix but it seems that Tomcat developers don't care about it because it happens when a context containing its own loader is defined in server.xml file and since Tomcat 5 defining context in server.xml is not recommended)

  • ClassNotFoundException on javac/Main when accessing JSP : Tomcat is started with a JRE instead of a JDK.

  • If you have a problem with the plugin check eclipse log file (<%Your_Workspace_dir%>/.metadata/.log)

If you have any problem with this plugin send an email to plugintomcat@eclipsetotale.com .
(Select this button : Preferences->Tomcat->JVM Settings->Dump configuration to .log file, and include in your email the corresponding lines of your .log file, it is in <%Your_Workspace_dir%>/.metadata)

วันพุธที่ 24 ตุลาคม พ.ศ. 2550

การสร้างตัวติดตั้งแบบเร่งด่วน

Are you not satisfied with the zip bundle thats generated out of your module suite from Netbeans? Are you looking for an easy way of generating installers for suite projects right inside the Netbeans IDE?

Well, here it is..a plugin based on openInstaller installer framework that does just this. openInstaller is an extendable, cross-platform, multi-home install and customizable installer framework. All you have to do after installing the plugin is :

  1. Configure your module suite to be 'standalone'. This is required to generate an installer. The plugin will assist you in this if you have not configured your module suite project yet.
  2. Choose the Generate suite installer button on the toolbar (with CD icon). This will bring up the wizard.
  3. Enter the basic details about your application (like, name, version, system requirements and license).
  4. When you click Finish on the wizard, the plug-in will generate an installer and keeps it under 'dist' folder. There are three zip files in that folder : one module suite zip (generated by Netbeans, as before), -binary.zip is the generated installer (you can rename this to any name you want and -source.zip which contains the source files for the installer. The latter can be used in upcoming openInstaller IDE to customize the generated installer.
  5. Distribute -binary.zip bundle and unzip on the target machine and execute the launcher script specific to your platform (There's one for all *NIX and one for windows).

Download the plugin from this update center. (you need to manually configure this update center in your Netbeans IDE. If you do not know how to do this, go here. Look into the first part and use this update center link.

More information (in the form of FAQ) about the plugin is here.

You really have to see this flash demo which shows how easy is to generate an installer for your module suite application.

Disclaimer: The module described here are purely experimental (alpha version), so no guaranties. Use at your own risk.

Below are the screenshots of the plug-in actions..

The screenshots show the process of generating installers for the FeedReader suite sample that comes with Netbeans IDE

http://blogs.sun.com/vdblog/entry/netbeans_module_suite_installer_generator

วันเสาร์ที่ 13 ตุลาคม พ.ศ. 2550

Component Palette คืออะไร เอาไว้ทำอะไร

ผมได้อธิบายถึง Code snippet ซึ่งในที่นี้เราก็จะมาทำให้เป็นในรูปแบบ palette palette หมายถึง อะไรที่อยู่ด้านข้างของ GUI หรือ editor แล้วทำเป็น รูปไอคอนเพื่อให้เราเห็นรูปแล้วเข้าใจว่ามันคืออะไร
เมื่อเราลากมาใส่ใน code เราก็จะได้ code ที่เขียนเสร็จแล้ว อยู่ใน code ของเรา
การ สร้าง อยู่ในลิ้งนี้นะครับ และควรอ่าน code snippet ก่อนด้วยนะครับ

http://platform.netbeans.org/tutorials/nbm-palette-api2.html

วันอาทิตย์ที่ 7 ตุลาคม พ.ศ. 2550

NetBeans Code Snippet สร้าง Code สำเหร็จรูปเอาไว้ใช้

Code Snippet คืออะไร ?
เรามาทำความเข้าใจไอ้เจ้า Code Snippet เมื่อเราเขียนโปรแกรมภาษาใดเรามักจะลืม คีย์
เช่น private,public,protec ,class ,implement ,extens และอื่นๆ ซึ่งทำให้เรานั้นเสียเวลา
ไปกับการเอาหนังสือมาเปิดดูว่ามันเขียนยังไง แล้วมีไว้ใช้ทำอะไร แต่ถ้าสร้างขึ้นมาเองก็จะสามารถ
ใส่คำอธิบายเอาไว้ซะเลยครับ เพื่อสะดวกกับการทำงานของเราเวลาและความคิดที่เราทำงานอยู่จะไม่ได้
สะดุดครับ
เราใช้มันอยู่แล้วละครับ พวกเวลา class.xxxx xxx ที่แสดงขึ้นมานั้นก็คือ Code Snippet ที่มีการท่องเข้าไปใน
API Class เราทำได้หลายแบบ ครับถ้ามีเฉพาะ คีย์ตัวเดียวเราจะทำปุ่มลัดเอาครับ แต่ถ้ามันเยอะหน่อยก็จะทำแบลากวางครับ
เรามาสร้างกันดีกว่าครับ เราจำเป็นต้องใช้ NetBeans Palette API มีอยู่แล้วใน Netbeans ครับ
ในที่นี้เราจะมาสร้างแบบ ใหญ่คือแบบที่ไม่ใช่คีย์ครับ เราจะเริ่มไว้ก่อนครับ เพราะเราจะพัฒนาเป็นแบบ GUI อีกทีครับ
เราจะใส่อะไรให้มันบ้างครับเวลาที่เราจะสร้างมันขึ้นมา
  • Java class ที่เอาไว้กำหนดระยะ code เมื่อ dragged ใส่เข้าไปใน Source Editor.
  • ชื่อที่เอาไว้แสดง palette item.
  • คำอธิบาย palette item.
  • 16x16 pixel image 'ไอคอนขนาดเล็ก' เมื่อแสดงผล
  • 32x32 pixel image 'ไอคอนขนาดใหญ่' เมื่อแสดงผล
ต้องมีการแก้ไข layer.xml ด้วย

ติดตั้ง Software

  • NetBeans IDE 6.0 (download)
  • Java Standard Development Kit (JDK™) version 1.4.2 (download) or 5.0 (download) or later

    ตัวอย่างการติดตั้ง
    ทำตามขั้นตอนต่อไปนี้
  1. Unzip the attached file.
  2. เปิด IDE, เลือก File > Open Project and browse to the folder that contains the unzipped file. Open the module project. It should look as follows:

    เอาไว้จะแปลความต่อนะเหนื่อยละเข้าไปดูในนี้ก่อนก็ได้ครับ http://platform.netbeans.org/tutorials/60/nbm-palette-api1.html


Generics คืออะไร ?

การจัดเตรียมโครงสร้างของชนิดข้อมูลที่มากกว่าชนิดข้อมูลนั้น คล้ายๆ array แต่ไม่ได้ระบุ เพิ่มได้เรื่อยๆ
ความสามารถในการส่งข้อมูลของ Interface และ Method ได้
การสร้าง Generics Class:
LinkedList
E คือชนิดข้อมูลไม่ว่าจะเป็น premetive หรือ reference
เป็นชนิดข้อมูล ย่อยที่อยู่ใน Linkedlist
ตัวอย่างรูปแบบการสร้าง
public class LinkedList
extends AbstractSequentialList
implements List, Queue, Cloneable, java.io.Serializable{
private transient Entry header = new Entry(null, null, null);
private transient int size = 0;
public E getFirst() {
if (size==0) throw new NoSuchElementException();
return header.next.element;
}

ตัวอย่างการใช้งาน
LinkedList li = new LinkedList();
li.add(new Integer(0));
Integer i = li.iterator().next();

ตัวอย่าง
// Create a Vector of String type
Vector vs = new Vector();
vs.add(new Integer(5)); // Compile error!
vs.add(new String(“hello”));
String s = vs.get(0); // No casting needed
ตัวอย่าง
HashMap map = new HashMap();
map.put(“wombat”, new Mammal("wombat"));
Mammal w = map.get(“wombat”);
แค่นี้ก่อนนะครับไม่เข้าใจถามละกันครับอาจเข้าใจยากไปหน่อยนะครับแต่ถ้าไม่เข้าใจกลับ
ไปอ่านโครงสร้างข้อมูลเรื่อง Linklist

การติดต่อ SVN google code ด้วย Netbeans




1. ขั้นตอนแรกในการติดต่อเขายัง google code ของโปรแกรม EasyWrite ใส่เหมื่อนในรูป https://easywrite.googlecode.com/svn/trunk/
แค่นี้แหละครับ

เราไปดูขั้นตอนที่สองกันครับ
2. ก็จะขึ้นหน้าตาแบบนี้นะครับเมื่อเรากด Next
3. จากนั้นก็ Browse.. หา EasyWrite กันครับ
ให้ Browse.. ที่เก็บ โค๊ตในที่นี้ผมเลือกไว้ใน Drive E:\
ก็จะเป้นดังรูปครับ
กด Next ก็จะทำการก๊อบปี้ จาก google code มาที่เครื่องเรา

ความสามารถใน java 5.0

  • ระบบข้อมูล Generics & Metadata ซึ่งเอาไปไว้ใน ภาษาเลยเปนแบบลิ้งลิชได้กันทุกระบบตัวแปล
  • เปลี่ยน Library API ให้ใช้ง่ายขึ้น
  • การปรับแต่ง JVM ก่อนและขณะรัน
  • ระบการจัดการและสังเกตการณ์ตัวแปลขณะรัน
  • ระบบหน้าตาแบบใหม่และการจัดการเรื่อง skin ,theme
  • for loop แบบ ใหม่
    for (variable : collection)
    Old code
    void cancelAll(Collection c) {
    for (Iterator i = c.iterator(); i.hasNext(); ){
    TimerTask task = (TimerTask)i.next();
    task.cancel();
    }
    }

    New Code
    void cancelAll(Collection c) {
    for (TimerTask task : c)
    task.cancel();
    }
  • เพิ่มชนิดข้อมูลที่ชื่อว่า enum เป็นตัวแปลที่เอาไว้อ้างอิงกับข้อความหรือข้อมูลอื่นๆ
  • ใช้ printf เหมื่อนใน c/c++
    System.out.printf(“%d + %d = %d\n”, a, b, a+b);
  • สามารถ import static Class ได้และคลาส static มาตรฐานอย่าง Math
    Math.sin(x) เขียนแบบนี้ก็ได้ sin(x)
  • การรับข้อมูลแบบ คอมมานไลน์
    Scanner s = new Scanner(System.in);
    int n = s.nextInt();
    มีต่อแน่นอนครับ

วันเสาร์ที่ 6 ตุลาคม พ.ศ. 2550

Subversion การดึงและอัพเดตโค๊ตจาก google

เว็บที่เกี่ยวข้องที่สำคัญคือ เว็บใน Netbeans เอง
http://subversion.netbeans.org/
สำหรับ flash Video ของ roumen
http://roumen.name/blog/subversion2/subversion2.html
และผมเขียน บางอย่างไว้ใน
http://code.google.com/p/easywrite/wiki/loadsource

ถ้าไม่เข้าใจตรงไหน คอมเม่นได้ครับ

วันศุกร์ที่ 5 ตุลาคม พ.ศ. 2550

วิธีเพิ่มภาษาเข้าไปใน GUI ของ netbeans

วิธีการนี้เป็นระบบ มาตรฐาน i18n เพื่อให้สามารถเลือกเปลี่ยนภาษา ตามท้องถิ่นต่างๆ ได้ง่ายและสามารถเพื่อและแก้ไขได้สะดวก ยิ่งขึ้นเรามาดูวิธีกันครับ ตามลิ้งนี้จะเป็น Flash Video
ครับ ให้เราได้ทำตามได้ง่ายๆๆ ครับ
http://form.netbeans.org/JavaOne/autoi18n/autoi18n.html
แบบ ธรรมดาหน้าเว็บ
http://www.netbeans.org/kb/55/gui-automatic-i18n.html