Pages

Saturday, November 30, 2013

Project Type Guids for Asp.Net MVC

When adding MVC to an existing Asp.Net project, these are the Guids to be added to the project file. After adding these, the actions for adding Controllers, etc. will become available in Visual Studio. VS has to be restarted, though, to avoid strange exceptions.

 

GuidTools Needed to Open ProjectBuild references
{E53F8FEA-EAE0-44A6-8774-FFD645390401}Asp.Net MVC 3System.Web.Mvc 3.0.0.0
{E3E379DF-F4C6-4180-9B81-6769533ABE47}Asp.Net MVC 4System.Web.Mvc 4.0.0.0
{349c5851-65df-11da-9384-00065b846f21}Web Designer

Asp.Net MVC Project Guids | Chris F Carroll

Friday, November 29, 2013

Issues With DateTime Globalization

Background:
  • What's wrong with DateTime anyway? (link)
Libraries:
  • for .Net: NodaTime

DateTimeOffset does not help you with Daylight Savings Time!

This one is often a source of confusion. DateTimeOffset data type has been introduced to SQL Server but it is only a try (at best) to help out with TimeZone issues. It only contains the (numerical) offset from UTC but, as many know, that offset changes throughout the year. This is known by Daylight Savings Time (DST) and is in effect at different times at different regions in different years. The whole concept is getting obsolete as of late but it is still there and we have to live with it.

Check Jon Skeet's answer below and also have a look at NodaTime library that has a better implementation for working with TimeZones, offsets, and daylight savings.

c# - How does DateTimeOffset deal with daylight saving time? - Stack Overflow

Tuesday, November 26, 2013

Using LiveReload plugin with DocPad

LiveReload plugin for DocPad updates the web page, being previewed in a browser, when a change happens in its source code. This is pretty convenient when adding content as it removes boring and repetitive work, and provides immediate visual feedback, preventing possible missteps.

The missing link to having LiveReload working is to have the "styles" block enabled in the template.

Reference: Beginner Guide | Getting Started | DocPad - Streamlined Web Development

<%- @getBlock("styles").toHTML() %>

Monday, November 25, 2013

Tips for working with Report Server (SSRS)

Below are some tips for working with SQL Server Reporting Services. The tips are absolutely necessary as almost every step, in case the report has any complexity, is slow and painful, and often unintuitive.
  • reporting services - How to get rid of blank pages in PDF exported from SSRS - Stack Overflow -set ConsumeContainerWhitespace to True
  • How do I best display CheckBoxes in SQL Server Reporting Services? (link) - use Webdings 2 font; or HTML source
  • Working with Dates stored as UTC - convert using SQL CLR UDF (link); access timezoneinfo from SQL (link);
  • Related links: TZI in SQL CLR (link), Issue with NodaTime in CLR (link), second (link), Enabling CLR in SQL Server (link), Create CLR Functions (link), Create and run CLR function (link); download SSDT (link); set database Trustworthy (link)
  • Another way of converting Dates is to convert them at the Report level. This leads to a different set of problems, like inability to use deployment from Visual Studio. Add code to a report (link), deploying assemblies (link) and one more (link), Using System.Core: Resolve issues with System.Core version (link). After adding a reference to System.Core the problems arise. Version 4 can not be used, hence a reference must be changed to 3.5.0.0. This breaks Deployment from Visual Studio. Manual upload will work and the report will run.
  • Setting visibility of a textbox
=IIF(First(Fields!Street2.Value, "AddressDataSet") is nothing or
First(Fields!Street2.Value, "AddressDataSet") = "", true, false)
  • Format date/time (link). Use =Format(value, "dd/MM/yyyy HH:mm").
  • Pass a parameter in URL (link). Simply add another key/value pair, such as "&key=value".
  • Rendering HTML (link
  • Set OverwriteDataSources property for objects at the Project level.

Wingdings and Webdings printable character map

Below is a link to the PDF version of the printable character map for symbol fonts in Windows. Thanks to Bruce Gabrielle, the author.

wingdings-webdings-character-map-speakingppt.pdf

Sunday, November 24, 2013

From Word to PDF using LibreOffice

Problem

Here I will put together links and tips on how to handle the following scenario. I need to produce a PDF documentation from a set of Word files in .doc and .docx formats. These have some content that changes and, to handle that, I would create a "template" file where the content would be adjusted on the fly. Then the documents would be converted to PDF format for distribution. Details on implementation are below.

Working with Template Files

Template files are just formatted text files. These can be .docx, .doc, or .odt formats. Custom tags are inserted into the file originally, and then replaced when the custom output is required. The purpose is to have a visual designer for documents and also a system that is easily customizable but, at the same time, easy to read and manipulate by a machine.

Word

Word XML (.docx)

There is a library for working with .docx format, for .Net platform:

Word (.doc)

These files can be read using MS Office or Libre Office.

Open Document Format (.odt)

  • Writer Demo using CLI link.
  • AODL library for manipulating .odf documents.

Direct Manipulation

While reading the template files can be done using native libraries, the templates are simple enough for a quick find/replace functionality of the plain text. Both .docx and .odt are, in fact, Zip compressed collection of XML files.
  • Zip packages are supported directly by the .Net Framework, using ZipPackage class.
  • Zip files are accessible through ZipFile class.

Converting to PDF

Word files are converted to PDF using LibreOffice.
  • Earlier mentioned AODL library can export files as PDF.
  • CLI-UNO Language Bindings also can be used to export .odt files to PDF in .Net directly.
  • Converting Microsoft Word Document to PDF format using OpenOffice.org (Portable), on CodeProject link
  • HOW TO: Convert office documents to PDF using Open Office in C# (link
  • Programmatically convert Word (docx) to PDF, on StackOverflow (link)
CLI-UNO library is available with default LibreOffice installation and is (usually) found at
C:\Program Files (x86)\LibreOffice 4\URE\bin\cli_uno.dll

Additional References

Conclusion

There should be enough material here for the solution required at the beginning of the post.

Thursday, November 21, 2013

Creating shortcuts in Windows 8 Start Menu

The location for creating shortcuts to programs is
%appdata%\microsoft\windows\Start Menu\Programs\
Reference:
Creating your own Windows 8 Start Screen shortcuts (Tiles)

The location for Startup programs is
%AppData%\Microsoft\Windows\Start Menu\Programs\Startup
 

Ember.js Embedding in Existing Pages

There are a few important points when adding Ember.js to existing pages.

The most important ones are setting the application's root element, and disabling the URL handling.

Reference: Ember.js - Configuring Ember.js: Embedding Applications

Ember.js Quickstarts

There seems to be lack of Quickstart tutorials for Ember. You know, the kind of "do this, do that, and off you go", having a working Ember application with core concepts there. Ember.js documentation has made good progress and there are also other articles available that may do that job even better. Here are some links I found useful in that regard:
And a more detailed ones:

Wednesday, November 20, 2013

Ember Debugger for Firefox & Chrome

Ember.js addons/extensions available for Firefox and Chrome, either via direct download or through store.

tildeio/ember-extension · GitHub

Saturday, November 16, 2013

Firefox - the best browser of 2013

Firefox is back to being the best browser, according to Tom's Hardware. While performance is a cool thing to talk about, reliability is much more important for serious work. This is the area where Firefox really shines in the latest releases, when compared to the competition.

Reliability

During the 40-tab reload, the team assessed the reliability of each browser to ensure all pages had fully rendered. The results were surprising:

  1. Firefox loaded all pages correctly
  2. Opera 12 required four tabs to be refreshed
  3. IE10 required eight (and the browser crashed first time)
  4. Opera 15 required nine refreshes
  5. Chrome required twelve — 30% of pages were incomplete or incorrectly loaded

 

The Firefox gets the top place by having overall good results, not just shining in minority of areas.

Source: The 2013 Award for the Best Browser Goes to… - SitePoint

Friday, November 08, 2013

Removing (hiding) an Android device from Google Play

Here is the link to Settings page of Google Play, where the visibility of devices can be managed:

Google Play

It is getting annoying seeing one's old devices listed. Especially if they have an identical name! Like having a new Nexus, for example.

Tuesday, November 05, 2013

Use Visual Studio 2012 to edit Reports

Previously we had to have two versions of Visual Studio installed in order to edit reports. SSRS environment was based on the previous version of Visual Studio. Now, finally, there is something that enables Visual Studio 2012 (the latest stable version) to edit the SSRS reports.

Download SQL Server Data Tools - Business Intelligence for Visual Studio 2012 from Official Microsoft Download Center