Microsoft has recently posted on their website a
plethora of webcasts dealing with many current topics. Of particular interest are the ones posted on Virtualization. The ones that deal specifically with topic follows:
How to Virtualize Infrastructure Workloads
http://www.microsoft.com/emea/itsshowtime/sessionh.aspx?videoid=348Using Application Virtualization to Decrease Your Application Management TCO
http://www.microsoft.com/emea/itsshowtime/sessionh.aspx?videoid=361An Overview of Microsoft's Vision for Virtualization
http://www.microsoft.com/emea/itsshowtime/sessionh.aspx?videoid=337Transitioning to Windows Server Virtualization
http://www.microsoft.com/emea/itsshowtime/sessionh.aspx?videoid=343I have yet to watch them, but if I find something particularly interesting, I will post it on my blog ASAP.
Just want to say happy new year and succes to all the people at ArtinSoft and especially to our blogs readers, this year we have a lot of new things coming, just no migration stuff, but new tools and products that hopefully everybody will love, especially people in the web development world. At this point can't tell more about it...
In the other hand I'll be sharing more knowledge and tips about Asp.net and migrations from ASP to ASP.NET and of course .NET related information.
Stay Tune !
A quick post to wish you all a happy new year!
This is going to be an interesting year, with the release of Windows Vista, possibly Longhorn Server, and all the virtualization products on the pipeline from both Microsoft and the competition. I also think that this year 64-bit usage will increase significantly on the home and workstation front, given the release of Vista 64-bit and the fact that drivers are starting to show up.
So, best wishes to you all, and hope you have a great 2007!!
If you are migrating a Powerbuilder Application to .NET the
more recommend language you can use is VB.NET. This because this language has a
lot of common elements with PowerScript. Lets see some simple comparisons.
Variable definition
A variable is defined writing the Data Type just before the name.
For example:
Integer amount
String name
In VB.NET this will
be
Dim amount as Integer
Dim name as String
Constants
constant integer MAX = 100
In VB.NET this will
be
Const MAX As Integer = 100
Control Flow: If Statement
If monto_cuota=13 Then
nombre= 'Ramiro'
ElseIf monto_cuota=15 Then
nombre= 'Roberto'
Else
nombre= 'Francisco'
End If
This code is almost exactly the same in VB.NET
If
monto_cuota = 13 Then
nombre = "Ramiro"
ElseIf
monto_cuota = 15 Then
nombre = "Roberto"
Else
nombre = "Francisco"
End If
Control Flow: Choose Statement
Choose case monto_cuota
Case Is< 13: nombre='Ramiro'
Case 16 To 48:nombre= 'Roberto'
Else
nombre='Francisco'
End Choose
This code is slightly different:
Dim
monto_cuota As Integer
Dim
nombre As String
Select Case monto_cuota
Case Is < 13
nombre = "Ramiro"
Case
16 To 48
nombre = "Roberto"
Case
Else
nombre = "Francisco"
End Select
Control Flow: For statement
For n = 5 to 25 step 5
a = a+10
Next
In VB.NET
Dim n, a As
Integer
For n = 5
To 25 Step 5
a = a + 10
Next
Control Flow: Do Until, Do While
integer
A = 1, B = 1
//Make
a beep until variable is greater than 15 variable
DO
UNTIL A > 15
Beep(A)
A = (A + 1) * B
LOOP
integer
A = 1, B = 1
//Makes
a beep while variable is less that 15
DO
WHILE A <= 15
Beep(A)
A = (A + 1) * B
LOOP
In VB.NET
Dim A As Integer = 1, B As Integer = 1
'Make a beep
until variable is greater than 15 variable
Do Until a > 15
Beep(a)
a = (a + 1) * B
Loop
'Makes a beep
while variable is less that 15
Do While A <= 15
Beep(a)
a = (a + 1) * B
Loop
This is the migration of a snippet of ASP classic to ASP.Net
Checking that a File Exists ASP Classic
<%
Dim strExists
Dim strNotExists
Dim objFileSystemObjectVar
``
strExists = "exists.txt"
strNotExists = "error.txt"
Set objFileSystemObjectVar = Server.CreateObject("Scripting.FileSystemObject")
' The FileExists method expects a fully qualified path and
' use Server.MapPath
%>
<p>
"<%= strExists %>" exists:
<b><%=objFileSystemObjectVar.FileExists(Server.MapPath(strExists)) %></b>
</p>
<p>
"<%= strNotExists %>" exists:
<b><%= objFileSystemObjectVar.FileExists(Server.MapPath(strNotExists)) %></b>
</p>
Checking that a file exists ASP.NET
<%@ Page Language="VB" %>
<%@ Import Namespace="System.IO" %>
<script language="VB" runat="server">
Dim strExists As String = "exists.txt"
Dim strNotExists As String = "error.txt"
</script>
<p>
"<%= strExists %>" exists:
<b><%=File.Exists(Server.MapPath(strExists))%></b>
</p>
<p>
"<%= strNotExists %>" exists:
<b><%= File.Exists(Server.MapPath(strNotExists))%></b>
</p>
These project extends the VB and C# languages with query,
set and transforms operations. It adds a native syntax for those operations.
The idea of the LINQ project is to make data manipulation
part of the language constructs. Lets see these VB examples for LINQ:
The following examples
associates the Customer class to the Customer table. Just adding the Column Tag
before a field, maps it to a table column.
<Table(Name:="Customers")>
_
Public Class Customer
<Column(Id:=True)>
_
Public
CustomerID As String
…
<Column()> _
Public City As String
…
End Class
To
access the database you do something like:
'
DataContext takes a connection string
Dim db As
DataContext = _
New
DataContext("c:\...\northwnd.mdf")
'Get a typed table to
run queries
Dim Customers As
Table(Of Customer) = db.GetTable(Of Customer)()
'Query for customers from London
Dim q = _
From
c In Customers _
Where
c.City = "London" _
Select c
For Each cust In q
Console.WriteLine("id=" & Customer.CustomerID
& _
",
City=" & Customer.City)
Next
You just create a
DataContext and create typed object that will relate dot the relational tables.
I think this is awesome!!
It is even nicer if you
create a strongly typed DataContext
Partial Public Class Northwind
Inherits DataContext
Public
Customers As Table(Of
Customer)
Public
Orders as Table(Of
Order)
Public Sub New(connection As String)
MyBase.New(connection)
Your
code gets cleaner like the following:
Dim db As New
Northwind("c:\...\northwnd.mdf")
Dim q = _
From c In db.Customers _
Where
c.City = "London" _
Select
c
For Each cust In q
Console.WriteLine("id=" & Customer.CustomerID
& _
",
City=" & Customer.City)
Next
These project will start a
lot of exciting posibilities. I recommed you have a look at’: http://msdn.microsoft.com/data/ref/linq/
This is an old topic but I always like to give some thoughts
on this idea. I really think that in the
future everything will run from the internet. Internet is becoming another
basic need just as electricity, water, gas and telephone. The appearance of new
technologies makes it easy to have Internet even in remote places like beaches
and mountains.
Rich Clients have been defended because it was said that not
a lot of interactivity could be produced by thin clients. It has also been said
that powerful interfaces (with complex gadgets, etc) could be produced in a web
interface. I think that Flash, and AJAX
have shown that despite all believes it is possible. There are still more technologies
that will come. But the easier deployment and the fact that you can use your
web applications everywhere even from a cell phone in a taxi cub.
I also love phases like “If you ask an engineer the time,
he'll tell you how to build a clock.”. Web interfaces are simple and easy to
learn look at blogs like Jon Galloway http://weblogs.asp.net/jgalloway/archive/2003/09/27/29446.aspx
and Microsoft's Inductive User Interface (IUI) initiative it seams like more
people is starting to think in this way.
This post is the second part on the comparison between Virtual Server 2005 R2 SP1 and Windows Virtualization:
- Cluster Support: Both Virtual Server and Windows Virtualization have support for Windows Server clustering
- Scripting support: Both Virtual Server and Windows Virtualization have support for scripting, but Virtual Server uses a COM API and Windows Virtualization a WMI-based API
- Supported VMs: Virtual Server, with SP1, support up to 128 VMs on a single server. Windows virtualization supports as many as the hardware allows.
- Management Interface: Virtual Server has web-based administration tools. Windows Virtualization, on the other hand, will be managed through a MMC snap-in, to put it in line with all other Microsoft’s management solutions.
You can check out the first part here.
Migrating ASP to ASP.NET
Surpinsingly for me. I found that some friends were working on migrating an ASP classic site to ASP.NET. I was impressed to see that there are still sites in ASP classic at ALL!!!!
ASP.NET 2.0 provides so much improvements, you cannot even debug in ASP. ASP.NET 2.0 has better performance and easier to deploy. There is even Intellisense! These days is hard for me not assuming that all IDEs provide the developer aids like that.
Also migrating simple ASP classic code to ASP.NET is not that hard.
Let’s see a simple ASP classic page like:
<%
Dim objConn
Dim objRS
Set objConn = Server.CreateObject(“ADODB.Connection”)
Set objRS = Server.CreateObject(“ADODB.Recordset”)
objConn.ConnectionString = “DRIVER=(SQL Server);server=…”
objConn.Open()
objRS.Open “SELECT * from Items”, objConn
Do While Not objRS.EOF
Response.Write CStr(objRS(“ID”)) + “ – “ + objRS(“Description”) + “<br>”
objRS.MoveNext
Loop
objConn.Close
%>
Migrates easily to:
<%@ Page aspcompat=true Language=”VB” AutoEventWireUp=”false” CodeFile=”Default.aspx.vb” >
<%
Dim objConn
Dim objRS
Set objConn = Server.CreateObject(“ADODB.Connection”)
Set objRS = Server.CreateObject(“ADODB.Recordset”)
objConn.ConnectionString = “DRIVER=(SQL Server);server=…”
objConn.Open()
objRS.Open (“SELECT * from Items”, objConn)
Do While Not objRS.EOF
Response.Write (CStr(objRS(“ID”).Value) + “ – “ + objRS(“Description”).Value + “<br>”)
objRS.MoveNext
Loop
objConn.Close
%>
These are the task to do:
- Remove SET
- Any method in ASP.NET requires its parameters to go inside parenthesis
- ASP.NET does not have default properties so elements as objRS(“ID”) must be changed to objRS(“ID”).Value and objRS(“Description”) to objRS(“Description”).Value
- you must add the aspcompat=true property to the page because of the apartment threading issues
- You should change statements like Dim objRS to Dim objRS as Object it is not an error but it will help you make your code more clear.
You can also download the Migration Assitant from ASP to ASP.NET from:
http://www.asp.net/DownloadWizard.aspx?WizardTarget=AspToAspNetMigrationAssistant
Several times I've been asked something along the lines of “why should I install virtual machine additions on a virtual machine? The virtual machine works fine without them, doesn't it?". I thought it is worth it to quickly mention the benefits of virtual machine additions in this post.
The Virtual Machine Additions included with Virtual Server perform several tasks. They allow better communication between Virtual Server and the guest OS, on things such as time synchronization or the ability to shut down the machine on command. But the most important task performed by the Additions is that they patch the operating system so it can work with what is called Ring Compression.
Operating systems normally run on Ring 0 on x86 CPUs. Ring Compression allows the virtual machine OS to run on Ring 1 on the hardware, allowing the host operating system and the virtual machine monitor to run on Ring 0. By using ring compression, the VMM is able to trap instrucions from the virtual machine that otherwise it is unable to catch – such as memory requests. The alternative, at least in Virtual PC (I’m not 100% possitive Virtual Server follows the same approach) is to run the operating system instructions not on the hardware, but on a binary translator. This is the one of the reasons why after installing the additions you see such an increase in the virtual machine’s performance.
Of course, ring compression is not necessary if you have a CPU with AMD-V or Intel VT technology. In those CPUs, the virtual machine monitor runs on a Ring -1, so guest operating system will run on Ring 0 without any complications.
You can read more about this topic here or here.
Windows Virtualization is the next generation of virtualization solutions offered by Microsoft. Here is a quick list on how it compares to Virtual Server 2005 R2 SP1:
- Supported Hardware: Virtual Server 2005 R2 SP1 runs on both x86 and x64 architectures. Windows Virtualization will be x64 ONLY.
- Virtual Machine Support: Virtual Server supports 32–bit virtual machines. Windows Virtualization supports both 32 and 64–bit Virtual Machines
- Virtual Machine Memory Support: Virtual server can allocate up to 3.6GB per VM. Windows Virtualization will be able to assign up to 32GB per VM
- Hot add: Virtual Server does not support adding hardware to a virtual machine while it is running. Windows Virtualization supports hot add of memory, processors, storage, and networking devices.
A couple of weeks ago, during the Virtualization for Developers event in Redmond, we had a short presentation on Viridian by Arno Mihm, Program Manager for Windows Virtualization. He explained the features that will be available on that platform, the differences with the current Virtual Server architecture, and also talked a little bit about the hypervisor.
Windows Virtualization is coming up with some pretty impressive features. The Windows Hypervisor is a tiny piece of code (right now it is around 160KB… it has grown, though, since it was 140KB when we first heard about it on the Longhorn Developer Review back in April), that manages the different partitions running on the physical computer. Microsoft has taken an intelligent approach at this level. The hypervisor only manages context switches between the VMs and protects access to the different VM’s resources. All device drivers and any other logic are managed by the parent OS. This way the hypervisor code can remain really small and extremely fast, and provide the type of reliability that is necessary for this type of environment.
Another nice feature of Windows Virtualization is the device driver architecture. “Enlightened” operating systems will route all device requests through Virtualization Service Clients, that through a very efficient communication mechanism (called VMBus) will communicate directly with Virtualization Service Providers on the parent partition of the server, and then call the hardware directly. This is more efficient than current implementations, in which calls to virtual devices are trapped and handled through the virtual machine worker processes, requiring several context switches in the process.
The best part of the presentation, however, was to finally get to see Windows Virtualization in action. He did a short demo on his laptop, that had a preliminary build of Longhorn server with the Hypervisor enabled. One of the virtual machines was also running Longhorn server, and he showed us how you can dynamically add memory to a virtual machine, WHILE THE VM IS RUNNING, and the client operating system (Longhorn server in this case) will pick it up immediately. This is very useful for those times when you need to give an extra boost to a virtual machine so it can complete a certain task. And my understanding is that all new server products from Microsoft (starting with Exchange 2007) will be able to dynamically pick up these changes as well.
Ok enough theory. To start using the internationalization
stuff lets start with a simple Form.
Open the Visual
Studio IDE. And Start a Windows Forms project. And then create a simple Form.
Add some labels and buttons and set their captions. Once you do that and finish
the initial creation of the form, go to the properties pane and change the
Localizable property to true and
assign the desired value in the Language property. The Visual Studio designer
will save the changes in additional resource files whose names will look like
<FormName>.<culture>.resx
Once you finish the texts, sizes, positions for the first
culture and save it. The IDE creates the resource file for that culture. If you
want to create a resource file for another language just change the Form
property and assign the text for this new language.
You can not only assign personalized translations for each
region but also the position and size of components. This is useful because in
some languages the buttons might need to be bigger because the labels could be
bigger.
All this work is supported by the .NET resource managers. System.Resources.ResourceManager class.
I recommend you also using String Resource Tools like the
ones at: http://www.codeplex.com/ResourceRefactoring
These tools makes it even easier the task of moving all your
strings to resource files:
Recently I was asked by some fellows some help to make a new
version of their VB6 application in Spanish, but at the end we end up migrating
the application to VB.Net and taking advantage of the .NET internationalization
features.
VB6 did not provided and out-of-box support for multiple
cultures, but the .NET framework provides the developer with utilities to
create applications that allow users in multiple regions use their applications
according to their “Culture”.
The .Net Framework is able to handle different cultures.
These “cultures” are used to localize certain aspects of the application for
particular geographic zones.
When an application is not created with any cultural
considerations it is said to use a Neutral
Culture. It implies that independent of the machine configuration it will
behave and display components in the same way.
The Culture is assigned automactically using the machine
settings or it can be altered programmatically. You can use the property
System.Globalization.CultureInfo.CurrentUICulture for that purpose.
Cultures have two elements: language and region. For example
for Argentina where Spanish
is spoken la culture will be es-AR (es is for Spanish: ESpañol and AR for Argentina)
If no information is found at all for an language then the
neutral culture is used.
The information for user display is handler in assemblies
usually called “satellite assemblies” which are loaded depending on the culture
of the environment where the application is executed.
Over at the Virtually vista blog there’s a post talking about how to run the RTM of Vista in a virtual machine. Regarding the supported products and additions, the post states:
If you're using Virtual PC, you should be using the VPC 2007 Beta - the additions that ship with that product work just fine in Vista.
If you're using Virtual Server, you should use the VS 2005 R2 SP1 Beta - those additions work with Vista as well.
The only downside we've found with running Vista on a VM is that the precompactor doesn't work - and Vista uses a lot of disk space during the installation, so we haven't been able to compact a dynamic VHD with Vista.You can get both VPC 2007 and Virtual Server 2005 R2 SP1 Beta form http://connect.microsoft.com.
Yep, it’s that time of the year again. I just wanted to write a quick post to wish you all a Merry Christmas and a Happy New Year!!
I’ll probably make a couple of post in the next few days, since I won’t be taking time off for the holidays. But for those of you that do, I hope you have a happy holiday!!
Cheers.
This is a very controversial topic. Recently I have seen several blogs that state that the VB6 Programmers are moving to other platforms like PHP or Java instead of VB.NET
For example see:
Number of VB
Developerts Declining in US
By
Steve Graegert
“They’re also leaving VB.NET; which is down by 26%. This means Java
now holds the market penetration lead at 45% (with developers using Java during
some portion of their time), followed by C/C++ at 40%, and C# at 32%.”
I also remember an Article I read in 2005 in JDJ (Java Developers Journal) that expressed that C# was a language created similar to C++ to aid the C++ programmers move to the .NET Framework, argument that I do not share.
I have no evidence but I do not feel that it is that way. I'm am a Java Developer too. And both platforms have their merits. C# is a nice language, very similar to Java and C++ no doubt but it deserves its own place. Visual Studio has still a path to follow. But VS2005 provides some useful refactorings and the incredibly awaited feature that allows you to edit the code that you're running :)
Maybe the 1.0 and 1.1 frameworks were not enterprise ready, but 2.0 and 3.0 frameworks are an excellent improvent.
Java as well had to go thru a lot of JDK releases. They have just released the 1.6 and what about the J2EE releases, the Java Enterprise Beans fiasco. You can confirm that by looking at the rise of POJO (Plain Old Java Object) frameworks like spring.
In general everything requires time to grow. I think that Java has been more time in the market and it has finally provided mechanisms that allow the development of enterprise services "easier" and it is giving it momentum.
.NET components industry is common, there are lots of components and somethings are easier. So I'll wait some time, maybe a couple of year to really find out which is the hotter platform.
Last week we succesfully delivered the first in the series of virtualization events aimed at developers creating software to work with Virtual Server 2005. Even though we didn’t get as much of a turnout as we were expecting, the event was a complete success. Also, the feedback we got for both the content and the presentation was excellent!
I encourage you to register for one of these events. The next one is in Zaragoza on Jan 23–25. The next US event will be again in Redmond, on Feb 6–8. Don’t miss them!
Not everything that revolves around Virtualization is good - point in case: the software known as
Microsoft.Windows.Vista.Local.Activation.Server-MelindaGates.
This VMW virtual image fools Microsoft's latest operating system (Vista) into believing that it is contacting a Key Management Service server (KMS). When Vista tries to access the KMS, it connects to the Virtual Machine and within seconds the operating system is activated and fully functional even though it is a pirated copy.
As of now, Microsoft has yet to release an update that will fix this hack and assist Vista into knowing that it is not contacting a real KMS. It really makes you wonder how soon the hackers will release and update to their VMWare image after Microsoft releases their update.
The
complete article is on on the vmblog's web site.
In this introductory post, we motivate some basic notions and set a context with respect to the problem of performing computer aided refactoring; we want to pay special attention to refactoring of Web pages as a target and look for implementation paths as a systematic process, subject that we present in a white paper available for the interested reader.
Refactoring is understood as any form of software transformation which is performed with the purpose of improving quality attributes of some piece of software without changing its originally intended behavior; it is used typically for accomplishing more readability and better understanding. A refactoring step should be relatively small and specific, so that is easily testable, for instance trough unit-testing; however such steps can be composed for achieving a broader transformation goal. Software refactoring can be effectively used to interleave "actual" development steps with small and disciplined (e.g. preventive and perfective) steps of maintenance; by this way, refactoring makes feasible to reach higher levels of software quality at the long term without necessarily disturbing programming productivity at the short term.
Refactoring tools are nowadays hosted in many IDEs for popular programming languages for tasks like consistently renaming of an identifier, for performing method extraction and method pull-up/down operations, among some others. The IDE usually gives facilities to apply the transformation in a mechanical and safe way; the user is the driver the IDE is the refactoring vehicle in such a case. In some cases, the refactoring operations are predetermined, so the programmer has no easy way to create and compose his/her owns transformations, for instance defining own made set of rules for naming conventions or criteria for diagnosing aspects of design quality, those eventually deserving refactoring efforts.
Beyond the nice possibility of programming refactoring, let us suppose we also are interested in a more automated and flexible form of refactoring, namely, one that assists by the detection of refactoring opportunities and anticipates the benefits of applying associated transformations.
Although such a facility would be certainly useful, we can easily realize that there can be a lot of opportunities of different nature for identifying a valuable refactoring task. So, if we think of such a process as a search problem, we rapidly need to accept that the search space can be big and heterogeneous with respect to the nature and goals a programmer may attempt to accomplish through the one or the other kind of refactoring path. Those goals may also depend on the kind of software element we are interested in.
With this general context in mind, we consider one specific case, namely the refactoring of web pages; for such purpose we have developed a white paper, where we elaborate on standard reasoning strategies envisioning the requirements for an automated tool which aids at the task of systematically refactoring web pages. Our presentation -that we name rational refactoring- is more intuitive and practical than formal, we focus on the central value of employing a semantically based approach for driving the process and expose justifications in terms of the some potential advantages we may obtain when we are considering computer aided refactoring of web pages, specifically. We use some ASP.NET facilities for illustrations purposes. The white paper is available here.