Saturday, February 19, 2011

gacutill

To install an assembly in the Global assembly cache (GAC) I simply used to copy the .dll into the assembly (C:\Windows\Assembly) folder; This was Windows XP.
On Windows 7 though, the drag and drop won't work, it can only be done by using the gacutil.
we can do this by running the command prompt as administrator navigate to the folder where the gacutil and type gacutl /i <assembly> like C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin> gacutil /i c:\myassembly.dll .
There is also Mscorcfg.msc (.NET Framework Configuration Tool)
You can also install dll into the gac using the windows installer. To install an assembly using the Windows Installer, create a new installer project and click on the menu View the File System. On the left hand side, right click and select "add global assembly cache folder", click on the GAC then in the right hand side click add. Browse to the assembly to be installed and compile the project.
This is probably most effective for windows applications and installations.

Monday, February 14, 2011

monodroid

Java was never my forte, I did some Java swing apps in college for academic purposes, and that was it, so I was kind of hesitant to try out Android development, I started off from this site http://developer.android.com/resources/tutorials/hello-world.html
Now there is this android development in .Net with C# :) http://monodroid.net/
and yes it can be done right from VS 2010 see here http://monodroid.net/Tutorials/Hello_World The thing is the process starts off with installing Android SDK and configuring a simulator and install the plugin see here http://monodroid.net/Installation

Mono for Android also offers the following:
  • The same OpenTK library popular among .NET developers on Windows, Linux, iPhone, allowing you to share the same OpenGL logic across platforms.
  • Support for the full JIT (unlike iOS)
  • Templates for C# (but other .NET compilers should work, if they reference MonoDroid's libraries).
  • Last, but certainly not least, MonoDroid is now supported on Mac OS X.
source : http://www.androidguys.com/2011/01/06/mono-android-open-developer-testing/

Friday, February 11, 2011

Custom Validator

There are two ways to use the custom validator, the client side validation and the server side. I think the server side keeps thing simple, I was using one on my form, and I intended to use it on the client side i.e. call a function in javascript with two parameters like

function validate(sender args)
{
      //validation code
      args.isValid=true; //or false
}
the validator itself has the OnClientValidate=validate()

I was saying the server validation does not slow thing its almost equal in time limit to the client validation.
The server side validation is similar have a validate function that returns isValid:

protected void validate(sender as Object, args as ServerValidateEventArgs)
{
//validation code
args.isValid = true // or false
}

I did put the validation into an update panel, like

<asp:ScriptManager ID="ScriptManager1" runat="server" />
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <asp:CustomValidator ID="CustomValidator1" runat="server" ErrorMessage="Error" ClientValidationFunction></asp:CustomValidator>
            <asp:CustomValidator ID="CustomValidator2" runat="server" ErrorMessage="Error" OnServerValidate></asp:CustomValidator>
....

Maybe that did something to the updation of the control 

Wednesday, February 9, 2011

Vanity GUIDs


Heard about Vanity GUIDs , Apparently these king of GUIds are ubiqu but have pattern to them embedded in their text . They can be used for Branded software (e.g., your company or product ID), Debugging (no idea) or humor read this article for more on C#411 . And you can see some code there to make them.
I foound a comment down there interesting
Mike writes:
You can't guarantee that a System.Guid will be globally unique either, to the point of it being fairly pointless using the Guid class to create a few billion GUIDs just to force retrieve what is essentially a manually created one anyway.
may god have mercy on your soul


Its usage might get a little offbeat.

Saturday, December 18, 2010

JavaScript and SilverLight

I was trying out some SilverLight usig the project Template from VS Web developer and I wanted to to spawn a simple alert .
To register JavaScript from MailPage.xaml.cs, you need to HtmlPage.RegisterScriptableObject("Page", this);
and use the HtmlPage.Window.Invoke("<jsfunctionname>","<parameter>")

and from JavaScript in Silerlightap...aspx add a function with a simple alert mesaage, a parameter can be used as well
 in xaml:
<Grid x:Name="LayoutRoot" Background="White">
        <TextBlock x:Name="text">text</TextBlock>
  </Grid>
If you have a TextBlock in xaml then that textblock can be accessed from the cs and by using the attribute
[ScriptableMember]   you can write a function to modify some text value the cs, and since its ScriptableMember the value can be passes from JavaScript.

I think the syntax in JavaScriot would be something like
document.getElementById('silverlightControl'); //get the control having a textbox
page.<cs function>(some value);
and this would have the value in the silverlight control

I had read somewhere about this and I cannot find it now, I will do a test ASAP

Wednesday, December 15, 2010

Content Editor WebPart

Is there a way to show an Image on top of the MasterPage of SharePoint portal
I think using a content editor webpart, we can add a div tag with style of position:absolute
like <div style="position: absolute; left: 10px; top: 10px; height: 400px; width: 100px; "><img src=... /></div>

I will try this and update...

Saturday, December 4, 2010

js Calender

This one is probably the best I've seen and has some cool features like multiple date selection, but the best feature it says on the site, that I liked is that it does not depend on any 3rd party library, I haven't tested it but it good on the site
http://www.dynarch.com/projects/calendar/
I downloaded the source, that has a really cool demo,
got to their downloads page http://www.dynarch.com/projects/calendar/download/
much more stuff at  http://www.dynarch.com/