What Technologies Should Every Software Developer Look At

I was recently asked to provide a list of technologies that might help developers become more current and help them decide what is important for their careers. I wanted to put together a list that was comprehensive, but that is just not feasible or practical. So let me throw this list out to you and get your feedback. [Lets not start a holy war of c++ vs. java vs. .Net vs. <insert language here>!]

I would really appreciate your honest feedback on what YOU consider to be important that is on this list or that I may have missed. My hope is to find a list of 10 technologies that you consider to be absolutely necessary for Software Developers to know in the coming years. They don’t have to be the list below, please feel free to add to this. Thank you. 

  1. F#
  2. Windows Azure
  3. Jaxer / Node.js / Narwhal
  4. CoffeeScript
  5. TFS / Git / Mercurial
  6. Design Patterns
  7. SQL Deep Dive
  8. Windows Phone 7
  9. Windows 8 Development
  10. Ruby on Rails
  11. XAML
  12. XNA Framework
  13. Parallel Framework
  14. Visual Studio 2010 Tips & Tricks (poll devs for tips)
  15. WPF / MVVM & MVPVM (Movel View Presenter ViewModel)
  16. How to debug using WinDbg & SysInternals Tools
  17. DSLs (in Boo or Otherwise)
  18. Machine Learning
  19. Windows Workflow
  20. Hadoop
  21. I-Phone programming
  22. Kinect Programming
  23. Silverlight
  24. HTML 5 Canvas Programming
  25. Powershell administration (managing servers etc would become much easier)
Tagged

Reporting In ASP.NET MVC 3

This past week I had a need to create a report for an ASP.NET MVC 3 app I was working on. The requirement for the report was to show charts of the data and to provide the original data using databars and indicators and output it to PDF. Not a very complex report at all. But somehow, there were some Goldilocks moments which I present to you now.

Telerik.Reporting – Too Cold

The first thing I tried was the Telerik Reporting solution. It was easy to do but the charting gave me some headaches. The main pain point for me was that it did not support Radius charts and there were no plans to add it. The other problem was with the way the reporting control (server side control) had to be used. Its as if they created it for regular ASP.NET and then hacked it for MVC. See example code here.

image

Aspose.Cells – Too Hot

Then I tried Aspose.Cells to generate an excel sheet and perform the necessary conversion to PDF. This tool was simple to implement but very tedious to get looking just right. I didn’t have a lot of time to spend on the reporting aspect and It felt like I was writing VBA. To be clear, Excel is inherently tedious to work on and Aspose.Cells is the best implementation of Excel I have ever seen. Not even Microsoft has a good implementation that just works (especially in a server environment). The main issues I ran into with Aspose.Cells was that indicators were buggy and would not work properly. The other issue was saving as PDF. It would save fine but the indicators and databars would not print in the PDF report. We use Aspose.Cells in other projects where we need to generate reports that are mostly excel files to allow for data manipulation. It works there and its awesome. However, for this project, it was just not right. 

At this point we started looking at using HTML 5 to generate the charts and just spit the data out on the page. But then we had the issue of taking an HTML page and converting it to a PDF. There are some tools out there that will do it but its not something I wanted to do.

Product Diagram of Aspose.Cells for .NET

Report Builder 3.0 – Just Right

I finally tried Report Builder 3.0. The UI is not the easiest to work with when trying to do styling etc. but it got the job done in record time and the report exported to PDF nicely. It worked. Pleased with this result I was ready to use the LocalReport ability (‘Represents a report that is processed and rendered locally without connecting to a report server’) to render the report in the MVC Controller and stream the PDF file as a result of the Controller method.

The problem is that Microsoft in its infinite wisdom has not enabled that functionality for reports created in Report Builder 3.0.

imageimage

Why in the world would such a useful functionality be crippled on purpose? There must be a workaround!

Stackoveflow was checked but did not help. Changing the report type by modifying the xml does not render it useable. Then I came across this link which stated:

The reports that are created with ReportBuilder 3.0 use the RDL 2010 schema but the ReportViewer in local mode can only process/render reports that use the 2005 or 2008 schema. If you publish the 2010 report to a report server and use the ReportViewer in remote mode you can render the 2010 RDL Report.

So I had to find another way around this issue. I had to use a Report Server to host the report.

Then I could use the WebClient class to request the report via http. The URL I used was:

http://<SERVER_NAME>/ReportServer_SQLEXPRESS?%2fGAP%2f<REPORT_NAME>&rs:Command=Render&rs:Format=PDF&rc:Toolbar=false&rc:Parameters=false&<PARAM_1>=<VALUE>

Notice that there are some things you have to replace in the URL above. Also note that ‘ReportServer_SQLEXPRESS’ is being used. This is because the instance is running off SQL Express and not the full blown SQL 2008 R2 which you should used in production. And that ‘Format=PDF’ will render the report as a PDF.

 

So, to conclude, Report Builder 3.0 was the easiest to use to build the report and generating the PDF from the report was also simple to accomplish. Report Builder supports many different styles of charts and data displays much like Excel. I’m now going to push Report Builder for all our reports considering the ease with which they can be modified and just how easy they are to use. I could put the data on the report and give it to the designer to prettify.

Also, in case you did not know this, Microsoft SQL Server2008 R2 RTM – Express with Advanced Services is a fully functioning SQL SERVER 2008 database with all the trimmings.

  • Same database engine as other versions of SQL Server.
  • Supports 10 GB of storage per database.
  • Backup and restore with ease.
  • Compatible with all editions of SQL Server and SQL Azure.
  • Designed to work with Visual Studio and ASP.NET.
  • Available with a graphical management tool.
  • Offers reporting capabilities, full-text search, and spatial support.
  • Tagged , , , , , , , , , , ,

    Presentation Slides – An introduction to F#

    On Saturday 5th November 2011, I presented a talk on F# and Functional Programming at Desert Code Camp. It was my first time at DCC and I must admit I thoroughly enjoyed interacting with people who enjoy technology and learning new things like me.I got to meet some great attendees and speakers. Lets not forget the immense time and effort given by the volunteers and organizers of Desert Code Camp as well.

    I think the best part of my speech was getting people excited about F# and hearing the wows and praises for F# and my presentation after. You guys rock!

    Also, congratulations to the two F# book giveaway winners.

    I wanted to post the presentation slides for anyone who wanted it. I have tried to add the sample code to the presentation slides as well. Feel free to contact me if you have any questions.

    An Introduction to F# – Sushant Bhatia (.PPTX)
    An Introduction to F# – Sushant Bhatia (.PDF)

    Edit: The presentation is not looking nice in Google Docs. I will try and get a PDF of the entire presentation up tonight. It should also contain the notes that I put so that you can try out the code.

    Tagged , , , , ,

    ASP.NET MVC Caching Dynamically generated JavaScript

    One of the things you may occasionally have to do while using JavaScript is show dialogs and react to your users inputs. These could be in the form of alert boxes that are built into the language, growls, loading panels or even just a message added to an element. (Side note: The jQuery BlockUI plugin seems very promising).

    The discerning user would realize that a website that targets a global audience has to be able to localize, globalize and internationalize to their language and a good starting place is to look at Scott Hanselman’s post on this very topic.

    Globalization, Internationalization and Localization in ASP.NET MVC 3, JavaScript and jQuery – Part 1

    One hacky way to get localized strings in JavaScript when they are in separate files is to have a localized file with all the localized text in it. Then based on the users language preference, load up the appropriate file and use the strings from there. But what if the strings come from a database and you need to generate this at runtime to be able to handle change without deployment again. Well here is how you can do it.

    Read the article on JavaScriptView by elegantcode for more details. However, to summarize here are their steps:

    1. Create a controller method that return the view as a JavaScriptFileResult preferably in your home controller.
    2. Create a view that contains the localized strings in an array. I used a helper method to get the contents from the database dynamically. You may wish to add this to your home controllers view folder as well.
    3. Add a script block in the shared layout’s header to the URL for the JavaScript file.

    All well and good. The file will now come down with the rest of the content as a JavaScript file and you can use the array of localized strings in your other JavaScript code.

    BUT! The one problem you may notice is that the JavaScript source file is retrieved every time a request is made to the server. Thus you will need to cache it. To do so, we just need to add the OutputCacheAttribute onto the controller method that returns the JavaScript file.

    [OutputCache(Location = System.Web.UI.OutputCacheLocation.ServerAndClient, Duration = 900, VaryByParam = "none")]

    The only problem here is that the VaryByParam is set to none. That’s because we don’t have any parameters being passed into the method. This is a problem because two different requests can come in for varying locales and now the second one may get the cached value of the first one. Therefore, we need to pass in the locale as a parameter and then VaryByParam on that field. This will ensure that every locale has the file cached and changes made can go out without requiring a deployment of files to the server.

    JsConstants

    The script block in the _Layouts.cshtml file.

    <script src="@Url.Content("~/Home/JsConstants?lcid=" + System.Threading.Thread.CurrentThread.CurrentCulture.LCID)" type="text/javascript"></script>

    But of course, who wants to keep sending these Id’s over all the time for all our script files. So, the easiest way to do this would be to create an identifier that can be used to check language automatically. And then we can write, “lang” in the VaryByParam attribute option and remove the lcid parameter from JsConstants.

    [OutputCache(Location = System.Web.UI.OutputCacheLocation.ServerAndClient, Duration = 900, VaryByParam = "lang")]

    The code to make this work is as follows. [Sorry but I’m not quite sure where I found this gem from]

    public override string GetVaryByCustomString(HttpContext context, string value)
    {
    	if (value.Equals("lang"))
    	{
    		return Thread.CurrentThread.CurrentUICulture.Name;
    	}
    	return base.GetVaryByCustomString(context,value);
    }

    fidllerJsConstants

    As you can see from the image above, the first request for the JsConstants file containing the JavaScript returned 918bytes of data. Whereas, the subsequent call returned 0 bytes. The raw message returned reads as follows:

    HTTP/1.1 304 Not Modified
    Cache-Control: private, max-age=863
    Expires: Sat, 03 Sep 2011 22:57:26 GMT
    Last-Modified: Sat, 03 Sep 2011 22:42:26 GMT
    Vary: *
    Server: Microsoft-IIS/7.5
    X-Powered-By: ASP.NET
    Date: Sat, 03 Sep 2011 22:43:03 GMT

    This indicates that we are able to cache the contents of the JavaScript file that was being generated dynamically and it will be refreshed after the Duration we set (900).

    Happy Coding.

    kick it on DotNetKicks.com

    Generating Object Classes from XML

    I ran into a need for generating classes that xml data can be deserialized into. I generally write this myself but today, I needed to do it faster.

    Along came the Visual Studio XSD tool.

    Open a VS command prompt.
    Type ‘xsd file.xml’. This will generate a file.xsd.
    Then type, ‘xsd file.xsd /classes’. This will generate a file.cs file that you can then use to deserialize into.

    For more details, check out this cool link http://sharpertutorials.com/using-xsd-tool-to-generate-classes-from-xml/

    Follow

    Get every new post delivered to your Inbox.