Skip to main content

Posts

Showing posts from 2010

Twenty Ten Last Day

Today is the last day of this year..This will be the last post in this year . Lot of things happened in this year and already every things has added to our life as a experience. For everybody……         HAPPY NEW YEAR!!!!!!!!!!!!!

Importance of good user message

Problem Company 1 Dear Valued Customer,Your Mobile invoice value for [date] is Rs[Amount] & the total outstanding value at date is Rs[Amount]. Thank you. Our record indicate an overdue of Rs.[][date] pls settle the same by date to enjoy uninterrupted services.Pls ignore if settled. Company 2 Dear Valued customer,Your bill dated date is now due.Please make payment.if already settled pls ignore this sms. Given messages are received from two different telecom company in Sri Lanka when there is a due payment . Mistake The way messages has presented is different .In company 1 first reminder message sends very polite manner. but it’s second message is not polite it directly gives the message . But message is informative but company 2 message is very polite and short but it s not informative.When reading, user gets two different impression over the message. Lesson Learned So good message should polite,short and informative.

Appreciation

Today I got this touching email: One young academically excellent person went to apply for a managerial position in a big company. He passed the first interview, the director did the last interview, made the last decision. The director discovered from the CV,  that the youth's academic result is excellent all the way, from the secondary school until the postgraduate research, never has a year he did not score. The director asked, "Did you obtain any scholarship in school?" and the youth answered "none". The director asked, " Is it your father pay for your school fees?" the youth answered, my father passed away when I was one year old, it is my mother who paid for my school fees. The director asked, " Where did your mother worked?" the youth answered, my mother worked as cloth cleaner. The director requested the youth to show his hand, the youth showed a pair of hand that is smooth and perfect to the

Chain of Responsibility Pattern

This pattern I used for handling scenario as follows; Applying permission on user to view some data is based on many criteria and those are having a sequence. By Appling this chain of responsibility pattern I could able to arrange the code nice manner , very easy to add new criteria as well as change the sequence.

Organized well

In your desktop where is your taskbar? Most of them keep it as default . That is in bottom of the screen like this. Till few months back I also kept as that manner. But now I have positioned it right side of the screen. By keeping in this position its is very comfortable to access the list . High number of items can be arranged in this position in a very organized manner. If you are using wide screen, this is the effective position to use the maximum use of the screen. Following screen gives idea of comparison of the positions. Other than those when positioning the task bar we should concern about followings; Continually remove unwanted items, otherwise cant directly access the what we want so it will be a time consuming task. Arrange the width of the task bar up to user preference. Enjoy the right side arrangement of the taskbar.

Before You Refactor

Refactoring need to be done by every programmer and it leads to have a maintainable code base.Rajith Attapattu has highlighted very good points when doing refactoring The best approach for restructuring starts by taking stock of the existing codebase and the tests written against that code. Avoid the temptation to rewrite everything. Many incremental changes are better than one massive change. Many incremental changes are better than one massive change. New technology is an insufficient reason to refactor. New technology is an insufficient reason to refactor. Remember that humans make mistakes. Other than above, good practices can be found in here .

97 Things Every Programmer Should Know

Some sections of above book I read few months back and today I got a thought to read it again. There are more than 97 things programmer should know but this is great collection and good prioritized list to follow. No need to read it from top to bottom , can switch to any topic as we like. . Also it’s proud to find one author from Sri Lanka who is Rajith Attapattu

Ship It Review -2

You need to focus following three area to built up a great product and ship it successfully ; Techniques Infrastructure Process The book highlights importance of following areas comes under the tools and infrastructure, Manage Assets , Script Your Build , Build Automatically , Track Issues, Track Features, Use a Testing Harness , On Choosing Tools ,When Not to Experiment. These factors lead  for building a good infrastructure by saving time, and enhancing effectiveness.In the beginning of the chapter two ,it gives nice quote by John Carmack. . . the cost of adding a feature isn’t just the time it takes to code it. The cost also includes the addition of an obstacle to future expansion.. . . the trick is to pick the features that don’t fight each other. Shortly the code should be according to the Open close principle .

Rubber Ducking

Actually this is great concept we can used for improve our coding and also to find the missing areas in our scenario. Find More Concept : Place a rubber duck on your monitor and describe your problems to it. There's something magical about stating your problems aloud that makes the solution more clear.

The transaction is in doubt

Sometimes you may get this error when you use transaction scope . The transaction is in doubt I also got this error recently and able to find the reason for it. That is because of the some of the readers had not properly disposed. Actually in this case you can use Using keyword to overcome this. Exception : System.Transactions.TransactionInDoubtException was unhandled by user code Message="The transaction is in doubt." Solution : using (reader) { }

Ship It Review -1

This books has been described Habits in interesting manner. Following story took from it and the story shows how we should go for a decision rather considering everybody doing it or becuse of we have already done it. Story: Did you hear the story of the woman who always cooked ham by cutting off and discarding a third of it first? When asked why, she said that was how her mother always cooked hams. When asked, her mother said that was how her mother had always cooked. They finally confronted Grandma, who admitted that when she was young, she didn’t have a pan big enough for an entire ham, so she always just cut the end off, and it became a habit.

Dead Code Problem

Problem Actually this problem occurred when i was doing integration two projects. [Phase1 and phase2 of a project] . Phase 2 is developed on top of the phase1. Parallel phase1 had changed lot . Mean time those were working on phase2 has commented existing phase 1 code without comments . Phase 1 and phase 2 merged with some conflicts. So we commented such places with the descriptive comment . After merged the result code base has merged those phase 2 commented parts. Also there was some of already dead code in phase 1. So it is difficult to understand weather this is actual dead code or commented one from phase 2. Mistake Had left dead dead code and missing comments . Lesson learned Normally developers leave dead code in their original code with the mind of future purpose. But this not a good habit to continue.As long as you use source control ,earlier code may exist. Problem will occur if you are not using such version control. In such a situation you can keep dead code with des

I Like Google Flintstone’s image

I like this Flintstone’s 50th Anniversary image of Google. Very creative and attractive... More info ...

Understand how things are coupled

Problem This problem was to add new filtering for one of already completed search scenario as well as another scenario. The search part is completely had been built using dynamic SQL. There for decided to build generic method which can used by all the scenario with the intension of reusability. Implemented filtering with the design pattern. ok.. Fine..Everything fine...But last moment find another placed which used this filtering which is tightly couple with the another SP..So couldn’t use this newly implemented method..Cant help...Had to written that filtering inside the SP. In this problem not much harm raised. We couldn’t achieve reusability because of tightly couple module. Mistake Missed one of the affected scenarios of the filtering. Lesson learned Before getting into a decision we need to identify the all the affected paths those areas already exist. And also need to understand how much each of them couple with other modules and SPs... Anyway got chance to improve my

Integration

My next task will be the integration of a project which has two versions. Today i started working on it . Finished outline part and hope to identify the common mistakes we have done. So next post will be on highlighting the practices we should follow .

LIKE in sp_executesql

If somebody wants to use LIKE in sp_executesql if you use syntax as follows it will give an error. Wrong Syntax: LIKE N''%'' @variableName ''%'' Error message received; Msg 102, Level 15, State 1, Line 24 Incorrect syntax near '%'. Correct Syntax: LIKE N''%'' + @variableName + ''%'' Have to double the quotes as well as '+' marks around the variable.

Session Sharing

Recently i had a issue like this; if same page opened using different tabs in the browser and trying to save then the changes are done to one page is effect to other page . Finally found it is because of the session sharing problem in the browser. Could be able to overcome this problem using view state in the my scenario. But had to work lot..;-)

Add ready Only attribute

If you want to toggle read-only attribute in a textbox you cant do it as follows. //This will make the textbox read only . textBoz.Attributes["readonly"] = "true"; //This will not remove read only from the text box. textBoz.Attributes["readonly"] = "false"; Solution :- //This will make the textbox read only . textBoz.Attributes["readonly"] = "true"; //This will remove read only from the text box. txtAbn.Attributes.Remove("readOnly");

Get distinct

If you want to user LINQ distinct have to override IEquatable .Equals method. Rather using this it can be easily achieved like this ; var distinctItems = items .GroupBy(x => x.PropertyToCompare) .Select(x => x.First());

Update

If you want to update a field of one table from another table it can be done as follows: Example: Table A field 2 has foreign key relationship with table B .Need to update table A field 3 with the value from table B. Table : A Field1 Field2 Field3 1 ------1------ Null 2 ------2------ Null Table : B Field1 Field2 1------- 3 2 -------4 Query 1: UPDATE A SET A.Field3 = B.Field2 FROM A a INNER JOIN B b ON A.Field2 = B.Field1 WHERE A.Field3 is null Query 2: update A set A.Field3 = (select B.Field2 from B where B.Field1=A.Field2) where A.Field3 is null Query 1 is faster than Query 2

Who's got the monkey ?

Today i found a interesting article on how manger should delegate his work. According to my understanding, this theory is highly applicable for software industry because most of the targets are accomplishing using teams.When we work in a team we should know what are the things need to be delegate.And those work must have to delegate.According to this theory problems are considered as monkeys. So everybody wants to know about how to deal with monkeys.

Writing Tips

When we are writing emails some time we may not care much about small things.But it will create difficulties to recipient. As well as it reflects sender. This is a good post on it . It highlights necessity of the good writing.It mention simple example as follows; Compare the following two job applications. The content of the emails are identical – but who would you give the job to? i’ve attached my resume i would be grateful if you could read it and get back to me at your earliest convenience. i have all the experience you are looking for – i’ve worked in a customer-facing environment for three years, i am competent with ms office and i enjoy working as part of a team. thanks for your time Or Dear Sir/Madam, I’ve attached my resume. I would be grateful if you could read it and get back to me at your earliest convenience. I have all the experience you are looking for: * I’ve worked in a customer-facing environment for three years * I am competent with MS office * I

Silly mistake

Actually i underwent a problem which was very painful. But finally i found the problem. I could able to learn lot from that even thought its a Silly mistake . Basically scenario is as follows; There is a asp page and it pop up another page. Once i click on the parent page and it pop up a child window but it get minimized within a second. Finally got to now there is a text box focus method calling from parent page.:-)

DB4o & .Net

Its new to me..Today i started to work on DB4o and up to now feel better. Learning curve is short and also easy to learn. As a beginner it is better to use DB40 reference as well as http://www.codeproject.com/KB/database/OOP_with_db4o.aspx

First day of Year Twenty Ten

Today's the first day of 2010. There is a question weather we should called this year as twenty ten or two thousand ten ...It is very easy to say as "twenty ten" rather two thousand ten( Twenty Ten ). Anyway its a another new year. So,,, ,...................... Happy New Year..........................