Including Knockout In Your Custom Dot Net Nuke Module

One issue I ran into, besides the outdated documentation, was that I couldn’t figure out how to include Knockout.JS in my module. Sure I could just download the .js files and include them directly, however I believe that DNN has to of had a way for me to ensure only one instance of the Javascript Library is loaded(per page).

I found the solution after messing with the endpoints for quite a while:

As you can see, it is really just a one liner. You need to include it within your Page_Load method, which will ensure Knockout.JS is available for that view in your module.You might also have to add a using statement to the top of the .cs page as well:

Enjoy!

Manipulating The DOM w/ C# After It Has Loaded (ASP.net – RegisterStartupScript)

Last week I ran into a bit of a niche problem, but let me give you some context first. I was working on a simple Dot Net Nuke module that needed to grab information via an API and then populate an Onyaktech form with that data via any means possible.

I utilized the RESTSharp library to do the dirty work of handling the RESTful requests for me. Leaving the task of inserting the received data into the form left to wrestle with.

My initial idea was to use some sort of JavaScript injection on the page. I could of redirected to some sort of url such as:

This sounded good in theory, yet in practice this ended up being:

Which just places the code on the top of the page before the DOM has loaded and is ready. Therefore I was confused on what to do. Luckily for me, C# and ASP.net give me a method called “RegisterStartupScript“. Using this we can tell the .Net framework to automatically execute the JavaScript string we are about to inject, only after the pages elements load. This gave me the wonderful result in which I required.

My code ended up looking something like this:

Hope this helps someone out there in the WWW.

How To Extend A Virtual Machine’s Disk Space

So today, I finally ran into a limit with my max size on one of my virtual machines. Following the instructions below should help you extend your disk space, as it did for me.

Host Machine: Windows 8.1

Guest Machine: Windows 7

This post extends ‘Increase VirtualBox Disk Size‘.

I followed that post to the point. However, it confused me because my VM wasn’t showing that I could expand it in the disk manager from within the guest OS. What I didn’t realize and what the post didn’t inform me about was snapshots. I had taken a snapshot previously and for some reason the post just assumed I had never done such a thing. Therefore when looking for your .VDI file to extend, make sure you check the snapshots folder and select the snapshot that is most recent, or the one you are about to run.

Hopefully this prevents some confusion. Enjoy!

Visual Studio Code – First Impressions

If you have been living under a rock, you may not have heard that Microsoft just released a new multi-platform code editor named “Visual Studio Code”. Obviously it is a spawn off of it’s brother, Visual Studio. So how will this compare to Atom.io or Sublime Text Editor? Lets take a look and see my first impressions.

To be blunt, I use Visual Studio 2012 and 2013 in my day to day development at work. I used to use sublime, however I wasn’t a fan of it being written in python, because of my own personal inability to extend it very well. Therefore I switched to Atom.io a while ago, as I am familiar with JavaScript and a bit of coffee script. Yet now with the new player in the game. I feel I need to at least check it out.

Visual Studio Code

There you go, my first screenshot of the editor. Looks clean enough and odly reminds me of a remix of my current Atom.io environment + visual studio environment.

The dark theme is what I live for. Not really a lover of purple, but it does sub-consciously inquire my brain to think of royalty.

You may be asking what the four icons on the left side are for. It appears they are as follows: Explore, Search, Git, and Debug.

Explore: Seems to allow for your normal preview of the directory you are working with.

Search: Find and replace tool? Adds the ability to search via a regular expression, that is pretty cool.

Git: Haven’t tried this on the windows install yet. Did test it out with on my linux VM though. Very helpful, however doesn’t work well with a git repo over HTTPS. I suggest you use SSH anyways though.

Debug: Haven’t really tried this out yet.

Trial Run w/ Node.JS:

So I went ahead and cloned my most recent project: “Node Against Humanity”. In which, is just as it sounds. It is a real time app that allows a family to play CAH on their big screen w/ their phone’s as input devices.

Yet when I switched to my GIT tab in VS Code, it said I didn’t have git installed on my system:

Git not installed tab.

It appears someone else installed Github for Windows on my machine. Therefore, I was able to just find the weird “appdata” path and add it to my environmental variables. Easy fix.

Summary:

Wrapping everything up, the editor looks nice. The syntax highlighting is simple enough. I really enjoy the intellisense instead of crappy auto competition stuff I usually have to work with. If you don’t enjoy the sidebar being there you can actually just click the current icon you are working with to make it disappear. There are plenty of options. I feel this editor really lives up to it’s name. It is just for code. Don’t expect to be doing any cool drag and drop WYSIWYG in the editor, but it does seem to render HTML pages quite nicely. Looking forward to the future of this editor.

Top 7 Skills You Need To Learn Before Going To College

Hello Noob. Welcome to the internet! I have gone ahead and prepared a list of the 10 skills that are most important when going into college. Read them, learn them, use them.

Math – That is right kid. Math is important. You need that stuff. Most colleges have what is called “placement testing” and yes “Math” is a portion of it. Even art majors have to have the minimum of pre-calc or something of the sort… so get those flash cards out and begin.

Communication – Here is one for my fellow nerds. You love to spend time playing video games, however sooner or later, you will have to take a speech class to graduate. Better get use to being social now, before it gets really awkward.

Sleeping – This is one of the biggest skills you need to learn. Hibernation is what they should really call it. Yet in college you will be tempted every single hour of every day(after your freshman year that is) to hang out with someone, help someone else, or even study a bit more. However the biggest success for the next day is sleep. Hit that bed up at 8pm and be proud to tell your friends the next day!

Reading – If you were anything like me, you ended up never even touching a text book in high school. I mean come on.. those things were only good at collecting dust right? Well, guess what. In college you have to learn to read. Those online summaries are only so helpful when it comes to a project where you need to implement a Naive version of some algorithm before the clock strikes 11:59pm. It is necessary to actually at minimum scan over the books for your “major” classes. Yet don’t let this frighten you.. those cliff notes are pretty efficient for classes such as History…

Go To The Bathroom – Ha ha ha, laugh it up. But seriously. If you are in high school and are a junior or senior. Stop asking for permission to go to the bathroom. In college you are a fool if you raise your hand to ask to go to the bathroom. Save it. That hand raise is more important… like questioning the lectures motives. Simply be quite and as subtle as possible make your way out of there.

Research – Research is a skill. Start working on it.

Life Skills – Do some research, gather some life skills. Learn to sign a check, learn what leasing an apartment is like, figure out what one must do to get a loan. These are real world things you will have to do, so spot sitting still. Figure it out. It isn’t that hard! You got this!

Hopefully this post lives up to my idea of the once per month minimum I put on myself. Maybe it’ll help you, maybe it won’t. Either way, i’ll be seeing you all on the flip side!

No Symbols Have Been Loaded For This Document

As one might know, in my spare time I work with a ton of Node.JS, Python, and C++ based applications. However, what you don’t know is that I used a bunch of C# and .Net at my work place. And here is a little tid bit I need to share with the world.

Appending this item onto Doug’s post about his debugger not working quite right. This was the solution that enabled me to continue coding through the day.

  • If you are working on a Web Application, then try opening it in Internet Explorer.

IUPUI Computer Science Day

Hello Computer Science Day! At IUPUI(Indiana University — Purdue University Indianapolis) we celebrated today(3/13/2015), a great day, by inviting out some local high schools that have programming classes to come test their students skills. We had three contests going on for a bit over two hours each. From game development to advances programming techniques, the students got to come and test their skills via trying their skills at some challenges put together by us college kids.

I ended up helping with the Advance Programming Content. here is a picture of the classroom and some of the students:

WP_20150313_10_24_08_Pro WP_20150313_10_24_15_Pro

Also here is a small glimpse of the Q and A session being led by Dr. Hill:

WP_20150313_13_22_27_Pro

And last but not least, one of me accidentally disobeying a rule, obviously fixing my mistake after getting my friend Naeem to take a picture of me:

Check out that bowl cut though ;)

WP_20150313_10_07_01_Pro

All-in-all the competitions went very well. I wasn’t one of the people whom planned this event. However, I did get the chance to grab lunch with a few of the students and maybe sway some of their minds towards attending IUPUI. Anyways, have a great Pi(3.14…) day tomorrow!

 

Row Filter Builder Via Query Parameters

Today I ran into an issue where I had hacked together a simple single column filter for a dynamic DataGrid but ended up needing full filtering. I then had to pull an hour or two to re-create the code, therefore allowing me to do more in-depth filtering. You can scan through the code below because reading code is learning code.

Let me know if you are able to use this code. Any improvements? Just let me know.

Talking About Solving Problems

Yep, errors!! I Launched Visual Studio, opened up a project and came across a weird error telling me I need to check my “ActivityLog.xml” file. Needless to say it looked pretty normal until I got to the end. There was an System.IO.IOException which usually occurs when you try to access something that either doesn’t exist or belong to you… Yet the next statement was a sentence saying “The file exists”.

Contemplating this issue, I figured using an search engine should be my first reaction. I copied and pasted the entire error message, and nothing. Not a single result from any of the engines I used. Gotta break it down. Retried my search approach by re-scoping my copy/paste skills. I pasted in the first line or two of the error and waited for my results.

Breaking it down allowed me to come across a post about someone else getting a System.IO.IOException error when their TEMP folder was to large. Hum. Interesting<<< The link didn’t work, but the search engine’s meta data provided enough info for me to follow through.

Time to really get a solid answer though.

BAM! Found one… -> http://stackoverflow.com/questions/28771479/vs2013-crashing-when-i-go-to-team-explorer-and-click-on-changes

Not sure how this guy figured out that exactly at 65535 files it would cause the error, but better him than me. Time to clean out my TEMP Folder. A simple opening up of “Disk Cleanup Utility” and BAM!

Problem solved!

Hopefully you enjoyed that simple look into my problem solving life.

How To Solve Problems

Sticky Note with Keywords about problem solving.Over the past few weeks I have noticed a trend showing up in the questions people have been asking me. Questions like “How did you do that?” and “Why did you think like that?” have been thrown around quite a bit. Therefore, I am using this post to represent a WORA(write once read anywhere) article.

Solving problems is a skill. You don’t just pick up a football and instantly become part of the NFL. You take your time, train your body, work hard to become something of which you want to be. Same goes for the skill of figuring things out. When you don’t use your brain, it weakens. Whereas if you are solving problems daily your brain starts to tie things together, strengthening you mind.

Hopefully this clears things up. I simply break things down, and I do it often. It isn’t about knowing a lot, it is about being able to take appropriate steps backwards and reassessing each issue. Anyone can do it, just don’t let yourself become flustered.