Uploaded Silverlight sample for VBScript.net compiler

by lichen 11/3/2009 11:20:00 PM

I have uploaded Silverlight sample that uses my VBScript.net compiler to http://www.codeplex.com/aspclassiccompiler. It is available under the source tag in change set 31328 or later.

I am not quite using the capabilities in Microsoft.Scripting.Silverlight yet. I want to take advantages of it when its document becomes available. For the time being, I created my own little host called VBScriptHost in the SilverlightApplication1 project.

I modified App.xaml.cs to create an instance of VBScriptHost and expose it. In MainPage.xaml.cs, I created a ScriptScope object. This is the object that I feed host variables to VBScript. I then parse this object to the Execute method of a CompiledCode object.

In the example, I passed MainPage itself with the variable name "page" to the VBScript. In order to expose the object hierachy of the MainPage, I have to expose MyButton using the x:FieldModifier="public" attribute; otherwise, it is an internal property and is hidden from the dynamic code. In future versions, I will modify my binder in an attempt to access the internal properties so that we do not have to change the access level of objects in the page.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

ASP.NET

Uploaded ASP Classic Compiler Build 0.5.4.34834. This build supports VS2010 and Silverlight.

by lichen 11/2/2009 10:36:00 PM

As usually, it can be downloaded from the source tab of http://www.codeplex.com/aspclassiccompiler.

  1. This version is built with DLR 0.92. It is compatible with VS 2010 beta 2.
  2. We have resolved all API difference with Silverlight so that Silverlight build of our VBScript.net compiler is available for the first time. We will upload some samples in the next weekly release.
  3. All the binaries are consolidated into the bin folder.

Going forward, we will stay on DLR 0.92 for a while so that we have a stable build so fix the bugs in core features.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

ASP.NET

Uploaded ASP Classic Compiler Build 0.5.3.32871 with support for Windows Azure, variable initializer and extension operator

by lichen 10/25/2009 5:43:00 PM

Today, I have uploaded change Set 30945, version 0.5.3.32871, built with DLR Changeset 32871. It could be downloaded from the source tab of http://www.dotneteer.com/aspclassiccompiler. The following are a summary of changes:

  1. Now ASP Classic Compiler would run under medium trust or Windows Azure partial-trust. Partial-trust is the default trust level of Windows Azure. Windows Azure does not support asp classic. Windows Azure supprots php but requires full-trust. Asp Classic Compiler is the only way to run asp page on Azure without changing the trust level.
  2. Azure sample uploaded. We modified only one view /home/index.asp but that is enough to prove the concept.
  3. Variable initialization in declaration statement as a VBScript extension. For example: dim s = new system.text.stringbuilder()
  4. Add the operator overloading through extension methods. C# supports extension methods, but not "extension operators". We added this support so that we can add new behavior without the need to modify our binders. Some typical asp code would now run much faster by a simple change. For example, asp pages often have codes like:
<%    
dim s    
dim i        
s = "<table>"    
for i = 1 to 12
s = s + "<tr>"
s = s + "<td>" + i + "</td>"
s = s + "<td>" + MonthName(i) + "</td>"
s = s + "</tr>"
next    
s = s + "</table>"    
response.Write(s)
%>

This code is slow because the runtime kept creating new string and discard the one one. Now we just need a simple change:
<%    
imports system    
dim s = new system.text.stringbuilder()    
dim i        
s = s + "<table>"    
for i = 1 to 12
s = s + "<tr>"
s = s + "<td>" + i + "</td>"
s = s + "<td>" + MonthName(i) + "</td>"
s = s + "</tr>"    
next    
s = s + "</table>"    
response.Write(s)
%>
Note that we added "+" operator as an extension operator for the class System.Text.StringBuilder. 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

ASP.NET

Uploaded ASP Classic Compiler Build 0.5.2.32072 with support for ASP.NET MVC

by lichen 10/19/2009 10:58:00 PM
I have uploaded changeset 30470. This update allows asp classic compiler to be used as a view engine for the ASP.NET MVC. I have ported NerdDinner sample to asp view engine as an example. For more information, visit http://aspclassiccompiler.codeplex.com/. Go to source code tab and download changeset 30470.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

.Net | ASP.NET

Lost 2 years of blog

by lichen 10/19/2009 8:24:00 PM

My SQL 2005 driver crashed. I have not run a backup for two years. So I lost 2 years of blog. Hopefully I will run backup more oftenin the future.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

My first impression with Ruby On Rail

by lichen 7/24/2007 4:56:00 PM

Whenever I search subjects relating to rapid application development, I always encounter Ruby On Rail (ROR). So I decided to take a look of ROR. The creators and supporters of ROR have done an excellent job to make starting with ROR really easy. Instant Rails has made download and installation a one stop shopping.The Rolling with Ruby on Rails is one of the best articles that I have ever read on introducing a new subject.

What makes ROR so productive? I think the following features really make ROR productive:

  1. Scafolding: ROR's code generator can generate the skeleton code from a database table. One can then work on generated code to meet the needs.
  2. Migration: A typical problem with database application development is what to do when the table schema is changed. ROR has excellent data migration tool built-in.
  3. Convention over configuration: ROR uses MVC pattern.Unlike other MVC frameworks such as Struts or String, ROR uses convention to instantiat objects and assemble them together. We neither to work with configuration files, nor have to assemble the objects.
  4. ActiveRecord: ROR's model often is simply a subclass of ActiveRecord without additional properties. It is not necessary to regenerate the model when the table schema is changed.
  5. Ajax support: ROR really shines at utility functions that can generate Javascript code to create an AJAX application.
  6. Easy to create unit tests to test the model and controller.

So am I going to develop my next big application wth ROR? I am still sketical for the following reasons:

  1. Scalability concern: I don't think I can do everything in Ruby. I think is much easier to find libraries in Java or .NET. So if I want to create an application with a single language, Java or .Net is a much better bet.
  2. Errors are captured at runtime instead of compile time.
  3. Debugging support.
  4. Model has access to database. I really hope model and persistency are implemented in different layers.

ASP.NET is current still my favorite web application development tool because it is the best tool for build sophiscated view for its support for rich controls. Microsoft has created excellent RAD tools such as strongly-typed dataset and it is nearly as productive as ROR. The main draw back with RAD deeloped with ASP.NET/Strongly-typed dataset is that the view and controller are combined in the code-behind so the controller is not testable. So we really need a scafolding tool to make it easier to generate the MVC skeleton. I am glad to see that projects like SubSonic is emerging.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

.Net | ASP.NET

Compare JSF to ASP.NET 2.0.

by lichen 7/18/2007 5:26:00 PM

JSF is the latest offering for the Java web application development. JSF is an MVC framework, similar to Struts. JSF is an enhancement to Struts:

  1. The action is now mapped to a method of a bean instead of a servlet. Components can now have events. This is much more like code-behind in ASP.NET. This reduces the number of files one has to work with.
  2. More custom tags and richer controls, such as Data Tables.

Here is how JSF compares with ASP.NET 2.0:

  1. ASP.NET 2.0 is the mainstream development framework in .net world. JSF is still considered as unproven. Only a quarter or less Java web developer jobs requires JSF.
  2. JSF is a specification instead of implementation. Depending on the implementation used, one may get more or less rich components. So evaluating implementation itself is a major task.

In conclusion, projects using ASP.NET 2.0 should expect stable and well behaved frameworks. Developers should find it much easier to develop web applications with richer functionality and to work with AJAX.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

.Net | ASP.NET | Java

Compare Struts to ASP.NET

by lichen 7/18/2007 4:40:00 PM

Struts is an MVC framework for Java web application development. Struts 1.0 was released in July 2001, roughly a year before ASP.NET 1.0. Currently, 70-80% of Java Web application developer's job requires Struts so it is fair to say that Struts is the current mainstream framework for Java web application.

Struts contains an MVC framework and a set of JSP custom tags. For a simplest application, developers need to provide:

  1. An html form in which user can enter data.
  2. A Struts bean that serves as model. The inputs in the form is mapped to the properties of the bean.
  3. An action servlet which serves as controller.
  4. One or more JSP pages that serves as view for the results.

The components are wired together with a configuration file struts-config.xml. Struts framework actually provides a servlet as front-controller in which all actions go to. The front-controller is responsible for instantiate the Struts bean, dispatch the action and route to the approprate view based on the return of the action.

In addition, Struts also supplies custom JSP tags that provides the following functionalities:

  1. Preserve the state of input if the view is same as the form.
  2. Validation.
  3. Layout with Tiles.

Struts provides serveral important functionalities in the framework and significantly reduced the repeatitive tasks in Java web development. ASP.NET does not require a regid MVC pattern like Struts (which could be both pro and con). Besides that, ASP.NET does almost every other things better:

  1. Struts still requires coding the same information twice, once in form and the second time in bean. In ASP.NET code-behind, controls are automatically created from form. In additional, ASP.NET supports rich controls, i.e., controls not available in HTML.
  2. The modle, view and controller of Struts is scattered in many files. The only place to find them is in the struts-config.xml file. It is inconvenient to work with large number of files. Although the seperation of functionalities into many classes remotes reuse, in reality, the classes are rarely reused.
  3. ASP.NET's mechanism to preserve form state is simpler to use.
  4. ASP.NET's validation architecture is better and it is transparent to render client-side Javascript depending on the type of clients.
  5. ASP.NET's master page and skin is superior to Tiles.

In conclusion, also Struts is a significant improvement over normal JSP/Serlet programming. Struts is still far behind ASP.NET in functionality and productivity. There are tools like AppFuse that would make Struts development easier. It is still nowhere near the experience with Visual Studio 2005 and ASP.NET 2.0.

Perhaps it is time to compare ASP.NET with JSF which is the latest offering in the Java world.

Currently rated 3.0 by 5 people

  • Currently 3/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

.Net | ASP.NET | Java

Compare ASP, JSP and ASP.NET

by lichen 7/16/2007 6:44:00 PM

ASP (Active Server Pages) was a revolution to web development when it was released by Microsoft in 1997. Since then, Sun has answered with a better tool in JSP. Microsoft answered to the Java challenge with ASP.NET in 2002. How do they compare to each other? I have done a survey and will anwer the question in a series of posts.

ASP allows server scripts and expression to be embedded in HTML. When it is desirable to seperate the code from the content, one would write the code in a COM object (usually written in VB6) and call the COM object from ASP page.

JSP (JavaServer Pages) has the following advantages over ASP:

  • ASP is interpreted while JSP is compiled - better performance.
  • In the Java world, one can develop Servlet and Servelet filter. In ASP world, one has to use C++ to write ISAPI Extension and ISAPI filter. ISAPI Extension and filter does not share session state with ASP. While the Servlet functinality is not essential, lack of filter is a limitation for ASP.
  • In Java world, one often seperate presentation and code with JSP/Java Bean, like the ASP/COM object combination. One limitation for the Java Bean is that it does not have context while the COM object can access the context. To access the context, one has to write custom JSP Tag. The capability of JSP does make custom components look like HTML.

ASP.Net was Microsoft's answer to JSP. ASP.NET not only has all the capability of JSP, it also represent a major productivity boost:

  • ASP.NET's HttpHandler and httpModule is equivalent to Servlet and servlet filter.
  • ASP.NET support custom controls, like the custom JSP tags.
  • ASP.NET supports a code behind model. This is a productivity boost compare to JSP/Java Bean. With JSP/Java Bean, one has to code the inputs once in the form and then again in the bean. One only create the controls once in ASP.NET pages and they are automatically accesible in code-behind.
  • ASP.NET support rich components (none-HTML, such as Grid and TreeView. These are usually DHTML controls manipulated by JavaScript with states saved in a hidden input control. ASP.NET has the viewstate framework for store and retrieve the property of controls. These rich controls can be accessed in the code-behind page transparently like any other control. JSP/Java bean are limisted simple HTML inputs. Therefore, it is much easier to develop feature rich page with ASP.NET than the JSP/Java bean approach.

In conclusion,  JSP is about half way between ASP and ASP.NET. It is perhaps not fair to compare ASP.NET and JSP since they are not really in the same generation. A better comparison to ASP.NET might be JSP/Struts or JSF.

Currently rated 3.2 by 13 people

  • Currently 3.153846/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

.Net | ASP.NET | Java

Working with Dates in Java

by lichen 7/11/2007 3:52:00 PM

For .net programmers, we used to work in a single System.DateTime structure. In Java, unfortunately, we often need to work with several classes:

  • java.util.Date

java.util.Date internally store the date/time as number of milliseconds after Jan. 1, 1970 using long. There are 86,400,000 millilseconds a day. The default constructor represents the date/time that the object is constructed. The main advantage of using Date class is that it is possible to parse a String to Date or format a Date to String using DateFormat class.

  • java.text.DateFormat, java.text.SimpleDateFormat

These two classes can convert a String to/from to Date. One can use one of the overloaded DateFormat.getDateInstance() methods to get a localized format. For custom format, it is better to create an instance SimpleDateFormat using the format string in the constructor.

  • java.util.GregorianCalendar

We need this class in order to work with parts of a date or construct a date from parts. It also allow us to add a range to a date. We can convert between Date and GregorianCalendar by using the setTime() and getTime() method of teh GregorianCalendar class.

There is a nice article on Javaworld that contains many useful examples. 

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Java

Powered by BlogEngine.NET 1.2.0.0
Theme by Mads Kristensen

About the author

Name of author Author name
Something about me and what I do.

E-mail me Send mail

Calendar

<<  April 2014  >>
MoTuWeThFrSaSu
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011

View posts in large calendar

Pages

    Recent comments

    Authors

    Tags

      Disclaimer

      The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

      © Copyright 2014

      Sign in