Sony TSL300C Illegal Cassette Config

Posted on Monday, June 29, 2009 by Nicki

One of the tapes in our tapeset failed, and a new one was labelled. This is where the trouble started.


As soon as the magazine is inserted into the drive, it scans all the tapes. Every time it gets to the position where the new tape is located, it ejects the magazine with a "Illegal Cassette Config" error together with flashing indicator for the position where the tape was located. I searched on Google, and could not find anything. That usually spells trouble. I grabbed an old tape, as well as a new one and a cleaning tape.

After inserting the new (unlabelled as in sticker on the tape) tape into the drive, it loaded. Then we had a look at the other new tape we tried to load, and realised that we had used the bigger sticker label instead of the narrow one, and it covered some indentations obviously necessary for the tape to be detected. After replacing the label with the correct one, all was well.

A huge relief when I was prepared for a good couple of hours...

Creating a SQL Server CLR Procedure

Posted on Thursday, June 25, 2009 by Nicki

I ventured into unchartered territory (for myself) and created a SQL Server CLR Procedure today. It is actually very easy.


First, create a class library project in VS 2005/2008. Create a class with a static method that will be the CLR Procedure

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Data.SqlClient;
using Microsoft.SqlServer.Server;

namespace SQLCLRTest
{
public class SQLCLRDemo
{
[Microsoft.SqlServer.Server.SqlProcedure]
public static void HelloWorld()
{
using (SqlConnection conn =
new SqlConnection("context connection = true"))
{
conn.Open();
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "SELECT 'Hello World!' AS Greeting";
SqlContext.Pipe.ExecuteAndSend(cmd);
}
}
}
}
Then you have to register the assembly in SQL Server

CREATE ASSEMBLY SQLCLRTest FROM 'C:\work\sandbox\SQLCLRTest\SQLCLRTest\bin\Debug\SQLCLRTest.dll'

Then you create the procedure

CREATE PROCEDURE HelloWorld
AS EXTERNAL NAME SQLCLRTest.[SQLCLRTest.SQLCLRDemo].HelloWorld


You might have to enable CLR execution in SQL2005

EXEC sp_configure 'clr enabled', 1;
RECONFIGURE WITH OVERRIDE;
GO

Then you can appreciate the fruits of your labour

exec HelloWorld

Greeting
------------
Hello World!

(1 row(s) affected)


Now that was easy!

MSDN reference here
Error when creating CLR procedure here
Enabling CLR in SQL Server here

How to connect to SQL Server, VS TFS, etc using Windows Authentication when computer is not on Active Directory Domain

Posted on by Nicki

I often move around between different clients, and never join their domains, simply because my machine would get cluttered with policies and logon scripts, so I've encountered this problem before.


To access a fileshare, you just map using
net use \\machinename\ipc$ /user:domain\user
This does not work for connecting to SQL Server with Windows Authentication though. I found this neat little trick to accomplish this:
runas.exe /netonly /user: "C:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\ide\SqlWb.exe"
This runs Management Studio as the domain user, which can then authenticate to SQL Server using Windows Authentication.

The original article can be found here

ASP .Net Windows Authentication

Posted on by Nicki

If you use Windows Authentication, and the user is not allowed to access the specific page, a nasty 401.2 Access Denied error message will be displayed to the user. What if you want to display a friendly error message?


You would think that an entry in the <customErrors> section would work? No, it does not.

To get to the solution: You have to define Application_EndRequest in Global.asax.cs that looks something like

protected void Application_EndRequest(object sender, EventArgs e)
{
HttpContext context = HttpContext.Current;
if (context.Response.Status.Substring(0,3).Equals("401"))
{
context.Response.ClearContent();
context.Response.Write("<script language="javascript">" +
"self.location='NotAllowed.aspx';</script>");
}
}

Then you create the NotAllowed.aspx page to display a nice friendly message to the user.

You can find more information here.

ASP.Net configure page-level security

Posted on by Nicki

Did you know that you can configure security on a page level instead of on a folder level, like the custom tool in Visual Studio does?


Here's how:

Outside the section in the Web.config, add a location tag and configure the required security for the location.

Example:
<location path="Default.aspx">
<system.web>
<authorization>
<allow roles="Users"/>
<deny users="*"/>
</authorization>
</system.web>
</location>

This is all in the main Web.config file, so it does not require a folder per role with its own Web.config for which you want to secure pages, reducing the deployment complexity.

You can specify a directory in the path attribute, which will then apply all settings to that directory. It seems that you can also have nested <location> tags, so you can define a <location> tag for a directory, and then define a <location> tag for each page in the folder, each with its own settings. I think it is brilliant!

I found some details on the subject here. You can find the reference in the MSDN library here.

Building a Linux MediaCentre

Posted on Tuesday, June 23, 2009 by Nicki

I'm currently toying with the idea of building a Linux MediaCentre to record and watch TV, as well as store and display photos, as my VCR is getting old.


KnoppMyth (soon to be called LinHES) has drawn my attention, as it is already in version 6. The card I'll be using initially will be a Genie Wonder Pro that I have lying around. Are there any DVB-T (DTTV - soon to be launched in SA) cards available in SA already?

Hopefully I'll install everything in the next couple of weeks.

Perl upgrade on FreeBSD

Posted on by Nicki

Have you ever done a perl upgrade on FreeBSD, only to find that none of your installed ports that use perl work anymore? I recently had that shock, and found the following hint:


Execute perl-after-upgrade after upgrading perl on FreeBSD, it will display all modules that needs to be updated. Then execute it again with the -f switch to actually make the required changes.

Voila, everyone settle down again please!

Flushmaster not flushing

Posted on by Nicki

We have two Cobra Flushmaster flushvalves in our toilets at home, and recently the one refused to flush. I enquired as to pricing, and was shocked. A new one is about R2k. I spoke to the guys in the plumbing department at my local hardware store, and they suggested a seal kit at R200. I was quite scared of tackling this, as I could end up having to fork out R2k if I get it wrong...


It took about 1.5-2h to take it apart and replace the seals, taking care not to break anything in the process. I also cleaned gave it a thourough cleaning and lubed the moving parts with some wheel bearing grease. Imagine the relief when I put it all back together and it flushes like a new one. Now if I could get some goodies with the money saved...

SQL Server 2008 Spatial, Google MAPS API

Posted on by Nicki

At a recent TechDays event I was introduced to the spatial features in the latest version of SQL Server, 2008. Spatial apps has interested me for a while, but I never really got a chance to do anything, I suppose in a way due to the preceived complexity.


I wondered what I could to with the new sptial features. A farmer on one of the forums I frequent recently suggested that the fellow forumites acquire rainmeteres and report daily rainfall figures, as rainfall often differs sunstantially between areas just a few km apart. Well I thought, why not write an application allowing users to register their geographical locations and record their rainfall, and display the data on a map?

This is where Google Maps API comes in. It allows you to populate a map on your own website with your own objects. I was amazed at the amount of free custom controls available for the Google Maps API, and quickly put together the site.

You can see the end result here.

Javascript, Timezones and Google Mail

Posted on by Nicki

Google hosts the email for my domain, and I've always had an issue with the times of messages in the message list displaying incorrectly. I just ignored it for a while, but then it became too irritating to ignore anymore.


The correct time was displayed in IE, but not in FireFox and Google Chrome. Creating a test.html page containing a script tag with the instruction alert(new Date()) showed the differences.

I browsed the Google Help forums for assistance, and the suggestions I found did not help. I found a thread that could be relevant (http://www.google.com/support/forum/p/Google+Apps/thread?tid=68f2eb265a1e0d8b&hl=en) and followed on the postings. After trying a couple of things, bkenelly suggested that I have a look for the TZ environment variable, as the Timezone setting (via double-clicking on the clock) was correct.

There was no TZ environment variable set under My Computer / Properties / Advanced / Environment variables, but executing the SET command in a Command Prompt showed that TZ was defined as CAT2. This caused the mysterious 4h difference. After defining TZ to GMT-2 and restarting Chrome, the time was correct. Hooray!!!

What is this all about?

Posted on by Nicki

When I was a little boy, I had a red knitted jacket that I used to live in, especially in winter. I was so fond of it, the workers on the farm called me Jasman, the Afrikaans for "Jacket Man", directly translated.


On this blog I intend to post about things I encounter in my daily life, from computer programming to toilet flushvalves to linux media center to motorcycle maintenance.

p4tuaqdehb