Monday, May 29, 2006

Well, I’ve been using realvnc (www.realvnc.com), and I think it’s neat. Now granted, I’ve only used it on my local network, which is a workgroup and not a domain; but I like it much more than the Remote Desktop that comes with Windows XP.

The reason I like it better than Remote Desktop is because I can share a desktop among more than one computer. I run Windows XP Pro SP2, and I’ve found that when I connect to another computer with Remote Desktop, my local computer logs off.

What I want is to share a program with multiple computers. You know, I’m running an app and I want three or four friends to also see that app. In fact I want more than that … I want those three or four friends to be able to take control of my app – click a checkbox or click a button. I can do this with realvnc.

We have used gotomeeting (www.gotomeeting.com) for this. Gotomeeting is a great program and works fine over the Internet. And I haven’t tried realvnc over the Internet. I think the cost of gotomeeting is reasonable. It’s about $50/month, but realvnc has a free version.

There are for-pay versions of realvnc. On their website you can compare features. The personal edition does encryption and file transfer along with some other features that I don’t understand like “one-port HTTP & VNC” and “Desktop Scaling.” The cost is reasonable (about $30 for each server site). I have not tried running the viewer on a site that does not have the server.

Gotomeeting has a messaging capability that realvnc lacks (or I haven’t found it.) This is not a big loss for me. We like to use Skype (www.skype.com) for voice communication anyway. BTW, Skype works really well over broadband and over the free wireless I can pick up in various coffee shops, but it worked terribly with PeoplePC. I had dialup PeoplePC for a while and was not impressed with its performance and got somewhat irritated with its silly user interface.

When I first started using realvnc, I was not able to share a desktop with several computers. When another viewer connected to my VNC server, the computer with the previous view lost its connection. Easily fixed, though, you got to configure the VNC viewer to have a shared connection. To do this open the viewer and click on Options before you connect to the VNC server. Then, under the Misc tab, choose “Shared connection…”

 

Here’s a screenshot of one of my computers running the viewer and connection to another of my computers running the server.

 

Now admittedly I have not tried this over the Internet yet. I don’t know what kind of problems firewalls and NAT routers will give me, but so far I really like realvnc.

Anyone else using it?

5/29/2006 3:04:17 PM (Pacific Daylight Time, UTC-07:00)  #    Disclaimer  |  Comments [4]  |  Trackback
 Friday, May 05, 2006

All the different .NET Remoting varieties have similar but not identical configuration files. And there are a lot of optional elements I am not showing. My description here is by no means complete. (For a full description of remoting configuration files, see the MSDN article Format for .NET Remoting Configuration Files – a good article, but could use more examples.)

What I’m trying to do is clear up some of the simple stuff for myself. So if someone sees an error here, I really would appreciate knowing.

Remote objects can be CAOs or SAOs and when they are SAOs, they can be singleton (stateful and all clients share state) or single-call (stateless). CAOs are stateful , and each client has its own state.

SAO (server side)

On the server, the config file looks like …

<?xml version="1.0" encoding="utf-8" ?>

<configuration>

  <system.runtime.remoting>

    <application>

     <lifetime>

     </lifetime>

      <service>

       <wellknown mode = "Singleton"

        type = "StepByStep3_1.DbConnect, StepByStep3_1"

        objectUri="DbConnect" />

      </service>

      <channels>

       <channel ref="tcp" port="1234" />

      </channels>

      </application>

   </system.runtime.remoting>

</configuration>

 

Well, that you have a <service></service> element tells me that this is a config file on a server. <wellknown … /> tells me that it is an SAO; the mode attribute makes it a singleton.

This file chooses a tcp channel, but it could just as easily been an http channel.

Often for examples, I just create a console application as a simple server to host the remotable class. I could instead run the server process as a Win service or use IIS as an activation agent for the server process.

If you wanted to use IIS as an activation agent, the channel would have to be http.  Also, the objectUri value would have a .rem extension. My server would be a web app and the configuration would be in web.config. I would not specify a port number because IIS automatically uses port 80. I wouldn’t have a <channels></channels> element either. My web.config would look like …

<configuration>  

 <system.runtime.remoting>

  <application>

   <service>

    <wellknown mode="Singleton"

     type="StepByStep3_10.DbConnect, StepByStep3_10"

     objectUri="DbConnect.rem" />

   </service>

  </application>

 </system.runtime.remoting> 

<!-- other web.config stuff -->

</configuration>

 

SAO (client side)

On the client side, the config file (for the app that uses the remote object) looks like …

<?xml version="1.0" encoding="utf-8" ?>

<configuration>

 <system.runtime.remoting>

  <application>

   <client>

    <wellknown

     type = "StepByStep3_1.DbConnect, StepByStep3_1"

     url="tcp://localhost:1234/DbConnect" />

   </client>

  </application>

 </system.runtime.remoting>

</configuration>

 

That you have a <client></client> element tells me that this is a config file on a client. <wellknown … /> tells me that it is an SAO; there is no mode attribute because the client does not care about the mode.

Note that the value of the url attribute ends with the objectUri of the server-side config file. It also specifies the name of the computer that hosts the remote object and the port it uses. This example uses a tcp channel, but it could just as easily have been an http channel.

However, if you’re using IIS as an activation agent, the channel would have to be http. The url attribute value would end in .rem. And I would not specify a port number.

CAO (server side)

On the server, the config file looks like …

<?xml version="1.0" encoding="utf-8" ?>

<configuration>

  <system.runtime.remoting>

    <application>

      <service>

       <activated

        type = "StepByStep3_1.DbConnect, StepByStep3_1"

       />

      </service>

      <channels>

       <channel ref="http" port="1234" />

      </channels>

      </application>

   </system.runtime.remoting>

</configuration>

 

That you have a <service></service> element tells me that this is a config file on a server. <activated … /> tells me that it is an CAO; there is no mode attribute because the client does not care about the mode.

CAO (client side)

On the client side, the config file looks like …

<?xml version="1.0" encoding="utf-8" ?>

<configuration>

 <system.runtime.remoting>

  <application>

   <client url="http://localhost:1234">

    <activated type="StepByStep3_1.DbConnect,StepByStep3_1" />

   </client>

  </application>

 </system.runtime.remoting>

</configuration>

 

That you have a <client></client> element tells me that this is a config file on a client. <activated … /> tells me that it is an CAO; there is no mode attribute because the client does not care about the mode.

IIS does not support CAO.

 

5/5/2006 10:16:00 AM (Pacific Daylight Time, UTC-07:00)  #    Disclaimer  |  Comments [5]  |  Trackback
 Sunday, April 30, 2006

Installation

You know I thought this problem went away with the beta, but it apparently is still there. I had installed Visual Studio 2005 Professional, used it for a while and then tried to install SQL Server 2005 Development Edition. I never get to see the Management Studio. It seems that my computer always wants to use SQL Express.

I can see the Management Studio if I install SQL Server 2005 Development Edition without previously installing Visual Studio 2005 Professional. I haven’t yet tried installing Visual Studio 2005 Professional after installing SQL Server 2005 Development Edition to see if they work together.

Here’s the version of Visual Studio 2005 Professional that I have.

 

Microsoft Visual Studio 2005

Version 8.0.50727.42  (RTM.050727-4200)

Microsoft .NET Framework

Version 2.0.50727

 

Installed Edition: Professional

 

Accessing Data with SQL Express

I have been using Visual Studio 2005 for a while now, but just recently tried accessing a database with SQL Server Express. I had a rude awakening. I couldn’t use the method I had become familiar with. I finally got this to work, but I didn’t find the documentation trail easy. No one ever talks about this; everyone must have figured it out a long time ago, I guess.

Here’s what I tried to do that did not work. I got error messages like cannot login to the database or something cryptic about named pipes. I didn’t pursue the details of the error message. I mean I might have to later, but experience has told me that it is more efficient to figure out how to do something than to analyze why the method you tried did not work. Sometimes it’s frustrating to do that, but the pursuit of knowledge can get in the way of getting the job done. My academic friends are now shaking their heads and wagging their fingers.

I should mention that I can access the data in the database just fine with Server Explorer

Anyway, here’s what I tried to do (that did not work)…

SqlConnection cnn = new SqlConnection();

cnn.ConnectionString = "Data Source=beachparty;" +

   "Initial Catalog=Northwind;" +

   "Integrated Security=SSPI";

SqlCommand cmd  = cnn.CreateCommand();

cmd.CommandType = CommandType.Text;

cmd.CommandText = "SELECT CompanyName FROM Customers " +

    "ORDER BY CompanyName";

cnn.Open();

 

Here’s what I did instead that worked…Is there a better way? I’m sure there is. If you know of one, please don’t keep it a secret!

I chose Data-Add New Data Source… from the Visual Studio menu, I chose Database and clicked Next.

 

Look at that connection string. Not what I expected. Click Next again.

 

I click Next and get asked what I want in my Dataset. I don’t really want a Dataset, so I choose nothing and click finish. The result is that I get a NORTHWNDDataSet.xsd, which I then delete. But what I gained that I wanted was an app.config file, which has the appropriate connection string.

<?xml version="1.0" encoding="utf-8" ?>

<configuration>

    <configSections>

    </configSections>

    <connectionStrings>

        <add name="StepByStep7_7.Properties.Settings.NORTHWNDConnectionString"

            connectionString="Data Source=.\SQLEXPRESS;

               AttachDbFilename=&quot;C:\SQL Server 2000 Sample Databases\NORTHWND.MDF&quot;;

               Integrated Security=True;Connect Timeout=30;User Instance=True"

               providerName="System.Data.SqlClient" />

    </connectionStrings>

 

The point now is how to take advantage of that new connection string stored in the app.config. I noticed that under my project (called AppA) in the Solution Explorer, I see a section called Properties. I can expand that and see a file called Settings.Designer.cs.

 

This file resides in the namespace AppA.Properties, so I put a using AppA.Properties at the top of my winform. I also notice that the file has a property called NORTHWNDConnectionString.

public string NORTHWNDConnectionString {

   get {

      return ((string)(this["NORTHWNDConnectionString"]));

   }

}

 So I replace the connection string assignment

cnn.ConnectionString = "Data Source=beachparty;" +

   "Initial Catalog=Northwind;" +

   "Integrated Security=SSPI";

 

with

Settings mySettings = new Settings();

cnn.ConnectionString = mySettings.NORTHWNDConnectionString;

 

Hmmm… now things are working. All the code above is in the event handler for the button labeled Get Customers.  Click on the button and fill the listbox.

SqlDataReader dr = cmd.ExecuteReader();

while (dr.Read())

{

    lbCustomers.Items.Add(dr.GetString(0));

}

 

4/30/2006 7:46:15 PM (Pacific Daylight Time, UTC-07:00)  #    Disclaimer  |  Comments [0]  |  Trackback
 Saturday, April 29, 2006

Agatha is dying. She had two seizures yesterday..the second went on for 15 minutes. She shook and cried and it was heartbreaking. Then we called several vets. Our Hillsboro vet was unhelpful and too far away. Our Seaside vet had an emergency number that went to an answering machine. We called a vet hospital in Astoria and drove her there. We poured cold water on her to keeep her fever down, and she seizured the whole way. She’s there now, getting Valium intravenously. We visited her this afternoon. She looks bad, still twitching and scared. We’ll visit her this morning and ask that she be put to sleep.

She’s the best friend I ever had. I wish so very much that she could go more easily, but I think she suffered these last couple of days. We wanted to give her a chance to live a little longer. Because she had suffered. We had hoped she could have come home and be with us for a few days more. So that we could show her how much we loved her.

Agatha is my dog. We’ve had her for about 15 years, and she’s about 16. We found her back then abandoned in the park across the street.

4/29/2006 1:26:03 AM (Pacific Daylight Time, UTC-07:00)  #    Disclaimer  |  Comments [0]  |  Trackback
 Friday, April 28, 2006

Again an old book … for old people I guess … anyway I’ve read it and still look at it. It’s the Developing XML Web Services and Server Components from Microsoft’s self-paced training kit.

Once again looking at the chapter on serviced components, I came across something I missed last time around. You know, I find this serviced component stuff and all .NET and COM interoperability confusing. I suspect it’s because I came to .NET without first going through COM as most people have.

I think of a serviced component as a .NET component that derives from SystemEnterpriseServices and that can use COM+ services; and that’s why you use them – to use the COM+ services.

Then, the book mentions dynamic registration (the CLR registers the assembly in the COM+ Catalog) and constrasts this with the command line utility regsvs.exe. And then comes this kicker: “On the other hand for COM clients you should register the serviced components manually by using the command line utility, regsvs.exe.” For COM clients? Why would a COM client ever want to use a serviced component? COM clients can get at COM+ services much more directly it seems to me.

I talk to some people about this, but apparently serviced components are not in the path most people around here travel on.

4/28/2006 10:13:22 AM (Pacific Daylight Time, UTC-07:00)  #    Disclaimer  |  Comments [0]  |  Trackback
 Monday, April 24, 2006

This Kalani book … old  … I like it … MCAD/MCSD Training Guide (70-320): Developing XML Web Services and Server Components with Visual C# .NET and the .NET Framework

Chapter 7 is on Serviced Components. Here are some thoughts … take them with a grain of salt.

I think the only reason you want to use a serviced component is to access COM+ services, such as transactions, object pooling, and JIT. The Kalani book has an example (StepByStep7-1) that creates and uses a serviced component but uses none of these features. The example succeeds in showing you how to create and use a serviced component but fails in that there is no motivation for doing so. You keep loooking at the code and saying, Why do this?

The example goes on in StepByStep7-2 to get a strong name for the assembly and in StepByStep7-3 to install it into the COM+ catalog. Then, StepByStep7-4 show how to manage the component with the Component Services Admin Tool. But you know you never actually use this serviced component.

A serviced component doesn’t actually get used until StepByStep7-7. This step shows code that calls a serviced component made in StepByStep7-5, which is just like StepByStep7-1, except that it has a ClassInterface attribute and a custom interface. The serviced component derives form this interface as well as ServicedComponent. But again, the example uses none of the features that would motivate you to using a serviced component in the first place.

4/24/2006 3:11:59 PM (Pacific Daylight Time, UTC-07:00)  #    Disclaimer  |  Comments [0]  |  Trackback
 Tuesday, April 04, 2006

Our study group has been taking some online tests. We’re going to stop. Scott has already passed the test (70-320); Steve and I will take it this month, and we expect to pass, but frankly at this point we’ve put in so much effort, we don’t care any more.

On one of the tests, we have 171 questions in the database. To test ourselves, we take a 50-question test. What this means is we select 50 questions at random from a database. The questions are then returned to the database and stand the same probability of being selected for the next 50-question test.

I was curious about how many 50-question tests I had to take to be confident that I tried out every one of the 171 questions. I wrote a C# program to calculate that, and the following graph shows my results.

random tests

Just to be safe I took one 171-question test (I got two wrong by the way). I was happy with that score, but I’m not sure how much it means any more. I’ve seen these questions so often by now that I recognize the answer without even having to read through all the question. I force myself to read all the question and reason out an answer, but unfortnately, I’ve memorized the answers by now, and so the test is not measuring knowledge any more.

The peak of the graph is at 15 tests. Here are the values around the peak

12       4280

13       7789

14       11100

15       12650

16       12624

17       11400

18       9449

19       7501

20       5814

21       4307

22       3178

23       2382

24       1653

 

I don’t know what the distribution is. It doesn’t look Gaussian; it’s not symmetric. I think it might be interesting to look at the equations in more detail to determine what distribution models the behavior best. Better, though, would be to look at the algorithm that chooses the questions and see what changes one could make to narrow the distribution. For example, one could weight the probability to preferentially select questions that have not been selected before.

 

4/4/2006 4:55:31 PM (Pacific Daylight Time, UTC-07:00)  #    Disclaimer  |  Comments [5]  |  Trackback
 Tuesday, March 21, 2006

It was last Friday night getting around 9:30, and it was time to take our old dog out. It takes us, Lory and I, longer to get ready than Agatha, the old dog. So I opened the front door and let Agatha mosey down the walk while I went into the garage looking for a flashlight and Lory rummaged through the hall closet looking for Agatha's doggie jacket; yes, it was cold this night.

Then, she was gone. Agatha, I mean. I ran up and down the driveway, looked up and down the street, ran through the house, crashed through our bushes. “Agatha,” I shouted. “Where is she?” I shouted again. Still no flashlight, and I gave Lory a penlight from my desk. We went from “Where is that damn dog?” to “Christ, the goddam dog is missing and where is that effing flashlight?”

By 4:30AM we were cold, saddened, and discouraged. We had walked and drove around the inner and out circles of our subdivision several times. We went down the asphalt trail by Rock Creek and took all the muddy side trips, down those slippery trails that ended in piles of trash and in one case an old cracked toilet.

We walked the length of Rock Creek Blvd back and forth several times all the way to Powerline Park. Sometimes we would walk with her that far. but she never went all the way to the park on her own. In fact the farthest she's ever gone on her own is like down our driveway, turn left and the 50 feet or so to the corner, and that was rare. I'd say in the 15+ years we've had her, something like 99.99% of the time, she's sniffed around our front yard bushes or waited impatiently at the foot of our driveway.

Past tense. Nostalgia. She was a good old dog. That was our mood during that last trudge home.

We slept a couple of hours and then walked some more. The animal shelter opened at 11AM and we were right there, reporting a lost dog. We left and then came back because we had put Washington Country for her license and then remembered that we had transferred her to Clatsop because in these, her autumn days, she spends most of her time at our beach house.. There was a woman there who looked at us strangely as if we knew her and had forgotten.

We called the Clatsop pound and yes (wow!) someone had reported finding her. On Route 26, near North Plains around 10PM. There was no way she could get there that fast; someone had to have taken and dropped her. The lady at Clatsop said well, they could be mistaken about where Agatha was found. She then put us in touch with a guy in Rock Creek, and he said he found her around Kiwanda, a few blocks from our house.

And so we drove to his place immediately; he was around Powerline Park. He was waiting outside with another guy, and Agatha was on a brand new leash. She looked good, alert and happy to see us. I put her in our backseat. I asked if we could give him a reward. He said yes, but that's not why he did this; it was cold, Agatha was a dog in trouble, and he was glad to help.

So Agatha is back. We just got back from a walk along Chapman Beach. There was a slight rain. Agatha was wearing her jacket, and I had my hood up. The wind and rain stir up the sand and stings your face.

I was thinking about walking Agatha back in Rock Creek the day after her ordeal. She likes to turn left at the end of the driveway and go down Rock Creek Blvd toward Kiwanda because I think there are more dogs and more smells down that way. But this night she very purposely turned right into the subdivision. Smart dog.




3/21/2006 4:19:38 PM (Pacific Daylight Time, UTC-07:00)  #    Disclaimer  |  Comments [2]  |  Trackback