Archive for the ‘Project Updates’ Category

Node.js running on Azure.

Tuesday, September 10th, 2013

Recently I created a little node.js project for fun. It sole reason for existing is to display Bastard Operator from Hell quotes. I ended up deploying this little project to a free azure website because this little project used edge.js and required C#. Azure websites runs on windows and has .NET installed. Yes even node.js websites run on windows.

Time to jump right into it. I spent entirely too much time getting my little project deployed. Why? Well, the documentation for azure is incomplete. Little did I know, I was missing a key piece of info. To run node.js in azure, one needs a web.config file. If you use one of the templates it will be created for you. If you don’t use a template, you have to created. This is/was not documented.

Why does node.js require a web.config to run in azure? Well node.js in azure runs on IIS. Yeah, that IIS. If I am not mistaken, it is using iisnode. Honestly, this is ok given that azure runs windows and IIS is pretty decent at managing resources. But for the love of sanity, could this be written somewhere please?

How did I figure this out? By luck. I created another website using the template, FTPed into website and noticed a little file with the name web.config. Upon looking at, it is clear as to why it is required.

Here is an example of a web.config, the important piece is line 14. The path should be the name of app start js file.

<!--
     This configuration file is required if iisnode is used to run node processes behind
     IIS or IIS Express.  For more information, visit:

     https://github.com/tjanczuk/iisnode/blob/master/src/samples/configuration/web.config
-->

<configuration>
    <system.webServer>

        <handlers>
            <!-- indicates that the app.js file is a node.js application to be handled by the iisnode module -->
            <add name="iisnode" path="server.js" verb="*" modules="iisnode" />
        </handlers>

        <rewrite>
            <rules>
                <!-- Don't interfere with requests for logs -->
                <rule name="LogFile" patternSyntax="ECMAScript" stopProcessing="true">
                    <match url="^[a-zA-Z0-9_\-]+\.js\.logs\/\d+\.txt$" />
                </rule>

                <!-- Don't interfere with requests for node-inspector debugging -->
                <rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true">
                    <match url="^server.js\/debug[\/]?" />
                </rule>

                <!-- First we consider whether the incoming URL matches a physical file in the /public folder -->
                <rule name="StaticContent">
                    <action type="Rewrite" url="public{REQUEST_URI}" />
                </rule>

                <!-- All other URLs are mapped to the Node.js application entry point -->
                <rule name="DynamicContent">
                    <conditions>
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True" />
                    </conditions>
                    <action type="Rewrite" url="server.js" />
                </rule>
            </rules>
        </rewrite>

        <!-- You can control how Node is hosted within IIS using the following options -->
        <!--<iisnode
          node_env="%node_env%"
          nodeProcessCommandLine="&quot;%programfiles%\nodejs\node.exe&quot;"
          nodeProcessCountPerApplication="1"
          maxConcurrentRequestsPerProcess="1024"
          maxNamedPipeConnectionRetry="3"
          namedPipeConnectionRetryDelay="2000"
          maxNamedPipeConnectionPoolSize="512"
          maxNamedPipePooledConnectionAge="30000"
          asyncCompletionThreadCount="0"
          initialRequestBufferSize="4096"
          maxRequestBufferSize="65536"
          watchedFiles="*.js"
          uncFileChangesPollingInterval="5000"
          gracefulShutdownTimeout="60000"
          loggingEnabled="true"
          logDirectoryNameSuffix="logs"
          debuggingEnabled="true"
          debuggerPortRange="5058-6058"
          debuggerPathSegment="debug"
          maxLogFileSizeInKB="128"
          appendToExistingLog="false"
          logFileFlushInterval="5000"
          devErrorsEnabled="true"
          flushResponse="false"
          enableXFF="false"
          promoteServerVars=""
         />-->

    </system.webServer>
</configuration>

My little project: https://github.com/Oobert/BOFHAA
It running in azure: http://bofhaa.azurewebsites.net/#index=359

Update 9/11/2013: I need to clear some things up. As pointed out in the comments there are many ways for azure to auto create a web.config or iisnode.yml file. In my case, I did not use the command line to deployment and ran into a bug with github deployments which would not allow me to publish to azure from github. This bug may be fixed now. In the end, I uploaded my files to azure via FTP, which did not create a file for me. My fun ensued at this point when I couldn’t figure why nothing was happening.

This was not meant as a bash against Azure. I was just putting this out there in case someone else runs into the same issue. Happy Coding!

 

ASP.NET Dropin DLL Plugin – Part One

Wednesday, June 12th, 2013

My intro to web programming was with PHP and scripts such as phpBB and other internet forum software. I always like that installing a plugin normally just worked. You would drop a folder into some directory and the script would see it and you could install it. I have yet to really see this recreated in ASP.NET MVC.

For the past year or so I have been trying to find a way to recreate this. There are many blog posts and half tutorials on this. There is even a few libraries out there on how to do this.

And old blog post from 2008 was my starting off point. It talked about Virtual Paths. It worked but the syntax was terrible.

I knew if I was going to do this, I wanted everything to just work as easily as possible. I also wanted the plugins to be runnable on there own if the developer wanted (for dev and debug reasons).

Griffin.MvcContrib has a way to do this. It seems overly complicated to me. So I kept at it.

After some more searching I found an example of some code that implemented a virtual path provider. I don’t know from where or who but I feel bad because I would like to give them credit. I finally had enough to start tinkering on my own.

I finally have something to show for all of this. I have posted on github a working example of how to create a ASP.NET MVC plugin system. This system allows for DLLs that contain all necessary files, compiled or embedded, to be dropped into the bin directory of a main site and then those files served from the DLL.

Over the course of a few more post, I will cover how the important bits work and what the gotchas are. If you need this now, check out the github project. Currently, it has one plugin that has JavaScript and image examples.

Questions are always welcome.

ASP.NET Dropin DLL Plugin – Part Two
 

Android Development: The Fail

Monday, February 7th, 2011

So back in October I started the process of learning to do development for to android. Sadly, I am here today to admit that went poorly. This is my reflection on why it went badly and how I expect to better next time.

Problem 1: Me. Yup, that is right. The first problem I ran into was me. I have a lot of ideas for applications for Android and in general. The problem isn’t that I jumped right into development, it was when I jumped I landed in a spot that was over my head and that made me instantly frustrated. With in days of installing the tools and SDK my drive had died. I just got over whelmed with all the new that I didn’t take the time to learn.

Solution: While I hate doing the typical “Hello World” type apps, it is a necessary evil. It is the steps needed to ramp up understanding of the environmental. What I was trying to do was not hard but because I didn’t know the basics of Android development, it was difficult to find help. The process isn’t hard and takes a bit of time but ramping up is needed to keep from being overwhelmed.

Problem 2: Holy cow, embedded application development is slow. Let me be clear, development isn’t slow but getting you application to run via emulator or on a device is painful. When it takes a few minute for my application to run, this just kills the fun and drive to continue. Especially when learning. When I was waiting, it was so easy to get side tracked.

Solution: I hear the sdk and emulators are getting better and faster. I am also in needed of a new PC which is pushing 5 years old or at least an upgrade or 2. Other than that, I am not sure what else I can do.

So the biggest problem was me. Once I can get through them, it should be pretty easy to continue. I plan on starting this again as I think there is some positive applications I could contribute to the community. However this is on hold for the moment. Need to get caught up on technologies related to my job, mainly ASP.NET MVC

Android Development: The Install

Wednesday, October 6th, 2010

I recently picked up my first smart phone. After years of wanting to move up to a smartphone but holding off because of price, I finally caved and picked up a HTC Desire. It is running Android 2.1 out of the box. It is a pretty slick phone. So far I have enjoyed my prechuse.

One of the reason I decided to pull the trigger was the idea of creating application for the phone. By day I am a .NET developer. Mainly C#. I was sort of excited to learn a new development environment and langue because I have been in .NET land for so long. I figure it is time to branch out. Yeah java is not much different than .NET but you have to start somewhere. 🙂

So I had some time to get the Eclipse IDE setup and ready to go to start my journey. I went to http://developer.android.com and followed the instructions on getting started. I am starting from scratch. The machine (win7) I am working on didn’t even have the Java runtime installed yet. Since I am a novice when it comes to Java and Eclipse, I followed the installation steps for the Android SDK. They seemed straight forward.

First step: Get eclipse. Sounds easy enough. Read through the section for ecplise which stated…

A Java or RCP version of Eclipse is recommended. For Eclipse 3.5, the “Eclipse Classic” version is recommended.

What does that even mean? So I want to the Eclipse site and downloaded the Java version of Eclipse 3.6 and continued to the section to install the Android Develipment Tools (ADT).  This is where things get more confusing because I was greated with…

Caution: There are known issues with the ADT plugin running with Eclipse 3.6. Please stay on 3.5 until further notice.

Grrrrrr…. But I just downloaded 3.6.1!! To limit the number of issues I run into I decide to follow what Google recommends and found a copy of Eclipse 3.5. No big deal. I go to run Eclipse and it promptly fails stating it can not find the JVM. At this point I was confused because I had thought that I installed Java at some point in the past. Yeah, I was wrong. Whoops. Over to the Oracle to get the JRE/JDK.

I am running win7 x64 and did what anyone running x64bit OS would do. I download the x64 windows binary. Install Java. Run eclipse. Eclipse fails again. Still stating that it could not find the JVM. Ugh. The message box suggest to add the path to the JVM to my system path. A few clicks later and it should be good to go right? Nope, now Eclipse crashs but with a log/debug message.

At this point I was about ready to give up. That is until it dawned on me. “Hey stupid! You probably can’t run 32bit Eclipse with 64bit JRE!” An uninstall and reinstall of the JRE and eclipse is running!

From here on out everything seem to work correctly. Totally elapsed time: ~2 hours. No really 2 hours.

My enthusiasm has lessened alot because of the frustrating install. I mean I have not even started to write a hello world Android app yet. I am planning on sharing my experience as I go and comparing it to how I view the .NET start up experience.

VHS to DVD project.

Sunday, May 10th, 2009

The Problem: What to do with all those aging home videos that are on VHS (or other analog) format?

The Answer: Buy some new toys and convert the analog video to something modern like DVDs!

My parents, like many, bought a home video camera in the late 80s. Since then my family has accumulated hours upon hours of home movies. There is a lot of family history on those VHS tapes. That is a lot of family history many do not want to disappear. The real problem is most (none technical people) do not realize that tapes do not last forever and VCRs will not be around that much longer.

I was pretty much going into this blind. There are a many possible way to get analog video converted to digital video. Since I didn’t want to screw this up or waste money on anything that yielded problems or poor quality, I made sure to do my research. VideoHelp.com has proven to be a great resource for all things video. There is a ton of information on the site but be warned, VideoHelp.com has a large community of professionals so it is hard to get a clear answer for the hobbyist.

I started my research with exactly how to get the analog video from the VCR to my computer. There are tons of ways to convert analog video to digital video. There are a number of hardware to software and internal and external solution to do this. After reading the net, it becomes clear the easiest way to get video from analog to digital was to use a GrassValley ADVC110. The ADVC110 takes in S-Video or Composite connectors. It will do the conversion from analog video to digital video in the unit and outputs the video from the device over fire-wire. The video that is output from the device is DV-AVI and runs about 13GB/hour.

The next major part of this plan was to find a VCR. There are a lot of options for a VCR too. Finding a VCR proved to be even more complicated than finding a device to do the video converter. It seems that there are a lot of opinions how what type of VCR is better and why. There is a large debate over consumer vs professional VCRs and which one is better. At the present moment in time, there are no companies making standalone VCR players. The options are to buy a used professional or prosummer VCR from EBay or similar place or you can buy a consumer dvd/vcr combo from your local retailer. The main difference between the two options (form what I can tell) is a some of the professional VCRs will have image correct/stabilization in the form of a TBC or Time Base correction device. A TBC will make jumpy video more stable and remove some of the artifacts form the video.

Since I needed a new DVD player for my office, I opted to go with the consumer DVD/VCR combo. I bought a Philips DVD/VHS combo from Wal-Mart for $80 bucks. I figured if the video quality was poor, I would try to find a used professional VCR. After all my research and worrying over what to buy, I finally pulled the trigger and bought the ADVC110 and VCR/DVD player. Last weekend, I hook it all up and started to convert video. I have 13 family video tapes to convert and since then I have done 3 of the tapes. I wanted the DVDs to look as good as the VHS tapes when being played on a TV. I can say that with my current set up the digital video looks better than the VHS tapes. It is all really easy to use too!

Set Up of the VCR and ADVC110 is very easy and easy to work with. The hardware set up consisted of connecting the VCR to the ADVC110 and the ADVC110 to my computer. To capture the video being pushed from the ADVC110, I use a free tool called WinDV which is very easy to use. Once the raw DV-AVI video is captured, I have been using Windows Movie Maker and Windows DVD Maker to create movies and DVDs. Both are straight forward to use. They are not very robust but they get the job done to my needs.

I am open to question just remember I am by no means an expert on this subject. Here is a very small example of raw video that has been converted from on of the tapes. The clip is what my bedroom looked like when I was little.

Tony