Visual Studio Minimalist Menu?

Downloaded Visual Studio 2010 Express, because I need to use the parallel programming in my project, and it’s the first time I came across the ConcurrentDictionary example on the Internet, but VS complained that it couldn’t find the namespace, so I decided to look it up in the Object Browser, and I noticed it’s not there, and most of the menu are gone!

At first I thought it is stripped out in Express edition, after playing with the menu, I figured the default setting is the Basic setting, can easily change from Tools –> Settings –> Expert Settings , and hence all the familiar menu came out.

Never encountered this situation before as this is the first time using Express edition…

May 30, 2010 · Stephen Saw

Super Mario Crossover

Just happened to came across a Flash game, Super Mario Crossover at Newground, I don’t usually like to play Flash game, I prefer it to be a downloadable game on my desktop, but this game got me hooked for some times.

Super Mario Bros Crossover’s title screen
Title Screen

This game is based on Super Mario game we all familiar with, but instead of Mario alone, we can now choose from Samus from Metroid, Link from Zelda, Mega Man from Mega Man series, Simon from Castlevania, and Bill from Contra.

Each level starts with character selection

Super Mario Bros. Crossover character selection
Characters

All character having some common ability, step on enemy, hit the block with head. But the game is well design where each of the character have special ability on their own, which is exactly same as in their game. All character starts with basic ability, e.g. Mega Man can do slide, can’t do charge shot, Bill using only basic gun. After get the mushroom power-up, they will get a new ability, Mega Man can now do charge shot, Bill using a machine gun, while flower power-up made them have the special ability, Mega Man using fire shot from the fire boss, Bill using shot gun. Each character’s power-up will retain as the game proceed, unless game over.

This game can even let user to change control key (most of the Flash game don’t, I hate to play game using arrow key), and even save/load game state, awesome!

May 22, 2010 · Stephen Saw

Pacman on Google

Randomly access to Google main page brought me a surprise, it’s Pacman’s 30th birthday, and Google actually replacing their usual Google logo to a Pacman game, and the I’m lucky button as Insert Coin button, which clicking the button will add Mrs Pacman into the screen.

Pacman control by arrow key and Mrs. Pacman control by W,A,S,D key.

Pacman

< wakka wakka…

May 22, 2010 · Stephen Saw

I Comparing String

A buddy of mine suddenly popped me a question, how to sort a list of string according to the substring, this is a very good question, as I’ve never come across this kind of sorting, usually will use the Array.Sort or Array.Reverse to handle the thing. But to sort according to the substring is something new to me.

To do that, we’ll need the ICompare interface. In this scenario, I got an array that looks like this:

string[] s = { "aaaB", "aacC", "aabA" };  

which will give the result of aaaB, aabA, aacC if using the Array.Sort. Now the objective is to sort the list based on the last character, but not the other. To do this, I’ve use a class that implement ICompare (I’m doing it for .NET 1.1, I don’t have fancy lambda or maybe I just don’t know how to do it without class).

class Comparing: IComparer  
{  
  public int Compare(object x, object y)  
  {  
    return String.Compare(x.ToString().Substring(3), y.ToString().Substring(3));  
  }  
}  

We’ll need the System.Collections namespace for this, the only function inside this class is the implementation of the IComparer interface, which is a required function. The function compare 2 value, x and y, which will be our array item.

Here I using the substring of each x and y to get the last character that I wanted to sort, and compare them with String.Compare. To call our class,

string[] s = { "aaaB", "aacC", "aabA" };  
Array.Sort(s, new Comparing());  
foreach(string str in s)  
{
  Console.WriteLine(str);  
}  

By just passing in our new class in the Array.Sort, now it work out very well. 😀

May 21, 2010 · Stephen Saw

Visual Studio 2008 Adding Feature Error

Trying to add new component to my existing Visual Studio 2008 Professional installation, adding in C++ component that I left out as I’m no C++ programmer, and I need it to compile some existing source. On the installation screen, after checked C++ and click next, I’m presented with an error:

VS2008Setup
After a quick Googling, found that by uninstalling the Service Pack 1 for my Visual Studio 2008 actually works!
Easy steps, uninstall Service Pack 1, install C++ component, and then reinstall the Service Pack 1.
😀 happy Visual Studio 2008 again.

May 12, 2010 · Stephen Saw

Mouse Get Away

Happen to running Windows 7 64bit, with a Wacom Bamboo tablet driver installed (tablet unplugged), using a wireless mouse, mysteriously my mouse does not working well in MS Paint and WLM drawing.

It might cause by recent Windows Update, or some mystery stuff happening background, my mouse start to act weird on MS Paint, where I click and drag (or draw) is actually not the actual drawing happen, the real drawing happen slightly (quite) off the actual clicking point, but it does working well on normal clicking and dragging.

Fixed it by going Control Panel –> Mouse, and click the OK button, it take few second to save and close the mouse properties dialog, and magically it fixed my mouse problem, weird. :S

May 12, 2010 · Stephen Saw

File.Create Locking File

It’s very handy to use File.Create(“filename.txt”) inside .NET. Specially when doing a quick File.Exists and recreate the missing file using File.Create, but right after creating the file using File.Create, the file was locked. To fix this, the use of Using, or adding a .Dispose after the statement will do the works.

using (File.Create("filename.txt"));//OR File.Create("filename.txt").Dispose();  

It’s a simple thing, but often forgotten bout it, good to remember again!

May 11, 2010 · Stephen Saw

Humble Indie Bundle

It’s insane, Humble Indie Bundle are selling 5 indie games in a bundle, which cost only Whatever-You-Want-To-Pay, it’s donating to Child’s Play and the EFF, so, be a good guy, support indie game, and support charity.

Visit Humble Indie Bundle , 1 week only! Act fast!

May 5, 2010 · Stephen Saw

The Very First Windows Service Project

My first time of writing Windows service program, it actually not as tough as I thought it will be in the first place.

To start off, is to create a new Windows service project, of course, this had me confused for the first time, after selecting the language, C# or VB, instead of choosing the template, actually the Windows Service template is inside the –> Windows category.

Creating project

This is what we’ll get after created the project,

Solution explorer

Read more ... →

April 23, 2010 · Stephen Saw

Attaching Visual Studio Debugger to ASP.NET

I’m pretty sure there are bunch of people who also having problem that whenever they debug their ASP.NET project, the page run, and Visual Studio can’t debug it.

Actually one can attach the process to the development web server manually by go to Debug –> Attach to Process (may vary from version or edition) and select the development web server instance.

I found a single click method to get the job done. Using Macro. In Macro Explorer, create a new macro and new module, and using these codes:

Imports System
Imports EnvDTE
Imports EnvDTE80
Imports System.Diagnostics

Public Module Module1

Public Sub AttachProcess()
    Dim process As EnvDTE.Process
    
    For Each process In DTE.Debugger.LocalProcesses
        If (System.IO.Path.GetFileName(process.Name).ToLower() = "webdev.webserver.exe") Then
            process.Attach()
            Exit Sub
        End If
    Next

    MsgBox("No Development Server Found")
End Sub

End Module

To make the life easy to run the macro, go to Tools –> Customize –> Keyboard and locate the macro and assign to a new shortcut key. That’s it, whenever the web project is running, press they shortcut key and the debugger will be running. But due to the nature of the codes, it will attach to the first development web server found, it might be able tweaked to become more flexible.

March 19, 2010 · Stephen Saw