Amazon.com Widgets WilliaBlog.Net | I dream in code

WilliaBlog.Net

I dream in code

About the author

Robert Williams is an internet application developer for the Salem Web Network.
E-mail me Send mail
Code Project Associate Logo
Go Daddy Deal of the Week: 30% off your order at GoDaddy.com! Offer expires 11/6/12

Recent comments

Archive

Authors

Tags

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.


'No device drivers found' during Windows 7 installation on Mac using Bootcamp

Apple provides some tools along with detailed step by step guides to help you install Windows for a dual boot setup on your Mac, but even if you follow them completely, you may find yourself stuck (as I was) very early in the process because the Windows Setup program can't find the drivers it needs to continue, even though they were so carefully prepared by the Bootcamp assistant. I tried preparing my bootable USB drive with 3 separate Windows 7 x64 ISO files, and could never get past this 'No Device Drivers found' error. In retrospect this could have been because the only USB stick I had that was big enough was a USB 3.0 stick and the USB 3.0 drivers needed to access it were on the stick, so in true Chicken and egg fashion Windows setup needed the drivers in order to find the drivers... So using a USB 2.0 stick might have resolved my issue.

However, while I didn't think of that at the time, I was still able to get Windows up and running: By inserting the original Windows 7 install DVD, rebooting the mac, holding down the option key to boot from the windows disc I was able to install Windows successfully. Of course, most of the hardware wasn't working due to missing drivers, so after windows setup completed, I returned to my Windows PC and burned the entire contents of that USB stick to a DVD-R. Inserting that disc I was finally able to run the Bootcamp setup that had been so lovingly prepared by Apple, and installed all of the drivers I needed to make Windows actually work.

Making the DVD-r bootable would have been even better, but since I'd already installed Windows by that point I didn't need to. (I used a $25 external USB 2.0 optical drive, since my Macbook Pro didn't come with an one).

Good luck!


Categories: Windows | Windows 7
Posted by Williarob on Thursday, April 03, 2014 11:04 AM
Permalink | Comments (0) | Post RSSRSS comment feed

Installing 32 bit software supplied with a .inf file on 64 bit Windows

Back in the days before Windows had UAC and 64 bits it was possible to distribute simple software, such as the lossless video codec Huffyuv without an installer. All you needed was the dll and an .inf file. To install it you would simply right click on the .inf file and click install, and windows would take care of copying the dll to the system folder, registering it and creating a few registry keys for you. Sadly those days are gone. If you download the Huffyuv codec today for your 64 bit version of Windows, extract the files and try that method of install, you won't see any error messages, but that codec will not appear in your list either.

To install it, you will need to open a command prompt and be logged in with a user account that has administrative privileges.

  • Go to the Start menu/button > All Programs > Accessories and right click on Command Prompt then Left Click on "Run as Administrator".
  • A little black DOS window should appear that will say "Administrator Command Prompt" at the top.
  • In this example we are assuming that your copy of Windows was installed to the standard directory (C:\Windows), and that you extracted the huffyuv files to a folder on your c drive called "downloads". navigate to the SysWOW64 folder by typing: cd c:\windows\syswow64 and then press enter.
  • Again, in the DOS box, type rundll32.exe setupapi.dll,InstallHinfSection DefaultInstall 0 c:\downloads\huffyuv.inf and press enter. Pay close attention to the spacing (or lack thereof). And that's a "zero" in the last half of the command, not the letter "O". There's no space around that comma. What you type has to match perfectly.
  • If there are no error messages, then it has installed correctly.

Tags:
Categories: misc | Windows
Posted by Williarob on Wednesday, July 24, 2013 5:44 PM
Permalink | Comments (0) | Post RSSRSS comment feed

Godaddy and HTML5 Video

Godaddy's shared hosting control panel does not include a tool to change or add Mime Types, so out of the box, your hosted site will probably not be able to serve .webm, .ogg, .ogv, or .oga content. In addition, by default, Godaddy servers are configured to use the mime type "video/mpeg" for the .mp4 extension rather than "video/mp4", which is why your mp4 video might be failing to play even in IE 10. However, if your site is hosted on IIS 7+ you can add some entries to your web.config file. Find the <system.webServer> element and look for a section called <staticContent>. If it is not there you should add it so that it looks something like this:

<system.webServer>
    <!-- Other elements -->
    <staticContent>
	  <mimeMap fileExtension=".m4v" mimeType="video/m4v" />
	  <mimeMap fileExtension=".ogg" mimeType="audio/ogg" />
	  <mimeMap fileExtension=".oga" mimeType="audio/ogg" />
	  <mimeMap fileExtension=".ogv" mimeType="video/ogg" />
	  <mimeMap fileExtension=".webm" mimeType="video/webm"/>
	  <remove fileExtension=".mp4" />
	  <mimeMap fileExtension=".mp4" mimeType="video/mp4" />
    </staticContent>
</system.webServer>

Note that because the .mp4 extension already has a mime type configured for it on the server, we have to remove it first.

Troubleshooting: If, after adding this section you start seeing Error 500 server errors on your site, first make certain that there aren't now 2 staticContent sections in your system.webServer section, then remove all of the mimeMap elements and see if the error goes away. If it does, simply add them back one at a time until you cause the error again. Add a remove element before the mimeMap(s) that cause the exception.

 


Categories: ASP.Net
Posted by Williarob on Friday, May 31, 2013 6:37 AM
Permalink | Comments (0) | Post RSSRSS comment feed

Blog Engine Save Button not working on large post

I recently wrote a really long (about 20,000 words) blog post. I had been saving it periodically as I typed, but it suddenly reached a point where the Save button just didn't work anymore. Bringing up Firebug I could see that the Ajax request was being sent and a 500 sytem Error was being returned by the server. When I tried to insert a breakpoint in the method it was never being hit.

This made me think that this size limitation was probably in ASP.Net, not in the BlogEngine.Net codebase, and sure enough that is what it is. jQuery doesn't limit the size, but ASP.NET does by default.  You can adjust it with this web.config setting:

 

<system.web.extensions>
 
<scripting>
     
<webServices>
       
<jsonSerializationmaxJsonLength="x">
       
</jsonSerialization>
     
</webServices>
 
</scripting>
</system.web.extensions>


Where x is the size limit in bytes.

If you insert this section into your web.config and start seeing errors, you will need to install ASP.NET AJAX. Visit www.asp.net/ajax for more details.

 


Categories: Ajax | JavaScript
Posted by Williarob on Wednesday, April 10, 2013 9:32 AM
Permalink | Comments (0) | Post RSSRSS comment feed

Export options missing from Adobe Media Encoder

I installed the trial version of Adobe Media Encoder CS6 (Actually the whole CS6 Master Collection) just so that I could try exporting a video as a DPX image sequence. The installation took about 90 minutes. After opening Adobe Media Encoder and adding my source file I discovered that I couldn't export to any kind of image sequence:

Adobe Media Encoder Presets

Although they appear in the list of presets, they have no options beneath them and whichever one you select the Apply Preset button remains grayed out:

Adobe Media Encoder Presets Image Sequence greyed out

I watched a tutorial video on the Adobe Web site to make sure I wasn't missing something, but it made it very clear that it was as easy as selecting a preset, so why couldn't I select one of the image sequences? Google helped me find other people with the same problem, but no solutions. Eventually, however I did find the write combination of search terms and found a solution here.

Find the file named AddExporterList.txt located at

C:\Program Files\Adobe\Adobe Media Encoder CS6\txt

Save an original copy somewhere else. Copy/Paste or delete as necessary to make the new file look like this:

# MediaCore Plugins

# AME Plugins

AudioWriter
WinMediaWriter

# AME Plugin Formats

MPEG4

H.264 Blu-ray


Hit save and restart AME. Voila! It worked for me and hopefully it will work for you. My Export options are now greatly expanded:

The old AddExporterList.txt which was not working, looked like this:

# MediaCore Plugins

ExporterAIFF
ExporterAVI
ExporterBMP
ExporterCIT
CITExporter
ExporterDPX
ExporterGIF
ExporterGIFStill
ExporterJPEG
ExporterCoreAudio
ExporterNULL
ExporterP2
ExporterPNG
ExporterQuickTimeHost
ExporterTarga
ExporterTIFF
ExporterUncompressed
ExporterWave
ExporterWindowsMedia
ExporterXDCAMHD

# MediaCore Plugin Formats. Syntax: ExporterName.ZeroBasedIndexToBlacklist

ExporterMPEG4.1
ExporterMPEG4.2
ExporterMPEG4.3

# AME Plugins

AudioWriter
WinMediaWriter

# AME Plugin Formats

MPEG4
H.264 Blu-ray

Posted by Williarob on Friday, February 08, 2013 2:30 PM
Permalink | Comments (0) | Post RSSRSS comment feed

Adding a Paypal Donate button to your Blogengine.Net blog or ASP.Net Page.

I recently had a request from a client to add a paypal donate button to their blog. So off I went to the Paypal site to get instructions for them on how to generate the button html for them to send to me.

  • Login to your paypal account (or create one).
  • Click on the Merchant Services tag.
  • Click on "Create Payment Buttons for your Website"
  • Choose "Donate" as the button type, and complete the form.
  • At the end of the process, you have the html you need to add the button to any site.

They did all this and sent me the html which consists of a simple form. Initially, I simlpy created a new text widget and pasted it in. The button looked as it should but when I clicked on it I got a 404 error. I viewed the source for the page and saw that the Form tag had been stripped, probalby by the text editor. No problem, I went to the Site Master page, and pasted it directly into the theme template, exactly where it was needed. Published the change, still goes to a 404 page. Then I realize what the problem is. I'm nesting forms. Blogengine.Net, like many traditional ASP.Net based sites, relies on the page being wrapped in a <form runat="server"> tag, which allows for all the postback stuff to work.

A quick Google search for "BlogEngine PayPal Donate button" returned a handy little Extension. But on closer inspection I could see that while this would add a button inside a post, it could not be relied upon to add it to the frame of the page itself, so that it could appear at all times, regardless of which post or page you were viewing. Of course, if it could add it to a post it must have found a way around the nested form issue, so I took a look at the code and discovered that it was creating a simple link, that is an image, wrapped in an anchor tag that looked something like this:

<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=[email address here]&item_name=[Description, e.g. "Donation to MySite.com" (UrlEncoded)]&no_shipping=0&no_note=1&tax=0¤cy_code=USD&lc=US&bn=PP%2dD onationsBF&charset=UTF%2d8"><img src="Path/To/PaypalDonateButton.jpg" /></a>

So I filled in my information and I finally had a working paypal donate button. However, I didn't like the fact that my email address was now so firmly embedded on the page, I rather liked the anonymity that the original paypal code offered. Any spider could skim my email from the page and start adding to the thousands of spam emails I already receive every day. So I kept looking for other solutions. As usual, Stack Overflow had a better solution.

Instead of using the anchor tag which makes a Get request and exposes your email address, paste in the full code from paypal, then delete the form tags. Replace the image input with a server side image button or regular button and have it post back to paypal for example If the paypal code looks like this:

 

<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="xxx">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" 
alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>

 

You paste it all in where you want it then modify it like this:

 

<input name="cmd" type="hidden" value="_s-xclick" /> 
<input name="hosted_button_id" type="hidden" value="xxx" /> 			
<asp:ImageButton ID="btnDonate" 
AlternateText="PayPal - The safer, easier way to pay online!" runat="server" 
ImageUrl="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" 
 PostBackUrl="https://www.paypal.com/cgi-bin/webscr" OnClick="btnPayNow_Click"/>
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1" />

 

In your code behind, add an empty method to handle the OnClick specified above (btnPayNow_Click):

 

protected void btnPayNow_Click(object sender, EventArgs e)
{
        
}

 

That's it! Now you have a working Paypal donate button. If you want to test it out to see if it works, by all means click on the one you see on this page ;) Or, you can change the postback Url on your button to "https://www.sandbox.paypal.com/us/cgi-bin/webscr" which should allow you to test it without actually spending any money.


Categories: ASP.Net
Posted by Williarob on Friday, October 26, 2012 7:43 AM
Permalink | Comments (0) | Post RSSRSS comment feed

WINDOWS 7: Explorer Locks "thumbs.db" in most recently viewed folder

Problem

On windows 7, you navigate to a folder that contains images or video files that you have either added new content to or have simply never explored before, if you then back out of that folder and try to delete it, you are warned that "The action can't be completed because the file is open in Windows Explorer. Close the file and try again. Thumbs.db":

Clicking Try Again any number of times will not resolve the issue. All of the files within that folder (except Thumbs.db) do still get deleted.

Usually, if you navigate to another folder for which a new Thumbs.db file is generated, then often the original problem folder can be deleted (though the most recently explored one can not), but sometimes a reboot is required. Even switching to another PC and trying to delete the folder through the network doesn't work. This was not an issue with Windows Vista.

Solution

It turns out that Windows 7 no longer relies on hidden Thumbs.db files to manage its thumbnails - that's now done with a central thumbnail cache - and it only generates these db files for backward compatability purposes. So, in my opinion, the best solution is to stop using Thumbs.db files entirely. Just to be clear, this does not mean that you will no longer see thumbnails of images and videos in windows explorer. Thumbnails will still be generated and your Windows Explorer experience as a user will be unchanged (except that you will be able to delete your folders more freely because these pesky thumbs.db files will no longer be an issue).

There are a number of ways to implement this fix and I believe they all require a reboot for the change to take effect. If you have a version Windows 7 that allows you to edit group policies (Windows 7 Professional, Ultimate or Enterprise) you can follow these steps to resolve the problem:

·    Click the Start orb

·    Enter gpedit.msc in the search box and hit Enter.

·    Expand User Configuration - Administrative Templates - Windows Components. 

·    Click on Windows Explorer.

·    Right-click the entry "Turn off the caching of thumbnails in hidden thumbs.db files" and choose Edit.

·    Enable the setting.

If you have Windows 7 Starter, Home Basic or Home Premium, or just want a quicker solution here's the .reg file equivalent of the group policy fix above.

(Paste the text below into Notepad, save it with a .reg extension, and then double-click the file.)


Windows Registry Editor Version 5.00

; Enables group policy: "Turn off the caching of thumbnails in hidden thumbs.db files"

[HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Explorer]
"DisableThumbsDBOnNetworkFolders"=dword:00000001


Alternatively you could download a .reg file I made earlier, and simply double click on it:

ThumbsDbFix.reg (244.00 bytes)

Or:

Bring up a (administrator) CMD prompt and type (or paste):

  REG ADD "HKCU\Software\Policies\Microsoft\Windows\Explorer" /v "DisableThumbsDBOnNetworkFolders" /t REG_DWORD /d 1 /f

And you're done.


Tags:
Posted by Williarob on Wednesday, March 14, 2012 11:48 AM
Permalink | Comments (0) | Post RSSRSS comment feed

visualsvn server "'repositories' is not a valid short filename"

Problem

I had been trying to upgrade my standard edition Visual SVN Server for months now. Every time I received the email notification of a new version I would download the update, run it and the install would fail with the error "'repositories' is not a valid short filename". Google helped me find a handful of people seeing the same error, but no solutions. Ever hopeful that the next release would not have this issue, I tried again today with the latest version but the same thing happened. Then I had an idea:

Solution

Before you run the installer, open VisualSVN Server Manager and click the stop button. Then the install will complete without a hitch. Why the installer doesn't stop the service for you before it tries to install is something only the VisualSVN Team can answer.


Categories: SVN
Posted by Williarob on Monday, March 12, 2012 12:45 PM
Permalink | Comments (0) | Post RSSRSS comment feed

Generic AddOrUpdate Extension for IDictionary (C#)

I recently came across a situation where the properties of a class were adding the value to an internal dictionary of key value pairs which made it easy to loop through and return a JSON string. This worked great until we later ran into a situation where we needed to update a property after it had already been set, which of course generated a "System.ArgumentException: An item with the same key has already been added". While it is easy enough to add a check to see if the dictionary already contains the key you are attempting to add, doing this for every property would be way too much code repetition so an Extension Method seemed appropriate.

Edit: However, it has since been pointed out in the comments area below (thanks jeanie77!), that I could just as easily have used the indexer, e.g. dictionary[key] = value to achieve the same results. If that index does not already exist it will be created, and if it does it will be updated. I prefer this solution to the extension method because it is more readable, native to the framework and can be reused in other solutions without having to find and copy the Extension code also.

If you still want to use the extension method, add the following code to a static class in your solution, then add that namespace to the list of namespaces you are "using" at the top of any class that might need it, and your Dictionary will have a .AddOrUpdate(key, value) method:

 

        public static IDictionary<TKey,TValue> AddOrUpdate<TKey,TValue>(this IDictionary<TKey, TValue> dictionary, TKey key, TValue value)
        {
            if(dictionary.ContainsKey(key))
            {
                dictionary[key] = value;
            }
            else
            {
                dictionary.Add(key, value);
            }

            return dictionary;
        }

 


Categories: C#
Posted by Williarob on Tuesday, August 30, 2011 8:54 AM
Permalink | Comments (0) | Post RSSRSS comment feed

Printable HBO Game of Thrones Viewer's Guide

Like many people, after thoroughly enjoying the first season of Game of Thrones on HBO, my wife and I started reading the books. Even with the show fresh in our minds, we found ourselves getting confused Jory/Jorah, Tyrion/Tywin so we went online looking for a nice cheat sheet. If you haven't already been there, take a look at the official HBO viewer's guide. It's presented beautifully, and easy to follow. As a web developer, I can appreciate the hard work that went into this great site.

However, thinking that we didn't want to keep going online to check every time we needed to, we thought it would be great to print it all out. What a mistake that was. All formatting is gone, and this is the result:

With the layout all messed up, the printed pages are useless!

So, with a little help from FireBug for Firefox and Adobe Photoshop, I have created a nice printable version of the site:

Download it here in Adobe PDF Format:

HBO Game of Thrones Guide to Houses.pdf (2.27 mb)


Posted by Williarob on Monday, July 25, 2011 2:10 PM
Permalink | Comments (0) | Post RSSRSS comment feed