TechnicalArchitectureWorx

The (Unofficial) ITWorx Technical Architecture Blog

Archive for the ‘El-Geish’ Category

Resolution for (Exception from HRESULT: 0x800736B1)

Posted by archworx on October 17, 2007

I got this error when I tried to use a C++ DLL, compiled by Visual Studio 2005 SP1, in a web application (ASP.Net 2.0):

“This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem. (Exception from HRESULT: 0x800736B1)”

This happens due to a lot of reasons, you can check them at: http://blogs.msdn.com/eldar/archive/2006/06/07/621501.aspx

The reasons in my case were:

1- The target C++ DLL depends on 3 DLLs: msvcm80.dll, msvcp80.dll, and msvcr80.dll version 8.0.50727.762. This is because the SP1 is installed on the development machine, while the production machine has these files but version 8.0.50727.42, thus, I installed Microsoft Visual C++ 2005 SP1 Redistributable Package (x86) on the production machine. You can get it from: http://www.microsoft.com/downloads/details.aspx?familyid=200B2FD9-AE1A-4A14-984D-389C36F85647&displaylang=en

2- My bad! I forgot to change the DLL’s active configuration to release, so you always have to check that before you deploy your application.

Posted in .NET 2.0, Configuration Management, El-Geish | 29 Comments »

Passing Parameters to Flex

Posted by archworx on August 16, 2007

Adobe Flex is a great way to do Rich Internet Applications (RIA). When you need to pass a parameter the flex flash movie, you can do that simply by adding a line in the generated script tag.

...
} else if (hasRequestedVersion) {
    // if we've detected an acceptable version
    // embed the Flash Content SWF when all tests are passed
    AC_FL_RunContent(
        "src", "Main",
        "flashVars", "i=15&employeeName=xyz", // add this line with the vars you want to pass
        "width", "100%",

...

Then, in flex, you can access this parameter as follows:

application.parameters.i

Posted in El-Geish, Flex | 3 Comments »

Testing Webservices with NUnit

Posted by archworx on July 1, 2007

Because NUnit is an exe and you sometimes you need to access web.config and objects that are only present in a web context, you will need to do the following:

– Open the command prompt and cd to C:\Program Files\Microsoft Visual Studio 8\VC, or in Visual Studio 2005 Command Prompt, type wsdl url (where url is the WSDL URL). A C# file will be generated with the name of the webservice. You can add some command line arguments to change the file name or the language. Just type wsdl without any arguments to show the help.

– Move the file to your test project and use it. It will call the webservice 🙂

There’s a great article about Implementing Service-Oriented Integration with ASP.NET .. check it out.

Posted in El-Geish, Unit Testing | 4 Comments »

Test Driven Development (TDD)

Posted by archworx on May 27, 2007

One of the basics in eXtreme Programing (XP) is to test any code that might break. In an approach to make life easier, developers wrote tests before writing the actual code!!

“It’s about figuring out what you are trying to do before you run off half-cocked to try to do it. You write a specification that nails down a small aspect of behaviour in a concise, unambiguous, and executable form. It’s that simple. Does that mean you write tests? No. It means you write specifications of what your code will have to do. It means you specify the behaviour of your code ahead of time. But not far ahead of time. In fact, just before you write the code is best because that’s when you have as much information at hand as you will up to that point. Like well done TDD, you work in tiny increments… specifying one small aspect of behaviour at a time, then implementing it.” – Dave Astels

The development cycle in TDD is called Test-Code-Simplify, and it looks like the following:

(“Extreme Programming Applied“, p159)

  1. Write a single test
  2. Compile it. It shouldn’t compile, because you haven’t written the implementation code it calls
  3. Implement just enough code to get the test to compile
  4. Run the test and see it fail
  5. Implement just enough code to get the test to pass
  6. Run the test and see it pass
  7. Refactor for clarity and “once and only once”
  8. Repeat

Posted in El-Geish, Extreme Programming | 1 Comment »

Edit and Continue

Posted by archworx on May 23, 2007

Source: http://msdn2.microsoft.com/en-us/library/bcew296c(VS.80).aspx

Edit and Continue is a time-saving feature that enables you to make changes to your source code while your program is in break mode. When you resume execution of the program by choosing an execution command like Continue or Step, Edit and Continue automatically applies the code changes with some limitations. This allows you to make changes to your code during a debugging session, instead of having to stop, recompile your entire program, and restart the debugging session.

Posted in .NET 2.0, El-Geish, Programming, VS 2005 | Leave a Comment »

F#

Posted by archworx on May 23, 2007

Source: http://research.microsoft.com/fsharp

Combining the efficiency, scripting, strong typing and productivity of ML with the stability, libraries, cross-language working and tools of .NET.

F# is a programming language that provides the much sought-after combination of type safety, performance and scripting, with all the advantages of running on a high-quality, well-supported modern runtime system. F# gives you a combination of

The only language to provide a combination like this is F# (pronounced FSharp) – a scripted/functional/imperative/object-oriented programming language that is a fantastic basis for many practical scientific, engineering and web-based programming tasks. 

F# is a pragmatically-oriented variant of ML that shares a core language with OCaml. F# programs run on top of the .NET Framework. Unlike other scripting languages it executes at or near the speed of C# and C++, making use of the performance that comes through strong typing. Unlike many statically-typed languages it also supports many dynamic language techniques, such as property discovery and reflection where needed. F# includes extensions for working across languages and for object-oriented programming, and it works seamlessly with other .NET programming languages and tools.

For further information, read about F# in more detail, download the F# distribution, read the getting started pages (a guide to installation and running your first program), go to the F# Manual, and learn about the growing F# Community. A short FAQ is also included on this site.

Some Starting points

Posted in .NET 2.0, El-Geish, Programming | 1 Comment »

Anonymous Methods in C#

Posted by archworx on May 23, 2007

In .Net v1.x, declaration of delegate required named methods. C# 2.0 introduced anonymous methods, as MSDN states, “Creating anonymous methods is essentially a way to pass a code block as a delegate parameter.

// Create a handler for a click event
btn.Click += delegate(System.Object o, System.EventArgs e) { MessageBox.Show("Click!"); };

This can be very useful in some cases such as a parameter to the Thread constructor:

new System.Threading.Thread(
  delegate()
  {
      System.Console.WriteLine("Hello");
      System.Console.WriteLine("World");
  }).Start();

Click here for more info.

Posted in .NET 2.0, El-Geish, Programming | 1 Comment »

‘My’ Namespace in VB.Net 2.0

Posted by archworx on May 23, 2007

For rapid development, Visual Basic .Net 2.0 introduced a namespace called My to access all the stuff that belongs to you like computer, network, printers, keyboard, forms, and others.

My Namespace 

For eaxmple, if you need to access the network, you just type: My.Computer.Network.

If My.Computer.Network.IsAvailable Then
    My.Computer.Network.DownloadFile("http://myserver.com/log.txt","c:\archives\serverlog.txt")
End If

Click here for more info.

Posted in .NET 2.0, El-Geish, Programming, VS 2005 | Leave a Comment »