Wednesday Jun 17, 2009

Two weeks past after we officially release DocWeb 2.0 outside. Now, we have visit data in my hand. Here is just make a simple analysis base on those data:

  • We already have 3,600 unique users access system and total access number is 4,507. The new visitor is 3600 which is 80% of all. That means the returning visitor is 900, it's 20% of overall.
  • We got about 300 new visitors everyday in past 2 weeks. At the same time, we got about 50-100 returning visitor everyday. That's good news for us: DocWeb make some users keep in loop and continue to attract more new users.
  • Those users come from all over the world. And top 10 countries are China, United States, Japan, India,Germany,Brazil,France,Mexico,United Kingdom and South Korea.
  • Most of popular browser used are Internet Explorer and FireFox. 9% of visits use Chrome and Safari.
  • 92 % of visits have Java plugin ready in browser
  • Most of import features from feedback are: Doc translatable and searchable.

Welcome all users from the world!


Monday Jun 01, 2009

今天, 2009年6月1日,我们正式在 http://doc.java.sun.com  上发布的 DocWeb 2.0 版本。SDN 的用户可以直接登陆 DocWeb。

DocWeb 2.0 使用 SDN 的用户界面风格,独特的支持 SDN 单点登录,多语言的内容,丰富的用户交互形式:意见,代码示例,投票,错误参考等等... 对全球的 JavaSE, ME, EE开发者而言,希望这个版本将大大增强用户体验和引进更多的方便和实用。衷心的欢迎大家浏览 DocWeb 2.0 并提更多宝贵意见!

Friday May 22, 2009

In DocWeb 2.0 final release, we will follow same VOC gathering way used by Sun's website. There will have a float icon on webpage. User just need click it if they have some feedback for this application:

When user click on that icon, a dialog will popup to user to fill their feedback like this:

Please feel free to fill your feedback about DocWeb 2.0. We will try our best to make DocWeb 2.0 better!

Friday May 15, 2009

In past year, I use my spare time to work on this Java API doc community: DocWeb 2.0 . I still work hard to deliver it outside yestoday though the whole beijing site in under sad mood. I even join a fareware lunch a little delay cause of this. But I am so still exciting when I saw it is outside and work perfect as it is just like your baby. It's hard time and what we can do is do it best! We plan to release final version before JavaOne. And the schedule will be still tight as we still have lots things need be covered:

  • Existed user migration
  • SDN authentication module integration
  • Cluster support in application
  • Some bug fixings
  • Product running environment setup

Could you please let me know if you have any comment for DocWeb 2.0? Here is screenshot for your first view:

Monday May 11, 2009

Traditional Chinese handwriting is beautiful and elegant, and it is symbol of chinese traditional spirit. I am interesting in how we can emulate it in JavaFX. Here I create a simple demo to show it.

  • Make sure you have image editor like Adobe Illustrator or Photoshop
  • Download JavaFX 1.1 Production Suite and install it.
  • Create a serial of layers in photoshop which demo the whole chinese character writing process. Here I create 11 layers to show one chinese character.
  • Following tutorial: Getting Started With JavaFX 1.1 Production Suite, we can export our pictures into .fxz file which can be use in JavaFX. You need uncheck "Preserve 'JFX:' IDs only" during exporting to get an id for each node in exported file:


  • Create a new JavaFX project in NetBeans and copy that exported file into your project

In NetBeans project, I only need writing few line of code to make it work:


var content = FXDLoader.loadContent("{__DIR__}res/handwriting.fxz");
var x: Integer;

Timeline {
  repeatCount: Timeline.INDEFINITE
  keyFrames: [
    at(0s) { x => 1 },
    at(3s) { x => 11 tween Interpolator.LINEAR}
  ]
}.play();

var node = bind content.getNode("layer{x}");

Stage {
    title: "Application title"
    width: 425
    height: 425
    scene: Scene {
        content: bind [content.getNode("background"), node]
        }
}
      

Here is the demo:

Here is java web start way to run it as desktop: Traditional Chinese Handwriting Demo

Thursday May 07, 2009

There already have docs about customize API doc for Java SE: Doclet Overview. How about JavaFX doclet?

Actually, most of part in that Java SE doc can be applied to JavaFX's. You need download JavaFX sdk from JavaFX website. There have a file whose name is javafxdoc.jar. You need compile and run your customized doclet class with that library. You can use that simple example doclet provided in Doclet Overview and take a try to compile your doclet class:

javac -classpath javafxdoc.jar ListClass.java 

And then write some javafx code MyClass.fx and run it with your doclet:

javafxdoc -doclet ListClass -docletpath .  MyClass.fx

It will create output for MyClass.fx according to your doclet class.

 
  

Friday Apr 17, 2009

In previous article, we talk about how to create a new project in NetBeans. Here we will try to make it final work for App Engine.

Update build.xml

  • Put dependency class libraries for 'compile' task 
  • Copy all of those libraries to deploy directory
  • Create some task to make debug ready
  • Make those xml files ready for JDO/JPA enhancement

Here is my build.xml file, It worked on my environment. I map test action to 'debug' as there is no debug item there for map:

Please remember to update propery 'appengine.sdk' accourding to your environment, and keep in mind that I put third-party jar files under '<Project Base>/lib' directory.

Now, most of things are ready in NetBeans, you can create application and run/debug it in NetBeans now.

How to create Servlet

You can new a Servlet after right click on project. NetBeans couldn't auto generate information in web.xml for free-form and you just need go to web.xml and manully did servlet/url mapping like this:

That's different thing for Servlet support.

How to debug application for Google App Engine

Since we already map 'test' action to 'debug', we should right click on project and choose 'test' to do debug'. When system is running and listenning on Java remote debug port 5005, attach debugger under menu 'Debug':

Enhancement

I remove datanucleus-enhancer-1.1.1.jar under directory 'lib' as there have duplicated one under 'lib\user\orm'. It will cause duplicated registration error during enhancement.

How to stop running container

We need manully kill it outside of NetBeans. We can use 'kill' on Unix and 'Task Manager' on Windows to kill that java process. I bet you won't make mistake to kill NetBeans process as it use more memory than that container's. You need finish debugger session in NetBeans first if you are debugging it.

Now, we can easily debug Servlet/JDO/JPA in NetBeans. You can download NetBeans here!


Thursday Apr 16, 2009

Since there haven't so many articles talking about how to do job in NetBeans for Google App Engine, I take a try and here I will share you my way to make it work from scratch as a workaround. We still need NetBeans plugin for full support. Hope it will be ready very soon.

- Copy demos\new_project_template directory from that app engine SDK for java to your project home directory as your initial project pattern.

- Delete unecessary file and make it ready like this:


- Start NetBeans, new a project and choose 'Java Free-Form Project' under 'Java' Category. Just like following screenshot shown:


- Click 'Next' button and choose your template directory your just copy from SDK demo for 'location'

NetBeans will automatically fill rest of columns. You just need change your project name from default.

- Click 'Next' to map NetBeans action to customed build script, here what I did:

I mapped 'Build Project' to 'compile', 'Clean Project' to 'clean' and 'Run Project' to 'dev_appserver'. I will talk it later about how to debug in NeBeans and we will map 'test' to 'debug' at that time. Here we just skip that step.

- Last step for free-form project creation in NetBeans is put your source package folder here:

- After project creation in NetBeans, we need update project properties to include more lib. Right click on new project and click on 'properties'. Please put follow jar file into 'Java Sources Classpath':

  • appengine-api-1.0-sdk-1.2.0.jar under 'lib\user' from App Engine SDK
  • All jar files under directory 'lib\user\orm' from App Engine SDK
  • All jar files under directory 'lib\shared\' from App Engine SDK
  • Third-party jar if you program will be used. You can put those jars under <project>\lib

You don't need use all of those libs. You can reduce them according to your requirement. I didn't try it:

This step is making NetBeans editor know those classpath and make it work correctly on your code when your are writing. Compile process couldn't automatically reuse those classpath for compiling. We still need put those libs for compile process. Please check next article about update build.xml to make it work finally.

Saturday Apr 11, 2009

I saw Google release a early access for App Engine for java language and take try(It also support Python as well). I am fetching RSS feed from different blogs and show it locally on system. It works great! You can take a look on my trial page

Nowaday, Google only provide development plugin for Eclipse. I still prefer to code in NetBeans. So I use Netbeans to coding and it work:

  • Create a web project and choose any container during creation
  • Manually put Google's lib into project I need call it's service.
  • Manually create 'appengine-web.xml' file under directory 'WEB-INF' and remain 'sun-web.xml' as while.
  • Clean and build it in NetBeans(Please don't run it in NetBeans as Google app engine use a different container)
  • Run app engine in console 'dev_appserver.sh <project base>build/web' and access it in your browser by http://localhost:8080/
  • Upload it to your application by 'appcfg.sh update <project base>/build/web' after you already apply an application id on google(Please apply one from Google if you haven't)
  • Access your online application by http://<Application ID>.appspot.com/.

The only pity is I don't find a easy way to debug it directly in Netbeans.

Google give a quota for free trial. It is enough for me nowaday. I am just worry about upcoming quota change and not sure it can match user needs for free.

Monday Mar 30, 2009

There already have lots for page flipping components for flash. Seemed there is no for JavaFX. I take some times and create a prototype. You can take a try if you already installed jdk1.6.0 u12 or above on your machine to view this demo:

- Wait for program loading for a while

- Move mouse to one corner of slides, drag it to flip to another page till it's on end or beginning page.

Please let me know if you have more comments. I will put your suggestion into update version.

FlipPage Demo

Here is java web start way to run it as desktop: FlipPage Demo

Tuesday Mar 17, 2009

As bug 6416177 exist, Java didn't official support SuSe10 for CCKJ. In case you need run some java application show in CCKJ, do there have any workaround? Here is a step about how to config font support for JDK:

  • Check what types of font SuSe support for your language

Go to '/usr/X11R6/lib/X11/fonts/truetype and view file 'fonts.dir', you will see map between true type font file and it's supported font like this:

FZSongTi.ttf -founder-songti-medium-i-normal-0-0-0-0-c-0-gb18030-0

Try to pick up fonts from that list for JDK's 5 logical font families:

  1. serif: plain, bold, italic, bolditalic
  2. sansserif: plain, bold, italic, bolditalic
  3. monospaced: plain, bold, italic, bolditalic
  4. dialog: plain, bold, italic, bolditalic
  5. dialoginput: plain, bold, italic, bolditalic

Abviously, you can use one font represent all of those logical fonts. It's you prefer.

  • Make change in fontconfig file 

Go to directory <JDK HOME>/jre/lib/, view file 'fontconfig.SuSE.properties.src'. You will see it only support charset 'iso8859-1'. We need put our language's support into it.

For example, we want use '-founder-songti-medium-i-normal-0-0-0-0-c-0-gb18030-0' for logical font 'serif.plain'. We need put following into that fontconfig file:

serif.plain.zh-1=-founder-songti-medium-i-normal-*-%d-*-*-c-*-gb18030-0

Please map all logical fonts to our phyical font alias following about way. After that, we need change the 'Search Sequences' to 'sequence.allfonts=latin-1,zh-1' and put font file names we used into file:

filename.-founder-fangsong-medium-r-normal-*-%d-*-*-c-*-gb18030-0=/usr/X11R6/lib/X11/fonts/truetype/FZFangSong.ttf

Also, we need put following line in file:

awtfontpath.zh-1=/usr/X11R6/lib/X11/fonts/truetype

Here is fully sample on my test machine. Restart application, and enjoys!

Wednesday Feb 18, 2009

GlassFish 中启用压缩功能提升网站性能

GlassFish 中可以启用 HTTP 压缩功能来提升网站性能。HTTP 压缩其实就是将网页内容压缩,减少HTML代码网络传输的代价,来提高Web性能。这里有四个属性可供配置:

  • compression
  • compressionMinSize (in OCTET)
  • compressableMimeType
  • noCompressionUserAgents

你可以用通过命令行启动:

%asadmin set server.http-service.http-listener.http-listener-1.property.compression=force

许可的值是:
    off –  取消压缩
    on –   启用压缩
    force –在任何情况下都压缩
    正数 – 采用压缩应满足的最小输出数据

如果 content-length 未知, 只有在 compression 设为 force h时才会压缩。

详细可参考

Enabling HTTP Compression in GlassFish
compression and compressionMinSize in GlassFish v3
http-listener in GlassFish v3

Thursday Feb 12, 2009

In case you have blogs in Roller system need be backup, here is one way if you are using thunderbird email client:

- Create a new account with type 'RSS news & blog'.

- Add your blogs rss feed url into that account. You can get your blogs rss feed url by click 'XML' icon on your blog's first page.

- Change your account setting to make sure all blog will be download at once

- Close thunderbird and find it's profile directory to backup it. You can get detail step for this on this link .

Friday Jan 16, 2009

If you are installing windows from iso file by using 'Virtual Machine Manager' in xVM, windows installer will let you put your disk into cdrom when windows restart during installation. xVM won't load iso file into cdrom automatically if you restart your domain. 

If you run 'virsh dumpxml [domain]', you will see that domain's device information like this:

    <disk device='cdrom'>
      <target dev='hdc'/>
      <readonly/>
    </disk>

    <disk type='file' device='disk'>
      <driver name='tap' type='vdisk'/>
      <source file='[raw file]'/>
      <target dev='hda'/>
    </disk>

To solve this windows installation issue, we just need run following command from console:

virsh attach-disk [domain] --type cdrom --driver file --mode readonly [iso file] hdc

Let's check device again:

#virsh dumpxml [domain]

<disk type='file' device='cdrom'> <driver name='file'/> <source file='[iso file]'/> <target dev='hdc'/> <readonly/> </disk> <disk type='file' device='disk'> <driver name='tap' type='vdisk'/> <source file='/export/os/2003tw'/> <target dev='hda'/> </disk>

Now, just back to your windows installer window, clicking 'retry' and installer will continue it's job.

We can use same way to switch difference CD during installation. For example, there have 4 CDs if you install SuSe 10. It's a way for you if you don't have a dvd iso file.

You can click this to get more information about 'virsh' command.

Thursday Jan 08, 2009

在 08 年初申请了两张 Sun 考试券,由于 2008 年一直挺忙,结果一拖再拖到年底终于决定要用掉它们。SCJP 和 SCJD 都在几年前过了,唯一的选项就只有 SCEA 5 (Sun Certified Enterprise Architect for the Java Platform, Enterprise Edition 5) 了。本来听说 2008 年考过 SCEA 5 Beta 版的人都认为题挺难的,不太好考阿。但考虑到与其让考试券过期还不如试一下。准备了两周过后去考,居然过了。这也是我元旦放假前比较高兴的事了:-)

比较奇怪的是,其中居然我认为还不错的关于模式、Web 层的部分考得不好,反倒是安全、EJB 的部分考得不错。可能是我考前都看自己不太熟悉的部分,反倒没对熟悉的部分轻视了。如果有人要考的话我可有很多教训分享哦

2009 年就要考 SCEA 5 的二和三阶段了,也希望自己能一样顺利吧。

This blog copyright 2009 by leonfan