Note to self

by Damiaan Peeters 22. June 2008 15:31

Defragment from time to time your disk.

image

(22% free space)

MSSQL error message: "Property Owner is not available for Database [databaseName]"

by Damiaan Peeters 22. June 2008 10:43

Problem

When i clicked on the properties of the Database, I got this error on 2 of my Microsoft SQL Server 2005 databases.

image

TITLE: Microsoft SQL Server Management Studio

Cannot show requested dialog.

ADDITIONAL INFORMATION:

Cannot show requested dialog. (SqlMgmt)

Property Owner is not available for Database '[myDatabaseName]'. This property may not exist for this object, or may not be retrievable due to insufficient access rights.  (Microsoft.SqlServer.Smo)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.3042.00&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.PropertyCannotBeRetrievedExceptionText&EvtID=Owner&LinkId=20476

Cause

I have restored this databases in the past from other server's backup, and my original login is apparerently not available on target server.

image

Solution

You can fix it with 'sp_changedbowner sa'.

update:
I removed '2005' the subject of this post because you can have this error message on the Newer SQL Server 2008 also.

update 2:
The syntax to use in SQL Server Management Studio is:

use myDBName
EXEC sp_changedbowner 'sa'

NDepend

by Damiaan Peeters 21. June 2008 08:58

A few days ago I received my NDepend license. 

What is NDepend

On their web site (http://www.ndepend.com), it states that :

NDepend is a tool that simplifies managing a complex .NET code base.

So in other words, (also on the web site)

Architects and developers can analyze code structure, specify design rules, plan massive refactoring, do effective code reviews and master evolution by comparing different versions of the code.

Out of my experience, I know - I really know - that bad designed software is a nightmare to maintain.  Worsted of all is that most of the time is it horribly coded and badly documented.  I've done seen in the past, and I am still struggling today.  It's easy to guess where the problems are, or how you could make the application better.  Because guessing is most of the time not the proven to be good, scientists created something like "metrics". 

Metrics measure your software, code base or even your software design.  NDepend uses these metrics and also the dependencies between your assemblies to tell you more about your application.

More about NDepend later!

Defragmentation

by Damiaan Peeters 20. June 2008 15:28

Everyone knows that I am a "defragmentation-tool user".  Yes, I defragment my drives regularly.  And yes, I am convinced that it helps to keep my PC up and running.  (No, I do not want to reinstall my PC every few months.)

You should definitely check out the new tool from Piriform (the company that created CCleaner and Recuva...), it is called Defraggler!

It doesn't seem the fastest tool on the market, but it has a nice features.

E.g.  You can defragment a file or all files in a Folder.  How cool is that?  I always wondered if deframentation of one file would speed up its loading time.  Or image you have a folder with files that are regularly updated, you might be interested in defragmenting this folder, but leaving the rest of your disk alone.  Of course you can defragment your freespace too.

image

Altough it is a release candidate, it seems a very decent and stable tool.  And the best of all, it is free for personal and corporate use.  (yes, defragmentaion runs on Windows Server 2003) . 

Hooray!

Font with special zero

by Damiaan Peeters 13. June 2008 14:21

I know that IT people and programmers struggle searching fonts with a zero (0) that differs from a 'o' (or O).  Very handy to show license key's with 0 (zeroes).

What would you think of this font?

The Raize Font is a clean, crisp, fixed-pitched sans serif screen font that is much easier to read than the fixed pitched fonts that come with Windows. Ideally suited for programming, scripting, html writing, etc., the Raize Font can be used in any IDE or text editor.

image

Oh by the way, it's free!

http://www.raize.com/DevTools/Tools/RzFont.asp

Tags: ,

General

"Show this folder as an e-mail Address Book" check box is disabled in Outlook 2007 Contact folder properties

by Damiaan Peeters 27. May 2008 19:13

2008-05-26 - SOLVED

Problem

I had this problem that my e-mail contacts where not linked to my e-mails.  I found this "Show this folder as an e-mail Address Book", but i was unable to activate the checkbox.

According to the Microsoft Support website you can solve this

When these too solutions are not working you are pretty much left on your own. 

Cause

I've read in my search for a solution that Microsoft Outlook (2007) might loose track of the address book when you move datafiles, when you migrate form a other system or ...

It might be possible that the mail profile gets damaged.

[more] 

Solution

Google and Live served me no solution so i re-read the support articles.
The solution is mentioned if you carefully read the KB 197577 .  It states:

"Your profile is damaged and does not recognize the Outlook Address Book service."

As i was searching for several hours for a solution, I didn't focussed on repairing the profile. I just deleted my mail profile and created a new one. 

These steps solved the issue for me:

  1. take note (and backup's) of all existing outlook settings: attached datafiles, account settings (hostnames, usernames, passwords!), ...
  2. be sure that outlook is not anymore in memory, reboot if necaissary
  3. go to "Mail" in configuration panel (under users for Windows Vista),
  4. remove the profile,
  5. create a profile
  6. start outlook,
  7. re-attach other datafiles datafiles and remove newly created datafiles (for the new profile)
  8. ACTIVATE the "Show this folder as an e-mail Address Book"
  9. Be happy

Hope it helps.

Searching in all tables and columns of a database

by Damiaan Peeters 26. May 2008 12:57

There are a lot of people struggling with finding data.  What about these two solutions... Google gave me these solutions...

When you know little about a database or can't remember it is often nice to be able to do global type searches on that database. This scenario can be thought of in two ways.

  • Search database schema
  • Search database data

Below I describe how to do both on a MS SQL database.

Search MS SQL Server for any text | Just Geeks 

 

And what do you think of this problem...  I guess you know the problem...

I was forced recently to do some maintenance and bug fixing on an aging .NET-based CMS.

Most of the problems were in the SQL Server database, with lots of corrupted entries. The most frustrating thing however was that at times I didn’t even know where to find the entries. Try finding some specific strings in a database with a hundred tables, each with many columns (poorly named, obviously) and tens of thousands of records – it’s like finding the proverbial needle in the haystack.

Searching in all tables and columns of a database | RichNetApps Developers' blog

Vista update KB940510 available

by Damiaan Peeters 21. May 2008 23:31

No problem for me..  but is it for you?

image

"Install this update to enable Windows Vista to detect software that bypasses product activation and interferes with normal Windows operation"

Tags:

General

Change Keyboard layout in Windows XP and Windows Server 2003 at logon screen

by Damiaan Peeters 10. May 2008 08:53

While you had to Cannot log on after changing keyboard settings, you can now just configure it.

All you have to do is:

  • Open control panel
  • open the regional and language options
  • go to the advanced tab
  • Activate the "Apply all settings to the current user account and to the default user profile"
    image
  • Press Apply or OK, log off and you will see that the keyboard has the layout you wanted...

The same solution is valid for Windows XP.

Eval Statement and .Net Runtime Compilation (retry)

by Damiaan Peeters 9. May 2008 11:44

Yes I come from a VBA environment.  Microsoft Access all the way.  Last years I am into .Net but I was still missing my "good old" Eval statement.  A colleague triggered my curiosity and I started digging for a solution.

We dive into 2 methods.  The first is using the Microsoft Script Control, the second is the Runtime Compilation.

[more]

The easiest solution is probably to take the "Good Old" eval method from where it is available.  This means that you will need to set a reference to: COM Microsoft Script Control 1.0

MSScriptControl.ScriptControlClass mScriptControl; mScriptControl = new MSScriptControl.ScriptControlClass(); mScriptControl.Language = "VBScript"; mScriptControl.AllowUI = false;  mScriptControl.Reset(); try {    retval = mScriptControl.Eval(s);     } catch{ /* ... */ } 

You have to admit, this isn't to difficult.
This is well described on vb-tips.com

Another solution would be Compilation at Runtime. 

The simplest example I found was at EggheadCafe: Build a Custom .NET "EVAL" Provider.  It is created for VB, but can easily be changed to C#.

For archiving purposes, here is the code...

VBCodeProvider c = new VBCodeProvider();ICodeCompiler icc = c.CreateCompiler();CompilerParameters cp = new CompilerParameters();cp.ReferencedAssemblies.Add("system.dll");cp.ReferencedAssemblies.Add("system.xml.dll");cp.ReferencedAssemblies.Add("system.data.dll");cp.CompilerOptions = "/t:library";cp.GenerateInMemory = true;StringBuilder sb = new StringBuilder("");Debug.WriteLine(sb.ToString());// look at this to debug your eval stringCompilerResults cr = icc.CompileAssemblyFromSource(cp, sb.ToString());System.Reflection.Assembly a = cr.CompiledAssembly;object o;MethodInfo mi;o = a.CreateInstance("PAB.PABLib");Type t = o.GetType();mi = t.GetMethod("EvalCode");object s;s = mi.Invoke(o, null);return s;

To compile some c# code at runtime I found the Runtime Compilation (A .NET eval statement) article on CodeProject.  This is a library which cuts out the compiler references etc. If you use this 'Evaluator' class, you can call a e.g. a StringChanger method as described below.  This code is also available on the mentioned page as example.

string myCode = "s =+ \" TEST\"; return s";

MethodResults stringChanger = null;StringBuilder source = new StringBuilder();source.Append("public string StringChanger(string s)");source.Append(Environment.NewLine);source.Append("{");source.Append(Environment.NewLine);source.Append(myCode);source.Append(Environment.NewLine);source.Append("}");try{ stringChanger = Eval.CreateVirtualMethod( new CSharpCodeProvider().CreateCompiler(), source.ToString(), "StringChanger", new CSharpLanguage(), false);}catch(CompilationException ce){ MessageBox.Show(this, "Compilation Errors: " + Environment.NewLine + ce.ToString()); return;}try{ output.Text = (string)stringChanger.Invoke(inputString.Text);}catch(System.Reflection.TargetInvocationException tie){ MessageBox.Show(this, "Method-Thrown Exception: " + Environment.NewLine + tie.InnerException.ToString()); return;}

We learned today that there are many possibilities with the System.Reflection and the System.CodeDom.Compiler namespaces.

Who.I.am

Certified Umbraco, .net and Azure developer, seo lover. Magician in my spare time.

Month List