> 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 !!
Wednesday, August 26, 2009
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:
- Open the Thunderbird/Sunbird application and select File > New Calendar.
- Select On the Network and click Next.
- Select the CalDAV format option.
- In the Location field, enter [http://www.google.com/calendar/feeds/[full email id]
/public/basic] and click Next. - Enter a name and select a color for your calendar.
- Choose the email address as none. Proceed further.
- 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 - 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:
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
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
Above code chunk, removes comma and converts it to double only for comparison and then returns the result.
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 usingsetMinimumFractionDigits();
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.
Subscribe to:
Posts (Atom)