Is it a bug in Google Search?

I have been noticing a problem with Google search for some time now. I have observed that Google gives a link to Chrome web browser, even when I search for something else. I have tried the following keywords:

  • download skype
  • download firefox
  • download flash player
  • get skype
  • get flash player
Each page comes with a sponsored link that carries the relevant text, for instance ‘Skype’ and ‘Firefox’ for the first to search keywords above, respectively. But the actual reference behind the text is not correct. It always points to Here are a few screen shots:

Is it a bug(or is it intentional)?




Ultimate NetSuite Development Tips

  1. SuiteCloud Developer Account

    You don’t want to touch the data/configurations of the production account of your client and you don’t have access to the Sanbox account. Or, you want to develop a SuiteApp as a product rather than for a particular client. NetSuite offers a Community SuiteCloud Developer Network account for free .
  2. Search Box

    Are you a shortcut addict? Feel uneasy to move the mouse to much and always find ways to reduce number of clicks and key presses? Then this tip should work great for you.

    NetSuite Search Box

    As a result your frequent navigations are shortened. For instance “Setup > Customization > Scripts > New”, accessible by searching for “script” and “Document > Files > File Cabinet”, by typing “fil”.

  3. Script Debugger

    Its often painful to make changes to scripts on our machine and then upload them to File Cabinet, before you can see the script running. This becomes even more harsh if the changes is as short as one character. In such a scenario, use the Script Debugger. Make changes online and debug it right within your browser. Keep in mind that the process would require some patience because of back and forth calls between NetSuite and the web browser.
  4. SuiteScript API

    Code Auto-Completion is a great feature. However, there is little help offered by IDE’s in case of loosely typed languages like JS. If you like to get some help with auto-complete, download SuiteScript API from NetSuite File Cabinet. This is a JS file you should add to your project with other SuiteScripts.

    SuiteScript API

  5. Developer Resources

    NetSuite Developer resources are a great way to  develop for NetSuite. Whether you are a beginner or a seasoned NetSuite Developer, the SuiteScript Developer and Reference Guide specially serve good purpose.
  6. Domain Knowledge

    If you only have a background in software development and have no prior experience of working with ERPs/CRMs, you might find it handy to go through the basics of NetSuite ERP/CRM domain. Try out Netsuite for Dummies.

, , ,

Leave a comment

My love… for Expressive Programming Languages

I started out my journey with programming as a teenager learning GW-BASIC. Soon I learnt C language followed by C++.  I was impressed with the OO syntactic constructs C++ had on offer but I felt a little uneasy with a few constructs such as the scope resolution. I started studying Java. It immediately caught my attention with the syntactic improvements and simplifications it brought over C++.

I was still in academics, so learning(precisely trying) programming languages on surface, was a fun activity. I went through PHP, Javascript. I came in interaction with C#. This was the time this language was evolving. The internet was full of text describing the fact that C# was Microsoft’s Java. This encouraged me to study C# and consequently .Net Framework in detail. This was the time LINQ was introduced and I simply loved it. I really liked the way it was elegantly added to the C#. The features added to C# for supporting LINQ namely lambda expressions, implicitly typed  variables, anonymous types, extension methods, query expressions and etc complemented the LINQ infrastructure beautifully. By the time I finished academics, I was a seasoned OO developer.

Recently, I was considering to learn a more cryptic language that aligns with jQuery’s ‘write less, do more’ tagline (although not a language, I like jQuery for the same reason). I considered Python/Ruby but did not find these exciting enough. I have just come across Scala, and decided to make it my next fun mission.

Normally when I learn a new programming, I would give very little time to learning conventional constructs(for, if, function/class definitions etc). After a very long time, I have come in connection with a language that demands paying attention to such constructs. So no liberty of skipping pages.

I am considering Programming in Scala by Martin Odersky – the man behind Scala, et al. At the time of writing this post, considerable amount of content that teaches Scala, is avaible on Google Books. If you already know Scala, you would probably know by now, what my feedback about the language is…A-W-E-S-O-M-E.

The motivation for using Expressive Languages

  • The code becomes declarative in nature. It has less noise for syntactic constructs and more concentration on the intended logic.
  • The above feature makes the developer productive in writing and making changes to the code
  • Debugging becomes super easy.
  • I personally feel, a developer has a better chance of aligning his/her code with coding best practices.

The only reason I find to keep my self from using an expressive language for a particular task is, as you might have guessed performance. Comparing LINQ to collections with loops, reveals loops are faster. You need to be able to judge if you need mission critical performance, otherwise the difference is ignorable.

, , , , ,


A NetSuite Best Practice – Client JS in Suitelets

Often we need writing Suitelets in Netsuite that have conventional HTML UI elements rather than the objects provided by Netsuite’s UI Builder API. We normally use HTML within javascript string to be sent to client side. To write code against the elements in this HTML, client side javascript also goes within a string. Problems arise when we need to update the code within a string as we are not able to use the features of the IDE to its fullest. This post is all about solving these problems, exploiting the fact that the server-side code written for Suitelets is also in javascript.

The Technique

Good news is that each javascript function object has a toString() method, and a better news is that it works as expected in Netsuite ! :).

So the idea is to write client and server-side code alike and use the toString() method of the client-side functions to aggregate the client-side script.


Lets take a simple scenario. We are creating a user registration form within a Suitelet using plain old HTML form elements.

  • When the user inputs first and last name fields we would like to suggest a user name.
  • When the user inputs a password, we would like to warn if it contains the first or last name.

Here goes the script:

function main(request,response)
function getHtml()
    var h = '';
    h += 'First Name';
    h += '<input type="text" id="txtFName" onblur="setUserIdFromNames();"/>';
    h += 'Last Name';
    h += '<input type="text" id="txtLName" onblur="setUserIdFromNames();"/>';
    h += 'User Name';
    h += '<input type="text" id="txtUserName" />';
    h += 'Password';
    h += '<input type="password" id="txtPass" onblur="performPasswordSecurityCheck();"/>';
    return h;
function getClientSideCode()
    var s = '';
    s += '<script type="text/javascript">';
    s += 'function setUserIdFromNames()';
    s += '{';
    s += '  var firstName = document.getElementById("txtFirstName").value;';
    s += '  var lastName = document.getElementById("txtLastName").value;';
    s += '  var userName = firstName.toLowerCase() + \'.\' + lastName.toLowerCase();';
    s += '  document.getElementById("txtUserName").value = userName;';
    s += '}';
    s += 'function performPasswordSecurityCheck()';
    s += '{';
    s += '  var password = document.getElementById("txtPassword").value;';
    s += '  var firstName = document.getElementById("txtFirstName").value;';
    s += '  var lastName = document.getElementById("txtLastName").value;';
    s += '  if(password.indexOf(firstName)!=-1 || password.indexOf(lastName)!=-1)';
    s += '      alert("Using names in password makes it less secure!");';
    s += '}';
    s += '</script>';
    return s;

The highlighted lines contain the script that is problematic. Its difficult to read,  refactor and debug.

Here is the improved version of the code:

function getClientSideCode()
    var arrFunctions = [setUserIdFromNames,performPasswordSecurityCheck];
    var clientScript = '<script type="text/javascript">';
    for (var i = 0; i < arrFunctions.length; i++)
        clientScript += arrFunctions[i].toString();
    clientScript += '</script>';
    return clientScript;

function setUserIdFromNames()
    var firstName = document.getElementById('txtFirstName').value;
    var lastName = document.getElementById('txtLastName').value;
    var userName = firstName.toLowerCase() + '.' + lastName.toLowerCase();
    document.getElementById('txtUserName').value = userName;

function performPasswordSecurityCheck()
    var password = document.getElementById('txtPassword').value;
    var firstName = document.getElementById('txtFirstName').value;
    var lastName = document.getElementById('txtLastName').value;
    if(password.indexOf(firstName)!=-1 || password.indexOf(lastName)!=-1)
        alert('Using names in password makes it less secure!');

Notice the changes from the previous version:

  • All the client-side functions now coexist with the server-side code
  • The getClientSideCode() function  has the references of all client side functions. It iterates over all of these to append each to the client-side script.

Pros and Cons

The latter code is much better than the earlier version.

  • The client-side code is easier to maintain. Its free of noisy code/characters like extra semicolons, quotes and annoying escape sequences.
  • One can use the features provided by the IDE to make change in the code such as renaming identifiers and code formatting.

However there are a few limitations to this approach that must be taken care of .

  • The IDE has no means to discriminate between server and client-side functions so the developer has to be careful using intellisense/autocompletion to avoid calling client code in server-side and viceversa.
  • Every time you create/remove a client-side function you need to update the collection of functions(arrFunctions in the code example).
function main(request,response)
}function getHtml()
var html = ”;
//html += getClientSideCode();
html += ‘<script type=”text/javascript”>’;
html += ‘    function setUserIdFromNames()’;
html += ‘    {‘;
html += ‘        var firstName = document.getElementById(“txtFirstName”).value;’;
html += ‘        var lastName = document.getElementById(“txtLastName”).value;’;
html += ‘        var userName = firstName.toLowerCase() + “.” + lastName.toLowerCase();’;
html += ‘        document.getElementById(“txtUserName”).value = userName;’;
html += ‘    }’;
html += ‘    function performPasswordSecurityCheck()’;
html += ‘    {‘;
html += ‘        var password = document.getElementById(“txtPassword”).value;’;
html += ‘        var firstName = document.getElementById(“txtFirstName”).value;’;
html += ‘        var lastName = document.getElementById(“txtLastName”).value;’;
html += ‘        if(password.indexOf(firstName)!=-1 || password.indexOf(lastName)!=-1)’;
html += ‘            alert(“Using names in password makes it less secure!”);’;
html += ‘    }’;
html += ‘</script>’;
html += ‘<div>’;
html += ‘    First Name<input type=”text” id=”txtFirstName” onblur=”setUserIdFromNames();”/><br />’;
html += ‘    Last Name <input type=”text” id=”txtLastName” onblur=”setUserIdFromNames();”/><br />’;
html += ‘    User Name <input type=”text” id=”txtUserName” /><br />’;
html += ‘    Password  <input type=”password” id=”txtPassword” onblur=”performPasswordSecurityCheck();”/><br />’;
html += ‘    …’;
html += ‘</div>’;
return html;

, , , ,


Javascript Gotchas : for vs for…in

Since the day I first acquainted myself with javascript, I thought ‘for’ and ‘’ served pretty much the same purpose. I always considered the latter to be merely of syntactic ease to a developer. Today I found out an important difference between these two constructs.

Suppose we run this code snippet:

var array = [1,2,3,4,5];
array.capacity = 10;

var str = '';
for(var i in array)
  str += array[i];

var str2 = '';
for(i=0; i < array.length; i++)
  str2 += array[i];

So by the end of the code execution, what are the values of str and str2? Before executing this code I always thought both will give the same result but the fact is :
str2 = ‘12345’ while str = ‘1234510’

If the highlighted line(No.2) is removed, both str and str2 give the same value ‘12345’.

If you closely read the description of the for…in consctruct from W3Schools, you’ll find the reason behind this difference in behavior. It says

“The for…in statement loops through the elements of an array or through the properties of an object.”

What entices us to believe that both ‘for’ and ‘’ are alike is the way these have been demonstrated. Almost all the top search result from google, give the code of iterating array elements while explaining the ‘for…in’ construct, so we never use it for accessing properties. Although, we usually do not keep properties in array objects but this behavior results when we get an array object from an external javascript library. Here is the example code for jQuery that reveals this difference:

var a = '[{"a":1},{"a":2},{"a":3}]';
var array = $.parseJSON(a);
for(var i in array)
  //process array[i]

Useful knowledge !

, , ,


ASP.Net : Construct a test Soap Request using sample

I recently did a project involving ASP.Net web services. I created one of my own and had to call it from some other part of the same project. While  debugging there were numerous occasions when I needed to build small Soap requests to test out functionality or even connectivity. It was annoying to write the Soap packets manually and it was extra-annoying when I could simply get a dummy Soap request from the web service page provided by ASP.NET(screenshot below).

Suppose, I have a simple (VB.Net) method in my web service that I want to call from somewhere:

<WebMethod()> _
Public Function HelloWorld(ByVal str As String) As String
    Return str
End Function

When I run the web service and click the "HelloWorld" link I get the following yellow looking page, which is not new to ASP.Net developers :

This page contains the sample SOAP request/response to call the web method. To use this effectively, I created a little HTML page with some javascript code that takes the sample request text as argument and returns a code that assigns this to a string. Here is the code:

function generateCode()
   var a = document.getElementById('txtSoap');
   var count = 0;
   var output = 'var str = \'\';\rstr += \'';
   for(var i=0;i<a.value.length;i++)
     if(a.value.charAt(i)=='\r' || a.value.charAt(i)=='\n')
     output += '\';';
     output += a.value.charAt(i);
     if(a.value.charAt(i)=='\r' || a.value.charAt(i)=='\n')
     output += 'str += \'';
   output += '\';';
   txtOutput.value = output;

Upon giving this input:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="" xmlns:xsd="" xmlns:soap="">
  <HelloWorld xmlns="">

We get this output:

var str = '';
str += '<?xml version="1.0" encoding="utf-8"?>';
str += '<soap:Envelope xmlns:xsi="" xmlns:xsd="" xmlns:soap="">';
str += '<soap:Body>';
str += '  <HelloWorld xmlns="">';
str += '    <str>string</str>';
str += '  </HelloWorld>';
str += '</soap:Body>';
str += '</soap:Envelope>';
str += '';

Useful. Isn’t it? I ended up using it 3 or 4 times the same day.

, , , ,

Leave a comment

Microsoft Open Door 2010 – Day 2

In my last post I shared with you what I found out on Microsoft Open Door 2010 Day 1.  This post for the proceedings of Day2 of the event.

Most of you must be knowing the release of Internet Explorer 9 is just around the corner. Microsoft is promoting their new browser big time. This event had a full session dedicated to a features review of IE9 and a relative performance comparison with its contemporary browsers. The session was presented by Asli Bilgin (Web Strategy Lead for Middle East & Africa).

IE9Asli told that Microsoft is working with bodies responsible for the web standards to make sure the development for cross browser websites is easier. There is special focus for adapting to the specification of HTML5 and CSS3. To optimize the execution time of Javascript, IE9 comes with a new Javascript Engine “Chakra” which, according to a study by WebKit SunSpider, takes IE9 amongst the ranks of the fastest browsers.  Considering the fact that almost all Windows machines shipped in the last decade have been with GPU, developers of IE9 leverage the machine’s GPU to improve the performance of the web content it renders. To demonstrate the features of IE9, she opened up the Internet Explorer 9 Test Drive page which contains several tests for the new features in IE9 and ran those on different browsers, highlighting the areas where IE9 was winning.

The second session I attended was by Renat Minazhdinov (Technical Community Collaboration Manager – Middle East & Africa) under the title “Microsoft resources for Developers: how to take most of your work with Microsoft”. Renat stressed at the need for developers (and other IT Pros) to constantly keep themselves updated with the latest tools/technologies that are coming out. Employers these days do very little to properly train their employees for whatever is new in the market, therefore employees should have a direct access to the best training resources online.

Renat explained that Microsoft encourages people to try software for free. He suggested using software from MSDN Evaluation Center or Technet Evaluation Center rather than opting for pirated version from some torrent. He claimed that Microsoft is the most social organization as it encourages its employees to share technical information, upcoming tools/technologies and trends. This is in contrast with some other organizations (like Apple) where employees are legally prohibited to share such information. This means people looking for technical information as well as solution for their development related problems, have a chance to directly interact with Microsoft experts on places such as:

For more information, you can find the presentation slides here and here.

I found participation in the event very useful, got a chance to meet people from other organizations in the IT industry and had a chance to see presenters sharing the latest from a giant like Microsoft. Looking forward for more events like these…

, , , , , , ,

Leave a comment