Oct 29, 2010

Integrated Server

Alhamdulillah thanks for Alloh who has given His mercy to us till now. And also for people who support this project, beginning from our study club students which are keep struggle to realize our goals.

Designing this project has been imagined for along time. The real implementation of ICT for our school, which is become very large community and number of services that must be served. We was studied about amount of network, Linux operating system, wireless technology and also the real cases of ours here. Implementing our knowledge has begin, since we got high speed internet access.

The concept of this project is giving good serving actually on internet access with no breaking the religion rules. Some special configurations are needed to prevent users access prohibited sites.

All software that used on this project are open source. The configurations of this AAA server are customized for SMA Budi Utomo  only. Due to some features of Radius Server cannot run properly, we made some special scripts to handle many cases which not handled by AAA.

We setting up this for project with high-end technology to make it still applicable  for next expansion of ICT. For next step, we can merged such as SIPS (Voip Server), freeNAS (open source NAS implementation) , Kannel (GSM messaging system) to our existing server.

Next urgently needed is develop private website and micro-blog to support some features and also empower human resource in using ICT for teaching. Facing global growth of technology, especially to make micro-blog and private websites, our student and also teacher must familiar to our new system. Some features has been enabled to improve them, such as private samba file server with net-bios login for each teacher 1 Giga Byte quota.

We know that its not too prefect, sometimes we found any vulnerabilities of our system, especially in filtering many words related to porn term and many others. We try to make it best, but we need support from all users to give many suggestions to improve our system together.

check my ppt on  : http://www.slideshare.net/febru/integrated-server
Read more ...

Aug 17, 2010

maktaba shamela-like on Adobe Flex Error, Lidwa.com Error

New adobe flex application launching and bring the same concept of maktaba shamela in Indonesian version. It provide collection of hadiths on site with many features. Great to developer of this site. I am so appreciate with.


Its still in beta version but, i can see the strength, i think it would be better if the developer merge or make source of his data comes from shamela format, so the user  of shamela will also can use his shamela library on web easily.

When i use this site, it still appear any error, the message is here : 

[Error] Connection ioError [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032"][Error] Connection ioError [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032"]

I think Lidwa.com will fixed it latter ...  hopefully ..
but overall, good job for lidwa.com's team ...

and i hope it able to be copied to other format ...

Read more ...

Aug 7, 2010

[SOLVED] Spring Error on x64

Please give me suggestion about this problem,... iam working on this for 4 days
==

PRE-CONDITION :
1. LUCID / netbean 6.8 / x64 / oracle 10 / tomcat 6.0.20 / springFramework / iceFaces framework / hibernate 2.5
2. Oraclelistener + connection => (seems working properly)
3. phisical mem : 4 Gb, swap 8 Gb / centrino core 2 solo

modification :
1. tweak tomcat memory :
-Xmx512m -Xms512m -XX:PermSize=256m -XX:MaxPermSize=256m -XX:NewSize=128m
( http://spring-java-ee.blogspot.com/2010/07/tomcat-javalangoutofmemoryerror-permgen.html )

2. update connection post max on server.xml (let it accept more than 2 Mb)
<Connector URIEncoding="utf-8" maxPostSize="4097152" connectionTimeout="20000" port="8084" protocol="HTTP/1.1" redirectPort="8443"/>

3. update jasper-runtime and jasper-compiler with native jasper of tomcat (suggested by mr. Joko)

4. startup oracle, update oracle url to connect using DataManager, update oracleDialect (it seems working properly)


TAP POINT:
/home/febru/Downloads/INTI
/telkom/telkom-isc/OS3/nbproject/build-impl.xml:701:
<nbdeploy clientUrlPart="${client.urlPart}" debugmode="false" forceRedeploy="${forceRedeploy}"/>

PROBLEMS:
1. sometimes build => OK but cannot deploy => i do clean and re-build and restart tomcat
2. sometimes error memory => i need to kill force tomcat
3. build OK => Deploy => OK but i've got 404, or 500
5. cannot initialize ServletContainer

MEMORY DUMP:
$ free
total used free shared buffers cached
Mem: 3961232 3912696 48536 0 35344 629104
-/+ buffers/cache: 3248248 712984
Swap: 7815580 156452 7659128

$ top
top - 19:25:17 up 4:43, 3 users, load average: 2.55, 1.86, 1.74
Tasks: 224 total, 4 running, 220 sleeping, 0 stopped, 0 zombie
Cpu(s): 96.0%us, 4.0%sy, 0.0%ni, 0.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 3961232k total, 3919508k used, 41724k free, 36004k buffers
Swap: 7815580k total, 156444k used, 7659136k free, 623696k cached
 
1. tomcat log :

Jul 5, 2010 6:49:30 PM org.apache.catalina.core.ApplicationContext log
...INFO: Marking servlet jsp as unavailable
Jul 5, 2010 6:49:30 PM org.apache.catalina.core.StandardContext loadOnStartup
SEVERE: Servlet /docs threw load() exception
java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactoryat java.net.URLClassLoader$1.run(URLClassLoader.java:202)at java.security.AccessController.doPrivileged(Native Method)at java.net.URLClassLoader.findClass(URLClassLoader.java:190)at java.lang.ClassLoader.loadClass(ClassLoader.java:307)

Jul 5, 2010 6:49:30 PM org.apache.catalina.core.ApplicationContext log
INFO: Marking servlet jsp as unavailable
Jul 5, 2010 6:49:30 PM org.apache.catalina.core.StandardContext loadOnStartup
SEVERE: Servlet threw load() exception
java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactoryat org.apache.jasper.servlet.JspServlet.<init>(JspServlet.java:58)at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)

Jul 5, 2010 6:49:31 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
Jul 5, 2010 6:49:31 PM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
Jul 5, 2010 6:49:31 PM org.apache.catalina.core.ApplicationContext log
INFO: Marking servlet jsp as unavailable
Jul 5, 2010 6:49:31 PM org.apache.catalina.core.StandardContext loadOnStartup
SEVERE: Servlet /examples threw load() exception
java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactoryat org.apache.jasper.servlet.JspServlet.<init>(JspServlet.java:58)at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)

Jul 5, 2010 6:50:49 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
Jul 5, 2010 6:50:52 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.lang.OutOfMemoryError: PermGen space
Caused by: java.lang.OutOfMemoryError: PermGen spaceat java.lang.ClassLoader.defineClass1(Native Method)at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)at java.lang.ClassLoader.defineClass(ClassLoader.java:616)

Jul 5, 2010 6:50:54 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class com.sun.faces.config.ConfigureListener
java.lang.OutOfMemoryError: PermGen spaceat java.lang.ClassLoader.defineClass1(Native Method)at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)at java.lang.ClassLoader.defineClass(ClassLoader.java:616)at java.security.SecureClassLoader.defineClass(SecureClassLoader.
java:141)

Jul 5, 2010 6:58:26 PM org.apache.catalina.core.StandardContext loadOnStartup
SEVERE: Servlet /docs threw load() exception
java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactoryat org.apache.jasper.servlet.JspServlet.<init>(JspServlet.java:58)at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)at java.lang.reflect.Constructor.newInstance(Constructor.java:513)at java.lang.Class.newInstance0(Class.java:355)

INFO: Reading mappings from resource : ./os3/bussiness/hbm/Profile.hbm.xml
Jul 5, 2010 7:04:06 PM org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
INFO: Mapping class: os3.bussiness.beans.Profile -> profile
Jul 5, 2010 7:04:06 PM org.hibernate.cfg.Configuration addResource
INFO: Reading mappings from resource : ./os3/bussiness/hbm/Radius.hbm.xml
Jul 5, 2010 7:04:06 PM com.icesoft.faces.application.D2DViewHandler <clinit>
INFO:
ICEsoft Technologies, Inc.
ICEfaces 1.6.0 DR5
Build number: 8
Revision: 13974
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
APPLICATION LOG:

init:
deps-module-jar:
deps-ear-jar:
deps-jar:
...Created dir: /home/febru/Downloads/INTI/telkom/telkom-isc/OS3/build/web/WEB-INF/classes
Created dir: /home/febru/Downloads/INTI/telkom/telkom-isc/OS3/build/web/META-INF
Copying 1 file to /home/febru/Downloads/INTI/telkom/telkom-isc/OS3/build/web/META-INF
Copying 228 files to /home/febru/Downloads/INTI/telkom/telkom-isc/OS3/build/web
Copied 43 empty directories to 1 empty directory under /home/febru/Downloads/INTI/telkom/telkom-isc/OS3/build/web
library-inclusion-in-archive:
Copying 1 file to /home/febru/Downloads/INTI/telkom/telkom-isc/OS3/build/web/WEB-INF/lib
Copying 1 file to /home/febru/Downloads/INTI/telkom/telkom-isc/OS3/build/web/WEB-INF/lib
Copying 1 file to /home/febru/Downloads/INTI/telkom/telkom-isc/OS3/build/web/WEB-INF/lib
Copying 1 file to /home/febru/Downloads/INTI/telkom/telkom-isc/OS3/build/web/WEB-INF/lib

Copying 1 file to /home/febru/Downloads/INTI/telkom/telkom-isc/OS3/build/web/WEB-INF/lib
Copying 1 file to /home/febru/Downloads/INTI/telkom/telkom-isc/OS3/build/web/WEB-INF/lib
library-inclusion-in-manifest:
Created dir: /home/febru/Downloads/INTI/telkom/telkom-isc/OS3/build/empty
Compiling 567 source files to /home/febru/Downloads/INTI/telkom/telkom-isc/OS3/build/web/WEB-INF/classes
/home/febru/Downloads/INTI/telkom/telkom-isc/OS3/src/java/os3/backing/beans/speedyAccount/UsagePage.java:526: warning: [deprecation] getDate() in java.util.Date has been deprecated

stopdate.setDate(stopdate.getDate()+1);
/home/febru/Downloads/INTI/telkom/telkom-isc/OS3/src/java/os3/backing/beans/speedyAccount/UsagePage.java:526: warning: [deprecation] setDate(int) in java.util.Date has been deprecated

stopdate.setDate(stopdate.getDate()+1);
/home/febru/Downloads/INTI/telkom/telkom-isc/OS3/src/java/os3/backing/beans/speedyAccount/UsagePage.java:540: warning: [deprecation] getDate() in java.util.Date has been deprecated

if (isSearch && eksekusi) stopdate.setDate(stopdate.getDate()-1);
/home/febru/Downloads/INTI/telkom/telkom-isc/OS3/src/java/os3/backing/beans/speedyAccount/UsagePage.java:540: warning: [deprecation] setDate(int) in java.util.Date has been deprecated

home/febru/Downloads/INTI/telkom/telkom-isc/OS3/src/java/os3/services/assembled/impl/OS3UsageReportImpl.java:42: warning: [deprecation] setMonth(int) in java.util.Date has been deprecated

date.setMonth(mon-1);
/home/febru/Downloads/INTI/telkom/telkom-isc/OS3/src/java/os3/services/assembled/impl/OS3UsageReportImpl.java:43: warning: [deprecation] setDate(int) in java.util.Date has been deprecated

date.setDate(1);
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
16 warnings
Copying 106 files to /home/febru/Downloads/INTI/telkom/telkom-isc/OS3/build/web/WEB-INF/classes
RMI Compiling 1 class to /home/febru/Downloads/INTI/telkom/telkom-isc/OS3/build/web/WEB-INF/classes
compile:
compile-jsps:
Starting Tomcat process...
Waiting for Tomcat...
Tomcat server started.
In-place deployment at /home/febru/Downloads/INTI/telkom/telkom-isc/OS3/build/web
deploy?config=file%3A%2Ftmp%2Fcontext4975874327773052747.xml&path=/OS3
FAIL - Failed to deploy application at context path /OS3
/home/febru/Downloads/INTI/telkom/telkom-isc/OS3/nbproject/build-impl.xml:701: The module has not been deployed.
BUILD FAILED (total time: 1 minute 15 seconds)

HENDY's comment
Hendy Irawan
Feb,
1. yg WAR udah jadi ada gak? kalo ada, coba dicompare ke WAR hasil build. ada file yg kurang gak..?

2. ini pake NB ato Eclipse? nampaknya koq di situ pake NB. coba rebuild ulang project originalnya pake IDE aslinya. aslinya sndiri pake N...B/Eclipse? (kalo eclipse ada file .project, kalo NB ada folder nbproject)

3. di build process ada file yg kurang, tambahkan library commons-logging.jar sbg dependency.

root of the problem: format project aslinya apa (Eclipse/NB)? jgn bikin project baru cm dgn ngambil source, krn byk setting/dependencies dll. berasal dr project tsb.

MY ANSWER
Febru Wasono
‎@Hendy: thanks bro.
1. ada .war nya tp klo di deploy malah error, krn compatibilitas lib untuk jasper-runtime + jasper-compiler di awal tdk sama dgn yg ada di server (makanya Mas Joko saranin di replace)

2. ini di develop oleh bbrp org sebel...umnya dgn bbrpa IDE, terdekat dengan aku (di atasku) dia pk NB

3. common-looging + common-logging-api udah di tambahkan

4. klo ku lihat yg eclipse dia udah gak ada .project nya, itu lah alasannya knpa kmrin km saranin pk STS aku gak jadi pake, aku pake NB aja yg 1 jalur di atasku.

OS3 is operation support system for a telecom company which is handle many network devices to make provisioning.
SOLUTION

Pre Condition :
=========
Product Version: NetBeans IDE 6.8 (Build 200912041610)
Java: 1.6.0_20; Java HotSpot(TM) 64-Bit Server VM 16.3-b01
System: Linux version 2.6.32-22-generic running on amd64; UTF-8; en_US (nb)
Userdir: /home/febru/.netbeans/6.8
Linux x64.

Detected Problems
======
1. Java Aliasing for Java Development Kit on Netbean, some NB project maybe incompatible version with your NB, the new one, define that JDK Alias is "JDK 1.6 (Default)" and the old define as "JDK 1.6" , I don't know exactly why it makes different in compilation process since the ".war" also cannot running well on my tomcat (even it successful to be build).
2. tomcat 6.x use different library on jasper.

Solution Steps:
=========
A. Create new alias for Sun JDK to NB
1. Project Properties
2. Click libraries
3. Click manage platform
4. Add platform with name "JDK 1.6" and locate the folder location refers to your Sun JDK

B. Just use flat version of tomcat 5.X

Points
====
1. ensure that you use Java Sun
2. do not rebuild deployment configuration on NB (usually automatic re-generate)
3. use JDK Alias as "JDK 1.6"
4. use tomcat 5.x
Read more ...

[SOLVED] Hibernate Error [ORA-01000: maximum open cursors exceeded]

Enterprise application with many persistent cursors need special treatment to hold on. When you load too many HBMs with a cursor each connection, you must also provide persistent connection (especially with pooling mechanism)

[from IBM]
Typically, in Java, when an object goes out of scope, it is automatically garbage collected, but the Java specification does not place any specific requirements on the JVM regarding when (or even if) this will occur for any particular object. Therefore, do not rely on finalizers to close cursors. A finalizer is called when a class is garbage collected.

Explicitly close all cursors (e.g. ResultSet.close() and Statement.close()) when the cursors are no longer needed. This ensures that the corresponding server-side cursors are closed, preventing the ORA-01000 error.

The SQL_TEXT column can be queried in V$OPEN_CURSOR view to determine which cursors are not being closed. For example:

select sql_text from v$open_cursor;

Notes:
1. Typically, close() statements should be put in a finally clause of the try block.
2. There are known problems in certain versions of Oracle 8.1.6 JDBC drivers that can make this problem worse. The Oracle 8.1.7 JDBC driver or a later version should be used.
[end from IBM]

error : ORA-01000: maximum open cursors exceeded will happen on oracle 10 with persistent connection more than 1000. It will not appear on oracle 9 (as i tried on my first laptop). Explicitly you may use oracle 10 OJDBC pointed to oracle 9 to mock it do as oracle 9.

here's the example :

for oracle 10 you may use
<property name="dialect">org.hibernate.dialect.OracleDialect</property>

for oracle 9 you may use
<property name="dialect">org.hibernate.dialect.9OracleDialect</property>

both are use same driver. (ojdbc 14).

Short solution to solve this error is :
1. add to your Hibernate config
<property name="statement_cache.size">0</property>

2. remove your connection pooling

<!--
<property name="hibernate.c3p0.max_size">100</property>
<property name="hibernate.c3p0.min_size">10</property>
<property name="hibernate.c3p0.timeout">5000</property>
<property name="hibernate.c3p0.max_statements">100</property>
<property name="hibernate.c3p0.idle_test_period">300</property>
<property name="hibernate.c3p0.acquire_increment">2</property>
<property name="hibernate.c3p0.validate">false</property>
-->

and everything is working now... :D
next question is : "how to update my connection pool so it will work for more than 1000 connections ?"

Let's research about this... :)

note:
check the cursor
SELECT v.value as numopencursors ,s.machine ,s.osuser,s.username
FROM V$SESSTAT v, V$SESSION s
WHERE v.statistic# = 3 and v.sid = s.sid
Read more ...

Implementation of Z-Score on Scooring-System for lecturers.

Bagi para dosen dan atau para pemangku pelajaran dan atau yang berhubungan dengan sistem penilaian, mungkin metode ini bisa digunakan untuk membantu dalam hal penilaian.

Saya buat ini dulu (2007) krn ada masalah dalam hal scoring system.


Base-Case :

Ketika ada seorang dosen mengajar sehingga memeberikan score, ada standard yang berbeda tiap dosen, sehingga mungkin kalau si dosen A nilai rata2nya 4 dan dosen yang lain dengan subject yg sama bisa memberikan mean-score 8.
Di sisi institusi mereka punya standart yang sama, anggap aja institusi menginginkan mean-score nya minimal 7, So: how to change / convert raw score to the expected mean-score ?

Main-Idea :

ada beberapa cara untuk meng-convert sehingga nilai mean-nya akan menjadi 7, yaitu :
1. menambahkan unsur subjective dan kita tambahkan manual tiap anak (it will be hard and manual)
2. menambahkan nilai yg sama kepada tiap anak (akan terjadi ketidak-adilan)
3. pendekatan terbalik, dimana kita solved the problem dari ujung, dari expected-mean kita kembalikan ke belakang sehingga akan ketahuan kita butuh total tambahan nilai berapa yang akan di bagi untuk masing2 anak.

Case-by-Case:

1. on the first case problem : sering kali nilai subjective itu jadi sangat rumit krn gak hafal dan sulit untuk menghafal kebiasaan / kerajinan / kesopanan masing2 anak, sehingga kemungkinan mahasiswa yg "baong" tetep dpt subsidi score 'banyak" dan mungkin lebih banyak drpd mahasiswa yg "bageur"
Di sisi lain : akan menjadi sangat manual dimana dosen butuh tambah-kan score manually for each student. (gimana kalau students nya ratusan... O..ow)

2. Pada kasus ini, maka biasanya akan terjadi over-head score, yang mungkin saja si nilai tertinggi akan dpt nilai lebih dari 100, dan yang paling kecil akan tetep terlalu kecil kalau distribusi nya sempit atau terjadi banyak pencilan.

Kalau nilai tertinggi sudah tinggi, maka nilai penambahan berapa yang akan di tentukan untuk meng-upgrade nilai mereka akan menjadi satu persoalan tersendiri.

3. Pendekatan yg baik, pertanyaan berikutnya gmana cara membagi roti itu sehingga jadi adil ?,.. hmm... di sini saya ajukan 1 solusi dengan menggabungkan beberapa scoring-system.


New-Approach

1. pahami masalahnya adalah saya punya tambahan roti yg harus di bagikan, gmana cara pembagiannya agar adil ?, maka caranya adalah yg punya nilai tertinggi dia akan mendapat subsidi nilai terkecil, dan yang punya nilai terkecil akan dpt subsidi nilai terbesar dengan Rule bahwa secara urutan pola distribusinya tetep (urutan nilai dari yg tertinggi ke terendah akan tetep).
2. analisa pola distribusinya, ketika sempit maka akan terlalu susah untuk membagi "roti" itu, maka kita perlu perlebar dulu distribusinya (agar tidak terlalu banyak pencilan).
3. setelah pola nya di perlebar, baru di upgrade dengan metode terbalik. (kita pake pendekatan dari belakang), seperti ini caranya :
a. raw-score di lebarkan distribusinya selanjutnya di sebut X
b. raw-score di tambahkan nilai (dalam percentage of upgraded-score ) dari expected global-mean selanjutnya di sebut Y
c. nilai dari X+Y jadi nilai yang mature.

that's all, thanks.


you can download my slides on :
http://slidesha.re/97gjvL
implementation on excel on : http://slidesha.re/9rCnmk

you just need to input your students score (raw-score) and input your expected upgrade.
Read more ...

Jul 24, 2010

Java Accessing WSDL via HTTPS SSL

For along time i tried to make it accessible as easy as HTTP, but i 've got trouble many times, i tried 6 different access mechanism to use this service.
and now i solved the problem with this :

String address = ServicePoint.WSDL_LOCATION.toString();
JaxWsProxyFactoryBean proxyFactory = new JaxWsProxyFactoryBean();
proxyFactory.setServiceClass(ServicePointPortType.class);
proxyFactory.setAddress(address);
ServicePointPortType client = (ServicePointPortType) proxyFactory.create();
configureSSLOnTheClient(client);


next, you can call client.getBSfromCELL(MAC); or other services.

private static void configureSSLOnTheClient(Object c) {
org.apache.cxf.endpoint.Client client = ClientProxy.getClient(c);
HTTPConduit httpConduit = (HTTPConduit) client.getConduit();
try {
TLSClientParameters tlsParams = new TLSClientParameters();
tlsParams.setDisableCNCheck(true);
KeyStore keyStore = KeyStore.getInstance("JKS");
String trustpass = "changeit";
File truststore = new File("/trgwimax/client.keystore");
keyStore.load(new FileInputStream(truststore), trustpass.toCharArray());
TrustManagerFactory trustFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
trustFactory.init(keyStore);
TrustManager[] tm = trustFactory.getTrustManagers();
tlsParams.setTrustManagers(tm);
truststore = new File("/trgwimax/client.keystore");
keyStore.load(new FileInputStream(truststore), trustpass.toCharArray());
KeyManagerFactory keyFactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
keyFactory.init(keyStore, trustpass.toCharArray());
KeyManager[] km = keyFactory.getKeyManagers();
tlsParams.setKeyManagers(km);
FiltersType filter = new FiltersType();
filter.getInclude().add(".*_EXPORT_.*");
filter.getInclude().add(".*_EXPORT1024_.*");
filter.getInclude().add(".*_WITH_DES_.*");
filter.getInclude().add(".*_WITH_NULL_.*");
filter.getExclude().add(".*_DH_anon_.*");
tlsParams.setCipherSuitesFilter(filter);

httpConduit.setTlsClientParameters(tlsParams);
} catch (KeyStoreException kse) {
System.out.println("Security configuration failed with the following KSE: " + kse.getCause());
} catch (NoSuchAlgorithmException nsa) {
System.out.println("Security configuration failed with the following NSA: " + nsa.getCause());
} catch (FileNotFoundException fnfe) {
System.out.println("Security configuration failed with the following FNFE: " + fnfe.getCause());
} catch (UnrecoverableKeyException uke) {
System.out.println("Security configuration failed with the following UKE: " + uke.getCause());
} catch (CertificateException ce) {
System.out.println("Security configuration failed with the following CE: " + ce.getCause());
} catch (GeneralSecurityException gse) {
System.out.println("Security configuration failed with the following GSE: " + gse.getCause());
} catch (IOException ioe) {
System.out.println("Security configuration failed with the following IOE: " + ioe.getCause());
}

}

before running this script, you have to import key from server and register it on your local machine, It's mandatory, Java need to register the key as its certificate. Sometimes administrator just give you the key without certificate, so you need to convert it by yourself.

Remember that there are many certificate files on your machine but, the valid key is on $JAVA_HOME/jre/lib/security/cacerts so you need to add your key (after converted to certificate (PEM or CERT) to this file.

There are 3 default key parameters that you have to use to import it.
Key Type : default is JKS
Password : changeit
Alias : mykey, root, host-number such as 127.0.0.1-1

While you import the key, you need ensuring that your certificate file that you operate is the right one, it must be $JAVA_HOME/jre/lib/security/cacert

you may use keytool (portecle-1.5.zip) to export the JKS to PEM or CERT so you can add it to cacerts. The steps are :

1. use it as root

2. open file $JAVA_HOME/jre/lib/security/cacerts

3. import the JKS

4. sometimes you need to export it first to PEM or CERT

5. add the PEM or CERT into cacerts

6. save it.

some WSDL services are need to convert into String manually or just call getValue() before toString();
It's use to rid the xml elements that may still included.

i write it as my own note, so i don't need to make it later.
Read more ...

Mar 1, 2010

cpanel rubygems no such file to load gem A2hosting

Already make some script for a host with ruby, i 've got some trouble while deploy. I have no problem on my local but i got "no such file to load" however it already successfully installed.
Ensuring the installation,  i repeat my installation steps

gem install "module" -y

i move all cache file for gems to other path, you can also delete it.
mkdir mybackup
mv /home/your_username/ruby/gems/cache  mybackup

Cpanel said that i have to add this on my script, but it seems not solve the problem

$:.push("/home/your_username/ruby/gems")

so, i make change on .bashrc, i add some lines below
vim .bashrc
export PATH=.:$PATH:/home/your_username/ruby/gems/bin
export RUBYOPT=rubygems
export GEM_HOME=/home/your_username/ruby/gems
export GEM_PATH=/home/your_username/ruby/gems
export RUBYLIB=/home/your_username/ruby/gems/lib

logout to make bashrc be applied, then logged-in

check the script with irb
irb
>require 'rubygems'
>require 'hoe'
Read more ...

Jan 29, 2010

List Books Shamela Part 1

Its hard to fight The laziness. More than a month I search on Shamela books list, but I just have nothing, I decide to make a simple grabber to catch all list, just use 2 hours I get it all, create and wait until it finished the job.

Some parts  are grabbed yet, i will post later if alls ready. Just use this list first. Okay,... Let's use this technology to assist us closer to God. Recite and research on Islamic science are never ended.  :)

you can use downloader or just create a simple script on perl or ruby or phyton to make a thread-download .

Here's the simple example on Ruby :
Save this list bellow to books.list

create a simple script downloader.rb

File.open("books.list", 'r').each do |f|
    Thread.new do
            system("wget #{f}")
            sleep 1
  end
end


run it with
ruby  ./downloader.rb


cat books.list
http://www.shamela.ws/books/107/10772.rar
http://www.shamela.ws/books/107/10773.rar
http://www.shamela.ws/books/107/10769.rar
http://www.shamela.ws/books/107/10759.rar
http://www.shamela.ws/books/107/10786.rar
http://www.shamela.ws/books/106/10619.rar
http://www.shamela.ws/books/107/10776.rar
http://www.shamela.ws/books/018/1817.rar
http://www.shamela.ws/books/122/12286.rar
http://www.shamela.ws/books/105/10549.rar
http://www.shamela.ws/books/107/10781.rar
http://www.shamela.ws/books/108/10814.rar
http://www.shamela.ws/books/108/10816.rar
http://www.shamela.ws/books/124/12445.rar
http://www.shamela.ws/books/225/22549.rar
http://www.shamela.ws/books/211/21108.rar
http://www.shamela.ws/books/225/22547.rar
http://www.shamela.ws/books/211/21113.rar
http://www.shamela.ws/books/124/12446.rar
http://www.shamela.ws/books/086/8630.rar
http://www.shamela.ws/books/225/22579.rar
http://www.shamela.ws/books/226/22657.rar
http://www.shamela.ws/books/226/22643.rar
http://www.shamela.ws/books/075/7525.rar
http://www.shamela.ws/books/226/22661.rar
http://www.shamela.ws/books/122/12293.rar
http://www.shamela.ws/books/226/22642.rar
http://www.shamela.ws/books/123/12304.rar
http://www.shamela.ws/books/227/22721.rar
http://www.shamela.ws/books/113/11353.rar
http://www.shamela.ws/books/124/12444.rar
http://www.shamela.ws/books/225/22551.rar
http://www.shamela.ws/books/034/3485.rar
http://www.shamela.ws/books/226/22653.rar
http://www.shamela.ws/books/117/11730.rar
http://www.shamela.ws/books/227/22793.rar
http://www.shamela.ws/books/227/22798.rar
http://www.shamela.ws/books/227/22797.rar
http://www.shamela.ws/books/075/7509.rar
http://www.shamela.ws/books/075/7570.rar
http://www.shamela.ws/books/118/11821.rar
http://www.shamela.ws/books/075/7571.rar
http://www.shamela.ws/books/085/8553.rar
http://www.shamela.ws/books/228/22808.rar
http://www.shamela.ws/books/228/22812.rar
http://www.shamela.ws/books/228/22804.rar
http://www.shamela.ws/books/085/8570.rar
http://www.shamela.ws/books/228/22852.rar
http://www.shamela.ws/books/229/22915.rar
http://www.shamela.ws/books/023/2305.rar
http://www.shamela.ws/books/229/22916.rar
http://www.shamela.ws/books/228/22853.rar
http://www.shamela.ws/books/228/22868.rar
http://www.shamela.ws/books/228/22870.rar
http://www.shamela.ws/books/107/10784.rar
http://www.shamela.ws/books/228/22800.rar
http://www.shamela.ws/books/228/22855.rar
http://www.shamela.ws/books/228/22876.rar
http://www.shamela.ws/books/228/22848.rar
http://www.shamela.ws/books/228/22874.rar
http://www.shamela.ws/books/228/22869.rar
http://www.shamela.ws/books/025/2569.rar
http://www.shamela.ws/books/229/22918.rar
http://www.shamela.ws/books/064/6400.rar
http://www.shamela.ws/books/228/22886.rar
http://www.shamela.ws/books/208/20855.rar
http://www.shamela.ws/books/228/22842.rar
http://www.shamela.ws/books/208/20854.rar
http://www.shamela.ws/books/180/18007.rar
http://www.shamela.ws/books/228/22895.rar
http://www.shamela.ws/books/228/22891.rar
http://www.shamela.ws/books/228/22890.rar
http://www.shamela.ws/books/228/22889.rar
http://www.shamela.ws/books/228/22888.rar
http://www.shamela.ws/books/066/6610.rar
http://www.shamela.ws/books/123/12300.rar
http://www.shamela.ws/books/162/16231.rar
http://www.shamela.ws/books/162/16232.rar
http://www.shamela.ws/books/109/10906.rar
http://www.shamela.ws/books/228/22877.rar
http://www.shamela.ws/books/183/18381.rar
http://www.shamela.ws/books/032/3283.rar
http://www.shamela.ws/books/072/7268.rar
http://www.shamela.ws/books/227/22799.rar
http://www.shamela.ws/books/227/22726.rar
http://www.shamela.ws/books/229/22912.rar
http://www.shamela.ws/books/000/0041.rar
http://www.shamela.ws/books/187/18795.rar
http://www.shamela.ws/books/228/22882.rar
http://www.shamela.ws/books/225/22592.rar
http://www.shamela.ws/books/229/22921.rar
http://www.shamela.ws/books/229/22910.rar
http://www.shamela.ws/books/229/22934.rar
http://www.shamela.ws/books/229/22922.rar
http://www.shamela.ws/books/229/22928.rar
http://www.shamela.ws/books/225/22593.rar
http://www.shamela.ws/books/230/23023.rar
http://www.shamela.ws/books/226/22676.rar
http://www.shamela.ws/books/231/23163.rar
http://www.shamela.ws/books/231/23100.rar
http://www.shamela.ws/books/026/2615.rar
http://www.shamela.ws/books/231/23177.rar
http://www.shamela.ws/books/105/10500.rar
http://www.shamela.ws/books/236/23611.rar
http://www.shamela.ws/books/235/23586.rar
http://www.shamela.ws/books/097/9776.rar
http://www.shamela.ws/books/020/2037.rar
http://www.shamela.ws/books/021/2163.rar
http://www.shamela.ws/books/257/25791.rar
http://www.shamela.ws/books/033/3328.rar
http://www.shamela.ws/books/114/11421.rar
http://www.shamela.ws/books/257/25794.rar
http://www.shamela.ws/books/258/25800.rar
http://www.shamela.ws/books/263/26324.rar
http://www.shamela.ws/books/263/26332.rar
http://www.shamela.ws/books/130/13088.rar
http://www.shamela.ws/books/261/26142.rar
http://www.shamela.ws/books/271/27107.rar
http://www.shamela.ws/books/113/11314.rar
http://www.shamela.ws/books/007/0727.rar
http://www.shamela.ws/books/263/26356.rar
Read more ...

Jan 28, 2010

install maktaba shamela on Ubuntu

For you who use shamela on windows, meanwhile you can use it on Ubuntu Karmic (9.10). Just follow my steps.

Add to your repository
sudo vim /etc/apt/sources.list
deb http://ppa.launchpad.net/sabily.team/ppa/ubuntu karmic main
deb http://ppa.launchpad.net/awn-testing/ubuntu karmic main


sudo apt-get update
sudo apt-get install noor
sudo apt-get install thwab
sudo apt-get install ttf-arabeyes
sudo apt-get install ttf-me-quran


The shamela books are available to be downloaded on these site :

http://shamela.ws
http://almeshkat.net
http://saaid.net/book/index.php
http://www.almaktba.com

here's some instance book links :

http://www.shamela.ws/books/106/10657.rar
http://www.shamela.ws/books/106/10649.rar
http://www.shamela.ws/books/099/9904.rar
http://www.shamela.ws/books/091/9134.rar
http://www.shamela.ws/books/084/8474.rar
http://www.shamela.ws/books/106/10659.rar
http://www.shamela.ws/books/099/9950.rar
http://www.shamela.ws/books/085/8565.rar
http://www.shamela.ws/books/099/9938.rar
http://www.shamela.ws/books/099/9943.rar
http://www.shamela.ws/books/099/9942.rar
http://www.shamela.ws/books/106/10641.rar
http://www.shamela.ws/books/099/9948.rar
http://www.shamela.ws/books/099/9988.rar
http://www.shamela.ws/books/107/10765.rar
http://www.shamela.ws/books/107/10701.rar
http://www.shamela.ws/books/106/10695.rar
http://www.shamela.ws/books/107/10767.rar
http://www.shamela.ws/books/106/10660.rar
http://www.shamela.ws/books/059/5923.rar
http://www.shamela.ws/books/090/9075.rar
http://www.shamela.ws/books/042/4289.rar
http://www.shamela.ws/books/107/10756.rar

After download these books, extract it, then open it with thwab. (the extension file must be .bok)
Read more ...

Jan 27, 2010

load balancing Huawei C261 ISP Speedy

Let's make load balancing internet with ISP and Huawei C261. Just follow this steps

Make sure that ISP is ready on eth0 and C261 on ppp0, you can check my previous posting  about how to setup ppp connection on ubuntu karmic 9.10. On this case the ISP gateway is 192.168.1.1 and ppp0 connection is assigned by dhcp server.


$ ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 00:1e:33:22:4b:08 
          inet addr:192.168.1.3  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::21e:33ff:fe22:4b08/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:20472 errors:0 dropped:0 overruns:0 frame:0
          TX packets:24246 errors:0 dropped:0 overruns:0 carrier:1
          collisions:0 txqueuelen:1000
          RX bytes:14898826 (14.8 MB)  TX bytes:4689741 (4.6 MB)
          Interrupt:29



$ ifconfig ppp0
ppp0      Link encap:Point-to-Point Protocol 
          inet addr:10.10.8.107  P-t-P:10.17.4.12  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:3945 errors:5 dropped:0 overruns:0 frame:0
          TX packets:4302 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:3
          RX bytes:2596124 (2.5 MB)  TX bytes:842762 (842.7 KB)



$ cat /etc/resolv.conf
# Generated by NetworkManager
# nameserver 208.67.222.222   => if you want to use openDNS
nameserver 192.168.1.1
nameserver 10.17.3.244


On list above NS of ISP is 192.168.1.1 and NS of ppp0 is 10.17.3.244. Now to make it simple, just create a new file loadbalance.sh, just like this :

$ vi loadbalance.sh

#!/bin/bash
RP0=`ip addr show ppp0 | grep inet | awk {'print $4'} | cut -d '/' -f1`
ET0=`ip addr show eth0 | grep global | awk {'print $2'} | cut -d '/' -f1 | cut -d '.' -f1,2,3`.1

sudo ip route replace default scope global nexthop via $ET0  dev eth0 weight 200 nexthop via $RP0  dev ppp0 weight 10

echo "------------- load Balanced  $ET0 => $RP0 "
ip route show
route -n


save it and change permission by running
chmod +x loadbalance.sh

now run the script with sudo privilege


$ sudo ./loadbalance.sh
------------- load Balanced  192.168.1.1 => 10.17.4.12
10.17.4.12 dev ppp0  proto kernel  scope link  src 10.10.8.107
10.42.43.0/24 dev wlan0  proto kernel  scope link  src 10.42.43.1  metric 2
192.168.1.0/24 dev eth0  proto kernel  scope link  src 192.168.1.3  metric 1
169.254.0.0/16 dev wlan0  scope link  metric 1000
default
    nexthop via 192.168.1.1  dev eth0 weight 200
    nexthop via 10.17.4.12  dev ppp0 weight 10
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.17.4.12      0.0.0.0         255.255.255.255 UH    0      0        0 ppp0
10.42.43.0      0.0.0.0         255.255.255.0   U     2      0        0 wlan0
192.168.1.0     0.0.0.0         255.255.255.0   U     1      0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 wlan0
0.0.0.0         192.168.1.1     0.0.0.0         UG    0      0        0 eth0 


$ ping www.google.com
PING www.l.google.com (64.233.181.104) 56(84) bytes of data.
64 bytes from ni-in-f104.1e100.net (64.233.181.104): icmp_seq=1 ttl=53 time=89.1 ms
64 bytes from ni-in-f104.1e100.net (64.233.181.104): icmp_seq=2 ttl=53 time=276 ms
^C


okay just try it...  :)
Read more ...