Monday, December 14, 2009

Start ASP.NET Development Web Server in Command Line

start "ASP.NET Development Server" /B c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\WebDev.WebServer.EXE /port:[port#] /path:[file path] /vpath:[/virtual parth/]

Starting debug server this way will allow debugging web project without even starting Visual Studio 2005.

Friday, December 04, 2009

VC++ Redistributing

Symptom: I keep bumping into this issue. Once in a while my VC++ application does not even start on the targe computer.

Cause: The root cause is that the target computer does not have the VC++ library to support the applications. I works with server products, so I usually just install VC++ library once and expect all my future updates can be done by xcopy only. However, because I turned on auto-update on my development computer, my Visual Studio 2005 keep changing the library it is linked against. So once in a while xcopy deployment is broken.

Fix:
  • Sometimes it can be fixed by simply running Windows Update
  • Run VC++ Redistributable Package on the target computer. It is located here: %PROGDIR%\Microsoft Visual Studio 8\SDK\v2.0\Bootstrapper\Packages\
  • More options here: Choosing a Deployment Method

Monday, November 16, 2009

GridView: get selected rows

Below is sample C# code to get selected rows in GridView.

protected int[] GetSelectedRows()
{
List rowIDs = new List();
foreach (GridViewRow row in GridView.Rows)
{
CheckBox cb = ((CheckBox)row.FindControl("chkRow"));
if (cb.Checked)
{
string IDString = GridView.DataKeys[row.RowIndex].Value.ToString();
rowIDs.Add(Int32.Parse(IDString));
}
}
return rowIDs.ToArray();
}

"SelectAll" CheckBox in GridView using jQuery

Here is a way to do it:


/**
* Register logic for "select all" check box and the group of check boxes
* for each data row.
*
* @param {Object} chkAllSelector jQuery selector to find the "select all" check box
* @param {Object} chkItemSelector jQuery selector to find the check boxes for all the rows
*/

function registerSelectAll(chkAllSelector, chkItemSelector) {
//"select all" checkbox
var checkAllBox = $(chkAllSelector);
//checkbox for each row
var checkItems = $(chkItemSelector);

//check/uncheck all rows if "select all" is clicked
checkAllBox.bind("click", function(){
checkItems.each(function(){
this.checked = checkAllBox[0].checked;
})
});

//uncheck "select all" if some rows are unchecked
checkItems.bind("click", function(){
if(this.checked === false) {
checkAllBox[0].checked = false;
}
});
}


To use it:

registerSelectAll(".chkAllHeader input", ".chkItem input");

Monday, November 09, 2009

"An unexpected error occurred." accessing Network Connection's properties

Cause: seems like it suddenly happens after a recent Windows Update. I cannot ping or "remote desktop" to the computer. Trying to access network connection give me this error: "An unexpected error occurred."

Solution:
This seems to fix the problem:
command line:
regsvr32 netshell.dll
regsvr32 ole32.dll
reboot

Then I can access the properties page, and I disable/re-enabled firewall. Everything coming back to normal.

P.S.
Keep my fingers crossed. Waiting for more surprised from next automatic Windows Update.

Wednesday, October 14, 2009

3D Visualization on iPhone - Got to see it to believe it

Ziosoft showcased this amazing 3D visualization on iPhone. It is fast and smooth with very high image resolution. With dual touch, seem like it is very easy to control zoom, move cutoff plane, rotate and move object, and select depth of rendering.

http://www.youtube.com/watch?v=sDVAosnh1j4&feature=channel_page

From their description and the look, it is obvious that there is web server doing the rendering behind. iPhone seem to provide the dual touch and navigation. Still the the speed is impressive. Either the iPhone has very high speed internet access, or there is some very efficient decompress and rendering algorithms running on it so that data transfer rate is not too high.

Monday, August 10, 2009

Server Explorer Missing

Symptom: Visual Studio 2005 Server Explorer is missing.
Reason: A while back, Visual Studio failed to load the server explorer at starup time, and showed a dialog to disable it. I guess I accidentally clicked "yes".

Solution: run this command in Visual Studio 2005 command line environment:
devenv /resetskippkgs

Tuesday, June 30, 2009

Refeactor! for C++ -- Review

Tried Refactor! for C++ (free version 9.1.5 published June 29, 2009). Visual Studio 2005

Summary of my experience:
Pros:
  • Free;
  • The idea is very attractive: refactor C++ code with right click and no modal dialogs;
  • Rename class names seem to work fine;
Cons:
  • Does not work most of the times. Usually global search and replace did a better job in renaming things;
  • Affects VS grammar highlight. After installation, code grey out by "ifdef"s are totally messed up. Unistall the softwate, Visual Studio went back to correct grey out;

Recommended? No. I uninstalled the software after a few days.

Still looking for a decent C++ refactoring tool.