I enjoy reading from Brent Ozar.
I liked his review of Sql Server 2008 in his blog where he compared it with Lady Gaga's premier album The Fame and its sophomore.
Go ahead and have a read and enjoy
So I am a developer. Or should I say a web developer. I write code for a living. I love coding. I also love talking about it. Indeed we do find ourselves having to learn new technologies is a short spell of time. On this blog, I will try keep abreast with technological challenges. Join me in learning and sharing with the community our journey in coding.
Thursday, October 07, 2010
Using TRUNCATE_ONLY in SQL Server 2008
After upgrading to SQL Server 2008 from 2005, I got an error with one of my scripts. I am using Sql 2008 SqlExpress 10GB.
This is my T-SQL
And I get this error:
Msg 155, Level 15, State 1, Line 1
'TRUNCATE_ONLY' is not a recognized BACKUP option.
So I asked myself if there is an option similar to what 'TRUNCATE_ONLY' was doing in 2005?
I posted a query at Ask Sql Server Central
I got very nice responses, including a link to this article by Brent Ozar
Check out the responses above, hope it helps you if you are upgrading to Sql Server 2008.
You can also read further on this article on how to configure Sql Server 2008
BACKUP LOG "pathtomylogfile" WITH TRUNCATE_ONLY;
And I get this error:
Msg 155, Level 15, State 1, Line 1
'TRUNCATE_ONLY' is not a recognized BACKUP option.
So I asked myself if there is an option similar to what 'TRUNCATE_ONLY' was doing in 2005?
I posted a query at Ask Sql Server Central
I got very nice responses, including a link to this article by Brent Ozar
Check out the responses above, hope it helps you if you are upgrading to Sql Server 2008.
You can also read further on this article on how to configure Sql Server 2008
Saturday, September 18, 2010
Important: ASP.NET Security Vulnerability
Please read this Microsoft Security Advisory on ScottGu's blog regarding an ASP.NET Security Vulnerability
Thursday, September 09, 2010
Google Instant
Google Instant is a new search enhancement that shows results as you type. We are pushing the limits of our technology and infrastructure to help you get better search results, faster. Our key technical insight was that people type slowly, but read quickly, typically taking 300 milliseconds between keystrokes, but only 30 milliseconds (a tenth of the time!) to glance at another part of the page. This means that you can scan a results page while you type.
Friday, August 20, 2010
Robert The Grey: I don’t want your stinkin’ code comments
Robert The Grey: I don’t want your stinkin’ code comments: "I just read a fantastic thought experiment being put forward and trialled by Jesse Liberty at the moment. I’ve written this post in support ..."
Wednesday, August 18, 2010
Bournemouth Air Festival 19th – 22nd August 2010
Incredible air displays, attractions and fantastic evening entertainment – Bournemouth is ready to welcome you to the UK’s biggest free aviation Festival this Thursday, Friday, Saturday and Sunday (19th – 22nd)
Tuesday, August 03, 2010
Got DropBox yet?
Have you heard of DropBox yet? Don't hesitate to check it out if you haven't. You sync all of your computers via the Dropbox servers, their basic free service gives you 2Gigs of space and works cross-platform (Windows, Mac, Linux)
It works by behaving like a folder under version control that automatically syncs any time something new is added or modified. It takes care of merging and conflicts without ever bothering you (in case of conflicts, it just shows both files and renames one of them appropriately).
Wednesday, July 14, 2010
SQL Server Express 2008 now 10GB!
In case you are not aware, you now get 10GB with the free edition of SQL Server 2008 Express edition!.
Greate news, check out at their official website SQL Server Express 2008
C# extension method similar to Sql's IN operator
Consider the code snippet below
if(a == x || a == y || a == z)We can re-write this expression as:
- Using array's contains
- Using a similar syntax for the SQL's IN operator by using extension
return collection.Contains(obj);
}
And invoke as
if(a.IsIn(b, c, d)) { ... }
Read more at Stackoverflow
Wednesday, July 07, 2010
Find the Port a Connection is Using in Sql Server
SELECT c.session_id, c.local_tcp_port, s.login_name, s.host_name, s.program_name
FROM sys.dm_exec_connections AS c INNER JOIN
sys.dm_exec_sessions AS s on c.session_id = s.session_id
WHERE c.local_tcp_port <> 1433
I found this very useful when monitoring external access to your Sql Server instance.
The original post was here at SqlServerCentral
FROM sys.dm_exec_connections AS c INNER JOIN
sys.dm_exec_sessions AS s on c.session_id = s.session_id
WHERE c.local_tcp_port <> 1433
I found this very useful when monitoring external access to your Sql Server instance.
The original post was here at SqlServerCentral
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
Use Cookie-free Domains for Components
This is an excerpt from Yahoo Best Practices for Speeding Up Your Web Site
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!!!
The teaching material is all free!!!
Wednesday, June 02, 2010
ASP.NET application and page life cycle
An excellent article on the Asp.Net application and page life cyle. Please click here
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...");
}
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...
{
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;
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
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
Subscribe to:
Posts (Atom)