Saturday, June 25, 2011

AnkhSVN add-on a nice Subversion Support for Visual Studio

As all we know SVN is a nice and free source safe tool.

Similarly I was searching a free add in to Integrate SVN and Visual Studio.

AnkhSVN is a nice add on for subversion integration for Visual Studio. Best part is its free. I have seen VisualSVN, but that is licensed. We can visit the following URL and download AnkhSVN.

http://ankhsvn.open.collab.net/

Tuesday, February 22, 2011

Book : Expression Blend 4 with Silverlight

Foundation Expression
Blend 4 with Silverlight


By Victor Gaudioso

http://friendsofed.com/book.html?isbn=143022973X

http://www.amazon.com/Foundation-Expression-Blend-4-Silverlight/dp/143022973X

Book : ASP.NET MVC Framework Unleashed

ASP.NET MVC Framework Unleashed By Stephen Walther

http://www.informit.com/store/product.aspx?isbn=0672329980

http://stephenwalther.com/blog/category/11.aspx

Book : WPF Good book

WPF 4 Unleashed

http://www.informit.com/store/product.aspx?isbn=0672336553

Wednesday, February 9, 2011

What happens when user click .NET assembly (EXE)?

When you double click on a .net .exe assembly

  • Windows' PE (Portable Executable) loader kicks in



  • If you're on a Windows >= Windows XP it will detect that the executable is a managed executable and will forward it to .net by calling _CoreExeMain in mscoree.dll (_CoreDllMain if you double clicked on a managed .dll). It can use the assembly configuration file to know which runtime to use.



  • If you're on Windows < Windows XP, the .exe file contains a small native piece of code that will jump to mscoree.dll's _CoreExeMain or _CoreDllMain.



  • Then mscoree.dll initializes the .net runtime, depending on the global configuration, the assembly configuration file, and what not.



  • Then if it's a .exe, it will JIT compile its entry point method, and start executing it.




  • Reference :
    http://stackoverflow.com/questions/2788270/what-happens-when-user-click-net-assembly-exe

    http://maneshjoseph.blogspot.com/2010/10/what-happens-when-you-click-on-net-exe.html

    Saturday, February 5, 2011

    Get the Image from a Image URL using C#.Net

    Following is code to Get the Image from a Image URL using C#.Net

    private Image ImageFromURL(string Url)
            {
                byte[] imageData = DownloadData(Url);
                ImageDetail imgDetail = new ImageDetail();
                Image img = null;
    
                try
                {
                    MemoryStream stream = new MemoryStream(imageData);
                    img = Image.FromStream(stream);
                    
                   
                    stream.Close();
                }
                catch (Exception)
                {
                }
    
                return img;
            }
    
    private byte[] DownloadData(string Url)
            {
                string empty = string.Empty;
                return DownloadData(Url, out empty);
            }
    
            private byte[] DownloadData(string Url, out string responseUrl)
            {
                byte[] downloadedData = new byte[0];
                try
                {
                    //Get a data stream from the url
                    WebRequest req = WebRequest.Create(Url);
                    WebResponse response = req.GetResponse();
                    Stream stream = response.GetResponseStream();
    
                    responseUrl = response.ResponseUri.ToString();
    
                    //Download in chuncks
                    byte[] buffer = new byte[1024];
    
                    //Get Total Size
                    int dataLength = (int)response.ContentLength;
    
                    //Download to memory
                    //Note: adjust the streams here to download directly to the hard drive
                    MemoryStream memStream = new MemoryStream();
                    while (true)
                    {
                        //Try to read the data
                        int bytesRead = stream.Read(buffer, 0, buffer.Length);
    
                        if (bytesRead == 0)
                        {
                            break;
                        }
                        else
                        {
                            //Write the downloaded data
                            memStream.Write(buffer, 0, bytesRead);
                        }
                    }
    
                    //Convert the downloaded stream to a byte array
                    downloadedData = memStream.ToArray();
    
                    //Clean up
                    stream.Close();
                    memStream.Close();
                }
                catch (Exception)
                {
                    responseUrl = string.Empty;
                    return new byte[0];
                }
    
                return downloadedData;
            }