Java如何取得營幕寬度?
import java.awt.Toolkit;
import java.awt.Dimension;
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
然後就可以透過screen.width和screen.height來取得螢幕的寬度與高度
如果要取得瀏覽器的寬度與高度, 則使用 getClientWidth() and getClientHeight() 就可以了.
[Java] 取得螢幕寬度
[Flex] about namespace 2.6 issue
[轉帖] 对于MySQL使用 GROUP_CONCAT 函数 的方式进行处理(非常简单)
[轉帖] git-upload-pack: command not found, how to fix this correctly
[轉貼] GWT – Browser window resized handler
Java如何取得營幕寬度?
import java.awt.Toolkit;
import java.awt.Dimension;
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
然後就可以透過screen.width和screen.height來取得螢幕的寬度與高度
如果要取得瀏覽器的寬度與高度, 則使用 getClientWidth() and getClientHeight() 就可以了.
Q:
Namespace 2.6 in the application descriptor file should be equal or higher than the minimum version 3.1 required by Flex SDK ????
A:
you need to replace <application xmlns="http://ns.adobe.com/air/application/2.6"> to <application xmlns="http://ns.adobe.com/air/application/3.1"> inside *-app.xml file.
I have been using git to keep two copies of my project in sync, one is my local box, the other the test server. This is an issue which occurs when I log onto our remote development server using ssh;
Q:
I am developing a GWT application that render a text on a canvas. I want to resize the canvas whenever browser window resized. The problem is if I used Window.addResizeHandler, the rendering process with each resize will be very slow. So I need a way to resize the canvas only when the user release the mouse button after finishing resize. Is there anyway to do that?
Q: Using GWT 1.6.4, I have the following code to retrieve the dimensions of the browser window:
RootPanel panel = RootPanel.get();
int height = panel.getOffsetHeight();
int width = panel.getOffsetWidth();
Now, in the Hosted Mode browser, and in IE (but I believe the hosted mode browser uses IE, right?), this returns the correct values for both width and height. However, in FF3, width gives the correct value, but height is always zero. Can anyone explain this? Am I doing something wrong? What is the correct way to retrieve the height of the window in Firefox, and is there one method that works correctly in both IE and Firefox?
We just changed our Subversion repository’s url from something terrible with custom port number hideousness to a URL so clean, concise and georgeous that I became brain damaged. The old URL still works but I wanted to repoint all my checked out code to the new URL. I tried switch and it didn’t work until Bret mentioned that Eclipse had something called relocate for this issue. A google search later…
Assume your personal repository is in the directory ~/proj. We first create a new clone of the repository and tell git-daemon that it is meant to be public:
$ git clone --bare ~/proj proj.git $ touch proj.git/git-daemon-export-ok
The resulting directory proj.git contains a "bare" git repository–it is just the contents of the ".git" directory, without any files checked out around it.
Next, copy proj.git to the server where you plan to host the public repository. You can use scp, rsync, or whatever is most convenient.
This is the preferred method.
If someone else administers the server, they should tell you what directory to put the repository in, and what git:// URL it will appear at.
Otherwise, all you need to do is start git daemon; it will listen on port 9418. By default, it will allow access to any directory that looks like a git directory and contains the magic file git-daemon-export-ok. Passing some directory paths as git-daemon arguments will further restrict the exports to those paths.
You can also run git-daemon as an inetd service; see the git daemon man page for details. (See especially the examples section.)
The git protocol gives better performance and reliability, but on a host with a web server set up, http exports may be simpler to set up.
All you need to do is place the newly created bare git repository in a directory that is exported by the web server, and make some adjustments to give web clients some extra information they need:
$ mv proj.git /home/you/public_html/proj.git $ cd proj.git $ git --bare update-server-info $ chmod a+x hooks/post-update
(For an explanation of the last two lines, see git update-server-info and githooks.)
Advertise the URL of proj.git. Anybody else should then be able to clone or pull from that URL, for example with a command line like:
$ git clone http://yourserver.com/~you/proj.git
Java 日期轉字串範列
1.//目前時間2.Date date = new Date();3.//設定日期格式4.SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");5.//進行轉換6.String dateString = sdf.format(date);7.System.out.println(dateString);
Java字串轉日期範例
1.//欲轉換的日期字串2.String dateString = "20010-03-02 20:25:58";3.//設定日期格式4.SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");5.//進行轉換6.Date date = sdf.parse(dateString);7.System.out.println(date);以上不支援 gwt, 若要在 gwt 字串日期互轉, 必須使用
GWT does not provide full emulation for the date and number formatting
classes (java.text.DateFormat, java.text.DecimalFormat,
java.text.NumberFormat, java.TimeFormat, et cetera). Instead, a subset
of the functionality of the JRE classes is provided by
com.google.gwt.i18n.client.NumberFormat and
com.google.gwt.i18n.client.DateTimeFormat
GWT provides the DateTimeFormat class to replace the functionality of
the DateFormat and TimeFormat classes from the JRE.
詳細用法, 請參考 http://code.google.com/intl/fr/webtoolkit/doc/1.6/DevGuideCodingBasics.html#DevGuideDateAndNumberFormat
參考資料: GWT官方文件 and http://cooking-java.blogspot.com/2010/03/java-string-to-date.html
Question:
I’m new to Java but not to programming (I normally code in Ruby). One thing I’ve seen in Java code examples is the use of <> instead of () to pass params to an object. Below is a code example (taken from a Google Web Toolkit tutorial):
publicvoid onValueChange(ValueChangeEvent<String> event){ String token = event.getValue(); // depending on the value of the token, do whatever you need ...}
Does it have to do with casting or is it something else? Can someone explain to me what this signifies or is used for? Thanks!