NodeSchool Tutorial Solutions: scope-chains-closures

Sorry for all the time off, sometimes life gets busy, oops. Here’s the next workshopper from scope-chains-closures. You can find solutions in the list below.

Once again, if you only copy and paste the solutions, you probably aren’t learning anything. I’ve done my best to do things the way the workshopper intends them to be done. Also worth mentioning a lot of workshoppers now have “expected solutions” after you complete a challenge. My solutions may not always match those.

Workshopper / Tutorial was found via

Workshopper source can be found here on GitHub.

    Nothing to see here… just follow the instructions and learn a little bit about using Google Developer Tools in Chrome. If you’re fairly confident and comfortable in Chrome, this won’t do too much for you. It’s an interesting exercise none the less.

NodeSchool Tutorial Solutions: learn-sass

Jumping a little bit out of order, this is a workshopper I completed awhile back at the Dallas Nodeschool. Since I already had it done, I figured why not through the solutions up here with the rest of them. This workshopper isn’t really related to Node.js specifically, but it’s fairly quick and easy tutorial to get you started with a little SASS and SCSS. If you have any experience with CSS in the past, this workshopper will go very easy and very fast for you. Cheers.

Workshopper / Tutorial was found via

Workshopper source can be found here on GitHub.

  12. FOR LOOP

NodeSchool Tutorial Solutions: javascripting

As discussed in a previous post, I’ve decided to start cranking through a series of small projects in Node.js. The motivation behind the idea is to familiarize myself with Node in several diferent scenarios and exercises to broaden my understanding of the Node ecosystem. As part of that, I also decided to post solutions to the workshoppers I complete on my blog in case anyone gets stuck in the process of completing one of the workshoppers.

I’ve started by going backwards and doing some of the earlier, easier workshoppers I completed back when I first started attending NodeSchool Dallas. You can find these solutions in the list below. It is worth noting, if you only copy and paste the solutions, you probably aren’t learning anything. I’ve done my best to do things the way the workshopper intends them to be done by attempting to only use basic javascript or modules mentioned in the challenge itself. I should also mention a lot of workshoppers now have “expected solutions” after you complete a challenge. My solutions may not always match those. For the list of solutions below, I literally just installed the node package and went through each exercise until it was complete.

The javascripting workshopper is the first workshopper mentioned on NodeSchool’s website and it is geared towards beginners. If you have a working knowledge of JavaScript from previous programming or web development experience, it is very likely this workshopper won’t teach you much and you might be better off skipping ahead to learnyounode. Either way, best wishes to everyone.

Workshopper / Tutorial was found via

Workshopper source can be found here on GitHub.

  10. ARRAYS

Becoming Fluent in a New Language

Over the past several years, I’ve been blessed by gracious companies to take on projects in languages that were not my expertise to say the least. Amazingly, some of these projects were the most rewarding projects in my career. I can honestly say that in the past 5 years, I’ve tackled Objective-C, Java, and Swift. Along with the core languages comes an array of frameworks that slip into your knowledge base such as AFNetworking, Spring, Mockito, Alamofire, Camel, etc., etc. The most interesting thing to me about the above statements is that while I believe they are true statements, I could not pinpoint a single time, task, or mindset that helped me become fluent in any of those languages.

For Objective-C, I attended an iOS 5 Bootcamp hosted by Big Nerd Ranch. I felt outclassed the entire week and spent basically every minute I was awake furiously working through exercises. Sometime between that camp and the next year with that company, I became fairly well-versed in the world of iOS. I knew how things worked. I could troubleshoot an application. Outline a design. And interview for a mobile solutions consultant position fairly well.

The latter statement is of some importance, as I took that job. My first project in that position would end up submerging me in a world of SOAP web-services built in Java using a myriad of, sometimes outdated, frameworks. Once again, I felt out of my league. Everyone around me seemed to have this built in understanding of Java, dependency injection, unit testing, continuous integration, Eclipse, SOAP, and Tomcat. The people around me were all about my age, how did I fall so far behind? Within a few months, I would be recognized as a great trainer for new team members coming into Java projects for the first time. I was helping people understand how web-services worked, how Tomcat responded to request and loaded Java applications, and how Spring worked it’s magic in pulling all of your Java classes together.

How did this happen? What steps did I take? What training course did I follow? The answer is much more simple than I would have originally thought. Basically, I just submerged myself in the language (sometimes unwillingly). By having a job that required me to work on the project, I was somewhat forced to learn the language. By sitting in a room full of knowledgable developers and spending 8 hours a day writing Java code, I became a fairly decent Java developer.

I would follow this project up with two Swift-based iOS applications and come out feeling well versed and fully capable in the Swift development space. All of those past experiences have taught me something, if you want to learn a new language, you need to be immersed in the language. If you want to learn Spanish, move to a Spanish speaking community. If you want to learn Afrikaans, move to South Africa. If you want to learn German, move to Germany. You’ll be a natural in no time, because you’ll be completely submerged in the language. The sheer amount of time spent in the language will push you to adapt at amazing speeds. The same is true for programming languages.

Throughout the past few years, in between projects, and even during projects, I have attempted to use my spare time to continue learning. I’ve taken courses in Node.js, MongoDB, and Scala. I can honestly say, none of those things stuck.

So what am I getting at here?

What is the point of all of this?

The point is this: I’ve decided I want to keep learning. I want to look forward everyday and push myself to always be something better tomorrow. When you finish a project, you should be able to look back at that project and see 10 ways to do it better next time. I am not one of the brightest and best developers out there. I have just been lucky enough to find myself in opportunities that pushed me to learn, many of which including learning alongside my peers who were also driven to be better tomorrow than they are today. This has been a tremendous blessing.

For now, I would like to learn Node.js at a level that I would feel comfortable bringing an idea to conception in the Node language for professional, production use. To do this, I’ve decided to immerse myself in the language. And I’m going to use this mostly useless website to help hold me accountable.

I’m going to try and do a workshopper at least once a week during my downtime. At least for a few months. As I do this, I’ll try to post the solutions here on this site for anyone who might need help. I hope by immersing myself in several different tutorials, topics, and categories related to Node. That the switch in my brain will flip and I’ll come out with the ability to think about Node projects with the same level of comfort I approach mobile applications and Java projects.

Have a question or comment? Reach out to me via GitHub or twitter @kwandrews7.

And if you have some downtime, why not go learn a new language? All the cool kids are doing it. ūüėČ

Prevent Windows Domains from Changing Your Mac Hostname

I ran into an interesting problem several months back and have helped out numerous friends since then with very similar issues, so I thought I would share that fix here. If you are operating an Apple machine such as a MacBook Pro on a corporate network utilizing Windows domain controllers, the DNS will sometimes send down the hostname of the last computer to use your IP Address. Your MacBook will then kindly accept this new name as his name for use on the network. This can cause problems with any software utilizing your computer’s real name for networking purposes.

The temporary solution is run sudo hostname This-MacBook-Pro.local¬†¬†or the equivalent with your computer name in place “This-MacBook-Pro.local”. However, this solution is only temporary and the time it sticks seems to vary greatly.

After researching around and reading numerous blogs and StackOverflow questions, I landed on the following command. The command below appears to resolve the problem completely, as I have now gone over four months without my client’s network resetting my local hostname.

If any of you are experiencing similar problems, give the command above a shot and I wish you the best of luck!

Print ResultSet Data Dynamically

Recently, I have been performing numerous queries to Oracle database servers in my web service flows. Since this is something done often in web development, I often want to simply print out everything returned from one of my queries so that I can either compare that data manually with the output from other SQL queries or utilities. When performing updates to services that provide large datasets back to the user, it is often useful to log the direct SQL results out to a file that can be compared with the existing code base using a diff tool such as WinMerge.

The generic ResultSet.toString() called when you try to print a ResultSet in Java provides you with the fairly useless, but ever so familiar:


This week while optimizing a flow that originally performed almost 4,000 separate SQL queries, I took a few minutes to write out a snippet of code that I could stuff into various places throughout the original and optimized code base to compare the data. Since this proved to be highly valuable for this task, I decided I would share that snippet with you all. The code is pasted below and should be useful in most Java-based projects.



The code will print or log out the ResultSet row by row with column names and data shown inside brackets. The basic idea is to loop through the entire ResultSet using a while loop. As long as their is another row, retrieve the row’s meta-data and use the columnCount value to loop through each column printing the columnName from the meta-data along with the column’s data.

For example, the query that returns the following table would print out the code immediately following the table.


Name Address Phone Email
John 143 Commerce Rd, Dallas, TX 555-4578
Suzy 496 Product Blvd, Memphis, TN 555-8246
Jack 790 Main St, Chicago, IL 555-3598
Sally 839 Tempest Cir, New York, NY 555-1162


Best wishes and happy coding!