Tuesday, April 22, 2008

ASP.NET 2.0 Page & Control Event Cycle

Here is the event cycle in ASP.NET 2.0 Page.


Wednesday, April 02, 2008

The SML.NET compiler

What is ML?
ML is a programming language originally developed at the University of Edinburgh around twenty years ago. There are now two variants: Standard ML (also known as SML), which has a formal definition most recently revised in 1997, and O'Caml, developed at INRIA in Paris.
What is ML like?
ML is a high-level language that abstracts away from the machine so that the programmer doesn't have to worry about low-level details like memory management, data representation and pointer chasing. It therefore has advantages of increased productivity, clearer and more maintainable code, and fewer errors. Its features include:
Static type checking and type inference
Garbage collection
Exception handling
4. Parameterized types and parametric polymorphism
5. Recursive datatypes and pattern matching
6. Mutable references
7. First-class functions
8. Sophisticated module system with parameterized modules
What is ML good for?
ML is particularly good for language-processing, hence its widespread use amongst the research community in compilers, interpreters, program analysis tools, theorem provers and formal verifiers. But the advantages listed above make it useful for many applications.
What is SML.NET?
SML.NET is a Standard ML compiler developed at Microsoft Research Cambridge that targets the .NET Common Language Runtime (CLR). It's very easy to use: tell it where your source code lives, give it the name of a "root" structure, and it produces an assembler file which it then runs through the CLR assembler to produce an executable or DLL. The code that it produces is verifiable.


One topic I'm often asked about is obfuscation of managed code, What is that? Is it a new way to secure your assembly/code?. Let me tell you, obfuscation is the process of scrambling the symbols, code, and data of a program to prevent reverse engineering. The technique is also preventing code from the possible security threats.
Optimizing C++ compilers for native code tend to produce obfuscated code by default. In the process of optimizing, the code is often rearranged quite a bit and symbols are stripped from retail builds. In contrast, managed code compilers (C#, VB.NET, etc) generate IL, not native assembly code. This IL tends to be consistently structured and fairly easy to reverse engineer. Most optimization happens when the IL is JIT-compiled into native code, not during compilation.
This means it's pretty easy to take a compiled assembly and de-compile it into source code, using a tool such as Lutz’s Reflector and File Disassembler . While this is a non-issue for web scenarios where all the code resides on the server, it's a big issue for some client scenarios, especially ISV applications. These client applications may contain trade secrets or sensitive information in their algorithms, data structures, or data. This is where obfuscation tools come in.
Obfuscation tools mangle symbols and rearrange code blocks to foil decompiling. They also may encrypt strings containing sensitive data. It's important to understand that obfuscators (as they exist today) can't completely protect your intellectual property. Because the code is on the client machine, a really determined hacker with lots of time can study the code and data structures enough to understand what's going on. Obfuscators do provide value in raising the bar, however, defeating most decompiler tools and preventing the casual hacker from stealing your intellectual property. They can make your code as difficult to reverse engineer as optimize native code.
If you're interested in obfuscation for your code, I recommend taking a look at one of the third-party obfuscators that work on managed code. For example,
Visual Studio ships with the community edition of Dotfuscator, a popular obfuscation package. The community edition only mangles symbol names, so it's not doing everything the full-featured editions do, but it will at least give you an idea of how an obfuscator works. And there are other third-party obfuscators that work on managed code as well. Keep in mind that obfuscating your code may make debugging more difficult or impossible. Many of the third-party obfuscators have features that help with debugging, however, such as keeping a mapping file from obfuscated symbol names to original symbol names.
I'm also asked what is Microsoft's stance on obfuscation? Do MS obfuscate their own code? The answer for the .NET Framework team is no. As a development platform, it makes more sense not to obfuscate, so MS protect their intellectual property by other means. Some Microsoft products that use managed code have opted to obfuscate.

MS Surface

It's lil bit longer then expected, but Microsoft has its first customer ready to put Surface computers into public use.
Perhaps most interestingly, the first one out of the gate is not one of the company's earliest partners. Instead, it is cellular carrier AT&T that is ready to make use of the touch-screen computers.

The company will use several counter-height units inside its cellular retail stores. The company is beginning with five stores on April 17: two in New York, one in San Francisco, one in San Antonio, and one in Atlanta. Each store will have a few of the Surface machines where customers can compare the features of different phones as well as check out service plans and view coverage maps. Currently AT&T uses laptops in the store to offer such features.
"We're in business now," said Pete Thompson, the general manager of Microsoft's surface computing unit.
Microsoft had talked about such a retail use for Surface, but in its demonstrations had featured AT&T rival T-Mobile. Thompson said that T-Mobile remains a partner, but he had no update as to when that carrier will be ready to use Surface in its stores.
And, although Microsoft CEO Steve Ballmer has said he wants the consumer version of surface speed up, Thompson said he also wants to make sure that the company doesn't disappoint its earliest customers, who are all large businesses.
Microsoft has said it is aiming to have the consumer version on shelves by 2011, as much as two years earlier than its initial plan.
"We are trying to do the right thing and accelerate where we can," Thompson said, but added, "I am very much focused on making this initial commercial plan a success without getting distracted."
As for those early buyers, Thompson said that Microsoft does have other unnanounced customers for the Surface, though he declined to name names. (One name we've heard mentioned is Disney, though Thompson would not comment on that.) He did say that we would start to see activity through partners in some additional areas, such as government, health care, and education.
At last year's partner conference, Microsoft talked about having a software development kit available by April.
Thompson said that the company has started offering a development kit for some software makers and partners, but that for the time being the kit will only be available to select developers.
"We're looking at more of a managed rollout of the SDK at this point," he said, adding that he would not characterize the software kit as being broadly available. "That's where we want to get to. I don't want to say this is a closed or managed system over time."
Although AT&T will be the first place the public can go to regularly see the Surface, Microsoft has permanently installed the machines in one other place: its own campus.
"You can just walk into most lobbies," Thompson said, adding that the company has about 15 to 20 buildings with the machines so far. "We're putting in three to five a week."

Microsoft Wins Open-Format Designation

Microsoft has won an international standards designation for its open-document format, according to voting results obtained Tuesday, apparently ending a divisive yearlong battle with software rivals before a global standards-setting organization.
Microsoft’s Office Open XML, a format for interchangeable Web documents, was approved by 24 of 32 countries in a core group in a ballot by the International Organization for Standardization. Approval by the standards-setting body, a nongovernmental network of 157 countries based in Geneva, is considered almost certain to influence software spending by governments and large companies.
The tally reversed a loss by Microsoft in first-round voting before an 87-nation panel in September, a process that involved blunt lobbying by both sides toward members of national standards committees — typically made up of technicians, engineers and bureaucrats.
In the final round of voting, which ended Saturday, three-quarters of the core group members — including Britain, Japan, Germany and Switzerland — supported Microsoft’s standard, according to the results document. Of the 87 votes, 10 opposed the standard: Brazil, Canada, China, Cuba, Ecuador, India, Iran, New Zealand, South Africa and Venezuela.
Under organization rules, at least 66 percent of core group members must accept a standard for it to be approved, and no more than 25 percent of all voting nations can be opposed.
Roger Frost, a spokesman in Geneva for the standardization group, would not confirm that Microsoft’s format had been designated, saying the organization would disclose the vote Wednesday after informing its members. The International Herald Tribune obtained the results from one of the delegations contacted by the standardization group.
Microsoft’s request for rapid approval of its standard in early 2007 produced an intense lobbying campaign by
I.B.M. and Sun Microsystems, which had helped develop a rival interchangeable document format called Open Document Format.
This rival was the first interchangeable document format to receive approval by the standardization group in 2006, and its backers used that in selling the technology to governments and large companies. The format is now being considered for use by 70 nations.
Microsoft’s push for speedy approval led to objections from many members of the standards group. They felt pressure from the company, whose Office application suite is the standard on more than 90 percent of computers and archives worldwide, according to International Data in Framingham, Mass.
There were tart remarks even from countries that abstained from the vote, like the Netherlands. “This is like someone with six shopping carts of food trying to go through the express lane at a supermarket,” said Michiel Leenaars, a member of the Dutch delegation. “The end result of this will be confusion. The standard is simply too big. There are still a lot of questions out there.”