From CodePlex
SkyDrive Viewer
Lets you browse your own personal files and folders that you have on SkyDrive by getting you to sign into the program using your Windows Live ID.
Collection of unedited thoughts and bits of knowledge I can't seem to remember
Search This Blog
Sunday, January 25, 2009
Writing Interfaces in C#
Useful references for C# class interfaces
www.csharp-station.com Tutorials Lesson13 - Interfaces
Code Guru - Interfaces
www.csharp-station.com Tutorials Lesson13 - Interfaces
Code Guru - Interfaces
Thursday, January 22, 2009
Get Comments for Blogger Blog
.Net Documentation for Blogger API from Google
Very easy but I need to remember the following (and I know I won't :)
Getting comments for all posts on the blog, use
AtomEntry.Links[3] was
Very easy but I need to remember the following (and I know I won't :)
Getting comments for all posts on the blog, use
http://www.blogger.com/feeds/blogID/comments/defaultThis link does not appear in list of links on AtomEntry.Links
AtomEntry.Links[3] was
http://www.blogger.com/feeds/blogID/posts/default and I simply replaced "posts" with "comments" and then queried the blogger web service.
private void GetComments(AtomEntry blog, string login, string password)
{
Service bloggerService = new Service("blogger", "WebPhotoTool.Accounts");
bloggerService.Credentials = new GDataCredentials(login, password);
FeedQuery query = new FeedQuery();
query.Uri = new Uri(blog.Links[3].AbsoluteUri.ToString().Replace("posts","comments"));
AtomFeed feed = _bloggerService.Query(query);
foreach (AtomEntry entry in feed.Entries)
{
}
}
{
Service bloggerService = new Service("blogger", "WebPhotoTool.Accounts");
bloggerService.Credentials = new GDataCredentials(login, password);
FeedQuery query = new FeedQuery();
query.Uri = new Uri(blog.Links[3].AbsoluteUri.ToString().Replace("posts","comments"));
AtomFeed feed = _bloggerService.Query(query);
foreach (AtomEntry entry in feed.Entries)
{
}
}
Wednesday, January 21, 2009
Running Deadlock trace in SQL server 2000
Turn on deadlock trace
DBCC TRACEON(1204,1222)
DBCC TRACEON (3604)
DBCC TRACEON (1204)
To turn off deadlock tracing and logging:
DBCC TRACEOFF (3604, 1204)
This will enable deadlock tracing for all existing connections and new. You can check out KB832524 for more details. Trace flag 1204 reports deadlock information formatted by each node involved in the deadlock. Trace flag 1222 formats deadlock information, first by processes and then by resources.
Use SQL Profiler to trace deadlock events and get the resource ID of the table or index under contention. The steps to do this are:
DBCC TRACEON(1204,1222)
DBCC TRACEON (3604)
DBCC TRACEON (1204)
To turn off deadlock tracing and logging:
DBCC TRACEOFF (3604, 1204)
This will enable deadlock tracing for all existing connections and new. You can check out KB832524 for more details. Trace flag 1204 reports deadlock information formatted by each node involved in the deadlock. Trace flag 1222 formats deadlock information, first by processes and then by resources.
Use SQL Profiler to trace deadlock events and get the resource ID of the table or index under contention. The steps to do this are:
- Start SQL profiler
- On the Trace Properties dialog box, on the General tab, check Save to file and specify a path to save the trace
- Click the Events tab, only add Locks\Lock:deadlock and Locks\Lock:deadlock chain
- Click the Data columns tab, add DatabaseID, IndexID, ObjectID
Tuesday, January 20, 2009
SQL Server 2000 DBCC Traceon flags
SQL Server 2000: Some useful trace flags
Trace flags are used to temporarily set specific server characteristics or to switch off a particular behavior. You can set trace flags by using DBCC TRACEON command or by using the -T option with the sqlservr command- line executable. After activated, trace flag will be in effect until you restart server, or until you deactivate trace flag by using DBCC TRACEOFF command.
DBCC TRACESTATUS (trace# [,...n])
To get the status information for all trace flags currently turned on, you can use -1 for trace#.
This is the example:
DBCC TRACESTATUS(-1)
You can use DBCC TRACEON command to turn on the specified trace flag. This is the syntax from SQL Server Books Online:
DBCC TRACEON (trace# [,...n])
If you want to turn off the specified trace flag(s), you can use DBCC TRACEOFF command.
This is the syntax from SQL Server Books Online:
DBCC TRACEOFF (trace# [,...n])
1. Trace flag -1 (undocumented).
This trace flag sets trace flags for all client connections, rather than for a single client connection. Is used only when setting trace flags using DBCC TRACEON and DBCC TRACEOFF. The setting of the Trace flag -1 is not visible with DBCC TRACESTATUS command, but work without problems.
This trace flag was documented in SQL Server 6.5 Books Online, but was not documented in SQL Server 7.0 and SQL Server 2000.
2. Trace flag 1204 (undocumented).
This trace flag returns the type of locks participating in the deadlock and the current command affected. This trace flag was documented in SQL Server 7.0 Books Online, but was not documented in SQL Server 2000.
3. Trace flag 1205 (undocumented).
This trace flag returns more detailed information about the command being executed at the time of a deadlock. This trace flag was documented in SQL Server 7.0 Books Online, but was not documented in SQL Server 2000.
4. Trace flag 1807 (undocumented).
You cannot create a database file on a mapped or UNC network location. This opportunity is generally unsupported under SQL Server 7.0 and SQL Server 2000. You can bypass this by turn on trace flag 1807.
5. Trace flag 3604 (undocumented).
One of the most used trace flag. Trace flag 3604 sends trace output to the client. This trace flag is used only when setting trace flags with DBCC TRACEON and DBCC TRACEOFF. Trace flag 3604 was documented in SQL Server 6.5 Books Online and in SQL Server 7.0 Books Online, but was not documented in SQL Server 2000.
6. Trace flag 3605 (undocumented).
In comparison with Trace flag 3604, this trace flag sends trace output to the error log. Trace flag 3605 was documented in SQL Server 6.5 Books Online and in SQL Server 7.0 Books Online, but was not documented in SQL Server 2000.
7. Trace flag 3608 (undocumented).
This trace flag skips automatic recovery (at startup) for all databases except the master database. Trace flag 3608 was documented in SQL Server 6.5 Books Online, but was not documented in SQL Server 7.0 and SQL Server 2000.
8. Trace flag 4022.
If turns on, then automatically started procedures will be bypassed. This trace flag described in CREATE PROCEDURE statement in the SQL Server Books Online.
9. Trace flag 8202 (undocumented).
This trace flag used to replicate UPDATE as DELETE/INSERT pair. Let me to describe.
UPDATE commands at the publisher can be run as an "on-page DELETE/INSERT" or a "full DELETE/INSERT".
If the UPDATE command is run as an "on-page DELETE/INSERT," the Logreader send UDPATE command to the subscriber, If the UPDATE command is run as a "full DELETE/INSERT," the Logreader send UPDATE as DELETE/INSERT Pair. If you turn on trace flag 8202, then UPDATE commands at the publisher will be always send to the subscriber as DELETE/INSERT pair.
2. INF: Trace Flag to Replicate UPDATE as DELETE/INSERT Pair
SQL Server 2000: Some useful trace flags
Alexander Chigrik
chigrik@mssqlcity.com
Introduction
In this article, I want to tell you, what should you know about trace flags, and how you can use some useful trace flags in SQL Server 2000 for administering and monitoring.Trace flags are used to temporarily set specific server characteristics or to switch off a particular behavior. You can set trace flags by using DBCC TRACEON command or by using the -T option with the sqlservr command- line executable. After activated, trace flag will be in effect until you restart server, or until you deactivate trace flag by using DBCC TRACEOFF command.
Trace flags
You can use DBCC TRACESTATUS command to get the status information for the particular trace flag(s) currently turned on. This is the syntax from SQL Server Books Online:DBCC TRACESTATUS (trace# [,...n])
To get the status information for all trace flags currently turned on, you can use -1 for trace#.
This is the example:
DBCC TRACESTATUS(-1)
You can use DBCC TRACEON command to turn on the specified trace flag. This is the syntax from SQL Server Books Online:
DBCC TRACEON (trace# [,...n])
If you want to turn off the specified trace flag(s), you can use DBCC TRACEOFF command.
This is the syntax from SQL Server Books Online:
DBCC TRACEOFF (trace# [,...n])
1. Trace flag -1 (undocumented).
This trace flag sets trace flags for all client connections, rather than for a single client connection. Is used only when setting trace flags using DBCC TRACEON and DBCC TRACEOFF. The setting of the Trace flag -1 is not visible with DBCC TRACESTATUS command, but work without problems.
This trace flag was documented in SQL Server 6.5 Books Online, but was not documented in SQL Server 7.0 and SQL Server 2000.
2. Trace flag 1204 (undocumented).
This trace flag returns the type of locks participating in the deadlock and the current command affected. This trace flag was documented in SQL Server 7.0 Books Online, but was not documented in SQL Server 2000.
3. Trace flag 1205 (undocumented).
This trace flag returns more detailed information about the command being executed at the time of a deadlock. This trace flag was documented in SQL Server 7.0 Books Online, but was not documented in SQL Server 2000.
4. Trace flag 1807 (undocumented).
You cannot create a database file on a mapped or UNC network location. This opportunity is generally unsupported under SQL Server 7.0 and SQL Server 2000. You can bypass this by turn on trace flag 1807.
5. Trace flag 3604 (undocumented).
One of the most used trace flag. Trace flag 3604 sends trace output to the client. This trace flag is used only when setting trace flags with DBCC TRACEON and DBCC TRACEOFF. Trace flag 3604 was documented in SQL Server 6.5 Books Online and in SQL Server 7.0 Books Online, but was not documented in SQL Server 2000.
6. Trace flag 3605 (undocumented).
In comparison with Trace flag 3604, this trace flag sends trace output to the error log. Trace flag 3605 was documented in SQL Server 6.5 Books Online and in SQL Server 7.0 Books Online, but was not documented in SQL Server 2000.
7. Trace flag 3608 (undocumented).
This trace flag skips automatic recovery (at startup) for all databases except the master database. Trace flag 3608 was documented in SQL Server 6.5 Books Online, but was not documented in SQL Server 7.0 and SQL Server 2000.
8. Trace flag 4022.
If turns on, then automatically started procedures will be bypassed. This trace flag described in CREATE PROCEDURE statement in the SQL Server Books Online.
9. Trace flag 8202 (undocumented).
This trace flag used to replicate UPDATE as DELETE/INSERT pair. Let me to describe.
UPDATE commands at the publisher can be run as an "on-page DELETE/INSERT" or a "full DELETE/INSERT".
If the UPDATE command is run as an "on-page DELETE/INSERT," the Logreader send UDPATE command to the subscriber, If the UPDATE command is run as a "full DELETE/INSERT," the Logreader send UPDATE as DELETE/INSERT Pair. If you turn on trace flag 8202, then UPDATE commands at the publisher will be always send to the subscriber as DELETE/INSERT pair.
Literature
1. SQL Server Books Online2. INF: Trace Flag to Replicate UPDATE as DELETE/INSERT Pair
Friday, January 16, 2009
Collection of Free Tools
Several Free Tools I have found useful.
NVU - Web Authoring Tool url
MagicDisc - Mount ISO images as CDs url
WinVi - Text File Editor for Windows url
NSIS - Nullsoft Installer url
Venis - Visual UI for NSIS url
Mztools - Free VB6 Addin similar toResharper url
7zip SDK - Freeware zip lib SDK url
7zip - Freeware Zip tool url
Gimp 2.6.4 - Graphics Image Manipulation Program url
Eclipse Color Palette Tool url
NVU - Web Authoring Tool url
MagicDisc - Mount ISO images as CDs url
WinVi - Text File Editor for Windows url
NSIS - Nullsoft Installer url
Venis - Visual UI for NSIS url
Mztools - Free VB6 Addin similar toResharper url
7zip SDK - Freeware zip lib SDK url
7zip - Freeware Zip tool url
Gimp 2.6.4 - Graphics Image Manipulation Program url
Eclipse Color Palette Tool url
Move location of SQL Server temp database
Run this query:
use master
go
Alter database tempdb modify file (name = tempdev, filename = 'H:\Data\tempdb.mdf')
go
Alter database tempdb modify file (name = templog, filename = 'H:\Data\templog.ldf')
Go
Then,restart MSSQLServer service
use master
go
Alter database tempdb modify file (name = tempdev, filename = 'H:\Data\tempdb.mdf')
go
Alter database tempdb modify file (name = templog, filename = 'H:\Data\templog.ldf')
Go
Then,restart MSSQLServer service
Monday, January 12, 2009
Determine version of .net framework installed
http://support.microsoft.com/kb/318785
How to determine which versions of the .NET Framework are installed
To determine which versions of the .NET Framework are installed, locate the %systemroot%\Microsoft.NET\Framework folder. To open this folder, you can paste this address into a Windows Explorer address bar. The following folders contain the released versions of the .NET Framework:
* v3.5
* v3.0
* v2.0.50727
* v1.1.4322
* v1.0.3705
How to determine which versions of the .NET Framework are installed
To determine which versions of the .NET Framework are installed, locate the %systemroot%\Microsoft.NET\Framework folder. To open this folder, you can paste this address into a Windows Explorer address bar. The following folders contain the released versions of the .NET Framework:
* v3.5
* v3.0
* v2.0.50727
* v1.1.4322
* v1.0.3705
Updating NSIS installation
Steps to update installation of NSIS on my development machine
Now DRC install script will compile.
Files can be found here
- Install latest NSIS, allow install to remove previous version.
- Run FontName-0.7.exe
- run install from GetVersion.zip
- Copy the following files into F:\Program Files\NSIS\Plugins\
- Copy GetVersion.dll
- Copy version.dll
- Copy ZipDLL.dll
- In Registry.ZIP, for Desktop, copy files the following files
- Include to F:\Program Files\NSIS\Include
- Example to F:\Program Files\NSIS\Examples
- Plugin to F:\Program Files\NSIS\Plugins
Now DRC install script will compile.
Files can be found here
Saturday, January 10, 2009
C# Switch Statment
MSDN
The switch statement is a control statement that handles multiple selections by passing control to one of the case statements within its body. It takes the following form:
Note:
C# switch does not fall through as the switch statement does in C++
switch (e.KeyCode)
{
case Keys.F5:
webBrowser1.Navigate(txtURL.Text);
break;
case Keys.Escape:
webBrowser1.Stop();
break;
default:
break;
}
The switch statement is a control statement that handles multiple selections by passing control to one of the case statements within its body. It takes the following form:
switch (expression)
{
case constant-expression:
statement
jump-statement
[default:
statement
jump-statement]
}
Where:
- expression
- An integral or string type expression.
- statement
- The embedded statement(s) to be executed if control is transferred to the case or the default.
- jump-statement
- A jump statement that transfers control out of the case body.
- constant-expression
- Control is transferred to a specific case according to the value of this expression.
Note:
C# switch does not fall through as the switch statement does in C++
switch (e.KeyCode)
{
case Keys.F5:
webBrowser1.Navigate(txtURL.Text);
break;
case Keys.Escape:
webBrowser1.Stop();
break;
default:
break;
}
Thursday, January 8, 2009
Notes on Creating COM with C#
Articles:
- COM Interop Part 1: C# Client Tutorial
- COM Interop Part 2: C# Server Tutorial
- http://www.codeproject.com/KB/cs/ManagedCOM.aspx
- http://www.csharphelp.com/archives/archive190.html
- http://www.vector.org.uk/archive/v231/askdll.htm
- MSDN:Example COM Class (C# Programming Guide)
- csharphelp: Building COM Objects in C#
Monday, January 5, 2009
Truncate Transaction log SQL Server 2000
Get database name:
SELECT * FROM master.dbo.sysdatabases
Get File group ID
Use [db_name]
select * from dbo.sysfiles
Truncate and shrink Transaction file:
Use [db_name]
BACKUP LOG [db_name] WITH TRUNCATE_ONLY
DBCC SHRINKFILE (fileID)
SELECT * FROM master.dbo.sysdatabases
Get File group ID
Use [db_name]
select * from dbo.sysfiles
Truncate and shrink Transaction file:
Use [db_name]
BACKUP LOG [db_name] WITH TRUNCATE_ONLY
DBCC SHRINKFILE (fileID)
Subscribe to:
Posts (Atom)