SEARCH:   GO
{Blog entries}
Author: Javier Callico Created: 9/19/2006
Posts about findings in my daily life as software developer.

Follow these steps to reset the MySQL root user privileges on Windows:

1- Stop the MySQL service

2- Open a command prompt and run the following command:

D:\MySQL\MySQL Server 4.1\bin>mysqld-nt --skip-grant-tables

3- Open a new command prompt and connect to the mysqld server with this command:

D:\MySQL\MySQL Server 4.1\bin>mysql -u root

4- Issue the following statements in the mysql client:

mysql> FLUSH PRIVILEGES;

mysql> USE mysql;

mysql> REPLACE INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0);

mysql> REPLACE INTO user VALUES ('%','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0);

mysql> quit;

5- Open the windows task manager and kill the process with name mysqld-nt.exe

6- Start the MySQL service and now you will have the...

Read More »

I remember that some time ago I had the need to interact with a library written in .NET from MS SQL 2000. Creating a COM+ object using managed code was the first thing that came to my mind (I had done it before using C++). I googled it for a little bit but couldn't find the right way to get this done and since I was really in a hurry ended up creating a simple console application that was called using xp_cmdshell.

Today I had the time to revisit this issue and this time in less than 1 minute the right article came on top of my search results: Microsoft Enterprise Services allows you to create Microsoft COM+ applications using the .NET Framework.

This is the article that explains this process in details:http://support.microsoft.com/kb/306296

How to invoke COM applications from SQL?http://www.sqlservercentral.com/columnists/dasanka/callingcomfromtsql.asp

Read More »

Imagine the following scenario: The table defined below is populated with "key values" available to a given application. These values are generated by other application and inserted in batches from time to time into this "key pool" table.

/* Create table */CREATE TABLE [KeyPool]([KeyPoolId] [int] IDENTITY(1,1) NOT NULL,[Key] [varchar](30) NOT NULL,[IsUsed] [bit] NOT NULLCONSTRAINT [PK_KeyPool] PRIMARY KEY CLUSTERED ([KeyPoolId] ASC))

/* Insert test values */INSERT INTO [KeyPool] ([Key], [IsUsed]) VALUES ('KEY00001',0)INSERT INTO [KeyPool] ([Key], [IsUsed]) VALUES ('KEY00002',0)INSERT INTO [KeyPool] ([Key], [IsUsed]) VALUES ('KEY00002',0)INSERT INTO [KeyPool] ([Key], [IsUsed]) VALUES ('KEY00003',0)INSERT INTO [KeyPool] ([Key], [IsUsed]) VALUES ('KEY00004',0)INSERT INTO [KeyPool] ([Key], [IsUsed]) VALUES ('KEY00005',0)INSERT INTO [KeyPool] ([Key], [IsUsed]) VALUES ('KEY00006',0)INSERT INTO [KeyPool] ([Key], [IsUsed]) VALUES ('KEY00007',0)

How you select a unique key from this table and also marking it as "used" so is not returned again. Given the current conditions, around 5 different processes may be requesting a value at the same time.

...

Read More »

Shows how to convert an object to a byte array using the binary formater and then encoding the resulting byte array to a Base64-encoded System.String.

Read More »

Today I was asked to look into an interesting task that was keeping busy one of my colleagues for a while. It's such a common task that I'm wondering how come I was never presented with something similar before.Let's use an example to better illustrate the task on hand. Imagine you have a notification system that runs daily and creates a list of different events for what individual users need to be notified. This table represents the notification list resulted from the daily run:UserId        EventId-------------------    1        1    1        2    1        3    2        2    3        2    3        4    3        5    4        2    Now a new requirement comes up: All events will be assigned a priority and the users can only received 2 notifications a day for the events with the highest priority.This table represents our Events and their Priority (the bigger the number the highest is the priority):EventId         Priority--------------------    1                8    2                9    3                10    4  ...

Read More »

Introducing the SQL Server Database Publishing Wizard

Read More »

Creating a .NET Custom Control with culture-awareness built-in. This code was originally designed for .NET 1.1 but it also works in 2.0

Read More »

How to avoid the Thread was being aborted error when calling .net webservices by not exceeding the time-out threshold for an ASP.NET request.

Read More »

Take a look at meebo.com... if you are a geek you will like it, if you are not you will like it too :-)

Read More »

Radio Buttons Are Not Mutually Exclusive When used in Repeaters or DataGrids

Read More »