15 June 2011

New in framework 4 - dynamic object

Below the previous post on framework 4 (Parallel) - time will demonstrate the new type object - "dynamic".

Dynamic object is built at runtime.
Unlike the previous version of the framework, when we received the object VAR - VAR built during Compilation, so that in fact we knew the type of object VAR in advance.
Dynamic does not know it's like you until it actually materialize.

Let's see an example


Please note that varObject already during Compilation does not give us continue to work because of that string is not int.
However, dynamicObject passes Compilation.


Here is the correct code - passing Compilation:

using System;
using
 System.Collections.Generic;
using
 System.Linq;
using
 System.Text;
namespace
 ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            var varObject = 1;
            Console.WriteLine("var object = {0}. the type is {1}",varObject,varObject.GetType());
            //var varObject = "1";
            //Console.WriteLine "var object = {0}. the type is {1}", varObject, varObject.GetType());
            dynamic dynamicObject = 1;
            Console.WriteLine("dynamic object = {0}. the type is {1}", dynamicObject, dynamicObject.GetType());
            dynamicObject = "1";
            Console.WriteLine("dynamic object = {0}. the type is {1}", dynamicObject, dynamicObject.GetType());
            Console.ReadLine();
        }
    }
}

Yours,
Roi

10 June 2011

Problem with stsadm addwppack command

Recently I came across an unfamiliar problem, when I tried to install web-part (stsadm addwppack command).
I ran the following simple command:

D:\>stsadm -o addwppack -force -globalinstall -url http://mySite -filename WP_Debloy.CAB

And the message I received:

This solution contains no resources scoped for a Web application and cannot be deployed to a particular Web application.

What the hell's going on?
After games of all kinds of trials, I got a solution: instead of running the command -url , I ran the command -nodeploy.
And I got the following message:

"wp_debloy.cab" has an unsupported extension, and cannot be added to the solution store.

So it's easy - Suddenly, the CMD is important for me to write in small letters (insteand of -filename WP_Debloy.CAB - You need to write -filename WP_Debloy.cab).
Yes... I got

Operation completed successfully.

Now I ran the command again with the-url command and everything went correctly.



Yours,
Roi