Dev Buzz #2 - Bookmarks - 1 JUL 2013

1. July 2013 21:11

Devbuzz 

 

Awesome Stuff

Web Development

JQuery

Open Source

  • Attribute Routing – Attribute based routing library for MVC and Web APIs
  • LessCSS – The dynamic stylesheet language
 No Rating

MSDN Style Syntax Highlighting In ASP.NET

30. June 2013 01:03

ASP.NET 

There are many syntax highlighting plugins available on the web right now. Majority of the sites are using javascript based Syntax Highlighter from Alex Gorbatchev. I am using it for my current blog and BlogEngine.NET has it as a default syntax highlighter. It is good because it has a lot of themes to offer and you can also customize according to the look and feel of your blog or site. Moreover it has support for multiple languages which makes it acceptable among most of the bloggers and developers.

I also like the way MSDN and Codeplex style their code. Although it has some flaws like moving the code to the next line if it exceeds the length of the pre or div tags. The library MSDN and Codeplex are using for syntax highlighting is ColorCode. ColorCode is open-source and supports every language specific to Microsoft. The way ColorCode works is totally different than that of any other syntax highlighting library. Javascript based syntax highlighter use CSS for different styles whereas ColorCode uses in-line CSS to  set styling for the code.

To install ColorCode you can use NuGet command or add ColorCode reference as a library downloadable from Codeplex. NuGet command:

PM> Install-Package ColorCode

Only Microsoft stack languages are supported by ColorCode. Here is the complete list:

  • XML
  • Java
  • JavaScript
  • SQL
  • C#
  • VB.NET
  • ASPX (C#)
  • ASPX (VB.NET)
  • C++
  • PHP
  • PowerShell
  • Typescript
  • FSharp

As I mentioned earlier that this library uses in-line CSS and therefore you cannot use it in the windows forms application. You can use the webbrowser control in windows forms application if you want code to render correctly.

This is a sample basic usage of ColorCode.

string code = File.ReadAllText(Server.MapPath("~/Test.txt"));
string finalCode = new CodeColorizer().Colorize(code, Languages.CSharp);
codediv.InnerHtml = finalCode;

First line of the code will read all the text from a file. The second line will initialize a new CodeColorizer class Colorize method which will take 2 parameters, first is the code for which we want the syntax highlighting for and the second parameter is language. I now have the finalCode string which has the code with syntax highlighting. This is the output I have in my browser window.

It looks pretty good from the front but behind the scenes it’s not that pretty.

ColorCode is an open-source library and is hosted on Codeplex.

Reference:

 No Rating

Getting Started With Glimpse In ASP.NET MVC

25. June 2013 22:43

ASP.NET ASP.NET MVC 

When I heard about Glimpse, I thought it like to be another MiniProfiler like stuff or a combination of MiniProfiler and this. But it seems to be more robust diagnostic tool for developers. Here is my experience with this awesome diagnostic tool.

What is Glimpse?

Glimpse is a diagnostic tool for ASP.NET applications which let you see detailed diagnostic information of your web application. Glimpse knows everything your server is doing and displays it straight away to you in your browser. Currently Glimpse is supported for ASP.NET – Web Forms and MVC and PHP and other languages are in queue as well. If you want to contribute to the project as it is open-source, you can contact the project developers here. The Glimpse project is still under development and there are more that 70 bugs reported at Github.

Getting Glimpse & Getting Started

I have used MiniProfile in the past and the major difference between the two tools I noticed is that in MiniProfile you have to make changes in the code to profile or view the diagnostic information. On the other hand Glimpse is just simply plug and play library. If you are going to give Glimpse a try make sure that you use NuGet to get the library. Glimpse comes with lots of configurations and setting them out manually in the application will be a pain just like ELMAH. As we are now living in post-NuGet era, we must use the power of NuGet to do all the hard work and configuration for us. You can get Glimpse depending on the type of project you have. To add Glimpse in MVC application fire the below NuGet command.

PM> Install-Package Glimpse.MVC

For Web Forms

PM> Install-Package Glimpse.ASP

After the command gets completed, take a look at the web.config file where you can see all the configurations. Without paying more attention to the configs, run the application to see Glimpse in action. Unlike MiniProfiler, there were no changes in the code. Before you can actually see Glimpse in action you have to turn it on, and to turn Glimpse on navigate to the URL http://localhost:XXXX/glimpse.axd 

A cookie is set when Glimpse is turned on. This cookie tells the server to send the diagnostic data to the application. Here is how it looks on my home page.

The above screenshot gives you a summarized information of what your application and server is doing. The summary part is distributed in three parts i.e. HTTP, HOST and AJAX. The HTTP segment shows the summary of the diagnostic information that flows over HTTP. In the HOST segment you can also see the name of the controller and action name. AJAX segment shows zero count as there are no AJAX call yet in my application which communicates with the server. This is just a summary which is visible at the bottom right hand corner of the web page. To view more detailed diagnostic information hover the mouse over any of these segments and you get one level more information.

If this is not enough for you then click on the big g icon at the bottom right corner.

The screenshot above just covering one tab out of 12 tabs which have complete diagnostic information about the application.

What else it can do?

Glimpse has extensions that will let you get information about EF, nHibernate, Ninject and many more. You can view the complete list of extensions here which you can use to see what these libraries are doing behind the scenes. Check out the complete list of extensions here.

Moving to production

Glimpse is a diagnostic tool and is very powerful from a developer’s perspective. When moving the website or web application to the production servers, no developer would want to leave Glimpse working on the landing page of your site. So before you move to production you have to turn Glimpse off. To turn off Glimpse you can navigate to the same URL which you have used earlier to turn it on. This is the easy option available, but anyone with the Glimpse handler URL can easily turn it on!? The best approach is to change the setting in the web.config file, so even if the third person has the URL of the Glimpse handler he will never be able to turn it on. To turn off Glimpse permanently set defaultRuntimePolicy to Off. The line in your web.config after the change will look like this.

<glimpse defaultRuntimePolicy="Off" endpointBaseUri="~/Glimpse.axd">

Once this property is set to Off, there is no way a user can turn Glimpse on without changing its value back to On. Glimpse has a lot more options to explore which I can’t cover in single blog post. I am looking forward on using some extensions now for Ninject and Entity Framework.

References:

 No Rating

Dev Buzz #1 - Bookmarks - 19 JUN 2013

19. June 2013 20:28

Devbuzz 

 

ASP.NET/MVC/Web

JQuery

  • JWERTY – Awesome handling of keyboard events
  • JustGage - JustGage is a handy JavaScript plugin for generating and animating nice & clean gauges
  • Spritely.NET – Best parallax plugin for jQuery
  • DropKick – A jquery plugin for beautiful dropdowns
  • Tipsy – Facebook-style tooltip plugin for jQuery

Visual Studio

Open Source

  • Windows 8 App design templates - More than 70 app design templates
  • MahApps – Make your WPF app look like Windows 8 app
  • MUI – Build Win8 like apps using this library in WPF
  • ModerUICharts – Modern UI (Metro) Charts for Windows 8, WPF, Silverlight
  • Dapper – A simple object mapper in .NET – Micro ORM
  • Mini-Profiler – A simple but effective min-profiler for .NET & Ruby

Misc

 


DZone’s Definitive Guide Helps You Make the Right Cloud Decision for Your Organization

Have you ever tried sifting through the hundreds of cloud solutions available in today’s market? There are so many categories of cloud providers that it’s hard to know if you’re researching the right one’s for your use case.

So how do you distinguish the contenders from the pretenders? Even if you have nailed down the type of cloud provider you need, you’re still facing a litany of choices.

The cost and time savings of choosing the right cloud provider can revolutionize your business and drive significant new profit, but the selection process is daunting.

DZone observed many developers and IT professionals struggling to find the right solution for their organization, so we decided to mount this unprecedented research project to create a definitive guide to cloud providers.

The result is DZone’s Definitive Guide to Cloud Providers:  Link (bit.ly/13LUWkX)

•       100 Pages of Cloud Solution Analysis

•       9 Categories of PaaS and IaaS Analyzed and Compared

•       35+ of the Most Active Cloud Solutions and Their Feature Sets

•       Research from 400+ IT Professionals on Cloud Preferences.

Get your FREE copy of this guide and make the best decision for your organization.

 No Rating

Developer Buzz (Dev Buzz) - Sharing My Bookmarks

16. June 2013 11:24

Musings 

Dev Buzz is an abbreviated form of Developer Buzz which will be a carrier of my bookmarks. There is no point of saving me a bookmark if I can’t share out with other developers (this is my thought on bookmarks). Therefore, from today onward I’ll be doing a blog post week or may be monthly to share by bookmark with the rest of you guys and moreover I have a huge collection of funny programmer pics which also accompany my bookmarks. Hope you all like this.

 No Rating