Node.JS Function Callback Scope (i.e. Passing A Function)

687474703a2f2f737562737461636b2e6e65742f696d616765732f6e6f64655f747572746c652e706e67.resizedToday while going through exercise 6 of learnyounode’s tutorials I got very frustrated. This tumblr link doesn’t even do me justice. Yet after about an hour of smashing my head against my keyboard I decided to go back to the basics.

When passing functions in Node.js you must remember the current scope of variables. I ended up passing a callback function to a function within a custom module I was making for the exercise, and ended up resetting the variable to “undefined” in the process. Below is the code that caused me the issue:

Looking above the code seems file at first glance, however take a closer look at that single nested function within getList. It has a reference to call which is linked to the higher level callback function. Apparently Node.js throws a fit with this saying it is undefined.

That being said I wasn’t paying attention to the scope of the code. All I really needed to do was call the callback function from with in the nested function. Because it is embedded in the original function it has scope access to all the variables defined before it’s initialization. So I present to you the working code:

Hopefully one day this will be able to help either myself or someone else out there on the internet.


Setting A Container To A Specific Module On DotNetNuke 7

For some weird reason I keep forgetting how to change individual module’s container types. Let me mention this is not to change every module’s container on a page, only one at a time.

Step 1) Go to the individual module’s settings.

Step 2) Make sure the “Page Settings” tab is selected.

Step 3) Select the module’s container type you want in the “Module Container:” section.

Step 4) Hit the save button and enjoy!

As it seems the preview button next to the “Module Container:” section doesn’t actually work for specific modules, it just changes the containers for the entire page. Weird feature/bug, maybe they will fix this in the next version.

Auto Complete Syntax in Sublime Text 2 for Node.js (SublimeCodeIntel)

Today I was looking into doing some Node.js programming for a simple game idea I had. Finally sitting down at my desk around 10:00pm, I realized I wasn’t purely confident while writing my code. Figuring out the source cause, of my use of Visual Studio and being able to rely on it’s excellent Intellisense for C# and other languages I found myself wedged into a pickle.

Without further due, I leave you with the instructions on how to install SublimeCodeIntel.

Step 1) You will need to install Package Control for sublime first and foremost. You can do this by visiting’s installation page and going through the Simple installation procedure. Make sure you select the tab for the correct version of sublime you are running.

Step 2) Restart Sublime

Step 3) Open up Package Manager either via Command+Shift+P on OS X, Control+Shift+P on Linux/Windows. Type in “Package Control: Install Package” and then give it a moment to populate the list of modules/plug-ins.

Step 4) Select “SublimeCodeIntel” from the list and give it time. On completion of the tool, it will popup a text document from within Sublime and give you further instructions on it’s use.

Step 5) Restart Sublime once again and start editing your .js files with intel. ;)

Hope this helps!

Mobile Websites As Native Applications

Goal: Make a mobile DotNetNuke website into a native application for iPhone and Android using PhoneGap 2.9+.

Ways of Implementation:

1) Javascript local file that grabs the HTML from online and embeds it within a local webpage for the user to view. The plus side to this approach is client side cashing and less data usage on the users end. Yet the con’s is that the HTML grabbed online would have to include full URL’s to images, along with Javascript modified links to external websites.

2) Iframe on the local page. This is like having a mini web-browser that is full screen on the main HTML page. The pro’s of this solution is no need to update the local app when updating the site, because all changes persist. The con’s consist of dependence upon the way the browser renders iframes. It is pretty much hope based with as many versions of Android that are out there.

Considering the one day time limit and other contributing constraints I decided to go with route 2. This gave me the most flexibility along with not having to install a custom theme onto the DotNetNuke installation. If I want, I can at a later point in time; change the theme, along with adding some kind of mobile theme switcher module and not have to worry in the long run if I will need to push a local app update to the phones.

You are probably wondering how I was able to get away with just slapping PhoneGap onto the mobile website. Simple, the original theme we are using for our Multi-tennate website is responsive, therefore already appearing great on mobile phones. Combine that with the demographics of the application’s users; having a mobile app that mimic’s the website is very useful and reduces the learning curve for those classified as elderly using the application on their phones.

Just another look into a quick decision that I had to make in my life. Hope you enjoyed it.



TOTD: Fix A WordPress Site URL From The Database

Here isĀ the script I used today, to fix the site URL from my WordPress installation when I accidently messed it up today.


How To Add Your Email Back To Your Windows Phone Start Screen

Did you accidently delete your email tile from your start screen? I did… and here is how I got it back.

Simply go to Settings>email+accounts and locate the account you are missing from your home screen. Select it andĀ uncheck the “Email” checkbox, then click the checkmark in the bottom application bar. Then go back into that same account again, and re-enable the checkbox for the email to that account. Click the done checkmark at the bottom again, and TA-DA! On your home screen there should be the tile to that email account once again (Check towards the bottom.)


Fitbit One

Fitbit OneThe Fitbit line of products is fairly well known among the general public of today. Fitbit is a company that specializes in health sensors for personal use among individuals.

Hearing about these quite a bit over the past couple years, I decided to go out and get a Fitbit One. Now I know most people are thinking “Why would you get the one?”. Well apparently I am an “old fashion” person by still having a watch, and I counter with
“What would the purpose of a flex be on my arm, when it doesn’t even tell me the time?”

So I haven’t been using it very long, only the past 16 hours or so. Most of which has been me sitting in a car… Yet it feels nice, and is very compact. Looks very similar to my pocket knife when clipped onto my pants.

I am excited to really dive in deep with it, and now that there is an official Windows Phone app for it, you know I will be working hard to do better on tracking my food and weight.

I’ll give more of an update in the next couple days on how I feel about it personally. Especially when I have a few days of the sleep features under my belt! Pretty excited to try it out.

That’s a bit about me and what I am thankful for today, what are you thankful for?`

Spam From INFINITE MONKEYS Through Outlook Via Gmail

Alarm Clock ClipArtLet me set the context. I am late to work because my alarm didn’t go off. This was caused by myself not plugging in my phone at night before bed. So therefore I was already upset at myself, and now at work I see that my some of my family and friends had replied to emails, I frankly never sent.

So obviously I had a problem… I first went into search mode, went through all my security settings on my outlook account, heck even make sure two-step authentication was still enabled. I revoked permissions to every application, phone, and Xbox I had ever signed in on. And yet something still didn’t feel right.

It then dawned on me that a long time ago, when I was still a Gmail user, I had encountered this experience before. So trying to remember my old gmail login credentials and failing miserably, I ended up going through their password reset process.

Picture of site.Once I was in, there was nothing to stop me, I revoked all my app passwords, and then there it was… Account Permissions. Something that I did not recognize at all. An app called “” had access to my account. I then tried visiting their site (don’t suggest it, screenshot to the left) and realized it was just a spam site. This must be what has been causing me problem every 6 months or so for the past couple years…

One last thing, the link it was sending out is below. I made it un-clickable for obvious reasons. Hopefully someone else out there finds this post helpful.


I found a problem. The problem is sitting in front of a computer screen for hours on end. It bogs me down and makes my mind mush. So what is a nerd suppose to do?

BUILD SOMETHING! I decided to throw together a quick app that will remind you every now and then to get up and stretch. I call it Breaker. Simple name for a simple application. Hopefully it helps others by preventing long period’s of uninterrupted times on a PC.