public void onClick$downloadAgent(Event event){
try {
Filedownload.save("download/xxx.xls", "application/octet-stream");
} catch (FileNotFoundException e) {
System.out.println("FileNotFoundException:" + e.getMessage());
}
}
星期日, 3月 27, 2011
[ZK] How to download file in ZK
[Asp.Net] zip and unzip in asp.net using DotNetZip Library
If you want to create a zip in your asp.net.I suggests that you can use DotNetZip Libriay that is very easy to use.You can get more details in the following link :
DotNetZip Library
Create a downloadable zip within ASP.NET. This example creates a zip dynamically within an ASP.NET postback method, then downloads that zipfile to the requesting browser through Response.OutputStream. No zip archive is ever created on disk.
DotNetZip Library
Create a downloadable zip within ASP.NET. This example creates a zip dynamically within an ASP.NET postback method, then downloads that zipfile to the requesting browser through Response.OutputStream. No zip archive is ever created on disk.
public void btnGo_Click (Object sender, EventArgs e)
{
Response.Clear();
Response.BufferOutput= false; // for large files
String ReadmeText= "This is a zip file dynamically generated at " + System.DateTime.Now.ToString("G");
string filename = System.IO.Path.GetFileName(ListOfFiles.SelectedItem.Text) + ".zip";
Response.ContentType = "application/zip";
Response.AddHeader("content-disposition", "filename=" + filename);
using (ZipFile zip = new ZipFile())
{
zip.AddFile(ListOfFiles.SelectedItem.Text, "files");
zip.AddEntry("Readme.txt", "", ReadmeText);
zip.Save(Response.OutputStream);
}
Response.Close();
}
星期二, 3月 22, 2011
[Alfresco] Create your first web script
if you want to create customize web script in Alfresco.
You will need to understand:
You will need to understand:
- XML for expressing the Web Script description
- <basename>.<httpmethod>.desc.xml
- Optionally, JavaScript for writing Web Script behaviour
- <basename>.<httpmethod>.js
- Freemarker for rendering a Web Script response
- <basename>.<httpmethod>.<format>.ftl
星期日, 3月 20, 2011
[XSLT] XSLT Note
XSLT(Extensible StyleSheet Language Transformations)
XSLT是一種把XML文件轉換成XHTML文件或是其他的XML文件的語言。
XPath則是可以操控XML文件的語言,XSLT大量的使用此技術。
XSLT文件是利用stylesheet當作root element的XML文件
Reference:
XSLT Tutorial
XSLT是一種把XML文件轉換成XHTML文件或是其他的XML文件的語言。
XPath則是可以操控XML文件的語言,XSLT大量的使用此技術。
XSLT文件是利用stylesheet當作root element的XML文件
Reference:
XSLT Tutorial
星期三, 3月 16, 2011
[ZK] How to pass parameter to another zul page
Today i want to pass parameter to another zul page so i find the solution for using "Executions.createComponents".
arg - java.util.Map(Refer to ZK:The User Guide)
The arg argument passed to the createComponents method in the
org.zkoss.zk.ui.Executions class. It might be null, depending on how
createComponents is called.
It is the same as self.desktop.execution.arg.
params.put("name", "John");
Executions.createComponents("/my.zul", null, params);
Then, in my.zul,
...
Notice that arg is available only when creating the components for the included page, say
my.zul. On the other hand, all events, including onCreate, are processed later. Thus, if you
want to access arg in the onCreate's listener, use the getArg method of the
org.zkoss.zk.ui.event.CreateEvent class.
Testing code is the below:
In the a.zul composer.
In teh b.zul composer.(change_password.zul)
arg - java.util.Map(Refer to ZK:The User Guide)
The arg argument passed to the createComponents method in the
org.zkoss.zk.ui.Executions class. It might be null, depending on how
createComponents is called.
It is the same as self.desktop.execution.arg.
params.put("name", "John");
Executions.createComponents("/my.zul", null, params);
Then, in my.zul,
...
Notice that arg is available only when creating the components for the included page, say
my.zul. On the other hand, all events, including onCreate, are processed later. Thus, if you
want to access arg in the onCreate's listener, use the getArg method of the
org.zkoss.zk.ui.event.CreateEvent class.
Testing code is the below:
In the a.zul composer.
final Map<String, Object> map = new HashMap<String, Object>(0);
map.put("userid",detailsUser.getUserName() );
Window changepasswordWin = null;
changepasswordWin = (Window) Executions.createComponents(
"/admin/change_password.zul",
null,
map);
In teh b.zul composer.(change_password.zul)
Map<String, Object> args = null;
public void onCreate$changePasswordWin(Event e) throws Exception {
System.out.println("--ChangePassword changePasswordWin--");
CreateEvent ce = (CreateEvent) ((ForwardEvent) e).getOrigin();
this.args = ce.getArg();
System.out.println("pass userid:" + this.args.get("userid"));
//do something
//....
System.out.println("--/ChangePassword changePasswordWin--");
}
星期二, 3月 15, 2011
[ZK] Dynamic to add button and listen event
Button btnModify = new Button("Modify Password");
//parent is cell of row
btnModify.setParent(cell);
btnModify.setImage("/admin/images/btn/modify_key.png");
btnModify.addEventListener("onClick", new EventListener() {
public void onEvent(Event event) throws Exception {
//to do something
}
});
[ZK] Messagebox EventListener
捕捉Question Messagebox的事件
//popup messagebox
Messagebox.show("Are you sure?",
"Question", Messagebox.OK | Messagebox.CANCEL,
Messagebox.QUESTION, new EventListener() {
public void onEvent(Event event) throws Exception {
//if clicks ok to do something
if (((Integer) event.getData()).intValue() == Messagebox.OK) {
//to do something
}
}
});
星期五, 3月 11, 2011
[Java] Notes for Json in Java
在java中操作json,可從Json in java 下載source code,用eclipse重新build成jar檔。
Reference:
Json in Java
JSON in JAVA 的簡單程式範例
Reference:
Json in Java
JSON in JAVA 的簡單程式範例
星期四, 3月 10, 2011
星期五, 3月 04, 2011
PHP ZEND Framwork
http://blog.corausir.org/website-design/ausir-1219
http://www.jaceju.net/blog/archives/category/web-development/php/zend-framework/page/2
http://blog.wu-boy.com/2009/03/24/1060
http://www.jaceju.net/blog/archives/category/web-development/php/zend-framework/page/2
http://blog.wu-boy.com/2009/03/24/1060
星期二, 3月 01, 2011
[ZK] ZK Eclipse Setting
From: ZK Essentials/Working with the Sample Applications/Setting Up the Applications Using Eclipse
In the fifth step:
"Once the download is complete, go to Window > Preferences > ZK > ZK Packages, click Add File/Directory to add the ZK package downloaded"
The default ZK Package versioin is 3.6.3, so downloaded the latest one which is zk-bin-5.0.5.zip from zk downloads. Then keep following the fifth step to select the downloaded file and then the latest version could be displayed as an option.
In the fifth step:
"Once the download is complete, go to Window > Preferences > ZK > ZK Packages, click Add File/Directory to add the ZK package downloaded"
The default ZK Package versioin is 3.6.3, so downloaded the latest one which is zk-bin-5.0.5.zip from zk downloads. Then keep following the fifth step to select the downloaded file and then the latest version could be displayed as an option.
星期一, 2月 28, 2011
星期四, 2月 24, 2011
[Mysql] SP where in
DROP PROCEDURE IF EXISTS `simpleproc08`$$
CREATE PROCEDURE `simpleproc08`(IN param0 TEXT, OUT param1 INT)
BEGIN
SET @qry = CONCAT('SELECT COUNT(*) INTO @param1 FROM regions WHERE regions_id IN (', param0, ')');
PREPARE stmt FROM @qry;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET param1 = @param1;
END$$
DELIMITER ;
CALL simpleproc08('1, 2, 3', @a);
SELECT @a;
Result:
@a
------
3
CREATE PROCEDURE `simpleproc08`(IN param0 TEXT, OUT param1 INT)
BEGIN
SET @qry = CONCAT('SELECT COUNT(*) INTO @param1 FROM regions WHERE regions_id IN (', param0, ')');
PREPARE stmt FROM @qry;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET param1 = @param1;
END$$
DELIMITER ;
CALL simpleproc08('1, 2, 3', @a);
SELECT @a;
Result:
@a
------
3
星期三, 2月 23, 2011
[Alfresco] Authority
AuthorityDAOImpl.java
Language: Java
License: GPL
Copyright: (C) 2005-2007 Alfresco Software Limited.
LOC: 471
AuthorityServiceImpl.java
Language: Java
License: GPL
Copyright: (C) 2005-2007 Alfresco Software Limited.
LOC: 215
Reference:
Repository Cache Configuration
Repository Configuration
Language: Java
License: GPL
Copyright: (C) 2005-2007 Alfresco Software Limited.
LOC: 471
AuthorityServiceImpl.java
Language: Java
License: GPL
Copyright: (C) 2005-2007 Alfresco Software Limited.
LOC: 215
Reference:
Repository Cache Configuration
Repository Configuration
星期二, 2月 22, 2011
[Alfresco] Create a share site using Restful
Use restful api to create a share site.
option1:How to create a share site using the REST API ?
option2:The code is described as the following.I don't build it . XD
option1:How to create a share site using the REST API ?
option2:The code is described as the following.I don't build it . XD
星期一, 2月 21, 2011
[Alfresco] Create a share site
Use webscript to create share site.you can see the following link .
Creating Alfresco Share sites with JavaScript
Creating Alfresco Share sites with JavaScript
星期二, 2月 15, 2011
[Alfresco] Alfresco APIs Reference
if you want to use alfresco APIs to build costomized web application,those are some links as the following
Tips:Navigate to Web Script List:http://localhost:8080/alfresco/service/index
Tips:Navigate to Web Script List:http://localhost:8080/alfresco/service/index
- RESTful API (source code path:remote-api/config/alfresco/templates/webscripts/org/alfresco/*)
- 3.1 REST API
- Deployment REST API
- 3.0 REST API
- Repository RESTful API Reference
- 2.1 REST API
- 2.0 RESTful API
- OpenSearch
- REST Design Guidelines
- CMIS RESTful API Reference
- 3.4 JavaScript Services API
- JavaScript API Cookbook
- Java Foundation API
星期日, 1月 30, 2011
[Alfresco] Constants.java
Constants.java
Language: Java
License: GPL
Copyright: (C) 2005-2007 Alfresco Software Limited.
LOC: 74
Language: Java
License: GPL
Copyright: (C) 2005-2007 Alfresco Software Limited.
LOC: 74
[Alfresco] ContentModel.java
ContentModel.java
Language: Java
License: GPL
Copyright: (C) 2005-2007 Alfresco Software Limited.
LOC: 171
Language: Java
License: GPL
Copyright: (C) 2005-2007 Alfresco Software Limited.
LOC: 171
訂閱:
意見 (Atom)