Author: Jamie

  • MSSQL Running an extra AND statement

    This had me baffled and shook me to the core as it went against everything I understand about an AND statement. I was using a standard CASE as I have done hundreds, if not thousands, of times that contained two AND statements. The first part of the statement returned false but, MSSQL still proceeded to execute the second statement. This may not seem like a big deal, but in this particular case I had an error producing data type mismatch problem. When the first part of the CASE was true the second part compared the data as a bigint whereas the actual value was an nvarchar, so it errored.

    Let’s take a look at an example.

    (more…)

  • What is the difference between String and string in C#?

    Short answer: nothing. string is an alias to System.String. This also holds true for int and System.Int32.

    If you want my personal preference I always use the lowercase version aka the alias. Why? Because I don’t need to add the following reference: using System; in each file. I know, it’s a little OCDish, but what can I say…

  • Updating all npm packages in a Node.js project

    I have two common scenarios where I want to update my npm packages. First, my existing project needs a package update or secondly I’ve started a new project and since I’m lazy I’ve copied my package.json file from one project to this project. I’ve found two different ways to perform this.

    1. Changing the versions to * in my packages.json
    2. Using the npm-check-updates package

    Let’s examine in more details each way.

    (more…)

  • Passing/reading command line arguments with Node.js

    It’s quite common when running an application to want to pass arguments to the program to define how it should run when executed. This is no different then with Node.js. To accomplish this I like to use one of two ways:

    1. Reading the JavaScript array node js process.argv and manually parsing the variables
    2. Using an npm library such as minimist that helps simplify and (in my opinion) parses them into a nice JavaScript variable

    Let’s take a look at both ways.

    (more…)

  • Searching for and loading an invoice object using NetSuite Restlet

    This article assumes that you have some NetSuite experience and have created a NetSuite Restlet. I have written a previous article that describes how to authenticate with NetSuite for calling a Restlet using token based authentication that should help you get up-to-speed.

    To search for objects using NetSuite’s JavaScript Restlet implementation I will be using nlapiSearchRecord. Once the record has been found it will then be retrieved using nlapiLoadRecord.

    (more…)