Thursday, 19 July 2012

Enable .config file build configuration transformations in non-web based applications

Not posible OutOfTheBox in Visual Studio 2010 and not in current Visual Studio 12 RC, but it exists an easy work around in David Sandor blog post.

Monday, 23 April 2012

VirtualBox - error after moving VDI file - Failed to open the hard disk

I was running out of disk space, so I needed to move virtual disk drive (VDI file) to another partition. As normally (read: in other virtualization tools) I removed/detached VDI file from virtual machine, moved it to new partition and added to existing virtual machine in this step error occurred:

"Failed to open the hard disk filepath.vdi
Cannot register the hard disk filepath guid because a hard disk different filepath.vdi with UUID guid already exists.guid "

Solution:
Run following command "vboxmanage internalcommands sethduuid filepath.vdi"

PS vboxmanage.exe is normally located in "C:\Program Files\Oracle\VirtualBox"

Thursday, 5 April 2012

ADT17 bug: "java.lang.NoClassDefFoundError"

After successful build of Android application it crashes with error:

java.lang.NoClassDefFoundError: com.google.android.apps.analytics.GoogleAnalyticsTracker

Or some other class. Probably you have installed new ADT17 update. ;)

Resolution: Move \lib to \libs folder.

Tuesday, 17 January 2012

Database mail not working - restart/re enable service broker


Situation:
- no mail is send
- databasemail.exe is missing in taskmanager
- in event log "An error occurred in Service Broker internal activation while trying to scan the user queue 'msdb.dbo.ExternalMailQueue' for its status. Error: 1222, State: 56. Lock request time out period exceeded. This is an informational message only. No user action is required."

Try:
ALTER DATABASE [msdb] SET SINGLE_USER WITH ROLLBACK IMMEDIATE
ALTER DATABASE [msdb] SET DISABLE_BROKER
SELECT is_broker_enabled FROM sys.databases WHERE name = 'msdb' ;
ALTER DATABASE [msdb] SET ENABLE_BROKER
SELECT is_broker_enabled FROM sys.databases WHERE name = 'msdb' ;
ALTER DATABASE [msdb] SET MULTI_USER

EXEC msdb.dbo.sysmail_stop_sp;
EXEC msdb.dbo.sysmail_help_status_sp;
EXEC msdb.dbo.sysmail_start_sp;
EXEC msdb.dbo.sysmail_help_status_sp;
EXEC msdb.dbo.sysmail_help_queue_sp @queue_type = 'mail';

Thursday, 5 January 2012

How to clean up Word HTML document?

When saving word DOCx as HTML file, you'll huge html file with a lot of classes, tags, etc,.. This on-line Cleanup tool can help you.

Tuesday, 18 October 2011

RAISERROR raises error - not expected behavior on SQL 2005

Description:
We all expect that RAISERROR raises error, but not like this one:

Script:
RAISERROR ('Error', 16, 255 );

Output:
Invalid value 255 for state. Valid range is from 0 to 127

Value for state can be from 0 to 255, according to BOL:
"state
Is an integer from 0 through 255. Negative values or values larger than 255 generate an error.
If the same user-defined error is raised at multiple locations, using a unique state number for each location can help find which section of code is raising the errors."

Solution:
- check SQL Server version (@@VERSION) and if it's 9.0.1399 (Microsoft Sql Server 2005 RTM) it's really time to apply some service pack. SQL 2005 RTM was released on November 7, 2005! ;)

Links:
- http://sqlserverbuilds.blogspot.com/ (list of SQL Server builds)
- http://www.microsoft.com/download/en/details.aspx?id=7218 (Download Microsoft SQL Server 2005 Service Pack 4 RTM)
- http://support.microsoft.com/kb/2507769/ (Cumulative update package 3 for SQL Server 2005 Service Pack 4)

Appendix:
- error in German language version:"Der Wert 255 für den Status ist ungültig. Der gültige Bereich liegt zwischen 1 und 127."

Tuesday, 4 October 2011

Kids don't delete LDF files!

If you have, and no backup etc, read following articles:

try with "CREATE DATABASE name ON fileMDB FOR ATTACH_REBUILD_LOG"
http://social.msdn.microsoft.com/forums/en-US/sqldisasterrecovery/thread/d48bb79b-0403-46d8-abb9-11fff40e7e72/

in case of opened transactions (error:" The protocol can not be rebuilt because there were open on shutdown of database transactions / users that no probe was used for the database or the database was write protected. This error can occur if the transaction log file was manually deleted or lost due to hardware failure or external failure.")

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=114812
http://stackoverflow.com/questions/773059/how-to-recover-database-from-mdf-in-sql-server-2005

Uncommited transacions will appear in recovered databases.