Sponsored by Gluten Free Waffles and Sliced Bananas

Friday, December 10, 2010

FIX: Samsung Intrepid (Windows Mobile 6.5) Freezes and Unresponsive

11:11 AM Posted by Tyson Nero No comments
If you own a Samsung Intrepid and the device is constantly freezing and unresponsive, you may have an issue with a known bug regarding the XbuttonSetting. This bug affects tmail.exe and causes the phone to freeze for up to several minutes when closing the Messaging window.

Please following the below steps to correct:
  1. Go to Start > Settings > System > XbuttonSetting
    • Click Windows Button to go to the Start screen
    • Click Settings
    • Click System
    • Click XbuttonSetting
  2. Uncheck Enable to end running programs by tapping "X"
  3. Restart your device
Now, go into Messaging and try closing it using the “ok” button. You should no longer experience any hanging. If you still have difficulties, ensure the checkbox is not enabled under the XbuttonSetting.

The implications of disabling the X button are that your programs may continue to run after exiting. You may need to visit the Task Manager from time to time to free up any used memory.

Wednesday, August 11, 2010

Visual Studio 2010 Facts: Fact #6

7:06 AM Posted by Tyson Nero No comments
The fall of man did not come from Eve eating the forbidden fruit, but from her breaking the nightly build in Visual Studio 2010.

Friday, July 9, 2010

Wednesday, June 23, 2010

Detect Google Chrome Browser with ASP.NET

6:28 AM Posted by Tyson Nero 4 comments
Can't detect Chrome by default with ASP.NET? Here's the quick way.

  1. Right-click you project and select Add ASP.NET Folder > App_Browsers
  2. Right-click App_Browsers and select Add New Item > Browser File. Name it Chrome.browser.
  3. Add the following code to Chrome.browser.

Increase the number of characters ASP.NET uses for the user agent header in Web.config:

You can now create a file to test browser detection. Here is some code to get you through the process.

.aspx page:

Code behind:
lblBrowser.Text = Request.Browser.Type + ", " + Request.Browser.Platform;

lblData.Text = "User Agent = " + Request.UserAgent + " ";
lblData.Text += "Type = " + Request.Browser.Type + " ";
lblData.Text += "Name = " + Request.Browser.Browser + " ";
lblData.Text += "Version = " + Request.Browser.Version + " ";
lblData.Text += "Major Version = " + Request.Browser.MajorVersion + " ";
lblData.Text += "Minor Version = " + Request.Browser.MinorVersion + " ";
lblData.Text += "Platform = " + Request.Browser.Platform + " ";
lblData.Text += "Is Beta = " + Request.Browser.Beta + " ";
lblData.Text += "Is Crawler = " + Request.Browser.Crawler + " ";
lblData.Text += "Is AOL = " + Request.Browser.AOL + " ";
lblData.Text += "Is Win16 = " + Request.Browser.Win16 + " ";
lblData.Text += "Is Win32 = " + Request.Browser.Win32 + " ";
lblData.Text += "Supports Frames = " + Request.Browser.Frames + " ";
lblData.Text += "Supports Tables = " + Request.Browser.Tables + " ";
lblData.Text += "Supports Cookies = " + Request.Browser.Cookies + " ";
lblData.Text += "Supports VB Script = " + Request.Browser.VBScript + " ";
lblData.Text += "Supports JavaScript = " + Request.Browser.JavaScript + " ";
lblData.Text += "Supports Java Applets = " + Request.Browser.JavaApplets + " ";
lblData.Text += "CDF = " + Request.Browser.CDF + " ";

Wednesday, May 12, 2010

Wednesday, May 5, 2010

Code Monkeez Newest Sponsor

7:46 AM Posted by Tyson Nero 1 comment
Code Monkeez is proud to announce that we are now sponsored by Gluten Free Waffles and Sliced Bananas, a subsidiary of Tomatoes and Basil.

Wednesday, April 28, 2010

Banana Peels: Casting a string or int to an Enum

10:34 AM Posted by Tyson Nero No comments
I always find myself researching how to cast to an Enum. If you're like me, here's the simple solution.

Using a string:
MyEnumType myEnum = (MyEnumType)Enum.Parse(typeof(MyEnumType), theString);

Using an int:
MyEnumType myEnum = (MyEnumType)theInt;

Wednesday, April 21, 2010

Windows 7: Chuck Norris Approved

6:56 AM Posted by Tyson Nero No comments
One may wonder... Is Windows 7 Chuck Norris approved? Through some discreet sources, Code Monkeez has learned that not only did Chuck Norris approve Windows 7, but it was actually his idea!

Tuesday, April 20, 2010

The Ultimate SQL Search Tool (Free!)

6:14 AM Posted by Tyson Nero No comments
Does your company have it's own custom SQL search stored procedure that hardly works? Are you constantly searching for database objects but don't know where to find them? Well, Red Gate® Software has the perfect tool to meet your needs: SQL Search.

This add-on hooks right into SQL Server Management Studio to dynamically search across servers, databases and objects for fragments of text. Results are listed while you type and display in a preview window for respective objects with your search terms highlighted.

If your company is not using SQL Search, they are missing out.


Tuesday, April 6, 2010

ASP.NET MVC: Authorizing Users with the [Authorize] Filter

4:11 PM Posted by Tyson Nero No comments
MVC makes it easy to declaratively authorize users at the method and class level, and you don't even have to write any code. Implementing the logic is as simple as adding a [Authorize] attribute to your action methods or model classes.

User must be logged in:

public ActionResult Create()

public ActionResult Create()

Use action filters to specify users and roles:

public ActionResult Create()

public ActionResult Create()

Friday, April 2, 2010

How To Study for the 70-536 Application Development Foundation Exam (And Hopefully Pass)

10:12 AM Posted by Tyson Nero No comments
Exam 70-536 - TS: Microsoft .NET Framework - Application Development Foundation is the prerequisite exam for the following MCTS certifications:
  • .NET Framework 2.0 Web Applications
  • .NET Framework 2.0 Windows Applications
  • .NET Framework 2.0 Distributed Applications
  • .NET Framework 3.5, Windows Presentation Foundation Applications
  • .NET Framework 3.5, Windows Communication Foundation Applications
  • .NET Framework 3.5, Windows Workflow Foundation Applications
  • .NET Framework 3.5, Windows Forms Applications
  • .NET Framework 3.5, ADO.NET Applications
  • .NET Framework 3.5, ASP.NET Applications

The 70-536 covers a wide array of .NET Framework topics, many of which you may never use in real life. The amount of information covered can seem overwhelming and it will be, but Microsoft does a good job of spelling out the topics you should know. The skills measured are as follows:
  • Developing applications that use system types and collections (15 percent)
  • Implementing service processes, threading, and application domains in a .NET Framework application (11 percent)
  • Embedding configuration, diagnostic, management, and installation features into a .NET Framework application (14 percent)
  • Implementing serialization and input/output functionality in a .NET Framework application (18 percent)
  • Improving the security of .NET Framework applications by using the .NET Framework security features (20 percent)
  • Implementing interoperability, reflection, and mailing functionality in a .NET Framework application (11 percent)
  • Implementing globalization, drawing, and text manipulation functionality in a .NET Framework application (11 percent)
Here is a more detailed list:

I recently passed the 70-536 with a score of 838 on my first attempt. Below are my recommendations for studying and taking the exam.

Studying for the exam
  1. Buy and read the Microsoft book
    MCTS Self-Paced Training Kit (Exam 70-536): Microsoft .NET Framework 2.0 Application Development Foundation
    1. Follow the test objectives laid out in the beginning of the book.
      1. It's up to you if you want to read the book front to back or in order of the objectives.
    2. Read and answer the review questions at the end of each section.
    3. Complete the code labs at the end of each section.
    4. Use the free MeasureUp exam prep software that comes with the book.
      1. You can break the exam up by test objective. As you cover a specific objective, focus the exam questions on what you have already covered.
  2. Purchase and practice reputable exam prep material
    Here are some widely used recommendations:
    1. Transcender
    2. Self Test Software
    3. MeasureUp
    4. When going through practice exams, focus on a specific objective at a time. When you are scoring 95-100% on that objective move to the next. When you are scoring well on all objectives separately, begin practicing exam questions all together. Get to the point where you are scoring nearly 100% every time.
  3. Avoid brain dumps!
    Be aware of brain dumps and non-authorized exam prep materials. If you are caught using such materials, Microsoft will permanently ban you from any future certifications: http://www.microsoft.com/learning/en/us/certification/exam-policies.aspx#bans.
  4. Watch exam prep webcasts and online videos
    1. Microsoft Learning Events
    2. 70-536 Walkthrough
      Exam Coaching Session: Exam 70-536: TS: Microsoft .NET Framework – Application Development Foundation
    3. 70-536 Cram Session
  5. Focus on the .NET 2.0 Framework
    The exam will favor answers that involve items newly added with the 2.0 Framework.
  6. Read the Microsoft book again!
    Now that you know what topics you need to be familiar with in detail, go back in the text and study them specifically.
  7. Take notes from the book
    1. It will be easier for you to remember a specific topic if you have written it down by hand.
    2. This will also allow you to summarize what you need to study rather than constantly referencing the book.
  8. Write down test questions and answers
    1. This will increase your memorization of what could potentially be on the exam.
    2. Having the questions and answers on paper will allow you to quickly review and study without the need to access exam software.
Taking the exam
  1. Show up early
    Use the extra time to review your notes.
  2. Take your time
    You have about 2 hrs to finish the exam but will most likely finish in less than an hour. Don't Rush!
  3. Review your answers
    Be sure to check your answers 2 or 3 times before moving to the next.
  4. Filter out answers based on differences
    Sometimes, the answers will look identical. Closely examine methods, properties, ect. to spot the differences and remove the answers that don't belong. This will increase the probability of choosing the correct answer.
  5. Answer each question
    You only get points for correct answers and will not be deducted for incorrect ones. Even if you don't know the answer, just guess.
I hope this helps any prospective 70-536 test takers. Good luck and be prepared.

Tuesday, March 30, 2010

ASP.NET MVC: DRY Design with Partial Views

6:44 PM Posted by Tyson Nero No comments
The use of partial views in MVC is an example of DRY (Do Not Repeat Yourself) design. Partial Views are comparable to user controls in Web Forms and also share the same .ascx extension.

To create a partial view, simply check Create a partial view (.ascx) when adding a new view. Copy any implementation into the new view that you would like to share across other views. To render your partial view in other views, use the below syntax:

<% Html.RenderPartial("PartialViewName"); %>

Monday, March 29, 2010

Using Reserved Keywords in SQL Server (T-SQL)

2:02 PM Posted by Tyson Nero 1 comment
It's a very basic concept, but for the new database developer, it can cause fits. One T-SQL reserved keyword is "description" which is commonly used as a column name for instance. You probably should not get in the habit of using reserved keywords as column names and such, but if you do, the proper way to express them is by enclosing the name in brackets as so: [description].

SELECT [description] from Table1

Thursday, March 25, 2010

MVC: HtmlHelpers Are Extension Methods

4:36 PM Posted by Tyson Nero No comments
Take a stroll through the Object Explorer to the System.Web.Mvc.Html namespace, and you will actually find that MVC HtmlHelper methods are actually Extension Methods of the System.Web.Mvc.HtmlHelper class.

namespace System.Web.Mvc.Html
    public static class SelectInputExtensions
        public static string DropDownlist(this HtmlHelper htmlHelper, string name) { }

        public static string DropDownlist(this HtmlHelper htmlHelper, string name, IEnumberable items) { }

MVC: Model Binding Security

4:04 PM Posted by Tyson Nero No comments
If you want to limit what model properties can be updated from the controller, use the [Bind] attribute. You can the Bind attribute's Include and Exclude propeties to controls what properties are bindable.

Lock down model binding at the per-usage level:
  1. Create an array of allowed properties
  2. Call UpdateModel passing in your model object and the array of allowed properties
string[] allowedProperties = new[] {"Property1", "Property2"};

UpdateModel(modelObject, allowedProperties);
  1. Add the [Bind] attribute to object passed into your action method
  2. Use the Include or Exclude property to control the bindable model properties
public ActionResult Create([Bind(Include="Property1,Property2")] ModelObject modelObject) 
Lock down model binding at the type level for all scenarios:
  1.  Add the [Bind] attribute to a particular interface or class
  2. Use the Include or Exclude property to control the bindable model properties
public partial class ModelObject
  1. Register the [Bind] attribute within the Global.asax file when you don't have access to the type definition.