Saturday, November 2, 2013

Verizon Corruption, ISIS and Google Wallet

This is a post from XDA today where I addressed someone with good intentions who is supporting ISIS and trying to defend their decision. Original thread HERE.


I decided to go ahead and check my facts, and yep; they're all still valid and nothing you've said changes that.

Also, NOBODY is left with ONLY the option of using ISIS. They can do like 99.999999% of the population and use cards... OR they can encourage behavior that will further enable a major communications company already well known for abusing their customers to continue doing so.

As for your point about Apple, you're off base there too because Apple doesn't even have enough market share to have such an effect any more and even if they did, they'd come out with their own 'Isis' and watch everyone (including Verizon) bend over and take it. Of course, even Verizon has enough grey matter to keep themselves from that situation so..... it's not going to happen genius.

Your logic is about as strong as something my 3-year old might try on me and it will get about the same response; a condescending tone and then ignored politely with a forced smile. Wanna guess which step we're on now?

By the way, if you think that's raging, you might be a bit on the sensitive side, but if you'd like I can start using a more gentle tone and words just for you. I think I can recall those days from before the Corps reconditioned me (decades ago)

For the logic and/or mathematically challenged, I've gone ahead and compiled some facts of interest to the topic at hand and to explain why ANYONE supporting ISIS in any way is in the minority and only hurting everyone else.

Taken from: ISIS (VerizonT-Mobile and AT&T) and Google Wallet

I'd like to think that the numbers and facts speak for themselves here.

Friday, November 1, 2013

How to run an IISNODE (node.js for IIS) app in a virtual directory OR how to build a node.js app that works regardless of virtual directories in IIS

How's THAT for a lengthy title?

I spent more time than I care to admit trying to figure out how to get an existing node.js app running in a virtual directory on IIS. The entire reason I set out to use node on IIS was to be able to use it inside an existing app and that meant either a sub-app or a virtual directory and in this case, the latter seemed the better (easier) choice but the virtual directory name was causing reference issues for "Dynamic" requests (actual node.js app files).

The solution turns out to be well addressed, at least for "express" framework apps using app.use()

When you call app.use(app.router), you can pass a namespace prefix for your virtual directory and then requests will succeed BUT who would want to hard-code their virtual directory name into their app [yuck!]?

The solution turns out to be quite simple because IISNODE promotes appSettings to environment variables. Taking advantage of this fact, you can add an entry to the apps web.config such as:

        <add key="appvirtdir" value="/nodetest" />

Then you can make one simple modification to your server.js file like this:

app.configure(function () {
    app.use(process.env.appvirtdir || '', app.router);

This way your app is flexible but not even tied to the existence of the environment variable let alone its value UNLESS you want it to be and even then, the variable is local to the app (not really an environment variable).

I'm still working on the static requests and will update this post when I nail that. From what I'm reading everywhere, it should be as simple as updating the relevant rewrite rule but so far it seems that the rule isn't being applied so the settings are irrelevant. I'm still trying to determine why but I'm not quite competent with URLRewrite. Below is what I currently have.

My virtual directory is "nodetest"
~/public/stylesheets/style.css exists
/nodetest/stylesheets/style.css returns "Cannot GET /nodetest/stylesheets/style.css"
/nodetest/public/stylesheets/style.css returns the expected CSS

              <rule name="LogFile" patternSyntax="ECMAScript" stopProcessing="true">
                <match url="^(?:[a-zA-Z0-9_\-]*/)*[a-zA-Z0-9_\-]+\.js\.logs\/\d+\.txt$" />
              <rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true">
                  <match url="^server.js\/debug[\/]?" />
              <rule name="StaticContent" patternSyntax="Wildcard">
                <action type="Rewrite" url="public/{R:0}" logRewrittenUrl="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                <match url="*.*" />
              <rule name="DynamicContent">
                      <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True" />
                  <action type="Rewrite" url="server.js" />

How to install Node.js on Windows and integrate with IIS

I've decided that it's time for me to look at using node.js on Windows because I want a JSON web service that will run inside IIS, using SQL Server and I've learned that node.js is now a first-class citizen on Microsoft platforms.

My goal is to develop a web service that can consume my SQL Server DBs natively and run inside IIS using Node.js for [theoretically] maximum performance.

My development platform (where I'll first run all these steps) is Windows 8.1 but as I understand it, this should all work from Windows 7 to 8.1 with virtually no differences. At this time, I'm using WPI 4.6.

This process will give you an environment where IIS uses url-rewrite to send all requests to server.js in the project folder and it will do the routing and then web.config uses the iisnode section to cause certain files/folders to get processed through node so that IIS is the web server and node is essentially the application processor.

The first step is to install Web Platform Installer (WPI). At present, this can be found at:

WPI is essentially an IIS package manager but it does a LOT more than just manage packages. Using WPI, we will install WebMatrix which does even more than WPI (setup entire sites, with dependencies and provide a simplistic (yet still powerful) development tool that can then publish an entire site (with dependencies) to IIS AND run locally for development.

WPI is a 114KB download (web installer itself) that takes just a couple minutes to install and run.

First run will look something like the following except you may see newer packages (they're listed newest to oldest by default):

The next step is to simply use WPI to install WebMatrix. In reality, you can install WebMatrix directly (though I think that might install WPI anyway), but WPI is akin to NPM and you'll likely want it soon anyway.

At the top-right of WPI, in the search box, type "WebMatrix" and press enter/return. Find the latest version (currently 3) then click the "Add" button for it. Next, hit the "Install" button at the bottom.

I have a fairly fast connection (150Mb Cox Ultimate) and a fast machine so my install took about 20 seconds. When the install is complete, exit WPI and launch "Microsoft WebMatrix" from your Start Menu (or MetroUI if you've managed to live with it. I use StarDock's Start8 to give me back my start menu to and basically do away with metroUI).

Once you've launched WebMatrix (here-unto referred to as WM), deal with the Azure marketing content (I hit "not now" at the bottom right) and you're ready to setup a Node.js site.

Click the big "New" icon then "Template Gallery".

On the left, select "Node.js" template group then pick one of the templates. I'm using "Starter Site" for this tutorial. Next provide a "Site Name" at the bottom then click "Next".

As you click "Next" on the next few screens, the "magic" happens. ALL the dependencies are identified, downloaded, installed and configured rather than you having to locate all the compatible libraries, apps, modules, etc.. Just click "I accept" and sit back with WebMatrix does all the hard work. This will also install NPM by the way :)

This process will install "IISNode for Express" by default. If you are running full IIS (real development machine or server), you can now go back into WPI and search for and add "IISNode" to install the version for IIS, otherwise you now have a fully working Node.JS site ready to be opened in Visual Studio, run locally as-is, or published to an IIS Server.


If you're running full IIS locally and want to deploy locally (or on a machine with IIS), then follow the steps below (found them HERE). Also, using WPI, install "IISNode for IIS (IIS exists)".

Here is the quick version of what I found that is more recent guidance and was enough for my demo:
  1. 1.Install Web Deploy 3.5 for Hosting Servers [using WPI]
  2. 2.Bounce IIS and IIS Manager [Restart IIS]
  3. 3.Configure the Management Service I used parts of this:
  4. 4.Install Web Matrix to another machine. (You cannot deploy to the local machine.) [Yes you can, you just can't deploy to 'localhost', you must use your machines FQDN]
  5. 5.Deploy from the machine in 4 to the machine configured in 3. [Which can be the same]
Hope that helps others through the process
I still had some issues afterwards and one was resolved by opening "Programs and Features" from the control panel, searching for "Web Deploy", then click "Change" and select the deselected options (like the IIS extension).


Of course, after taking the time to put this post together, while searching for Razor related content, I ran across the following (which is basically my post with follow-up related to Node.js code):