星期一 八月 04, 2008

Django will run on Jython

Jython is an implementation of high-level, dynamic, object-oriented language Python written in 100% Pure Java. We can run Python code on Java platform with the support of Jython.
Python web framework Django could also run on Jython now. Jim Baker has written an article: Django on Jython is almost there to show that even there's still more work to do, Django could run on Jython platform.

[Read More]

星期二 四月 29, 2008

Java and Movies

Today i go to Nanjing agriculture university to help Huang Shan with her tech talk. I prepare a new tech talk about Java. Of cource, there are some movies i find, which are the same with some features of Java.The fisrt move is Forrest Gump.The actor is Tom Hanks who i like very much.Gump has low intelligence, however he has his own advantage. In every stage, he can always seize the chance using his feature.That is the similar with Java history. Java's old name is oak, which was used to embedded system.However, internet promote Java developing and make Java new life.
The second movie is Mad Detective. The detective can find human's different characters.The man in the movie has seven characters. In fact, Java can delegate different meanings, too. You can say Java is a program lanaguage. You also can say Java is the develop platform, including JavaSE, JavaEE and JavaME. Of cource, Java is the brand. Sun adopts JAVA as his stock name.
The third movie is Three Kingdoms: Resurrection of the Dragon. The story is about famous hero Zhao Yun in China. He is the common soldier at first.However, he has many advantages which can make him become a General. So when a chance happens, he seizes it and let people know him. Netbeans which is excellent develop tool for Java is the similar. Netbeans has so many advantages and it need an opportunity, so Jolt which is the oscar in softare gives netbeans the chance: Netbeans gets Jolt award and Productivity Award in these two years. Whatever, Hope you will like and know Java and Netbeans through these movies.


       

星期五 四月 25, 2008

J2ME Demo to play multi-media resources

 


In this Demo, I introduced how to play multi-media resources using Mobility Package in Netbeans.The development enviorment are: NetBeans 5.5.1, Mobility Package


1.Display Picture


It is easy to display pictures in MobilePhone using NetBeans event without writing one code. Tha main steps are:


1) Put the pictures to the ~~/src/ folder in the program.


2) Add a Image resource ,and set the resource path as one picture resource.


3) Add a ImageItem to the form, and set the image as the images in the resources.


Run the porgram and we can find the picture has been displayed.


 


2.Play Audio


MMAPT is a option package in J2ME, which provides a standard API that can display some media based on time, such as audio and video.


In this Demo I use the MMAPI1.1, and it can support the follow media type:


MIME Type                                     Description


audio/midi                                        MIDI file


audio/sp-midi                                          MIDI


audio/x-tone-seq                              MIDP2.0


audio/x-wav                                      WAV PCM


image/gif                                          FIG89a


video/mpeg                                      MPEG


video/vnd.sun.rgb565                      video record


It can not support other media type such as MP4 ,3gp, but it is believe that the day will be coming.


The mainly step of developing audo play are:


1)       Get the resources from file


2)      Create a Player object


3)      play the audio


The mainly code discription of program are


1)       Get the audio resources and create Player


try{


InputStream in = getClass().getResourceAsStream("qhc.wav");


music = Manager.createPlayer(in,"audio/x-wav");


} catch (Exception e) { e.printStackTrace(); }


2)       Start playing the audio


try {                 


        music.start();        //Start Play


        ticker1.setString("Playing… ");        //set the ticker to display text


      } catch (Exception e) { e.printStackTrace(); }


3)       Continue playing after pause               


   try {


        music.setMediaTime(pauseTime);


              music.start();    //Continue play after pause


        ticker1.setString("Playing… ");


      } catch (Exception e) { e.printStackTrace(); }


4)       Pause playing the audio


try {


        pauseTime = music.getMediaTime();      //pause play


            music.stop();


      } catch (Exception e) { e.printStackTrace(); }


5)       Stop playing


try {


          music.stop();        //stop play


        music.close();


          } catch (Exception e) { e.printStackTrace(); }


 


3.Play Video


The main step of playing video is same to that playing audio, the difference is that the VideoControl object must be create to set the display mode.


The mainly code discription of program are


1)       Get the video resources and create Player


try{


InputStream iv = getClass().getResourceAsStream("sun.mpg");


video = Manager.createPlayer(iv,"video/mpeg");


    video.realize();      //different from the audio play


} catch (Exception e) { e.printStackTrace(); }


2)       create a VideoControl object, different from the audio play


VideoControl vc = (VideoControl)video.getControl("VideoControl");


  //Create a Item to display video


Item videoItem = (Item)vc.initDisplayMode(VideoControl.USE_GUI_PRIMITIVE,null);


   form3.append(videoItem);


3)       Start playing the audio


try {                


        video.start();        //Start play


        ticker2.setString("Video playing…");       //set the ticker to display text


      } catch (Exception e) { e.printStackTrace(); }


4)       Continue playing after pause               


   try {


        video.setMediaTime(pauseTime);   


        video.start();               //Continue play after pause


         ticker2.setString("Video playing…");


      } catch (Exception e) { e.printStackTrace(); }


5)       Pause playing the audio


try {


        pauseTime = video.getMediaTime();      //Pause play


        video.stop();                        


      } catch (Exception e) { e.printStackTrace(); }


6)       Stop playing


try {


          video.stop();  //Stop play


        video.close();


     } catch (Exception e) { e.printStackTrace(); }


 


4.Notes:


We must focus on the media size and the memory in Emulator and MobilePhone. We can change the memory size in Emulator if exists OutOfMemory Error when the program 


is correct without some mistake such as not to release the memory resources. And we shoule note that the memory size in emulator must low than that in MobilePhone will be


deployed.




You can download the demo result and the source code from the follow link:


http://blogs.sun.com/Chinese_Functional_CA/resource/j2meVideoDemo_HongBingfeng.wmv


http://blogs.sun.com/Chinese_Functional_CA/resource/SourceCode_J2MEVideoDemo_HongBingfeng.zip


星期四 四月 24, 2008

SMS vote

SMS vote is a small receivable and analytical tool for activity feedback through GRPS Modem or phone connected to PC. Its ease of use, coupled with real time chart view, make it an essential program for any party, for today and tomorrow.


Features:



  • Read incoming messages from GPRS Modem/Phone and insert into database by asynchronous method.

  • Refresh chart in real time.

  • Lucky draw and send confirmation message.

  • Background customizable.

  • PNG output.

  • Property configuration.

  • Local OS look and feel.

  • 4 devices support.


Project:


http://unix-center.org/projects/smsparty/


Source:


http://unix-center.org/frs/download.php/5/20080114_gprsmodemparty_source.zip


Platform:



  • OS: Microsoft Windows XP & Solaris Express

  • Device: WAVECOM Q2303A GPRS Modem

  • DB: MySQL 5

  • JDK: 1.6

  • IDE: NetBeans IDE 6.0



 

About

This is Chinese Functional CA Team Blog. Any suggestion is appreciated.

Search

Archives
« 四月 2014
星期日星期一星期二星期三星期四星期五星期六
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
今天