Wednesday, July 7, 2010

WebMatrix PHP Editor

Yesterday Scott Guthrie announced WebMatrix, a new tool from Microsoft which lowers the barriers to entry for creating your own .NET based website. It features all the newest Microsft treats which Guthrie has introduced over the last week: IIS Express, Compact SQL Server, and Razor.

Tonight, rather than playing with all these new toys, I was able to setup WebMatrix as an IDE for an existing PHP website I manage. A screenshot (clicky, please):



It's pretty, by far the best looking PHP IDE I've tried. And easy to use; everything about it screams simplicity (which is good and bad: no intellisense, no right-click context menu). Still a huge improvement over my previous editor: Filezilla and TextPad :)

Two big complaints: the Publish functionality wasn't working well for me (I update to an ftp site, WebMatrix updates *all* files everytime) and my site doesn't render perfectly in the browser (css-related stuff, not sure if it's an IIS Express).

I did have to go through a bit of pain to get IIS Express to render php pages. Detailed issue below:
  • Trying to load a .php page, I recieved a HTTP 404.3 error: "The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map."
  • The handler is not present! I spent quite a bit of time trying to manually update the .config file (I think I was updating the wrong one - %WebMatrixInstall%/config/applicationHost.config?? Anybody know?) before finding this post which details how to add a php handler to IIS 7.0 and IIS 7.5 (and IIS Express, which is based on IIS 7.5) via appcmd.exe.

And how to fix it:

  • Open a command prompt at your WebMatrix install directory (mine is "C:\Program Files (x86)\Microsoft WebMatrix"
  • For the following command, replace the scriptProcessor parameter with your proper path to php-cgi.exe and run: " appcmd set config /section:handlers /+"[name='PHP_via_FastCGI',scriptProcessor='C:\Program Files (x86)\PHP\php-cgi.exe',path='*.php',verb='*',modules='FastCgiModule',resourceType='Either']" "
  • Do the same with this command: " appcmd set config -section:system.web
    Server/fastCgi /+"[fullpath='C:\Program Files (x86)\PHP\php-cgi.exe']" /commit:a
    pphost "
  • It works (for me)!

All in all, I was very impressed with WebMatrix and IIS Express. I'll be using WebMatrix to manage my PHP site in the future and I hope to play with Razor and SQL Express soon!

Tuesday, June 1, 2010

TextPad and XML Tidy

I've been using TextPad for general text editing lately. Works quite nicely, no huge complaints (syntax highlighting would be nice, perhaps there's an add-on out there???).

There is an Add-On for Text-Pad named XML Tidy that formats XML documents nicely, taking them from ugly one-line documents to properly tabbed hierarchies. Very cool, this feature is a must for Text-Pad users working with XML documents. I ran into some problems during install on Windows 7 and will note the solution here. First, an install guide:

1. Download XML Tidy from the Text-Pad Add-On page
2. Unzip and put the folder in a permanent location (I chose the existing TextPad install folder)
3. In TextPad, install the Add-On by going to Configure->Preferences and selecting Tools in the tree. Click Add-> Program and select the XML Tidy exe (where you put in in step 2).
4. You will now be able to configure XML Tidy in the same Preferences window. Expand Tools and select XML Tidy. You'll need to change Parameters field to "$Clip $DocWnd" (as per the XML Tidy Readme). Hit OK.
5. You can now run XML Tidy in TextPad by going to Tools->External Tools -> XML Tidy. Note the Ctrl + (number) shortcut, very handy!

At this point you should be excited, as you've installed and configured XML Tidy. Open up your favorite XML document, hit Ctrl + (number) aaaaaand.... Nothing happens. Here lies the issue.

XML Tidy is throwing an error (it's hidden when running in TextPad). Run XMLTide.exe by itself, you'll get the following error in a dialog box:

"The program can't start because MSVBVM50.DLL is missing from your computer. Try reinstalling the program to fix this problem."

XML Tidy requires Visual Basic 5 runtime files, which apparently includes certain DLLs no longer packaged with or are deprecated in Windows 7 (Windows Vista, too? I didn't research it thoroughly). Luckily you can still download the required DLL here. Download and unzip the CAB file (a DLL and an INF file are inside) to the same directory as XMLTidy.exe (the exe will be able to find the DLL if it's located in the same directory).

That should be it! Try running the exe again, you should get a different error that says you need to pass text to the program. Go back into TextPad and try running the Add-On again there. I hope it works for you!

Friday, May 7, 2010

Pepsi Promoting Entrepreneurship

It's great to see entrepreneurship promoted anywhere: schools, businesses, a beverage company's latest philanthropy...

Check out Pepsi's Refresh Project, a philanthropic project whose basic premise hinges on the American Entrepreneurial Spirit(tm). Here's the gist:
  • Every month, Pepsi gives away $1.3 million to 32 philanthropic ideas
  • Anyone can submit an idea
  • Pepsi chooses 1000 ideas each month to be voted on by YOU!
  • YOU can cast up to 10 votes per day in support of any of the 1000 ideas
  • The top ideas at the end of the month are verified as legit by Pepsi, Pepsi sends a check
Brilliant! Some ideas are rather boring "grant money please" applications. But others, others radiate with the entrepreneurial excitement that is so fun and energizing to behold. It's a joy to see that spirit promoted and rekindled in philanthropy and America at large.

Wednesday, April 21, 2010

Setting up SVN

I've used this guide from Coding Horror several times over the past year. It takes the reader through the install and configuration of a simple SVN server. The end solution is hosted as a Windows Service and provides simple user authentication.

Also, Programming Nightmare does not directly borrow its name from Coding Horror :-)

Friday, April 16, 2010

DBML (LINQ to SQL) Wonkiness

I like using DBML (LINQ to SQL) as an ORM system when I'm doing work in C#.NET. It's far from a perfect solution but it's easy to use and expandable (partial classes for the win).

Visual Studio 2008 has a graphical DBML file editor which allows you to drag tables from a SQL Server database onto its canvas. Probably the biggest pain working with this setup comes when making DB changes and you need to reflect those changes in this graphical editor. The best solution I've come up with in doing this is to basically delete all the tables you've updated, then drag them back onto the canvas. Unfortunately this requires deleting stored procedures that return an object of that table type.. So you have to re-add those as well, which makes this non-scalable solution. (If you have a better update solution, please post it!)

This is where the wonkiness comes in. I've had the following happen a few times: I have the DB Server connected inside Visual Studio and at the same time I'm making updates to it within SQL Server Management Studio. Changes are made to the database within Management Studio and I'll need to go through the above process in Visual Studio. Then something goofy happens. I'll be unable to add a stored procedure, receiving an error that indicates that the SP's return object does not match the Table shown in the graphical editor. Or Foreign Keys won't appear in the graphical editor or its produced code. The problem persists until Visual Studio is restarted. After a restart everything will work as expected.

This wonkiness has me caused some hair pulling over the last year. Hopefully this tip - restart Visual Studio if the graphical DMBL editor isn't behaving as expected - will save you some time.

Tuesday, April 6, 2010

Getting Back Into Gaming

I have fallen out of touch with the gaming universe.

It happened slowly... I quit checking evotab.com for new articles every hour. Then I'd check it every day and just glance over the feeds for something interesting, not having time to keep up on all games on all consoles. I quit reading PvP. I didn't listen to the Gamers With Jobs podcast. I stopped watching Zero Punctuation. Before long I fell behind on Dubious Quality, xkcd and Penny Arcade..

As of today, it's been over 6 months since I've felt "in touch" with the gaming industry. It really came to light today when I stumbled across this article, from 2 weeks ago. (Nintendo has released some info on the Nintendo 3DS, a new handheld which will be unveiled at E3 this year). Back in my gaming days, this is the type of thing that I would have known about less than an hour after the news broke. And I would have been incredibly excited about it. Now it's something I'm interested in and somewhat disappointed that I didn't know about.

I don't need to get back to the point where I get know the hourly news on every game. However, gaming is something I'm interested in and passionate about, a hobby that I want to keep my nose in and an industry I enjoy keeping abreast of. I firmly believe that happiness is a product of doing the things you enjoy (advanced concept there). What does it say for my future if I'm unable to make time to do the things I enjoy today, when I have so little responsibility?

So I'm going to tiptoe back into gaming news. I plan on reading the sites I loved: Dubious Quality, xkcd, Penny Arcade, Rock-Paper-Shotgun, Gamers With Jobs.. These are all easy to digest in 15 minutes a day. Today I bought a little something-something to jumpstart these refound habits:


Sure I'll miss the breaking, sometimes obscure Kotaku and Joystiq news; I will get the highlights instead. I'll be doing something I enjoy, regardless.

Monday, April 5, 2010

Batch Photo Resizing

This is how I want picture resizing to work: Drag pictures or a folder onto an executable icon, that exe should then transcode those photos (recursively exploring sub-folders) to a Facebook / CD-RW friendly 1 megapixel image.

The Google brought me this app: Picture Resizer 4.0. PR4 works just like I've outlined above! Configuration is done by renaming the executable (appending options to the end of it). The site has a "Renaming Wizard" to help you out with this:


Shown are the options I used, which gave me images in the kB's rather than the MB's. Who needs all those pixels anyway?

Picture Resizer 4.0. Googling so you don't have to.

Friday, April 2, 2010

UnDelete a file with Glary Undelete

How often have you heard the question (or asked it yourself), "I just deleted something, is there any way to get it back?" These slap-your-forehead requests are usually asked frantically and in times of panic as users quickly come to the realization that their last 3 days of work may be gone forever.

But be still! Remain calm. We can rebuild him, we have the technology. It's called Glary Undelete.

I found this program over vacation after my girlfriend mistakenly deleted 3 days worth of photos from a Kodak camera (why would you make a 'Delete all photos' option so readily accessible, I will never know). This free program was able to restore all 300 photos and make me a hero.

There are certainly other programs that would accomplish the same task but I found that finding a free one can take a bit of effort. Paid programs go so far as to show you the files that it COULD restore, provided you pay the $20 to activate the product. Teases.

Glary Undelete. Googling so you don't have to.

Thursday, April 1, 2010

Bringing the blogs

April is a time for warmer weather, frantic work on semester projects, and blogging.

Last year a number of my friends attempted 30 blog posts in 30 days during the month of April. The object of the exercise was (and is!) to a) actually blog; and b) get better at blogging.

30/30 is getting another run this April and I'm going to try and keep up! The participants:


Looking forward to it.

Saturday, August 1, 2009

Running Diablo II in High Resolution on Windows Vista

This morning I set up Diablo II to run in Vista and was able to get the D2MultiRes mod working. D2MultiRes provides you with the option to play Diablo II and the Diablo II: Lord of Destruction expansion in resolutions higher than the standards supported. Right now I have the game running in 1440x900:


Steps:

Install Diablo II and the Diablo II: LOD expansion.
Download and install the patch for the expansion. I found it on Blizzard's site, here. Direct link to the patch.
Get the program to run in Vista.. Right click the "Diablo II.exe" executable, click properties and then go into the "Compatibility" tab. Play the settings you see here until it works. What worked for me: "Run in compatibilty mode for XP SP2", "Run in 256 Colors" and "Run in 640x480 screen Resolution" all checked. Another popular solution to Vista woes: anytime you run the executable, right click and then "Run as Administrator". Good luck.
On first run Diablo II may do a "Video test" and allow you to select which graphics driver to use. I was unable to run the game using the Direct Draw driver, but the Direct 3D driver works. You can change this setting later by running the "D2VidTst.exe" executable in the install directory (you can also find it in the start menu).

At this point Diablo II should be up and running! Steps to install the mod:

Download the D2MultiRes mod. Direct link. Unzip the downloaded file and copy its contents to your Diablo II directory.
Run the game from "D2MultiResGame.exe". You will probably have to go through the same process as above to get it to play nice with Vista (compatability mode settings).

The mod creator claims that it is incompatible with the Direct 3D driver but I didn't have any problem. The main menu screen will still be at 640x480 but once you start the game you will have a myriad of resolution options! I mentioned running at 1440x900 but at that resolution it was difficult to click enemies (which you do a lot of in Diablo..). After bumping it down to 1280x800 many of those difficulties went away and the game still looks great.

One thing I'm suprised with at high res is the "Perspective" graphics. It's Blizzard's way of making a 2D game look much more 3D and it is gorgeous to see in action at high resolution. Basically, as you move your perspective of the landscape shifts as well. So a wall will subtly rotate or change size as you move away from it to provide the illusion that it is actually a 3D object. I've never noticed it before at lower resolutions but at 1440x900 it really pops out when you are just walking around town. Unfortunately a screenshot can't really capture the effect, install the game and see for yourself!

-happy gaming

Monday, June 8, 2009

Disable System Beep in Ubuntu

I've done this 3 times in the last three days and need a place to write it down for future reference:

How to disable the system beep in ubuntu:
Edit the file '/etc/modprobe.d/blacklist'
Add the line 'blacklist pcspkr'

Thursday, April 30, 2009

GUI Design Guidelines

I can't make things look pretty.

...specifically GUIs (although I'm not much of an arteest either). I've grown to realize this over the last five years or so. However, I do appreciate and admire those people who are able to make things look pretty. In my left-brained efforts to understand their creative right-brained madness, I've come to really appreciate and enjoy GUI Design Guidelines and Standards documents.

Tonight I came across a post on Google's Android Developers Blog which introduces Widget Design Guidelines for Android. The guideline provides a list of standards for Android widgets and provides tips from the Android team on how to create an effective widget, very interesting stuff to glance over. Very useful stuff if you're creating your first widget or struggle making things look pretty.

This brought to mind some GNOME documentation I stumbled upon long ago that provided HCI guidelines for the entire GNOME project. These guidelines start off with Getting Real style usability principle writeups before jumping into specifics standards for the GNOME project. Personally I think some of the documentation is fascinating to browse through. Check out the section on designing effective icons, alerts or window layout for a taste of what's there.

Wednesday, April 29, 2009

HDTV Research - AVS Forum

I'm a loyal reader and follower of Bill Harris over at Dubious Quality. I've been reading his blog since the beginning of my time on this internet, starting with his posts at the now defunct (and still sorely missed) gonegold.com.

Bill is always an entertaining read and has introduced me to a number of interesting stories and resources, one of which is the AVS Forum. This is THE place to go if you're interested in researching or purchasing a new HDTV. It's basically a large community of experts and HD TV (and other sound and video equiptment) fanatics. Check it out. If you're thinking about purchasing, make sure you register and check out the Great Found Deals forum!

Wednesday, March 25, 2009

New Record!

Just noticed this....

5 straight months with at least one blog post! woot!

Once again, back from the dead

This past month I've been busy with job hunting, spring break and school. Not to mention work done on HappierHour, the new phenomena sweeping Facebook nation!

This evening a fellow blogger came in bragging about the new look of his site and I felt compelled to update my blog with a new template. To top it all off I figured a new post was in order. So here it is, promising to be the first of many more to come.

Job update to satiate the hungry... This summer I'll be working at a tech firm and am anticipating taking on a wide variety of tasks: development in .NET and C# (<3 C#), database design and benchmarking, system administration, tweaking and updating perl scripts, general process automation in both Windows and Linux. I hope that some of these tasks will result in worthwhile, helpful and entertaining blog posts.

Wednesday, February 4, 2009

Validation and Rake tasks

Today I was able to put some nifty url validation into my feed reader. Almost as nifty are the tests I wrote to validate them.

I also created a Rake task to update all the feeds in the database. Rake tasks are also nifty, its very easy to access and modify models within them. I found a helpful intro to rake tasks here.

A final note: Rails Guides is a newly found resource for me. It was apparently updated to a new visual format this week and it looks great right now. There's some great, current documentation there that I would recommend to anyone looking to learn more about rails.

Wednesday, January 28, 2009

Forms and Links

Tonight I was able to put some solid time into OutBlogger, users can now add watches to feeds they are interested in.

So I've gotten a decent handle on Rails by now but I still struggle in two main areas: Forms and Links in views. It's simply a matter of not knowing which tool to apply where (form_for, link_to, button_to, etc.). Rails has a number of helper methods and it seems like every example I look at implements them differently... Which leads to frustration and me trying a number of different things. I usually know WHAT I need to do (ex. tonight I needed to send a POST containing a new watch to the watches controller) but I struggle with HOW to do build inside a view.

Head colds suck.

Saturday, January 24, 2009

OutBlogger and TDD

My RSS reader is working in a fairly simple form. I've tried to engage in test driven development while creating OutBlogger.

Starting from scratch, I've tried following the mantra "write no code unless a test fails." This left me writing tests such as this one:
def test_create_duplicate_feed
   feed_a = Feed.new(:url => "http://feeds.joystiq.com/weblogsinc/joystiq")
   feed_b = Feed.new(:url => "http://feeds.joystiq.com/weblogsinc/joystiq")

   feed_a.save
   assert !feed_b.save
end
This test allowed me to write one line of code in the model:
validates_uniqueness_of :url
Needless to say it was a little slow and frustrating at the start. Since then I've adjusted the mantra and am now just coding the easy, boring stuff and using intermittent TDD for interesting stuff. I do keep away from generating generic scaffolds inside the project, as that creates tons of unnecessary code. This mix of quasi-TDD and avoiding the generate command has tidied up my code a great deal and made iterative development much easier.

Monday, January 19, 2009

Itest flag. Noted.

When running tests by hand from the command line be sure to include the "-Itest" flag. Without this flag the test_helper.rb file won't be loaded properly, your tests will not run.

Relevant RoR commit