Changing the name of a SQL Server

/* Posted November 25th, 2008 at 10:28am [Comments: none] */
/* Filed under Microsoft, Programming */

Changing the name of a SQL Server
Renaming a system 'beneath' a SQL server causes a variety of problems; SQL goes into an identity crisis, MSDTC develops amnesia and chaos reigns. As a general rule, I don't like to rename servers upon which SQL is installed, but sometimes, there's no choice. Note: you must have an SA-level account or be in the System Administrators group on the SQL Server to perform this operation.

Here are the steps to restore order; again, use at your own risk, no warranty, etc., etc.:

Allow modifications to system catalogs:

In SQL Enterprise Manager, Right-click the SQL Server and select Properties.
Click the "Server Settings" tab
In the "Server Behavior" panel, check "Allow modifications to be made directly to the system catalogs".
Click OK.
Update fields in “sysservers“:

Navigate to Master, Tables and open table "sysservers".
Set the values of field “srvname“ and field “datasource“ to the new server name (you'll note they contain the old server name).
Note: Do not modify "srvnetname"; it modifies itself based on an update to the row.
Cycle the SQL Server and SQL Agent services.
Once the services have been cycled, confirm the change has occurred in Query Analyzer:
SELECT @@SERVERNAME

Restore Order (aka, revoke updates to system catalogs):

In SQL Enterprise Manager, Right-click the SQL Server and select Properties.
Click the "Server Settings" tab
In the "Server Behavior" panel, uncheck "Allow modifications to be made directly to the system catalogs".
Click OK.
Reboot the server and monitor the event log. You will likely see this error:

COM+, Error 4440:

The CRM log file was originally created on a computer with a different name. It has been updated with the name of the current computer. If this warning appears when the computer name has been changed then no further action is required. (original server name).

This error is benign IF the current name of the system is in the “Computer“ field AND the original name of the built system is in the above message. If these are not both correct (as described), retrace the SQL Server steps and ensure you updated both fiels in table “sysservers“.

Note: If you registered your SQL and AS servers in the Enterprise Manager and Analysis Manager as the original server name (as opposed to 'localhost'), you will need to re-register the new server name.

  • Twitter
  • Digg
  • del.icio.us
  • Propeller
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • Mixx
  • Yahoo! Buzz
  • NewsVine
  • Facebook
  • Google Bookmarks

Problems with CVS: “[tag aborted]: cannot rename file, file exists” Error

/* Posted October 9th, 2008 at 7:27am [Comments: none] */
/* Filed under Linux, Programming, Windows */

CVS and SVN logos

I was happily tagging away my just-released source code on my Cygwin Linux for Windows emulation layer using the good old fashioned Cygwin command prompt with the good old fashioned ‘cvs’ command when my tag aborted suddenly and spit out this error:

cvs [tag aborted]: cannot rename file /my/cvs/repo/,userguide.pdf, to /my/cvs/repo/userguide.pdf,v: File exists

…Much to my horror since it was in the middle of a CVS tag operation. This occurs because of a permissions problem, namely that the file cannot be renamed because you don’t have write permissions for it. This is a peculiar anomaly on Windows only, since I certainly did not have userguide.pdf open anywhere. It turns out that WinCVS, like Cygwin, has this problem as well. It seems to occur because the file doesn’t get closed properly for some reason on Windows. If you’re using WinCVS, try shutting it down and restarting it again. Hopefully it will properly close the file. On Cygwin, there’s not really any way to “restart” anything except your entire OS. To get around this, I simply executed the CVS tag again from a proper Linux terminal. On Linux you won’t get this sort of problem. The tagging operation then resumed seamlessly without any problems, even though it had quit halfway on Windows. Or if you must use Cygwin, restart the OS as I mentioned earlier.

  • Twitter
  • Digg
  • del.icio.us
  • Propeller
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • Mixx
  • Yahoo! Buzz
  • NewsVine
  • Facebook
  • Google Bookmarks

SharePoint C# – SecurityException: WebPermission Request Error

/* Posted June 16th, 2008 at 1:47pm [Comments: 6] */
/* Filed under C#, Microsoft, Programming, SharePoint, Windows */

Security Exception
Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application’s trust level in the configuration file.

Exception Details: System.Security.SecurityException: Request for the permission of type ‘System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089′ failed.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

If you care getting the error above in SharePoint, there is a simple work around to get your code to work.

1. Open the wss_minimaltrust.config located: “C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\CONFIG”

2. Under the XML section <namedpermissionsets> and under the last <permissionset> add


<ipermission>
class="WebPermission"
version="1"
Unrestricted="true">
</ipermission>

3. Save the file and you are good to go!

  • Twitter
  • Digg
  • del.icio.us
  • Propeller
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • Mixx
  • Yahoo! Buzz
  • NewsVine
  • Facebook
  • Google Bookmarks

c# Generate a Random Number

/* Posted June 10th, 2008 at 4:53pm [Comments: none] */
/* Filed under C#, Programming */

The following code snippet shows how to generate a random number between a range in C#, where min and max are minimum and maximum range of the new number.

private int RandomNumber(int min, int max)
{
Random random = new Random();
return random.Next(min, max);
}

How to use it?

Copy the above code in your class where you want to use it and call like this:

int returnValue = RandomNumber(5, 20);

  • Twitter
  • Digg
  • del.icio.us
  • Propeller
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • Mixx
  • Yahoo! Buzz
  • NewsVine
  • Facebook
  • Google Bookmarks

Create ID Field in SharePoint List

/* Posted June 2nd, 2008 at 4:45pm [Comments: none] */
/* Filed under Microsoft, Programming, SharePoint */

This seams to be a common problem, and one that I get many calls from users about:

I have a query with our Sharepoint site and was advised that you were probably the best person to ask.

I have created a list under:

http://sharepoint/sites/department/Lists/ListName/AllItems.aspx

I need the first column (Issue ID) to be an automatically generated number but can’t seem to get it. Would it be possible for you to take a look and advise?

You can’t add a new unique auto-generated ID to a SharePoint list, but there already is one there! If you edit the “All Items” view you will see a list of columns that do not have the display option checked.

There are quite a few of these columns that exist but that are never displayed, like “Created By” and “Created”. These fields are used within SharePoint, but they are not displayed by default so as not to clutter up the display. You can’t edit these fields, but you can display them to the user. if you check the “Display” box beside the ID field you will get a unique and auto-generated ID field displayed in your list.

  • Twitter
  • Digg
  • del.icio.us
  • Propeller
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • Mixx
  • Yahoo! Buzz
  • NewsVine
  • Facebook
  • Google Bookmarks

Windows 2008 and SharePoint 2007 Don’t Play Nice

/* Posted May 9th, 2008 at 4:24pm [Comments: 1] */
/* Filed under Microsoft, PC, Programming, SharePoint, Windows */

Recenlty i was trying to get a development environment setup on my new Windows 2008 computer, and was installing the typical Microsoft items. Little did i know that SharePoint 2007 wont install on Windows 2008:

Here is the error I ran into: Read more »

  • Twitter
  • Digg
  • del.icio.us
  • Propeller
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • Mixx
  • Yahoo! Buzz
  • NewsVine
  • Facebook
  • Google Bookmarks

How to Automate your MySQL database backups

/* Posted May 5th, 2008 at 11:00am [Comments: none] */
/* Filed under PHP, Programming */

logomysql1 How to Automate your MySQL database backups

for automating backups, you can use this: http://www.mysqldumper.de/en/

\or you can run this automatic script

Here’s an essential automatic script and a cron job you will need in order to keep your backup automatic.

Yes, if you get a dedicated server, don’t get their stupid extra $15/month for backing up your database. (All they do is make scripts like this one and charge you for it)

You can follow this example and go spend that money on junk food.

So all you have to do is FTP your backup files.

This is way better than going into your phpMyAdmin and downloading from the web interface since the file is already ready for you to download.

Here’s how you do it:

1) Make a new file called backup.sh in your home directory. 2) Use the following syntax:

Read more »

  • Twitter
  • Digg
  • del.icio.us
  • Propeller
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • Mixx
  • Yahoo! Buzz
  • NewsVine
  • Facebook
  • Google Bookmarks

How to widgetize your theme in Wordpress

/* Posted May 5th, 2008 at 10:52am [Comments: none] */
/* Filed under Blogging, Programming */

wordpresstitle1 How to widgetize your theme in Wordpress

Make a file called functions.php in your theme directory. (if you don’t have one yet)

Add the following code and save the file:

if ( function_exists(’register_sidebar’) )
register_sidebar(array(
‘before_widget’ => ”,
‘after_widget’ => ”,
‘before_title’ => ‘

‘,
‘after_title’ => ‘
‘,
));
?>

Then add the following anywhere you want to add dynamic widgets:

Read more »

  • Twitter
  • Digg
  • del.icio.us
  • Propeller
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • Mixx
  • Yahoo! Buzz
  • NewsVine
  • Facebook
  • Google Bookmarks

“Column ordering” not showing up SharePoint List

/* Posted May 2nd, 2008 at 10:18am [Comments: 4] */
/* Filed under Microsoft, Programming, SharePoint */

Missing the Column Ordering button on the List settings screen? Need to figure out how to move items around on the edit screen? Recently I ran into this issue where the “Column Ordering” option that was normally there went missing on a few of my lists.

Go to the list you want to edit
Click on any of the 3 links listed under the Columns section

  • Create column
  • Add from existing site columns
  • Indexed columns
  • In the URL bar, replace the aspx page with “formEdt.aspx” and that will bring you to the Column ordering section.

    Read more »

    • Twitter
    • Digg
    • del.icio.us
    • Propeller
    • Reddit
    • Slashdot
    • StumbleUpon
    • Technorati
    • Mixx
    • Yahoo! Buzz
    • NewsVine
    • Facebook
    • Google Bookmarks

    Emacs Keyword Syntax Highlighting for Verilog, Specman Elite

    /* Posted April 28th, 2008 at 4:04pm [Comments: 1] */
    /* Filed under Programming, Reference */

    If you’re an avid Unix user you’ve probably used Emacs at one point or another. Ever wonder how sometimes when you open up a file (like .cpp) the editor is able to highlight and color all the right keywords pertaining to the programming language the file is coded in? The secret is in the .emacs file located in your home directory. I’ve worked with both Verilog and Specman Elite files before, and found the correct code to add in the .emacs file to enable the beautiful keyword syntax highlighting/coloring that makes the code much more readable. Read more »

    • Twitter
    • Digg
    • del.icio.us
    • Propeller
    • Reddit
    • Slashdot
    • StumbleUpon
    • Technorati
    • Mixx
    • Yahoo! Buzz
    • NewsVine
    • Facebook
    • Google Bookmarks