url = textReplace("?", URLEncoder.encode("?"), url);
url = textReplace("&", URLEncoder.encode("&"), url);
private String textReplace(String find, String replace, String input)
    int startPos = 0;
        int textPos = input.indexOf(find, startPos);
        if(textPos < 0)
        input = input.substring(0, textPos) + replace + input.substring(textPos + find.length());
        startPos = textPos + replace.length();
    return input;


BufferedInputStream remoteBIS = new BufferedInputStream(conn.getInputStream());
ByteArrayOutputStream baos = new ByteArrayOutputStream(10240);
byte[] buf = new byte[1024];
int bytesRead = 0;
while(bytesRead >= 0)
    baos.write(buf, 0, bytesRead);
    bytesRead = remoteBIS.read(buf);

byte[] content = baos.toByteArray();


File f = new File(fileName);
FileOutputStream out = new FileOutputStream(fileName);


* Set of URLs downloaded or scheduled, so we don't download a
* URL more than once.
* Thread safety: To access the set, first synchronize on it.
private Set urlsDownloadedOrScheduled;

这种log挺好:(apache log4j)

private final static Category _logClass = Category.getInstance(TextSpider.class);

显示信息: 2005-05-01 11:40:44,250 [main] INFO? TextSpider.java:105 - Starting Spider...
_logClass.info("Starting Spider...");

posted @ 2006-02-16 14:10 罗明 阅读(560) | 评论 (0)编辑 收藏
当下载第一个URL时(一般是网站主页),如果等待时间过长,那么其他线程要么会认为网站已下载完而结束,要么会在下面标*代码处抛出NullPointerException, 很少能够存活下来。

else if(queueSize() == 0)       /* queueSize()已经被同步 */
URLToDownload nextURL;
    nextURL = queue.getNextInQueue();
int newDepth = nextURL.getDepth() + 1; **********************

nextURL = queue.getNextInQueue();后面加上判断就OK了:

    nextURL = queue.getNextInQueue();
    if(nextURL == null)


posted @ 2006-02-16 14:10 罗明 阅读(1022) | 评论 (0)编辑 收藏

I had to get obsessed with keyboard shortcuts when using IDEA.
Apparently some of that must have rubbed off, because
lately I've been looking for shortcuts to methods and classes in Eclipse 3.0.

There are two traversal shortcuts I use all the time: Ctrl-O and Ctrl-T.

Ctrl-O shows the methods of the class in the current editor in a popup.
Hit Ctrl-O when the popup is up, and you'll see all the inherited
methods as well. This is incredibly useful, as it allows me to bounce
between methods even when I'm not sure which class is implementing
which method.

Ctrl-T shows the type hierarchy of a selected type in a popup. This is the
complement to Ctrl-O. When I'm sure of what
interface I'm looking at, but I really want to pick a particular implementation
and want to go trawling through that
implementation for a bit, Ctrl-T will show me all the subclasses or
implementors for that type.

There is a third option which I haven't used much. Ctrl-F3 shows the
methods of a selected type in a popup. I can see how this can be useful,
but in practice I have a pretty good idea of which methods are attached
 to which classes and Ctrl-Space fills most of my needs there.

However, I have been missing a couple of things. These are the shortcuts
I just found recently, and are very good for hitting up random files:

Ctrl-E shows a popup list of all the open files.
Ctrl-Shift-T creates a dialog box that you can use to navigate to any class.
Ctrl-Shift-R creates a dialog box that shows any resource in the project
(basically any file.)
Alternately, there's an Eclipse plugin called GotoFile which seems to behave
a little more "IDEAish".

Finally, I found a plugin which actually integrates Eclipse with Windows!
Eclipse Platform Extensions is actually functional and useful, although
you wouldn't guess it by looking at the website. Although it says that
it provides a "System GC" functionality, it actually does far more,
like provide a "Open in Windows Explorer" and
"Open Command Window here" dialog to the Package Explorer.

posted @ 2006-02-16 14:09 罗明 阅读(290) | 评论 (0)编辑 收藏

Installing the help system as an infocenter

You can allow your users to access the help system over the Internet or an intranet, by
installing the infocenter and the documentation plug-ins on a server. Clients view help
by navigating to a URL, and the help system is shown in their web browser. The
infocenter help system can be used both for client applications and for web
applications, either of which can have their help accessed remotely. All features
of help system except infopops and active help are supported.

The infocenter help system allows passing number of options that can be used to
customize various aspects of the infocenter. The following options are supported:

  • -eclipsehome eclipseInstallPath - specifies Eclipse installation directory.
    This directory is a parent to "plugins" directory and eclipse executable.
    The option must be provided, when current directory from which infocenter
    is launched, is not the same as Eclipse installation directory.
  • -data instanceArea - specifies a path that Eclipse can use to write instance data.
    The value can be an absolute path of a directory, or a path relative to Eclipse
    installation directory. The option must be provided when Eclipse is installed in
    the read only location, or has been customized to override osgi.instance.area
    or osgi.instance.area.default properties.
  • -host helpServerHost - specifies host name of the interface that help server
    will use. It overrides host name specified in the application server plugin preferences.
  • -port helpServerPort - specifies port number that help server will use. It overrides
    port number specified in the application server plugin preferences.
  • -locales localeList - specifies a list of locales that infocenter will recognize and
    provide a customized content for. If the option is not specified, infocenter will
    build navigation, and index documents for each preferred locale of the browsers
    accessing the infocenter. When the option is present, locales from browser
    requests will be matched with locales in the list. If browser preferred locale
    does not exist in the list, but its language part does, it will be used. Subsequently,
    additional browser locales in decreased order of preference will be matched
    against the list. If none of the browser locales (or its language part) matches any
    locale on the list, the client will be served content in the default locale - server
    locale or locale passed with -nl option. For example using options
    -nl en -locales de en es fr it ja ko pt_BR zh_CN zh_TW
    will cause infocenter operating in 10 locales. All other locales will receive content
    for en locale.
  • -dir rtl - sets right-to-left rendering direction of help UI in the browser.
  • -noexec - indicates that Eclipse executable should not be used. You may need to use
    this option when running on a platform for which Eclipse executable is not available.
  • Additionally, most options accepted by Eclipse executable can be passed. They are
    especially useful during debugging and for applying customization to Eclipse.
    For example, passing options
    -vmargs -Xmx256M 
    increases memory available to the infocenter and will allow serving a larger book collection.


These steps are for the help system integrator and are not meant to address all the possible scenarios.
 It is assumed that all your documentation is delivered as Eclipse plug-ins and, in general, you are
familiar with the eclipse help system.

  1. Download the Eclipse Platform Runtime Binary driver from www.eclipse.org.
  2. Install (unzip) the driver in a directory, d:\myApp. This will create an eclipse sub-directory,
    d:\myApp\eclipse that contains the code required for the Eclipse platform
    (which includes the help system).

How to start or stop infocenter from command line

The org.eclipse.help.standalone.Infocenter class has a main method that you can use to
launch infocenter from a command line. The command line arguments syntax is:

-command start | shutdown | [-eclipsehome eclipseInstallPath] 
[-data instanceArea] [-host helpServerHost] [-locales localeList]
[-port helpServerPort] [-dir rtl] [-noexec] [platform options]
[-vmargs JavaVMarguments]

To start an infocenter on port 8081 issue a start command by running

java -classpath d:\myApp\eclipse\plugins\org.eclipse.help.base_3.1.0.jar 
org.eclipse.help.standalone.Infocenter -command start -eclipsehome
d:\myApp\eclipse -port 8081

To shut the infocenter down issue a shutdown command by running

java -classpath d:\myApp\eclipse\plugins\org.eclipse.help.base_3.1.0.jar 
org.eclipse.help.standalone.Infocenter -command shutdown -eclipsehome

Using the infocenter

Start the web server. Point a web browser to the path "help" web application running on a port
specified when starting the infocenter.  On the machine the infocenter is installed, this would be

How to start or stop infocenter from Java

When including infocenter as part of another application, it may be more convenient to start it
and stop using Java APIs instead of using system commands. Follow the steps if it is the case:

  1. Make sure d:\myApp\eclipse\plugins\org.eclipse.help.base_3.1.0.jar is on your app classpath.
    The class you use to start, and shut down the infocenter isorg.eclipse.help.standalone.Infocenter.
  2. Create an array of String containing options that you want to pass to the infocenter. Typically,
    the eclipsehome and port options are needed.
    String[] options = new String[] { "-eclipsehome", "d:\\myApp\\eclipse" ,
    "-port", "8081" };
  3. In your application, create an instance of the Help class by passing the options.
    Infocenter infocenter = new Help(options); 
  4. To start the help system:
  5. To shut the infocenter down:


Making infocenter available on the web

Eclipse contains a complete infocenter and does not require other server software to run.
However, in unsecure environment like Internet, it is recommended infocenter is not accessed
directly by clients, but is made available through an HTTP server or an application server.
Most servers come with modules or servlets for delegating certain request to other web
resources. For example, one may configure a proxy module of Apache HTTP Server to
redirect requests made to http://mycompany.com/myproduct/infocenter to
http://internalserver:8081/help that runs an infocenter. Adding the lines

LoadModule proxy_module modules/ApacheModuleProxy.dll
ProxyPass /myproduct/infocenter http://internalserver:8081/help
ProxyPassReverse /myproduct/infocenter http://internalserver:8081/help
to conf/httpd.conf file of Apache server running mycompany web site accomplishes this.

Some versions of Apache HTTP server, may contain AddDefaultCharset directive enabled in
configuration file. Remove the directive or replace with

AddDefaultCharset Off
to have browsers display documents using correct character set.

Running multiple instance of infocenter

Multiple instances of infocenter can be run on a machine from one installation. Each started
instance must use its own port and be provided with a workspace, hence -port and -data
options must be specified. The instances can serve documentation from different set of plug-ins,
by providing a valid platform configuration with -configuration option.

If -configuration is not used and configuration directory is shared among multiple infocenter
instances, with overlapping set of locales, it must be ensured that all search indexes are created
by one infocenter instance before another instance is started. Indexes are saved in the configuration
directory, and write access is not synchronized across infocenter processes.

[Optional] Installing a minimal set of plug-ins

The infocenter does not require the entire  Eclipse Platform package. It is possible to run the
infocenter with the following plug-ins (located in the  eclipse\plugins directory):


Some documentation plug-ins may have dependencies on other plug-ins, usually by specifying required
plug-ins in their plugin.xml. The dependent plug-ins need to be installed on the infocenter as well.
Additionally, plug-ins that were designed for earlier than 3.0 version of Eclipse implicitly require an org.eclipse.core.runtime.compatibility being present plug-in to work.

Infocenter plug-ins can be updated without restarting the infocenter, using commands explained
in Updating a running infocenter from command line topic. To use this functionality, the minimal
set of plug-ins must include org.eclipse.update.core plug-in.

See Help System Preferences for more information on customizing help system.

posted @ 2006-02-16 14:08 罗明 阅读(469) | 评论 (0)编辑 收藏
Class.forName is excellent


在Log4j里定义一个静态类构造器,里面放apache log4j的初始代码。


posted @ 2006-02-16 14:07 罗明 阅读(224) | 评论 (0)编辑 收藏


<title>404 Not Found</title>
<h1>404 Not Found</h1>
/asfsfdsd.jsp was not found on this server.
<p /><hr />
Resin 2.0.3 (built Wed Oct 17 10:11:08 PDT 2001)

  -- Unfortunately, Microsoft has added a clever new
  -- "feature" to Internet Explorer.  If the text in
  -- an error's message is "too small", specifically
  -- less than 512 bytes, Internet Explorer returns
  -- its own error message.  Yes, you can turn that
  -- off, but *surprise* it's pretty tricky to find
  -- buried as a switch called "smart error
  -- messages"  That means, of course, that many of
  -- Resin's error messages are censored by default.
  -- And, of course, you'll be shocked to learn that
  -- IIS always returns error messages that are long
  -- enough to make Internet Explorer happy.  The
  -- workaround is pretty simple: pad the error
  -- message with a big comment to push it over the
  -- five hundred and twelve byte minimum.  Of course,
  -- that's exactly what you're reading right now.


posted @ 2006-02-13 18:27 罗明 阅读(925) | 评论 (0)编辑 收藏
posted @ 2006-02-12 16:35 罗明 阅读(724) | 评论 (1)编辑 收藏
Bill Scott's AJAX Blog: Nine Tips for Designing Rich Internet Applications
If you were going to provide some quick basic guidelines for designing rich applications what would they be?

posted @ 2006-01-09 17:16 罗明 阅读(395) | 评论 (0)编辑 收藏
源多说明通过你的apt能安装更多软件,如果下列链接有效,就将它加到你的sources.list (注意顺序,将速度最快的放在最前头,apt会默认用前面的链接下载软件)

deb ftp://ftp.sjtu.edu.cn/sites/archive.ubuntu.com breezy main restricted universe multiverse
deb ftp://ftp.sjtu.edu.cn/sites/archive.ubuntu.com breezy-updates main restricted universe multiverse
deb ftp://ftp.sjtu.edu.cn/sites/archive.ubuntu.com breezy-security main restricted universe multiverse
deb http://archive.ubuntu.org.cn/ubuntu breezy main restricted universe multiverse
deb http://archive.ubuntu.org.cn/ubuntu breezy-updates main restricted universe multiverse
deb http://archive.ubuntu.org.cn/ubuntu breezy-security main restricted universe multiverse
deb http://archive.ubuntu.org.cn/ubuntu-cn breezy main universe multiverse restricted
deb http://archive.ubuntu.org.cn/ubuntu hoary main restricted universe multiverse
deb http://archive.ubuntu.org.cn/ubuntu hoary-security main restricted universe multiverse
deb http://archive.ubuntu.org.cn/ubuntu hoary-updates main restricted universe multiverse
deb http://archive.ubuntu.org.cn/ubuntu-cn ubuntu.org.cn main universe multiverse restricted
deb http://archive.ubuntu.org.cn/ubuntu hoary-backports main universe multiverse restricted
deb http://archive.ubuntu.org.cn/backports hoary-extras main universe multiverse restricted
deb-src http://archive.ubuntu.org.cn/ubuntu hoary main restricted universe multiverse
deb-src http://archive.ubuntu.org.cn/ubuntu hoary-security main restricted universe multiverse
deb-src http://archive.ubuntu.org.cn/ubuntu hoary-updates main restricted universe multiverse
deb http://helix.alioth.debian.org/deb sid main non-free
deb-src http://helix.alioth.debian.org/deb sid main non-free
deb http://ubuntu.cn99.com/ubuntu/ breezy main restricted universe multiverse
deb http://ubuntu.cn99.com/ubuntu/ breezy-updates main restricted universe multiverse
deb http://ubuntu.cn99.com/ubuntu/ breezy-security main restricted universe multiverse
deb http://ubuntu.cn99.com/ubuntu-cn/ breezy main restricted universe multiverse
deb http://ubuntu.cn99.com/backports/ breezy-extras main restricted universe multiverse
posted @ 2006-01-07 17:02 罗明 阅读(2005) | 评论 (0)编辑 收藏
Source: http://openide.netbeans.org/tutorial/api-design.html#design.less.friend
Allow access only from a friend code
Another useful technique to not expose too much in API is to give access to certain functionality (e. g. ability to instantiate a class or to call a certain method) just to a friend code.

Java by default restricts the friends of a class to those classes that are in the same package. If there is a functionality that you want share just among classes in the same package, use package-private modifier in definition of a constructor, a field or a method and then it will remain accessible only to friends.

Sometimes however it is more useful to extend the set of friends to a wider range of classes - for example one wants to define a pure API package and put the implementation into separate one. In such cases following trick can be found useful. Imagine there is a class item:

public final class api.Item {
    /** Friend only constructor */
    Item(int value) {
        this.value = value;

    /** API method(s) */
    public int getValue() {
        return value;
    /** Friend only method */
    final void addListener(Listener l) {
        // some impl
that is part of the API, but cannot be instanitated nor listened on outside of the friend classes (but these classes are not only in api package). Then one can define an Accessor in the non-API package:
public abstract class impl.Accessor {
    public static Accessor DEFAULT;

    static {
        // invokes static initializer of Item.class
        // that will assign value to the DEFAULT field above
        Class c = api.Item.class;
        try {
            Class.forName(c.getName(), true, c.getClassLoader());
        } catch (ClassNotFoundException ex) {
            assert false : ex;
        assert DEFAULT != null : "The DEFAULT field must be initialized";

    /** Accessor to constructor */
    public abstract Item newItem(int value);
    /** Accessor to listener */
    public abstract void addListener(Item item, Listener l);
with abstract methods to access all friend functionality of the Item class and with a static field to get the accessor's instance. The main trick is to implement the Accessor by a (non-public) class in the api package:
final class api.AccessorImpl extends impl.Accessor {
    public Item newItem(int value) {
        return new Item(value);
    public void addListener(Item item, Listener l) {
        return item.addListener(l);
and register it as the default instance first time somebody touches api.Item by adding a static initializer to the Item class:
public final class Item {
    static {
        impl.Accessor.DEFAULT = new api.AccessorImpl();

    // the rest of the Item class as shown above
Then the friend code can use the accessor to invoke the hidden functionality from any package:
api.Item item = impl.Accessor.DEFAULT.newItem(10);
impl.Accessor.DEFAULT.addListener(item, this);
posted @ 2006-01-05 21:01 罗明 阅读(407) | 评论 (0)编辑 收藏










本报讯  斑竹多id灌水是为了反恐 

1月4日 紫丁香站长lanslot在听证会上被问及:每个斑竹允许同时登陆3个帐号,免费获取 

bbs 八卦报消息:关闭bbs是为了刷水箱 

5月5日 紫丁香全面关闭,据紫丁香总管popstar称:由于战友灌水过多,导致紫丁香系统 






次重申了坚持“一个joke”政策。single, girl, man等版斑竹也纷纷表示“派独 

本报讯: single版不存在灌水行为。 



Re: popstar: 关闭bbs是为了刷水箱 



posted @ 2006-01-05 20:45 罗明 阅读(551) | 评论 (0)编辑 收藏

  function toServer(){
  var xml = "<root>"+
  var XMLSender = new ActiveXObject("Microsoft.XMLHTTP" );
  alert(XMLSender.responseText); //可处理后台返回的结果
  姓名:<input type="text" id="name" /><br>
  密码:<input type="text" id="pwd" /><br>
  <input type="button" value="登录" onclick="toServer()">
  java.io.BufferedReader br = request.getReader();
  String str = "";
  while (str != null) {
  str = br.readLine();
  process (str); //可通过任何语言实现解析XML,进行业务处理
  javax.servlet.ServletOutputStream sos = response.getOutputStream();
  sos.print("login success" );
  Open bstrMethod, bstrUrl, varAsync, bstrUser, bstrPassword
  Send varBody
  setRequestHeader bstrHeader, bstrValue
  bstrHeader:HTTP 头(header)
  bstrValue:HTTP 头(header)的值
  xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
  responseText :结果返回为字符串。
posted @ 2006-01-03 18:59 罗明 阅读(449) | 评论 (0)编辑 收藏

  • Content with Style: Fixing the Back Button and Enabling Bookmarking for AJAX Apps - Mike Stenhouse explains how to fix two of the more distracting problems with Ajax. These can be particularly problematic for users new to Ajax applications.  Since Ajax apps typically load into a single web page, it makes pressing the Back button meaningless or actually harmful.  And this breaks the browser usage model annoyingly.  Also, individual views of data in an Ajax application cannot have a URL or permalinks unless precautions are taken.  Mike does a great job covering how to reduce these problems.
  • Saving Session Across Page Loads Without Cookies, On The Client Side - Ajax virtuoso Brad Neuberg strikes again with a detailed explanation of how to deal with saving session information across page loads without relying on cookies.  This is important in larger applications which typically want to store more information than a cookie can hold.  Brad also has some terrific tools to deal with this as well (see AMASS below)
  • Call SOAP Web services with AJAX - By design, Ajax is a voracious consumer of web services like XML/HTTP, REST, and SOAP.  A great article at IBM's DeveloperWorks describes how to easily call SOAP web services from Ajax.  This is important because SOAP is a complex protocol that requires some familiarity to use.  While Ajax development tools like Atlas, General Interface, and Bindows will solve this by providing a SOAP stack, for many, hand development of back-end SOAP request is the only option right now to achieve interoperability with WS-I Basic Profile web services.
  • Ajax using only an image - Browsers and networks continue to get more secure and many configurations will not allow an Ajax application to use web services, and almost none of them will allow you to access a server other than the one the Ajax app loaded from.  Enter an elegant technique to solve this by using image URLs.  Not for the faint of heart, and certainly a possible security hole but a compelling solution nonetheless.

Ajax Tools and Libraries

  • TIBCO's General Interface - I've not used this Ajax development environment extensively yet but it apparently eats its own dog food and runs entirely inside a browser (which apparently must be Internet Explorer).  Supposedly containing an entire SOAP stack, a full-blown IDE, and numerous libraries, General Interface is one of the leading solutions in this space and can be downloaded and used today.  TIBCO cautions you not to use it for production apps yet, but my initial use was encouraging.
  • Microsoft Atlas - A serious contender in the Ajax IDE space (details here), Microsoft is planning for Atlas to be a heavy-duty, enterprise scale Ajax solution.  Integrated into Visual Studio 2005, Atlas is just a code name but expect that it will be a leading Ajax player from the get go and will live up to its name.
  • Dojo - Still in early release, the open source Ajax library, Dojo, is getting lots of attention from folks in the know.  Dojo is billed as a "powerful, portable, lightweight, and tested tools for constructing dynamic interfaces. Dojo lets you prototype interactive widgets quickly, animate transitions, and build Ajax requests with the most powerful and easiest to use abstractions available."  I haven't used it yet, but you can bet I will be soon.
  • Script.aculo.us - One of the very best Ajax visual effects libraries that I've used is the eponymous script.aculo.us.  Advertised as "Web 2.0 JavaScript", script.aculo.us has numerous effects and convenience tools, all built on nice, tight object-oriented abstractions.  I've used it and I can recommend it for its simplicity and reliability.
  • Bindows - Mind-blowing Ajax library for recreating the full richness of native applications, and includes a SOAP stack.
  • AMASS - Ajax gets good client-side storage.  A brilliant piece of work by Brad Neuberg, check out a description of how AMASS works here.
  • TrimQuery - A robust JavaScript database for Ajax.  When combined with AMASS above, neat things can really happen.

    Ruby on Rails

  • Ruby on Rails - Should probably be listed first, not down here.  The best lightweight, server-side Ajax framework out there today.  Note that Ajax pioneers and Web 2.0 leaders 37Signals sponsor this site and RoR is used by a great many successful Web 2.0 sites.

  • Log4Ajax - Many serious developers wouldn't switch to a new programming model without a Log4J equivalent and here it is.  Both traditional console as well as advanced logging support for Ajax is here today.  SourceForge site here.
  • Backbase - This IDE is getting good reviews but it apparently uses an abstraction layer like Morfik.  I haven't used it yet but I keep hearing about it.
  • Sajax - A good competent server-side framework featuring support for most common back-end languages like Perl, Python, Ruby and much more.

Note: The most complete Ajax framework listing I've seen available is here.

Ajax News and Resources

Ajax Developer's Journal

  • The Ajax Developer's Journal - Good sources of news for Ajax are still pretty scarce but that's starting to change in a big way.  SYS-CON has recently launched their Ajax Developer's Journal and has been working closely with Jesse James Garrett, who coined the term.  Expect lots of interesting and topical new articles and coverage on a regular basis.
  • Ajaxian - Dion Almaer and Ben Galbraith have been working on Ajaxian for a while now and it remains one of the very best sources for the latest Ajax news, tools, events, and general inspiration.

Critiques and Analysis of Ajax

  • Ajax Mistakes - This is Alex Bosworth's terrific analysis of the early problems with Ajax.  He a big believer in the technology and his Ajax-powered LiveMarks site is one of my absolute favorites.  A good place to start to understand some of the challenges with Ajax.
  • Fixing Ajax: XmlHttpRequest Considered Harmful - Some good coverage of why Ajax doesn't really enable the use of the services of other web sites without a lot of work.  This is a big barrier to leveraging Web 2.0's global services landscape.  This can be solved a number of ways however and the options are explored here.  The image URL solution a few paragraphs above is missing but otherwise this is an excellent summary.

    Ajax Network Constraints

  • 10 Places You Must Use Ajax - Alex is back and carefully enumerates the good places to use Ajax.  He also covers when to avoid it.  Excellent material for those learning how to design with Ajax.
  • Top 10 Reasons Ajax Is Here To Stay - Andre Charland nails it.  Though some folks dislike Ajax for a variety of reasons, here are some terrific positive motivations for using it today.

And don't forget to see what can be done with Ajax!  Check out these great new Ajax-enabled applications here.

posted Friday, 30 December 2005

posted @ 2006-01-03 11:42 罗明 阅读(481) | 评论 (0)编辑 收藏
这几天一直在写代码,struts架构 + jsp + javascript,都抽不出时间写Blog了。可能生活过得充实就很少会写Blog吧。能做自己喜欢的事,还能填满腰包,这估计就是最幸福的工作吧!要继续调试我的javascript了,学习ing
posted @ 2005-12-28 22:09 罗明 阅读(83) | 评论 (0)编辑 收藏
这几天一直在写代码,struts架构 + jsp + javascript,都抽不出时间写Blog了。可能生活过得充实就很少会写Blog吧。能做自己喜欢的事,还能填满腰包,这估计就是最幸福的工作吧!要继续调试我的javascript了,学习ing
posted @ 2005-12-28 14:10 罗明 阅读(130) | 评论 (0)编辑 收藏
第一个是XmallCharter, 何为Charter? 就是画图表的啦。Xmall吗?是我毕业后要开的公司的名字啊(这家伙又在yy了^_^)。

XmallCharter是一个基于JFreeChart库的图表软件,仿照PowerPoint里的图表功能,支持饼状图、域图、线状图、条形图、3D条形图等图表类型,100% Java Swing 代码,绿色软件,解压缩即可在Linux、W$等系统上运行。





第二个是XBlogger,一个基于Eclipse RCP的Blog客户端,是今年IBM校园科技创新竞赛的参赛作品,但是由于某些原因,最终没能提交(55~,早点回学校就好了)。本地数据库使用HSqlDB,目前只支持Blogger.com(.Text类型的也能支持,但还没加上,懒了)。本来应该有个Web Service中间层,以后可行的话可能会加上,基本架构和截屏如下(现在还没开源,完善一下先):





posted @ 2005-12-16 21:06 罗明 阅读(4651) | 评论 (4)编辑 收藏





           图 4. 均匀分割屏幕



图 5. 背景图片

背景图片的第一部分(32*32)表示地面,第二部分表示大海,第三部分表示天空。使用TiledLayer时,图片的索引是从1开始的(不是0,所以地面图像的位置是1,大海是2,天空是3)。TiledLayer类可以将图5分割成三张图片,然后用每张图片填充对应的方格。在这里,我们用三个 32*32大小图片填充5行5列的背景,部分代码如下:

// 加载图片
backgroundImg = Image.createImage("/tiledLayer1.gif");

// 创建TiledLayer背景
background = new TiledLayer(55, backgroundImg, 3232);


最后剩下的就是设置每个方格里放置的图像了。创建背景的所有代码都在createBackground()方法里,如下所示。在MyGameCanvas 类的start()里调用这个方法,然后在buildGameScreen()方法的最后添加background.paint(g),这使得 TiledLayer实例将自己绘制到屏幕上。

// 使用TiledLayer创建背景
private void createBackground() throws IOException
// 加载图片
    backgroundImg = Image.createImage("/tiledLayer1.gif");

// 创建tiledLayer背景
    background = new TiledLayer(55, backgroundImg, 3232);

// 布置图像的数组
    int[] cells = {
33333,  // 天空
        33333,  // 天空
        11111,  // 地面
        22222,  // 大海
        22222   // 大海

// 设置背景
    for(int i = 0; i < cells.length; i++)
int column = i % 5;
int row = (i - column) / 5;
        background.setCell(column, row, cells[i]);

// 设置背景位置
    background.setPosition(GAME_ORIGIN_X, GAME_ORIGIN_Y);



    图 6. 添加了背景的游戏截屏

posted @ 2005-12-16 19:58 罗明 阅读(1090) | 评论 (0)编辑 收藏
在奔波中我慕然回首 看看過去的年頭
曾經努力得到的所有 轉眼之間不停留
但你卻永遠在我的背後 承受壓力與憂愁
縱然是汗在流 嚐盡苦頭 還是陪我往前走

脆弱是令人容易跌倒 泛起失望的念頭
有誰甘心向現實低頭 還是無奈的接受
人總會有想哭的時候 你總會用你的雙手
悄悄的撫平了我的傷口 不會讓別人知道

你是我的溫柔 給我所有 代替了一切哀愁
不管天有多長 地有多久 無悔的為我守候

你是我的港口 讓我停留 停留在你的溫柔
縱使天也會荒 地也會老 愛是沒有盡頭
posted @ 2005-12-14 18:13 罗明 阅读(50) | 评论 (0)编辑 收藏

if you are using Linux, pls add yourself to this list on above site.

posted @ 2005-12-14 11:07 罗明 阅读(361) | 评论 (0)编辑 收藏
没想到这么容易,打开TSC, 默认选择RDP方式(另外两种RDPv5、VNC还没试过呢,待会试试,看效果怎样),填一些基本信息(我就填了ip地址、工作组名和计算机名),选择“Connect”连接,就弹出了熟悉的Windows登录框,下面是一个截屏:

posted @ 2005-12-13 10:22 罗明 阅读(2979) | 评论 (7)编辑 收藏
共14页: 上一页 1 2 3 4 5 6 7 8 9 下一页 Last