Monday, April 26, 2010

Having trouble with MTC ? Immediate complaint over mobile now !!!

This is a true Incident!! I am copying below the incident as narrated by the victim:

"I m AnandRaj working in Chennai One(Thoraipakkam), Chennai. I usually travel by Metropolitan Transport Corporation(MTC) bus, from jain college stop (Which is near to my office) to tidel park and from Tidel park I will catch train, to home. MTC bus coming from kelambakkam(19B,21H) mostly wont stop in tidel park in early days. So I usually prefer to get into T51 bus, which will stop in tidel park stop. After some time 19B started stopping in tidel park also.

Today while returning from office at around 8.30 pm, I was in a hurry to catch my 9.28 pm train at Tidel park. I got up a bus(19B) in Jain College at around 8.45 pm, and asked the conductor to give a ticket for tidel park stop. He said, the bus wont stop there, and he asked me to get down at signal if it stops there or else get down at stop next to tidel park. I was arguging with him that I am going daily with the same bus and get down in the tidel park stop. But he was keep on saying the same thing.. I got irritated with conductor response. Suddenly I remembered a complaint phone no.(9884301013) I read in one bus sometime back and noted down in my mobile. I called that no. and said about the incident that conductor is not stopping in the usual stop.

The MTC representative (person at the other end) asked me to give the phone to the conductor. The conductor was not interested to talking with his official. The MTC rep. asked me the bus registration no. He enquired where is the bus at that time and I said it is in Kandhanchavadi. The MTC rep. said he will come in the line and talk to them. I was curious how he will come and catch the bus.

After few mins. the wireless transmeter(to track the bus), near the driver in the bus started shouting... Driver stop the bus. Driver stop the bus in the left side of the road. Driver was not sure what is happening may be his first experience, for others(including me) it is the real first experience. The driver stopped the bus and started listening to the transmeter. The MTC rep. enquired why the bus is not stopping in tidel park stop. The driver said he stops in tidel park stop and in the previous trip also he has done. The rep. asked him then why the conductor is saying like that. He asked the conductor what is the issue. The conductor was speechless. The driver somehow managed the situation and supported the conductor by saying that the conductor was new to this route. The driver asked excuse for the incident and said he will stop in the Tidel Park stop

The MTC rep. said he wanted to talk the passenger who called him. I went near the transmeter and spoke to the MTC rep. He said sorry for the incident happened and asked sorry on behalf of MTC. Everyone in the bus were surprised of things happening. I came back to my seat and I was so embarrassed as all were looking at me. Few passengers asked me what is the no. and whom I called. They also took the no. The bus stopped in Tidel Park stop then. After getting down I called the MTC rep. and said the bus stopped in the stopping.

It was a nice experience for me and others who travelled in the bus, including driver and conductor and I was very shocked after this incident. Yes, nowadays good things are happening in government sector also and technology is used properly.

Complaint Phone no. for MTC bus: 9884301013, 9445030516, 9383337639"

Sunday, November 15, 2009

SAR values for Nokia mobiles in India as on 15th Nov

Choose the Nokia mobile phone model below for checking SAR rate (radio wave emissions). The SAR value must be below an agreed level (2 W/kg).




Friday, October 23, 2009

i18n support for German Characters in Java

Problem: Issues on Double Byte support - Java platform.

Symptoms: The umlauts characters like ä,ö,ü in German / Spanish / Portuguese languages are garbled in the output stream. Java application receives data over a socket using an InputStreamReader. It reports "Cp1252" from its getEncoding() method:

/* java.net. */ Socket Sock = ...;
InputStreamReader is = new InputStreamReader(Sock.getInputStream());
System.out.println("Character encoding = " + is.getEncoding());
// Prints "Character encoding = Cp1252"

That doesn't necessarily match what the system reports as its code page. For example:

C:\>chcp
Active code page: 850

The application may receive byte 0x81, which in code page 850 represents the character |ü|. The program interprets that byte with code page 1252, which doesn't define any character at that value, so I get a question mark instead.

Solution:

You can work around this problem by using code page 850 i.e., by adding another command-line option:

java.exe -Dfile.encoding=Cp850 ...

ENC=...
java.exe -Dfile.encoding=%ENC% ...


To write at the command line,

> chcp 850
Active code page: 850

> type 1251.txt
abcde xyz
ÓßÔÒõ ²■


Some pointers relevant to this:

> http://illegalargumentexception.blogspot.com/2009/04/i18n-unicode-at-windows-command-prompt.html
> http://stackoverflow.com/questions/1336930/how-do-you-specify-a-java-file-encoding-value-consistent-with-the-underlying-wind

Wednesday, August 26, 2009

Intel Pro Wireless driver installation for Inspiron 1525

> Download the wireless driver for inspiron at http://support.dell.com/support/downloads/format.aspx?c=us&cs=19&l=en&s=dhs&deviceid=9540&libid=5&releaseid=R164255&vercnt=1&formatcnt=0&SystemID=INS_PNT_PM_1525&servicetag=&os=WW1&osl=en&catid=5&impid=-1

> Extract the drivers' .exe file

> Goto .../Intel_multi-device_A12_R164255/XP/Drivers/x64 folder in command prompt

> Assuming that ndiswrapper is already installed, do ndiswrapper -i NETw4x64.INF

> /sbin/insmod /lib/modules/2.6.29.6-217.2.8.fc11.x86_64/kernel/net/wireless/lib80211.ko

> /sbin/insmod /lib/modules/2.6.29.6-217.2.8.fc11.x86_64/extra/wl/wl.ko

> modprobe lib80211

> modprobe wl

> If you have the wireless switch turned on, you will see the network manager searching for wireless driver

> Done !!

Thursday, August 06, 2009

Use Google Calendar from Thunderbird

If you are using thunderbird and the addon for using google calendar https://addons.mozilla.org/en-US/thunderbird/addon/4631 is not compatible (with the thunderbird version), follow these steps:
  1. Open the Thunderbird/Sunbird application and select File > New Calendar.
  2. Select On the Network and click Next.
  3. Select the CalDAV format option.
  4. In the Location field, enter [http://www.google.com/calendar/feeds/[full email id]/public/basic] and click Next.
  5. Enter a name and select a color for your calendar.
  6. Choose the email address as none. Proceed further.
  7. In the pop-up screen, enter the following information:

    Username: This is the complete email address you use with Google Calendar (including the part after the @ sign).
    Password: This is the password you use to sign in to Google Calendar

  8. Click OK.

Wednesday, July 15, 2009

Implementing Jtable Sorting + Currency Rounding + Comma Separation

Illustrating one of the test cases where you have to sort the currency values in the JTable without losing precision.

Some facts:
1. Double values rounds off decimal values leading to loss of precision in Currency values
2. Only Double can show numerics (having decimal points) in Currency format (Comma separated values)
3. JTable when given String representation of Double values cannot recognize it as Double by itself.
4. There are no direct apis in Double to control decimal limits and round off

Due to above list of limitations, it is bit complex to implement all the three functionalities together. But there is a workaround/solution for this. See the code below:


package testing;

import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.Comparator;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;
import javax.swing.table.TableRowSorter;

/**
*
* @author vijay
*/
public class JTableSortDemo {

public static void main(String[] args) throws Exception {
// Decimal format to define the required format with #Fraction digits
DecimalFormat df = (DecimalFormat) NumberFormat.getInstance();
df.setMinimumFractionDigits(6);
df.setMaximumFractionDigits(10);

// Heeaders
String columnNames[] = {"Expected (String value)", "Double (Formatted Numeric) Value", "Double without formatting(has roundoff)"};

// Input values
String[] strKeys = {"6304482644123.000003", "6304482644.4012", "63044.00", "1235482644.95", "1235482644.10", "1235482644.00"};
double[] dDatas = {6304482644123.000003, 6304482644.4012, 63044.00, 1235482644.95, 1235482644.10, 1235482644.00};

Object[][] data = new Object[dDatas.length][columnNames.length];
String strDF = null;
for (int i = 0; i < dDatas.length; i++) {
strDF = df.format(dDatas[i]);
data[i] = new Object[]{strKeys[i], df.format(dDatas[i]), dDatas[i]};
}

// Creating tablemodel
TableModel model = new DefaultTableModel(data, columnNames) {

public Class getColumnClass(int column) {
return getValueAt(0, column).getClass();
}
};

Comparator comparator = new Comparator() {

public int compare(String s1, String s2) {
Double dbl1 = Double.valueOf(s1.replaceAll(",", ""));
Double dbl2 = Double.valueOf(s2.replaceAll(",", ""));
return dbl1.compareTo(dbl2);
}
};


// Create table and associate sorter
JTable table = new JTable(model);
TableRowSorter sorter = new TableRowSorter(model);

// 1 is the column where the fraction values are not lost
sorter.setComparator(1, comparator);
table.setRowSorter(sorter);

JScrollPane scrollPane = new JScrollPane(table);

// Add table to container
JFrame frame = new JFrame("Sorting Table");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.add(scrollPane);
frame.setSize(300, 200);
frame.setVisible(true);
frame.pack();
}
}


The solution incorporated in above code is to write user defined comparator which converts the String values to double (only during comparison).

In detail:

i) Use the DecimalFormat to retain the decimal values to 'n' number of digits using
setMinimumFractionDigits();
setMaximumFractionDigits();


ii) After applying the decimal format, we will have a string shown in the JTable (with comma).


iii) Now while sorting the particular column(2nd column in above sample), we can override the the default functionality of comparator of TableRowSorter class. Default behaviour is to sort it as String. The solution is to write a comparator like below and set it to the TableRowSorter.


Comparator comparator = new Comparator() {
public int compare(String s1, String s2) {
Double dbl1 = Double.valueOf(s1.replaceAll(",", ""));
Double dbl2 = Double.valueOf(s2.replaceAll(",", ""));
return dbl1.compareTo(dbl2);
}
};


Above code chunk, removes comma and converts it to double only for comparison and then returns the result.

Tuesday, July 14, 2009

OpenSSO and Agent Installation

Here is my blog post about OpenSSO and Agent Installation in Glassfish: http://blogs.sun.com/vijayanand/entry/opensso_and_agent_installation_in

Monday, July 13, 2009

Calculate Cipher Size

Calculating Cipher Size for Symmetric algo.:
If you are using "DES/CBC/PKCS5Padding" cipher instance, and using cipher api like:
int doFinal(byte[] input, int inputOffset, int inputLen, byte[] output, int outputOffset)
you may want to think about what cipher text size calculation should be used for this. Because the output byte require a fixed length before encrypt/decrypt.

Solution: If plain text size is x and Encryption block size is y then

Size of CipherText = x + y - (x mod y)

The resulting ciphertext size is computed as the size of the plaintext extended to the next block. If padding is used and the size of the plaintext is an exact multiple of the block size, one extra block containing padding information will be added.

Source: http://www.obviex.com/Articles/CiphertextSize.aspx

Tuesday, July 07, 2009

Fedora Linux Essential

Fedora Linux Essentials:

> You can open a terminal from the current directory (from GUI for browsing folders). "Open terminal here" Nautilius script:
http://www.cyberciti.biz/faq/linux-gnome-open-terminal-shell-prompt-here/

> Given a rpm file, can do Local install without checking for dependencies.
yum localinstall --nogpgcheck .rpm

> Power saving mode in linux:
http://lesswatts.org/tips/wireless.php#pm
http://lesswatts.org/tips/wireless.php#bt

> 64bit flash for linux:
http://download.macromedia.com/pub/labs/flashplayer10/libflashplayer-10.0.22.87.linux-x86_64.so.tar.gz

> Nero for linux
http://www.brothersoft.com/d.php?soft_id=59627&url=http%3A%2F%2Ffiles.brothersoft.com%2Fdvd_video%2Fdvd_burner%2Fneroforlinux3.zip

> Fedora wireless for dell inspiron 1525: http://www.cenolan.com/2008/11/rpm-install-broadcom-wireless-sta-driver-fedora/

> Audio packages:
yum install ffmpeg ffmpeg-libs ffmpeg2theora gstreamer-ffmpeg
http://techchorus.net/index.php?q=how-play-music-and-video-fedora-10

> Synchronize date from terminal: ntpdate 0.pool.ntp.org

> Enabling root login for fedora:
Edit /etc/pam.d/gdm file as root user and comment the below line
#auth required pam_succeed_if.so user != root quiet

> Install adobe reader in fedora:
yum install AdobeReader_enu.i486

> set proxy:

For convenience, put this line in a file, say "/usr/bin/setproxy" and do
chmod +x /usr/bin/setproxy
Next time you set this with command "setproxy"

Monday, June 08, 2009

Disable dynamic deployment in sun java system application server

> Dynamic Deployment in Glassfish Application Server:

Dynamic reloading is useful only in development environment and not recommended for a production environment because it may degrade performance. To disable this, the sun-web.xml should have class-loader element with reload-interval set as below:


Attributes description for classloader element is at http://docs.sun.com/app/docs/doc/819-2634/6n4tl5kp3?a=view#abxhy.