assuming jdk1.6.0 and Glassfish3.1.1 and NetBeans6.9.1 have been installed and your PC is online.
download JTrac2.1.0 source file jtrac-src-2.1.0.zip and unzip it;
open jtrac project within NetBeans;
delete jtrac project from NetBeans (don't delete it from disk);
re-open jtrac project within NetBeans;
resolve problem (most dependencies jars will be downloaded);
download following unresolved jars from website:
selenium-server-0.9.0.jar
selenium-java-client-driver-0.9.0.jar
manually install above artifscts in 'Test Libraries';
'Add Dependency'commons-logging into 'Libraries';
GroupId=commons-logging
ArtifactId=commons-logging
Version=1.0.3
excuting 'test' target should be fine now.
in the project property, add property 'maven.test.skip=true' to 'Run Project' action;
set GF3 as the server to run;
excuting 'test' target should be fine now.
Saturday, 18 February 2012
Wednesday, 21 December 2011
Web scraping
a computer software technique of extracting information from websites.
HtmlUnit is a headless web browser written in Java.
Selenium is a portable software testing framework for web applications.
JWebUnit is a Java-based testing framework for web applications.
JWebUnit and HtmlUnit both stub the browser, whereas Selenium runs inside the browser.
HtmlUnit is a headless web browser written in Java.
Selenium is a portable software testing framework for web applications.
JWebUnit is a Java-based testing framework for web applications.
JWebUnit and HtmlUnit both stub the browser, whereas Selenium runs inside the browser.
CAPTCHA
"Completely Automated Public Turing test to tell Computers and Humans Apart"
In other words, a computer administers a test to determine if the subject is or is not human.
In other words, a computer administers a test to determine if the subject is or is not human.
Saturday, 3 September 2011
如何运行Wicket示范程序?
安装JDK1.6, NetBeans6.9.1, GlassFish3.1.1, Maven2.2.1 (set it as the External Maven Home in NetBeans)
Wicket in Action
================
下载http://wicketinaction.googlecode.com/files/wicket-in-action-0.9-source.zip
解压wicket-in-action-0.9-source.zip (注意:路径中不得有空格)
在NetBeans中,打开该项目, 并为其选择GlassFish3服务器
'Clean and Build' (Maven 将下载有关的库并存放在\.m2\repository下)
如果报告jta-1.0.1B.jar缺失,可从http://download.java.net/maven/2/javax/transaction/jta/1.0.1B/下载后,在项目库里选择'Manual install artifact',将其安装在本地库里后,重新Build
运行
Enjoying Web Development with Wicket
====================================
下载http://agileskills2.org/EWDW/source.zip
解压source.zip (注意:路径中不得有空格)
在NetBeans中,逐个打开项目, 并为其选择GlassFish3服务器,同时在其pom.xml文件中<build>块内,添加如下内容:
<sourceDirectory>src/main/java</sourceDirectory>
<resources>
<resource>
<filtering>false</filtering>
<directory>src/main/java</directory>
<includes>
<include>**</include>
</includes>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
'Clean and Build' (Maven 将下载有关的库并存放在\.m2\repository下)
运行
Wicket in Action
================
下载http://wicketinaction.googlecode.com/files/wicket-in-action-0.9-source.zip
解压wicket-in-action-0.9-source.zip (注意:路径中不得有空格)
在NetBeans中,打开该项目, 并为其选择GlassFish3服务器
'Clean and Build' (Maven 将下载有关的库并存放在
如果报告jta-1.0.1B.jar缺失,可从http://download.java.net/maven/2/javax/transaction/jta/1.0.1B/下载后,在项目库里选择'Manual install artifact',将其安装在本地库里后,重新Build
运行
Enjoying Web Development with Wicket
====================================
下载http://agileskills2.org/EWDW/source.zip
解压source.zip (注意:路径中不得有空格)
在NetBeans中,逐个打开项目, 并为其选择GlassFish3服务器,同时在其pom.xml文件中<build>块内,添加如下内容:
<resources>
<resource>
<filtering>false</filtering>
<directory>src/main/java</directory>
<includes>
<include>**</include>
</includes>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
'Clean and Build' (Maven 将下载有关的库并存放在
运行
Monday, 15 August 2011
Friday, 8 July 2011
How to read and write Word/Excel 2007 files from C# programs?
(1) Add following references to your VS2008 project:
using Word = Microsoft.Office.Interop.Word;
using Excel = Microsoft.Office.Interop.Excel;
full spec of above packages can be found at:
Microsoft.Office.Interop.Word Namespace
Microsoft.Office.Interop.Excel Namespace
Alternatively, you can use the 'object browser' from VS2008 or F1 key online help
(2) create following object in your C# programs and work on them:
object oMissing = System.Reflection.Missing.Value;
Excel.Application oXL = new Excel.Application();
Excel._Workbook oWB = (Excel._Workbook)(oXL.Workbooks._Open("my_workbook.xlsx", oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing));
Excel._Worksheet oSheet = (Excel._Worksheet)oWB.Sheets["my_sheet"];
Excel.Range oRng = oSheet.UsedRange;
Word._Application oWord = new Word.Application();
Word._Document oDoc = oWord.Documents.Add(ref oMissing, ref oMissing, ref oMissing, ref oMissing);
oDoc.PageSetup.PaperSize = Microsoft.Office.Interop.Word.WdPaperSize.wdPaperA4;
oDoc.PageSetup.Orientation = Microsoft.Office.Interop.Word.WdOrientation.wdOrientPortrait;
oDoc.PageSetup.LeftMargin = oWord.MillimetersToPoints(15F);
oDoc.PageSetup.RightMargin = oWord.MillimetersToPoints(15F);
Word.Range wrdRng = oDoc.Bookmarks.get_Item(ref oEndOfDoc).Range;
Word.Table oTable = oDoc.Tables.Add(wrdRng, 1, num_of_cols, ref oMissing, ref oMissing);
(3) clean the objects afterward:
object oDoNotSave = Word.WdSaveOptions.wdDoNotSaveChanges;
oDoc.Close(ref oDoNotSave, ref oMissing, ref oMissing);
oWord.Quit(ref oMissing, ref oMissing, ref oMissing);
oWB.Close(oMissing, oMissing, oMissing);
oXL.Quit();
using Word = Microsoft.Office.Interop.Word;
using Excel = Microsoft.Office.Interop.Excel;
full spec of above packages can be found at:
Microsoft.Office.Interop.Word Namespace
Microsoft.Office.Interop.Excel Namespace
Alternatively, you can use the 'object browser' from VS2008 or F1 key online help
(2) create following object in your C# programs and work on them:
object oMissing = System.Reflection.Missing.Value;
Excel.Application oXL = new Excel.Application();
Excel._Workbook oWB = (Excel._Workbook)(oXL.Workbooks._Open("my_workbook.xlsx", oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing));
Excel._Worksheet oSheet = (Excel._Worksheet)oWB.Sheets["my_sheet"];
Excel.Range oRng = oSheet.UsedRange;
Word._Application oWord = new Word.Application();
Word._Document oDoc = oWord.Documents.Add(ref oMissing, ref oMissing, ref oMissing, ref oMissing);
oDoc.PageSetup.PaperSize = Microsoft.Office.Interop.Word.WdPaperSize.wdPaperA4;
oDoc.PageSetup.Orientation = Microsoft.Office.Interop.Word.WdOrientation.wdOrientPortrait;
oDoc.PageSetup.LeftMargin = oWord.MillimetersToPoints(15F);
oDoc.PageSetup.RightMargin = oWord.MillimetersToPoints(15F);
Word.Range wrdRng = oDoc.Bookmarks.get_Item(ref oEndOfDoc).Range;
Word.Table oTable = oDoc.Tables.Add(wrdRng, 1, num_of_cols, ref oMissing, ref oMissing);
(3) clean the objects afterward:
object oDoNotSave = Word.WdSaveOptions.wdDoNotSaveChanges;
oDoc.Close(ref oDoNotSave, ref oMissing, ref oMissing);
oWord.Quit(ref oMissing, ref oMissing, ref oMissing);
oWB.Close(oMissing, oMissing, oMissing);
oXL.Quit();
Thursday, 2 June 2011
如何开发JRuby+MySQL+Rails 3程序?
安装JDK 1.6
--------------------------
下载jdk-6u25-linux-x64.bin
chmod 700 jdk-6u25-linux-x64.bin
./jdk-6u25-linux-x64.bin
安装JRuby
--------------------------
下载jruby-bin-1.6.2.tar.gz
tar xvfz jruby-bin-1.6.2.tar.gz
安装GlassFish
-------------------------
下载glassfish-3.1.1-ml.zip
unzip glassfish-3.1.1-ml.zip
在.bash_profile中添加设置如下:
--------------------------
JAVA_HOME=$HOME/jdk1.6.0_25
JRUBY_HOME=$HOME/jruby-1.6.2
GLASSFISH_HOME=$HOME/glassfish3
PATH=$JAVA_HOME/bin:$JRUBY_HOME/bin:$GLASSFISH_HOME/bin:$PATH:$HOME/bin
export PATH JAVA_HOME JRUBY_HOME
重新登录
安装rails, jdbcmysql, glassfish gem, warbler
--------------------------
gem install rails activerecord-jdbcmysql-adapter glassfish warbler
创建MySQL用户
--------------------------
mysql -u root -p
mysql> create user duke@localhost identified by 'glassfish';
mysql> grant all on hello_development.* to duke@localhost;
mysql> grant all on hello_production.* to duke@localhost;
mysql> flush privileges;
创建hello程序
--------------------------
rails new hello -m http://jruby.org/rails3.rb -d mysql
cd hello
修改 config/database.yml中的MySQL用户名及口令
创建development数据库
-------------------------
rake db:create
rake db:migrate
创建production数据库
-------------------------
rake db:create RAILS_ENV='production'
rake db:migrate RAILS_ENV='production'
启动WEBrick (使用development数据库)
-------------------------
rails s
检查http://localhost:3000/是否正常
启动Glassfish gem(使用production数据库)
-------------------------
确认在/etc/hosts中,127.0.0.1映射到你的机器名(用hostname命令查看)
在 hello/Gemfile中添加gem 'glassfish'
(it is ok with development database)
glassfish hello
(there is a Routing Error: No route matches "/" with production database)
glassfish hello -e production
启动GlassFish(使用development数据库)
-------------------------
asadmin create-domain --portbase 2000 --domaindir . mydomain
asadmin start-domain --domaindir . mydomain
cd hello
warble
将hello.war放置到Glassfish上
--------------------------
下载jdk-6u25-linux-x64.bin
chmod 700 jdk-6u25-linux-x64.bin
./jdk-6u25-linux-x64.bin
安装JRuby
--------------------------
下载jruby-bin-1.6.2.tar.gz
tar xvfz jruby-bin-1.6.2.tar.gz
安装GlassFish
-------------------------
下载glassfish-3.1.1-ml.zip
unzip glassfish-3.1.1-ml.zip
在.bash_profile中添加设置如下:
--------------------------
JAVA_HOME=$HOME/jdk1.6.0_25
JRUBY_HOME=$HOME/jruby-1.6.2
GLASSFISH_HOME=$HOME/glassfish3
PATH=$JAVA_HOME/bin:$JRUBY_HOME/bin:$GLASSFISH_HOME/bin:$PATH:$HOME/bin
export PATH JAVA_HOME JRUBY_HOME
重新登录
安装rails, jdbcmysql, glassfish gem, warbler
--------------------------
gem install rails activerecord-jdbcmysql-adapter glassfish warbler
创建MySQL用户
--------------------------
mysql -u root -p
mysql> create user duke@localhost identified by 'glassfish';
mysql> grant all on hello_development.* to duke@localhost;
mysql> grant all on hello_production.* to duke@localhost;
mysql> flush privileges;
创建hello程序
--------------------------
rails new hello -m http://jruby.org/rails3.rb -d mysql
cd hello
修改 config/database.yml中的MySQL用户名及口令
创建development数据库
-------------------------
rake db:create
rake db:migrate
创建production数据库
-------------------------
rake db:create RAILS_ENV='production'
rake db:migrate RAILS_ENV='production'
启动WEBrick (使用development数据库)
-------------------------
rails s
检查http://localhost:3000/是否正常
启动Glassfish gem(使用production数据库)
-------------------------
确认在/etc/hosts中,127.0.0.1映射到你的机器名(用hostname命令查看)
在 hello/Gemfile中添加gem 'glassfish'
(it is ok with development database)
glassfish hello
(there is a Routing Error: No route matches "/" with production database)
glassfish hello -e production
启动GlassFish(使用development数据库)
-------------------------
asadmin create-domain --portbase 2000 --domaindir . mydomain
asadmin start-domain --domaindir . mydomain
cd hello
warble
将hello.war放置到Glassfish上
Subscribe to:
Posts (Atom)