Sunday, November 27, 2011

Localization in WPF

Change App.xaml.cs as follows :

protected override void OnStartup(StartupEventArgs e)
{

CultureInfo culture = new CultureInfo("it-IT");
Thread.CurrentThread.CurrentCulture = culture;
Thread.CurrentThread.CurrentUICulture = culture;

FrameworkElement.LanguageProperty.OverrideMetadata(
typeof(FrameworkElement),
new FrameworkPropertyMetadata(
XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.Name)));

base.OnStartup(e);
}

Tuesday, April 12, 2011

Saving TFS credentials

Go to Control Panel\User Accounts\Credential Manager
Add windows credentials - put network address as your TFS server and your credentials.
That did it. VS2008 on windows server 2008 R2 did not ask for TFS credentials.
This thing also worked on command prompt too - I didnt have to provide credentials for "tf get"

For windows XP :
Go to Control Panel\User Accounts\Advanced\Manage Password - Add

If your machine does not show Add button , try this
1. Enable your "Protected Storage" service from services.msc
2. run secpol.msc Go to Local Policy -> Security Options -> Disable the policy "Network access: Do not allow storage of credentials or .NET Passports for network authentication"

Thursday, March 17, 2011

Using Magnifier in presentations

This is a must know for anyone who gives presentations.

Windows 7 has an awesome tool - magnifier (magnify.exe)
Heres how you can use it :
  • Windows logo key Picture of Windows logo key + Plus to zoom in
  • Windows logo key Picture of Windows logo key + Minus to zoom out, and
  • Windows logo key Picture of Windows logo key + ESC to exit.
Also, if you are showing code in Visual Studio, all you have to do is Ctrl + mouse scroll to increase or decrease the text size.

Sunday, September 19, 2010

Debugging Blogspot+Silverlight+Dropbox issue

I traced my browser calls when it loaded the demo silverlight app and I got the following:



Request URL:http://dl.dropbox.com/u/4186718/Nitin.Spike.XAPHosting.xap
Request Method:GET
Status Code:200 OK
Response Headers
Content-Type:application/octet-stream
Date:Sun, 19 Sep 2010 06:12:06 GMT
Server:dbws
accept-ranges:bytes
cache-control:no-cache
content-length:4379
etag:10n
pragma:no-cache
x-robots-tag:noindex,nofollow




The problem is that the Content-Type is application/octet-stream, it should have been application/x-silverlight-app. Okay so we know the problem, how do we fix it? I am using dropbox, are they suppose to push with correct content-type or do i need to configure it somewhere... I have asked this question in their forums...

Thursday, September 02, 2010

Testing Silverlight

Get Microsoft Silverlight




Okay it doesnt work, but i see a lot of people displaying silverlight content on blogspot. I wonder whats going wrong. I guess i am done using these free blog hosting sites... its time to move to my own blog - its expensive but i will get to control a lot of stuff.
Update: I have finally hosted my silverlight XAP on a paid host and it works. :)

Saturday, August 28, 2010

Enum extensions

Sharing these Enum extension methods I wrote yesterday.


using System;
using System.ComponentModel;

namespace Nitin.Spike.EnumExtensions
{
class Program
{
static void Main()
{
const Colors someColor = Colors.Red;
string description = someColor.Description();
if (someColor.HasDescription())
{
if (someColor.HasDescription("indicates stop", StringComparison.OrdinalIgnoreCase))
{
Console.WriteLine("Works");
}
}
}
}
public enum Colors
{
[Description("Indicates Stop")]
Red,
[Description("Indicates Nothing")]
Blue,
[Description("Indicates Go")]
Green
}
public static class EnumExtensions
{
public static string Description(this Enum someEnum)
{
var memInfo = someEnum.GetType().GetMember(someEnum.ToString());

if (memInfo != null && memInfo.Length > 0)
{
object[] attrs = memInfo[0].GetCustomAttributes(typeof(DescriptionAttribute),false);

if (attrs != null && attrs.Length > 0)
return ((DescriptionAttribute)attrs[0]).Description;
}
return someEnum.ToString();
}
public static bool HasDescription(this Enum someEnum)
{
return !string.IsNullOrWhiteSpace(someEnum.Description());
}
public static bool HasDescription(this Enum someEnum, string expectedDescription)
{
return someEnum.Description().Equals(expectedDescription);
}
public static bool HasDescription(this Enum someEnum, string expectedDescription, StringComparison comparisionType)
{
return someEnum.Description().Equals(expectedDescription, comparisionType);
}
}
}

Saturday, July 31, 2010

High Speed Internet


The first time I connected to internet was some 9 years back, I got my own internet connection around 8 years back, and at that point of time I used to get 56 Kbps speed, and today I have a 512 Kbps line.

Is this speed enough for me? Hell no.. why not? because even today I can’t watch my videos directly off the web. Although I can watch low quality videos online, but now I want HD quality. I wonder if I will ever be satisfied with my connection.