mandag den 13. januar 2014

Fun way to change your daily path

I really enjoy finding new processes/tools to enhance the daily challenge of getting things done. Getting things done can both be tasks at work or private stuff that needs your attention. Changing daily routines, or in my case, trying to incoporate a new daily training session is for me, not just a walk in the park.

Right now I’m trying to see if the online webtool called habitrpg (http://habitrpg.com) is the right helping hand. It uses this rewarding system (the carrot) where you set up some daily tasks (or todo’s or long-term things to either do or not do). You also setup the award you can cash in, when X number of tasks have been done. In my case I’m allowed to bye a cake AND a special beer.

torsdag den 20. juni 2013

Biztalk Sql Agent Job Failed orphaned messages

Today I received an alert on a failing Sql Agent Job on a Biztalk Sql Server. The job was failing cause of errors in the Biztalk Msg Database. The cure for the issue is by using the Terminator Tool. More information on Tord's blog: http://biztalkadmin.com/orphaned-messages-in-the-tracking-database/

torsdag den 8. november 2012

RDP - session hanging

In some cases on some systems I have experienced that my RDP session hangs, and the only thing I can see when logging in on the server is a black screen.

When this happens I have 2 options:

  1. Complain, complain and complain
  2. Call some support fellow, or disturb a colleague who might happen to have access to the same server, and let him kill my RDP session
But this was until today, when I thought to myself: Myself, there must be another way, and there is. Using the commands: quser.exe /server:[servername] from a different server actually tells you which users logged on to the target server. Read out the session-id from the user you want to "kill" and use: logout [session-id] /server:[servername]. This will do the trick.

Thanks Dan Rigsby for sharing this [http://www.danrigsby.com/blog/index.php/2008/08/26/remotely-log-off-remote-desktop-users/]

fredag den 26. oktober 2012

Are your SQL Server Queries slow?

Run this query to see if any of your indexes needs a rebuild or reorganize:
(linked back from this site: http://weblogs.asp.net/okloeten/archive/2009/01/05/6819737.aspx)

SELECT 'ALTER INDEX [' + ix.name + '] ON [' + s.name + '].[' + t.name + '] ' +
       CASE WHEN ps.avg_fragmentation_in_percent > 40 THEN 'REBUILD' ELSE 'REORGANIZE' END +
       CASE WHEN pc.partition_count > 1 THEN ' PARTITION = ' + cast(ps.partition_number as nvarchar(max)) ELSE '' END
FROM   sys.indexes AS ix INNER JOIN sys.tables t
           ON t.object_id = ix.object_id
       INNER JOIN sys.schemas s
           ON t.schema_id = s.schema_id
       INNER JOIN (SELECT object_id, index_id, avg_fragmentation_in_percent, partition_number
                   FROM sys.dm_db_index_physical_stats (DB_ID(), NULL, NULL, NULL, NULL)) ps
           ON t.object_id = ps.object_id AND ix.index_id = ps.index_id
       INNER JOIN (SELECT object_id, index_id, COUNT(DISTINCT partition_number) AS partition_count
                   FROM sys.partitions
                   GROUP BY object_id, index_id) pc
           ON t.object_id = pc.object_id AND ix.index_id = pc.index_id
WHERE  ps.avg_fragmentation_in_percent > 10 AND
       ix.name IS NOT NULL

onsdag den 3. oktober 2012

SQL Server Bulk Insert

How to insert bulk data into a SQL Server Table from a CSV file:


BULK
INSERT TugLookup
FROM 'c:\temp\tuglookup.csv'
WITH
(
FIELDTERMINATOR = ';',
ROWTERMINATOR = '\n'
)
GO
--Check the content of the table.
SELECT *
FROM TugLookup
GO

torsdag den 7. juni 2012

Notes on BizTalk 2010

Some notes around installing and configuration of BizTalk 2010

The installation was done on a virtualized Win 2008R2. Follow this document from Microsoft:

The installation consists of following components:
- SQL Server 2008R2 with SSAS,SSRS and SSIS installed. But be sure to read the installation guide
- Visual Studio 2010 (download the trial version from Microsoft)
- Configuration of the SQL Server (deactivate shared memory on the instance)
- Installation of BizTalk 2010
- Configuration of BizTalk 2010

After this, launch the Administration application.

Tutorial for developing your first BizTalk solution:

torsdag den 26. april 2012

Create multiple scheduled tasks across n-servers

Needed to create the same scheduled task on several servers. Using a bit of Powershell made the task a bit easier. Below functions can be used to create, delete and view scheduled tasks on a specific server:

Function Get-ScheduledTask
 {
 param([string]$ComputerName = "localhost")
 Write-Host "Computer: $ComputerName"
 $Command = "schtasks.exe /query /s $ComputerName"
 Invoke-Expression $Command
 Clear-Variable Command -ErrorAction SilentlyContinue
 Write-Host "`n"
 }
 
# EXAMPLE: Get-ScheduledTask -ComputerName Server01
 
Function Remove-ScheduledTask
 {
 param(
 [string]$ComputerName = "localhost",
 [string]$TaskName = "blank"
 )
 If ((Get-ScheduledTask -ComputerName $ComputerName) -match $TaskName)
  {
  If ((Read-Host "Are you sure you want to remove task $TaskName from $ComputerName(y/n)") -eq "y")
   {
   $Command = "schtasks.exe /delete /s $ComputerName /tn $TaskName /F"
   Invoke-Expression $Command
   Clear-Variable Command -ErrorAction SilentlyContinue
   }
  }
 Else
  {
  Write-Warning "Task $TaskName not found on $ComputerName"
  }
 }
 
# EXAMPLE: Remove-ScheduledTask -ComputerName Server01 -TaskName MyTask
 
Function Create-ScheduledTask
 {
 param(
 [string]$ComputerName = "localhost",
 [string]$RunAsUser = "System",
 [string]$TaskName = "MyTask",
 [string]$TaskRun = '"C:\Program Files\Scripts\Script.vbs"',
 [string]$Schedule = "Monthly",
 [string]$Modifier = "second",
 [string]$Days = "SUN",
 [string]$Months = '"MAR,JUN,SEP,DEC"',
 [string]$StartTime = "13:00",
 [string]$EndTime = "17:00",
 [string]$Interval = "60" 
 )
 Write-Host "Computer: $ComputerName"
 $Command = "schtasks.exe /create /s $ComputerName /ru $RunAsUser /tn $TaskName /tr $TaskRun /sc $Schedule /mo $Modifier /d $Days /m $Months /st $StartTime /et $EndTime /ri $Interval /F"
 Invoke-Expression $Command
 Clear-Variable Command -ErrorAction SilentlyContinue
 Write-Host "`n"
 }
 
# EXAMPLE: Create-ScheduledTask -ComputerName MyServer -TaskName MyTask02 -TaskRun "D:\scripts\script2.vbs"

Borrowed from: this link 

søndag den 25. marts 2012

Doing the BI Certification with Koenig-Solutions in Dubai - Part I

Going to Dubai from Copenhagen is quite easy. I found a flight with Qatar Airways. A quick stop in Doha before arrival in Dubai (1 hour) was OK. Landed in Dubai at 2.10am local time and was kind of tired. Unfortunately many people had choosen to go to Dubai, so getting through customs took about an hour. From here it should be painless, but my suitcase was apparently forgotten in Doha. Luckily many flights go from Doha to Dubai so only 30 minutes of waiting and of to the Koenig Apartment. But now the local time was 4.15am. A quick call to Koenig caretakers to tell them I was coming resultet in a quick welcome and showing to my flat and room. A nice big flat with 2 rooms and 2 bedrooms. Breakfast was at 8am, so not much time to sleep.

A quick shower and rushing to the breakfast which includes eggs, toast, fresh fruit, juice and several types of cerials. Even the ones my kids are not allowed to eat. Then off to the Koenig Office for starting the course, using the Koenig Bus which transports all people, including instructors, to the office. A nice blend of indian, oman, american and danish blend in that bus. At the office the manager at the office welcomed me, informed about the reimbursement of taxi trip and daily cost for lunch. The lunch at the office is done at "food court" where several fast-food stores are present, including KFC and Subway, but also indian and italian style food. Pretty ok selection. Back to what I came for, the SQL 2008 BI course. The instructor - Prakash - introduced to the course, with a overview of the different elements in the course and then we startet. Being the only one on the team is pretty ok. The instruction is a mix of using the traditional (...veryyyyy traditional) Microsoft stuff, with slides and some pretty boring lab exercises. But Prakash also uses a simple whiteboard for introducting the subjects and explaning what the comming module would contain. And this is actually ok. At least when the lab exercies are spiced up with improvised exercises where things not goes as the theory says. And most often, this is where the potential and skills of the instructor becomes visible. But so far its going well. At 13 o'clock it's time for a 1 hour lunch break, which seams like appropriate. Getting some lunch and some rest in the sun is nice. At 17 o'clock the instruction is done, and around 17:15 the bus takes us back to the apartment.

So to sum it up, the experience so far has been positive. The course is going well, so far almost covered the SSAS area in 2 days, been to the pool twice, ran 5 kilometers and had some interesting conversations with the two caretakers.

lørdag den 24. marts 2012

Doing the BI Certification with Koenig-Solutions in Dubai - background

This blogentry is something complete different compared to the little bit of other stuff I've put on the blog. This is about my journey to Dubai for a 12 fast-track course on MS SQL 2008 Business Intelligence. For some time ago I was supposed to attend a course back in Denmark over a couple of months, with a weekly meetup with instructors and fellow students. The course never got off the air and was canceled. This was back in late 2009. Suddenly a opportunity came up for trying to go again, but this time I had heard about Koenig-Solutions, an Indian based course supplier. After a quick check I signed up for a 12 days fast-track course, with base out of Dubai. What this also meant was actually 14 days away from my family, including 3 small kids.

Signing up with Koenig-Solutions was inspired from this guy's blog-post who went to Goa for a course. Going to India is cheaper than going to Dubai, on the contrary Dubai is a shorter flight from Denmark, and no Visa or vaccines is required. Dubai is of course also more western kind-of. So the sum of all is, that I booked 12 days in Dubai with MS SQL 2008 BI Maintain & Development, including 2 MS certifications. The booking and communication with Koenig before the trip has been good, with quick answers on all kinds of questions. Even a question just before scheduled departure because of illness to a family member was handled very well. It turned out that up to start of the course start you can actually cancel and get a almost fully refund. Try that with a european company.

All for now, next blog post will be about the first couple of days in Dubai. 

mandag den 13. december 2010

Learning Ruby

About a month ago I needed something new to learn. And since a long time I have been reading stuff about Rails and how Rails was a fantastic solution for creating websites by using a standard way of handling various common issues when developing websites. Since Rails is build on Ruby I thought it could be a benefit to learn Ruby before opening the big box of Rails. Surfing around the web gave me a link to Rubylearning.org. Rubylearning is a site centeret around learning Ruby and Ruby-centeret stuff like Sinatra. At the time I was ready to learn Ruby they actually launched a Ruby beginner course. The price for the course was low, $14, so what could I loose?

The course was setup with 7 weeks of studying, with a interval of 1 week for each area. Every area would contain some background material to read, and some exercises to solve. Each week has it´s own forum where you upload your exercise-solutions and questions (if any). Within a short time after commiting your stuff a hardworking competent teacher read and commented on your solution. Because everybody could see each other solutions and comments this inspired to change your solution or gave a hint how to solve a exercise. And this was almost the best of the course. In my humble opion the course gave full value for your bucks. Before signing up be prepared to use some extra hours every week on programming puzzles.

So go and see if Rubylearning.org does not have a course for you.

I am hooked on Ruby and have already launched my first Sinatra solution on Heroku used internal at my company. yay

Install Rails 3.0 on Ubuntu 10.10 using RVM


I am on a new tour. I want to find out about that Rails thing. Coming from a .NET world something the Rails world seems interesting enough to have a go at it. I´ve been using a course on www.rubylearning.org for learning the Ruby language itself. I can definitely recommend to do that. A very good course which demands that you actively do something to get through it. But coming back to the Rails thing, this blog-entry should be about how to install Rails 3 on a Ubuntu 10.10. First of all I found out that installing Rails on Ubuntu can be complex but I found out that installing RVM could make life easier. So first of all I installed RVM using this guide: http://ruby.about.com/od/rubyversionmanager/ss/installrvmlinux.htm

After installation of RVM the system should be ready for some Ruby / Rails installation. First install Ruby 1.9.2 by: RVM install 1.9.2


This will fetch the source and compile. So it might take a while before it is done.
Now set the default ruby version with:

ruby --default ruby-1.9.2

now install rails by:

gem install rails <-- don´t use sudo as RVM now takes care of having the gems on your home folder


tirsdag den 31. august 2010

Mythtv and Wii

This is just great - and nerdy ! My running Mythtv installation have had an ongoing issue with an somewhat not working Remote. Ah, ok, it ain't working at all :-) So the good old keyboard has been hooked up, but it is not that pretty. So yesterday I found the solution. A great guy has made a python script which hooks up your Wii controller to your Mythtv installation. That way you can control the myth-frontend. Even using the build in x-y controllers in the Wii controller.

søndag den 27. december 2009

Mythtv & user jobs

I have a running installation of Mythbuntu 8.04 with a DVB-T card installed, and it’s working pretty good. Recently I wanted to get a user-job running which could transcode selected tv recordings to XVID and move them into the Video folders. Setting up the job was not that difficult but running the job did not produce any output. A view in the /var/log/mythtv/mythbackend.log showed a listing with an error in the nuvexport-xvid script at line 36. But that was not interessting. Furthermore the output in the error log showed

No backends found. Please copy /home/myththtv/.mythtv/config.xml from a working Mythtv installation instead

A quick google gave the result. Normal the mythtv-frontend is running under the logged in user, which in my case was me, but the nuvexport-xvid actually did run under the mythtv user, and therefore not config.xml file was found. A copy of the config.xml from my user directory to the mythtv folder solved the issue.

søndag den 25. oktober 2009

Windows 7 stuff

I have been running Windows 7 RC for a couple of months, before the official release of the product. So far I have been very pleased, except for one thing, but that’s a different story. But just tripped over this page with 77 interesting things you can do with Windows 7. For supporters a new tool “Problems Step Recorder” lets the user run through a trouble’ish flow and screen-dumps with information are recorded and saved. The supporter have then possibility to see what actual happens. Nice. But check out all the nice stuff here: http://technet.microsoft.com/en-us/magazine/2009.10.77windows.aspx

Technorati Tags:

onsdag den 7. oktober 2009

Powershell Batch Files Rename

I needed to rename a bunch of files, all starting with “POD_”. I wanted to remove the “POD_” from every file. In my eager to learn Powershell this was a good opportunity to launch the Powershell ISE. After a short Google Search this made my life more Powershellish:

dir -filter "POD_*" |
rename-item -newname { $_.name -replace "POD_*", ""}

The “dir –filter “POD_*” command locates all files. These are piped to the rename-item cmdlet. Using the “-newname” param and some regular-expression, the files are renamed as wanted