2006-04-30

ToolStrip and it's responsiveness

I had a problem with the new .NET 2.0 component "ToolStrip". The problem appeared when switching between forms within an application by clicking on one of the toolstrip buttions. The first click was not "catched" as an event. This was really annoying and I was near switching to the toolstrip components of Infragistics.

First I found a quick solution. I added the event "MouseHover" and then focused on the toolstrip like this:

Private Sub tolMain_MouseHover(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tolMain.MouseHover
tolMain.Focus()
End Sub

It worked but it seemed unnesseary. I did a quick search on the Internet and I found a post from one who had faced and solved the problem. Read more about it here: http://blogs.msdn.com/rickbrew/archive/2006/01/09/511003.aspx

He hade made a C# example and here is my code, converted to VB.NET:


Imports System.Windows.Forms.ToolStrip
Public Class ToolStripEx
Inherits ToolStrip
Private bolClickThrough As Boolean = False

Public Property ClickThrough() As Boolean
Get
Return bolClickThrough
End Get
Set(ByVal value As Boolean)
bolClickThrough = value
End Set
End Property

Public Sub New()
MyBase.new()
End Sub

Protected Overrides Sub WndProc(ByRef m As Message)
MyBase.WndProc(m)
If bolClickThrough Then
If m.Msg = NativeConstants.WM_MOUSEACTIVATE And m.Result = CType(NativeConstants.MA_ACTIVATEANDEAT, IntPtr) Then
m.Result = CType(NativeConstants.MA_ACTIVATE, IntPtr)
End If
End If
End Sub
End Class

Friend Class NativeConstants
Friend Const WM_MOUSEACTIVATE As UInt32 = 33
Friend Const MA_ACTIVATE As UInt32 = 1
Friend Const MA_ACTIVATEANDEAT As UInt32 = 2
Friend Const MA_NOACTIVATE As UInt32 = 3
Friend Const MA_NOACTIVATEANDEAT As UInt32 = 4
End Class

2006-04-24

Long time no blog

There have been a lot of work on VisualCron lately. There is a clear roadmap but sometimes I get busy on sidetracks - smaller o bigger requests by customers. Luckily, my dad, a professional tester has been there helping with testing and documentation.

On the personal side, I have a lot of things that I look forward to. First, the average temperature is increasing every day. Second, there will be a lot of traveling this year. In the end of May, me and Neda are traveling to Istanbul, Turkey. In July we will travel to Malage in Spain. Later in the autumn, me and my friends are going to London.

I haven't had the time to work with the studio yet. Hopefully there will be more time soon..

2006-01-25

WMI Adventures - "Invalid Class", "Not Found" and "Access Denied"

I was trying to monitor the registry with WMI - Windows Management Instrumentation. I could find almost everything in the namespace "root\CIMV2" for my needs except for registry changes. Those where located in "root\DEFAULT" and did not use the regular WQL polling operator "WITHIN".

I searched for examples on the net using C# or VB.NET. The net was quite dry on this subject. I found some examples but when implementing those I got "Invalid Class". After some testing I found that you need to specify the class in the EventQuery. And the class changes depending on the type of registry query you want todo.

Registry changes are divided in three parts:

RegistryTreeChangeEvent - Monitors changes to a hierarchy of keys.
RegistryKeyChangeEvent - KeyPath Monitors changes to a single key.
RegistryValueChangeEvent - ValueName Monitors changes to a single value.

This is a VB.NET example:

Dim evQuery As New WqlEventQuery()
evQuery.EventClassName = "RegistryValueChangeEvent" <--- here you specify the classname which should match the "tablename" in the querystring evQuery.WithinInterval = New TimeSpan(0, 0, 0, 10, 0) evQuery.QueryString = "SELECT * FROM RegistryValueChangeEvent WHERE hive = '" & _ "HKEY_LOCAL_MACHINE" & "' AND KeyPath = '" & _ "Software\\Activision" &amp;amp; "'" & _ "AND ValueName='mamma'"

So remember to change the EventClassName depending on the tablename.

While testing I also stumbled upon the ManagementException "Not found". This error is due to that there is not match in the WQL. Maybe you have specified the wrong KeyPath or your are missing the double backspace.

The error "Access denied" is however not solved. I am getting the error when using the LIKE operator in WQL. If you have any idea about this the please comment that :)

2005-12-20

MSMQ permissions needs a "touch"

Recently I was working with a project where I needed to set up some MSMQ queues at the install phase. I realized I needed to change the security attributes when converting the c# application to a windows service. After scraping the web I found a way to set attributes.

The install went fine but when trying to access that queue I still received errors about permissions. I looked in the MSMQ attributes for that queue in Administrive tools. All was set right. After unchecking and then rechecking a box followed by Apply it worked again. A bug! This workaround/step would not be accepted by the end customer so I had to find a work around. After some testing I found that I could use the function SetPermissions on a queue after setting the permissions in the install. The result looks like this:

// local system account
Trustee t1 = new Trustee();
t1.Name = "SYSTEM";
t1.TrusteeType = TrusteeType.User;
t1.SystemName = ".";
AccessControlEntry ace1 = new AccessControlEntry();
ace1.EntryType = AccessControlEntryType.Allow;
ace1.GenericAccessRights = GenericAccessRights.All;
ace1.StandardAccessRights = StandardAccessRights.All;
ace1.Trustee = t1;

// any other computer
Trustee t2 = new Trustee();
t2.Name = "Everyone";
t2.TrusteeType = TrusteeType.Group;
t2.SystemName = ".";
AccessControlEntry ace2 = new AccessControlEntry();
ace2.EntryType = AccessControlEntryType.Allow;
ace2.GenericAccessRights = GenericAccessRights.All;
ace2.StandardAccessRights = StandardAccessRights.All;
ace2.Trustee = t2;

AccessControlList acl = new AccessControlList();
acl.Add(ace1);
acl.Add(ace2);
MSMQInstaller.Permissions = acl;

// This corrects a bug when previous settings are not correctly applied
// Using the SetPermissions after adding the accesscontrollist applies previous settings
// Remember to use Allow below to keep existing settings
MessageQueue m = new MessageQueue(MSMQInstaller.Path);
m.SetPermissions("SYSTEM", MessageQueueAccessRights.FullControl, AccessControlEntryType.Allow);

2005-10-13

Every day is a new day

I has been a while since I last posted here. I have been spending a lot of time on VisualCron. The future of VisualCron is becoming more clear. There are still of lot of things to implement but the foundation feels very stable.

The "singing-booth" is also ready now. It's a black rectangle, 1.2 * 1.5 meters with 2.2 in height. It is painted black now and I have put up some diffusers. It looks quite good and it sounds very good. I may post some pictures here later. I have to spend some time singing every day. Training singing is like training a muscle. I am very "untrained" right now but a little practice will do the trick!

Both my friend DJ and I have had very little time over to spend on our new project. But it will get better! Our next meeting is on sunday and hopefully everything will be clearer then!

2005-09-07

X-Station finally here

I received my X-Station this monday. Finally. I played around with it for a while. I am a newbie on that area but I got it working with Reason 3 and upgrade the firmware.

At the same day I bought Battlefield 2. Now I am stuck on that one too!

This month will be hectic. A lot of happenings will occur. As usual, besides the music project and BF2, I have another project going on with my friend DJ. Can't tell you anything about it yet but we hope that our idea is as great as we think! :) We'll be finished, hopefully, in the middle of November. But that's a very tight schedule! ;)

Neda and I has booked a trip to London the 16th of December. Just for the weekend. Can you imagine that I have never been there before?!

2005-08-21

VisualCron 2.5.0 released

Finally, after many weeks of work the version above of VisualCron is released. This version was an important step for me and VisualCron.

I have listened to a lot of user requests and implemented the most important things, you can read a list of changes here. Hope you'll like it!

My personal life has been suffering and I hope that this version will calm down most of the users for, at least, a shorter period. So after another weekend of work I go to sleep and wake up to my regular work again ;)

2005-08-19

Free caribbean cruise

I just got a computer, automated call on my home phone saying that I won a caribbean cruise like this:

Congratulations! You’ve won a free caribbean cruise. To reclaim your prize, press 9. That’s the nine-key on your telephone.


I didn't press 9 - I hung up and I think that you should do it too because I have heard that they will charge you 800 Euro and you won't get any trip :)

2005-08-12

Result is what counts

I have not been lazy - I have just been busy like a bee. In the previous weeks I have dreamt about VisualCron and worked late nights. A lot of important steps has been made both which I have mentioned before and new ones.

You, VisualCron users out there, has been lucky because the fact that I have not received my X-Station yet.

I expect the VisualCron release to be within 2 weeks from now.

2005-07-26

Going to Sicily

The clock is 5 am and in less than two hours Neda and I go to Giardini-Naxos in Sicily. It's really hot there right now, about 38 degrees Celsius.

Last week I were with my friends in Gotland, Sweden. The weather was bad but it did not affect the partying! Anyway, I used some of the bad weather to develop VisualCron and the new features are doing great.

The cab is waiting now!

2005-07-12

X-Station delayed..

I received a mail today saying that my X-Station was delayed. "Hopefully" it would come in stock at the end of this month. We'll see, I was thinking of swapping to an M-Audio Ozonic but I don't like the idea of firewire and it has no synthesizer. Cheaper though. I don't have the time anyway right now :) so I'll guess I wait.

Another hot day today. This evening I am going to the gym. Finally I am back on track :) Have I felt this feeling before? ;)

2005-07-11

Soon vacation..

It's been a lot todo lately. Both at work and home. This week is the last before my three weeks of vacation. A short vacation this year.

It's hot in Sweden. Today it is 32C and it has been like this for two weeks now.

There are many things to finish up before the vacation. I hoped to have a new version of VisualCron before the vacation but that seems hard now. I made a version but wasn't satisfied with that design, so now I am redesigning it - hopefully you'll like it. I have received a lot of interesting emails from interesting people lately. It's nice to get to know you, who you are - you out there!

A major event of this week is the arrival of my new toy. Hopefully it will be delivered by end of this week. It isn't crucial because I have so many other things todo so I can't play with it. Are you curious? :) It's a Novation X-station, a midikeyboard with integrated synth, soundcard and mic preamp. I am also building a cube for recording songs. The strategy is to order some sounddiffusers from Germany. I am not sure what will be produced - it's just for fun! But maybe I'll place a link here later!

About vacation. This year we are leaving, all of my friends to Gotland. Gotland is a small island which belong to Sweden. Next, me and my girlfriend are leaving for Sicily, Giardini-Naxos. After that, we'll visit my parents cabin in "Värmland".

Time to go home for today!

2005-06-22

BF2 is not good for VisualCron

A few days ago I tried the Battlefield 2 Demo and now I am stuck. I am thinking about buying the retail version at the release tomorrow. I don't like paying for software but I'm paying for the service, to play online etc - that's the way it should be.

Anyway, I am still making changes to the new version of VisualCron with "Time exceptions". It is some massive gui changes todo as well as coding changes.

On friday we have this holiday in Sweden called "Midsommar", midsummer. I'll spend some time with my friends and Neda to eat and take a break from work. Maybe I'll post some pictures later.

2005-06-13

DNSExit is down

DNSExit.com is down. I haven't had any problems before so this is the first time. Anyway, shit happens. I have spent a lot of time with VisualCron these days. Some minor corrections and some building on new features.

I have some problems with running jobs under certain credentials. After some research I have found that the problems exist due to some security fixes of Microsoft. The user, which a service account normally runs under, can't to any type of impersonation, i.e. try to run a process as another user. What I have heard, this will be possible in .NET 2.0. I am really interested in beginning developing in 2.0. but a small issue :) is that nobody has the runtime, so you are on your own if you try to redistribute it. I thought that I could come around this by just changing the service so that it runs under a different user. However, this produced some other errors, the service could not log anything and logon in the SSL was slow (don't know why). When I tried to impersonate it also produced an initialization error. So I have 3 errors to handle. That's why I am postponing the credential-thing and focusing on time exceptions and running so called "missed events" (when the server has been down or something like that). After that, I promise to take care of the credential thing - maybe that will be in .NET 2.0.

Personal stuff. Yesterday, Neda and I, invited her parents along with some other family members. We ate indian food and had a nice time. Now, it's monday and I am back on work!

Later.

2005-06-09

Cleaning VC up

After the release of the new VisualCron beta I have spent some time fixing bugs which were expected to be somewhere :) A newsletter has been created which the users can subscribe to. I try to send a mail about anf for every update I make.

Right now I am working on time exceptions, i.e. if you don't want your job to execute on a holiday or something like that. This may take some days to finish, I have spent a lot of time in front of the computer lately and I have bad concience for Neda.

Next in line is the "missed events" functionality. If you computer shuts down or something like that, VisualCron will run all the events that should have been run during the downtime, at startup.

See you later..

2005-06-01

Cisco does not like Cisco

After months of struggling with my home network I found a solution. What I experienced was regular disturbance in the network. Listening to WinAmp radio failed after 10 minutes. Strange logs in my router. I have router Linksys RV082 (produced by Cisco). I also have IP-telephony and that device is a Cisco ATA-188. I realised yesterday that these two doesn't like each other. The problem disappeared when I placed a switch between those. I don't know why and I don't want to spend more time on that problem. I am just happy that it works now!

VisualCron 2.0.1 - Beta released!

After many months of work I have released the beta of the new VisualCron. It has a lot of new features which I mentioned before. Soo, maybe I can relax for a few hours and sit and wait for the first bug report to arrive. =) This version feels stable but I had to cut in new functionality. I will be working on the upcoming features - maybe already tonight!

Please send me your comments about the new version - I hope that I am on the right way and this version is for you out there!

2005-05-30

Tough weekend

This weekend has been spent moving heavy items from Neda to me. I was out with the boys on the saturday and when I came home to the apartment it was totally remade. Neda, with her sister and mother were responsible for the makeover. It both looks and feels great.

The sunday was spent on VisualCron. It feels stable right now and I am making minor changes. I have decided what to bring in this version and what to bring in a future versions. The translators have done a great job. Almost all languages have a complete translation.

I am heading home now from the work. Time for some workout and maybe later some VisualCron development.. :)

2005-05-27

5 days

I've spent 5 days on my new job now. Most of the time has been spent on installation and filling gaps in knowledge. There has and will be a lot of other things this week. Neda has started to move in with me. Yesterday she came to me with her car fully loaded with clothes. I had to throw away some of my clothes but I'm sure that I won't miss any of them. This weekend is dedicated till helping Neda moving to me and VisualCron.

VisualCron has kind of paused during this week but I'll continue later tonight. The most important thing is to have a stable beta so new users can try it out and old users can upgrade without having to much disturbance. VisualCron is totally rebuilt and with the changes made I have a totally new platform that better supports new functionality. I have added a lot of new functionality which I hope that users will appreciate.

I have decided that some functionality have to wait due to some problems. For example, running commands as a different user. I know this is an important feature but when VisualCron is running as a service under the system account this is impossible due to security issues. Changing serviceaccount displayed some strange error and I have to do more research there.

I'll try to post changes made here, and what I have been spending my time on.

More information later..

2005-05-25

Post about Neda

Before mentioning her name I in any post I would like to tell you who she is. Neda is my love, grown up in Iran. We have seen each other for about three months now. It feels good - I am feeling relaxed which in itself is a very good sign.

The news is that Neda is moving in with me! We have already started planning the whole thing, which furniture to use and not. Here is a picture, isn't she nice!