Convert VMWare Virtual Hard Disks to VHD Format

14. December 2006 06:44 by Csaborio in General  //  Tags:   //   Comments (0)
Many people at Artinsoft use VMWare for their Virtualization needs.  This quickly became a hassle as the VMs that they were using that I needed could not be used in Virtual Server.  I just found out through this article that there is a new tool called the VMDK to VHD file converter.

I have not yet tested the tool, but soon I will be converting all the RedHat VMDK to VHDs and running them on our Virtual Server R2 SP1 (which fully supports Linux!). 

You can find the official link here, download it and let me know if you run into any issues!

Should I use a SCSI or IDE controller for my VHDS?

14. December 2006 06:36 by Csaborio in General  //  Tags:   //   Comments (0)
I have talked quite a bit in terms of the different VHDs there are, let's now focus on the different controller types that are available.

When you create a VHD, you need to attach it to an emulated controller in order for the VM to use it.  You have two options: SCSI or IDE, but which one should you choose and why?

The rule of thumb seems to be: if you can use SCSI, use SCSI, but why?  SCSI emulated controllers allow concurrent connections on the BUS, so this will make operations with multiple VHDs faster.  Furthermore, your VHDs can be bigger with SCSI controllers (2 Terabytes SCSI vs. 127 GB IDE!).  If that was not enough, SCSI controllers have more devices that can be attached to them.  IDE supports only 4 connections, SCSI supports up to 28!

Furthermore, emulated devices such as DVD drives can only be attached to IDE buses, so you better save those buses for these types of connections.  

So when should you use IDE controllers?  Use them when working with removable media or when you are dealing with a VHD that has an OS that will not allow itself to install itself on a SCSI connection.

Taking Advantage of Virtual Machines - IE 6 Testing VPC Image

2. December 2006 21:15 by Jaguilar in General  //  Tags:   //   Comments (0)

Microsoft released Internet Explorer 7 a few months ago, with some great features such as an RSS reader and tabs (my favorite). You, however, cannot run both Internet Explorer 6 AND Internet Explorer 7 on the same Windows installation. So if you are a web developer, and have to test your web pages in different versions of the browser, what can you do? Well, for one, you can thank Microsoft for releasing Virtual PC 2004 as a free download.

One of the known advantages of virtualization is the fact that you can run different configurations on the same machine. Microsoft is right now using this to help developers, by releasing AS A FREE DOWNLOAD a Virtual Machine image that contains a pre-activated Windows XP SP2 installation, Internet Explorer 6 and the IE7 Readiness Toolkit. With this VPC Image, you can run IE7 as the standard browser in your PC, and have and Virtual PC 2004 image with IE6 for testing purposes.

You can get more information about the VPC image in this post at the IEBlog. One of the downsides of the image, though, is that it has a "timebomb" and expires in April, 2007. But, between now and then, looks like the best alternative for running both browsers on your PC.

You can get the image from the Internet Explorer 6 Testing VPC Image download page

Tidbits on VHDs - Part 2

1. December 2006 11:24 by Csaborio in General  //  Tags:   //   Comments (0)

On my previous article, I touched base with the types of VHDs that are available.  I will now try and pinpoint which are the best scenarios to use each of those VHDs.

Fixed disks are the ones that offer the best performance because there is no dynamic creation since the VHD is always the size that was specifed in its creation.  The chance of fragmentation is also less when working with Fixed VHDs.  If your application is disk intensive and you are planning on running it on a VM, then this type of disk is the best way to go.

Dynamic disks work best when you want to make the best use of your space and you can withstand the performance penalty and fragmentation chance that can happen.  If you want to save the most space when running VHDs, then dynamic disks are your best option.  Use caution when working with dynamic disks as if the disk is expanding and the server runs out of space, disk corruption may occur.

Differencing Disks are a blessing for the IT Pro.  If I was an IT admin, I would just have base VHDs of the most frequently used OS in my enterprise.  For instance, I would have various VHDs with Windows Server 2003 Enterprise, Windows XP, Windows Vista and so on.  When someone requested a Windows XP disk with Visual Stuido installed, I would just create a differencing disk and install Visual Studio.  You can also have differencing disks of differencing disks which can become more and more useful in the long run.  The main thing to watch out for is to make sure that the parent is always read only, since any modification will render the “son” VHDs in an unusable state.

Finally, if you are looking for a way to convert a physical disk that does not contain an OS, you can just link the physical disk to a virtual one by setting up a Linked VHD.  Once you do that, all it takes is a trip to the Virtual Server Administrative interface and convert the linked disk to a fixed or dynamic one.  If you want to convert a physical disk that has an OS installed, you must use the Virtual Server Migration Toolkit.  Tips on how to use this tool belong in a future blog entry.  Take care!

Tidbits on VHDs - Part 1

1. December 2006 11:12 by Csaborio in General  //  Tags:   //   Comments (0)

Virtual Server has various VHD (Virtual Hard Disks) available for creation, namely:

  • Fixed
  • Dynamic
  • Differencing
  • Linked

In this first part of this blog, I will try and explain how each VHD works. 

Fixed VHDs are the closest thing that resemble a real hard drive.  When you create them and specify its size to 20 GB for example, the actual VHD file will be indeed 20 GB in size.  This means that if you are only using 1 GB of the VHD, it will still be taking 19 GB of space on the server where the VHD is stored.

Dynamic Disks, on the other hand, are not the size you specify at upon creation.  If you specify a dynamic VHD of size 20 GB, it will be originally created as a small drive, and as you write information and need more space, the VHD “dynamically” expands in size.  This operation can have a small toll on the VHD’s performance when it is expanded.  Furthermore, there can be more fragmentation issues since a sequence of bytes can be scattered in different places in the physical drive. 

Differencing Disks have a parent VHD.  Only the difference between the parent and the son will be written to the differencing VHD.  This means that if you need to create 20 Windows XP machines, instead of creating 20 VHDs with Windows XP (something that could take 40 GB), what you can do is set a Windows XP VHD as the parent (2 GB) and set the 20 VHDs as differencing (around 200 MB per disk).  You will be saving a lot of space this way.

Linked VHDs are pointers to real physical disks or partitions.  They are not meant to be used with virtual machines when they are on.  The only reason why you would want to use a linked disk is so that you can carry out a P2V (physical to virtual) migration. 

In my next blog, I will talk about which VHDs work best for which scenarios.

Invoke a WebService that needs Windows Authentication

1. December 2006 10:22 by Mrojas in General  //  Tags:   //   Comments (0)

Passing client credentials to a Web service using Windows authentication

Sometimes a Web Service is under a configuration that requires Windows Authentication. It is not a problem for .NET, all you need to do is set your environment to send the client credentials.
  1. First Create a Reference to a Web Service:





To do that just go to the references of your project and add a Web Reference. Type the URL of your web service. This will find your Web Service Reference and you can update it. This will generate the proxy code you need to access your webservice.

If you try to call your webservice with a call like:

WebReference.MyService pService = new WebReference.MyService ();
pService.doStuff("A", "B");

You’ll get a HTTP 404 forbidden access exception.

Now to send the user and password to call your service write some code like the following:

WebReference.MyService pService = new WebReference.MyService ();
pService.Credentials = new System.Net.NetworkCredential("user", "password");
pService.doStuff("A", "B");

You can also send the domain name as part of the parameter to the NetworkCredential class:

pService.Credentials = new System.Net.NetworkCredential("user", "password","domain");

It will be even better to have your user and password not in your code but in the configuration file for your program. You can then use the AppSettings class to access those properties.

ToolTip with Images

1. December 2006 06:30 by Mrojas in General  //  Tags:   //   Comments (0)

The Tooltips that comes out of the box for winforms do not support images on them. This is a simple class that allows you to add Images and Text to your ToolTips

using System;

using System.Windows.Forms;

using System.Collections.Generic;

using System.Text;

using System.Drawing;

namespace CustomControls

{

class ToolTipWithImage : Control

{

private Image _img;

private Control _ctl;

private Timer _timer;

string _imgfilename;

string _tiptext;

public String TipText

{

get { return _tiptext; }

set { _tiptext = value; }

}

public String ImageFile

{

get

{

return _imgfilename;

}

set

{

if (_imgfilename == value)

{

}

else

{

_imgfilename = value;

try

{

_img = Image.FromFile(_imgfilename);

this.Size = new Size(_img.Width + 70, _img.Height);

}

catch

{

_img = null;

}

}

}

}

public ToolTipWithImage()

{

this.Location = new Point(0, 0);

this.Visible = false;

_timer = new Timer();

_timer.Interval = 1000;

_timer.Tick += new EventHandler(ShowTipOff);

}

public void SetToolTip(Control ctl)

{

_ctl = ctl;

ctl.Parent.Controls.Add(this);

ctl.Parent.Controls.SetChildIndex(this, 0);

ctl.MouseMove += new MouseEventHandler(ShowTipOn);

}

protected override void OnPaint(PaintEventArgs e)

{

if (_img != null)

{

e.Graphics.DrawImage(_img, 0, 0);

e.Graphics.DrawString(TipText, this.Font, Brushes.Black, _img.Width, 0);

}

}

public void ShowTipOn(object sender, MouseEventArgs e)

{

if (!this.Visible)

{

_timer.Start();

this.Left = _ctl.Left + e.X + 100;

this.Top = _ctl.Top + e.Y;

this.Visible = true;

}

}

public void ShowTipOff(Object sender, EventArgs e)

{

_timer.Stop();

this.Visible = false;

}

}

 

}

 

To use it just do something like

ToolTipWithImage timg = new ToolTipWithImage();

timg.TipText = "Hello";

timg.ImageFile = @"C:\Hello.gif";

timg.SetToolTip(btnOk);

Virtual Server 2005 Performance Tips

30. November 2006 12:23 by Jaguilar in General  //  Tags:   //   Comments (0)

I found two websites that give tips on how to get the best performance out of Virtual Server 2005. Check them out:

One of the best tips came from the second article, when discussing SCSI and IDE virtual hard disks:

Still, the rule for performance is pretty simple. Use SCSI-attached VHDs whenever you can and use IDE-attached VHDs whenever you must.

 Both pages give excellent tips, and discuss things like the amount of memory you should have, how to optimize VHD placement, number of CPUs, and others. I recommend you look at them if you are considering installing Virtual Server.

Virtualization for Developers event in Redmond in two weeks

30. November 2006 06:47 by Jaguilar in General  //  Tags:   //   Comments (0)

The first Virtualization for Developers event will be held in Redmond between December 12–14. The registration is still open at the Virtualization Developer Lab Series webpage. We’ve been working hard on the content for this labs, and we are really looking forward to this event.

In these events you will learn how to work with the Virtual Server 2005 COM API in great detail. Once you complete them, you’ll be able to script common management tasks, and incorporate API calls to your own management applications. You’ll also get an overview of Virtual Server capabilities, and you’ll see how the System Center Virtual Machine Manager can make your life easier. You can review the complete agenda on this webpage: Virtualization 3 day Lab Agenda Overview.

Key Stakeholders: Developers

28. November 2006 09:14 by jpena in General  //  Tags:   //   Comments (0)

The developers of a legacy application tend to have an important sense of ownership of the application: probably they’ve spent many months in its design, coding, stabilization and maintenance tasks.  Also, they’ve got a lot to say about the future enhancements that should be made to the application, especially taking advantage of the features of the target platform after a migration is done.

In addition to this sense of “fatherhood” over the source code, developers have the best knowledge of the nuts and bolts of the application.  Naturally, no one knows the code more than the ones who actually wrote it.  Because of this, developers are among the key stakeholders that you must take into account when managing a migration project.

You may find the following tips useful when working with developers as a stakeholder group in migration projects:

  • Most developers will feel very enthusiastic about the migration project.  If they are part of the team that executes the migration, they will help keep the team motivated.  If they are not in the team, it’s always a good idea to keep them informed of the technical details of the project.
  • Some developers, especially if they are part of the team in charge of the migration, will feel tempted to do some enhancements to the application during the migration project.  This may introduce some sort of “feature creep” to the project, possibly increasing the testing and stabilization costs.  I guess you don’t want this, so make sure everybody stays focused on the goal of achieving Functional Equivalence first!
  • Developers who are not skillful yet on the target platform will feel rightfully concerned about the migration project.  Of course, they need training!  Make sure they receive proper training on the target language and technologies before the migration project finishes and they have to continue their maintenance tasks in the new platform.

Stayin' Alive in a Windows World

27. November 2006 13:55 by Csaborio in General  //  Tags: ,   //   Comments (0)

It’s been almost 5 months since I brought a black MacBook to work.  At first I thought it was not such a good idea due to the incompatibilities I could face.  So far the experience has not been a bad one, and I can run most of the software I need without having to strive against slow performance or incompatibilities.  With the exception of screwing up some of Jose’s powerpoint slide animations, I don’t think there has been mayor damage done.

The following compromises a list of the software that any individual looking for to work in a Windows environment should have on their list:

Parallels: If you must run Windows on OS X, then you need Parallels.  It’s performance is superb and it will allow you to run a Virtualialzied Windows with a little performance hit.  This blog I am writing as of now is under BlogJet using a copy of WindowsXP.  I also run Office 2007, Firefox, Messenger, Project, and Visual Source Safe (watch out Parallels, someone is lurking in the dark)

Crossover: it allows you to run Windows binaries without having to run Windows.  It is based on the Wine project and so far I have been able to run Office 2007 and Internet Explorer 6 without having to run Windows.  Still on early beta stages but nonetheless quite impressive.

TSClient: I mentioned this on an earlier post.  It has become my default RDC client, extremely fast.

NeoOffice: a port of OpenOffice but does not require x11 on your system.  It runs faster than Microsoft Office for Mac on my MacBook.  Until there is a universal binary for Office, I am using this one for Office productivity.

And finally, if all else fails (as is the case of running VTune on a VM), I can always boot into Windows natively using BootCamp.   Fortunately, thanks to the great programs above, this is something that is happening less often every time.

Automatically Adding Users to a Windows 2003 Server

27. November 2006 13:35 by Csaborio in General  //  Tags:   //   Comments (0)

A crucial part when carrying out training labs is setup. Without a well thought plan that takes into consideration everything that can go wrong (because it will), your labs are toast. We've done about ~70 trainings so far and in every one of them something pops up. With more and more trainings, you start to develop a sixth sense of complete and utter pessimism that will help you identify problems before they even show up.

That being said, we are in the middle of testing all of the setup for a series of Virtualization training labs in December 2007. We needed a way to quickly and painlessly add a bunch of users to a Windows 2003 Server. The following is the series of commands to create a user callled student1 on the server with Administrative priviledges that belongs to domain admins and an account that never expires:

net user student1 p@ssw0rd /ADD /DOMAIN
net group "domain admins" student1 /ADD /DOMAIN
net localgroup Administrators student1 /ADD
net accounts /maxpwage:unlimited /DOMAIN

There are plenty more of options so check out the net command to find a command that best suits your need.

Migrating VB6 to VB.NET Safely

27. November 2006 05:48 by Fzoufaly in General  //  Tags:   //   Comments (0)

This is an interesting blog post about some tips to prepare for a VB migration. 

Link to Migrating VB6 to VB.NET Safely « Star Struck Developer

Interestingly, now the dilemma is no longer weather I should upgrade or not but HOW do I upgrade and minimize the potential issues in doing so.

"But life does march on and .NET is now an essential part of any serious developers inventory. So this is the strategy I am following to at least provide the team the opportunity of migrating code to C# or VB.NET."

Safe Migration to VB.NET

27. November 2006 05:44 by Mrojas in General  //  Tags:   //   Comments (0)
    My colleague Juan Pastor forward us an interesting link. It was called "Safe Migration to VB.NET". By Phillip Munce.
He provides an interesting point of view of how to address a migration. He's approach is based on the Agile Development strategies.
Mainly he states that a good way to address a migration project is developing a set of Unit Test cases. For which you could use either NUnit or the Visual Studio Team System.
In that way is easier to establish a measure that let's you know when the project is migrated if it meets the original application test cases.
He also sees it as an oportunity to document and improve maintability for the application.
Here at Artinsoft we also give special attention to testing and the establishment of the test case scenarios because they are our main tool to determine the "Functional Equivalence"
 of the application being migrated which is the goal of most of our clients.
Testing is not always appreciated by developers but as applications grow and maintability becomes complicated, it is harded and harder to keep track that new functionality and patches do not destroy the rest of your application.
Take a look at Phillips Blog here.

Identifying Key Stakeholders, Part II

24. November 2006 16:25 by jpena in General  //  Tags:   //   Comments (0)

There are several key questions you need to ask yourself regarding each particular stakeholder that identify in your project.  Answering these questions will help you understand these people’s needs and concerns, and will allow you to classify them so you can communicate the right message to each individual stakeholder or group of stakeholders.  Some of these questions are:

  • How will this person (or group) be affected by the migration project? How will their work be changed?
  • What is the level of influence that this person has in the project? Are they supporting the project, threatening it or just awaiting its results?
  • What is the level of authority that this person has in the organization?  Is he or she a decision maker?
  • What kind of information does this person expect about the project? Do they need progress, financial or technical reports?
  • What kind of language should be used with this person? Technical, administrative or just simple language?

Note that this list is not exhaustive, as more questions may be necessary depending on your particular situation.  Once you have answered these questions, you will be able to classify project stakeholders into several groups, based on their influence, authority, concerns and informative needs.  This will allow you to focus on the most important stakeholders (without abandoning the other ones, of course!), and to project the most appropriate messages about the migration project to each stakeholder or group of stakeholders.  Keeping important stakeholders on your side will help pave your way to a successful migration project!

In the next posts, we will take a look at some of the typical stakeholders in a migration project.

Oh, yes, and the upgrade guide as well!

24. November 2006 09:53 by Jaguilar in General  //  Tags:   //   Comments (0)

Planning and performing a Visual Basic 6.0 migration is not that straightforward. You need to keep track of many small details, and you need to keep in mind the complete migration process – in other words, always see the big picture. The tool I posted about yesterday, the Code Advisor and the Assessment Tool, are invaluable in the help that they provide during the planning stages of the project. For the complete upgrade process, however I have to recommend the Upgrading Visual Basic 6.0 Applications to Visual Basic .NET and Visual Basic 2005 guide from the patterns & practices Developer Center over at MSDN.

This guide was written as a joint effort between Microsoft and ArtinSoft, and details all the steps necessary to succesfully upgrade your applications to Visual Basic .NET. It also deals with the actual technical hurdles you normally face when performing these types of conversions. Overall it is very comprehensive, and should be in your library if you ar planning or performing one of these projects.

If you are using the VB Upgrade Companion, and decide to upgrade to C# instead, most information from the guide still applies. That is one of the beauties of the .NET Framework – the concepts from VB.NET work with C# as well.

And don't forget the Assessment Tool!!!

23. November 2006 12:34 by Jaguilar in General  //  Tags: ,   //   Comments (0)

Yesterday I blogged about the Code Advisor, that will pinpoint common programming practices that difficult the migration of a VB6 application. Well, another very important tool that you can add to your arsenal is the Visual Basic 6.0 Upgrade Assessment Tool. This tool was developed by ArtinSoft, and creates a spreadsheet with detailed information of actual upgrade issues that will be present in the .NET code after the migration.

This tool is also a free download from Microsoft’s website. You can also check out ArtinSoft Visual Basic to .NET page for more information on upgrading Visual Basic 6.0 applications.

Remeber the Code Advisor!

23. November 2006 12:02 by Jaguilar in General  //  Tags: ,   //   Comments (0)

If you are considering to upgrade your Visual Basic 6.0 application to Visual Basic .NET or C#, remember that the recommended first step is to run Microsoft’s Code Advisor. The Code Advisor, according to the website:

The Code Advisor for Visual Basic 6 is an add-in used to review your code to ensure that it meets predetermined coding standards. The coding standards are based on best practices developed by Microsoft to produce robust and easy-to-maintain code.

The Code Advisor detects issues that are not converted automatically during the automatic migration, increasing the manual work required after running the conversion tools. These include Variant variables, late binding, soft binding of different objects, and others.

Check it out: Code Advisor for Visual Basic 6.0

Updating Win32 API Calls

23. November 2006 05:30 by Jaguilar in General  //  Tags:   //   Comments (0)

The Visual Basic Upgrade Companion allows you to convert calls to the Win32 API from Visual Basic 6 to C#. API calls in VB6 have the following syntax:

Public Declare Function RegOpenKey Lib "advapi32.dll" _
Alias "RegOpenKeyA" (ByVal hKey As Long, _
ByVal lpSubKey As String, phkResult As Long) As Long

The equivalent API call in C#, using platform invocation (p/invoke) is:

[DllImport("advapi32.dll">)]
extern public static int RegOpenKey(
IntPtr hKey,  string lpSubKey,  out IntPtr phkResult);

Even though the upgrade companion performs the conversion automatically, there are times when the protoype of the function may be slightly off. This happens mostly because of the changes in the data types between VB6 and C#. One example is when a string is sent to a method and its contents are modified in the call. String management is always tricky, and, in those cases, chances are that the VB Upgrade Companion will convert the VB6 fixed length string to a System.String object in C#. The correct conversion would be a System.StringBuilder object – remember that Strings are inmutable in C#, but StringBuilders are not, and they can be marshalled to the API as the strings that need to be modified.

If you ever have a doubt regarding the prototype of a Win32 API function in C#, I recommend that you check out PINVOKE.NET. This website contains the P/Invoke signatures for most methods of the API, classified by DLL. It is very complete, and can definitely save you lots of time if you are having problems with a particular methods.

If you are new to p/invoke, I also recommend that you check out this MSDN article on the subject.

Creating a Scheduled job in ORACLE

22. November 2006 06:41 by Mrojas in General  //  Tags:   //   Comments (0)

This is easily done with the Oracle 10g interface, there is a nice article that explains that in at this address

However sometimes you don't have access to the Administrative UI. Is there another way to create or schedule jobs?

Sure just use the he DBMS_SCHEDULER package.

There are several things you should do:

1. GRANT CREATE JOB TO MYUSER;

2. ALTER SYSTEM SET RESOURCE_LIMIT = TRUE;

3. Create Scheduler Program:

BEGIN
   DBMS_SCHEDULER.CREATE_PROGRAM(
      program_name=>'MYUSER.PROGRAM1',
      program_action=>'begin
         INSERT INTO TABLE1
         SELECT * FROM TABLE2;
         end;',
      program_type=>'PLSQL_BLOCK',
      number_of_arguments=>0,
      comments=>'Loads a table from another',
      enabled=>TRUE);
END;

 4. Create a schedule program:

BEGIN
   sys.dbms_scheduler.create_schedule( 
      repeat_interval =>   
         'FREQ=DAILY;INTERVAL=2;BYHOUR=18;BYMINUTE=0;BYSECOND=0',
      start_date => 
         to_timestamp_tz('2006-11-22 US/Eastern', 'YYYY-MM-DD TZR'),
      comments => 
         'Schedule for periodic loads',
      schedule_name => '"MYUSER"."DOLOADS"');
END;

 

5. And finally link both together to create a JOB:

BEGIN
   sys.dbms_scheduler.create_job(
      job_name => '"MYUSER"."JOB1"',
      program_name => 'MYUYSER.PROGRAM1',
      schedule_name => 'MYUSER.DOLOADS',
      job_class => 'DEFAULT_JOB_CLASS',
      comments => 'Loads a table',
      auto_drop => FALSE,
      enabled => TRUE);
END;

At least this is how I did it. This is just a quick summary of the following article:http://www.oracle.com/technology/oramag/oracle/04-jul/o44tech_dba.html

 

 

Categories