Monday, September 30, 2013

setup glassfish and roller

  • in .30
  • first disable jboss startup by "sudo update-rc.d -f jboss remove"
  • create glassfish user and group
  • mv glassfish to /usr/local/share/glassfish
  • chown to glassfish:galssfish
  • create a admin user and password:  ./asadmin change-admin-password
  • ./asadmin --host  30 --port 4848 enable-secure-admin to allow remote access to admin page
  • login to admin and change default http listener port to another number
  • copy mydql jdbc driver to /domains/domain1/lib/ext and roller-custom.properties to domain1/lib/classes.
  • add jdbc connection pool for roller and jdbc resource for jdbc/rollerdb
  • have to create the rollerdata dir in glassfish home and change the properties in roller-customer.properties
  • .have to install java jdk7 instead of using jre(jdk-7u40-linux-i586.gz)
  • sudo lsof -i tcp and found the job# for glassfish and kill it
  • scp the jdk
  • jdk-7u40-linux-i586.gz
  • sudo mv ./jdk1.7.0_40 /usr/lib/jvm/jdk1.7.0
  •  sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0/bin/java" 1
  • sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0/bin/javac" 1
  • sudo update-alternatives --install "/usr/bin/javac" "javaws" "/usr/lib/jvm/jdk1.7.0/bin/javaws" 1
  •  sudo chmod a+x /usr/bin/java
  •  sudo chmod a+x /usr/bin/javac
  • sudo chmod a+x /usr/bin/javaws
  • sudo chown -R root:root /usr/lib/jvm/jdk1.7.0
  • sudo update-alternatives --config java
  • sudo update-alternatives --config javac
  • sudo /etc/init.d/apparmor restart
  • edit /etc/profile.d/java.sh and put

"export JAVA_HOME=/usr/lib/jvm/jdk1.7.0

export PATH=$JAVA_HOME/bin:$PATH"

  • restart the server  and cd to glassfish/bin sudo ./asadmin craete-srevice
  • sudo chmod 755  /usr/local/share/glassfish/glassfish4/glassfish/lib/nadmin
  • start the GlassFish-domain1 service.

Sunday, September 22, 2013

glassfish 4 and roller 5.0.1

  • get tired of twisting  apache roller for jboss EAP,  decide to try glassfish 4.0
  •  downloaded and installed glassfish-4.0.zip  full java EE platform
  • unziped and copied mysql jdbc to the domain1/lib/ext
  • copied roller-custom.properties to domain1/clases
  • deployed the download roller-5.0.1-javaee.war
  • woala!!, it works.

Lessons learned:

I am not a Java App server guru, but worked more than 2 years with glassfish(3 then 4) and 3 years with jboss EAP(5, then 6)

a lot of applications downloaded from the internet(roller, nexus, and others) will work with glassfish without modification

for jboss, the apps  need spend some time painfully sniffing through the source code and a lot of time I have to give up and go back to use glassfish.

This is my first time use glassfish 4, and I did not notice a lot of change between 3 and 4, the speed is decent.

between jboss EAP 5 and EAP6, the change is radical and as a developer, a lot of things I did in EAP 5 are completely different in EAP6.

 

build roller 5.0.1 ro jboss eap 6.0

  • download the roller source and import existing Maven projects into eclipse
  • maven clean complie and install  roller-project(parent)
  • roller-core maven clean compile install with no problem
  • roller-planet-business stopped, change pom for guice. 

  <dependency>

  <groupId>com.google.inject</groupId>

  <artifactId>guice</artifactId>

  <version>3.0</version>

</dependency>

  • have to copy droptables.sql to  source/main/resource/sql
  • here are the missing dependency modificaton for roller-weblogger-business

<dependency>

  <groupId>com.google.inject</groupId>

  <artifactId>guice</artifactId>

  <version>3.0</version>

</dependency>

  <dependency>

            <groupId>net.oauth.core</groupId>

            <artifactId>oauth</artifactId>

             <version>20100527</version>

            <scope>compile</scope>

        </dependency>

 

        <dependency>

            <groupId>net.oauth.core</groupId>

            <artifactId>oauth-provider</artifactId>

             <version>20100527</version>

            <scope>compile</scope>

        </dependency>

  • added the net.oauth dependency to roller-weblogger-webapp and roller-weblogger-web and compliled them.
  • deployed roller-weblogger-webapp to jboss
  • tried a lot of things and installed jboss eap6.10, still not working

Saturday, September 21, 2013

maven nexus, apache roller

  • nexus on both 30 and 40.
  • downloaded source for roller and will try to install roller in jboss eap 6.0

Wednesday, September 11, 2013

Restore Roller Mydql Database


  • use ubuntu live cd  and choose " fix broken installation"
  • mount a usb to /media/external by choose the use from "sudo fdisk -l"
  • installed new ubuntu server 12.04 LTS from burned cd(tried usb and DVD not working).
  • installed mysql server after server started(LAMP won't work because of  dns issue of home).
  • mount usb and copy roller dir to /var/lib/mysql
  • sudo service mysql stop
  • sudo  chmod -R 660 /var/lib/mysql/roller/
  • sudo chmod 700 /var/lib/mysql/roller
  • sudo chown -R -f mysql:mysql /var/lib/mysql/roller
  • service mysql start
  • mysqlcheck --repair --all-databases
  • need to dump the roller db regularly, the weblogentry table is the most important.

mysql in ubuntu 12.04 LTS allow remote access

To expose MySQL to anything other than localhost you will have to have the following line uncommented in /etc/mysql/my.cnf and assigned to your computers IP address and not loopback
#Replace xxx with your IP Address 
bind-address        = xxx.xxx.xxx.xxx
Or add a bind-address = 0.0.0.0 if you don't want to specify the IP
Then stop and restart MySQL with the new my.cnf entry. Once running go to the terminal and enter the following command.
lsof -i -P | grep :3306
That should come back something like this with your actual IP in the xxx's
mysqld  1046  mysql  10u  IPv4  5203  0t0  TCP  xxx.xxx.xxx.xxx:3306 (LISTEN)
If the above statement returns correctly you will then be able to accept remote users. However for a remote user to connect with the correct priveleges you need to have that user created in both the localhost and '%'.
Before granting user access, you need to login MySQL. 
$ mysql -u root -p
CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'mypass';
CREATE USER 'myuser'@'%' IDENTIFIED BY 'mypass';
Then
GRANT ALL ON *.* TO 'myuser'@'localhost';
GRANT ALL ON *.* TO 'myuser'@'%';
If you don't have the same user created as above, when you logon locally you may inherit base localhost privileges and have access issues. If you want to restrict the access myuser has then you would need to read up on the GRANT statement syntax HERE If you get through all this and still have issues post some additional error output and the my.cnf appropriate lines.

Thursday, August 12, 2010

jsf, spring security and jstl




The following code get session spring security context and show log in name.

<--c:forEach items='${sessionScope}' var='p'>
<--ul>
<--li>Parameter Name: <--h:outputtext value="'${p.key}'/"><--/li>
<--li>Parameter Value: <--h:outputtext value="'${p.value}'/"><--/li>
<--/ul>
<--/c:forEach>
You logged in as <--h:outputtext value="${sessionScope.SPRING_SECURITY_CONTEXT.authentication.principal.username}">

-->


Tuesday, June 02, 2009

I delete my glassfish by accident from netbeans, so,I tried to put it back by using add server in netbeans, but the add server wizard won’t show up.

It turns out to be there is a bug with jdk6 update12 and netbeans, so I have to download and install jdk6 update11. And start netbeans from command line with jdk6u11.

Here is the command \dir\NetBeans 6.5\bin>netbeans.exe --jdkhome "\dir\jdk1.6.0_11"

now I can add my glassfish server back to netbeans

Friday, February 22, 2008

Java vs Python (Random thought)

Java 

Python 

Statically typed 

Dynamically typed 

Not compact, (through class)

Compact (scripting like)

GUI, swing, has a lot of nice widgets

Tkinter by default,

Bracket and semicolon

Colon and space

Javac compile into byte code

Command line interpreter

Parameter pass by value ( a value of reference to an object) 

Parameter pass by value( a value of reference to an object) 

  
  
  
  


 

Reference:

  1. python_java_side-by-side.html
  2. does java pass by reference or by value

Thursday, March 01, 2007

DSLR 有了LCD取景,已经不存在像差,DSLR的反光取景没有必要保留
我们先看LCD取景存在的弊端:
(1)LCD取景非常费电。
(2)LCD取景根据光线强弱自动调节感光度,使拍摄所得和实际所见不一致,特别是在光线较暗时。
(3)LCD取景要求机械快门一直打开,结果导致曝光动作繁琐,快门迟滞延长,不利于连拍和抓拍。 由于弊端(2)的存在,很多情况下不得不求助于光学取景器;但DC上的旁轴取景器又存在像差,这给拍摄带来了无法解决的难题。
所以从现在看来,保留反光取景还是很有必要的。
观点二、DSLR不是数码相机的终结者 这个观点笔者持同意态度。就是在目前,数码相机的种类也不是只有数码单反一种,还有DC和120数码后背等多种形态,只是众多不同类型的数码相机适用范围不同。它们有各自不同的市场定位。 再看DSLR的CCD(包括DC的),由于CCD对光线色彩没有识别能力,只能通过在一块CCD前增加低通滤波器来感应不同的颜色(R,G,B),红、绿、蓝三种颜色紧密排列,CPU再很据插值算法来还原得到图像,所以数码相机只是对外界模拟信号的数字化,并不是完整的记录,因此数码相机目前和传统相机的成像差距仍然存在。
有没有更好的办法改进提高数码相机模仿外界模拟信号的精度呢?答案是肯定的,比如应用于专业摄像机的3CCD技术。3CCD技术就是用3块CCD来分别感知如射光线的RGB三种色彩,再根据套色算法合成全彩图像。但要实现3CCD技术,目前的DSLR和DC的内部结构都不能满足(镜头后截距的限制),应此相机结构将发生彻底的改变,而先前的单反镜头也将不再适用。至于CCD/CMOS将来朝哪个方向发展,现在就不得而知了。或许现在盼望的135满画幅的尺寸到那时已经远不能满足需求。
新结构带来的不只是机身上的参数变更,影响更多的恐怕在于镜头生产商的镜头群。尼康,佳能,腾龙,适马等各镜头生产厂家,花费数十年到目前形成了规模庞大的通用镜头群,如果一旦单反相机由新机型取代,那么意味着,各镜头生产厂家必修更换生产线内容,重新开发一系列适用于新机型的镜头群,这个时间需要多久呢?2年?5年?10年?还是更长的时间?
我们玩摄影,应该从“利己”出发,而不应该从“不利他”出发。所谓“利己”和“不利他”就是说,选择有利于我们创作使用的相机,为我们所利用,而不是因为目前相机技术不够成熟而不用(如DSLR),更有甚者,认为购买使用DSLR是为DLSR生产商做试验,从思想上抵制DSLR;有这样想法的人最终只能是终日等待。俗话说,“临渊羡鱼,不如退而结网”,说的就是这个道理。

I am looking for a DSLR. This is something I find useful