Paul Maddox

Software development team leader specialising in Microsoft Visual C# and C++ from the Northwest of England. Experience working in a globalised business and team; understanding of enterprise business operation and practices; experience reporting to executive management Skills in numerous languages and technologies; knowledge of formal software development lifecycle; experience of architecture design

Tuesday, September 1, 2009

Twitter's Impending Doom: Apps and Games

Do you have that one annoying twitizen in your following list who talks jibberish all the time? Do you wish you could politely filter some/all of their tweets without blocking them entirely? Well, you can't. But don't worry, things are going to get a whole lot worse.

Twitter, by its very nature, treats all tweets equally. That's great, under the assumption all tweets are created equally. Unfortunately, apps like Twibbon, which trade a small service (adding a tiny graphic onto your profile pic) in exchange for an automated tweet from your account, change that, and they are only the tip of the iceberg.

Soon I predict a whole ecosystem of Twitter apps and games vying for access to your precious account login, and it will result in one thing: massive increase in twitter noise. (And you thought just having tweets your friends write is bad enough.) App invitations, quiz results, and spam, will all become part of your daily twitter traffic.

FaceBook apps and games, whether you love them or hate them, have two redeeming features: (1) you can block invitations for them, and (2) they are prohibited by FaceBook from forcing you to spam your friends (by, for instance, only allowing you access to the results of a quiz by spamming 10 of your friends).

Pretty soon Twitter will have to start factoring in recipient-based filtering of tweets depending on the origin app, and I don't believe Twitter will be able to move fast enough, with such enormous tweet volumes, to stem the tide. Without that, Twitter will quickly reach lowest-common-denominator proportions, and users will simply move on.

Friday, May 15, 2009

What happens if a statement fails in a SQL Server stored procedure?

Answer: it carries on regardless! In other words: if you want a stored proc to specifically stop upon error, test for it and return.

Take this example:

CREATE TABLE [dbo].[PaulTest](
[Number] [int] NOT NULL
) ON [PRIMARY]

CREATE PROCEDURE uspPaulTest AS
BEGIN
INSERT INTO PaulTest (Number) VALUES (NULL) -- fails as NULL is invalid
INSERT INTO PaulTest (Number) VALUES(1) -- still gets processed as the query doesn't return
END

-- Let's test it:

SELECT * FROM PaulTest

EXEC uspPaulTest

SELECT * FROM PaulTest

-- Output:

Number
-----------
(0 row(s) affected)

Msg 515, Level 16, State 2, Procedure uspPaulTest, Line 10
Cannot insert the value NULL into column 'Number', table 'Test.dbo.PaulTest'; column does not allow nulls. INSERT fails.
The statement has been terminated.(1 row(s) affected)

Number
-----------
1
(1 row(s) affected)

Wednesday, April 22, 2009

Visual Studio 2008 Errors

Recently I had my VS 2008 RTM/RC installation go pear shaped. Overnight I stopped being able to create VC++ smartdevice projects with the error

“Creating Project '<ProjectName>'... project creation failed”

‘No problem’, I thought, ‘I’ll just run setup and do a repair’.  Unfortunately, I got an error with the setup of

“A problem has been encountered while loading the setup components. Canceling setup.”

Luckily I came across a post on StackOverflow (which is running turning out to be a useful resource from the author of CodingHorror.com) pointing to a Microsoft tool to ‘force’ uninstall various Microsoft products, including Visual Studio:

http://msdn.microsoft.com/en-us/vstudio/bb968856.aspx

image

Tuesday, April 21, 2009

SQL Server 2008 Truncating Log File

First find the filename labels for your database:

select name from <DatabaseName>.dbo.sysfiles

Next truncate the log:

BACKUP LOG <DatabaseName> WITH TRUNCATE_ONLY

Finally shrink the database based on the log file in step 1:

DBCC SHRINKFILE('NameAbove_log',2048)

2048 is the resultant file size in MB.

Screen Real Estate Wastage

Usually I’m a fan of Microsoft UI design, however having installed the latest version of Windows Live Messenger (or more accurately had it forced on me) I’m astounded by the amount of screen real estate squandered.  Clearly Microsoft have been buying too many 24” monitors.  After turning off as much of the unneeded fluff as possible I was still left with a window far larger than necessary, with no real benefit.  See below!

image

SQL Quiz of the Day



Let’s say you have raw data as so:

Id Counter Ident
----------- ----------- -----
1 1 A
2 2 A
3 1 A
4 3 B
5 3 B
6 2 A
7 1 A
8 4 C
9 2 C
10 1 B
11 1 B
12 4 B

And you want to group by the Ident field, but
only contiguous blocks. So you want to display
the following:

Counter Ident
----------- -----
4 A
6 B
3 A
6 C
6 B

Naturally one can’t use GROUP BY, because this would
aggregate multiple A’s and B’s.

Answers on a postcard!

====

CREATE TABLE [dbo].[Test](
[Id] [int] IDENTITY(1,1) NOT NULL,
[Counter] [int] NOT NULL,
[Ident] [varchar](3)
COLLATE Latin1_General_CI_AS NOT NULL,
CONSTRAINT [PK_Test] PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]

Monday, April 20, 2009

MaddogTCP network TCP/IP fuzzer

A while ago - almost three years in fact - I wrote a fuzzer to test network security of TCP/IP connections. Due to one reason and another I never really released it, and despite being published on the net it was hidden from Google, and hence remained undiscovered.

Looking back, it was a reasonably succinct little program that deserves the light of day, so here it is:

http://www.calcaria.net/MaddogTCP/