Hello World (again)

Its been more than 9 months since I last wrote on my blog (Time really flies doesn’t it?). In this post, I reflect back on what kept me busy during this period.

Sometime in May Last year I along with a friend started www.chahiye.info (see my earlier post here). Running a company certainly drains out a lot of energy from its founders, leaving absolutely no time for anything (writing blogs included). Another side-effect (of running a co) is that it leaves your bank accounts with lots of empty space. This obviously makes the whole process more painful and interesting at the same time. If time permits I hope to write another post about the experience & some gyan 🙂 sometime soon. It might make an interesting read.

Anyway a few weeks ago; with our bank accounts exhausted, we figured that it is critical to generate some cash to sustain ourselves & keep the company going. The only way I could help in that was to re-start my freelancing work (I had actively stopped working on projects a couple of months ago – wanted to devote all my time at chahiye). I was fortunate enough to get work real quickly. I am currently spending half of my day consulting on an interesting project & might just take up another one in PHP (I’m new to PHP and therefore looking forward to it). Resuming tech work again exposed me to interesting observations, which I plan to share with all here. Stay Tuned …..

Its good to be back !!!!!!

request.getSession (false) always returning a session

Recently I found that request.getSession (false) was *always* returning a session instance even when it is not created earlier by my application. After spending 2-3 hours on it, I figured out the cause. Read on …….

I am working on adding a rather unique jobs functionality for chahiye.info which required an authentication mechanism. For this purpose, I wanted to add a check at various pages to ensure that if a session did not exist a request to these pages would be re-directed to loign page. This was done using the following code

HttpSession session = request.getSession (false);
if (session == null)
{
// forward request to login page
// return;
}

However to my surprise this api was always giving me a session instance even when I had not explicitly created one (after the login request). I searched my entire code base & confirmed that I was not creating a session anywhere. Looked up the JavaDoc for this method in class javax.servlet.HttpServletRequest, which clearly stated that if the supplied boolean is false and if the request has no valid HttpSession, this method would return null.

After spending some more time, I realized the problem. Basically if the application is using a JSP, the container (in my case Tomcat 5.5) by default ends up creating a session. In my case, the user’s landing page itself was a JSP as a result the session gets created at that time itself. To avoid this, simply add the following directive at your JSP, which tells the JSP compiler not to use session variable in the compiled class.

< % @page session="false" % >

Note – You will have to get rid of extra spaces between “<“, “%” & “@” symbols.

Have you also had a similar situation and figured out another cause for this? If yes, please share your experience here.

IIS Does not start – Skype may be the culprit

I come from Java world but was recently trying my hand at IIS. I wanted to learn how easy or difficult is to deploy a simple website on it. During the process faced a problem and figured out the cause, which I think is worth sharing. Read on …….

I was basically following an online tutorial here. Unfortunately after installing IIS on my win xp pro box, I could not confirm that it was running – When I pointed my web browser to http://localhost the default page did not show up. As a matter of fact nothing happened. I did not get any error message, just a simple white screen – I tried with Firefox (my default browser) as well as IE 7.

After reading some more, I found out about the IIS Management Console. Through it, I could see that the “Default Website” on my IIS installation wasn’t started and any attempt to start it would result in “Unexpected Error” window as shown on the right. I had no clue what was going wrong. Tried re-installing IIS but didn’t help.

Next while going through the properties of “Default Website” I realized that it works on port 80. Tried to change it (I thought that maybe the firewall might be causing some havoc) to 8080 and VOILA it worked. Only if the error message could be more meaningful it would have saved me a an hour or two.

Next I Tried disabling Firewall but it didn’t help. Executed the following command on command prompt to find that some process was indeed listening on port 80.

d:\>netstat -a | find “LISTENING”
TCP nucleo-01:ftp nucleo-01:0 LISTENING
TCP nucleo-01:smtp nucleo-01:0 LISTENING
TCP nucleo-01:http nucleo-01:0 LISTENING
TCP nucleo-01:epmap nucleo-01:0 LISTENING
TCP nucleo-01:https nucleo-01:0 LISTENING
TCP nucleo-01:microsoft-ds nucleo-01:0 LISTENING
TCP nucleo-01:1025 nucleo-01:0 LISTENING
TCP nucleo-01:35048 nucleo-01:0 LISTENING
TCP nucleo-01:1026 nucleo-01:0 LISTENING
TCP nucleo-01:netbios-ssn nucleo-01:0 LISTENING

Had a look at my processes but didn’t see any apparent process (Apache or something like that) so decided to kill processes one by one. My first shot was at Outlook (didn’t help), next came various IMs – That one helped. I was able to start IIS after killing Skype, Yahoo & GTalk on its regular port 80.

I later managed to zero in on skype and found that it was indeed running on port 80. On checking up its configuration (Tools -> Options -> Advanced -> Connection) found an option to stop using port 80 & 443. Restarting skype after disabling the use of standard http & https ports solved my problem.

I’m still new to MS world & in the process of learning so wonder if there is something else missing/incorrect on/with my machine configuration. Why wouldn’t a simple error (like port busy or something) be shown otherwise?

Have you faced this problem too and have something to share, please let me know.

Converted into three column layout

Today I spent time to convert my blog from the default 2 column to 3 column layout. I wanted to do that because the side-bar (on the right) was getting too cluttered with information.

First 10 minutes on google lead me to this link here, which provided simple instructions to modify the default blogger template to do what I wanted. Since I had earlier modified the template (to fit the top-navigation-bar) the instructions did not apply as it is, but the explanation provided was useful and I managed to complete this in 15 minutes. Thanks Mr Hans.

About My Blog

It feels odd to do this after 40 posts, but I guess I have been missing this post since a long time; so here it comes – what is my blog all about.

I’m basically a software developer @ heart, so essentially this blog will revolve around developing and using software. Being a freelancer & an entrepreneur I do get myself involved with various events & forums that are related to technology or entrepreneurship. I occasionally write about these events. I also sometime write about my thoughts; on anything and everything related to work. Lastly I occasionally write about startups (mostly around Delhi region) that I come across and are doing interesting work.

As also predicted in my introductory post here (more than a year ago), the frequency of my posts is not all that good. In this last 13 odd months, I have written 40 posts i.e. ~ 3 posts a month on an average. However since most of my posts are going to be about software they would be relevant for quite some time.

Outlook with Airtel can make current window lose focus while send/receive

I ran into a strange problem recently. Every now & then while working on my Windows XP SP2 laptop, I noticed that the active window would lose focus for 3-5 seconds. This was very annoying as while typing I would miss a few words.

Since this started happening very recently, I prepared a list of things that I had done alt-tab[3]recently. Even tried un-doing a few things, but nothing really worked. Today I happen to discover the source of the problem. At work, for a different reason I increased the frequency of automatic send/receive in my Outlook. I noticed with this; the problem started appearing more frequently. As a matter of fact, it happened every time Outlook did a send/receive. This was a good break-through. I tried un-doing a few things that I had done recently in Outlook settings. For example removed a few recently added rules; disabled send/receive groups and used “All Accounts” group instead. However still nothing worked. I tried searching google and found somebody else had the same problem, but the suggested solution on the forums required messing around with the registry & I wasn’t comfortable with the reasoning provided either so didn’t really try them out.

The next good thing that just happened was that in one of those 3-5 seconds I pressed ALT-TAB & noticed a new window in the preview which shouldn’t have been there. I could identify the logo was for Airtel; my new Internet Service Provider (I had recently shifted from BSNL to Airtel). Along with the router, Airtel guys had installed this program called Airtel NetXpert 2.0 on my machine which I thought was a single point of resolution for all my Airtel related problems (So far I really haven’t got a chance to look at what it really does so not sure if I’m correct here). Next I tried killing this program, which was quietly running in the background but accessible through Notification Area (where you see your clock) & VOILA my problem got resolved.

I guess this NetXpert program is monitoring outgoing & perhaps incoming traffic from my machine (even if I’m not on Airtel network). So when Outlook tries to connect to my mail server somehow this program gets activated which for some reason tries to steal focus from the current window. Though this is just a vague guess theory & there are still a quite few open ends here, but I guess I’ll leave this here.

If you faced this problem too, do let me know by adding a comment here.

Salesforce Native Functionality

Now that you understand what salesforce is, it is time to dive in. This article (second in salesforce series) talks about how to customize/extend salesforce platform using its native functionality that does not requiring any coding.

An organization account in salesforce at the root level comprises of various data objects. While the platform comes ready with some pre-built objects (like Account, Contact etc), it also allows its users to define new ones. This process of creating a new Custom Object is similar to that of creating a table in a database where the definition of the object is captured & requires special privileges. Salesforce provides simple web based UI tools to administrators that allow them to define an object & add attributes to it through a UI wizard. The following section talk about various concepts that are involved related to salesforce objects.

Custom Fields : Once an object is defined, it is not of much use till you add “Fields” to it. These fields are elements that would be required to be filled with data with every record of the custom object. You might want to think of these as columns of a database table. These fields could be of different types like numbers (integers as well as floating), text, date, Boolean, currency, lists etc. While defining the object, one is required to specify the “record name” – a field that would uniquely identify a record. This field of type Text or auto-generated number can be thought of as the “primary key” for the object.

Constraints :  Once an attribute has been defined, the platform allows adding simple constraints on them. A constraint comes handy when you want to impose restrictions on the possible values that an attribute can contain. For example if an attribute represents a percentage value, you would want to impose a constraint that it can be between zero and hundred. You also define an error message that is displayed if the constraint is violated.

Dependent Fields : Fields can also be marked dependent on one another. For example if you have a drop down (or pick-list) that stores a list of countries and another drop down that stores a list of cities; it is possible to show only cities of the selected country by marking the “city” drop down dependent on the “country” drop down.

Relationships : When adding an attribute, one can also set up a relation between objects. For example – When defining a “Student” object, it might have an attribute called “School” for example which might have its own set of attributes. These fields are known as “lookup” fields. You might want to think of this as a “foreign-key” relationship.

Triggers : Another interesting feature that can be used for manipulating custom-objects is triggers. These are call back methods that are executed by salesforce platform when data is inserted, updated or deleted. The logic to be executed is written in Apex (to be discussed later).

Security : When creating an attribute, security is also defined for that attribute. This essentially involves who all have permissions to view/modify/delete data in the field. More on security later.

Tab

sf-tab[8] Once a custom object has been defined along with the associated relationships, dependencies & constraints one can add that object to a new “Tab”. A tab is a UI element that provides visibility for the object to a user.  A tab can show a list of instances/records of a particular object; clicking each item in the list provides more details (Fields of the record) which can be edited if desired (assuming edit permissions are granted). A tab also provides buttons that allow a user to do standard operations like “New” which presents a user with a form that takes input for all the attributes defined. One can also create custom buttons to do custom actions – For example you might want to have a custom button that modifies an attribute of multiple instances in one shot (this would require Apex programming though which I’ll talk about in later sections).

Page Layouts

As mentioned above a Tab associated with a custom object provides information about instances of that object. All UI related aspects of this object are decided by the Page Layout. One can define different layouts and associate them to different roles (therefore controlling the amount of information visible to any role). A Page Layout manager is the place where one defines what all fields would be shown & in what order. This also allows a user to select the buttons that are to be shown.

Note – This post only introduces various concepts as used by salesforce & is by no means complete. If you like to read further, here is an excellent document that should help you – http://wiki.apexdevnet.com/index.php/Members:Creating_On-Demand_Apps_PDF. This points to a document titled : Creating On Demand Apps and is an excellent read. You would need to signup (free) as a developer to download this.

If you have any questions, please feel free to post the same in comments section and I would try to help as much as possible.

What is salesforce?

As an introductory post of the salesforce series this article intends to start from the basic question outlined by the heading of this article – What is salesforce?


Salesforce is an on-demand, web based platform that allow people to develop & host custom applications. Force.com (that’s what salesforce calls its platform) allows developers to build and deliver any application without any other software (other than a web browser). There is no need of a database, no need for any SDK to be installed on the local machine. The application once developed is available for access online immediately – therefore eliminating any need of hosting software servers & hardware. Read more about Platform As a Service nature of Salesforce here.

Salesforce also provides CRM solutions off-the-shelf to its customers that require zero development. These applications are ready to use and are extremely popular. These CRM applications are easy to customize through drag and drop click tools and therefore can be used with equal ease by small as well as huge organizations. A lot of organizations world wide have trusted salesforce for managing their sales & customer data for improved customer service, partner management and better visibility into sales pipelines.

Salesforce also provides an on-line marketplace called Appexchange; where people can buy/sell & deploy ready to use pre-built salesforce applications that can run on Force.com platform. This allows companies and individual developers to build applications that they can sell to prospective customers. salesforce.com also manages & encourages a huge developer community at developer.salesforce.com [DFC] which allows various tools to help developers build their applications.

Salesforce Tutorial

With this post I intend to start a series, where I would talk about Force.com – salesforce unique on-demand application development and hosting platform.

I got introduced to salesforce around last week of January 2008 and was assigned a task to implement a CRM application that could talk to a website’s existing proprietary system. The first problem that I faced at the time of learning was the plethora of terms that were being used all over the place at salesforce website. There is good documentation available in chunks and pieces but it takes time to reach the right document. Once I figured out some terms and where to look for help, things became easier. I would attempt to demystify some of these terms through my upcoming posts.

The journey that I undertook in developing the application forced me to quickly discover features that Force.com offers. Unfortunately I made initial mistakes in choosing the right components/features to build my application. These mistakes could have been avoided had I been better educated about the platform features. Some of these upcoming posts would help readers avoid making these mistakes. After going live a couple of weeks ago, I also discovered some inherent strengths and weakness of the platform. This knowledge too I feel would be useful for many others.

I would aim to complete this series of posts in a week or two; therefore would target publishing one post in 2-3 days. I would be categorizing all these posts under the Category “salesforce“.

OSS Camp 4 happening in Delhi on 21st June

oss-defaultOSSCamp Delhi Summer Edition is the fourth unconference in the OSSCamp series. It is a platform for promoting Open Source Projects from India. Details of the camp can be found at http://osscamp.in/index.php/OSSCamp_Delhi_Summer_Edition

 

Some of the sessions listed there definitely look interesting. I’m hoping to increase my gyaan on some of the open source products that I use/like.