Monday, July 23, 2007
YouTube role grows as U.S. election nears
Democratic U.S. presidential candidates (L-R) Hillary Clinton, John Edwards, Dennis Kucinich, Maurice Gravel, William Richardson, Barack Obama, Christopher Dodd and Joseph Biden take part in a candidates forum at the NAACP annual convention in Detroit, Michigan July 12, 2007. YouTube members are uploading video questions for upcoming CNN/YouTube debates.By yesterday evening, more than 1,700 videos had been put on YouTube's site for tnights debate among Democratic candidates. Now thats what i call Technology influencing Mankind.......or lets say influencing politics
Monday, July 02, 2007
IObjectReference interface.
Here's an example showing how it can be used:
[Serializable]
class S : IObjectReference
{
int i;
static S S5 = new S(5);
S(int i) { this.i = i; }
public static S Get(int i) { return (i == 5) ? S5 : new S(i); }
#region IObjectReference Members
public object GetRealObject(StreamingContext context)
{
return Get(i);
}
#endregion
}
Thursday, June 21, 2007
Indexing by integer: Array vs List vs Dictionary
So i just wrote something to check it. (See the results below:)
using System;
using System.Collections.Generic;
namespace ConsoleApplication1
{
class LookupPerformanceTest
{
static void Main(string[] args)
{
// ten million
int iterations = 10000000;
string[] array = new string[iterations];
List
Dictionary
int now = Environment.TickCount;
for (int i = 0; i < now =" Environment.TickCount;" i =" 0;" now =" Environment.TickCount;" i =" 0;" now =" Environment.TickCount;" i =" 0;" s =" array[i];" now =" Environment.TickCount;" i =" 0;" s =" list[i];" now =" Environment.TickCount;" i =" 0;" s =" dictionary[i];">
Results (running in Release mode)
Array population took: 94ms
List population took: 141ms
Dictionary population took: 719ms
Array lookup took: 15ms
List lookup took: 32ms
Dictionary lookup took: 593ms
Tuesday, May 29, 2007
Team System Unit Tests and Deployment Items
The files to be deployed with the tests have to be setup so that the tests can run successully on local machine and also on the build machine. Data files such as .cvs, .xml files etc. usually sits in the project directory along with everything all of the rest of my code files.
However the tests when run on the build machine fail because the files cannot be deployed to the "out" directory of the test results. I get a file IO exception – my .Xml file could not be located.
To make it work i had to do 2 things:
- I select my data files in the solution explorer, and look at the properties window. I can then find the "Copy to Output Directory" setting and change it to "Copy always".
- Secondly "DeploymentItem" attribute has to be applied to the items to be deployed other than the test assemblies.
You can use either absolute path or relative path to specify the location of the deployment files.
If you are using MSBuild and TeamCity for build, then you have to use a realtive path rather than the absolute path to make it work, because msbuild on the server uses relative paths as configured usually in the .build file.
To add a path for a deployment item please follow the following steps (as it is the easiet way to do so):
Select a test in the Test View window or in the Test Manager window.
Press F4.The Properties window for that test is displayed.
Click the Deployment Items property. An ellipsis (...) appears in the value column.
Click the ellipsis.The String Collection Editor dialog box is displayed.
Before the test is run, type a path to a folder or a file that you want to have copied to the test deployment folder. Press Enter and type additional paths to specify additional folders and files to be deployed.
Click OK.
Friday, May 18, 2007
Engadget's blunder
Thursday, May 10, 2007
Evaluating .NET/J2EE for your Enterprise Applications
I found a very good site which contains extensive materials designed to help you evaluate Microsoft .NET vs. J2EE application server technologies. It contains downloadable whitepapers, benchmark comparisons, and sample source code.
Evaluating .NET vs. J2EE
Well I am sold on .NET for a long time now. I hope the link above helps to make your decision easier.
Thursday, May 03, 2007
Microsoft Silverlight launched
If you’ve got the time, I’d recommend (though i havent done it myself yet, but i wil be doing it today evening) watching the Mix keynote video (warning it’s 2.5 hours). In this you’ll get an overview of Silverlight, the cross platform CLR, ruby in the browser, and some very, very cool demos.
You can download silverlight from Microsoft site.
Wednesday, April 25, 2007
Asynchronous Programming Model - 2.0
I have been reading about the Asynchronous Programming Model in Jeffrey Rithcer's book CLR via C#. I have really enjoyed reading it and i thought of writing something about it.
The Asynchronous Programming Model (APM), as implemented by Delegates, consists of three parts:
- BeginInvoke,
- EndInvoke and
- Rendezvous techniques.
BeginInvoke starts an algorithm, impelmented via a method, on a new thread. EndInvoke retrieves the result of that method. The Rendezvous techniques allow you to determine when the asynchronous operation has completed.
There are three different types of Rendezvous techniques you can use to retrieve the results of an asynchronous delegate invocation
1. Wait Till Completion
2. Polling
3. Method Callback
// a delegate for a method that takes no params and returns a string.
Scientists break internet speed record
Tuesday, April 24, 2007
Google vs. Microsoft: reality check
Why Google IS Afraid of Microsoft, Big Time
HIGHLIGHTS FROM THE ARTICLE:
Microsoft pummels Google in the “In-Game Advertsing” space. How? Google buys a small San-Fran company to meet the challenge. Microsoft buys the world-leader in the industry for In-game advertising.
Microsoft delivers a solid uppercut in Voice-activated local directory assistance. How? Google announces an experimental service that may not be available at all times and may not work for all users. (Cute) Microsoft acquires TellMe Networks. Heard of them? Most likely, you’ve been using them for the longest time. Almost half of all directory assistance calls are processed on TellMe’s voice platform, and roughly one in three Americans use Tellme every year to get things done.
Assertion that Microsoft's 'Dead' Doesn't Compute
QUOTES FROM THE ARTICLE:
“When a software runs more than 90% of the desktops on the planet — and will for the foreseeable future — it's simply not dead.”“Windows runs on the vast majority of desktops in the world; Linux and OSX make up less than 10% combined”(Microsoft) “…earned $12.6 billion after taxes in its last fiscal year.
Well this article was written by a guy who currently works for Microsoft (you might have guessed that) and is an ex-googler
Thursday, March 08, 2007
private void SetupBindings()
{
BindingList
new BindingList
orderBindingSource.DataSource = orderList;
BindingList
new BindingList
customerBindingSource.DataSource = customerList;
BindingList
new BindingList
employeeBindingSource.DataSource = empList;
}
Thus i reckon .NET winforms provide great support for databindings and it is one of the best options to use.
Wednesday, February 07, 2007
My new PC with Vista Ultimate
Windows Vista Ultimate is surely ultimate. It is mind blowing. my favourite key is the windows key and tab, to show multiple windows. The gadgets are obviously cool.
I arranged a short "Windows Vista Launch Event in Croydon". It was nothing official, i just named it as such. My collegaues came over to my palce after work and played around with vista. Even non technical guys are coming today evenning to have a look. Everyone's welcome to come and have a look.....
Saturday, February 03, 2007
Creating custom cultures in .NET
With CultureAndRegionInfoBuilder class you can define a custom culture that is new or based on an existing culture and region. You can specify the culture and region information for example the associated language, sublanguage, country/region, calendar, and cultural conventions to great detail by using specific CultureInfo and RegionInfo classes. The custom culture can also be installed on a computer and subsequently used by any application running on that computer.
I highly recommend using this feature in .NET to create custom cultures for the application.
Wolfgang Loder's Blog
His recent entries are:
Video about Rails and Django
Rails - worth the trouble?
Multiple Inheritance with C#
Online Conference AJAX
Check out his blog at:
http://wolfgangloder.wordpress.com/
Do have a read guys and let him know how do you find his posts.
Friday, January 12, 2007
Windows Vista and Office Developer launch - Jan 19-20, 2007
Tuesday, December 05, 2006
RegistrySecurity class
I was really impressed by the RegistrySecurity class. it represents the Represents the Windows access control security for a registry key.A RegistrySecurity object specifies access rights for a registry key, and also specifies how access attempts are audited. Access rights to the registry key are expressed as rules, with each access rule represented by a RegistryAccessRule object. Each auditing rule is represented by a RegistryAuditRule object.
This mirrors the underlying Windows security system, in which each securable object has at most one discretionary access control list (DACL) that controls access to the secured object, and at most one system access control list (SACL) that specifies which access attempts are audited. The DACL and SACL are ordered lists of access control entries (ACE) that specify access and auditing for users and groups. A RegistryAccessRule or RegistryAuditRule object might represent more than one ACE.
Monday, October 30, 2006
How cool is that
Heineken is to trial a tracking system which will tell it exactly where its beer shipments are, even in the middle of the Atlantic. The brewer has deployed the solution to track ten containers full of beer travelling from the UK and the Netherlands to its distribution centre in the US. The project, which it calls "The Beer Living Lab", uses triangulation techniques of both satellites and cellular base stations to locate exactly where the cargo is. The SOA-based architecture will also allow the creation of distributed data sources, rather than Heineken having to run a large central database.
Tuesday, October 03, 2006
Dynamically calling an unmanaged dll from .NET (C#)
Below is the code snippet for "Dynamically calling an unmanaged dll from .NET (C#)" from Jonathans blog on MSDN blogs:
To start and to refresh our memories, let's create a very basic C++ dll that does very little..... your code should resemble the following (check out my previous post for more info on this):
Header file
extern "C" __declspec(dllexport) int MultiplyByTen(int numberToMultiply);
Source code file
#include "DynamicDLLToCall.h"
int MultiplyByTen(int numberToMultiply)
{
int returnValue = numberToMultiply * 10;
return returnValue;
}
As you can probably infer from the function name, an int is passed into this function and it will return the number passed in multiplied by ten. Told you it would be simple.
Now comes the more interesting part, actually calling this dll dynamically from your C# source code. There are two Win32 functions that are going to help us do this:
1) LoadLibrary - returns a handle to the dll in question
2) GetProcAddress - obtain the address of an exported function within the previously loaded dll
The rest is rather simple. We use LoadLibrary and GetProcAddress to get the address of the function within the dll we want to call, and then we use the GetDelegateForFunctionPointer static method within the Marshal class to assign this address to a C# delegate that we define. Take a look at the following C# code:
static class NativeMethods
{
[DllImport("kernel32.dll")]
public static extern IntPtr LoadLibrary(string dllToLoad);
[DllImport("kernel32.dll")]
public static extern IntPtr GetProcAddress(IntPtr hModule, string procedureName);
}
class Program
{
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
private delegate int MultiplyByTen(int numberToMultiply);
static void Main(string[] args)
{
IntPtr pDll = NativeMethods.LoadLibrary(@"PathToYourDll.DLL");
//oh dear, error handling here
//if (pDll == IntPtr.Zero)
IntPtr pAddressOfFunctionToCall = NativeMethods.GetProcAddress(pDll, "MultiplyByTen");
//oh dear, error handling here
//if(pAddressOfFunctionToCall == IntPtr.Zero)
MultiplyByTen multiplyByTen = (MultiplyByTen)Marshal.GetDelegateForFunctionPointer(
pAddressOfFunctionToCall,
typeof(MultiplyByTen));
int theResult = multiplyByTen(10);
Console.WriteLine(theResult);
}
}
The only item worthy of note is the UnmanagedFunctionPointer attribute, which was introduced to version 2.0 of the .NET framework,
Monday, October 02, 2006
Using Settings in C#
There are two types of settings:
Application Settings
User Settings
Settings have four properties:
Name: The Name property of settings is the name that is used to access the value of the setting at run time.
Type: The Type of the setting is the .NET Framework type that the setting represents. A setting can be of any type. For example, a setting that holds a user preference of color would be a System.Color type.
Scope: The Scope property represents how a setting can be accessed at run time. There are two possible values for the Scope property: Application and User. These will be discussed more in this section.
Value: The Value property represents the value returned when the setting is accessed. The value will be of the type represented by the Type property.
Creating a New Setting at Design Time
You can create a new setting at design time by using the Settings designer. The Settings designer is a familiar grid-style interface that allows you to create new settings and specify properties for those settings. You must specify Name, Type, Scope, and Value for each new setting. Once a setting is created, it can be assessed in code using the mechanisms described later in this article.
To Create a New Setting at Design Time
In Solution Explorer, expand the Properties node of your project.
In Solution Explorer, double-click the .settings file in which you want to add a new setting. The default name for this file is Settings.settings.
In the Settings designer, set the Name, Type, Scope, and Value for your setting. Each row represents a single setting.
Changing the Value of an Existing Setting at Design Time
You can also use the Settings designer to change the value of a pre-existing setting at design time, as described in the following steps:
To Change the Value of an Existing Setting at Design Time
In Solution Explorer, expand the Properties node of your project.
In Solution Explorer, double-click the .settings file in which you want to add a new setting. The default name for this file is Settings.settings.
In the Settings designer, find the setting you want to change and type the new value in the Value column.
Changing the Value of a Setting Between Application Sessions
At times, you might want to change the value of a setting between application sessions after the application has been compiled and deployed. For example, you might want to change a connection string to point to the correct database location. Since design-time tools are not available after the application has been compiled and deployed, you must change the setting value manually in the file.
To Change the Value of a Setting Between Application Sessions
Using Microsoft Notepad or some other text or XML editor, open the
Locate the entry for the setting you want to change. It should look similar to the following example:
Type a new value for your setting and save the file.
Using Settings at Run Time
Settings are available to the application through code at run time. You can access the value of settings with application scope on a read-only basis, and you can read and write the values of user-scope settings. Settings are available in C# through the Properties namespace.
Reading Settings at Run Time
You can read both application-scope and user-scope settings at run time with the Properties namespace. The Properties namespace exposes all of the default settings for the project by using the Properties.Settings.Default object. When writing code that uses settings, all settings appear in IntelliSense and are strongly typed. Thus, if you have a setting that is of type System.Drawing.Color, for example, you can use it without having to cast it first, as shown in the following example:
this.BackColor = Properties.Settings.Default.myColor;
Saving User Settings at Run Time
Application-scope settings are read only, and can only be changed at design time or by altering the
To Write and Persist User Settings at Run Time
Access the user setting and assign it a new value, as shown in the following example:
Properties.Settings.Default.myColor = Color.AliceBlue;
If you want to persist changes to user settings between application sessions, call the Save method, as shown in the following code:
Properties.Settings.Default.Save();
Wednesday, September 20, 2006
Scotland Trip (15/09/2006 - 18/09/2006)
15: Edinburgh castle,
Hollyrood House, Edinburgh chapel
Authentic Fish and Chips.
16: Old town visit, dads office search, Royal botanical garden, Rosilln village and
chapel(The DaVinci Code Chapel), Authentic scottish beers and excellent food,
nightclub with champs.
17: Muselborough village and beach, John Muir Walk, Dad old house search,
Portobello beach, BenBradley, Champs discussion, Lots of beer.
18: Champs shopping. Mum shopping. Dad calling,I drinking.