Thursday
Dec052013

Simple way to avoid caching in Javascript

This is a tried and true method to avoid a situation in which you want to make a call to a static url which may return a different result each time. Simply append an argument to the url with a random or otherwise unique string as the value.

Consider this javascript function:

        function getUniqueString()
        {
            var d = new Date();
            return d.getTime().toString();
        }

This will return a unique string every time that you call it.

Now, suppose you are calling a url that looks like this:

        var url = "http://myserver.com/getSomeImage";

It may work the way you expect in one browser but not in another.  Just append an argument to it like so:

       var url = "http://myserver.com/getSomeImage?cacheKiller=" + getUniqueString();

The url might look like this:

       http://myserver.com/getSomeImage?cacheKiller=1386232969279

Well done!

 

 

Tuesday
Jul232013

Perfect Low-Carb Chocolate Ice Cream

This perfectly indulgent ice cream is so good you’ll never buy Jen and Barry’s again! You need to start the day before you make it. Letting the base sit in the fridge overnight is a must. The recipe was adopted from Alton Brown’s recipe. The secret to the sweetness is Slimtevia, a product that combines Stevia with Fructose, and is impossible to tell from real sugar. You can get it online from its maker, Jim Healthy at www.slimtevia.com. It is rather expensive. You have to buy 3 pounds at a time for 47 bucks (about 15 bucks a pound) but you use 1/3 the amount you would sugar, so it’s more like buying sugar at 5 bucks a pound. Still, it’s the best low glycemic sweetener I’ve found.

Makes about two 1/2 gallon batches.

Ingredients: 

  • 12 Cups Half and Half
  • 4 Cups Heavy Cream
  • 32 egg yolks
  • 1 and 2/3 cups Slimtevia
  • 8 Tsp Vanilla
  • 2 Tsp Salt (table or Kosher)
  • 8oz Hershey’s Cocoa Powder (1 can)
  • Lots of Ice
  • 1 and ½ Cups Kosher Salt
  • 1 cup cold water
  • Ice Cream Machine 

Base Preparation:

In a large stovetop pot combine 4 cups of half and half, 2 tsp of salt, and all of the cocoa. Whisk over low heat until the mixture has completely blended and turned into a chocolate sauce. Add the remaining half and half as well as the heavy cream to the mixture and heat to a simmer over low to medium heat, whisking occasionally to prevent burning on the bottom. If it becomes hot to the touch, turn it off.

While the chocolate cream is heating up, separate 36 eggs. Keep the yolks and do whatever you like with the whites. Whisk the egg yolks to combine. Don’t forget to stir the chocolate.

Gradually and slowly (about ¼ cup at a time) whisk the Slimtevia into the egg yolks, whisking vigorously after every ¼ cup. It should turn velvety smooth.

With a ladle, slowly add one ladle full of chocolate to the eggs while whisking briskly. This tempers the eggs so they don’t cook. If you notice any scrambled eggs at this stage, remove them, stop and let the chocolate cool down for a few minutes. Add about 5 cups of chocolate this way.

Slowly add the egg yolk mixture to the remaining chocolate while whisking slowly. Turn heat to low, and get out your thermometer. While whisking slowly and constantly, bring the temperature to 170 degrees Fahrenheit (77 degrees Celsius). Immediately remove from heat. Add Vanilla and stir until it is completely integrated into the chocolate ice cream base.

Pour into a vessel suitable for spending the night in the fridge. As you pour, if you notice clumps of egg at the bottom, stop pouring and fish out the clumps. If it’s too late, you should run the entire mixture through a strainer or a sieve. No clumps. We want custard, not scrambled eggs. J

Cover and leave out at room temperature (covered) for 30 to 40 minutes, then transfer to the refrigerator for an overnight stay.

Churning:

I have a White Mountain ice cream machine, and this worked for me. When in doubt you should always consult the owner’s manual to get the exact method for churning. The following is what I do.

Fill the canister half way with base and put the remaining custard back into the fridge. Attach the lid to the canister, place inside the bucket, and attach the motorized top. Fill the bucket with ice and plug in the unit. Let it spin for 2 minutes.

Sprinkle 1 cup of kosher salt on top of the ice and wait for 10 minutes or until the ice has gone down by about 3 inches.

Fill bucket again with more ice and sprinkle ½ cup of kosher salt around the top. Now we wait until it has been churning for a total of 30 minutes. You will hear the motor start to slow down. Pour one cup of cold water over the ice all the way around. The machine will really slow down. After another minute or so, it’s ready!

What now?

Now the ice cream is at the soft-serve stage. You can put it in a bowl and eat it. But first, make sure you pack up the rest of it as quickly as possible in a completely dry container for the freezer. I like tall containers so there’s less exposure to air. Before you put the lid on it, put a layer of plastic wrap over it so the wrap touches the ice cream. Make sure there are no air bubbles. Freeze for 4 or 5 hours and enjoy!

Thursday
Jun202013

Carl's File Uploader - A nice little file uploader for HTML/JS/JQuery/WebAPI

 

Carl's File Uploader is available at http://franklins.net/CarlsFileUploader_1.1.zip

Carl's File Uploader is a browser based asynchronous file uploader with progress reporting and auto-resume. It requires HTML5, client-side JavaScript and JQuery, and Web Api (C#) on the server.

To test:

1) Create a new Web project in VS 2012
2) Select the Web API template
3) Add CarlsFileUploader.js to the Scripts folder
4) Add FileUploadController to the Controllers folder
5) Add index.html to the project and make it your startup page
6) Create a file folder to accept uploads, and give asp.net write permission.
You can do this easily by granting full access to AuthenticatedUsers
7) Edit web.config and add the following, pointing to your upload folder: 

        <appSettings>
           <add key="filepath" value="f:\uploads" />
        </appSettings>

 

8) Run the project
9) Select one or more files and press the upload button
10) Enjoy

Carl Franklin
carl@franklins.net
June 20, 2013

Friday
Feb012013

I just finished mastering the Good Sponge Sampler Vol 2. Great original music from New London, CT

Thursday
Jan172013

Take steps to avoid an “echoey” room. Build a $30 sound baffle!

Watch this video on how a guy created a vocal area in his bedroom $30 worth of stuff you can get online and at your neighborhood store (cheap Uhaul moving blankets and some hanging hooks). You can REALLY hear the difference!

Here’s a link to the YouTube Video: http://tinyurl.com/BaffleVideo

He uses two blankets, a quilted moving blanket which you can buy for $15 at http://tinyurl.com/QuiltedBlanket, and under that a regular furniture pad, which you can buy for $8 at http://tinyurl.com/FurniturePad.  You’ll also need $6 worth of hooks from Home Depot or any hardware store and a set of shower rings, which you can also get at any Wal-Mart for a few bucks.

If you don’t have a way to build something like this and you have a walk-in closet in your house? Record in there! You’ll be amazed at the difference in quality you can get in a closet full of clothes.