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

Thursday, May 31, 2012

Type umlauts on Dvorak keyboard in Linux

Here is an article explaining how to enable typing German umlauts (and others) in Linux. This is so convenient. Now I can type umlauts straight from Dvorak keyboard layout.
Basically, in the keyboard layout settings, set the Compose key. In Fedora 18 Gnome 3.6 this is in Keyboard -> Shortcuts -> Typing.
I use Right Alt for this. And then type key combinations to get umlauts:
  • ä = compose, ", a
  • ö = compose, ", o
  • ü = compose, ", u
  • ß = compose, s, s
and so on. There are many other special characters that can be typed this way.
Source Article.

Windows Server Update Services

Here are some resources for setting up a Windows Server Update Services (link).

Windows Server Update Services (WSUS) enables information technology administrators to deploy the latest Microsoft product updates to computers that are running the Windows operating system. By using WSUS, administrators can fully manage the distribution of updates that are released through Microsoft Update to computers in their network.

Download WSUS 3.0 SP2 (link). WSUS Installation Guide (link).

If you get a message indicating that "IIS role or additional IIS role services must be installed", it is probably because your Windows Server IIS is missing IIS 6 MetaBase Compability role service.

After installation, I gave Read permissions on "c:\wsus" directory for Everyone so that any computer on the network could access the updates.

Clients

Configure client updates (link). Configure clients to use WSUS as the primary source of updates (link). Setting the clients that are not in the same domain is done by editing registry (link).

Create the key HKEYLOCALMACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\AU and add a DWORD value "UseWUServer" and set its value to 1.

Then in HKEYLOCALMACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate add keys WUServer and WUStatusServer, type String (Reg_SZ), and set them to the same value. That being the HTTP(S) address of your update server.

These settings are available as a .reg file on my Dropbox (link). You should adjust the URL to point to your WSUS server installation.

After client workstation restart, it automatically uses the WSUS server for Windows Update. The first time it checks for updates it will install a different version of Windows Update components. After that it will allow checking against a WSUS server as well as against Microsoft online update.

Administration

As an Administrator, you may want to clean the database ocassionally. This is done by removing superseeded updates.

A convenient way to download updates is to look at Needed updates. These are reported as needed by the clients.

The updates will download after they are approved (by default). This option is adjustable.

Enabling Java applets in Chrome on Fedora

To enable running Java applets in Google Chrome under 64-bit Linux (Fedora 17 x86_64) the following steps should get you going.

Install Java Runtime Environment. The version 1.7.0_04 uses the directories specified below. 

# mkdir /opt/google/chrome/plugins

# cd /opt/google/chrome/plugins

and then either

# ln -s /usr/java/default/lib/i386/libnpjp2.so

for 32-bit version (i586), or

# ln -s /usr/java/default/lib/amd64/libnpjp2.so

for 64-bit version (x64) of JRE. 

After this, go here to test whether Java applet support is successfully installed in Chrome.

Tuesday, May 29, 2012

Setting the default file handler in Gnome

Changing the default image viewer in Nautilus (default file manager in Gnome 3.4) is quite easy. Right-click on an image, select Properties, then go to Open With tab. Either select a different image viewer from the list there and click 'Set as default' or select a different handler by clicking 'Show other applications' button and searching for the desired application.

This process works if you want to change the default file handlers for any file type.