December 24th, 2009
leozc
I am not sure why there are so many WRONG post about setting auto login, but here the correct one.
I tested this one in RTM windows 7.
1. Use Win+R and put in "netplwiz".
2. In the user account window, uncheck the box as below:
That is it.
Diplomatic incident —This is a true story from the Japanese Embassy in U.S.A. !!!
A few days ago, Prime Minister Mori was given some Basic English conversation training before he visits Washington and meets president Barack Obama… The instructor told Mori Prime Minister, when you shake hand with President Obama, please say “how r u”. Then Mr. Obama should say, “I am fine, and you?”
…Now you should say “me too”.. Afterwards we, translators, will do the work for you.”
It looks quite simple, but the truth is…
When Mori met Obama , he mistakenly said “who r u?” (Instead of “How r u?”.)
Mr. Obama was a bit shocked but still managed to react with humor:
“Well, I’m Michelle’s husband, ha-ha…”
Then Mori replied “me too, ha-ha.. .”.
Then there was a long silence in the meeting
Are you wondering why your ASP app is always slower than what you think?
It is a must read, like as follow here.
Want to mix MVC+Service+Entities framework+Linq+ Dynamic data in your project?
Here is the read.
Are you those people like me occasionally need try-and-error in order to figure a relative complicated LINQ statement?
Are you those people like me love to have a interactive LINQ shell to evaluate ideas quick ? Then here you go!
LINQPad lets you interactively query SQL databases in a modern query language:LINQ. Kiss goodbye to SQL Management Studio!
LINQPad supports everything in C# 3.0 and Framework 3.5:
- LINQ to SQL
- LINQ to Objects
- LINQ to XML
For basic features it is free, and it only costs $7 bucks to get the Auto-completion, which is a must have IMHO. And the best part is you can even run code snippet in the editor!

Nice table views

I happen to come across the need to export file system hirachy into an XML form for further processing, and here is my LINQ statements that does the job. Please note the recursion usage in XDirectoryElement function. Last word you need to ensure you have permission to read the directories, which doesn’t worry me in my case.
Main Function:
private static XElement XDirectoryElement(String root, String filespec)
{
return /// Create "Directory" element with Path attribute
new XElement("Directory", new XAttribute("Path", root),
new XElement("Files", /// Add "Files" sub-element
from file in Directory.GetFiles(root, filespec)orderby file
select new XElement("File", Path.GetFileName(file))),
new XElement("Subdirectories", /// Add "Subdirectories" sub-element
from dir in Directory.GetDirectories(root) orderby dir
select XDirectoryElement(dir, filespec))); /// Do it recursively!
}
The usage of the function:
String root = @"C:\Program Files\Microsoft Games";
root = Path.Combine(root, @"");
XElement xde = XDirectoryElement(root, "*.*");
String filename = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "SubDir.xml");
xde.Save(filename);
Process.Start(filename); /// Open explorer to view the file.
A trimmed down version of the Output:
< ?xml version="1.0" encoding="utf-8"?>
<directory Path="C:\Program Files\Microsoft Games">
<files />
<subdirectories>
<directory Path="C:\Program Files\Microsoft Games\Chess">
<files>
<file>Chess.dll</file>
<file>Chess.exe</file>
<file>ChessMCE.lnk</file>
<file>ChessMCE.png</file>
<file>desktop.ini</file>
</files>
<subdirectories>
<directory Path="C:\Program Files\Microsoft Games\Chess\en-US">
<files>
<file>Chess.exe.mui</file>
</files>
<subdirectories />
</directory>
</subdirectories>
</directory>
</subdirectories>
</directory>
It is interesting that people tend to usie tables to layout contents in a Page, or controls in ASP page. Because this may be one of the easiest way to do the layout job quick. However to restruct the layout is always a headache.
I guess in ASP.net the most typical page layout is form, it consists of labels controls, textboxes, dropdown boxes, and sometimes datagrids etc. I prefer to use DIV blocks to control layouts instead of table.
I use the stylesheet to class the div tags, an example is below:
in file:mycss.css
DIV.base-layer {
background: none ; border:
margin: 0.5em 12px 0.5em 12px; padding: 0; text-align: center; width: 80%;}
DIV.table-row {
border:1px;
margin-top: 0; margin-right: auto; margin-bottom: 0; margin-left: auto;}
DIV.left-cell41 {
border: none; float: left;border: thin solid red 1px; margin: 0; padding: 0; width: 20%;}
DIV.left-cell42 {
border: none; float: left;border: thin solid blue 1px; margin: 0; padding: 0; width: 30%;}
DIV.left-cell43 {
border: none; float: left;border: thin solid green 1px; margin: 0; padding: 0; width: 20%;
overflow:visible;}
DIV.left-cell44 {
border: none; float: left;border: thin solid yellow 1px; margin: 0; padding: 0; width: 29%;
visibility:visible;
overflow:visible;}
in mysample.html (or you can put that in aspx)
<html>
<head>
<style type=”text/css”>@import url(mycss.css);</style>
</head>
<body>
<div class=”base-layer”>
<div class=”table-row” >
<div class=”left-cell41″>cell1</div>
<div class=”left-cell42″>cell2</div>
<div class=”left-cell43″>cell3</div>
<div class=”left-cell44″>Last cell</div>
</div>
</div>
</body>
</html>
However there is still a problem with overflowing, when the text in the cell is over the size of the cell, the text draws outside the box.
I am still doing research to seek for solution