Thursday, September 18, 2008

Visual Studio crashed while adding Toolbox items

I’d like to share my recent experience working in Visual Studio 2008. The other day I was working on a program in Visual Studio 2008 and had to update the Toolbox with some items. When I tried to add some items to the Toolbox Visual Studio quit unexpectedly. I was aghast as there was no error message or indication of reason(s) for the crash. I thought that perhaps it was simply a coincidence that Visual Studio quit when I tried to add items to the Toolbox. Repeated attempts to add items ( I also tried to add different items thinking that perhaps there was something wrong with the items I was trying to add to the Toolbox) to the Toolbox resulted in Visual Studio crashing each and every time. Since there was no error message I decided to check the event viewer and I found the following error message in the application event logs.


After exhausting all my options in troubleshooting this issue I turned my attention to the internet. After a little bit of research I found out that PowerCommands for Visual Studio 2008 may be the culprit. I checked to see if PowerCommands for Visual Studio 2008 was installed on my computer and it was installed on my computer. I uninstalled PowerCommands for Visual Studio 2008 and lo and behold that fixed the issue. I was once again able to add items to Visual Studio Toolbox.

PowerCommands for Visual Studio 2008 is a great add-on for Visual Studio that has many useful features for a developer but to me this is a critical issue that must be fixed otherwise one cannot use the Toolbox. So if you have PowerCommands for Visual Studio 2008 please be aware that you may not be able to add any items to the Toolbox. You have to uninstall it using Add/Remove programs to be able to add items to the Toolbox.

Tuesday, September 2, 2008

ActiveSWF - Dynamic flash creator

As a developer I have seen the need to create and show flash movies dynamically but employed alternative solutions. The alternative solutions was adequate to meet the minimum requirements but as my interest in Flash grew and when I decided to develop programs that would produce flash files (animation) dynamically (on the spot) it was an obvious decision to have a permanent, robust and reliable solution that would meet my needs. To this end, I searched on the internet for a solution but was initially disappointed to find out only handful solutions that were either only online creators with capability to create basic flash animations or offline creators with no dynamic flash creation capabilities. The disadvantage of online creators is that there are only a limited number of pre-defined templates that are available to the user and they require the user to access the website, edit the pre-defined templates configuration to customize the flash content and generate the flash file. One could very easily end up with the same type of animation as another person half the world away that is if both persons used this same service and the same template. Furthermore, one would need an internet connection to access the website to create the animations which severely limits the accessibility and makes the accessibility questionable. Otherwise, I was impressed to see online creators offer some pretty good animations. The offline creators even though had offline software to install and create potentially unlimited nice animations they lacked the capability to create animations from a configuration file or to create animations dynamically.

My search on the internet was eventually fruitful when I found ActiveSWF at http://www.activeswf.com/. ActiveSWF allows the creation of flash content dynamically and from easily configurable XML files. It allows desktop applications and web applications developers and web designers to achieve seamless professional results because of its compatibility with COM and .NET. ActiveSWF opens up the possibilities of flash content creation beyond imagination.

Fundamentally the process of flash content generation with ActiveSWF is very simple as shown in Figure 1. The first step is to create flash content definition in a XML file that conforms to ActiveSWF XML schema. This file is then processed by ActiveSWF platform (executable and libraries installed by ActiveSWF) to produce the flash movie.

Figure 1

If the flash content is to be generated dynamically from a program or a script then the process is as shown in Figure 2. The program or script can use the API provided by ActiveSWF to generate the flash content dynamically. ActiveSWF also provides an extensive list of error codes that a developer can use in his/her programs exception handling. The API library and other files needed for dynamic flash content generation can be redistributed allowing for dynamic generation of flash movies.

Figure 2

ActiveSWF supports many Macromedia Flash features to generate dynamic flash content. Some of the supported flash features include various shapes, images, sounds, plain text, HTML text, buttons, layers, actions, morphing, shape manipulations, shape transformations, vector graphics, font embedding, ActionScript 2.0, etc. The flash content definition XML file must first be created in order to generate the flash content. For the purpose of this review I decided to generate a sample flash movie. I did not have any trouble getting started with ActiveSWF. The first thing I did was go through the documentation which was very informative and helpful. It took me less than two hours to understand the fundamentals and workings of ActiveSWF. I hit the ground running in using ActiveSWF. The learning curve is next to nothing and this is true especially for people who are familiar with XML files.

ActiveSWF provides an XMLPad editor to create and edit the flash content XML files. I created the XML file for my sample using both XMLPad and Notepad++. However, XMLPad must be used to generate flash movie. Personally I find it convenient to edit XML files using Notepad++ because it has built-in XML style configurator and it displays line numbers. Allowing XMLPad to show line numbers would be a very useful feature when debugging the XML file. ActiveSWF supports several styles and objects that can be employed in flash movie creation. All the shape objects (elements) are very useful in creating any conceivable shape or animation. I found the polygon and button elements to be very useful. The button element has events associated with it and actions can be taken when the events are triggered. The other important element is the morph feature which can be used for tweened animations. Another important aspect of ActiveSWF is the ability to manipulate shapes in the frames using show, modify, hide, replace, transform, etc. In my opinion these components are essential in animating shapes. Many built-in actions are provided which can be used to perform various functions. Some of them are to open a URL location, control the flash animation, etc. One powerful action is the capability to include ActionScript code which can be used to create highly customized animations. I have done my reading on ActionScript and based on what I know now I recognize the potential of using it in creating flash movie and ActiveSWF makes it happen by supporting ActionScript. ActionScript can be used to unleash the full potential of ActiveSWF in creating rich flash movies. The documentation is also very good in terms of explaining the usage of ActiveSWF. It was very easy to understand ActiveSWF after reading the documentation.

I generated the flash content dynamically from my C#.Net program. It was a breeze to write a program in C# to generate the flash content dynamically. I was also successful in generating the flash content from XMLPad. ActiveSWF helped me overcome the challenges I faced in dealing with dynamic flash content generation. Not only was I able to accomplish my goal of having a software to produce dynamic flash content but also got a lot in return in the form of various other features. I am particularly pleased with ActiveSWF because it is very easy to use; provide vast number of features, supports ActionScript, allows dynamic creation of flash content which in my opinion is the foremost powerful feature of ActiveSWF. I couldn’t find a single product that could produce flash content dynamically. I could not have imagined doing what I want to do without ActiveSWF. The sample I created is a testament of my statements. It took me less than three hours to create the flash animation. I am very excited about the next release of ActiveSWF which will support ActionScript 3.0. I recommend ActiveSWF to anyone, developer and designer alike, without any reservations. The possibilities of creating stunning and rich dynamic flash animations are unimaginable with ActiveSWF.

For more information please visit ActiveSWF website at http://www.activeswf.com/.


Please see below for the sample dynamic flash animation I created for this write up.


Thursday, July 10, 2008

Obfuscation

One of the things that has always made me nervous is the security of my .Net applications. I was apprehensive of the potential for someone to decompile my .Net programs. I have always wondered why Microsoft developed such a powerful framework and yet left it open to prying eyes. Why didn't Microsoft provide any tools (at least I am not aware of any tools) to protect the .Net assemblies? Well all is not lost. Thank goodness to 3rd party obfuscation and protection software. I used one such software to obfuscate my startup manager program and it worked out pretty good.

{smartassembly} is a great software to obfuscate .Net programs and assemblies. I used
{smartassembly} to protect my startup manager program. The user interface is very simple. The protection process is very intuitive. The software simplified the protection process by presenting the options in a straightforward and easy to understand manner. There are several options to protect the assemblies. I was able to obfuscate the control flow of the program and encode strings in my program. I was able to add extended protection to my program by adding incorrect metadata to confuse decompilers and to prevent decompilation by ILDASM.

One useful feature I found was the capability to embed dependent assemblies where in you could embed dependent assemblies in your main assembly. I was able to take and embed three of my assemblies into the main program and not have to worry about dealing with many assemblies during deployment and runtime. This greatly reduced the number of assemblies I had to deploy with my application.



The size of the obfuscated program was less than the original program. I tried to open the obfuscated program in ILDASM but the program would not open. This was due to an option I selected in {smartassembly} to prevent from being opened in ILDASM.

















I then opened the obfuscated program in Lutz Reflector. The obfuscated program opened but the program was obfuscated and decompilation of the program would be next to impossible. As can be seen from the screenshot strings, classes, methods are obfuscated and classes were automatically sealed. This level of obfuscation makes it very difficult to understand and decompile the program.




{smartassembly} is not just an obfuscator but also provides several extended protection and optimization features such as memory management, pruning to reduce the size of the assembly, compressing, dependency merging and resource compression. Using the string encoding feature I was able to obfuscate sensitive strings that reveal intellectual information. This is a good feature to prevent decompilation of strings that may contain proprietary information. My application uses a lot of resources where icons are one of them. I was concerned about the size of the application but by using the resource compression feature I was able to compress the resources in the application.

Overall not only was I able to achieve protection for my application very easily but also improved and optimized the code, size and performance. I wouldn't have it any other way. For additional information on
{smartassembly} please visit the website by clicking on the following link: http://www.smartassembly.com/

Wednesday, July 9, 2008

Startup Manager

Introduction

After many near sleepless nights I believe the time has come for me to publish the first release version of my newest software application. This is a moment to cherish as it turned out to be better than what I had expected. I will make the software application available pretty soon but before that I’d first like to talk about it.

This is obviously the first release of this software application but I feel that for a first release this is not bad at all. I will obviously add many more features and capabilities in the future releases. This software application will eventually be an all in one utility that will address all the needs of a computer user ranging from managing the installed programs to maintaining the computer itself. At the present moment this software application is a startup manager that allows a user to maintain and manage programs that are set to startup (run) automatically when a user logons to the computer. It is imperative to know what programs are going to run automatically so you can prevent unwanted programs from running automatically and potentially cause damage to your computer.

My objective in developing this software application was straightforward: simple yet powerful. Typically, it is a challenge to make a right blend of these two qualities. It is hard to make something powerful and not make it complex and lose its simplicities. Conversely, it is hard to make something simple and still have powerful capabilities. Simple is inversely proportional to Powerful. I have tried my best to get the mixture right in order to provide a rich user experience.

As can be seen from the screen capture below the application uses the latest Ribbon UI to give a professional look and feel yet making it easy for the user to work with the program. There are basically three sections in the application window. The topmost section is the toolbar section, the larger middle section is the startup list section and the bottom is the detailed information section. Let’s look at each of these sections one by one.




Toolbar

The toolbar section contains a toolbar with all the required commands to manage the startup programs. See the screenshot and the table below for the list of commands.



  • Add Startup Entry: Allows user to add a new program to startup automatically
  • Delete Startup Entry: Allows user to delete an existing startup entry
  • Disable Startup Entry: Allows user to disable a startup entry and thereby prevent the referenced program from starting automatically
  • Refresh Startup List: Refreshes the startup list
  • Run Startup Entry: Runs the program referenced by the selected startup entry
  • Hide Detailed Information: Allows user to show or hide additional information about the program referenced by the startup entry
  • Expand All: Expands all tree nodes
  • Collapse All: Collapses all tree nodes
  • Expand Selected: Expands the selected tree node
  • Collapse Selected: Collapses the selected tree node
  • Configure: Allows user to set startup manager settings

The “add startup entry” and the “configure” commands actually display a popup where the required information can be entered before the actual command is executed.

Startup List

The startup list section lists the startup programs and their associated information. See the screenshot below.

This list is grouped by the type of the startup entry. For instance startup programs for all users in registry are grouped separately from startup programs for the current user in registry. The tree nodes should be expanded to view the startup programs. Users can navigate the list and edit startup program list by clicking the drop down box on the node in the Run Command column. Optionally, users can perform a lot of actions such as delete a startup entry, enable or disable a startup entry, run a startup entry, etc. by invoking the commands from the toolbar.


Detailed Information

The detailed information section is provided to show additional information about the selected startup program in the startup list section. See the screenshot below for the information shown in this section.



Wrap Up

This program is different than others in the market because it provides a simple UI, consistent look and feel, single UI i.e., user does not have to navigate away to other windows to do a task, unified and organized view of information where user does not have to go back and forth between multiple controls. Of course, I plan to expand this application and add many other new useful desktop utilities in the future releases that will make this application even better. In the coming days once everything gets settled down and after I do some housekeeping then I will post a roadmap. In the meantime please leave your comments.


Demo