Bin Deploying ASP.NET MVC4 On Remote Server

I was planning to move my  web applications written in MVC3  to MVC4 but was reluctant to do so as my current host (Godaddy) doesn’t support MVC4. After looking here and there finally I managed to run MVC4 on Godaddy servers.

To do this you can follow similar steps for MVC4  too as mentioned by Phil Haack in his blog.  In short , the idea is to copy required MVC4 DLLs to the bin folder of the remote server :

  • Microsoft.Web.Infrastructure.dll
  • System.Web.Helpers.dll
  • System.Web.Mvc.dll
  • System.Web.Razor.dll
  • System.Web.WebPages.Deployment.dll
  • System.Web.WebPages.dll
  • System.Web.WebPages.Razor.dll

To find correct location of these dll’s, goto project right click –> references –> select the desired dll and make copy local property to true. You need to do this for all of the above dll’s.  After you are done with this step compile the application and you are ready to copy the files.  You can either do it manually or do it using deployment wizard.

Posted in .Net | Tagged | Leave a comment

Bulk Import Excel Data into SQL Server Using C#

Recently I got an assignment where I had to import 45 excel files into MS-SQL server all having save structure. Being a developer the very first thing that came to my mind is  to write a small script that can import all the excel files in a directory to MS-SQL. Since I write most of my housekeeping scripts in Linqpad, below script was also written using the same tool but it should work and can easily be integrated to Visual Studio with  minimal or no changes.

Script to Import Excel :

Above code should be self explanatory. Inside the loop for each excel file an OLDEBD connection is being created and excel data is being read using a DataReader object. After this bulk copy operation is performed for faster data insertion.

Posted in .Net | Tagged , | Leave a comment

PHP CMS which is sophisticated, lightweight & simple

Stumbled upon this CMS named Bolt which says that it is very simple lightweight and straightforward. Bolt has been developed using PHP, and uses either SQLite, MySQL or PostgreSQL as a database. It’s built upon using Silex framework together with a number of Symfony components.

bolt-cms-showcase

Promising thing which looks here is the feature of Content Templates which means with slight configuration this CMS can render any kind of data defined in Templates. Other important thing is the extensibility which can be done using Bolt Extensions.

Will post more detail after playing with Blot.

Links :

Bolt CMS     Showcase     Documentation

Posted in Uncategorized | Tagged , | Leave a comment

Jsoup – A better HTML parser than HTMLAgilityPack

After using HTMLAgilityPack for a long time I finally switched to Jsoup.  Jsoup is better in parsing HTML and best thing is that it supports Jquery like selectors to select elements with ease. Many a times I have noticed HTMLAgilityPack fails to extract correct data. For example while extracting meta keywords and description information for a website built using ASP.net it usually fails because of some extra spaces added by Master pages.

How to bring Java written Jsoup to .Net world?

Solution is very simple. Jsoup can very easily be complied to .Net library using IKVM.Net. Although you will be required to use IKVM.NET VM to run Jsoup library but since last one and half years I haven’t seen any issues because of this. It was able to achieve almost every task where I was utilizing HTMLAgilityPack library. There is a little learning curve while switching to Jsoup but it is more beneficial. One more point to add that Jsoup comes with a good list of examples and selectors to make you life easy.

Because of licensing and distribution issues I am not putting  .Net compiled Jsoup here. If you are having problems converting just drop me a word.

C# Snippet using Jsoup

Links : 

Posted in .Net | Tagged , , , | 3 Comments