This is common sense, of course, but I was amazed at the profiteering some computer stores are up to.
I was looking for some CAT5E network cable to connect my media centre to my network, and enquired at a few stores. I was quoted R7.50 and R8.00/meter, and finally bought at another store for R3.00/meter. Granted, the first two prices were for stores inside a popular shopping mall, and the last is not. But charging 166% more than someone else for the same thing? I was even contemplating getting a wireless network adapter because it would have been cheaper than the cable at R8.00/meter!
Since then I found the name of a cable supplier which might even be cheaper than R3.00/meter. In case you are in Cape Town, look at Cape Cables.
Shop around before you open your wallet
0 comments Filed Under: Network Cable
Generic classes and Component services
I recently wrote a lightweight generic data access layer with generic list functionality. Everything worked fine until I had to implement a derived class as a Serviced Component. Turns out classes with generic methods cannot be added to component services, regsvcs.exe gives the following error
An unknown exception occurred during installation:
1: System.Reflection.ReflectionTypeLoadException - Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
Searched Google, and found 2 hits. If that happens you know trouble is looming on the horizon...
It appears to be a known bug, see the details here.
So for now I had to implement a workaround by not having my class derive from the generic base class but instead to have a private instance of it.
0 comments Filed Under: C#, Component Services, Generics
Getting Hauppauge WinTV-PVR-150 IR Blaster to work
I'm ready to move to the next level, to be able to change the channels on my decoder using the IR blaster that comes with the PVR-150. This link will help you a lot: LIRC PVR-150 IR blaster support
I only had to download the firmware and put it into the /lib/firmware directory on mythbuntu, and configure the IR blaster in Mythbuntu Control Center. I still have to figure out which codeset to use, but at least the irsend makes the little led on the blaster flash now.
0 comments Filed Under: hauppauge, IR Blaster, Media Centre, mythbuntu, mythtv
MythTV on Windows
I found a nice mythtv front-end for Windows, MythTV Player. Version 0.50 even supports Live TV. It can skip commercials as well.
I found the download here
0 comments Filed Under: mythtv, mythtv player, Windows XP
My first foray into PowerShell
I needed to change the date/timestamp on a file, and found that the touch utility does not exist. I also could not find the XP resource kit download, which apparently contains it. Then I remembered that PowerShell was installed when I recently installed SQL Server Express 2008.
$(get-item test.txt).lastwritetime=$(get-date "08/31/2012")
0 comments Filed Under: PowerShell, Timestamp
How many rows in all the tables in a database?
Often one needs to know the number of rows in all tables in a database, like when you are writing or executing tests, and need to know if you have test data for a table.
SELECT sysobjects.[name], max(sysindexes.[rows]) AS TableRowsYou can find the original here.
FROM sysindexes INNER JOIN sysobjects ON sysindexes.[id] = sysobjects.[id]
WHERE sysobjects.xtype = 'U'
GROUP BY sysobjects.[name]
ORDER BY name
0 comments Filed Under: RowCount, SQL Server
C# generics and testing
The power of C# generics, you just gotta love it.
The generic method:
public void TestGeneric(int logicalRecord) where L : new()
{
L list = new L();
Type x = typeof(L);
MethodInfo LoadMethod = x.GetMethod("LoadById");
Listrecords = (List )LoadMethod.Invoke(list, new object[] { logicalRecord });
Assert.IsTrue(records.Count > 0);
}
Invoking the generic method with the Factory type and the List type
TestGeneric(logicalRecord);
0 comments Filed Under: C#, Generics, NUnit
Spurl.net - grabb'em while you can
If you have online bookmarks at spurl.net, grab them while you can. I downloaded mine today, both the bookmark.htm and the bookmarks_xbel.xml. I don't know what the future holds for spurl, it has not been in a good state for weeks.
0 comments Filed Under: Online Bookmarks, spurl.net
Want to get rid of Word as default .htm(l) editor
Seems like MS thought Word was a good html editor. NOT!
"C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe" "%1"
Click all the right buttons to confirm and get out, and test it.
0 comments Filed Under: Default html editor, Visual Studio 2008, Word
What's in Google Chrome cache?
I'm trying to get my bookmarks from spurl.net while it seems to be up (albeit VERY slow), and the bookmarks.htm download broke with the html downloaded, but not the images. I wanted to see if I can grab it from the cache.
0 comments Filed Under: cache, Google Chrome
Spurl.net is dead, or is it?
Spurl.net is (or should I say was?) an online bookmark service, like del.icio.us. I've added quite a lot of bookmarks there, and it seems they might all be gone, as I've been unable to access the service for the past week or so. I've sent them emails, even that does not seem to get delivered.
0 comments Filed Under: Online Bookmarks, spurl.net
mythbuntu + Hauppauge PVR150 = win-win
I got a Hauppauge PVR 150 card today, installed it in place of the Genie Wonder Pro, configured it and the remote in the Muthbuntu Control Center, and it works out of the box! No editing of config files, no manual tricks, nada, niks!
0 comments Filed Under: hauppauge, Linux, Media Centre, mythbuntu, mythtv
mythbuntu 9.04 - 1, KnoppMyth 5.5 - 0
I dug an old Athlon 700 out of retirement, and fitted my Genie Wonder Pro TV card in it to see if I can get it working as a media centre.
0 comments Filed Under: btaudio, bttv, genie wonder pro, knoppmyth, Linux, Media Centre, mythbuntu, mythtv
What SQL is currently executing?
Have you wondered what SQL is currently executing on SQL Server, or which statement in a stored procedure is currently executing? Below is a script to create the sp_currentsql stored procedure.
CREATE PROCEDURE [dbo].[sp_currentsql]
AS
SET NOCOUNT ON
CREATE TABLE #SP_WHO2 (
SPID SMALLINT,
Status NCHAR(30),
Login NCHAR(128),
HostName NCHAR(128),
BlkBy CHAR(5),
DBName NCHAR(128),
Command NCHAR(16),
CPUTime INTEGER,
DiskIO INTEGER,
LastBatch VARCHAR(20),
ProgramName NCHAR(128),
SPID_2 SMALLINT,
RequestID int
)
INSERT INTO #SP_WHO2
exec sp_who2 active
DECLARE @SPID int
DECLARE @sql_handle binary(20), @handle_found bit
DECLARE @stmt_start int, @stmt_end int
DECLARE @line varchar(8000), @wait_str varchar(8)
DECLARE curSPID CURSOR FOR
SELECT DISTINCT SPID
FROM #SP_WHO2
WHERE Status != 'BACKGROUND' AND HostName != ' .' AND SPID != @@spid
OPEN curSPID
FETCH NEXT FROM curSPID INTO @SPID
WHILE @@FETCH_STATUS = 0 BEGIN
SELECT @sql_handle = sql_handle,
@stmt_start = stmt_start/2,
@stmt_end = CASE WHEN stmt_end = -1 THEN -1 ELSE stmt_end/2 END
FROM master.dbo.sysprocesses
WHERE spid = @SPID
AND ecid = 0
SELECT @line=SUBSTRING( text,
COALESCE(NULLIF(@stmt_start, 0), 1),
CASE @stmt_end
WHEN -1
THEN DATALENGTH(text)
ELSE
(@stmt_end - @stmt_start)
END
)
FROM ::fn_get_sql(@sql_handle)
SELECT @SPID SPID, @line SQL
FETCH NEXT FROM curSPID INTO @SPID
END
CLOSE curSPID
DEALLOCATE curSPID
DROP TABLE #SP_WHO2
GO
0 comments Filed Under: SQL Server
Windows XP refuses to hibernate
For a while now my laptop has refused to hibernate. One out of every 20 times it would hibernate, otherwise it would black the screen briefly and continue running, without any error messages. My machine takes quite a few minutes to boot up, due to all the stuff installed, so this was becoming quite annoying, as hibernate/resume is so fast compared to shutdown and boot.
0 comments Filed Under: Hibernate, Windows XP