#region: Awesome or Horrible?

While coding in Java recently, I decided to do a little research to see if Java supported the #region directive (or something similar) and found a ton of articles knocking its usage as poor programming style.

Personally, I love the #region directive in C#, as it allows me to keep my code more organized (and yes, I am aware of the exisiting code-folding functionality in Visual Studio). In the files I work with, I’ve become pretty meticulous about organizing the code blocks into regions, partially because I like the organization, and partly because I was previously under the impression that it was good form to keep source files organized in this way. I use the following regions myself, generally:

  • Private/Protected Members
  • Public Accessors
  • Constructors
  • Public Methods
  • Protected Methods
  • Private Methods
  • (Anything class specific)

I agree with the sentiment in the articles I’ve read that it is *not* good practice to sweep bad code under the rug by hiding it from the developer in a folded #region, but I think that organizing relatively good code into regions like the ones I’ve mentioned above makes it a lot easier to get directly to the code I want to work on.

What do you think? I’m curious to see justifications for/against this directive, and as always, thanks for reading!

Additional links:

ASP.NET: Starter Kits and Community Projects

In relation to the last post, here are some starter kits and projects officially listed at Microsoft’s own ASP.NET site (http://www.asp.net/community/projects/)

Starter Kits

 

DotNetNuke® Web Application Starter Kit

DotNetNuke is an open source web application framework ideal for creating, deploying and managing interactive web, intranet and extranet sites. The combination of an enterprise portal, built-in content management system, elegant skinning engine, and the ability to display static and dynamic content makes DotNetNuke an essential tool for ASP.NET developers.

TheBeerHouse: CMS and E-commerce Starter Kit

TheBeerHouse starter kit enables you to implement a website with functionality typically associated with a CMS/e-commerce site. This website demonstrates key features of ASP.NET 2.0 and is the sample used in the book, “ASP.NET 2.0 Website Programming / Problem – Design – Solution.”

Small Business Starter Kit

The Small Business Starter Kit provides a sample of a business promotion website suitable for small and medium-sized businesses. It provides a template for customizing and creating a site for your own business out-of-the-box, with advanced features including integration with SQL and XML data sources for content and data management.

Open Source

dasBlog

dasBlog is a blogging engine that offers elegant visual aesthetics, powerful easy to use features, and a unique application architecture. dasBlog requires no database engine, using file-based content management with an architecture that ensures excellent performance.

Visit the dasBlog Web Site

ScrewTurn Wiki

ScrewTurn Wiki is a fast, powerful and simple ASP.NET wiki engine, installs in a matter of minutes and it’s available in different packages, fitting every need. It’s even free and open source.

Visit the ScrewTurn Wiki Web Site

BlogFodder: List Of Free / Open Source ASP.NET Web Applications

I started looking for free/open-source ASP.NET applications to run on my development instance of IIS (since IIS is already running on my machine), and stumbled upon this list today:

As a big ASP.NET advocate, I’m loving the recent surge in open source / free ASP.NET applications that are hitting the web – And what’s more because Microsoft have given us some great building foundations with the frameworks like the ASP.NET Membership Provider, a lot of these open source programs are very high quality!  More so than some of the paid applications.

I thought it would be a good idea to create an ever growing list of all the open source ASP.NET applications I could find – Obviously I haven’t had chance to download or install every application so I can’t vouch for them

Notable applications:

Full list available at:
http://www.blogfodder.co.uk/post/2008/07/List-Of-Free–Open-Source-ASPNET-Web-Applications.aspx)

Making XAMPP (Apache) work with IIS on Windows XP/Vista

Update: This application will help you track down which applications are using which ports on Windows – very helpful for debugging if the steps below don’t solve your problem, or if IIS is not the only application answering on port 80: http://winnetstat.zapto.org/

Also, if you don’t specifically need all the features of XAMPP, but would like to run PHP/MySQL applications through IIS, give Web Platform Installer a try. Through WPI, you can choose to install PHP directly within IIS (so that IIS can serve both ASP.NET and PHP applications on port 80, for example) and you can also have a ton of applications installed and configured automatically for you, such as Drupal, WordPress, and Moodle (among many others). However, if you are still looking to run XAMPP specifically, or just run an Apache instance along with IIS, check out the instructions below. Thanks for visiting!

Continue reading “Making XAMPP (Apache) work with IIS on Windows XP/Vista”

Super Nintendo Emulator SE

Just found out about this today – I was always curious as to how they developed games for the Super Nintendo…

emuse2

Super Nintendo Emulator SE

From Wikipedia, the free encyclopedia

The Super Nintendo Emulator SE was a Nintendo-sponsored game development system for the Super Nintendo Entertainment System. It was designed by Intelligent Systems, and sold only to licensed Nintendo development houses.

Physical views

The device is in the form of a large, rectangular metal box, approximately 18 inches high, and 12 inches wide, and 13 inches deep. The box is painted grey, and bears the marking “Emulator SE” on the front in grey.

The device has two controller ports at the bottom that are standard Super Nintendo Controller ports. The rear of the device featured two 50-pin SCSI interface designed to connect to a PC running MS-DOS. One of these ports came with a terminator. The rear of the device also has a port labeled “Multi-Out”, which is identical to the Multi-out port on a normal Super Nintendo.

Below that, it has an 8 position DIP switch. Because there is no known copy of the documentation of this machine, the function of the switches is unknown. Although it is possible the switch is used to set the SCSI ID of the device.

The units bear five-digit serial numbers.

The device is rated to consume 40 watts of power at 120v, and bears a 1991 copyright date. It uses a standard PC Power Cable.

Wikipedia article here:
http://en.wikipedia.org/wiki/Super_Nintendo_Emulator_SE

Some pictures here:
http://shiggsy.gbadev.org/unit.php?unit=22

More info here (from an owner of the system):
http://dforce3000.de/snes.html

Multi-Targeting VS2005 and VS2008 Web Application Projects, a Gotcha!

Great post on how to share a solution between VS2008 and VS2005, from stevenharman.net/blog:

One of the things I’m most excited about with Visual Studio 2008 is it’s ability to target various versions of the .net framework, a feature known as multi-targeting.

I recently rebuilt a (hand-me-down) laptop for use at developer group meetings, conferences, and coding from the couch. When building out the machine I decided to only install VS2008 and make use of multi-targeting to work on my various .net 2.0 projects… like Subtext. Today I finally got around to loading Subtext up in VS2008 and I was expecting some heartache.

But I did a little research first and luckily came across Rick’s great post explaining how VS2008 and VS2005 can be made to play nice together, allowing you to work with your projects in either IDE. The gist is, the project files (i.e.- your .csproj files) will work in either environment, but you’ll need to maintain separate solution files. Not a huge deal as most of the churn is usually in the individual project files, and not the solution.

(via Multi-Targeting VS2005 and VS2008 Web Application Projects, a Gotcha!)

Regarding Base-64: Trying to solve an ASP.NET issue…

Update: Thanks to WordPress.com automagically linking related posts to each other, I think I may have found a potential solution to this issue here: Invalid character in a Base-64 string (ASP.NET)

The problem seems to be with the ViewState. The ViewState is encrypted, and when an attempt is made to decrypt it on postback, the error is triggered.  The solution is actually quite simple: in the web.config file, set the ViewState not to be encrypted, like this:

<system.web>
<pages viewStateEncryptionMode=”Never”>
</pages>
</system.web>

You should really check out the rest of that article; it looks like it’s got a great explanation for what is actually occurring.

Also, this seems to be related to another message, “Invalid Viewstate.”

My original article is below the fold…

Continue reading “Regarding Base-64: Trying to solve an ASP.NET issue…”