Pages

Thursday, June 21, 2012

TortoiseHg (Mercurial) and Passwords

Using a remote repository usually involves passing the credentials from your Mercurial client (TortoiseHg) and the repository server. If you commit/pull often then it is a pain to have to enter username and password every time an access in attempted over network. At the same time, it is a no-no to store username and password in configuration files in plain text.
Mercurial Keyring is an extension that securely handles this. Additional configuration may be needed, as per this article (link) but changes in TortoiseHg and the extension itself may make these obsolete.

Wednesday, June 20, 2012

Changing home directory for IIS Express


If you want to bring your sites along when switching machines, or sync them via some cloud service, you can change the home directory for IIS Express. Home directory is where all the configuration for web sites is stored.

Changing the User Home Directory
IIS 8.0 Express supports changing the user's home directory, which is mapped to the %IIS_USER_HOME% variable in configuration. By default this path is located at %UserProfile%\Documents\IISExpress, but users can change this by setting a CustomUserHome registry property in HKCU\Software\Microsoft\IISExpress, or by specifying the "/userhome" parameter when launching iisexpress.exe.

From ReadMe (link).

Developer goodness - LocalDb

With SQL Server 2012 Microsoft has released a product named LocalDb.

"LocalDB is created specifically for developers. It is very easy to install and requires no management, yet it offers the same T-SQL language, programming surface and client-side providers as the regular SQL Server Express. In effect the developers that target SQL Server no longer have to install and manage a full instance of SQL Server Express on their laptops and other development machines. Moreover, if the simplicity (and limitations) of LocalDB fit the needs of the target application environment, developers can continue using it in production, as LocalDB makes a pretty good embedded database too." 
Currently available for download from here.
A few things to note, though. LocalDb can be installed only on OSes above Windows 2000. It requires SQL Native Client which has to be installed separately. It can only be managed with SQL 2012 management tools which have to be installed separately. It supports only local connections through Named Pipes. The maximum database size is 10 GB.
All this seems good enough for development, or even minimalistic production setups, and is offset with the ease of deployment.

The connection string to use with LocalDb is "Data Source=(localdb)\v11.0;Integrated Security=true".

A few introductory articles:
  • Introducing LocalDB, an improved SQL Express (link)
  • What is LocalDB? (link)

Tuesday, June 19, 2012

Adding ASP.Net MVC 4 to Web Forms Project


This is probably not what you think. But, since I don't know what you think and that is irrelevant at this point, we can get down to business.

I've just added MVC 4 to an existing ASP.Net Web Forms project. There were a few quirks, especially with all the advice out there in regards to versions of MVC. So, here are some notes I wrote down during the process that can come in handy when performing the same exercise again.

Adding MVC 4

A great start is this article here. However, this relates to older version of MVC so some adjustments are necessary. The section that relates to adding items to the web.config, in particular. Basically, all the 3.5.0.0 versions need to be replaced with 4.0.0.0. The modified contents are here.

Adding Razor

If you are going to add new Views using Razor view engine, a Razor section needs to be added to web.config. In appSettings add this. Add the following code to appropriate sections (declaration in configSections add the Razor section itself) from here.
In Views directory there needs to be web.config. Check the contents here.

Friday, June 08, 2012

AutoFac, IoC Container for .Net

Autofac is fast and simple Inversion of Control (IoC) container for .Net. (link)

There is a tutorial on Code Project (link).

#dependencyinjection

Monday, June 04, 2012

Installing latest Redmine on Windows

Ruby is required for Redmine.

Ruby installer adds the following to the PATH:

C:\Ruby187\bin;

Steps

  • gem install bundle
  • gem install webrick
  • gem install rails

json package

json native package requires installation of DevKit.

http://github.com/oneclick/rubyinstaller/wiki/Development-Kit


cd <devkit_install_dir>
ruby dk.rb init
ruby dk.rb review
ruby dk.rb install

rmagick can't be installed on Windows. Use:


bundle install --without development test rmagick

Configuring Redmine


rake generate_secret_token

Running


ruby script/rails server webrick -e production