Friday, June 11, 2010

Fifa World cup 2010 kicks off today in South Africa

Fifa World cup 2010 kicks off today in South Africa. Yes, it is the first time Africa is hosting the tournament.
Looking forward to an entertaining month ahead and may the best team win.
Talk of favourites in this year's event, and names like Spain, Argentina, and England and of course the perennial favourites Brazil come up.

At our office, we did a mini Odds/Bets and I was lucky to bet on the following teams as favourites to win the tournament: Brazil, France, Paraguay, Nigeria and Australia.
At least I have Brazil on my pot :)

Wish you all the best and may the best team carry the cup!

Tuesday, June 08, 2010

Use Cookie-free Domains for Components

When the browser makes a request for a static image and sends cookies together with the request, the server doesn't have any use for those cookies. So they only create network traffic for no good reason. You should make sure static components are requested with cookie-free requests. Create a subdomain and host all your static components there.
If your domain is www.example.org, you can host your static components on static.example.org. However, if you've already set cookies on the top-level domain example.org as opposed to www.example.org, then all the requests to static.example.org will include those cookies. In this case, you can buy a whole new domain, host your static components there, and keep this domain cookie-free. Yahoo! uses yimg.com, YouTube uses ytimg.com, Amazon uses images-amazon.com and so on.
Another benefit of hosting static components on a cookie-free domain is that some proxies might refuse to cache the components that are requested with cookies. On a related note, if you wonder if you should use example.org or www.example.org for your home page, consider the cookie impact. Omitting www leaves you no choice but to write cookies to *.example.org, so for performance reasons it's best to use the www subdomain and write the cookies to that subdomain.

Ref: Please read here

Friday, June 04, 2010

Asp.net - Invalid postback or callback argument. Event validation is enabled using ‘

Asp.net - Invalid postback or callback argument. Event validation is enabled using ‘

This is a common Asp.Net error when updating List Box items on the client side.
I asked this question on stackoverflow.com (Click here).


Just reflecting on how many views people have had on this question, it seems to be a common issue most Asp.Net developers encounter.

Teaching Kids Programming

Follow some good work being done to teach Kids programming. Click here
The teaching material is all free!!!

Wednesday, June 02, 2010

Friday, April 30, 2010

Initialising log4net logging for Asp.Net web app

Some snippet below:

protected void Application_Start(object sender, EventArgs e)
{
XmlConfigurator.Configure();

log4net.Repository.ILoggerRepository repo = LogManager.GetRepository();
foreach (log4net.Appender.IAppender appender in repo.GetAppenders())
{
if (appender.Name.CompareTo("RollingFileAppender") == 0 && appender is log4net.Appender.RollingFileAppender)
{
var appndr = appender as log4net.Appender.RollingFileAppender;
string logPath = "MyApplication.log";
appndr.File = logPath;
appndr.ActivateOptions();
}
}

logger = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);

var configSource = new XmlConfigurationSource(ActiveRecordConfigStream);

Assembly assy = typeof([ParentAssembly]).Assembly;
ActiveRecordStarter.Initialize(configSource, assy.GetTypes());

logger.Info("My Application Starting...");
}

Tuesday, April 27, 2010

Creating custom .NET Exceptions in C#

public class XyzlException : Exception
{
public XyzlException (string errorMessage, Exception inner) : base(errorMessage, inner)
{}
}


You can pass in a custom error message to your new Exception type.

Just try it out...

Thursday, April 22, 2010

Using SQL Server CROSS APPLY to read XML segment

Here is an interesting code snippet:

declare @XML xml
set @XML ='<students>
<student name="Julius">
<subjects>
<subject name="Maths" score="90"></subject>
<subject name="Art" score="50"></subject>
<subject name="English" score="70"></subject>
</subjects>
</student>
<student name="Becky">
<subjects>
<subject name="Maths" score="90"></subject>
<subject name="Art" score="50"></subject>
<subject name="English" score="70"></subject>
</subjects>'
select ExpressionAlias.student_name,
ExpressionAlias.subject_name,
ExpressionAlias.score
From @XML.nodes('./students/student') Student (rowset)
Cross Apply
Student.rowset.nodes('./subjects/subject') Subject (rowset)
Cross Apply (
Select Student.rowset.value('@name','NVARCHAR(20)'),
Subject.rowset.value('@name','NVARCHAR(20)'),
Subject.rowset.value('@score','INTEGER')
) ExpressionAlias (student_name, subject_name,score)
Order By
ExpressionAlias.student_name ASC,
ExpressionAlias.score DESC;

Sunday, April 11, 2010

Wednesday, March 31, 2010

What the heck is SYLK File?

According to Microsoft:
A SYLK file is a text file that begins with "ID" or "ID_xxxx", where xxxx is a text string. The first record of a SYLK file is the ID_Number record. When Excel identifies this text at the beginning of a text file, it interprets the file as a SYLK file. Excel tries to convert the file from the SYLK format, but cannot do so because there are no valid SYLK codes after the "ID" characters. Because Excel cannot convert the file, you receive the error message.

I got the error message:
'SYLK: File format is not valid'
when trying to open a CSV file.

Apparently this is a known issue in Microsoft products.

Read more on KB323626

Tuesday, December 29, 2009

Geeks drive girls out of computer science

Interesting read on why 'girls' could be shying away from Computer Science!

Follow links below...

The stereotype of computer scientists as geeks who memorize Star Trek lines and never leave the lab may be driving women away from the field, a new study suggests.

Email this ArticleAdd to Newsvine


View article...

Friday, December 25, 2009

Season greetings

Wishing you happy holidays! Merry Christmas and Happy and Prosperous New Year 2010.

Thursday, May 28, 2009

"Cannot insert the value NULL into column '', table ''; column does not allow nulls. INSERT fails."

One useful system stored procedure is sp_helpdb. This stored procedure returns information about all of your databases on your server such as the size, owner, when it was created and the database settings. One issue that you may run into is that the stored procedure does not provide data, but an error occurs instead. The error that you receive is "Cannot insert the value NULL into column '', table ''; column does not allow nulls. INSERT fails."

Useful tips to fix this here

Wednesday, May 20, 2009

Stackoverflow DevDays, London Oct 2009

Hurry hurry, limited places for this opportunity to meet with Stackoverflow members in this 1 day event.

More details on Joel's site

See you there

Saturday, November 15, 2008

Server-side vs Client-side validation for ASP.NET web applications

What is validation?
In HTML 'Validation' is not a process, it is merely a concept. HTML simply offers client-side scripting and form-posting. With the web page disconnected, nothing will happen server side until the form is posted - after that nothing more can happen client side until a new web page (response) is received.
Client-side validation
Client-side scripting must occur before server-side scripting. 'Validation' then is a function of our code.
If our code uses client side scripting to validate, it must happen before the form post, if we use server side code to validate it must happen after the form post.
This obviously gives the option of using the client side scripting to cancel the form post if our validation routine is not satisfied.
In .Net Microsoft offered a wizard to generate validation scripts (the validation controls), but this merely generates code as explained above.
Client-side validation is fundamentally flawed in that the 'client' which, strictly speaking is outside the applications control, is detailing whether something is acceptable or not. So, for example, the user might have a browser that does not fully support JavaScript and invalid data might be returned as valid. For this reason it is always recommended to use server side validation.
Server-side validation
Server side validation on the other hand can be very frustrating and with unexpected results. A user can submit a form, wait for long time for it to be processed, only to be told that it is invalid. For this reason we add client side validation to check the form before it is submitted, merely to enhance userability.

Friday, September 19, 2008

Stack overflow

This is a good one - launched early in the week.

http://stackoverflow.com

Main article in "JoelOnSoftware" website
http://www.joelonsoftware.com/items/2008/09/15.html

Enjoy!

Friday, July 25, 2008

Working in the UK

Hi folks,

I presently live in UK on a HSMP visa.
I look foward to new opportunities in this market.

I will be available to share my experiences whilst here.

Regards,

Julius

Thursday, February 21, 2008

Installing VSTS 2008

I had a chance to set up the VSTS 2008.

All I can share is that you need to follow the steps as outlined in this link

1. Ensure you meet all the pre-requisites
2. Ensure you follow the step-by-step guide to the letter
3. Enjoy the power of VSTS.

I love the Team Foundation Build, it makes automation of buids so basic. You have to try this!

Julius

Thursday, February 07, 2008

Upgrading a Database SQL 2000 to SQL 2005

Hey,

The main thing to remember is that in SQL 2000, users used to own the objects. A user and a schema were one and the same thing.

In SQL 2005, the schema owns the objects, and the user owns the schema.
Therefore, when upgrading from SQL 2000 to 2005, the user who owned the objects is automatically converted into a schema. You ahve to go an extra mile and create a new user in 2005 and link the user to the schema.

For more details please read on the links below...

http://www.sqlservercentral.com/articles/Administration/2987/

And tracking deprecated stuff in SQL 2005:

http://www.mssqltips.com/tip.asp?tip=1370

Enjoy!

New Features in Team Build 2008

Hi,

Nice article here:
http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2408

Regards,

Julius