Tuesday, January 04, 2011

VS 2010 SP1 (Beta) and IIS Express

ScottGu has blogged on the VS 2010 SP1 (Beta) and IIS Express, see his article here
Basically Visual Studio 2010 SP1 adds support for IIS Express
IIS Express is a free version of IIS 7.5 that is optimized for developer scenarios:

  • It’s lightweight and easy to install (less than 5Mb download and a quick install)
  • It does not require an administrator account to run/debug applications from Visual Studio
  • It enables a full web-server feature set – including SSL, URL Rewrite, and other IIS 7.x modules
  • It supports and enables the same extensibility model and web.config file settings that IIS 7.x support
  • It can be installed side-by-side with the full IIS web server as well as the ASP.NET Development Server (they do not conflict at all)
  • It works on Windows XP and higher operating systems – giving you a full IIS 7.x developer feature-set on all Windows OS platforms
Check out ScottGu's blog and go for it.

Wednesday, December 22, 2010

ASP.NET Error Bar Chart

The Error Bar chart type consists of lines with markers that are used to display statistical information about the data displayed in a graph. A series of the Error Bar chart type has three Y values. While these values can be manually assigned to each point, in most cases, the values are calculated from the data present in another series. The order of the Y values is important because each position in the array of values represents a value on the error bar.

Adding Error Bar series to another series on same chart
Lets say we have a chart named Chart1 and series named Series1. 
We can add the Error Bar series to Series1 using the following snippet...
.
     Series errorBarSeries = new Series("ErrorBar");  
            errorBarSeries.ChartType = SeriesChartType.ErrorBar;  
            errorBarSeries.MarkerBorderColor = Color.FromArgb(64, 64, 64);  
            errorBarSeries.MarkerSize = 6;  
            errorBarSeries.YValuesPerPoint = 3;  
            errorBarSeries.BorderColor = Color.FromArgb(180, 26, 59, 105);  
            errorBarSeries.Color = Color.FromArgb(252, 180, 65);  
            errorBarSeries.ShadowOffset = 1;  
            errorBarSeries.MarkerStyle = MarkerStyle.None;  
            errorBarSeries["PointWidth"] = "0.1";  
            double error = 100;  
            foreach (DataPoint point in Series1.Points)  
            {  
                double centerY = point.YValues[0];  
                double lowerErrorY = centerY - error;  
                double upperErrorY = centerY + error;  
                errorBarSeries.Points.AddXY(point.XValue, centerY, lowerErrorY, upperErrorY);  
            }  
            Chart1.Series.Add(errorBarSeries); 
.
Calculating Error Values from Another Series
This can be done using the following code snippet.

  // Populate series with data
    double[]    yValues = {32.4, 56.9, 89.7, 98.5, 59.3, 33.8, 78.8, 44.6, 76.4, 68.9};
    Chart1.Series["DataSeries"].Points.DataBindY(yValues);

    // Set error bar chart type
    chart1.Series["ErrorBar"].ChartType = SeriesChartType.ErrorBar;

    // Link error bar series with data series
    Chart1.Series["ErrorBar"]["ErrorBarSeries"] = "DataSeries";

    // Set error calculation type
    Chart1.Series["ErrorBar"]["ErrorBarType"] = "StandardError";

    // Set error bar upper & lower error style
    Chart1.Series["ErrorBar"]["ErrorBarStyle"] = "UpperError";

    // Set error bar center marker style
    Chart1.Series["ErrorBar"]["ErrorBarCenterMarkerStyle"] = "Circle";
Adapted from:
MSDN Error Bar Chart     
Social MSDN Error Bar Chart

Wednesday, December 01, 2010

Using osql to do backup/restore and escaping special characters in 'LIKE'

Using osql util
Some quick quips to share on Sql Server on using osql command line util to performe  backups/restore
backup
osql -E -Sinstancename -q "BACKUP DATABASE [dbname] TO  DISK = N'backupfile.bak' WITH NOFORMAT, INIT,  NAME = N'dbName Database Backup', SKIP, NOREWIND, NOUNLOAD,  STATS = 10"
restore
osql -E -Sinstancename  -q "RESTORE DATABASE [dbname] FROM  DISK = N'backupfile.bak' WITH  FILE = 1,  NOUNLOAD,  REPLACE,  STATS = 10"
Using 'LIKE'
Using 'LIKE' to determine if a value or a column of values IS ALL DIGITS
SELECT * FROM testtable WHERE columnxyz NOT LIKE '%[^0-9]%'


'^' means 'NOT', so the expression above evaluates to 'Select only rows from testtable where everything in the columnxyz is a digit from 0 to 9'
Use the ESCAPE clause and the escape character in order to use special characters in your expression.
E.g. to find the exact character string 10-15% in column c1 of the mytbl2 table, we use
SELECT c1 FROM mytbl2 WHERE c1 LIKE '%10-15!% off%' ESCAPE '!'
Further reading on the BOL LIKE reference

Friday, November 12, 2010

Visual Studio 2010 Productivity Power Tools

You can check out the latest VS2010 Productivity Power tools on the visualstudiogallery portal.


I love the Solution Navigator, Searchable and Reference Dialog amongst the other gallery of extensions!

Monday, November 01, 2010

Why I’m a better software developer than you

I came across this article and thought it was good enough to share with you.


What makes one developer better than another? Shouldn’t we all be performing at the same level?...Read more here

Thursday, October 07, 2010

Lady Gaga The Fame and Sql Server 2008 R2

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

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
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





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
 if( new [] {x,y,z}.Contains(a))
  • Using a similar syntax for the SQL's IN operator by using extension
public bool IsIn(this T obj, params T[] collection) {
   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

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