I felt so stupid today. Because when for a couple of months,
every now and then, when someone asked me for a copy of the source code
I just made a copy of my src directory and then searched for the .svn* folder
and then I erased them,
until by mistake i found the
EXPORT function.
I use SmartSVN and I was creating a new project
and then the light came to me :S
Well if it happens to you just remember there is a
svn export
command. This will get the code from the repository without all the nasty files.
Microsoft recently started to distribute a new version of the Visual Basic 2005 Power Packs.
Link to Download details: Microsoft Visual Basic 2005 Power Packs 2.0
Notably, the routines that are included help with the automatic Upgrade/Migration of VB6 to .NET. From the MSDN web site:
" Overview
The new Line and Shape controls included in this version of the Visual Basic 2005 Power Packs are a set of three graphical controls that enable you to draw lines, ovals, and rectangles on forms and containers at design time making it much easier to enhance the look of your user interface. These new shape controls also provide events such as click and double-click allowing developers to respond and interact with end users.
The Printer Compatibility Library allows projects that used the Printer and Printers Collection in Visual Basic 6.0 to be upgraded without having to re-write your printing logic. By simply adding a reference to the library, declaring a Printer and making a few minor syntax changes, your project will be able to print using the Printers collection and Printer object as it did in Visual Basic 6.0. This version adds a new Write method to the Printer object which allows you to print text without a forced carriage return similar to the semicolon syntax used by Print method in Visual Basic 6.0.
The PrintForm component is designed to bring back the ability to easily print a Windows Form. With this the new PrintForm component you can once again layout the Windows Form exactly as you want it and allow your users to print the form as a quick report."
I'd like to relate this post with the one I did a few days ago related to performance (http://blogs.artinsoft.net/fzoufaly/archive/2007/0... ). In the previous post I was arguing about the use of the VB6 Compat library from .NET applications. Basically, I was arguing that the VB Compatibility library is written and distributed by Microsoft and therefore users should not be afraid to use it in their programs. TThe same goes with the power pack Microsoft is now releasing. The power pack contains a number of functions that are not directly addressed by the basic .NET framework but that are widely used and requested by VB programmers. So what is the right solution? Well, program them in .NET!!! I mean, is there another way to provide functionality that is not by programming it? Again, don't be afraid of using these routines more than you would be of any control you use in your app. And also, do not worry about the performance hit!!
In the VB world previous to .NET a concept you probably had to deal with was
TWIPS.
What were Twips? Well if you do not remember those happy VB6 times, let me
refresh your memory:
Twips are screen-independent units to ensure that the proportion of screen
elements are the same on all display systems.
A twip is defined as being 1/1440 of an inch.
A Pixel is a screen-dependent unit, standing for 'picture element'.
A pixel is a dot that represents the smallest graphical measurement on a screen.
In .NET everything is pixels. So if you migrated something from VB6 using the
Upgrade Wizard you might found several expressions like:
VB6.TwipsToPixelsX(ctrl.Left)
or VB6.PixelsToTwipsY(ctrl.Height)
There is an X and a Y version of this function, because the conversion factor
is not the same for both axis.
Sadly you can even found some expressions like:
VB6.TwipsToPixelsX(VB6.PixelsToTwipsX(ctrl.Left))
In a strict sense there could be minor differences because of the conversion
factors. But in it seams that things like that can be removed because all
controls Bound properties like Left, Top, Bottom, Right are in pixels. So why
will you convert your pixels units to Twips units to then convert them back to
Pixels if they where already in Pixels????
Also you can find something like:
VB6.TwipsToPixelsX(ctrl.Left + ctrl.Width + 30)
which should be something
like:
ctrl.Left + ctrl.Width + VB6.TwipsToPixelsX(30)
If you have an application migrated with the Upgrade Wizard you can use some
regular expressions to improve those expressions. If the conversion is something
like:
VB6.TwipsToPixelsY(VB6.PixelsToTwipsX(ctrl.Left))
then be careful because
conversion factor might produce a different value, due to the change of axis.
jeje Or you can uset the VBCompanion, the extensible version of the Upgrade
Wizard!!!
Microsoft is committed to support the vb6 runtime environment on Vista. However they will not continue to support the IDE: the development environment is not officially supported by Microsoft on Vista.
More detailed information can be found at:
VBRUN and ftponline
Additionally, do not forget to also verify the support of your third party controls. Are they being supported by their manufacturer?
Many companies have already moved or are in the process to upgrade their Visual Basic Applications to .NET. However, many others are procrastinating their decision. Which type are you? Dont'you think it is time to move yet? What are you waiting for?
A common question when upgrading VB6 applications to .NET is regarding the performance of the application.
The short answer is that the migrated app typically performs as good as the original application. Let's dive into a couple of common issues that customers typically worry about:
1) the use of the VB6 compatibility classes in .NET: First of all, I believe this is a very bad namespace name! Everytime you hear compatibility library you think about performance. However, in this case, all the classes in the compatibility library are implemented in .NET. They are included just to simplify the maintainability of the code. The functionality that they provide is not directly provided by .NET, therefore, the correct way of implementing it is to just program it in .NET which is exactly what the compat classes do. NO performance penalty here! In addition, these classes are part of the .NET framework, thay are supported by Microsoft and they will continue to be supported for the forseable future! If there is a function in there that you want to use it, just do it!
2) COM Interop: The VB Upgrade Wizard generates primary assemblies for the COM component that are referenced from VB6. This is of course the fastest way to communicate with them from .NET. Now, typically, COM components are black boxes that presumably execute non trivial functionality. This means that typically the time spent by the execution of the COM component is orders of magnitude larger than the time spent in the calling of the component from .NET. Therefore the performance impact is negligible. This is not true of course if the COM interface is very chatty as you will have to go through the primary assembly overhead many times.
The reason to eliminate COM interop is normally not one of performance. You want to eliminate COM components for maintainability reasons, for deployment reasons or to take advantage of newer versions of the components. If you just want to maintain the same functionality COM interop does not present a performance situation.
In summary and reinforcing the introductory statement a converted application from Visual Basic 6 to .NET typically performs in the same way as the original one.
Have you had a different experience? Let me know!
.NET has a more strict typing than VB6
So you must check in some circumstances if your object implements an interface
or not.
So I had used the as and is operators in C# but I did not know
how to do that.
I did I little research and I discovered some things about casting operators for
VB.NET
Operator |
Example |
Observations |
CType |
Dim testNumber
As Long
= 1000
' The following line of code sets testNewType
to 1000.0.
Dim testNewType
As Single
= CType(testNumber, Single)
|
Throws InvalidCastException or OverflowException It could
be less eficient due to VB.Net helper routines.
This is a Narrowing and Widening operator.
It can be overloaded
Public
Structure digit
Private dig
As Byte
Public
Sub New(ByVal
b As Byte)
If
(b OrElse b > 9)
Then Throw
New _
System.ArgumentException("Argument outside
range for Byte")
Me.dig
= b
End
Sub
Public
Shared Widening Operator CType(ByVal
d As digit)
As Byte
Return
d.dig
End Operator
Public
Shared Narrowing Operator CType(ByVal
b As Byte)
As digit
Return
New digit(b)
End Operator
End Structure
|
DirectCast |
Dim f
As New
System.Windows.Forms.Form
Dim c As
System.Windows.Forms.Control
' The following conversion succeeds.
c = DirectCast(f,
System.Windows.Forms.Control)
|
Throws InvalidCastException. Is more
efficient than CType because it does not depend on the Visual
Basic helper runtime functions. It can even detect some errors as
invalid casts during compile time
However it requires a relationship of inheritance of implementation
For example:
Dim q As
Object = 2.37
Dim i As
Integer = CType(q,
Integer)
' The following conversion fails at run time
Dim j As
Integer =
DirectCast(q, Integer)
The run-time type of q is Double. CType
succeeds because Double can be converted to Integer.
However, the first DirectCast fails at run time because the
run-time type of Double has no inheritance relationship with
Integer, even though a conversion exists
|
TryCast |
Dim
obj As MyType = TryCast(obj, MyType)
If obj
Is Nothing
Then
' Object could not be cast
Else
' Object was casted
End If |
Throws no exceptions. |
All this information has been taken from the MSDN site. This is just a quick
summary. For more information see:
Type Conversion Functions
Conversion Functions (Visual Basic)
Widening and Narrowing Conversions
Implicit and Explicit Conversions
Peter Ty assembled a good reference of links for Visual Basic 6 Upgardes to .NET.
Enjoy!
http://blogs.msdn.com/peterty/archive/2007/05/25/end-user-computing-foxpro-and-vb-migration.aspx
The launch of ArtinSoft's spanish web site (www.artinsoft.com.mx) comes in synch with ArtinSoft's winning a very large contract to migrate over 170 Visual Basic applications at Banamex (a Citi Group subsidiary). The applications will be fully updated and deployed by the bank in less than one year period. This is a record time for such a large migration project: over 5 millions lines of code!
Banamex performed extensive research on how to approach the VB6 support deadline. Since the beginning of the evaluation process the internal debate was weather to automatically migrate or to rewrite the apps.
They did a full assessment of their application portfolio and separeted the applications that were about to be retired and choose the applications that were functionally relevant to the business. They observed that the chosen applications were simply performing all the business requirements they were supposed to perform, therefore no need to change them functionally! The next realization was that a rewriting was definetely NOT the cost-effective way to solve the situation. The estimated difference betweeb a rewrite and a migration was 5 to 1.
Banamex showed once more that if your application is performing and what you need to do is move to adopt .NET and all the benefits that come with it then the best way forward is through automatic upgrade.
Read more about the Banamex story at: the following links (some are in spanish):
La República: http://www.larepublica.net/app/cms/www/index.php?pk_articulo=854
El Financiero: www.elfinancierocr.com/edactual/tecnologia1231205.html
CIO América Latina: http://www.cioal.com/pcwla/cioaldocs.nsf/pages/8E66B81ACF8DB582852573500015F54B
Pergamino Virtual: http://www.pergaminovirtual.com.ar/revista/cgi-bin/hoy/archivos/2007/00001122.shtml
Business News Americas: http://bnamericas.com/login.jsp?idioma=I&urlJump=story.jsp$SEP$idioma$EQ$I$AMP$sector$EQ$1$AMP$noticia$EQ$406218
Yahoo! España: http://es.biz.yahoo.com/10092007/185/firma-costarricense-software-moderniza-sistemas-banamex.html
Yahoo! México: http://mx.news.yahoo.com/.../38/negocios-firma-costarricense-software-moderniza-sistemas-banamex.html&printer=1
La Prensa Gráfica: www.laprensagrafica.com/economia/870594.asp
TMCnet: http://www.tmcnet.com/usubmit/2007/09/10/2925480.htm
Link to ArtinSoft – soluciones de migración de software
ArtinSoft just lunched its web site for the spanish market and specifically for the Mexican market.
This is a nostalgic note. Someone asked me, "hey, how do you make a fixed len
string in VB6?"
As the computer geek that I am, that the kind of questions I like to be able to
answer.
These are important questions like all those questions from the 80's rally:
The name of all the original thundercats...
The planet where Luck Skywalker went to learn with Yoda...
Which Star Trek character appear in ALL the episodes (yes it is Spock, Kirk is
not in all of them)
Well, the thing is to define a fixed len string in VB6 you do something like:
Dim aString As String * 10
If you do something like:
aString = "Mau" ' aString ==> "Mau "
That's all
Fixed length strings are automatically filled with spaces to pad them to their
fixed-length. How do you get rid of the extra spaces? Duh!!! with RTrim$ don't
you remember
When a variable like aString is declared, it will be filled with Null characters
until it is used.
And yes functions (RTrim$, LTrim$, and Mid$) will not trim Null characters, so
be sure to assign it with an empty string "" immediately.
Ahh! and by the way when you translate that to .NET, .NET does not have a fixed
len string so the easiest thing to do is use:
Microsoft.VisualBasic.Compatibility.VB6.FixedLengthString.
[C#]
using Microsoft.VisualBasic.Compatibility;
...
void foo()
{
VB6.FixedLengthString aString = VB6.FixedLengthString(10, "Mau");
}
Yesterday someone told me and I checked out
El Financiero online.
There's an article about
Artinsoft there.
If you don't know about us. We do Software Migration, and BANAMEX decided to upgrade their platform from VB6 to .NET.
It's a huge amount of code, and a very interesting project :)
See:
Article
Many of the same testing principles apply when working with upgraded applications. However, there are certain differences in the process that are worth noting. Here is a list of FAQs that are answered in the 21st and last chapter of the Migration Guide that ArtinSoft has prepared. Check it out and if you have further questions I'll be happy to discuss them with you.
Link to Testing Upgraded Applications
Some time ago I was interviewed (via email) by El Financiero, a weekly business-oriented newspaper from Costa Rica, regarding 64–bit technologies. A small quote from the interview was published a couple of weeks ago, along with some information I gave them on the advantages of moving to 64–bits.
The technical journalist from the newspaper did an article on how the Costa Rican Central Bank, BCCR, is moving their payments system (SINPE) from 32–bit to 64–bit servers, and the benefits they are getting from the move. These benefits include enhanced speed and database performance, given the large memory capacity of the new architecture. This is a fairly large system that handles over 3 million financial transactions per month.
ArtinSoft had some involvement in moving this system from Visual Basic 6.0 to Visual Basic .NET some time ago, in the dawn of the .NET era. There is even a published case study on the system – you can find it here.
Their plan currently is to slowly move all their systems to 64–bit over a period of 2 years.
You can check out the article here: BCCR ajustó tecnologías (you may need to be registered with the site).
A large percentage of the work I do here at ArtinSoft is related to what we call Ready programs. The Ready program is part of the Ready-Set-Go methodology – a migration project methodology developed here at ArtinSoft that has given us great results.
The Ready assessment program, or Ready, is the first stage of this methodology. As you are probably aware, the more planning you put into a project, the higher the probability that the project will be succesful. Well, with the Ready, we do a an in-depth analysis of the project before we start, and come up with a detailed project plan that takes into account any risks and possible issues with the migration.
The first step in a Ready is a thorough assessment of the size, complexity, migration goals, and testing procedures for your current application. This step involves a 5– to 10– day on-site analysis of an application. During that week(s), we perform interviews with the development, PM and testing teams, to get a feel for the project and gather enough information to proceed with the project. Once we come back to our office, we work alongside the development team to create an accurate estimate of the effort required to perform the migration. This normally includes any customization of the migration tools necessary to minimize the manual effort in the project.
The final product of the Ready program is a detailed written report that includes a fixed-cost proposal for completing the migration. This is usually delivered two or three weeks after the on-site visit. This report, on its own, has tremendous value for the organization. It summarizes the requirements for the migration, and the issues that need to be addressed even if the project is not performed by ArtinSoft. It can also help in justifying the need to modernize outdated applications.
The Ready program is a low-cost, low-risk approach to getting detailed information on your migration project. For more information on the ready, and on the overall methodology, check out the Ready-Set-Go methodology page at ArtinSoft's website.
Ever since we started working on the Virtual Server seminars, we’ve been hearing about I/O Virtualization, and how it will improve the virtualization landscape as the VT instructions did. Well, today Intel unveiled its vPro platform, with this new technology.
The technology is called Virtualization Technology for Directed I/O or VT-d. VT-d controls access from Virtual Machines to memory at the physical page level, preventing one VM from accessing other VM’s memory. This has the side effect of virtualizing interrupts and DMA tranfers, which in turn should increase the performance of virtual machines since the VMM would no longer need to trap and emulate the behavior from virtual machines.
For more information, check out or this article at Intel’s website, which contains a detailed explanation of the platform. For a more digested approach, check out this coverage at Arstechnica.
Sometimes you might have a situation where you have a VB Application you want to migrate to C# but you also have some PHP code you are depending on? Sounds familiar?
Well it isn't really a typical scenario jajaja
But anyway if you had the urge to do that now project Phalanger can help you with that just
check it out
And if you need help in the VB6 to C# stuff just write any question you have :)
As any geek I live frustrated by the lack of good tools in Windows.
Notepad, and Paint are just a couple of examples.
I was just dreaming for a nice, light replacement for those applications.
Well, recently somebody wrote a nice page with amazing freeware that you can use:
Amazing Tools
In case you missed it, Microsoft recently unveiled a new Virtualization Website. This website centralizes the information about all of Microsoft’s virtualization products.
I especially like the page about the different Virtualization Solutions offered by the company. It also caught my attention that they now have Softgrid application virtualization fully integrated with the virtualization stack.
On my last
post I mentioned some of the motivations of one of
ArtinSoft’s largest customers to upgrade their critical Visual Basic 6.0 and ASP applications (around 5M total LOC and 9,000 total users!) to the .NET platform. They expect more than US$40M of accumulated benefits in 5 years as a result of this investment in software migration, and considering the Total Property Benefit (TPB) and the Total cost of Ownership (TCO), recuperation time is 4 years in the most probable scenario.
In this particular case, the following migration benefits would help to reduce current costs, increase the income, steer clear of new costs, and avoid losing market position:
1-
Reducing the number of incidents and the total cost associated with the fixes: Having around 3-4 incidents per year at US$3,500–US$4,000 per fix, it was estimated that a migration would reduce this number between 60–70%.
2-
Avoiding business disruption: When avoiding the increase in the number of incidents, business disruption is prevented. Migration averts a negative impact upon the company’s value chain caused by the degradation of a business process supported by the system.
3-
Providing a competitive advantage: Migration provides an advantage over competitors, allowing the quick development of new system functionalities demanded by the customers. Some of the .NET’s characteristics that facilitate this are distributed technologies support, Web Services, Remoting and Windows Communication Foundation. It is estimated that the effect of losing competitiveness ranges between 4-5% of the revenue per year.
4-
Reducing new development efforts: With about 300 new developments per year, a migration to the .NET platform would reduce the effort between 18% – 22%. Some of the .NET characteristics that allow this are the fact that registry configuration or DLL registration is not necessary, a better deployment (sharing of multiple DLL versions, XCOPY, incremental installations, One-Click) and increased productivity (Just-In-Time (JIT) compilation, Common Language Runtime (CLR), Common Type System (CTS), .NET Framework Class Library (FCL), Garbage collection, Integrated Development Environment, Task List).
5-
Increasing new developments reuse: Some of the .NET integration characteristics that allow this are the easy interaction with .NET components and legacy systems and COM interop allowing the use of components from the original application. Reuse of new developments would range between 16 – 20%.
6-
Improving system performance: the .NET platform provides several improvements in this area, such as a multithreading and ASP.NET.
This is just an example of the reasons and some of the expected benefits for a particular migration project, and this varies from case to case. However, let’s be honest: any upgrade is generally a complex task, but in most cases the alternative is to drop behind the competition and go out of business. So this might be a good time to assess your investment in business applications.
I will be now blogging via
wordpress. This is just a matter of convenience for myself. Please update your bookmarks /
RSS feeds.
New blog address:
http://csaborio.wordpress.com/