Flickr favorites (12-29-2009)

Northern Lights over Sweden Welcome To Sweden ...christmas in Sweden Red house in Sweden Uppland,Sweden Stockholm, Sweden 062 - Lake Mälaren sunset - Little red boat

The images attached in this post are random selections from flickr.com and are not my work. You may need to obtain authorization from the owner on flickr.com before using them.


Flickr favorites (12-25-2009)

Balloons  on Sale at India Gate, New Delhi Cycle Rider & Pigeon on Rajpath. New Delhi Sunset in Delhi Bahai Lotus Temple in New Delhi Swaminarayan Akshardham Temple in New Delhi India Gate - Delhi

The images attached in this post are random selections from flickr.com and are not my work. You may need to obtain authorization from the owner on flickr.com before using them.


Server side conversion of UserControl to html

In order to get the html out of an ASP.NET control you can use the following code:

string pathToUserControl = "~/Controls/MyUserControl.ascx";
    
System.Web.UI.Page page = new System.Web.UI.Page();
System.Web.UI.UserControl control = page.LoadControl(pathToUserControl);
page.Controls.Add(control);
    
StringWriter writer = new StringWriter();
HttpContext.Current.Server.Execute(page, writer, false);
    
string renderedHtml = writer.ToString();

This method is mostly used to send the html back to the client browser using web services.


Flickr favorites (12-22-2009)

London Eye on Easter Sunday London Bridge (Tower Bridge) : Reflection on the River Thames Symbols of London Baker street 2 - New London edition (1B) London Routemaster Bus at Night London Underground Lift Tunnel Colors

The images attached in this post are random selections from flickr.com and are not my work. You may need to obtain authorization from the owner on flickr.com before using them.


Strongly typed view in ASP.NET MVC

When passing the model to MVC you have a couple of options.

Option 1: Passing un-typed model to the view

public ActionResult Product(string id)
{
    var product = new Product();
    product.ID = id;
    product.Name = "iPhone";
    ViewData["product"] = product;
}

In your view you have to cast the value in ViewData to the correct type as follows:

<%
    var item = (Product)ViewData["product"];
%>
<div>
    ID: <%= item.ID %>
    Name: <%= item.Name %>
</div>

Option 2: Pass a strongly typed model to the view

// ViewData["product"] = product;
ViewData.Model = product;

The Page directive of your view must specify the type it expects as follows:

<%@ Page Title="blah" ... Inherits="System.Web.Mvc.ViewPage<Product>" %>

Sometimes you may need to pass more than one object to the view. You can handle this by creating a new class that encapsulates all objects you need and pass an instance of that class to the view instead.


Icon Finder

Very cool website that allows you to find icons

IconFinder.net

The site uses AJAX and has icons of varying shapes and sizes. Check it out.


Flickr favorites (12-19-2009)

Milano o San Francisco? Blue Angels San Francisco Fleet Week 2007 Cable Car Waiting for a Green Light, San Francisco, California San Francisco Cargill Salt Ponds in San Francisco Bay Row housing, San Francisco

The images attached in this post are random selections from flickr.com and are not my work. You may need to obtain authorization from the owner on flickr.com before using them.


Access a share by it’s DNS alias name

On the DNS server

1. Open DNS
2. Create an A record with the name you want and the IP address of the server that you want to alias
3. Close out and make sure you can ping this new alias from another machine
4. If you cannot ping, refresh the DNS changes manually by using ipconfig /flushdns

On the Windows Server

1. Open regedit from Run or Command Prompt
2. Navigate to HKEY_Local_Machine\System\CurrentControlSet\Services\LanmanServer\Parameters
3. Add or Edit DWORD "DisableStrictNameChecking"
4. Change the value to 1

Restart the server. You should now be able to access the server using it’s DNS alias.


Flickr favorites (12-16-2009)

Paris Underground Gardens of Luxembourg. Paris.- Arc De Triomphe (Paris) in 1000 MegaPixels (Zoom in) Notre Dame de Paris Place du Tertre, Paris Paris spring

The images attached in this post are random selections from flickr.com and are not my work. You may need to obtain authorization from the owner on flickr.com before using them.


How to stop hotmail from opening Messenger

This issue has been bothering me for some time now and I have finally figured it out. Every time I check my hotmail, live emails, IE automatically starts MSN Messenger. It does not log me in, just opens it and sits there and I have to close it every single time.

Here are the steps to disable it:

1. Open Internet Explorer

2. Under Tools > Manage Add-ons, highlight “Windows Live” and click the Disable button (If Windows Live does not appear, change the Show drop-down to All add-ons)

3. Close Internet Explorer and login to hotmail again. Messenger should not launch anymore. It will show you an alert in IE about an add-on being disabled, just ignore it.