Wednesday, October 24, 2012

Visual Studio VS 2010 Crashes

Visual Studio VS 2010  Crashes

I experienced The Visual Studio 2010 crashes often today. Everytime I open a project, it was crashing. Searched the net but none of the solution really worked. I could open the VS 2010 but whenever I open a project, it was crashing.

Here are some solutions that may help:

1. Start the VS 2010 in administrator mode. Some recent changes or download may require it to install or update something and that may cause it to crash.

2. Check this lengthy list of q&a on MSN site (if you dont want to, this blog post tries to give the list of actions you can take)


http://social.msdn.microsoft.com/Forums/en-GB/vswpfdesigner/thread/2cfaf28f-80af-49ee-8408-07b4a8e0e964

3. Install latest WPF Toolkit

4. Install SP1 or whichever SP is latest for 2010 when you read this

5. This helped me - try uninstalling each Extension. In my case there were some Telerik Extensions that were causing this. Go to Tools > Extension Manager > and then uninstall the extensions by selecting them. Some of them may require you to uninstall from Windows Control Panel > Programs and Feature

6. Go to Start > MS VS 2010 > VS tools > Command Prompt

Go to folder C:\Program Files\MS VS 10> or whichever is your folder.

run devenv.exe /Log C:\yourlogfilename.txt

After the crash open the log file and see if there is anything that makes sense.

Pretty much Step 5 should help from above.


Wednesday, December 21, 2011

kendoUI - adding menu using web service

kendoUI is still in the beginning stages. Eventhough they have a commercial version there is quite a bit of functionalities needed before it can be fully used for a large application.


I am not sure what is the best practice for using each control and I would like to know this myself from @Telerik.  But here is an example of how to populate the kendoMenu dynamically using a web-service.


General approach is that each control/widget on the page should get the data from web-service. That way there is no server request. Now, our web-service can internally get the data from anywhere (database, xml file or any other appropriate way.) There will be a question about menu based on user-rights. But let's save that for later.


#1 - for now, let's assume that we have a web-service that has a function like following to return the menu details. 

    [WebService] //(Namespace = "http://WebService/")
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    [System.Web.Script.Services.ScriptService]
    public class WebService : System.Web.Services.WebService
    {
        [WebMethod]
        [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
        public List GetMenu()
        {
            List items = new List();
            items.Add(new MenuItem() { ParentTitle = "", Title = "Home", Link = "default.aspx" });
            items.Add(new MenuItem() { ParentTitle = "", Title = "Edit", Link = "edit.aspx" });
            items.Add(new MenuItem() { ParentTitle = "", Title = "View", Link = "view.aspx" });
            items.Add(new MenuItem() { ParentTitle = "Home", Title = "Login", Link = "view.aspx" });
            items.Add(new MenuItem() { ParentTitle = "Home", Title = "Profile", Link = "view.aspx" });
            items.Add(new MenuItem() { ParentTitle = "Home", Title = "Meetings", Link = "view.aspx" });
            items.Add(new MenuItem() { ParentTitle = "Home", Title = "Logout", Link = "view.aspx" });
            items.Add(new MenuItem() { ParentTitle = "Edit", Title = "Cut", Link = "view.aspx" });
            items.Add(new MenuItem() { ParentTitle = "Edit", Title = "Copy", Link = "view.aspx" });
            items.Add(new MenuItem() { ParentTitle = "Edit", Title = "Paste", Link = "view.aspx" });
            return items;
        }



#2 - we can declare our MenuItem class having all possible properties that we want to make use of in the front-end. We may want to have some unique id, or type of menu etc. but below is a simpler form of such menu item class.
    public class MenuItem
    {
        public string ParentTitle { get; set; }
        public string Title { get; set; }
        public string Link { get; set; }
        public string IconUrl { get; set; }
    }

#3 - the html can be as simple as 

Tuesday, December 20, 2011

calling asp.net (asmx) web service from jquery .ajax()

There is lot of information out there on this very topic but I got errors while implementing it and finally fixed it. So I wanted to post my findings with example. 1) When you create .Net ASMX Web Service, it will look like following: 

 [WebService] //(Namespace = "http://WebService/") 
 [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [System.ComponentModel.ToolboxItem(false)] 
[System.Web.Script.Services.ScriptService] 


 public class WebService : System.Web.Services.WebService 
 { 
 [WebMethod] 
  public string HelloWorld() 
 { 
 return "Hello World"; 
 }
}


Here the attribute in bold is very important. That indicates that this service can be called from the Javascript+ajax methods. 


You may see [ScriptMethod(ResponseFormat = ResponseFormat.Json)] attribute used for the Web-methods but this may not be necessary. At least when I ran the example I could run it successfully with and and without this attribute. Because the response format of the method will be determined based on the content-type used by the caller. Hence its important to set the 'content-type' from caller as below:


        $.ajax({
        type: 'POST',
            contentType: "application/json; charset=utf-8",
            url: 'http://localhost:1197/WebService.asmx/HelloWorld',
            dataType: "json",
            data: "{}",
            success: function(msg) {
                console.log(msg.d);
            },
            error: function(xhr, desc, ex) {
                console.log(xhr.responseText);
                console.log(desc);
                console.log(ex);
            }
        });

I was trying above example w/o 'contentType' and error function was called with 'parser error'. So having contentType in above is really important. 

Passing "{}" for data is not that important when your functions do not have any parameters. I could successfully call function w/o it, but if you get errors, you can try that.

Same for dataType: "json" - I commented it out and returned value was still interpreted as "json". I believe - again this is due to the contentType.



Tuesday, April 20, 2010

$telerik not found in IIS 7 windows server 2008

Of course, I don't understand Spanish. But following blog was helpful when I got the error installing a asp.net-telerik-web app on IIS 7, Windows Server 2008. The App was running fine in IIS 6, windows server 2003. When installed on 2008, on the client side, got javascript error that '$telerik' not defined, Type not defined etc.

http://msmvps.com/blogs/lalfaro/archive/2009/12/08/error-telerik-is-undefined-bajo-windows-2008-server-amp-iis-7.aspx

From above blog, I found that the entry under the system.webserver/handlers need preCondition="integratedMode,runtimeVersion2.0" for the Telerik entry. Once I added that the application ran fine.

Wednesday, March 17, 2010

Hotmail is painful

I still keep using Hotmail. But its very painful to use it:

- I wanted to delete some old email addresses - but in the contact list it will only show the name and not the email address. Hence you have to open the contact and then delete it; cant delete them from the list itself.

- when you type any email address in the [To] or [CC,BCC] boxes they are converted into some box with [x] next to it. You can't copy them any more and move it to one to another places like To->CC->Bcc etc. Also you cant simply use keyboard and update any addresses you have to use mouse to edit it.

Wednesday, March 3, 2010

Maps of War - Progress of Religion and War over time

Maps of War - Progress of Religion and War over time... very interesting flash graphics...
http://mapsofwar.com/images/Religion.swf

will iPad be Windows Killer

Here is a thought from young enterpreneurs that iPad could be Windows Killer.
http://ycombinator.com/rfs6.html

Rather than being Windows Killer, iPad will replace Windows machines for your day-to-day use. But Windows machines will still coexist mainly for business applications and much of the development. Businesses will keep using Windows Servers to host their applications. Developers will continue building their apps using .Net and such Microsoft platforms and Windows will remain favorite platform for development purpose.

With iPad people will be more interested in using web-baesd applications then iPad based applications. And to develop web-based applications you don't have to have Mac based systems. You can develop application in Windows and keep Windows/IIS/SQL Server as your back-end.

iPad will put a dent in Windows PCs market share, but the Microsoft will still make profit out of iPad. People will prefer to use Outlook Calendar and synching with Outlook on their iPad. Microsoft will develop Office tools (iOffice) for iPad which will sell more than iWork. iOffice should be made cheaper and should not be 100$ it should be like 10$ and may be free for a lighter version. Even Office Live with iPad can be a big hit.

And Microsoft will loose some customers in the beginning but will come back with iPad like tablets that run on entirely different OS rather than Windows. Microsoft has to realize that "Innovation takes place at Apple", but Apple has to realize that "Bussiness takes place at Microsoft".