Wednesday, October 31, 2012

[WSO2] Deployment Synchronizer for Artifact Synchronization Between the WSO2 Cluster Nodes - Webinar slides

I and Pradeep did a webinar on Deployment Synchronizer feature of WSO2 products with focus on practical aspects with a demonstration on setting up a minimal wso2 cluster setup w/ Deployment Synchronizer enabled. This covers most of the details that are needed to know on this subject. I did the Demonstration while Pradeep Fernando covered the technical aspects.

You can view the slides from below.




You can see the details on this webinar at - http://wso2.org/library/webinars/2012/10/enterprise-use-case-webinar-wso2-depsync-data-synchronization-between-nodes-cluster/

The abstract goes as -

Setting up a cluster is important when developing enterprise software and deploying them in production environments. Distributing deployment artifacts & related metadata to all nodes in a homogeneous cluster is a typical requirement for a clustered deployment of any middleware platform. In such a cluster, all nodes should contain the deployed artifacts as well as the related metadata.

The Deployment Synchronizer (DepSync) is the mechanism used in the WSO2 platform for distributing these artifacts and metadata across all nodes in the cluster. It provides the ability to synchronize data between the worker nodes of a product cluster. When used with the WSO2 Application Server, or the WSO2 ESB, you can synchronize your deployable artifacts like web services, and web applications etc. across the cluster nodes. In addition, with the latest WSO2 Carbon 4 release, WSO2 provides the ability to synchronize service metadata which includes service policies, transports, and service-type specific data. Now you only have to deploy and configure services in one node - called the manager. Then, DepSync will replicate those to other nodes - workers.

In this webinar, we will present how this is done in the WSO2 Cloud-enabled middleware platform. Typical deployment artifacts will include webapps, JAXWS/JAXRS apps, data services, proxy services, and BPEL processes . The WSO2 platform also natively supports multi-tenancy. Tenants & tenant artifacts are loaded on demand. We will demonstrate how DepSync works efficiently with multi-tenancy.

Make sure to join Kasun Gajasinghe and Pradeep Fernando as they introduce DepSync which reduces the complexity of configuration management of a clustered deployment, and provides a consistent way to synchronize the cluster with zero downtime.




Monday, October 8, 2012

Clear QPid/Andes/Cassandra JMS Queues



This tutorial shows how to clear the JMS queues of Cassandra. It should be noted that this method clear all the queues; you can't clear queue of your selection. This is useful where you have sent a message, and while it's in the queue something went wrong. There could be errors in processing the message due to incorrect settings etc. Since the queues are accessed FIFO (First-In-First-Out), if a message is hanged in the queue, it'll also block all other messages in the queue because they waits until the first message is processed.

At WSO2, we use WSO2 Message Broker to connect with Cassandra via WSO2 Andes (extended version of QPid) while WSO2 ESB will utilize these to maximum use. Message Store and Message Processor mediators that comes with WSO2 ESB uses JMS queues extensively.


  • Shutdown all the servers if they are running
  • Open up Cassandra-HOME/conf/cassandra.yaml
  • Remember the log locations you have set. Typically, you would have set 
    • data_file_directories
    • commitlog_directory
    • saved_caches_directory
  • Delete all three files folders. (By default, these locations point to relevant child folder in Cassandra-HOME/logs/cassandra/)
It's all set. Now, start the cassandra and other servers. The queues will be cleaned. Actually, what  happens during this process is that it removes all the queues. When the servers start, they re-create the missing queues. That should be it! :)

Thursday, October 4, 2012

Carbon 4.0.0 - JMS Address endpoint URL format


This applies when you are using WSO2 ESB 4.5.0+ and WSO2 MB 2.0+. In WSO2 Message Broker 2.0, we use Andes as the message broker, an extended version of QPid.

The format to use when defining a JMS endpoint is like follows. Remember The configuration will be different if you are not using Andes.


jms:/MaterialMasterProxy1?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.wso2.andes.jndi.PropertiesFileInitialContextFactory&java.naming.provider.url=repository/conf/jndi.properties&transport.jms.DestinationType=queue



If you are want to create an address endpoint with JMS in WSO2 ESB 4.5.0, then it will look following.



 <endpoint name="MaterialMasterProxyEndpoint">
     <address uri="jms:/MaterialMasterProxy1?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&amp;java.naming.factory.initial=org.wso2.andes.jndi.PropertiesFileInitialContextFactory&amp;java.naming.provider.url=repository/conf/jndi.properties&amp;transport.jms.DestinationType=queue"/>
  </endpoint>


In ESB 3.0.1, we defined the address endpoints as follows.

jms:/MaterialGroupsProxy1?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&amp;java.naming.factory.initial=org.wso2.andes.jndi.PropertiesFileInitialContextFactory&amp;java.naming.provider.url=tcp://10.200.3.117:5682&amp;transport.jms.DestinationType=queue&amp;java.naming.provider.url=repository/conf/server.properties




Tuesday, October 2, 2012

[Linux] Copy files faster cp command


Every Linux user is familiar with file copy command, cp (copy). As an user who uses this frequently in a day, I can't help but wonder about possible alternatives to cp. CP is terrible when copying large number of files that are small in size. So, after digging in the internet, I found the following command to be a little more faster than cp command when it comes to copying smaller files.




tar cf - dir1 | (cd dir2; tar xf -)

With this, you can move an entire directory from dir1 to dir2. Here's an example.




tar cf - images/ | (cd /media/gentoo_/images/ tar xf -)


Monday, September 17, 2012

HOW TO INSTALL VLC 2.0 IN UBUNTU 11.10


Did you know that the latest VLC player version they can get is 1.1.12?  As of today, the most recent version available is 2.0.4 which is able to install from Ubuntu 12.04. So, VLC users have to either have to upgrade Ubuntu version, or be stick with an older 1.x versions.

But there is a way to install VLC via a PPA from VLC Daily Build of master branch. It's ppa:videolan/master-daily . I first tried ppa:n-muench/vlc, but it never worked for me. This worked flawlessly. The technically savvy people may now go ahead and install VLC by using this PPA. Others or if you are just interested, follow the instructions below to get it installed.

First enter the following command to add this PPA to your software sources


sudo add-apt-repository ppa:videolan/stable-daily


Now, you can update your software indexes, and install VLC.


sudo apt-get update && sudo apt-get install vlc


Now, you have a nice looking VLC at your hand. They say the performance is improved too among other new features. But I'm yet to test those! :-)


Wednesday, September 12, 2012

Linux commands I can not afford to lose



HTTP Requests -
GET - wget blog.kasunbg.org


GET request - curl --request GET http://localhost:9763/services/StudentService.StudentServiceHttpEndpoint/student/kasun




POST request - curl -d "age=01&name=kasun&subjects=unix" http://localhost:9763/services/StudentService.StudentServiceHttpEndpoint/student/kasun


SOAP POST request to a SOAP 1.2 endpoint -
curl -d '<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body><p:echoString xmlns:p="http://echo.services.core.carbon.wso2.org"><in>kasun</in></p:echoString></soapenv:Body></soapenv:Envelope>'   -H "Content-Type: application/soap+xml"    http://localhost:9443/services/echo


Other commands - PUT, DELETE


SCP - 
scp -r -P 2200 /home/kasun/docbook-webhelp/  kasun@example.com:/home/kasun/public_html/
rsync


grep -ri "example" ../../ --include "*xml" -A5 -B5
find ../.. -iname "*xml"
tail -f target/carbontmp/wso2as-4.1.0-SNAPSHOT/repository/logs/wso2carbon.log


Replace a given word with a new one from a set of files - Here, I'm replacing the word 'oldWord' with 'newWord' of a set of files that ends with .xml in the current folder.

find . -name "*.xml" -exec sed -i "s/oldWord/newWord/g" '{}' \;


to replace the word "<webXml>${basedir}/../../web.xml</webXml>" with newWord. Note the escape charater (\) before $ and /. Used : for easy writing.

find . -name "pom.xml" -exec sed -i "s:<webXml>\${basedir}/../../web.xml<\/webXml>:newWord:g" '{}' \;


Find running Java processes - ps ax | grep java
Kill a process - kill -9 <process-id>

Subversion
Get only the modified files - svn status | egrep  "^M"
Create patch - svn diff > my-contribution.patch
Apply patch - patch -p0 < my-contribution.patch

Extract files -
tar -xjf my-archive.tar.bz2
tar -xzf my-archive.tar.gz
unzip my-archive.zip

Get the disk usage of a directory, sorted - du -s ./* | sort -g
Shutdown - sudo shutdown -h now
Reboot - reboot

The archive reader - file-roller
PDF reader - evince
Partition editor - gparted

Find the VGA driver in the machine - lspci -v | grep -i vga
Find attached USB devices - lsusb

Only copy a set of symbolic links in the current directory, and copy those to a separate folder. I did this in Ubuntu.
cp `l -1 | grep -ri @ | grep -ri "[^@]*" -o` ../my-symlinks/ -P

l -1 | grep -ri @ | grep -ri "[^@]*" -o - Selects outputs the file names of the symlinks. Then we copy it using cp with the parameter -P. -P means that cp won't follow the symlinks.

Bash for loop - in one line

for file in `fn pom.xml`; do echo $file; done

iPhone

Mount in Linux/Ubuntu

ifuse <mount_point> --root   - Only add --root if the phone is jail broken. Only jail broken phones can access the root / location.
ifuse /mnt/iPhone --root



Wednesday, July 25, 2012

Install Wireless / USB HP Printer in Ubuntu



Installing/Verifying the Drivers

The HPLIP software

HPLIP is an interface developed by HP to give Linux printing, scanning and fax functionalities.
The last version available at the moment (2.8.9) supports 1.445 models of HP printers and most probably the printer you're going to install is listed there.
To be sure of this, you just need to check the page that contains the entire list of the supported printers.
After having identified your model of printer in the list, pay attention to the first parameter, Min. HPLIP Version, which represents the minimum version of HPLIP that you need.
Every Ubuntu system contains a version of HPLIP (i.e. mine is the 2.8.2) by default. To verify this, type the following command on terminal:

dpkg -l hplip


You shall get a message similar to this:


Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                                 Version                              Description
+++-====================================-====================================-========================================================================================
ii  hplip                                3.11.7-1ubuntu3.1                    HP Linux Printing and Imaging System (HPLIP)


If in the first column you read the "ii" characters, it means that the version showed in the third column is currently installed on your computer.
If the installed version of HPLIP is lower that the minimum version that you require, keep reading, or skip to the next paragraph about the installation of a printer.


Installing the Printer

Enter `sudo hp-setup -i` and follow the instructions accordingly. -i is for interactive mode.
Here, I have listed how my interactive conversion with hp-setup went. :-) I needed to setup a printer via wireless. Setting up the USB connection is also pretty easy.



$ sudo hp-setup -i

HP Linux Imaging and Printing System (ver. 3.11.7)
Printer/Fax Setup Utility ver. 9.0

Copyright (c) 2001-9 Hewlett-Packard Development Company, LP
This software comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to distribute it
under certain conditions. See COPYING file for more details.

(Note: Defaults for each question are maked with a '*'. Press <enter> to accept the default.)


--------------------------------
| SELECT CONNECTION (I/O) TYPE |
--------------------------------

  Num       Connection  Description                                            
            Type                                                                
  --------  ----------  ----------------------------------------------------------
  0*        usb         Universal Serial Bus (USB)                              
  1         net         Network/Ethernet/Wireless (direct connection or JetDirect)
  2         par         Parallel Port (LPT:)                                    

Enter number 0...2 for connection type (q=quit, enter=usb*) ? 1

Using connection type: net

Using device: hp:/net/HP_LaserJet_Professional_M1212nf_MFP?zc=NPI915B32


Setting up device: hp:/net/HP_LaserJet_Professional_M1212nf_MFP?zc=NPI915B32



------------------------
| PLUG-IN INSTALLATION |
------------------------


HP Linux Imaging and Printing System (ver. 3.11.7)
Plugin Download and Install Utility ver. 2.1

Copyright (c) 2001-9 Hewlett-Packard Development Company, LP
This software comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to distribute it
under certain conditions. See COPYING file for more details.

(Note: Defaults for each question are maked with a '*'. Press <enter> to accept the default.)

/
-----------------------------------------
| PLUG-IN INSTALLATION FOR HPLIP 3.11.7 |
-----------------------------------------

  Option      Description                                    
  ----------  --------------------------------------------------
  d           Download plug-in from HP (recomended)          
  p           Specify a path to the plug-in (advanced)        
  q           Quit hp-plugin (skip installation)              

Enter option (d=download*, p=specify path, q=quit) ? d

--------------------------
| DOWNLOAD CONFIGURATION |
--------------------------

Checking for network connection...
Downloading configuration file from: http://hplip.sf.net/plugin.conf
Downloading configuration: [\                                                                                                                      ] 0%  

-------------------
| DOWNLOAD PLUGIN |
-------------------

Checking for network connection...
Downloading plug-in from: http://www.openprinting.org/download/printdriver/auxfiles/HP/plugins/hplip-3.11.7-plugin.run
Downloading plug-in: [****************************************************************************************************************************] 100%  8.0 KB   Receiving digital keys: /usr/bin/gpg --no-permission-warning --keyserver pgp.mit.edu --recv-keys 0xA59047B9


----------------------
| INSTALLING PLUG-IN |
----------------------

Verifying archive integrity... All good.
Uncompressing HPLIP 3.11.7 Plugin Self Extracting Archive.........................................

HP Linux Imaging and Printing System (ver. 3.11.7)
Plugin Installer ver. 3.0

Copyright (c) 2001-9 Hewlett-Packard Development Company, LP
This software comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to distribute it
under certain conditions. See COPYING file for more details.

Plug-in version: 3.11.7
Installed HPLIP version: 3.11.7
Number of files to install: 36

You must agree to the license terms before installing the plug-in:

LICENSE TERMS FOR HP Linux Imaging and Printing (HPLIP) Driver Plug-in                                                                                                


These License Terms govern your Use of the HPLIP Driver Plug-in Software (the "Software"). USE OF THE SOFTWARE INCLUDING, WITHOUT LIMITATION, ANY DOCUMENTATION, IS    
SUBJECT TO THESE LICENSE TERMS AND THE APPLICABLE AS-IS WARRANTY STATEMENT. BY DOWNLOADING AND INSTALLING THE SOFTWARE, YOU ARE AGREEING TO BE BOUND BY THESE TERMS. IF
YOU DO NOT AGREE TO ALL OF THESE TERMS, DO NOT DOWNLOAD AND INSTALL THE SOFTWARE ON YOUR SYSTEM.                                                                      


1. License Grant. HP grants you a license to Use one copy of the Software with HP printing products only. "Use" includes using, storing, loading, installing, executing,
and displaying the Software. You may not modify the Software or disable any licensing or control features of the Software.                                            


2. Ownership. The Software is owned and copyrighted by HP or its third party suppliers. Your license confers no title to, or ownership in, the Software and is not a sale
of any rights in the Software. HP's third party suppliers may protect their rights in the Software in the event of any violation of these license terms.              


3. Copies and Adaptations. You may only make copies or adaptations of the Software for archival purposes or when copying or adaptation is an essential step in the    
authorized Use of the Software. You must reproduce all copyright notices in the original Software on all copies or adaptations. You may not copy the Software onto any
public network.                                                                                                                                                        


4. No Disassembly. You may not Disassemble the Software unless HP's prior written consent is obtained. "Disassemble" includes disassembling, decompiling, decrypting, and
reverse engineering. In some jurisdictions, HP's consent may not be required for limited Disassembly. Upon request, you will provide HP with reasonably detailed      
information regarding any Disassembly.                                                                                                                                


5. No Transfer. You may not assign, sublicense or otherwise transfer all or any part of these License Terms or the Software.                                          


6. Termination. HP may terminate your license, upon notice, for failure to comply with any of these License Terms. Upon termination, you must immediately destroy the  
Software, together with all copies, adaptations and merged portions in any form.                                                                                      


7. Export Requirements. You may not export or re-export the Software or any copy or adaptation in violation of any applicable laws or regulations.                    


8. U.S. Government Restricted Rights. The Software has been developed entirely at private expense. It is delivered and licensed, as defined in any applicable DFARS,  
FARS, or other equivalent federal agency regulation or contract clause, as either "commercial computer software" or "restricted computer software", whichever is      
applicable. You have only those rights provided for such Software by the applicable clause or regulation or by these License Terms.                                    


9. DISCLAIMER OF WARRANTIES. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, HP AND ITS SUPPLIERS PROVIDE THE SOFTWARE "AS IS" AND WITH ALL FAULTS, AND HEREBY      
DISCLAIM ALL OTHER WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED, OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF TITLE AND NON-INFRINGEMENT, ANY IMPLIED
WARRANTIES, DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR PURPOSE, AND OF LACK OF VIRUSES ALL WITH REGARD TO THE SOFTWARE. Some                
states/jurisdictions do not allow exclusion of implied warranties or limitations on the duration of implied warranties, so the above disclaimer may not apply to you in
its entirety.                                                                                                                                                          


10. LIMITATION OF LIABILITY. Notwithstanding any damages that you might incur, the entire liability of HP and any of its suppliers under any provision of this agreement
and your exclusive remedy for all of the foregoing shall be limited to the greater of the amount actually paid by you separately for the Software or U.S. $5.00. TO THE
MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL HP OR ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL,                                              
INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, BUT NOT LIMITED TO, DAMAGES FOR LOSS OF PROFITS OR CONFIDENTIAL OR OTHER INFORMATION, FOR BUSINESS          
INTERRUPTION, FOR PERSONAL INJURY, FOR LOSS OF PRIVACY ARISING OUT OF OR IN ANY WAY RELATED TO THE USE OF OR INABILITY TO USE THE SOFTWARE, OR OTHERWISE IN CONNECTION
WITH ANY PROVISION OF THIS AGREEMENT, EVEN IF HP OR ANY SUPPLIER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND EVEN IF THE REMEDY FAILS OF ITS ESSENTIAL    
PURPOSE. Some states/jurisdictions do not allow the exclusion or limitation of incidental or consequential damages, so the above limitation or exclusion may not apply to
you.                                                                                                                                                                  

Do you accept the license terms for the plug-in (y=yes*, n=no, q=quit) ? y

Done.

Done.

---------------------
| PRINT QUEUE SETUP |
---------------------

warning: One or more print queues already exist for this device: 59-4th-floor-HP-LaserJet-M1212nf.

Would you like to install another print queue for this device (y=yes, n=no*, q=quit) ? y

Please enter a name for this print queue (m=use model name:'HP_LaserJet_Professional_M1212nf_MFP'*, q=quit) ?
Using queue name: HP_LaserJet_Professional_M1212nf_MFP
Locating PPD file... Please wait.

Found PPD file: drv:///hpcups.drv/hp-laserjet_professional_m1212nf_mfp.ppd
Description:

Note: The model number may vary slightly from the actual model number on the device.

Does this PPD file appear to be the correct one (y=yes*, n=no, q=quit) ?
Enter a location description for this printer (q=quit) ?
Enter additonal information or notes for this printer (q=quit) ?4th floor printer

Adding print queue to CUPS:
Device URI: hp:/net/HP_LaserJet_Professional_M1212nf_MFP?zc=NPI915B32
Queue name: HP_LaserJet_Professional_M1212nf_MFP
PPD file: drv:///hpcups.drv/hp-laserjet_professional_m1212nf_mfp.ppd
Location:
Information: 4th floor printer


-------------------
| FAX QUEUE SETUP |
-------------------


Please enter a name for this fax queue (m=use model name:'HP_LaserJet_Professional_M1212nf_MFP_fax'*, q=quit) ?q
OK, done.

Sunday, July 8, 2012

How to share 3G Internet connection on Ubuntu

I've been looking everywhere, reading tens of articles on how to share internet connection using WiFi via my 3G internet connection. I wanted connect my iPhone 3GS to Ubuntu Wifi such that I can download apps larger than 20MB easily. Finally, I found this post in ubuntu forum that fixed the my issue. Things were straight forward, so nothing big to worry. Though the post is for 9.10, it worked in Ubuntu 11.10 for me. http://ubuntuforums.org/archive/index.php/t-1384085.html

I'd like to keep things in one place for later reference, so I'm stating it here with some customizations.

I tried this with Huawei E173 3G modem, and the Wireless connection of my laptop.
Here,
3G modem -  accesses internet.
Wireless (WiFi) AdHoc network - for sharing the internet connection with other computers.

You'll need only need Firestarter. The Operating System I tested is Ubuntu 11.10 (Oneiric Ocelot).

Type in the terminal
`sudo apt-get install firestarter`


This guide assumes a basic understanding of ip addresses...gateways dns servers etc.

This solution does not provide dhcp ....but hey I don't want that anyway.

Make sure your 3G modem, and wireless card already works (may be on windows or OS X).... if not install their software and activate your card...verify it works etc...

Now plug the card into the ubuntu box and set it up with network-manager. Right click the connection and select new cdma modem (or similar) and input your details as neccesary. This is for the MODEM.

Once connected unplug any ethernet...turn off any wifi and verify you have internet access.

Then right click the network manager icon and select "Create New Wireless Network" to create an ad-hoc wifi connection. There, given a network name you prefer (say MyWifi). Set Wireless security to "WEP 40/128-bit...", and give a 5 letter key/password (0-9A-Z).

Now, go to network-manager -> "Edit Connections". In the Wireless tab, you'll find your wireless connection (MyWifi). Select it, and click on edit.

Then click ipv4 settings tab

Change from dhcp to manual and enter the following details

address = 192.168.13.1
netmask = 255.255.255.0
leave gateway blank

That's done. Now, start firestarter. 
`gksudo firestarter`

Use the wizard and select ppp0 as your internet device. You may want to set `IP Address assigned via DHCP` for this connection if that's the case. Check with your ISP for more info.

Select connection sharing and then use wlan0 as your sharing device. This is the your wifi network device. We don't need dhcp here. 

Connect to MyWifi connection, and to your 3G broadband connection.

Now, start firestarter firewall...

Now configure your iPhone/another computer to use this gateway in Static tab ..

set your ip address to be 192.168.13.101
netmask 255.255.255.0
router (or default gateway) 192.168.13.1

IMPORTANT you need to enter DNS servers... I used Google DNS. You may use openDNS if you need. The Google DNS I set was.

8.8.8.8

If you really want OpenDNS, register for their free service, and use these DNS addresses. 208.67.222.222,208.67.220.220

Thats it!

Save everything and you should have a working internet connection that is shareable! obviously everyone needs their own ip address and setup is a little cumbersome but hey it works!

if you want dhcp you can probably get this to work using ubuntu server, wvdial, and the great help by googling ubuntu easyrouter.

but hey this works for me....and I like having network manager deal with the usb modem.

Have a good day. Welcome your thoughts/questions in the comments section. :-)

Saturday, June 9, 2012

Speed Up 3G Broadband in Sri Lanka



Here I'm providing an optimal solution to have a faster 3G broadband connection in Ubuntu/Linux. As  many of you have experienced, the connection speed is really bad especially at peak times in most of the 3G networks. Here I'm providing  a set of configurations I have tried that seems to work great. This way, you will be able surf only on 3G (UMTS/HSPA) without falling back to slower protocols like EDGE. Further, this will reduce the domain look-up time, and speed up authentication.

The settings were configured using network-manager that comes with Ubuntu by default. The network-manager is available at the systray (top-right corner of top panel). The instructions are for Dialog Service Provider in Sri Lanka, but apply for other providers with minor changes. I have adopted some of these using resources 1, and 2.

Now, click on the network-manager icon in systray, and go to "Edit Connections...". This will open up a dialog box that looks like the following. I have selected the "Mobile Broadband" tab here.

If you want to optimize an existing connection, click on Edit to open the edit window. Otherwise, create a new connection which will open the edit window as well.




There are three tabs which you can change.

  1. PPP Settings tab - Click on "Configure Methods...". Uncheck all the checkboxes except PAP. Click on OK.




2. Mobile Broadband tab - For Type: field, select 3G (UMTS/HSPA). The Number field should be "*99#", and the APN should be Dialogbb which are the defaults.




3. IPv4 Settings tab - For DNS Servers, enter 8.8.8.8, 8.8.4.4 . These are for the DNS service provided by Google. There are alternatives like OpenDNS as well. Resources for these available in web, and these two are quite reliable.







Tuesday, May 15, 2012

Setup WSO2 Deployment Synchronizer in WSO2 Application Server

This post describes how to setup Deployment Synchronizer for a WSO2 Application Server cluster. The process would be the quite the same for WSO2 Enterprise Service Bus (ESB) as well. Here, we are going to have two AS cluster nodes (master, and one slave) with a shared registry (WSO2 Governance Registry).

Deployment Synchronizer (DepSync) is a recent addition to WSO2 products. It provides the ability to sync the product cluster. We use it to keep the axis2 repository of our products (by default, it's product-home/repository/deployment/server/) in sync between all the cluster nodes. Since axis2 repository includes the user-uploaded service archives, modules, service metadata etc, it's important that all the cluster nodes have the same content. DepSync takes care of this.

Pre-requisites:
WSO2 Application Server 4.1.2+, and Goverance Registry.

  • First, follow the instructions in Application Server documentation on Clustering Configuration to setup a basic cluster environment.  Usually, you will need a shared registry for your production deployment. But for testing purposes of WSO2 Application Server, you may ignore this step. This is needed for DepSync in WSO2 ESB though.
  • Enable the "State Replication Configuration" for both nodes as shown here. That is  done by setting the enable attribute value of clustering element to true in axis2.xml file. axis.xml file can be found at AS-HOME/repository/conf/axis2.xml (Starting from AS 4.5.0 ( 4.1.2+) the axis2.xml is located at AS-HOME/repository/conf/axis2/axis2.xml)

<clustering class="org.apache.axis2.clustering.tribes.TribesClusteringAgent" enable="true">

  • Now, you have a Master AS node, a Slave AS node, and a shared registry. The Master node will act as a Registry Read-Write (RW) Node, and the slave node will act as a Registry Read-only node.

There are two mechanisms for deployment synchronizing. One is a SVN-based mechanism, and the other is Registry-based mechanism.

SVN-based Deployment Synchronizer

SVN-based deployment synchronizer uses a Subversion repository to sync the contents in the sync directory (the axis2 repo directory, AppService-Home/repository/deployment/server,  by default). This includes several steps compared to registry-based depsync, but is efficient and high in performance.
What happens here is that when there are changes to the contents of axis2 repo directory, the Read-Writw nodes commits those to the Subversion repository. Then, this node sends a cluster message to all other (slave) nodes specifying the repo is updated. When these nodes receive the message, they updates there axis2 repo directory with what's in the svn repository.

  • Download and install SVNKit implementation as described in in this JIRA ESBJAVA-950.  Download the properly bundled svnkit bundle or just get the one available in the JIRA (svnClientBundle-1.0.0.jar). Make sure you have read the svnkit license. We do not ship svnkit by default because of licensing incompatibilities on re-distributions. This is an optional step, but it's highly recommended that you do this. If svnkit is not there, DepSync can use the SVN installed on your machine. But this default subversion implementation is not suitable for production. You need to copy this to repository/components/dropins/.

  • Now, you need to have a svn repository. You may use a existing svn repository, or create one locally. If you are in Linux, you can simply create a repository by following the command. 







svnadmin create /home/kasun/mylocalsvnrepo
For further information setting up svn repository, refer this link.

  • Now, you may use file:// protocol rather than setting up http:// url for the repo (by using a webserver like Apache) if the repo will be in local system. For example, you can do a manual checkout of the repository by using the command `svn checkout file:///home/kasun/mylocalsvnrepo/`

  • Next, we have to set the DepSync config in carbon.xml file located in AppService-Home/repository/conf/carbon.xml. Add the following xml content to carbon.xml of AppServer Master node. 
<DeploymentSynchronizer>
        <Enabled>true</Enabled>
        <AutoCommit>true</AutoCommit>
        <AutoCheckout>true</AutoCheckout>
        <RepositoryType>svn</RepositoryType> 
        <SvnUrl>file:///home/kasun/mylocalsvnrepo/</SvnUrl>         
        <!-- <SvnUrl>http://svnrepo.example.com/repos/</SvnUrl> -->            
        <SvnUser>kasun</SvnUser>
        <SvnPassword>password</SvnPassword>
        <SvnUrlAppendTenantId>true</SvnUrlAppendTenantId>
    </DeploymentSynchronizer>

I setup a local svn repo, and didn't set any user-passwords. So, SvnUser and SvnPassword is not effective in this scenario.

Here's an explanation on the options.


  • Auto Commit - Allows to perform commit operations automatically.
  • Auto Checkout - When this option is selected, an additional option named "Use Eventing" will be enabled.
  • Use Eventing - Allows to trigger checkout actions on registry events. This is not needed most of the time.
  • Synchronization Period - Synchronizer will get initialized and start running periodically as specified in this parameter. Default is 10 seconds.
  • Now, add the following content to the AppServer slave node(s).
<DeploymentSynchronizer>
        <Enabled>true</Enabled>
        <AutoCommit>false</AutoCommit>
        <AutoCheckout>true</AutoCheckout>
        <RepositoryType>svn</RepositoryType>
        <SvnUrl>file:///home/kasun/mylocalsvnrepo/</SvnUrl>
        <!-- <SvnUrl>http://svnrepo.local.com/repos/</SvnUrl> -->                
        <SvnUser>kasun</SvnUser>
        <SvnPassword>password</SvnPassword>
        <SvnUrlAppendTenantId>true</SvnUrlAppendTenantId>
    </DeploymentSynchronizer>


If you look closely, the only two differences between these two configs is that in slave nodes, we set AutoCommit to false, and AutoCheckout to true.

  • Now, deployment synchronizer is setup. Start greg, and the two AS nodes You'll see that when you do an operation like uploading a service to master node, the service archive get synced to slave nodes.

Registry-based DeploymentSynchronizer

Setting up a registry-based depsync is quite easy compared to svn-based depsync. There are two ways to enable this.Home/repository/conf
  1. Via carbon.xml configuration file
  2. Via DeploymentSynchronizer UI

Registry-based depsync via carbon.xml

  • If you have added any config at svn-based depsync, uncomment/remove those.
  • Add the following configuration to the AppServer Master node's carbon.xml file located in AppService-Home/repository/conf/carbon.xml.
<DeploymentSynchronizer>
        <Enabled>true</Enabled>
        <AutoCommit>true</AutoCommit>
        <AutoCheckout>false</AutoCheckout>
    </DeploymentSynchronizer>

  • For slave nodes, add the configuration above but with AutoCommit set to to false, and AutoCheckout set to true.


Registry-based depsync via UI

Start the master and slave instances of AS, and go to the management console from the browser.  If you configured the nodes for master and slave with port Offsets 1 and 2 respectively, the possible link would be https://localhost:9444/carbon/deployment-sync/index.jsp.


  • Log in to the master node, and go to Configure -> Deployment Synchronizer via left pane. 


  • Check "Auto Commit", and click on enable.


  • Now go the management console of the Slave node. (https://localhost:9445/carbon/deployment-sync/index.jsp)
  • There, check "Auto Checkout", and click on enable.



There's no need of doing any changes to greg instance.
Now, deployment synchronizer is setup. Start greg, and two AS nodes and see how it goes. You'll see that when you do an operation like uploading a service to master node, the service archive get synced to slave nodes.


Saturday, April 28, 2012

Officially a DocBook Mentor for Google Summer of Code 2012












I have got the opportunity to be a mentor for DocBook organization under Google Summer of Code 2012. I was a former participant of Google Summer of Code 2010, and 2011. In 2010 I worked with DocBook as a student with my mentor David Cramer where I developed the DocBook WebHelp output format. I always fascinated contributing to an Open-Source project, so it was a big achievement for me. I kept contributing to it which made me a part of the community, and a Committer for the project.

As many of you probably know, Google Summer of Code is an annual program administered by Google, in which Google sponsor students to complete a free and open-source software coding project. This is eighth iteration of GSoC. Most of the giants in Open-Source has been part of it including GNUGentooApacheKDEUbuntu, Mozilla with student participants from all over the world.

DocBook has secured five slots this time. We had enough resources to mentor five slots, on top of that there were five good proposals to mentor for. Fortunately, there wasn't any issue with de-duplication or from anything for that matter, so all five were selected into DocBook. This time, as usual, Richard, and Stefan Seefeld are the org admins. Stefan Seefeld, David, Jirka, Steve, and me are primary mentors for the five students while Stefan Hinz, and Peter Desjardins will be co-mentors for the two selected webhelp proposals.
Yes, two proposals were for WebHelp. That made this year's program more exciting. The two students were, Visitha, from University of Moratuwa, Sri Lanka (my Alma Mater), and Arun, from PES Institute of Technology Bangalore, India. There were overlap between them, so we had to sorted those out first before selecting both.

I found Visitha during the Google Summer of Code meetup at University of Moratwa we, past Sri Lankan gsocersorganized. Buddhi, who also attended that meetup has selected into DocBook. It's so glad to hear that people appreciating the effort we put there, and that it actually meant a lot for most.

I must mention Gihan Chanuka here. He contacted me on last January where he wanted to contribute to DocBook outside of GSoC. He has been asking various questions he had while trying out DocBook. Though he wasn't able to do that, he was a good candidate for GSoC. I am delighted that he also got selected into flying colors. Of course there is a long way to go from selecting to completion, but when it comes to GSoC, selection is a special milestone to pass.

Hoping to have a great time being a mentor this year!

Wednesday, April 11, 2012

Google Summer of Code meetup at University of Moratuwa


Google Open-Source blog has provided a coverage report for the Google Summer of Code meetup we held at University of Moratuwa on March 17th 2012  . The session has caught the eyes of Stephanie Taylor, and Carol Smith who are from The Google Open Source Programs Office, and showed interest to make it to a blog post.
It can be found at the following link. The content is provided below.
http://google-opensource.blogspot.com/2012/04/moratuwa-sri-lanka-google-summer-of.html

GSoC 2012 Logo. Image credits: Google Inc.

Special thanks goes to Dr. Chandana Gamage, Dr. Shehan Perera, and Ms. Vishaka Nanayakkara for providing your fullest support for the session. Thanks to all my friends including Nisansa, Pradeeban, Thilanka, Shelan, Subash, Suho, IsuruU, Nirmal who contributed to make this a success.
I heard the department is giving 10 marks for students in 3rd year who get selected into Google Summer of Code. That's great news since it will motivate the students a lot.

-----------------------------------------------------------------------------------------------------------------

We held our fifth Google Summer of Code meetup in the Moratuwa, Sri Lanka area on March 17th. We had enormous support from the Department of Computer Science & Engineering staff at theUniversity of Moratuwa to make it a full scale session covering many of the aspects of the program that are important to students. We had almost 150 students (a record high) in the morning introductory sessions and around 40 students during the afternoon sessions that were geared more toward second and third year university students.

Kathiravelu Pradeeban delivered an excellent 80 minute Google Summer of Code information presentation focusing on general open source fundamentals from how to communicate within open source communities to proper email/IRC etiquette to open source culture. He also discussed general information about Google Summer of Code such as important dates for the program, how to apply, guidelines on how to write project proposals, and some ideas to think about when deciding if a project is a good fit for you. In later sessions there was more of a focus on open source technologies with demos on how to effectively use these technologies for open source development work.


The students were very excited about the program, and asked many questions both publicly and to us individually after the session ended. We tried to clear up doubts students had about their own ability levels and encouraged them to participate by showing some of the great opportunities of working on a real-life project rather than the fake projects that they do at university most of the time. We also explained about the value of having connections all around the world and the spiritual happiness open source projects bring in general. Those of us that had participated as students with Google Summer of Code shared our experiences including one participant whose Google Summer of Code project caught the eye of a well known IT company who hired him.

Good luck to those students currently applying for Google Summer of Code!

By Kasun Gajasinghe, former Google Summer of Code student for DocBook Project and Gentoo Linux, 2012 DocBook Project mentor  

------------------------------------------------------------------------------------------------------------------

Saturday, March 17, 2012

DocBook WebHelp UI features by screenshots!

I wrote this blog post to show some of the UI features provided by DocBook WebHelp. So, following is a set of screenshots I took which which is how webhelp will look like in the next release. The next release would probably be versioned as 1.77.x. These are taken from revision r9240 on 2012-03-16. You may download the latest snapshot from DocBook snapshots site. You may download the latest release here.

A chunked output page docbook webhelp. It includes a header in top with a company logo, Contents, and Search panes at left side; the real contents in the right larger section; And some minor but useful features at top-right corner. The browser is Chromium/Google Chrome 16. Click on the screenshot for a larger view.

You may hide/unhide the left sidebar by clicking on  SIDEBAR at top-right corner in the page. Isn't that a easier way to read the contents? or do you prefer the default way? For larger monitors the effect is minimal!


A zoomed view the Contents pane in left. This shows the Table of Contents of the documentation, broken down by chapters/sections. You can configure the number of tree levels if you think it's necessary.

Plain search view. You can turn on/off the Search Highlighter provided. Try it yourself!


A typical search results section.  Read here to understand how the search result summaries appeared! And, we provide search scoring/rating mechanism for better searching.
A search with several words. WebHelp displays the results for the whole query, as well as for individual words which is nicely sectioned as shown above.