Wish You all a Very Happy New Year.....
There is only few days for the dawn of the new year, 2008. It is time to get organized for the new year. As with last year I thought of creating a Sri Lankan holiday list.
– – – – – – – – – Start Copy – – – – – – – – –
[Sri Lanka] 25
Tamil Thai Pongal Day(BPM),2008/1/15
Duruthu Full Moon Poya Day(BPM),2008/1/22
National Day(BPM),2008/2/4
Navam Full Moon Poya Day(BPM),2008/2/20
Mahasivarathri Day(BP),2008/3/6
Milad-Un-Nabi (Holy Prophet’s Birthday)(BPM),2008/3/20
Medin Full Moon Poya Day(BPM),2008/3/21
Good Friday(BP),2008/3/21
Day Prior to Sinhala & Tamil New Year Day(BPM),2008/4/12
Sinhala & Tamil New Year Day(BPM),2008/4/13
Bak Full Moon Poya Day(BPM),2008/4/19
May Day(BPM),2008/5/1
Vesak Full Moon Poya Day(BPM),2008/5/19
Day following Vesak Full Moon Poya Day(BPM),2008/5/20
Poson Full Moon Poya Day(BPM),2008/6/18
Esala Full Moon Poya Day(BPM),2008/7/17
Nikini Full Moon Poya Day(BPM),2008/8/16
Binara Full Moon Poya Day(BPM),2008/9/14
Id-Ul-Fitr (Ramazan Festival Day)(BP),2008/10/1
Vap Full Moon Poya Day(BPM),2008/10/14
Deepavali Festival Day(BP),2008/10/27
Il Full Moon Poya Day(BPM),2008/11/12
Id-Ul-Alha (Hadji Festival Day)(BP),2008/12/9
Unduvap Full Moon Poya Day(BPM),2008/12/12
Christmas Day(BPM),2007/12/25
– – – – – – End Copy – – – – – – –
Please follow the instructions given in my last post to add holiday list to outlook. Note that if you have last year’s list under Sri Lanka you will need to replace it with this year’s ones
Click on the button to add the Holiday Calendar to your Google calendar.
Defraggler is a cool utility that lets you to defragment your hard drive. If you have used windows defragmenter, I think you know that it requires at least 15% of free disk space to perform defragmenting of the drive. Some times this can be very annoying. Specially for me this is very annoying since my C drive is only 10GB and it fills up very quickly and can't even defragment since it do not have 15% free space.
Defraggler is the solution for this. This little tool allows you to defragment your hard drive with out any restriction of free disk space. Unlike default windows defragmenter this nice tool facilitates you to defragment individual files as well. Another cool thing about Defraggler is that it is portable, means that you can run it on an USB.
Yesterday 12th December we had a grand event at the university for the launch of the Imagine Cup 2008 competition. Event was organized by the Microsoft Student Champs community at the Faculty of Information Technology.
Event was not only about the Imagine Cup, there was the launch of the sourceFEED - which is the new online resource center developed by student champs. SourceFEED was a long requested thing by the faculty students, it provided access to lot of online learning material and Microsoft latest software products that the faculty get through MSDNAA. Launch of the sourceFEED was done by the university vice chancellor.
After the launch of the sourceFEED we had the launch of the Imagine Cup 2008. This is the 4th time that IC is happening in Sri Lanka. During last 3 years the competition was won by students from FIT. This year also our students are ready to give a big challenge to other IT institutes around the county to bring the cup for the 4th consecutive time.
We had a introductory presentation about the IC 2008 by Wela, who is the Microsoft Developer Evangelist. And then we had 2 brief technical sessions on building WPF applications and another one on Silvelight applications. I did the presentation on building WPF applications using VS2008 and Expression Blend. It was a very introductory session about WPF, XAML and Blend. You can view the presentation I did here in Google presentations. Wela did the presentation on Silverlight.
Have you ever used remember the password option in you browser and later forget that password. If you want to see what the password you typed there is small trick that can be used. Simply type this JavaScript in the address bar of your browser.
javascript:(function(){var s,F,j,f,i; s = ""; F = document.forms; for(j=0; j<F.length; ++j) { f = F[j]; for (i=0; i<f.length; ++i) { if (f[i].type.toLowerCase() == "password") s += f[i].value + "\n"; } } if (s) alert("Passwords in forms on this page:\n\n" + s); else alert("There are no passwords in forms on this page.");})();
You can find a full explanation at the Raymond.CC Blog.
I came across this article at TechRepublic few days back about few windows services that we can disable and boost the security of our computers. Following are the services that you can disable without any problem.
Some of these services may not even installed in your machine, specially some thing like ISS. Better check the services running in you machine and disable unnecessary ones. It can help you in two ways, one is that it will boost the security and other thing is that it will save your system resources to do some thing useful.
To see list of all the services running in you machine go to Control Panel > Administrative Tools > Services
You can find the original article here >>
Tomorrow(19th Nov) our new academic semester begins. It will be the start of my 4th year at the university. Two months of vacation seems to be vanished. Two months of vacation was very nice one. I managed to learn lots of new things during that time, and spend lot of time with my family.
Now I'm doing the IT special degree so next few months will be very busy. Road ahead will be more difficult but will be very exciting. I'm hopping to do well in this semester.
Microsoft Excel is one of the common was of storing data in business. There fore when we develop applications, most of the times we have to extract data from an Excel sheet. There are many methods to extract data from Excel file, both commercial and free libraries are developed for this purpose. One of such library is Apache POI HSSF.
I came across this library few weeks back when I was researching on a methods of reading data from Excel and load it to a Java application that we are developing. The project I'm working on is a development of Retirement Planning System, which our client is going to use for consultation purposes. He wanted to give his clients an Excel template where they put their current financial information such as incomes, expenses and our software should be able to read that file and load that data for projection purposes.
Apache POI provides good API to access Excel files, not only reading but writing as well. Here I'm only using reading functionality only. When we are panning to use Excel as data input method first thing is to develop good template with all required field. This is the sample Excel file I used in my testing.
When reading the data we are reading from cell by cell, so we have to know the exact cell that contains the data we need. I'm using a common interface to read data from Excel sheet. According to our requirement we can implement that to read data in to our java objects.
public interface RowProcessor
{
public Object[] process(HSSFSheet sheet) throws Exception;
}
Here we are passing the excel sheet to our process method and get set of objects after processing it. By implementing this interface I created a class called IncomeProcessor to read the Excel sheet and get an array of Income.
public class IncomeProcessor implements RowProcessor
{
//Row columns
private static final short COLUMN_NAME = 1;
private static final short COLUMN_OWNER = 2;
private static final short COLUMN_AMOUNT = 3;
private static final short COLUMN_INCREASE_RATE = 4;
/**
* The singleton instance of this class.
*/
private static IncomeProcessor thisProcessor;
/**
* Default constructor
* Created on: Nov 8, 2007
* @Author: Sandarenu
*/
private IncomeProcessor()
{
//Private so no outside instantiation
}
/**
* Get an instance of this row processor.
* Created on: Nov 8, 2007
* @Author Sandarenu
* @return instance of this row processor.
*/
public static RowProcessor getInstance()
{
if(thisProcessor == null)
{
thisProcessor = new IncomeProcessor();
}
return thisProcessor;
}
/**
* Do required processing for the Incomes.
*/
public Object[] process(HSSFSheet sheet) throws Exception
{
if(sheet != null)
{
int first = sheet.getFirstRowNum();
int last = sheet.getLastRowNum();
HSSFRow row = null;
List<Income> incomeList = new ArrayList<Income>(5);
Income income = null;
String owner;
first += 2; //Ignore first 2 rows - they are headers
for(int i= first; i<=last; i++)
{
row = sheet.getRow(i);
if(row != null && row.getCell(COLUMN_NAME) != null)
{
income = new Income();
income.setName(row.getCell(COLUMN_NAME).getRichStringCellValue().getString());
income.setStartingValue(row.getCell(COLUMN_AMOUNT).getNumericCellValue());
income.setIncreaseRate((float)row.getCell(COLUMN_INCREASE_RATE).getNumericCellValue());
owner = row.getCell(COLUMN_OWNER).getRichStringCellValue().getString();
if(owner.startsWith("C")|| owner.startsWith("c"))
income.setClientPercentage(100);
else if(owner.startsWith("S")|| owner.startsWith("s"))
income.setSpousePercentage(100);
incomeList.add(income);
}
}
return incomeList.toArray(new Income[incomeList.size()]);
}
return null;
}
}
This is the main class I used to test my data reading. Here first I read the excel file and then get relevant Sheet for processing. Using this technique we can easily populate our java objects using the data from Excel sheet.
public class Test {
/**
* @param args
*/
public static void main(String[] args)
{
TestListner tl = new TestListner();
ImportHandler ih = new ImportHandler();
ih.addStatusListner(tl);
try {
POIFSFileSystem fs =
new POIFSFileSystem(new FileInputStream("Book1.xls"));
HSSFWorkbook wb = new HSSFWorkbook(fs);
HSSFSheet sheet =wb.getSheet("Income");
RowProcessor ip = IncomeProcessor.getInstance();
Object [] incomes = ip.process(sheet);
for (Object object : incomes)
{
Income income = (Income)object;
System.out.println( income.getName() + " " + income.getStartingValue());
}
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
Output of the code.
You can download complete source code and sample Excel workbook here.
I have downloaded Windows Live Writer to see whether I can use it to publish blog posts in my blog. I think it is working fine, and I'm planing to continue using this for my next blog posts. WLW is having number of plug ins to support blog editing. One of the most important plug in is Source Code Format plug in.
JTextArea textArea = new JTextArea() {
ImageIcon backImage = new ImageIcon("Resources/Background.jpg");
Image image = backImage.getImage();
{setOpaque(false);}
//Override
public void paintComponent (Graphics g) {
g.drawImage(image, 0, 0, this);
super.paintComponent(g);
}
};
Eg 2: Add background image to JDesktopPaneJDesktopPane textArea = new JDesktopPane() {
ImageIcon backImage = new ImageIcon("Resources/Background.jpg");
Image image = backImage.getImage();
{setOpaque(false);}
//Override
public void paintComponent (Graphics g) {
g.drawImage(image, 0, 0, this);
super.paintComponent(g);
}
};
We can use this method to add background images to any Swing component.
It has been more than 1 1/2 months since I've done my previous post. It has been very tough time for me with all of the academic activities in the university. Last semester was the toughest semester yet. Had to complete back to back assignments without break ant then had to prepare for the exam. Now it’s all finished.
With this exam our general degree finishes. But I’m planning to do the special as well, so I’ve another year to go before finishing. There is going to be two months break before start of 4th year. So I can have little bit of break and do few more blog posts :)
Make Failure and Frustration Your Friends: A History Lesson
We all experience failure and the subsequent frustration. But how you handle those tormentors makes all the difference in your final outcomes. Oftentimes the peak of frustration comes right before a major breakthrough. That's if you don't quit. So don't quit! Instead use the energy behind that frustration to break through to a new level of strategy. Make failure the friend that brought you to breakthrough's doorstep! Let frustration be the energy that propels your leap across the chasm!
What follows are several success stories from history where failure was a frequent companion throughout these great people's lives. Let's all take some inspiration from their stories.
Last week I said good bye to Navantis.
It was a very difficult decision to be made, but I had to do that since I have to put my full effort for my academics. My nine month experience at Navantis was great. I learn a lot during my internship and part time period.
I'd like to thank all my colleagues at Navantis who helped me a lot during last nine months. Especially CEO Indaka, Duneel and Irzana.
W: Opens Start Menu
W+ E: Opens up Windows Explorer
W+ R: Opens the Run command.
W+ U: Opens Utility Manager
W+ L: Log Off
W+ F: Search files on your computer
W+ D: Show Desktop [will switch back and forth from all minimized and back again]
W+ F1: Help Menu
W+ Pause/Break: System Properties
W + Ctrl + Tab: Cycles through Tabs in your current app [eg. Firefox’s last focused tabs]
W+ Tab: Cycles Through Buttons in Taskbar
W+ M: Minimize all open windows.
W+ Shift+M: Maximize the windows you had open before minimizing
W+B: Set focus to the first System Tray Icon [which is the arrow if you enable the Hide Inactive Icons option]
CTRL+W +F: Search for computers
Basic tasks | ||
[F11] | Toggle full screen mode | |
[Alt] | Toggle display of menu bar (if it's not set to display) | |
[Ctrl]= | Zoom in | |
[Ctrl]- | Zoom out | |
[Ctrl]0 | 100 percent zoom | |
[Ctrl][F] | Search for selected text on page | |
[Ctrl]N | Open current page in new window | |
[Ctrl]A | Select everything on page | |
[F5] | Refresh current page | |
[Ctrl][F5] | Refresh cache and current page | |
[Esc] | Halt downloading page | |
[Alt]D | Select text in Address bar | |
[F4] | Display addresses you've typed | |
[Ctrl][Enter] | Add www and .com to the beginning and end of text entered in Address bar | |
[Ctrl][Shift][Enter] | Add http://www to the beginning of text entered in Address bar | |
Navigation | ||
[Alt]Home | Go to your home page | |
[Alt] Left arrow (or [Backspace]) | Go to previous page | |
[Alt] Right arrow | Go to next page | |
[Tab] | Move forward through items on page | |
[Shift][Tab] | Move backward through items on page | |
Tabs | ||
[Ctrl] Click | Open a link in its own tab in background | |
[Ctrl][Shift] Click | Open a link in its own tab in foreground | |
[Ctrl]T | Open new tab in foreground | |
[Ctrl][Tab] (or [Ctrl][Shift][Tab] to reverse) | Cycle between tabs | |
[Ctrl]W (or [Alt][F4] | Close current tab | |
[Ctrl] number | Jump to specific tab by number (1 through 8) | |
[Ctrl]9 | Jump to last tab | |
[Ctrl][Alt][F4] | Close all but current tab | |
[Ctrl][Shift]Q | Display Tabs list | |
[Ctrl]Q | Toggle Quick Tabs view | |
Searching | ||
[Alt][Enter] | Open search results in new tab after typing search text in Search box or Address bar | |
[Ctrl]E | Jump to Search box | |
[Ctrl] Down arrow | Open Search Provider menu (when you're in Search box) | |
Printing | ||
[Ctrl]P | Open Print dialog box | |
In print preview… | ||
[Alt][P] | Open Print dialog box | |
[Alt]U | Open Page Setup dialog box | |
[Alt]O | Set to portrait orientation | |
[Alt]L | Set to landscape orientation | |
[Alt]E | Toggle headers and footers on and off | |
[Alt]S | Change print size | |
[Alt]N | Show multiple pages | |
[Alt]1 | View full page | |
[Alt]W | View page width | |
[Alt]C | Close Print Preview | |
Menu access | ||
[Alt]M | Open Home menu | |
[Alt]R | Open Print menu | |
[Alt]J | Open Tools menu | |
[Alt]O | Open RSS menu | |
[Alt]L | Open Help menu | |
Favorites, history, feeds | ||
[Ctrl]D | Add current page to Favorites | |
[Ctrl]B | Open Organize Favorites dialog box | |
[Alt] Up arrow or Down arrow | Move selected item up or down list in Organize Favorites dialog box | |
[Alt]C | Open Favorites Center | |
[Ctrl]I | Open Favorites Center with favorites displayed (Add [Shift] to pin the list open) | |
[Ctrl]H | Open Favorites Center with history displayed (Add [Shift] to pin the list open) | |
[Ctrl]J | Open Favorites Center with feeds displayed (Add [Shift] to pin the list open) | |
[Alt]Z | Display Add To Favorites menu | |
[Alt]I | Display all feeds in feed view | |
[Alt]M | Mark feed as read in feed view | |
[Alt]S | Jump to Search box in feed view |