WiredPrairie

A little bit of everything: software, apps, usability, programming, design and whatever else

  • Home
  • About
  • Contact Me
  • Cooking
  • Nest Thermostat
  • Old Archives
  • Photography
  • Quick Searches
  • You need this

Dripping Mansfield Outdoor Wall Hydrant

Posted by Aaron on Saturday, May 18th 2013    Tweet

We’ve got 4 of these on our house:

http://www.prier.com/products/retired-products/500-series.html

(Apparently, they were Mansfield 500s, but the product line was acquired by Prier in 2007 and is now similar to the Prier 400 series).

When the water was turned on inside the house, and the water valve was open at the hydrant, yet an attachment was not drawing water (for example, a connected hose with an end that was not open), a consistent leak occurred around the handle (some refer to it as leaking behind the handle). This meant that we couldn’t connect a water sprinkle on a timer without wasting lots of water (as the hydrant was always on).

We had two professional plumbers tell us that they’d need to tear open the finished walls on the inside of the house and replace the whole unit to fix the problem. Not believing these claims, I went in search of a solution.

One solution was to tighten the handle and was easy to perform. While that helped a bit, it wasn’t the solution we needed.

The best solution was to buy and use this kit:

http://www.amazon.com/Prier-Products-630-7755-Service-Hydrants/dp/B000LNPEIO/ref=pd_sxp_grid_pt_0_1

Prier Products 630-7755 Service Parts Kit

It doesn’t come with instructions on the package, instead you’re direct to watch a video on YouTube with the details.

I watched the video once through and then fixed 2 of our faucets in about 15 minutes. It would have taken about 10 minutes if I had brought the correct tools with me to the faucets.

I’m no plumber, but it was easy to do the steps.

Neither faucets drip anymore. (I haven’t fixed the others yet). Hope this helps someone who’s a doubter about this working. The kit is around $10, which is far less than your plumber would charge for the trip and work.

Filed under: Recommendations     Tags: Plumbing
No Comment Yet   

Using Windows CSCRIPT to compile a Handlebar.js template

Posted by Aaron on Thursday, March 28th 2013    Tweet

I was looking for an alternative to using Node.JS for a JavaScript build process today on a Windows machine. I wanted something that relied as much on natively installed elements of a modern Windows PC as possible so that the build process would be portable.

So, I broke out my rusty Windows Script Host skills.

First, I created a file called, compile.wsf with the following contents:

image

When using cscript.exe, you can execute a more complex combination of scripts and include other script files by using a Windows Script File. The content of the file is an XML definition of jobs. A job represents a unit of work. If you only have one job in a file, the name won’t matter as the script engine will select it by default. If you do have more than one job you’d like to store in a single WSF file, you can use the /Job:{id} parameter of cscript.exe to run a single job.

Using the WSF file, you can include other script files using a script element (much like the script tag in HTML). In the example above, I’ve referenced a local copy of handlebars.js and a custom script called compile.js.

You can also inline script as shown above. After doing a basic check on the number of arguments provided to the script, compile is called, which is from the compile.js script reference.

Compile.js is simple:

image

Using an instance of the FileSystemObject, first the input file is verified to exist. Next, both the input and output files are opened. The Handlebars object is available globally by including it in the WSF definition and is used to precompile the contents of the input file’s template definition. Once compiled, it’s written to the output file and both files are closed.

I threw the three files in a folder called lib, and created a simple batch file called handlebars.bat which called the cscript executable with the Windows Script File shown above as the first parameter and then the values of the other parameters passed along:

image

While this solution only works on Windows, it doesn’t hurt to keep the Windows Script Host in mind when throwing together general repeatable tasks that you:

  • consider too complex for a batch file
  • consider too simple for a full .NET application
  • require usage of existing JavaScript libraries, like Handlebars.js for some work

Filed under: Coding, General     Tags: cscript, JavaScript, wscript
No Comment Yet   

Quilt Inspired by Microsoft Windows 8

Posted by Aaron on Monday, March 11th 2013    Tweet

My loving wife made me a quilt with her new sewing machine.

IMG_0151

For her first project with her new Brother DreamWeaver™ VQ3000, she wanted to start with something small. After a very short discussion, she and I agreed that the Windows 8 Start Screen/Modern UI interface would be a great starter project. Not only would it be fun to work on, it could be colorful, use a variety of stitching options, and use the ability to use a few different fonts to add some text.

Once I told her I would hang it in my office at work (which I have), she got started. (She knows me well enough that there would be a reasonable chance it could end up in a pile somewhere in my den or office).

IMG_0114She did not track how long it took to make, as it was her first project with the new sewing machine, but more than once she would drop by my den on a lazy Sunday afternoon with praise for her new sewing machine. Thankfully, she was able to use nearly all scraps for the quilt itself as it didn’t require larger fabric pieces. We did go to a famous fabric store once to buy some light blue thread.

She’d never owned a sewing machine that auto-threads the needle. I’m sure for many, that’s not news, but I was very impressed. I did a LOT of experimenting with colors and stitching patterns a few weekends and got extremely good at loading the thread so it could be auto-threaded onto the needle. I did it enough that she declared that I was much faster at it than her!

IMG_0127My wife is extremely organized, so she made many notes and sketches along the way so that the effort would be a “cut once, sew once” affair. (she’s has CS BS and MS, and Software Architect by day, so it’s maybe in her blood Smile).

She graphed out the whole thing mainly because there were so many pieces. While I didn’t mind if colors moved around after I had selected a location, she did. Smile Further, our cat has a tendency to shuffle fabric piles a bit.

In any case, a several weeks later working on weekend afternoons and a few evenings, she completed the quilt.

I asked about making a Surface sized quilt and grinning, she answered, “maybe.”

IMG_0140

IMG_0139For complete documentation and instructions, download this PDF.

image

Filed under: General     Tags: Brother DreamWeaver Sewing Machine, Quilting
2 Comments   

Finding duplicates in MongoDB via the shell

Posted by Aaron on Sunday, March 10th 2013    Tweet

I thought this was an interesting question to answer on StackOverflow (summarized here):

I’m trying to create an index, but an error is returned that duplicates exist for the field I want to index. What should I do?

I answered with one possibility.

The summary is that you can use the power of MongoDB’s aggregation framework to search and return the duplicates. It’s really quite slick.

For example, in the question, Wall documents had a field called event_time. Here’s one approach:

db.Wall.aggregate([
       {$group : { _id: "$event_time" ,  count : { $sum: 1}}},
       {$match : { count : { $gt : 1 } }} ])

The trick is to use the $group pipeline operator to select and count each unique event_time. Then, match on only those groups that contained more than one match.

While it’s not necessarily as readable as the equivalent SQL statement potentially, it’s still easy to read. The only really odd thing is the mapping of the event_time into the _id. As all documents pass through the pipeline, the event_time is used as the new aggregate document key. The $ sign is used as the field reference to a property of the document in the pipeline (a Wall document). Remember that the _id field of a MongoDB document must be unique (and this is how the $group pipeline operator does its magic).

So, if the following event_times were in the documents:

event_time
4:00am
5:00am
4:00am
6:00pm
7:00a

It would results in a aggregate set of documents:

_id count
4:00am 2
5:00am 1
6:00pm 1
7:00am 1

Notice how the _id is the event_time. The aggregate results would look like this:

{
        "result" : [
                {
                        "_id" : "4:00am",
                        "count" : 2
                }
        ],
        "ok" : 1
}
Filed under: Coding     Tags: Aggregation, MongoDB
No Comment Yet   

Liquid Exception: incompatible character encodings: IBM437 and UTF-8

Posted by Aaron on Saturday, March 2nd 2013    Tweet

Assuming you’re trying to use Jekyll on Windows, you may encounter an error similar to this:

Liquid Exception: incompatible character encodings: IBM437 and UTF-8 in css.html

image

My solution was to temporarily change the code page to UTF-8:

image

chcp 65001

This temporarily changes the code page of the current Command window to UTF-8.

Filed under: Coding     Tags: Jekyll, Python, Ruby, Windows 8
No Comment Yet   
« Older Entries
Google
Custom Search
Follow @wiredprairie

Archives

  • May 2013 (1)
  • March 2013 (5)
  • February 2013 (2)
  • January 2013 (5)
  • December 2012 (4)
  • October 2012 (2)
  • September 2012 (1)
  • August 2012 (8)
  • July 2012 (2)
  • June 2012 (2)
  • May 2012 (1)
  • April 2012 (9)

Pages

  • About
  • Contact Me
  • Cooking
    • GE Advantium Oven
  • Nest Thermostat
  • Old Archives
  • Photography
  • Quick Searches
  • You need this

Links

  • Old WiredPrairie Archives - Here lies the old WiredPraire content …
  • Quick Searches - A few filtered searches on Google to cut down the signal to noise ratio …
  • SnugUp - Best SmugMug Uploader for Windows

Subscribe

  •  Subscribe in a reader

     Subscribe to comments

    add

Browse Our Tag Archives

.NET Ajax API ASP.NET backbonejs bug C# CSharp Ember.JS Experience Expression Blend Flash Flex hash Html IE8 Internet Explorer Interviews Issue JavaScript knockoutjs LINQ Metro MongoDB MVC Nest Node npm Problem Review Ruby Silverlight SmugMug SnugUp SproutCore SVG TECHED Thermostat Typography Silverlight Flash View Source Windows Windows 8 WinRT WPF Xaml

©2007-2013 WiredPrairie

Disclaimer: All data and information provided on this site is for informational purposes only.

In association with Amazon.

WordPress Themes by Irish Band & Steel Band
(And, quite a few tweaks by WiredPrairie)