Add New Root User in OpenDJ

Ever wondered how to add another directory administrator to OPenDJ? Here is how.
1. Create a file admin2.ldif
dn: cn=EMEN2 Admin,cn=Root DNs,cn=config
cn: EMEN2 Admin
sn: Admin
givenName: EMEN2
objectClass: inetOrgPerson
objectClass: person
objectClass: top
objectClass: ds-cfg-root-dn-user
objectClass: organizationalPerson
userPassword: juSugU4w
ds-cfg-alternate-bind-dn: cn=EMEN2 Admin
2. run the following command:
/path to opendj/bin/ldapmodify -h localhost -p 1389 -D "cn=Directory Manager" -w password_for_Directory Manager -a -f "admin2.ldif"

Setup SCR3310 V2.0 Smart Card Reader in Ubuntu 14.04 64Bit

Here I am going to demonstrate how to enable SCR3310 V2.0 smart card reader in Ubuntu 14.04 box.

Requirements

libusb and libusb-dev
pcsc-lite-1.8.11
Smart Card reader driver 64Bit
pcsc-tools (Optional)

Install

1.Install libusb and libusb-dev
sudo apt-get install libusb-1.0-0 libusb-1.0-0-dev
2.Download and install pcsclite
#download
wget https://alioth.debian.org/frs/download.php/file/3991/pcsc-lite-1.8.11.tar.bz2
tar jvxf pcsc-lite-1.8.11.tar.bz2
cd pcsc-lite-1.8.11/
#make sure that you have enable libusab and disable libudev
./configure --enable-libusb --disable-libudev
make
sudo make install
sudo make fix-rights

3. Download and install 64Bit card reader driver
wget http://support.identive-group.com/download/driver/scmccid_5.0.29_linux_64bit.tar.gz
tar zvxf scmccid_5.0.29_linux_64bit.tar.gz
cd scmccid_5.0.29_linux_64bit/
sudo ./install.sh
4.Start pcscd service
sudo /usr/local/sbin/pcscd

Test Card Reader

1. install pcsc_tools
#install
sudo apt-get install pcsc-tools
#scan card
pcsc_scan

"am_agent_init failed" during OpenAM Web Policy Agent starts up

Background

OpenAM was deployed on Apache Tomcat and Web Agent was deployed in httpd server. Both of them were running in the SAME CentOS server. Yes, I know you might laugh at me: SAME SERVER?
If start service one by by one from command line, there was no error in either the log file of web agent AGENT_DIR/apache22_agent/Agent_##/logs/debug/amAgent or on web pages which uses web agent service.
#Start service one by one
/OPENDJ_DIR/bin/start-ds
/TOMCAT_DIR/bin/startup.sh
/etc/init.d/httpd start 

However, there were errors when you put them either in one run file rc.local with the same run order or in the same order but separated using chkconfig.
#Same order in rc.local file:
OPENDJ_ROOT="/opt/sso/opendj"
TOMCAT_ROOT="/opt/sso/apache-tomcat-7.0.52"
export OPENDJ_ROOT
export TOMCAT_ROOT
cd ${OPENDJ_ROOT}
/bin/su - nctrsso -c "${OPENDJ_ROOT}/bin/start-ds --quiet"
cd ${TOMCAT_ROOT}
/bin/su - nctrsso -c "${TOMCAT_ROOT}/bin/startup.sh"
/etc/init.d/httpd start

Using chkconfig tool to set run order.
#same order but seperate using chkconfig
S11ssoopendj -> ../init.d/ssoopendj
S18ssotomcat -> ../init.d/ssotomcat
S99httpd -> ../init.d/httpd

Symptom

The error were, "403 forbidden" when you visited web page hosted on httpd which use web agent service and "am_agent_init failed" in amAgent log file.

#detailed amAgent error
2014-08-14 09:23:20.351    Error 4841:47170489365360 all: Connection::request() socket not available, error 20
2014-08-14 09:23:20.351    Error 4841:47170489365360 Agent Profile Service: isRESTServiceAvailable(): An error occured while doing naming request. HTTP error
2014-08-14 09:23:20.352    Error 4841:47170489365360 all: agent_worker_init() am_agent_init failed

If I restart httpd server now, both error will go away.
This makes me think that maybe it because when httpd starts and initiates web agent, Tomcat has not fully started yet. 

Checking time stamps of apache log file and amAgent log file, I knew Tomcat started to init on 9:23:22 till 9:24:20; and httpd started to init web agent on 9:23:20. These data prove I am right.


# key timing in tomcat log file
Aug 14, 2014 9:23:22 AM org.apache.catalina.core.AprLifecycleListener init
Aug 14, 2014 9:24:20 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 57158 ms
# key timing in httpd log file
2014-08-14 09:23:20.292       -1 4840:47170489365360 all: Version: 4.0.0-SNAPSHOT
Using ps auxcheck the start time also proves that httpd initiates before tomcat fully started.

Solution

Run these init processes in the same script, rc.local, and let the calling thread sleep 120 seconds before initiating httpd for now, until a better solution is found.

OPENDJ_ROOT="/opt/sso/opendj"
TOMCAT_ROOT="/opt/sso/apache-tomcat-7.0.52"
export OPENDJ_ROOT
export TOMCAT_ROOT
cd ${OPENDJ_ROOT}
/bin/su - nctrsso -c "${OPENDJ_ROOT}/bin/start-ds --quiet"
cd ${TOMCAT_ROOT}
/bin/su - nctrsso -c "${TOMCAT_ROOT}/bin/startup.sh"
sleep 120
/etc/init.d/httpd start
exit 0

Installing Oracle 11g R2 Express Edition on Ubuntu 14.04 64-bit Virtual Machine

I need Oracle APEX for one of my project. Instead of waiting for the company DBA configure a workspace for me, I decide to install a local copy of Oracle and APEX myself to familar with.This is part one: install Oracle on UBuntu 14.04 64Bit

Environment

Ubuntu 14.04 64Bit virtual machine
Oracle 11g R2 Express Edition (XE)

Requirement:

Please go over every item below to make sure that your system meets these requirements.

1). Oracle 11g R2 Express Edition may require up to 2GB swap space. please use free -m to verify that you have at least 2G swap space. If you do not have enough swap space, like in my case, then do the followings.

Figure 1. verify that you have enough swap space.

#switch to root
sudo su -
#create swap file on /swapfile
dd if=/dev/zero of=/swapfile bs=1024 count=1048576
mkswap /swapfile 
swapon /swapfile
#backup old fstab file and create a new one
cp /etc/fstab /etc/fstab.bak_`date +%N`
echo '/swapfile swap swap defaults 0 0' >> /etc/fstab
#enable all swap devices
swapon -a
#verify the new swap devices
swapon -s
free -m
2). Install alien for converting the downloaded installer from Red Hat format into Ubuntu-specific installer
sudo apt-get install alien libaio1
3). Configure Awk for compatibility
sudo ln -s /usr/bin/awk /bin/awk
4)Create the following folder if needed
sudo mkdir /var/lock/subsys
5). Create a special chkconfig script:
The Red Hat based Oracle 11gR2 XE installer relies on /sbin/chkconfig, which is not available in Ubuntu. This command will create a file /sbin/chkconfig to simulate the chkconfig tool.
sudo vim /sbin/chkconfig
copy and paste the following content into the newly created chkconfig file
#!/bin/bash
# chkconfig simulator for Oracle 11gR2 XE installer 
file=/etc/init.d/oracle-xe
if [[ ! `tail -n1 $file | grep INIT` ]]; then
echo >> $file
echo '### BEGIN INIT INFO' >> $file
echo '# Provides: OracleXE' >> $file
echo '# Required-Start: $remote_fs $syslog' >> $file
echo '# Required-Stop: $remote_fs $syslog' >> $file
echo '# Default-Start: 2 3 4 5' >> $file
echo '# Default-Stop: 0 1 6' >> $file
echo '# Short-Description: Oracle 11g Express Edition' >> $file
echo '### END INIT INFO' >> $file
fi
update-rc.d oracle-xe defaults 80 01
Save the above file and assign the appropriate execute privilege :
sudo chmod 755 /sbin/chkconfig
6). Fix /dev/shm to avoid having "cause ORA-00845: MEMORY_TARGET not supported on this system" error.

sudo rm -rf /dev/shm
sudo mkdir /dev/shm
sudo mount -t tmpfs shmfs -o size=2045m /dev/shm # whatever value showing in your free -m output.

Installation


1). Download Oracle 11gR2 Express Edition installer from Oracle official site. You need an account to be able to download.

2). Unzip and convert the rpm package to deb package
cd /opt/oracle_src
mv ~/Downloads/oracle-xe-11.2.0-1.0.x86_64.rpm.zip .
unzip oracle-xe-11.2.0-1.0.x86_64.rpm.zip
cd Disk1/
#prepare Ubuntu specific package
sudo alien -d -c oracle-xe-11.2.0-1.0.x86_64.rpm 
#it takes a while for the command to complete.
3). Now you are ready to install Oracle 11gR2 XE.
cd /opt/oracle_src/Disk1
sudo dpkg --install oracle-xe_11.2.0-2_amd64.deb

 Fig 2. Output from installing script
4) configure
sudo /etc/init.d/oracle-xe configure
sudo /etc/init.d/oracle-xe configure
Enter the following configuration information:
HttP port:8080
port used for database listener:1521
password for SYS and SYSTEM:tiger
Do you want Oracle XE to be startted on boot: yes
Congratulations, once you see the following figure.
Fig 3. Success configuration screen

5. Post-installation configuration
5.1 Set-up environmental variables : add the following lines to ~/.bashrc file
vim ~/.bashrc
#copy the following line to file .bashrc
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe
export ORACLE_SID=XE
export NLS_LANG=`$ORACLE_HOME/bin/nls_lang.sh`
export ORACLE_BASE=/u01/app/oracle
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LFigure 1. verify that you have enough swap space.D_LIBRARY_PATH
export PATH=$ORACLE_HOME/bin:$PATH
5.2 update environment variable
. ~/.bashrc
5.3 try logging into database
sqlplus sys as sysdba [tiger]
6. Use APEX The default APEX installed is Application Express 4.0.2.00.09, which could be reached at http://127.0.0.1:8080/apex

Question and solution 

1.Database configuration failed during configuration step."Database Configuration failed.Look into /u01/app/oracle/product/11.2.0/xe/config/log for details". When I look at these files, ORA-00845: MEMORY_TARGET not supported on this system was the main complain.
Solution:
1) Do step 6 in requirement section
2) then do these steps below
# get the pid of oracle, 3120 in my case
ps aux | grep oracle 
#kill oracle
sudo kill 3120
#check again to make sure that oracle is killed
ps aux | grep oracle 
#remove the installation
sudo dpkg --purge oracle-xe
rm -r /u01
rm /etc/default/oracle-xe
update-rc.d -f oracle-xe remove
5) re-run the installation step 3) and 4)

Firefox Always Crashes in Ubuntu

Recently Firefox always crashes in my Ubuntu box. By looking at the crash report I noticed that add-ons might have something to do with the crash. However, the problem is still there after removing/disabling all add-ons. I even tried to update Firefox, that does not solve the problem neither. I then tried remove all contents related to Firefox and reinstalled it, and it seems fix the problem for me.
sudo apt-get --purge remove firefox
rm -rf ~/.mozilla/firefox/
sudo rm -rf  /usr/lib/firefox*
sudo apt-get install firefox

How to Enable/Install SyntaxHighlighter in blogspot

1. Log into your blogger account and click the blog you want to operate.
2. Click "Template" label from left column
3. Click "Edit HTML" label.
4. in the opening window, locate close head tag: , and put the following contents before close head tag:

























5. Save template.
6. Put your Script or Code inside the PRE tags and define class with brush name in your blog post.But you have to make sure that the code you are going to put inside the PRE tag has to be escaped, like "<a>" has to be converted to &lt;a&gt;
To do so, you could use this site. Escape html code.

<pre class='brush:[brushname];'>
  <!--Put Your Code Here (must be HTML escaped)-->
 </pre>
7. Always edit your code in HTML view editor. After editing your content in another editor, always paste the edited content in HTML view mode too.

How to Ask an Effective Questions

In a conversation, when completing a research survey, being interviewed for a job or working on a homework assignment, you might find yourself presented with a series of closed-ended or open-ended questions. Close-ended questions are those which can be answered by a simple "yes" or "no," while open-ended questions are those which require more thought and more than a simple one-word answer.

Close-Ended Questions

If you can answer a question with only a "yes" or "no" response, then you are answering a close-ended type of question.

Examples of close-ended questions are:

Are you feeling better today?
May I use the bathroom?
Is the prime rib a special tonight?
Should I date him?
Will you please do me a favour?
Have you already completed your homework?
Is that your final answer?
Were you planning on becoming a fireman?
Should I call her and sort things out?
Is it wrong to want to live on my own at this age?
Shall we make dinner together tonight?
Could I possibly be a messier house guest?
Might I be of service to you ladies this evening?
Did that man walk by the house before?
Can I help you with that?
May I please have a bite of that pie?
Would you like to go to the movies tonight?
Is math your favorite subject?
Does four plus four equal eight?
Is that haunted house really scary?
Will you be going to Grandmother's house for Christmas?
Did Dad make the cake today?
Is there a Mass being held at noon?
Are you pregnant?
Are you happy?
Is he dead?

Close-ended questions should not always be thought of as simple questions that anyone can quickly answer merely because they require a yes or no answer. Close-ended questions can also be very complicated. For example, "Is 1 in binary equal to 1 in counting numbers?" is a close-ended question that not everyone would be able to quickly answer.

Open-Ended Questions

Open-ended questions are ones that require more than one word answers. The answers could come in the form of a list, a few sentences or something longer such as a speech, paragraph or essay.
Here are some examples of open-ended questions:
What were the most important wars fought in the history of the United States?
What are you planning to buy today at the supermarket?
How exactly did the fight between the two of you start?
What is your favorite memory from childhood?
How will you help the company if you are hired to work for us?
What do you plan to do immediately following graduation from college?
What types of decorations do you plan to have for your friend's birthday party?
What was your high school experience like?
How did you and your best friend meet?
What sites do you expect to see on your vacation?
How do you go about booking tickets for a flight?
What were the major effects of World War II for the United States?
How do you go about purchasing a home?
What is it like to live in the capital of Morocco?
What is the quickest way to get to the pet store in town?
Why is it that every time I talk with you, you seem irritated?
In what way do you feel I should present myself?
How do you manage to raise those children alone?
What is the matter with the people in that class?
Where are you going to find the time to write all those letters?
Why can't I come along with you?
What makes the leaves change color?
How exactly does one replace the screen to a cellular phone?
Although open-ended questions require lengthier responses than do close-ended questions, open-ended questions are not always more complicated. For example, asking "What are you planning to buy today at the supermarket?" may simply require the respondent to read off of a list.

When These Questions Are Used

Either type of question can be used in a wide variety of scenarios. However, if you're looking for a guide to liken these types of questions to, you can think of close-ended questions as multiple choice questions on a school exam and open-ended questions as short responses and essay questions on an exam.

Open-ended Questions

Open-ended questions require a response with more depth and a lengthier response. Open-ended questions are also helpful in finding out more about a person or a situation, whether it's during an interview, at a party, or when getting to know a new friend.

Close-ended Questions

Close-ended questions can be answered in only one word or very short phrase. Close-ended questions can also be used in the situations mentioned above, although they have the potential to end the conversation.

Here are examples of close-ended questions in these types of situations:
Would you like vanilla ice cream?
Have you ever met Joe before?
Where did you go to college?
What is your best quality?
Are you happy?
Do you enjoy your car?
Does your brother have the same interests as you?
Do you have a pet?
Do you like animals?
When is your birthday?
Do you like rain?
Now, here's some examples of these close-ended questions turned into open-ended questions - to keep the conversation going:
What is your favorite flavor of ice cream and why?
How did you meet Joe?
What do you feel was most beneficial about your college experience?
How can your top qualities help our company to thrive and grow?
What are some of the things that bring you the most joy?
Why did you decide to purchase a Volvo?
What interests do you and your brother share, and which interests do you not share?
Do you have a pet and what is your pet like?
Do you like animals and why?
When is your birthday and how do you like to celebrate?
Do you like rain and what do you usually do during rain storms?
From these examples, it is clear that close-ended questions are used to elicit a short, quick response, while open-ended questions are gateways into conversations.

Credit to: this site.

Datatable static image not found on the server

When you use ```datatables.min.css``` and ```datatables.min.js``` locally, instead of datatables CDN, you may have encountered that ```sort...