2012/09/02

This station is non-operational

I realized that I hadn't posted anything new in a long time and I don't think this will change anytime soon. That doesn't mean that Informatica PowerCenter is a perfect piece of software, so there are no discoveries or tricks I could write about. There are and I ofter post articles about them to an internal knowledge base at work. For legal reasons, I cannot re-post them here.

Also, since the arrival of StackOverflow, I am a regular there and at other StackExchange sites, so it eats up quite a lot of the time I spend online.

I am not going to delete the blog, since some posts are still quite popular and they're getting a considerable number of visits every month.

2011/02/25

Names of custom content types cannot contain slashes

This is a definition of a custom content type generated in Visual Studio. The only thing I changed is the Name attribute.
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <!-- Parent ContentType: Task (0x0108) -->
  <ContentType ID="0x010800096b8767b29a4191929d5cc2d50e094e"
               Name="Yes/No Task"
               Group="Custom Content Types"
               Description="My Content Type"
               Inherits="TRUE"
               Version="0">
    <FieldRefs>
    </FieldRefs>
  </ContentType>
</Elements>
It seems to be perfectly valid. The package can be built and deployed to SharePoint without any errors or warnings. However, the new content type does not show up on the Site content types page (/_layouts/mngctype.aspx).

The problem is caused by the '/' character in content type's name - remove the slash, re-deploy the package and now the new content type will be visible on the Site content types page.

2010/08/30

Error "Violation of PRIMARY KEY constraint 'PK_Name'. Cannot insert duplicate key in object 'dbo.Table'" when applying snapshot to the Subscriber database

When setting up merge replication, you may get the following error:
Violation of PRIMARY KEY constraint 'PK_Name'. Cannot insert duplicate key in object 'dbo.Table'
while the initial snapshot is applied to the Subscriber database.

How can data that violates no primary key constraints at the Publisher cause such an error at the Subscriber? This can be caused by different collations used by the Publisher and Subscriber (at the database, table or column level).

If the Publisher database has a case-sensitive collation (e.g. SQL_Latin1_General_CP1_CS_AS ), the following data is correct (columns Type and Code are a primary key):

Type  Code  Column1
024   N     ...
024   n     ...
024   g     ...

However, an attempt to insert these rows into a table with case-insensitive collation (e.g. Latin1_General_CI_AI) will cause a primary key violation.

2010/08/23

Filter results in SQL Server Management Studio may be case-sensitive

If you are working with a database that has a case-sensitive collation (e.g. Latin1_General_CS_AS), the filter function in SQL Server Management Studio will use this setting and the results will be case-sensitive.

Filter showing tables with Bitmap in the name:


Filter showing tables with bitmap in the name:



If this database had a case-insensitive collation, filter results for Bitmap and bitmap would be identical and would contain all four tables.

2010/03/10

Spotify global hotkeys - AutoHotkey script

My script is based on one I found here.

Hotkeys:

Previous trackWin+1
Play/pauseWin+2
Next trackWin+3
Volume downWin+Q
Volume upWin+W

Script:
#1::
; Previous track
ControlSend, ahk_parent, ^{Left}, ahk_class SpotifyMainWindow
return

#2::
; Play/pause
ControlSend, ahk_parent, {Space}, ahk_class SpotifyMainWindow
return

#3::
; Next track
ControlSend, ahk_parent, ^{Right}, ahk_class SpotifyMainWindow
return

#q::
; Volume down
ControlSend, ahk_parent, ^{Down}, ahk_class SpotifyMainWindow
return

#w::
; Volume up
ControlSend, ahk_parent, ^{Up}, ahk_class SpotifyMainWindow
return
How does it work:

It's very simple - I just mapped my favourite audio player hotkeys to default Spotify keyboard shortcuts, e.g. #1 means Win+1 in AutoHotkey syntax and pressing this hotkey sends ^{Left} (i.e. Crtl+Left) to main window of Spotify application.

2010/01/12

Web Parts Maintenance Page - fixing a SharePoint page with faulty Web Parts configuration

If you ever use Site Aggregator Web Part on the default.aspx page of a site and configure it in a way that redirects users to some other website (specified when adding Site Aggregator) every time they try to open the SharePoint site (I have no idea how I managed to do it), you can use the Web Parts Maintenance Page to resolve this problem. Of course, you can use this page to troubleshoot all other kinds of problems caused by Web Parts misconfiguration.


The URL of the Web Parts Maintenance Page is:

http://SITE-URL/_layouts/spcontnt.aspx?&url=%2fPAGE-WITH-WEB-PARTS.aspx

2010/01/02

BSoD when installing Windows XP on ASUS K61IC notebook

If a bluescreen (Blue Screen of Death) occurs during Windows XP installation and the error message contains the 0x0000007B code, try to do the following:
  1. restart the notebook,
  2. press F2 to enter the BIOS setup,
  3. go to Advanced and then IDE Configuration,
  4. change the SATA Operation Mode setting to Compatible (the default setting is Enhanced).
Some information about the STOP: 0x0000007B error can be found here.

2009/10/21

Error "The remote debugger is not an acceptable version"

If you try to debug an ASP.NET application remotely using Remote Debugging Monitor (msvsmon.exe) and you get the following error:
The remote debugger is not an acceptable version
it means that the versions of Visual Studio and Msvsmon are different (e.g. Visual Studio 2005 + Msvsmon 2008).

2009/05/15

Missing auto-generated Resources.Designer.cs file

If the Resources.Designer.cs file is missing and there is no Run Custom Tool option in the context menu for the Resources.cs file (or, of course, any other resources file), it probably means that the Custom Tool property of the Resources.cs file is empty:


This is what MSDN says about the Custom Tool property:
Custom tools are components that can be used to transform files from one type to another at design time. For example, a custom tool might be a dataset code generator that reads in an XML Schema (.xsd) file and generates classes in a code file that programmatically exposes its tables and columns. There is a predefined list of custom tools available in the product; this property enables you to see which custom tool is applied to a file. In rare circumstances, you might have to change the value of this property. The value of this property must be either blank or one of the built-in custom tools.
In case of Visual Studio 2008 the default tool generating the *.Designer.cs files is ResXFileCodeGenerator - type it in the property and the problem should be solved:


UPDATE:

I found an easier way to do it:

2009/01/25

furl2delicious - a tool to import bookmarks from Furl to Delicious (with tags!)

I decided to switch from Furl to Delicious. Furl is a good bookmarking service, it has a unique feature that I think is very useful - it saves a copy of every bookmarked page. But recently it's been very slow, sometimes I couldn't even log in. Moreover, I like new Delicious design and Firefox integration so much better!

So I decided to switch. But I didn't want to lose more than 500 bookmarks. I tried to use the Delicious import feature - everything went smoothly but all my tags were lost. I looked for a solution on the Internet but I didn't find a working one, so I wrote my own tool.


It imports the following data:
  • the URL,
  • the title,
  • the comments (if there were any),
  • the tags (!),
  • the date when the bookmark was created (!).
I imported my bookmarks - it took about 20 minutes; out of 515 bookmarks that left Furl 501 arrived at Delicious, I didn't investigate why 14 bookmarks were lost.

I used the Delicious.Net library and Visual C# 2005 Express Edition.

Downloads:
furl2delicious - executables
furl2delicious - source code (.NET, C#)

2008/06/14

Last.fm event shoutbox feed - my first Greasemonkey script

I've just uploaded my first Greasemonkey script to userscripts.org. It is called Last.fm event shoutbox feed and can be downloaded from here.

It allows to follow the conversations in Last.fm event shoutboxes easily by subscribing to feeds created for them ('out of the box' Last.fm does not provide feeds for shoutboxes, my script uses hAtom to Atom/RSS transcoder).

Below you can see how it works.



UPDATE:

The script does not work with the new Last.fm, because the microformats were dropped during the re-design.

2008/05/01

Calling a .NET library from a VB6 application

Calling a .NET library from a VB6 application is pretty easy. There are many resources explaining how to do it (e.g. 1, 2, 3, 4). However, all of the (or at least the ones that I have read) forget to mention that, if you are using C#, there is a catch - the assemblies created in C# have a ComVisible attribute set to false by default. This simply means that they cannot be called from a VB6 application.

To change it open the AssemblyInfo.cs file, find the following line:
[assembly: ComVisible(false)]
and change it to:
[assembly: ComVisible(true)]

2008/04/29

Error "Unable to connect to SQL Server '(local)'. The step failed."

If you are using SQL Server 2000 and you have a job with a step that fails with the following error message:

Unable to connect to SQL Server '(local)'. The step failed.

it may mean that this step is configured to use a database that existed when the step was created but has later been dropped.

Moreover, if you don't remember what database this step should use, checking the step definition in Enterprise Manager won't reveal the cause of the problem, because there will be some database selected in the Database combo box (it cannot be empty) but it won't be the same database that the step is really configured to use (this database does not exist so it is not in the combo box).

To fix the problem select a new database for each failing step and save the changes.

2008/04/28

No Back and Forward buttons in Firefox 3

If you use as minimalistic version of Firefox as I do (which means that the Navigation Toolbar is hidden and all the buttons are moved from it to the space next to the address bar), after installing Firefox 3 you will notice that not only are the Back and Forward buttons missing but also you cannot add them from the Customize Toolbar window.

This is because the buttons are already added to the interface but they are not visible because the Navigation Toolbar is hidden.



Of course, the a Back/Forward button (two separate buttons from previous versions have been replaced with a single one) can be moved from the Navigation Toolbar to the place of your choice.

I encountered this problem after upgrading Ubuntu 7.10 (Gutsy Gibbon) to Ubuntu 8.04 (Hardy Heron), but it has nothing to do with Ubuntu. It is caused only by the fact that old Back and Forward buttons have been removed and a new Back/Forward one has been added. And it is placed in its default location (which is the Navigation Toolbar).

2008/03/27

Shrinking an outsized KeePassX/KeePass database

There is an error in KeePassX (and there was a similar bug in KeePass, too) that can cause the database file to grow at a very rapid pace (I don't know what triggers this growth). To be precise, the database size doubles every time it is saved even if a very small change is made.

My database reached 256 MB. KeePass running on Windows XP could not open it (because of an Out of memory error) while KeePassX on Ubuntu could open it but it was taking a few minutes. But the main problem anyway was the fact that I couldn't add new entries or make any changes because the file would grow again.

I tried to shrink the file by saving it as a new database or exporting and then importing it, but it didn't work. I also tried to find a solution on the Internet, but I only found an information that there was such a bug and it was fixed in Windows version. So after a few days I downloaded the KeePass sources, spent half a day (it's been a long time since I last saw a C++ code :) first trying to make them compile (I didn't have a libboost_regex-vc80-mt-sgd-1_34_1.lib library file; I installed it with BoostPro Binary Installer for Visual C++ - take a look here and here) and then trying to find a place in the code where the individual entries get loaded. :)

Finally, it turned out that the problem was caused by an attachment which was taking almost all space in the database file (it had a few KB when I attached it some time ago).

So I placed a line responsible for loading the attachment inside a try... catch... block and added a message box.
try
{
pEntry->pszBinaryDesc = _UTF8ToString((UTF8_BYTE *)pData);
}
catch (...)
{
AfxMessageBox((CString)"There was a problem with reading pszBinaryDesc " 
+ (CString)"field of " + pEntry->pszTitle + (CString)" entry.\n"
+ (CString)"This data has been LOST. However, you can now save the "
+ (CString)"database as a new file and its size should be normal again.", 
MB_ICONEXCLAMATION);
}
Thanks to this if there is a broken (outsized) attachment in some entry, an exception is thrown (important: if you try to run KeePass on Linux using WINE, this exception will not be thrown) and KeePass skips loading it and informs the user that such a problem occurred. Be aware that I didn't find a way to restore a broken attachment so some data is lost, but the database can be opened and saved as a new database. The new database has a normal size.

If anyone has a similar problem, let me know - I can e-mail modified sources or a compiled EXE file.

UPDATE:

A tip from an anonymous reader:
I was able to get around the same issue and shrink my keepass database via "File" -> "Export To" -> "KeePass Database" in v1.14. Using "Save As" wouldn't do it, but exporting did the trick!

2008/03/03

Invalid 'Remote table-valued function calls are not allowed' message error

Assuming that [11.99.120.12] is a linked server created on a SQL Server 2005 computer and pointing to a SQL Server 2000 computer, executing a simple query like this:

  SELECT *
  FROM [11.99.120.12].SALES_DB.dbo.ORDERS (nolock)

will fail with the following error message:

  Server: Msg 4122, Level 16, State 1, Line 1
  Remote table-valued function calls are not allowed.

This error message is not correct, since ORDERS is a table and not a function.

This query will run correctly only if the WITH keyword is used before the (nolock) hint:

  SELECT *
  FROM [11.99.120.12].SALES_DB.dbo.ORDERS WITH (nolock)

This problem is also discussed here.

2008/02/03

What I recently learned about casting an empty string (T-SQL)

SELECT CAST('' AS money)
-- .0000

SELECT CAST('' AS decimal(19,4))
-- Server: Msg 8114, Level 16, State 5, Line 1
-- Error converting data type varchar to numeric.

2008/01/10

Error when attempting to change a revision description (Subversion)

If you cannot modify a revision description in Subversion (SVN) because of the following error:

Repository has not been enabled to accept revision propchanges;
ask the administrator to create a pre-revprop-change hook

(or 'almost in Polish' ;)

Repozytorium nie ma włączone możliwości zmieniania atrybutów;
poproś administratora o utworzenie skryptu hook pre-revprop-change

it can be solved by creating an pre-revprop-change.bat file (in case you are using Windows) in the hooks directory of the repository. Of course the file does not have to be empty, it can do something like logging information about changes being made (because Subversion's revision properties are not versioned).

UPDATE:

On Windows 2003 BAT files cannot be empty - see here.

2007/09/30

Shorewall does not start at boot time

I am neither shell scripting nor security guru, but I think that there is an error in the /etc/init.d/shorewall script that installs with the version 3.2.6-2 of Shorewall.

I installed Shorewall using Synaptic today, configured it and tested that I can start it manually. Then I restarted the computer and found out that there are no rules defined in any iptables chain (sudo iptables -L). I used the sudo invoke-rc.d shorewall start command to check what's happening during boot time and I saw the following error:

  Please read about Debian specific customization in
  /usr/share/doc/shorewall/README.Debian.gz.


After a few minutes of checking by trial and error I knew there was a problem with a piece of code right after the # check if shorewall is configured or not comment and after a few more minutes I modified it and the problem was solved. Below is the modified version - the script was looking for a wrong file and checking a non-existent variable.
# check if shorewall is configured or not
if [ -f "/etc/shorewall/shorewall.conf" ]
then
. /etc/shorewall/shorewall.conf
if [ "$STARTUP_ENABLED" != "Yes" ]
then
not_configured
fi
else
not_configured
fi