Extending a UserControl in Silverlight

In a current project that I’m working on, I needed to extend a UserControl to add some additional specialized functionality. This is very easy to do if all you need is to extend code, but it becomes much more difficult if you want to extend it via a XAML/C# UserControl. After much web searching, I found a very simple and elegant solution, thanks to this site. Basically, all you have to do is modify the root element of your extended file as follows:

<local:SomeBaseTypeYouWantToUse
    x:Class="MyApp.MyControl"
    xmlns:local="clr-namespace:NameSpace.To.Your.BaseClass"
/>

Where SomeBaseTypeYouWantToUse is the class that you’d like to extend. Simple!

–Adam

Update (6/3/2010):I ran into some weird problems with this hack that I was unable to resolve. If anyone ends up reading this, please let me know if this worked correctly for your application.

Setting Document Root to Point to a Network Share With Windows/Apache

Quick tip: If you’re wanting to have your Apache document root point to a network share in Windows, here’s what you have to do:

  1. Change your DocumentRoot to the network share (drive remapping doesn’t seem to work).  Example: DocumentRoot “//path/to/share”
  2. Make sure to update the DocumentRoot path in your <Directory> config
  3. Edit the Apache service
    1. On the “Log On’” tab, click the “Browse” button next to the “This account” radio button.
    2. Type in an account name that has access privileges to the network share and click “OK”
    3. Enter the correct password for the user
  4. Restart Apache and LOL your way to the bank.

The New Vanity Search

From time to time, everyone is prone to perform a vanity search or two. Because I have a somewhat generic name (currently, Adam ranks at #72, Carter is #40), web searching always returns an interesting variety of results. Movie stars, a character in a British television series, an Elvis impersonator, and I all share the name “Adam Carter.” But what about adding a slight twist to your typical vanity search?

Rather than using my real name, I decided to do a search on one of my most commonly used Internet pseudo-names. Surprisingly, what came back was almost all me. In fact, the only non-me entry was for an entry in “Urban Dictionary” that, unsurprisingly, was not very flattering. Perhaps I angered this person and this was his or her revenge. Anyway, this ordeal got me thinking.

Unlike most others of my generation, I prefer to keep my online activity private from unknown onlookers. For example, I don’t use my real name for Facebook and Twitter. Yet, since the early days of the Internet, I’ve continually used the same pseudo-name for many of my activities. In some cases, my real name is even tied to my pseudo-name (oops!). Searching on this pseudo-name will provide you with several forum posts, lists of games that I’ve played, and even coding projects that I’ve been affiliated with. When I think about it, searching my pseudo-name provides a better picture of my life than my real name! Maybe I should start protecting my pseudo-name as much as I do for my real name.

For anyone that reads this, what does doing a vanity search on your Internet pseudo-name return?

–Adam

PHP 5.3 and MySQL: A connection attempt failed because the connected party did not properly respond after a period of time…

Having difficulty connecting to MySQL through PHP 5.3.x? Know that MySQL and PHP are properly configured? Using Windows Vista / 7? The problem may very well be that you’re connecting to ‘localhost.’ According to Joe Bedan, simply changing ‘localhost’ to ‘127.0.0.7’ will fix the problem, and he’s right!

According to another forum post, this is because Vista/7 does some goofy stuff with the ‘localhost’ alias. This person suggests that modifying the C:\Windows\System32\drivers\etc\hosts file to contain the line ‘127.0.0.1 localhost’ will fix the problem (make sure to do this as an administrator!). Unfortunately, this wasn’t the case for me. However, it’s worth a shot for anyone experiencing this problem.


–Adam