Monday, April 19, 2010

Testing of GPRS Based Site through Mobile Simulators

If you are developing GPRS based website which is a light version of your corporate or any site, you have to ensure that the GPRS based site is tested on all widely used mobiles before releasing to customers.

You can test it in
1. Windows Mobile Internet Explorer,
2. Opera Mini,
3. Blackberry,
4. Symbian Mobile.
To test you can either host the site on internet and buy 10 types of mobiles and test it. Else, you can download simulators/emulators/SDK for above and test it there.

You can have a webserver which is having GRPS based site on your local intranet.

In all the following text where ever proxy server is used it acts as router between simulator and the Intranet GPRS based site. Simulator cannot directly access the IP of the site for some reason. There may be a way but I am going ahead with these settings.


1). Windows Mobile 6.0 Operating System.

1.1) Installing Windows Mobile Simulator/Emulator in your system.
You can get from http://www.microsoft.com/downloads/details.aspx?FamilyId=1A7A6B52-F89E-4354-84CE-5D19C204498A&displaylang=en . Download file named Windows Mobile 6.1.4 Standard Images (USA).msi

1.2) Install Active Sync.
Active Sync is required for connecting Windows operating system and Windows Mobile.
You can get it from http://download.cnet.com/Microsoft-ActiveSync/3000-2094_4-10031823.html. You may already have it in your System.

1.3) Install WinProxy or any other Proxy Server
This is required as it would route your request from windows mobile simulator to your Application server. You can have winproxy or any other proxy you wish.

1.4) Start WM Emulator Mobile phone simulator front end


1.5) Start Active Sync and in connection setting put DMA



1.6) Start Device Emulator and click Refresh and select the connection and click on cradle.



1.7) Start Winproxy on your system.
1.8) In Mobile Settings -> Proxy Settings -> HTTP -> Connects from work to internet on yourIP:ProxyPort
1.9) In Mobile Settings -> Proxy Settings -> Socks -> Connects from work to internet on yourIP:ProxyPort
1.10) In Mobile Internet Explorer start browser.
1.11) Enter your URL.

2). Opera on above Windows Mobile 6.0
After following above steps you can also install opera in your mobile simulator.
2.1) Do proper internet proxy configuration as per above settings in steps 1.8 and 1.9. (Your proxy server should be able to resolve internet address like m.opera.com)
2.2) Visit m.opera.com from Mobile


2.3) Select proper browser version and download it.
2.4) Open the file explorer and start the setup of cab.
2.5) In Start -> All Programs -> More you will fine opera mini browser icon somewhere.
2.6) Start Opera and put your intranet link of GPRS site. (Your proxy server should be able to resolve intranet link)

3. Blackberry Simulator
3.1) Download Blackberry Simulator and Install. You can get it from http://na.blackberry.com/eng/developers/resources/simulators.jsp
3.2) Start Simulator from Start->Programs->Rim>. Blackberry screen will appear.
It takes some time to start the phone. Note that it is not able to detect the setting.


3.3) Click on Applications button-> Go to Manage Connections-> Select Restore Connections-> Simulator will detect network.



3.4) Go to browser and enter your URL of your Intranet site.



4. Nokia/ Symbian Simulator
4.1) Create a account/register in www.forum.nokia.com . You may need it some time later. Also if some setup is asking for serial number you can get it from http://www.forum.nokia.com/Tools_Docs_and_Code/Tools/Request_Serial_Number.xhtml
4.2) Search for S60 Platform SDKs for Symbian OS, for C++ in google and download 3rd Edition (262 MB). Don’t download 3rd Edition, FP 1 (355 MB). I dint find it stable.
4.3) Download perl. You can get Strawberry version from here. http://www.perl.com/download.csp
4.4) Install Perl. Install Symbian S60.
4.5) Start Emulator.



4.6) In emulator set Tools Network -> Proxy Server and port.
4.7) Set Tools Network -> General Settings ->256 MB.
4.8) Go to Browser and enter your URL.


There are other simulators also like Andrroid, iPhone, Motorola etc. You can work on above similar lines and get them up.

Tuesday, December 1, 2009

Database Connection Pooling

Database Connection pooling should be the first taken for performance optimization. C3PO offers connection pooling most used in Java projects. There are some properties which are basic like minPoolSize and maxPoolSize. minPoolSize Should be atleast equal to number of concurrent requests you foresee on your website. maxPoolSize, maxIdleTimeExcessConnections, acquireIncrement can be used to for handelling exceptional overload on server.

maxIdleTimeExcessConnections can be set to 5 minutes. It will bring back active connections to minPoolSize from maxPoolSize if it is idle.

maxStatements and maxStatementsPerConnection are used to save compilation time every time u call prepareCall. But it dont help. Keep both 0. If you set maxStatements as lets say 50 and if the size is consumed by current request there may be bottlenecks and Spikes. So avoid it.For maxStatements, It doesnt make sense compiling statements in application server because there may be 1000s of SQLs in your application.

Call Centers Tricks

Having a call center is important for every corporate. But are the call centers, customer cares or support desk becoming successful in actually solving the problems of customers. Recent interaction with an reputed Telecoms operator brought in front of me different ways/tricks which these call centers use to hide incompetence's. These call centers are acting as levels of shields which dont allow customers to get transparency and problem solved. They have range of tricks which are..

Trick 1: If your existing ticket is not solved till dead line, they might raise new ticket and buy time.
Trick 2: When you call the call centre they might put you on hold endlessly asking you that they are transferring to different department.

Trick 3: If you wish to speak to senior or manager they might transfer to some of their colleagues, i guess, who acts as senior.
Trick 4: They give phone number of nodal officer which is always switched off or engaged.
Trick 5: They give you time by when the problem will get solved and then without solving the problem, i guess, make a confirmation call saying problem is resolved.
Trick 6: If they are supposed to call you, they will give 2-3, i guess, missed calls and before you pick up disconnect the call. Later they say we tried to call you.
Trick 7: Will divert your phone to other state call center. Eg: Punjab or any other state.
Trick 8: They will hardly revel a facility like nodal officer email id. Even if you contact Nodal officer he will take sweet 5 days to reply.
Trick 9: If at all phone gets transferred to so called manager, he will give promise to solve the problem- but in 15 days.
Trick 10: They never give the phone number of the technical person who is actually going to solve the problem.
Trick 11: When a ticket is raised a completion deadline is given as 3 working days. However they dint seam to do any thing till the last minute and when the deadline is passed they ask for 2-3 additional days.
Trick 12: They close the ticket very often saying that there is INCOMPLETE INFORMATION. They wont even inform you about the closure.
Trick 13: The phone can be diverted in various department like GPRS, network, technical or customer care.
Trick 14: They will make a call asking you when are you at home for a technical person to visit at home personally. Obviously, most of us will not be at home on working days and the technical person will never have to visit your house.
Trick 15: They anyways have to auto option to auto cancel a phone number when he calls call center for 5-6 hours.
Trick 16: It is also common to suggest useless solutions and close the ticket. Like handset problem, simcard problem, restart mobile.
Trick 17: Ask the customer to get in contact through email support with reason given that email support is given more priority. In practical, both have same priority.
Trick 18: If you some how get call from technical department to inform you that the problem is solved, chances are that you will not be able to call back on that number. If some how you are able to call back on that number, they will ask you your mobile number to call you back. But in reality, i guess, they take your phone number and feed it in they local number or note it physically and ensure that they don't pick this phone number.

Words i guess means that me as a customer cannot prove the action but a perception is formed and harm is done about the image of call center.
As you don't have even a single person whom you can catch hold of and with so many options in call centers arsenal, you can only hope that your problem gets solved.


The attitude of people sitting at call centers, i dont know weather its officially taught to them or they themselves have invented it, would promote unnecessary inefficiencies. The technical team would be willing to solve the problem but if the call center guys are used to think that the problem is from customer end, even the genuine problems goes unresolved. I think that the number of employees in technical departments should be good enough to back the actual problems. If not surely business will not be able to scaling to higher limits.

It has to be noted that a single problem solved actually would reduce the N other number of calls as some problems would be faced by many other customers. With recovery in sight its high time to get technical teams on work to solve each problems which customers are facing and be able to scale successfully. Would end it with a funny note that this entry also helps callcenters those who have not yet implemented trick like above and can hence forth use same at their respective areas..

Sunday, October 25, 2009

Port 80 may not be a clean path

If you want to host a socket based application on internet, port 80 may not be a clean path to be picked.

A socket based application could be used when application creates a socket and communicates using custom data format like xml and delimited texts.A chat application is a example of socket application. There is a need for continous open connection which will flow chat text to client from server.

Generally client application which wants to do socket communication can rely on technique of http tunneling where a get request is made to a web server and once the socket is opened custom data fromats could be exchanged.

The problem faced here is which port should be selected for hosting chat server.
Selecting port 80 will work in 95 percent of cases and 5 percent of users might face any of problems mentioned ahead.

Request/Reponse: An ISP may route all the requests received from port 80 through proxy server. Proxy server works on request response basis, which means once request is received and forwarded to server and server has started responding, no more request can be received from client on same request connection. So the upstream data or the outbound communication on the client system may not work or hang.

Buffer data: An ISP proxy may buffer given number of bytes received from server and then flow the data to client. This may be done for caching at proxy level. It can also be used to detect if the response is any virus file. However, as per my knowledge hardly any ISPs scan for virus data.In this case inbound link may hand till configured bytes are read.

Proxy Load Balance: Some ISPs may route each request received from client on a load balanced proxy servers. This will cause each request to get different IP. To experience this you can visit www.whatismyip.com and check if your IP address is changing on every request. Try it 5/6 times to ensure it. This may affect those services which are using source ip for some kind of processing on server.

Header modification: When the data is routed through proxy servers at ISP, there are chances that the proxy server may add some additional headers on your reponse. If your application is not tolerant then you may have hard time solving this issue.
Some spyware installed on clients system mostly monitor request on port 80 and may tamper with request response headers.

Antivirus,Firewall,Spyware: However these are client end configurations, if may also affect socket communication. The application executables which are making socket communications should be added in antivirus and firewall exceptions.
Spyware are nasty to the extent of discarding application headers and putting their own headers. So avoid sending application data in http response headers. Your http response headers may not reach client system or may be manipulated.

Choosing a non 80 path may save you from above problems. If all your clients are using direct internet connection you may easily use non 80 port. However if you have users sitting in corporate offices surfing internet thorugh corporate proxy server then selecting non 80 path may be difficult.

This blog entry also to some extent explains how ISPs work internally. If you want ensure that your application works with with most ISPs do test you application with atleast 7-8 proxy servers before going on internet.

Monday, September 28, 2009

Development of Rural India

Although india is a fast developing nation, but the benefits of development is not reaching in deeper part of india. Unemployment, lack of basic infrastructure like Roads, Irrigation, Electricity are major problems. if these problems are solved through some structural changes india can become super fast growing economy.

Road construction companies should keep doing surveys about where they can create new roads n where they can do repairs. Instead of government ordering them they should proactively do it. Same applies to Dams construction.. Development should be pull based rather than push based. Somewhere i feel that indian corporate is more trustworthy than the local political representative.

Government has to solve irrigation problem asap as farming is still not a profit making business for major section of farmers. There is huge risk in farming as much is dependent on rains. If government cannot gurantee irrigation then farming should be nationalised in such regions. Afterall government cant leave people to make irrational choices of doing farming n trapping themselves in losses and debts. Many times farmers take double risk of rains and cash crops which often proves fatal.

There are so many industrial estates which are under ot not utilised. Work should be outsourced to from urban areas to such remote locations and railway frieghts should be waived on such outsourcing.

Sunday, August 30, 2009

Swing ResultSet Column Table Component

Hear is a ready to use component for JTable in swing which will also show column titles. By default the JTable only displays the data which is strange although. This code is free and can be used easliy in commercial and opensource applications.
Yet this component does not have alignment facility depending on Integer or String or Date datatypes. Will update once done.

Steps to use the class
1. Create a class ResultSetTableModel.java in package src.components.
2. Create a JTable and add it to JScrollPane.
JTable tblSuppliers = new JTable();
tblSuppliers.setVisible(true);
JScrollPane scrollpane = new JScrollPane(tblSuppliers);
pnlCenter.add(scrollpane,BorderLayout.CENTER);
3. Create the ResultSet,Create Model and set Model.
stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(strQuery);
ResultSetTableModel qtm = new ResultSetTableModel();
qtm.setResultSet(rs);
tblSuppliers.setAutoCreateColumnsFromModel(true);
tblSuppliers.setModel(qtm);


Code for ResultSetTableModel.java is as follows.
package src.components;

import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.util.Vector;

import javax.swing.table.AbstractTableModel;

public class ResultSetTableModel extends AbstractTableModel {
Vector cache;

int colCount;

String[] headers;

String currentURL;

public ResultSetTableModel() {
cache = new Vector();
}

public String getColumnName(int i) {
return headers[i];
}

public int getColumnCount() {
return colCount;
}

public int getRowCount() {
return cache.size();
}

public Object getValueAt(int row, int col) {
return ((String[]) cache.elementAt(row))[col];
}

public void setResultSet(ResultSet rs) {
cache = new Vector();
try {
ResultSetMetaData meta = rs.getMetaData();
colCount = meta.getColumnCount();

headers = new String[colCount];
for (int h = 1; h <= colCount; h++) {
headers[h - 1] = meta.getColumnName(h);
}

while (rs.next()) {
String[] record = new String[colCount];
for (int i = 0; i < colCount; i++) {
record[i] = rs.getString(i + 1);
}
cache.addElement(record);
}
fireTableChanged(null);
} catch (Exception e) {
cache = new Vector();
e.printStackTrace();
}
}

}

Saturday, August 29, 2009

Browser Embed In Swing

SWT Browser component is quite handy when you want to include support for platform independent browser support from your swing application.
Its more over important when you want to show modal window with a browser, because in case of non modal window you can anyways start IE instance from Runtime call.

The benefit of using Browser component in Swing is that it gives you enough control over the contents you can change anytime from website.
Also its saves you the time of rewriting the stuff written in Website again in Swing or AWT. Same stuff can be used here by directly pointing to Website Form/Page URL.

You have 2 options to go with.
1. chrriis.dj.nativeswing.swtimpl.components.JWebBrowser and
2. org.eclipse.swt.browser.Browser

I would suggest you to go with SWT Browser component.
One problem you will face with JWebBrowser is that the component creates problem with java 1.6. Its makes whole application
go crazy and all screens seams to get repaint problems.
Another problem you will face in JWebBrowser is that the component shows Custom window then a window.open call is made in
HTML page. You might like to open it in Default webbrowser of your operating system.
It allthemore becomes unacceptable when you have shown JWebBrowser component in JDialog window and you have clicked on window.open link.
It will show a window which is kind of hung and you cannot scroll or do any thing with the new window until you close the modal window.
One more problem you will encounter with JWebBrowser is that if you want to decide if opening of new window is to be allowed should be allowed
or not on the basis of URL location clicked, you have to
make a hidden JWebBrowser Component,
set it as browser instead of new window browser.
Dispose the new window using arg0.getNewWebBrowser().getWebBrowserWindow().dispose() in windowWillOpen open.
Ensure that you dispose the new window before setting the webbrowser.
Cancel the Opening of URL in locationChanging event and get the URL.
These long steps are to be followed if you want to intercept the opening up of new Window.

Good thing about JWebBrowser is that it is licensed under LGPL. So you can use it in your commercial projects also. You need not publish your code to users in case of LGPL.
A word for Christopher Deckers, author of JWebBrowser. Please make it work under Java 1.6. Just a call to NativeInterface.open starts the problems of repainting the windows.

However going with SWT Browser is not a eazy path either. You may face problems like
1. JVM Crashes
2. Not fitting easily in JDialog window and fits in JFrame.
3. Browser opens up in JDialog only once and dont come up next time onwards.
4. Your JDialog window shows up but the Browser dont show up.

To avoid JVM Crashes ensure that your window creation and displaying is all in SwingUtilities.invokeLater.
Let the shell loop be out of SwingUtilities.invokeLater. To ensure that JDialog and Browser both shows up,
you set location, size and visible for canvas, shell and browser component.
To ensure that the browser always comes up on window you might have to make use of small sleeps of 1 second outside your SwingUtilities.invokeLater.
This is to ensure that Window is created and shownup on screen before you try to set the browser component on the window.

The code written using SWT Browser component is completely platform independent. You can run vncserver service on your linux box and connect to it using vncclient and see your
application running in Linux environment using MOZILLA browser instead of IE.


If you need any advice or help on the topic please leave a comment here.