Foot Pedal Facet

About a year ago I was visiting a friend, Greg, at his home and went to wash my hands in his kitchen sink.  The facet was already on and I couldn’t figure out why the water wasn’t coming out.  He laughed and said “push the pedal with your foot”.  Sure enough, there was a foot pedal on the floor and pressing it down made the water come out.  Cool!  Besides being interesting and geeky, he pointed out that it actually helps save water when doing dishes because you can push the pedal down to wash a dish and then easily release temporarily before doing the next dish.  I spent the next 20 minutes asking questions about how he got it working and Greg was more than happy to give me the details and take me on a tour under his sink.  It was a pretty neat setup, complete with a manual bypass and switch override, but the heart of the system was a couple of electric solenoids.  Solenoids are water valves that are normally closed but open when given some direct current electricity.

A few months later, for my birthday, my parents and wife got me the parts needed to make my own foot pedal sink.  I called up Greg and get some details on the setup and he walked me through what I would need do.  I installed it a few weeks later and have had it working for months.

 

Parts List

!BnvRqIQBGk~$(KGrHqIH-CYEtrM23LFDBLkvQ20FSg~~_1231EEgny54aL71JHtDH8xqL._SL1500_

Installing

The installation at first glance seems a bit complex but it is fairly straightforward.  You need to:

  1. Connect the A/C side of the AC/DC supply to your dishwasher 110 A/C power source.  For me, the access was pretty easy and required a simple drill hole through my sink cabinet partition.
  2. Connect the negative D/C side of the supply directly to both the hot/cold side solenoids.  You will do a “Y” wiring configuration so both solenoids are getting the same negative D/C wire connection.
  3. Send positive D/C through both the bypass light-switch and foot pedal and then join the output from both back before doing a “Y” connection to both the hot/cold solenoid sides.  This allows either the bypass switch or the foot pedal to close the circuit and provide positive D/C current to the solenoids.

Foot Pedal Facet

 

 

 

 

 

 

 

ASP.NET MVC Deployments to Azure via GitHub

Windows Azure keeps getting better and better.  It’s been available for over 3 years and most of that time I have glossed over it in favor of Amazon Web Services.  The big discouraging factors for me were cost, limited services and the horrible Silverlight management interface it used to have.  A lot has changed in Azure over the last few years and I continue to be impressed.

They finally dumped the Silverlight management interface and went to a modern (and awesome, actually) HTML5 interface.  It is very functional and has some impressive UX features.  I like it a lot.  Also, Azure has fully embraced Git.  To be honest, this surprises me because Microsoft has traditionally been so closed and promoting of their own tool chain (i.e. TFS for source control).  But, this seems to be in line with a broader shift I’ve seen in the Microsoft Developer Division in recent years.  Kudos to Microsoft because I think this is the right direction.

Anyway, I recently found that you could tie an Azure website to a GitHub repository for deployments.  This is way cool because I love me some GitHub and this integration makes deployments so easy.

Here’s an example of  how you do it:

Create ASP.NET MVC Solution

Normally you’ll already have a solution you’re working with you want to use but for demonstration purposes I will create new ASP.NET MVC 4 Solution called foo and save it locally.

aspmvc4

Create Git Repository and Push to GitHub

You can (obviously) do this with the Git command line  or one of the Git GUIs but you basically just want to init a new local Git repo and push it to a new remote GitHub repo.  I usually start out by going directly to GitHub and creating a new repo and then following the instructions to connect it with a local repo.

azuregithub1

After you create the GitHub repo, there will be a screen that shows how to init a local repo and connect it to your new GitHub repo and it looks similar to this:

cd C:\dev\foo
git init
git commit -m "first commit"
git remote add origin git@github.com:username/foo.git
git push -u origin master

Setup new Azure Website

If you know how to use the Azure Management interface then you know this is easy.  Just click “Web Sites” on the left bar, then click “New” at the bottom left.  Click “Quick Create”, give it a name and then you are good to go.  It will initialize and be ready in a matter of seconds.

azurenewazurenewname

Link Azure Website to GitHub

You’ll want to pull up the new web site you just created and then go to the “Dashboard” page.  On the right side under “quick glance” you should see an option called ”Setup deployment from source control”.  Click this, select GitHub as the source and then select your repo.  Follow the screens and your ASP.NET MVC website should be automatically deployed to Azure within seconds. Also, each time you update the GitHub repo it will trigger a new deployment on Azure!

azuredashboard

azuredeploymentazuregithubazuredeploymentsuccess

 

A Note About Dependencies

When Azure pulls your source from GitHub and compiles it, it will have to resolve any assembly references.  There are two ways to handle this:

  1. Check your packages folder (from the solution directory) into GitHub –  This is straight forward and the least issue prone way to handle references.  Just ensure you commit the packages folder which contain all your assembly .dll references.  If all your external dependencies were added from NuGet you should be good to go.  If you have any assembly references that are not in NuGet you can place them in the packages folder directly and change the reference to point to this location.  This way, when Azure compiles your site, all the assembly .dll files will be available in the packages folder and you’ll be set.
  2. Enable NuGet Package Restore – To avoid checking in the packages folder (which could be quite large and go against everything that has been pounded in your head about source control best practices), you can Enable NuGetPackage Restore which will tell Azure to download package references from NuGet.  You need to make sure and commit the packages.config file from your project directory so Azure will know which packages to install.
No Comments

NuGet Releases with Rake

Every time I want to release a new version of Cron Expression Descriptor to NuGet, there is a bit of work to be done.  I had been planning on creating a MsBuild file to handle all the release tasks including versioning, building, packaging, pushing and tagging the Git repo but honestly, MsBuild is a pain to deal with because of its overly verbose XML syntax and need to install MsBuild Contrib to do anything beyond basic tasks.  Also, the installation process for MsBuild Contrib has always left a bad taste in my mouth: download zip, copy/paste to Program Files\… directory, add a bunch of XML to your .msbuild file to reference.

As I’ve been working with Rails more, I’ve become familiar with Rake, the MsBuild equivalent for the Ruby world.  Also, at Austin Code Camp a few weeks ago I saw Chris Holt use Rake for some .NET builds “because it is easy”.  Searching around online, I found Albacore, which provides a “suite of rake tasks that is intended to make building .NET systems easier”.  I decided to give Rake a shot for releasing Cron Expression Descriptor and it is working great.

The first thing I did was run ‘gem install albacore’ to install Albacore.  Then I downloaded the NuGet command line utility, placed it in a folder somewhere and added this folder to the path, so that nuget.exe could be executed from anywhere.  Also, I placed my .nuspec file (previously generated by NuGet) in the project directory.  Once I added the following Rakefile in the same directory as my Cron Expression Descriptor project I can simply run ‘rake release["1.7.0"]‘, from the directory where my Rakefile resides, to release a new version of Cron Expression Descriptor to NuGet.

This Rakefile does all the dirty work including updating the AssemblyInfo with the version number (passed in as parameter), building in Release mode, packaging the NuGet package, pushing NuGet repository, and tagging my Git repository with the current release number.  Releases are a breeze now!

#Rakefile for .NET project
#Example usage: rake release["1.7.0"]

require 'albacore'

project_name = "CronExpressionDescriptor"

task :version, [:version_number] do |t, args|
  desc "Version the assembly"
  	assemblyinfo :version do |asm|
		asm.version = args.version_number
		asm.file_version = args.version_number
		asm.input_file = './Properties/AssemblyInfo.cs'
		asm.output_file = './Properties/AssemblyInfo.cs'
 	end
end

task :build do
	desc 'Build the solution in the Release configuration'
	msbuild :build do |msb|
		msb.solution = project_name + '.csproj'
		msb.targets = [ :Clean, :Build ]
		msb.properties = { :Configuration => 'Release' } 
 	end
end

task :package => [:build] do
	desc "create the nuget package"
	sh "nuget.exe pack #{project_name}.csproj -Prop Configuration=Release -OutputDirectory bin\\Release -Verbosity normal"
end

task :push, [:version_number] do |t, args|
	sh "nuget.exe push bin\\Release\\#{project_name}.#{args.version_number}.nupkg"
end

task :tag, [:version_number] do |t, args|
	sh "git tag v#{args.version_number}"
	sh "git push --tags"
end

task :release, [:version_number] => [:version, :package, :push, :tag] do |t, args|
	desc "v#{args.version_number} Released!"
end
No Comments

Hipsters

I came across a twitter post recently by DHH (David Heinemeier Hansson) where he was reflecting back on an anti-Microsoft / Ballmer blog post he wrote back in 2010.  He posted the link shortly after the announcement that Ballmer was leaving MSFT.  The post is obviously a slamming session aimed at Microsoft.  That’s fine, I understand DHH would probably be one of the last people to be on the Microsoft payroll and both he and they (and me!) are probably just fine with that.

However, one of the first comments (shown below) was “you should rename your blog so its initials are “git” instead of “svn”.  Are you serious?

ddh_git_svn

Some of the things floating around in my head after seeing this were:

  1. Are you serious?
  2. Why in the world does it matter what the Url is for DHH’s blog?
  3. Why in the world does it matter whether DHH uses Subversion or Git for his blog?
  4. If Subversion works for him and gets the job done shouldn’t that be just fine?
  5. This guy (commenter) must be a hipster.  ”Subversion is so 2005 and if you aren’t using Git, you are so not cool.”

The problem I have with the hipster subculture in software development is that “they” focus on being non-mainstream, cool and trendy for no other purpose, seemingly, than to be non-mainstream, cool and trendy.  Getting the job done, productivity and the bigger picture always seem to take a back seat to being hip.

This post was originally intended to be a rant. A rant about the hipster developers.  As I started to write my rant, though, I realized something.  I succumb to the hipster mentality from time to time myself.  Since I do love technology and development, I naturally get intrigued by new, shiny tools and technologies and want to learn and start using them.  It keeps things interesting and fun.  And, when I use these new tools I do start to feel kinda “hip” and cool.  And who doesn’t want to feel hip and cool from time to time?

The problem comes, though, when I start to get the “you’re doing it wrong” mentality.  If someone else is doing something “un-hip” and I start to criticize them for that, I need to stop.  Different tools work for different people and needs.  If a tool exists that will get  the job done well why not use it?  Even it is is old.  Even if it is not cool.

 

5 Comments

The $5 Phone Dock with Universal Compatibility

Let’s face it: the cost of phone docks can be outrageous.  A simple iPhone dock costs $29.00 and a typical dock for the Nexus 4 can run about $20.  Buying a dock that will fit a phone with a case is tough too.  Some of them say they support phones with cases but I have purchased at least 2 in recent past which in fact did not work with my case.  You definitely don’t want to have to take your case off just to dock your phone.

So, I decided to go the easy, simple route.  Enter: the $5 Phone Dock.  Yes, it’s a mesh business card holder from Office Depot.  It works like a champ!  It fits virtually every phone, is easy to plug your existing charger in and works great!

 

IMG_20130818_140702IMG_20130818_140847

 

One Comment