10 jaar .net ervaring

by Damiaan Peeters 26. July 2011 23:40

Net gezien…  Je vraagt je af of die persoon de dubbele shiften heeft meegeteld…

image

Voor de niet kenners, op 16 januari 2002 verscheen versie 1.0 van .NET.

Tags:

General | Internet

My tools for Azure

by Damiaan Peeters 20. June 2011 17:56

Lately you see more azure development.  It’s true that Microsoft is highly investing in the platform (and the marketing). As lot of people know Microsoft doesn’t always provide the best tools themselves, but they do support partners to build tools. 

So, what tools am I using currently?  I use

I use also (not storage related but very useful)

  • Spotlight on azure (in Beta from Quest - monitor resources on an instance, see link below)
  • Greybox (easily kill active deployments quickly - http://greybox.codeplex.com – when developing with staging environments, you can't miss this tool !)
  • SqlExaminer & sql data examiner (synchronize you SQLAzure with local or other DB's - http://www.sqlaccessories.com/  - recently had a major upgrade for Azure)

You can find a lot of (paying) tools http://www.cerebrata.com/
or from Quest (all in beta and currently free): http://www.questcloudtools.com/

Scale up on Azure (and pay less)

by Damiaan Peeters 23. April 2011 01:47

Ok, you win a contest and receive an Windows Azure and SQL Azure Extended subscription worth € 500. This package includes 750 hours of a small compute instance and even 1 Business Edition database (up to 10 GB relational database).  Not bad, right?  Many thanks of course for the Belgian Umbraco User Group and Microsoft.

Last few weeks I’ve been testing around with Azure and I am starting to get confortable with it.  Even so confortable I looked at the invoices which contained almost 30 pages for last month only.  Thirty pages, while I didn’t do many heavy things.  And this all for the total amount of € 4,61.

If you want to digg into the € 4,61 split up, you will see that there is € 1.42 for relation databases. And even € 3,19 for compute hours. While this should be included in the package (that’s what they promised me …)

image

If you want to know why:

I was using EXTRA SMALL compute instances and WEB databases instead of SMALL and BUSINESS versions.

Solution

Upgrade your database: login into http://windows.azure.com go to databases and click on the manage button.  Enter your sql credentials and UPGRADE your SQL database:

ALTER DATABASE yourdatabasename
MODIFY (EDITION =  'business', MAXSIZE=10GB)

Then change the CSDEF file and REDEPLOY your solution (this can’t be changed post-deployment)

<ServiceDefinition name="<service-name>" upgradeDomainCount="<number-of-upgrade-domains>">
  <WebRole name="<web-role-name>" vmsize="[ExtraSmall|Small|Medium|Large|ExtraLarge]" >
  or
  <WorkerRole name="<worker-role-name>" vmsize="[ExtraSmall|Small|Medium|Large|ExtraLarge]">

Configuration exception when migrating a ASP.NET application to a Azure webrole

by Damiaan Peeters 31. March 2011 01:50

Ok.  I found why I got a configuration exception every time I launched my azure project (in visual studio 2010). 

I have installed Azure Tools 1.4, on my Visual Studio 2010 SP1.

The problem

When I launched the appFabric / Azure Compute Emulator, I got a my visual studio telling my that I he didn’t have any trace or disassembly information. 

The most annoying part of this situation is that my WebRole Entry point wasn’t started neither.

This was the error (cut some path’s out to keep it readable).

System.Configuration.ConfigurationErrorsException was unhandled
  Message=Configuration system failed to initialize
  Source=System.Configuration
  BareMessage=Configuration system failed to initialize
  Line=0
  StackTrace:
       at System.Configuration.ClientConfigurationSystem.EnsureInit(String configKey)
       at System.Configuration.ClientConfigurationSystem.PrepareClientConfigSystem(String sectionName)
       at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String sectionName)
       at System.Configuration.ConfigurationManager.GetSection(String sectionName)
       at System.Configuration.PrivilegedConfigurationManager.GetSection(String sectionName)
       at System.Diagnostics.DiagnosticsConfiguration.GetConfigSection()
       at System.Diagnostics.DiagnosticsConfiguration.Initialize()
       at System.Diagnostics.DiagnosticsConfiguration.get_IndentSize()
       at System.Diagnostics.TraceInternal.InitializeSettings()
       at System.Diagnostics.TraceInternal.get_Listeners()
       at System.Diagnostics.Trace.get_Listeners()
       at Microsoft.WindowsAzure.ServiceRuntime.Implementation.Loader.RoleRuntimeBridge.Initialize(String[] args)
       at Microsoft.WindowsAzure.ServiceRuntime.Implementation.Loader.RoleRuntimeBridge.Initialize(String[] args)
       at Microsoft.WindowsAzure.Hosts.WaIISHost.Program.RunEntryPoint(Parameters parameters)
       at Microsoft.WindowsAzure.Hosts.WaIISHost.Program.Main(String[] args)
  InnerException: System.Configuration.ConfigurationErrorsException
       Message=Configuration file [CUT].WL.dll.config does not have root <configuration> tag (C:\Users\[CUT]\approot\bin\[CUT].WL.dll.config line 2)
       Source=System.Configuration
       BareMessage=Configuration file [CUT].WL.dll.config does not have root <configuration> tag
       Filename=C:\Users\damiaan.COMM-IT\[CUT]\approot\bin\[CUT].WL.dll.config
       Line=2
       StackTrace:
            at System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(Boolean ignoreLocal)
            at System.Configuration.BaseConfigurationRecord.ThrowIfParseErrors(ConfigurationSchemaErrors schemaErrors)
            at System.Configuration.BaseConfigurationRecord.ThrowIfInitErrors()
            at System.Configuration.ClientConfigurationSystem.EnsureInit(String configKey)
       InnerException:

Solution

So what does it mean.  If you open up the config file mentioned in the (inner) exception. You might notice this is not a complete configuration file.  For me it was my App.Settings file. 

What I did?  I moved my app.Settings into my Web.config file.  And gone was the error.

I think this is a bug. So, I posted it to Microsoft Connect so you can review it overthere:

https://connect.microsoft.com/VisualStudio/feedback/details/654955/system-configuration-configurationerrorsexception-when-starting-website-hosted-by-azure-appfabric-compute-emulator#tabs

Regain administrator access to your SQL EXPRESS 2008 (R2)

by Damiaan Peeters 27. March 2011 23:32

As I described earlier with a plain SQL server loosing access to your own SQL server or database is a very annoying problem.

The Problem

When starting the Azure Compute Emulator I got this error:

Creating database DevelopmentStorageDb20090919...
Cannot create database 'DevelopmentStorageDb20090919' : CREATE DATABASE permission denied in database 'master'.

One or more initialization actions have failed. Resolve these errors before attempting to run the storage emulator again. These errors can occur if SQL Server was installed by someone other than the current user. Please refer to http://go.microsoft.com/fwlink/?LinkID=205140 for more details.

What this error means is:

  • I was using the useDevelopmentStorage=true parameter, so the emulator connects to the default sqlexpress instance (MACHINE\sqlexpress) on the pc. 
  • Once connected, he tried to create a new database

If SQL Express is not installed by the user your are working with.  The current user is NOT a sysadmin and can’t create any databases).  Adding yourself is neither a solution or enabling the SA user as you are not granted access to do so.

The Solution

Launch the “add self to SQL SysAdmin” script created by ward Beattie.

It saves you days of work and searching.

I highly encourage you to DOWNLOAD the script from the original location.  But just for reference and in case the script got deleted or moved, I added the complete script below.

 


@echo off
rem
rem ****************************************************************************
rem
rem    Copyright (c) Microsoft Corporation. All rights reserved.
rem    This code is licensed under the Microsoft Public License.
rem    THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
rem    ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
rem    IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
rem    PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
rem
rem ****************************************************************************
rem
rem CMD script to add a user to the SQL Server sysadmin role
rem
rem Input:  %1 specifies the instance name to be modified. Defaults to SQLEXPRESS.
rem         %2 specifies the principal identity to be added (in the form "<domain>\<user>").
rem            If omitted, the script will request elevation and add the current user (pre-elevation) to the sysadmin role.
rem            If provided explicitly, the script is assumed to be running elevated already.
rem
rem Method: 1) restart the SQL service with the '-m' option, which allows a single connection from a box admin
rem            (the box admin is temporarily added to the sysadmin role with this start option)
rem         2) connect to the SQL instance and add the user to the sysadmin role
rem         3) restart the SQL service for normal connections
rem
rem Output: Messages indicating success/failure.
rem         Note that if elevation is done by this script, a new command process window is created: the output of this
rem         window is not directly accessible to the caller.
rem
rem
setlocal
set sqlresult=N/A
if .%1 == . (set /P sqlinstance=Enter SQL instance name, or default to SQLEXPRESS: ) else (set sqlinstance=%1)
if .%sqlinstance% == . (set sqlinstance=SQLEXPRESS)
if /I %sqlinstance% == MSSQLSERVER (set sqlservice=MSSQLSERVER) else (set sqlservice=MSSQL$%sqlinstance%)
if .%2 == . (set sqllogin="%USERDOMAIN%\%USERNAME%") else (set sqllogin=%2)
rem remove enclosing quotes
for %%i in (%sqllogin%) do set sqllogin=%%~i
@echo Adding '%sqllogin%' to the 'sysadmin' role on SQL Server instance '%sqlinstance%'.
@echo Verify the '%sqlservice%' service exists ...
set srvstate=0
for /F "usebackq tokens=1,3" %%i in (`sc query %sqlservice%`) do if .%%i == .STATE set srvstate=%%j
if .%srvstate% == .0 goto existerror
rem
rem elevate if <domain/user> was defaulted
rem
if NOT .%2 == . goto continue
echo new ActiveXObject("Shell.Application").ShellExecute("cmd.exe", "/D /Q /C pushd \""+WScript.Arguments(0)+"\" & \""+WScript.Arguments(1)+"\" %sqlinstance% \""+WScript.Arguments(2)+"\"", "", "runas"); >"%TEMP%\addsysadmin{7FC2CAE2-2E9E-47a0-ADE5-C43582022EA8}.js"
call "%TEMP%\addsysadmin{7FC2CAE2-2E9E-47a0-ADE5-C43582022EA8}.js" "%cd%" %0 "%sqllogin%"
del "%TEMP%\addsysadmin{7FC2CAE2-2E9E-47a0-ADE5-C43582022EA8}.js"
goto :EOF
:continue
rem
rem determine if the SQL service is running
rem
set srvstarted=0
set srvstate=0
for /F "usebackq tokens=1,3" %%i in (`sc query %sqlservice%`) do if .%%i == .STATE set srvstate=%%j
if .%srvstate% == .0 goto queryerror
rem
rem if required, stop the SQL service
rem
if .%srvstate% == .1 goto startm
set srvstarted=1
@echo Stop the '%sqlservice%' service ...
net stop %sqlservice%
if errorlevel 1 goto stoperror
:startm
rem
rem start the SQL service with the '-m' option (single admin connection) and wait until its STATE is '4' (STARTED)
rem also use trace flags as follows:
rem     3659 - log all errors to errorlog
rem     4010 - enable shared memory only (lpc:)
rem     4022 - do not start autoprocs
rem
@echo Start the '%sqlservice%' service in maintenance mode ...
sc start %sqlservice% -m -T3659 -T4010 -T4022 >nul
if errorlevel 1 goto startmerror
:checkstate1
set srvstate=0
for /F "usebackq tokens=1,3" %%i in (`sc query %sqlservice%`) do if .%%i == .STATE set srvstate=%%j
if .%srvstate% == .0 goto queryerror
if .%srvstate% == .1 goto startmerror
if NOT .%srvstate% == .4 goto checkstate1
rem
rem add the specified user to the sysadmin role
rem access tempdb to avoid a misleading shutdown error
rem
@echo Add '%sqllogin%' to the 'sysadmin' role ...
for /F "usebackq tokens=1,3" %%i in (`sqlcmd -S np:\\.\pipe\SQLLocal\%sqlinstance% -E -Q "create table #foo (bar int); declare @rc int; execute @rc = sp_addsrvrolemember '$(sqllogin)', 'sysadmin'; print 'RETURN_CODE : '+CAST(@rc as char)"`) do if .%%i == .RETURN_CODE set sqlresult=%%j
rem
rem stop the SQL service
rem
@echo Stop the '%sqlservice%' service ...
net stop %sqlservice%
if errorlevel 1 goto stoperror
if .%srvstarted% == .0 goto exit
rem
rem start the SQL service for normal connections
rem
net start %sqlservice%
if errorlevel 1 goto starterror
goto exit
rem
rem handle unexpected errors
rem
:existerror
sc query %sqlservice%
@echo '%sqlservice%' service is invalid
goto exit
:queryerror
@echo 'sc query %sqlservice%' failed
goto exit
:stoperror
@echo 'net stop %sqlservice%' failed
goto exit
:startmerror
@echo 'sc start %sqlservice% -m' failed
goto exit
:starterror
@echo 'net start %sqlservice%' failed
goto exit
:exit
if .%sqlresult% == .0 (@echo '%sqllogin%' was successfully added to the 'sysadmin' role.) else (@echo '%sqllogin%' was NOT added to the 'sysadmin' role: SQL return code is %sqlresult%.)
endlocal
pause

Configuration of MySQL 5.5 on Websitepanel

by Damiaan Peeters 11. March 2011 19:36

So I followed these steps to activate MySQL 5.5 on our websitepanel deployment.

The current version of Websitepanel (1.1.0) doesn’t support Mysql by default.  However, with a few small changes you can get the Mysql version 5.5 to work.

<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependentAssembly>
<assemblyIdentity name="MySql.Data" publicKeyToken="c567fc88969c44d" />
<bindingRedirect oldVersion="0.0.0.0-6.3.5.0" newVersion="6.3.6.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>

  • Finally add and update the MySQL configuration in website panel.  These where the values I used
    • Internal Address: 127.0.0.1:3306
    • MySQL Installation Folder: C:\Program Files\MySQL\MySQL Server 5.5
    • Database Browser Logon URL: http://phpmyadmin.ourdomain.com/index.php
    • Root login: root
    • Root password: our root password

There is still a bug with deleting the database.  There are solutions available for this problem, but it’s not urgent for me.  So I didn’t tried it.

How to show off with cmd

by Damiaan Peeters 25. January 2011 23:30

If you use CMD.exe, then just hit F7.  It will give you all previous commands as shown in the screenshot below.

image

Oh btw, because I almost forgot.  There is a easy command prompt to create a new file.

copy con filename.txt

Hit return, just type your text and and with CTRL + Z (and return). You will now have a file with the content you wanted.  Thanks to Scott Hanselman for reminding me!

How to save on your DevExpress subscription

by Damiaan Peeters 22. December 2010 18:11

Normally you would guess that the price goes down when you order for a longer period.  Not with DevExpress components.  It depends on the date until when you want your subscription to be extended. 

I made some calculations.  Apparently there can be a difference of more than $ 0,25 PER DAY for your subscription.

image

So how to save with devexpress subscriptions.  You try to find:

  • a coupon code for your devexpress subscription
  • ask a quote
  • find the best date

I hope it helps you Smile

This is what they call cross selling

by Damiaan Peeters 17. November 2010 13:35

image

Translated: “Customers who viewed the IP phone bought eventually a stamping machine. “

Found this one on site of “Viking”.  They sell a Profoon IP-320 but the link area at the right they advertise a stamping machine. 

I don’t see the link between the two categories.  I guess that they call this cross selling? 

What do you think?

Tags:

Internet

Notepad font size is adjustable

by Damiaan Peeters 4. November 2010 13:20

Notepad is a stripped down of wordpad.  My guess.   Just see this screenshot and judge yourself!

image

Noticed the changes in the font size?

Who.I.am

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

Month List