tag:blogger.com,1999:blog-95815902024-03-12T19:51:54.655-07:00Dotnet FoxLife, coding, and the elimination of curly bracesBeth Massihttp://www.blogger.com/profile/07884372636469739761noreply@blogger.comBlogger98125tag:blogger.com,1999:blog-9581590.post-21392448708050726172007-03-27T13:19:00.000-07:002007-03-27T13:22:30.185-07:00I've Moved...I'm now posting on MSDN. <a href="http://blogs.msdn.com/bethmassi/">Check it out here</a>. Please update your <a href="http://blogs.msdn.com/bethmassi/rss.xml">RSS</a> or <a href="http://blogs.msdn.com/bethmassi/atom.xml">ATOM </a>feeds!!Beth Massihttp://www.blogger.com/profile/07884372636469739761noreply@blogger.com1tag:blogger.com,1999:blog-9581590.post-86632636542856131962007-03-08T14:09:00.000-08:002007-03-08T14:20:47.423-08:00EastBay.NET Launch Event -- TONIGHTI'll be speaking tonight on WCF in Pleasanton (a.k.a "P-town") for the <a href="http://www.baynetug.org/DesktopDefault.aspx?tabindex=2&tabid=26">EastBay.NET UG's</a> Vista launch event along with Deborah Kurata and David Klitzke. Bring your appetites for Vista, WPF and WCF presentations as well as REAL FOOD! Yes folks, we'll have dinner tonight from <a href="http://www.eriksdelicafe.com/">Erik's Deli</a>. :-) <br><br>
For more information <a href="http://www.baynetug.org/DesktopModules/DetailXEvents.aspx?ItemID=266&mid=143">check this out</a>. See you there!Beth Massihttp://www.blogger.com/profile/07884372636469739761noreply@blogger.com1tag:blogger.com,1999:blog-9581590.post-2174843466270584942007-03-05T09:12:00.000-08:002007-03-05T10:12:36.722-08:00Upgrade your May CTP VB LINQ Samples to Orcas March CTPIf you are playing with LINQ in Visual Basic, you'll probably want to check out <a href="http://devauthority.com/blogs/jwooley/default.aspx">Jim Wooley's</a> post on <a href="http://devauthority.com/blogs/jwooley/archive/2007/03/04/29684.aspx">how to convert a VB LINQ project from the May 2006 LINQ CTP to the March 2007 Orcas CTP</a>. The syntax has changed including the order of the Order By and Select clauses. Even though it may look weird to the SQL people, there is a good reason for it, actually. Putting the Order By clause fixes a scoping issue where you now don't have to select the fields you want to order by. There's also now no need to put a := for named parameters, you can use the more normal =. Anonymous types also have a new syntax. Better intellisense should help you out. <a href="http://www.thedatafarm.com/blog/">Julie</a> also has some <a href="http://www.thedatafarm.com/blog/2007/03/02/AFewOfTheManySyntaxChangesInVBAndLinqForSQLQueries.aspx">good information as well</a> so check her (I mean her blog) out.Beth Massihttp://www.blogger.com/profile/07884372636469739761noreply@blogger.com2tag:blogger.com,1999:blog-9581590.post-43497377277122439202007-03-01T05:23:00.000-08:002007-03-05T09:21:46.122-08:00Orcas March CTP Now AvailableIf you haven't seen it yet, <a href="http://msdn2.microsoft.com/en-us/vstudio/aa700831.aspx">here it is</a>. VPC images and regular install packages are both available. (Though the <a href="http://msdn2.microsoft.com/en-us/vstudio/aa948851.aspx">specific feature list</a> doesn't look like it's updated yet, you can <a href="http://www.microsoft.com/downloads/details.aspx?familyid=281fcb3d-5e79-4126-b4c0-8db6332de26e&displaylang=en#Overview">read the overview</a>.) A lot of things are finally coming together but I'm personally excited about LINQ. This CTP has the same features as the May LINQ CTP including LINQ to SQL and VB's XML literals. I'm off to download!......Beth Massihttp://www.blogger.com/profile/07884372636469739761noreply@blogger.com1tag:blogger.com,1999:blog-9581590.post-86906565057748912832007-02-20T10:46:00.000-08:002007-02-20T13:51:36.890-08:00VB WCF template in Visual Studio 2005 extensions for .NET Framework 3.0Just an FYI to anyone that is playing with WCF 2005 extensions in Visual Basic. When you create a WCF Service Library in VB, the code for the DataContract1 class it provides does not have <DataMember()> attributes on the properties FirstName and LastName, so when you try to generate a proxy it doesn't generate correctly and the sample doesn't work. <br><br>
New Project --> pick template VB/.NET Framework 3.0/WCF Service Library <br><br>
You'll see that the code for the DataContract1 at the bottom of the file doesn't have any <DataMember()> attributes. This has been fixed in the Orcas CTP that's due out very soon. So for now just pop those attributes in there and then follow the rest of the directions in the template to set up a host and config files. <br><br>
<pre>
<DataContract()> _
Public Class DataContract1
Private m_firstName As String
Private m_lastName As String
<b><DataMember()></b> _
Public Property FirstName() As String
Get
Return m_firstName
End Get
Set(ByVal value As String)
m_firstName = value
End Set
End Property
<b><DataMember()></b> _
Public Property LastName() As String
Get
Return m_lastName
End Get
Set(ByVal value As String)
m_lastName = value
End Set
End Property
End Class
</pre>
<br>
The template doesn't tell you directly how to set up a client to call it, but there is a VB example that shows you how. It's provided in the Program Files\Microsoft SDKs\Windows\6.0\Samples\ then extract the WCFSamples.zip and locate the \TechnologySamples\Basic\GettingStarted\VB\GetingStarted.sln. Here you can see a sample client and how to add the proper MetaData Exchange (mex) endpoint and service behavior so that you can generate the service proxy on the client side using "Add Service Reference" from the project menu. <br><br>
If you're following the instructions in the template, to add the endpoint to the host console application you need to put this in your app.config (note, if your host is a web server then you will place this in the web.config): <br><br>
<pre>
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<services>
<service
name="WCFServiceLibrary1.Service1"
behaviorConfiguration="metadataSupport">
<host>
<!-- Stick this in here if you remove the baseAddress
in the StartService method it creates for you. It's a
good idea to change that to use this config file instead.
<baseAddresses>
<add baseAddress="http://localhost:8080/ConsoleApplicationVB/service1" />
</baseAddresses>
-->
</host>
<endpoint
address=""
binding="wsHttpBinding"
contract="WCFServiceLibrary1.IService1" />
<!-- Adds a WS-MetadataExchange endpoint at
"http://localhost:8080/SampleService/mex" -->
<endpoint
address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="metadataSupport">
<!-- Enables the IMetadataExchange endpoint in services that
use "metadataSupport" in their behaviorConfiguration attribute.
In addition, the httpGetEnabled and httpGetUrl attributes publish
Service metadata for retrieval by HTTP/GET at the address
"http://localhost:8080/SampleService?wsdl" -->
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
</pre>
Then start the service (this is important) and in your client select from the project menu "Add Service Reference" and put the MetaData Exchange endpoint as the service URI and it will generate the client code for you with no problems.
<br><br>
<a href="http://3.bp.blogspot.com/_bk-OnFLmcjY/RdtMa1xOXbI/AAAAAAAAAAs/15iYE-C3j5M/s1600-h/mex.jpg"><img style="cursor:pointer; cursor:hand;" src="http://3.bp.blogspot.com/_bk-OnFLmcjY/RdtMa1xOXbI/AAAAAAAAAAs/15iYE-C3j5M/s400/mex.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5033701032510512562" /></a>Beth Massihttp://www.blogger.com/profile/07884372636469739761noreply@blogger.com1tag:blogger.com,1999:blog-9581590.post-46484593537584193232007-02-20T10:44:00.000-08:002007-03-08T14:02:48.959-08:00How to check the executing Type from the base classOccasionally when designing base classes we need to know the type of the inheriting class executing the method (i.e. like when you're loading types from other assemblies dynamically or when it's not possible to change the inherited classes). You can either use the TypeOf operator in VB or use the GetType method that is available in the CLR to accomplish this.
<br><br>
<pre>
Module Module1
Sub Main()
Dim a As New A
Console.WriteLine(a.Method1())
Dim b As New B
Console.WriteLine(b.Method1())
Dim c As New C
Console.WriteLine(c.Method1())
Console.ReadLine()
End Sub
End Module
Public MustInherit Class Base
Function Method1() As String
If TypeOf Me Is A Then
Return "Hello from A"
ElseIf TypeOf Me Is B Then
Return "Hello from B"
Else
Return String.Format("Hello from {0}", Me.GetType.ToString)
End If
End Function
End Class
Public Class A
Inherits Base
End Class
Public Class B
Inherits Base
End Class
Public Class C
Inherits Base
End Class
</pre>Beth Massihttp://www.blogger.com/profile/07884372636469739761noreply@blogger.com2tag:blogger.com,1999:blog-9581590.post-88929754308493275092007-02-16T11:08:00.000-08:002007-02-16T11:14:27.654-08:00SOA FactsOne of my favorite sites on the web is a <a href="http://www.chucknorrisfacts.com/">Chuck Norris fact site</a>. If you've never seen it it's hilarious. Well they now have <a href="http://www.soafacts.com/">SOA facts</a> which is equally amusing. Enjoy!Beth Massihttp://www.blogger.com/profile/07884372636469739761noreply@blogger.com0tag:blogger.com,1999:blog-9581590.post-88359450300841438092007-02-13T07:52:00.000-08:002007-02-12T15:55:21.528-08:00Sync Services for ADO.NETIf you haven't seen it yet, the <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=75FEF59F-1B5E-49BC-A21A-9EF4F34DE6FC&displaylang=en">Sync Services CTP</a> was released a couple weeks ago. Today they released the <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=02989F70-49AA-43D7-81B8-A651120F8D65&displaylang=en#filelist">documentation and samples</a>. The sync services for ADO.NET enable you to develop occasionally connected clients much much easier. The sync framework provides easy detection of all the types of data concurrency and conflict handling issues you encounter when developing offline clients and makes it easy to code resolutions. Best of all it uses SQLce and the deploymemt package is under 2Meg. For more information see <a href="http://blogs.msdn.com/stevelasker/default.aspx">Steve's</a> and <a href="http://blogs.msdn.com/synchronizer/default.aspx">Rafik's</a> blogs. <br><br>
BTW, I'll be speaking at <a href="http://www.devteach.com">DevTeach in May</a> on the sync services and architectures of occasionally connected clients.Beth Massihttp://www.blogger.com/profile/07884372636469739761noreply@blogger.com0tag:blogger.com,1999:blog-9581590.post-8164196598186033602007-02-12T13:56:00.000-08:002007-02-12T13:28:44.029-08:00EDM and LINQIn doing some more research on <a href="http://msdn2.microsoft.com/en-us/library/aa697428(vs.80).aspx">ADO.NET's Entity Data Model (EDM)</a> I came across some videos <a href="http://datajunkies.net/screencasts/adonet_vnext_part1/adonet_vnext_part1.html">here</a> and <a href="http://datajunkies.net/screencasts/adonet_vnext_part2/adonet_vnext_part2.html">here</a> by Shyam Pather, Dev Lead on the ADO.NET Team. The videos are from last summer but they do a really great job of describing the EDM as a conceptual model of your data, describing properties, associations/relationships, even inheritance -- using much a richer type system to model the entities. It separates the actual normalized data schema away from your application so that when underlying schema changes happen, your application is safe as long as the entity model hasn't changed. With ADO.NET 3.0 you can write queries (with a new 'entity SQL' eSQL query syntax) against the EDM and the data access stack automatically translates them to the database -- instead of getting rows back you get entities. Of course, any changes you make can be tracked and persisted back to the database automatically for you as well.
<br><br>
What I really love about the ADO.NET team is that they pay attention to the backward compatibility and migration issues. What I like here is the easy migration path of current code by using the new Mapping Provider (instead of the Sql Provider). The provider is different but the key is that you can use the connections, commands, readers, etc. in the same manner as you are accustomed to. However if you are writing new code you can create a strongly-typed query using the new Query class that returns the objects instead. <br><br>
This is all really really really great, however, I'm not too jazzed about learning yet another query syntax just to query these entities. Here's where LINQ comes in. You can query the EDM directly with LINQ, (very similar to how DLinq looks, actually). Let's take a couple examples. Here's how you would access data today:<br><br>
<pre>
Using cnn As New SqlConnection(MyConnectionString)
Using cmd As SqlCommand = cnn.CreateCommand()
cmd.CommandText = "SELECT Employee.Name, Region.Name " & _
"FROM SalesPeople " & _
"INNER JOIN Employees ON SalesPeople.EmployeeId = Employees.EmployeeId " & _
"INNER JOIN Region ON SalesPeople.RegionId = Region.RegionId"
Using dr As SqlDataReader = cmd.ExecuteReader()
'Process DataReader.....
End Using
End Using
End Using
</pre><br>
Say I created an EDM with an entity called SalesPeople, here's what the query could look like using Entity SQL (eSQL):
<pre>
Using cnn As New MapConnection(MyConnectionString)
Using cmd As MapCommand = cnn.CreateCommand()
cmd.CommandText = "SELECT Name, Region FROM SalesPeople"
Using dr As IDataReader = cmd.ExecuteReader()
'Process DataReader.....
End Using
End Using
End Using
</pre><br>
Finally (using the same EDM) here's what it could look like with LINQ:
<pre>
Using edm as New MyModel()
Dim sales = From s In edm.SalesPeople Select s
For Each person As SalesPerson In sales
'Do something with the SalesPerson objects
Console.WriteLine(person.Name)
Next
End Using
</pre><br>
All this makes me think... why do we need DLinq (LINQ to SQL) at all? Hmmmmmmm????? Seriously.Beth Massihttp://www.blogger.com/profile/07884372636469739761noreply@blogger.com1tag:blogger.com,1999:blog-9581590.post-1285284764022912252007-02-11T07:31:00.000-08:002007-02-11T08:02:15.749-08:00The History and Future of ADOIf you haven't seen it, Mike <span class="blsp-spelling-error" id="SPELLING_ERROR_0" onclick="BLOG_clickHandler(this)">Pizzo</span>, an Architect for Data <span class="blsp-spelling-error" id="SPELLING_ERROR_1" onclick="BLOG_clickHandler(this)">Programmabilty </span>at Microsoft, <a href="http://blogs.msdn.com/data/default.aspx">has a series of blog posts</a> describing the interesting history and evolution of ADO into what it is today.<br><br>
<a href="http://blogs.msdn.com/data/archive/2007/01/23/Data-Access-API-of-the-Day-_2800_Part-IV_2900_.aspx">In his last post</a> he describes the <a href="http://msdn2.microsoft.com/en-us/library/aa697428(vs.80).aspx">Entity Data Model (<span class="blsp-spelling-error" id="SPELLING_ERROR_2" onclick="BLOG_clickHandler(this)">EDM</span>)</a> and how client views are exposed through an ADO.NET data provider extended to support a query tree <span class="blsp-spelling-corrected" id="SPELLING_ERROR_3">representation</span>. He also explains what happened to <a href="http://msdn2.microsoft.com/en-us/library/ms971512.aspx"><span class="blsp-spelling-error" id="SPELLING_ERROR_4" onclick="BLOG_clickHandler(this)">ObjectSpaces</span></a>, which I found particularly interesting. He goes on explaining how <a href="http://msdn.microsoft.com/XML/linqproject/default.aspx"><span class="blsp-spelling-error" id="SPELLING_ERROR_5" onclick="BLOG_clickHandler(this)">LINQ</span></a> is supported in the Entity Framework (<a href="http://msdn2.microsoft.com/en-us/data/aa937723.aspx">ADO vNext</a>) and that they both will be featured together in the next <span class="blsp-spelling-error" id="SPELLING_ERROR_6" onclick="BLOG_clickHandler(this)">Orcas</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_7" onclick="BLOG_clickHandler(this)">CTP</span> (due in Feb/March). One thing that I asked Mike is what kind of guidance can he give on using <span class="blsp-spelling-error" id="SPELLING_ERROR_8" onclick="BLOG_clickHandler(this)">EDM</span> over <a href="http://download.microsoft.com/download/4/7/0/4703eba2-78c4-4b09-8912-69f6c38d3a56/dlinq.wmv"><span class="blsp-spelling-error" id="SPELLING_ERROR_9" onclick="BLOG_clickHandler(this)">DLinq</span></a> and when we can see tooling for <span class="blsp-spelling-error" id="SPELLING_ERROR_10" onclick="BLOG_clickHandler(this)">EDM</span> in Visual Studio.
<br><br>
This next <span class="blsp-spelling-error" id="SPELLING_ERROR_11" onclick="BLOG_clickHandler(this)">Orcas</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_12" onclick="BLOG_clickHandler(this)">CTP</span> is very exciting because it will have all the pieces finally together. <span class="blsp-spelling-error" id="SPELLING_ERROR_13" onclick="BLOG_clickHandler(this)">LINQ</span>, ADO <span class="blsp-spelling-error" id="SPELLING_ERROR_14" onclick="BLOG_clickHandler(this)">vNext</span>, and <span class="blsp-spelling-error" id="SPELLING_ERROR_15" onclick="BLOG_clickHandler(this)">WPF</span> tooling are my personal interests.Beth Massihttp://www.blogger.com/profile/07884372636469739761noreply@blogger.com1tag:blogger.com,1999:blog-9581590.post-27117449103317805872007-02-08T08:40:00.000-08:002007-02-06T10:06:01.476-08:00Relaxed Delegates in Visual Basic 8<a href="http://www.theproblemsolver.nl/contact.htm">Maurice</a> posted a <a href="http://msmvps.com/blogs/theproblemsolver/archive/2007/02/08/relaxed-delegates-in-visual-basic-8.aspx">workaround for relaxed delegates in Visual Basic 8</a>. Relaxed delegates are described in the <a href="http://msdn2.microsoft.com/en-us/library/ms364068(vs.80).aspx">Visual Basic 9 Overview on <span class="blsp-spelling-error" id="SPELLING_ERROR_0" onclick="BLOG_clickHandler(this)">MSDN</span></a>.Beth Massihttp://www.blogger.com/profile/07884372636469739761noreply@blogger.com0tag:blogger.com,1999:blog-9581590.post-75151571953904399992007-02-05T12:45:00.000-08:002007-02-06T09:04:05.680-08:00Ready for a New Day?<a href="http://1.bp.blogspot.com/_bk-OnFLmcjY/RceaAItzC1I/AAAAAAAAAAU/SlxgGtIy1Nc/s1600-h/newday2.jpg"><img id="BLOGGER_PHOTO_ID_5028156836112698194" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; CURSOR: hand" alt="" src="http://1.bp.blogspot.com/_bk-OnFLmcjY/RceaAItzC1I/AAAAAAAAAAU/SlxgGtIy1Nc/s320/newday2.jpg" border="0" /></a>
<div>I attended the <a href="http://www.microsoft.com/business/launch2007/signup/default.mspx">Vista Launch event</a> at <a href="http://www.moscone.com/directions/index.shtml"><span class="blsp-spelling-error" id="SPELLING_ERROR_0" onclick="BLOG_clickHandler(this)">Moscone</span> Center in SF </a>on Tuesday. It was a large event but nothing compared to the <a href="http://www.microsoft.com/windowsserversystem/applicationplatform/launch2005/default.mspx">Visual Studio 2005 launch </a>that was here back in November 2005. </div>
<div>The first debacle of the day was that the event details and announcements all pointed you to <span class="blsp-spelling-error" id="SPELLING_ERROR_1" onclick="BLOG_clickHandler(this)">Moscone</span> West (same building where the VS launch was held) but it turned out the doors were locked and not even one poster was on the wall inside. I was standing around with a few other scratching heads thinking "Where's the 'Wow'?" Finally a guard came to the window and told us the event was taking place in <span class="blsp-spelling-error" id="SPELLING_ERROR_2" onclick="BLOG_clickHandler(this)">Moscone</span> North. So all morning you had large groups of nerds walking across 4<span class="blsp-spelling-error" id="SPELLING_ERROR_3" onclick="BLOG_clickHandler(this)">th</span> street over to the <span class="blsp-spelling-error" id="SPELLING_ERROR_4" onclick="BLOG_clickHandler(this)">Moscone</span> North entrance. </div>
<div>The <a href="http://www.engadget.com/2007/01/29/live-at-the-windows-vista-launch-event/">main launch for Vista</a> was in New York City and looked huge but in SF they still had both <span class="blsp-spelling-error" id="SPELLING_ERROR_5" onclick="BLOG_clickHandler(this)">Moscone</span> North and South halls dedicated to three separate IT Pro tracks, one Developer track and one <span class="blsp-spelling-corrected" id="SPELLING_ERROR_6">Decision</span> Maker track. I helped out with the Ask the Experts area and in between that I popped into a couple sessions on the Developer track. </div>
<div>SF wasn't cool enough to get <a href="http://www.networkworld.com/news/2007/012907-ballmer-gates-speak-at-vista.html"><span class="blsp-spelling-error" id="SPELLING_ERROR_7" onclick="BLOG_clickHandler(this)">BillG</span> or <span class="blsp-spelling-error" id="SPELLING_ERROR_8" onclick="BLOG_clickHandler(this)">Balmer</span> for the keynote</a>, instead it was done by <a href="http://www.microsoft.com/presspass/exec/jeff/default.mspx">Jeff <span class="blsp-spelling-error" id="SPELLING_ERROR_9" onclick="BLOG_clickHandler(this)">Raikes</span>, President Microsoft Business Division</a>. He presented a lot of business cases for moving to Vista and had people demo the new OS as well as Office 2007 showcasing the new <a href="http://office.microsoft.com/en-us/help/HA101679411033.aspx">task oriented interfaces</a>. My personal high point of the keynote was when he introduced the CEO of <a href="http://www.sierranevada.com/index2.asp">Sierra Nevada Brewing Company</a> to discuss how Vista has made his <span class="blsp-spelling-error" id="SPELLING_ERROR_10" onclick="BLOG_clickHandler(this)">QA</span> department more productive (so that they can drink more beer, of course).</div>
<div>Among the local developer evangelists and Microsoft presenters, <a href="http://www.idesign.net/idesign/DesktopDefault.aspx?tabindex=3&tabid=5"><span class="blsp-spelling-error" id="SPELLING_ERROR_11" onclick="BLOG_clickHandler(this)">Juval</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_12" onclick="BLOG_clickHandler(this)">Lowy</span></a>, <a href="http://www.insteptech.com/h_whoweare.htm">Deborah <span class="blsp-spelling-error" id="SPELLING_ERROR_13" onclick="BLOG_clickHandler(this)">Kurata</span></a>, <a href="http://blogs.vertigosoftware.com/scott/">Scott Stanfield</a> also presented the new technologies in <a href="http://www.netfx3.com/"><span class="blsp-spelling-error" id="SPELLING_ERROR_14" onclick="BLOG_clickHandler(this)">Fx</span> 3.0</a>, giving demos on <a href="http://wpf.netfx3.com/">Windows Presentation Foundation</a>, <a href="http://wcf.netfx3.com/">Windows Communication Foundation</a> and <a href="http://wf.netfx3.com/">Windows <span class="blsp-spelling-error" id="SPELLING_ERROR_15" onclick="BLOG_clickHandler(this)">Workflow</span> Foundation</a>. I also caught <a href="http://nimad.wordpress.com/"><span class="blsp-spelling-error" id="SPELLING_ERROR_16" onclick="BLOG_clickHandler(this)">Nima</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_17" onclick="BLOG_clickHandler(this)">Dilmaghani</span></a> (local evangelist and all around nice guy) presenting on the new <a href="http://office.microsoft.com/en-us/sharepointserver/FX100492001033.aspx"><span class="blsp-spelling-error" id="SPELLING_ERROR_18" onclick="BLOG_clickHandler(this)">SharePoint</span></a> integration. All in all it was an informative track for developers to get a taste of what is possible with <a href="http://www.microsoft.com/windows/products/windowsvista/default.mspx">Windows Vista</a> and <a href="http://office.microsoft.com/en-us/default.aspx">Office 2007</a>. I assume it was equally beneficial for the IT pros (comments anyone?). I recommend <a href="http://www.microsoft.com/business/launch2007/signup/default.mspx">attending a launch in your area</a>. <em>[UPDATE: I forgot to mention for filling out session evaluations, attendees received a free copy of Office 2007. So if anything else, it's worth it to attend just for that.]</em></div><div></div>Beth Massihttp://www.blogger.com/profile/07884372636469739761noreply@blogger.com3tag:blogger.com,1999:blog-9581590.post-1168450085228988922007-01-10T08:27:00.000-08:002007-01-10T14:44:47.240-08:00I've Been Tagged! Five things about me....Okay, I suppose I can't ignore this anymore since both <a href="http://www.markusegger.com/blog/Travel.aspx?messageid=c407da9f-1f6c-4ac3-b3ee-f4d3ccf7dd18 ">Markus</a> and <a href="http://codebetter.com/blogs/sam.gentile/archive/2007/01/02/Tag_2C00_-I_2700_m-It_2100_.aspx">Sam</a> tagged me this week. It was only inevitable I suppose. Okay so here it goes -- five things you didn't know about me.
<br><br>
1. I'm a car fanatic and I have a 2003 Subaru WRX-ESX Stage 4 built by <a href="http://www.esxmotorsports.com/">EasyStreet</a> and <a href="http://www.gruppe-s.com/">Gruppe-S</a>. Once in a while I race it at <a href="http://www.sacramentoraceway.com/">Sacramento Raceway</a>. It does a 12.7 quarter mile. Next project is a rear swaybar, endlinks and a new clutch :-)<br><br>
2. I used to race mountain bikes, now I just ride them. I have a 2003 <a href="http://www.specialized.com/bc/SBCBkModel.jsp?sid=07FSRxc">Specialized FSR-Disc</a>. I love to ride many of the thousands of miles of trails on <a href="http://www.parks.ca.gov/?page_id=517">Mt. Diablo</a>. We have a beautiful view of the mountian from our bedroom.<br><br>
3. I have an XBox 360 and I am addicted to any car/motorcycle games. I play almost every night if I'm not watching Battlestar Galactica DVDs. We just got my dad who's retired an XBox 360 for Christmas so I'm hoping he sets it up and gets his online profile so I can kick his butt.<br><br>
4. I love wine and beer to the point where we're considering building a wine cellar. Exposure to great wines is easy living in the Bay Area. We go to festivals once or twice a month, even in the winter. This weekend we're headed to the <a href="http://www.wineroad.com/events/winterwineland.asp">15th Annual Winter Wineland</a>. I also belong to <a href="http://www.worldbeerdirect.com/shopping/beer_jb.asp">World Beer Direct's Beer of the Month Club</a> where they send me three bottles each of two different international beers and two different American microbrews to my door every month.<br><br>
5. I'm a pro Baseball and Football fan (it goes well with the beer :-)). I'll watch college football this time of year for the bowl games (Holy Crap, Boise State!). We have season tickets to the <a href="http://www.oaklandathletics.com">Oakland A's</a> and we're considering going to <a href="http://oakland.athletics.mlb.com/NASApp/mlb/spring_training/tickets.jsp?c_id=oak&year=2007&partnerID=2006hp_tixcomponent_oak_tab1&affiliateID=2006hp_tixcomponent_oak_tab1">spring training in phoenix</a> this year. I'm an <a href="http://www.raiders.com/">Oakland Raider</a> fan too but that's a little bit embarrassing to say right now! I've been a Raider fan since they won the 1984 superbowl when I was 12 years old. My family lived in the Los Angeles area (San Pedro) back then.<br><br>
Okay now for the lucky winners who get tagged by me!<br><br>
- <a href="http://blogs.msdn.com/yag/">YAG</a><br>
- <a href="http://codebetter.com/blogs/rodpaddock/Default.aspx">Rod Paddock</a><br>
- <a href="http://www.geekswithblogs.com/takenote">Duffy</a><br>
- <a href="http://blogs.iona.com/newcomer/">Eric Newcomer</a><br>
- <a href="http://msmvps.com/blogs/bill/Default.aspx">Bill McCarthy</a><br>Beth Massihttp://www.blogger.com/profile/07884372636469739761noreply@blogger.com3tag:blogger.com,1999:blog-9581590.post-1166203502850469302006-12-15T09:24:00.000-08:002006-12-15T09:25:02.863-08:00Visual Studio 2005 SP1 Released<a href="http://www.microsoft.com/downloads/details.aspx?familyid=bb4a75ab-e2d4-4c96-b39d-37baf6b5b1dc&displaylang=en">Get it here!</a>Beth Massihttp://www.blogger.com/profile/07884372636469739761noreply@blogger.com0tag:blogger.com,1999:blog-9581590.post-1158875972052954262006-09-21T13:37:00.000-07:002006-09-21T15:34:21.280-07:00Explicit Impersonation and Async Thread Identity in ASP.NETI've been doing some asynchronous thread programming in our server components and last night ran into a gotcha that took me a few hours to figure out so I thought I'd post this one to save people some trouble. <br><br>
I've implemented a Fire and Forget asynchronous pattern similar to <a href="http://www.bearcanyon.com/dotnet/#FireAndForget">Mike Woodring's sample</a> so that I could execute longer running processes than the typical web request on a spearate thread and return back to the client immediately. These processes connect to a SQL database using windows integrated security. <br><br>
All was working just dandy on my development XP box running without impersonation. In this scenario the components run under the default ASPNET identity and connect to a local database. (In Windows 2003/IIS6 the default identity is NETWORK SERVICE.) However when I went to deploy it on our testing servers I ran into a problem with the asynchronous thread identities. They were throwing exceptions trying to connect to the database. <br><br>
Our test rig is set up as two Windows 2003 servers, one app server and one database server on their own little domain. We set the app server's web.config with explicit impersonation of a least priveledged domain account that is windows authenticated to the database. All works fine for client request threads, however the identity of the async threads were that of the application pool, not the explicit domain user and was therefore causing problems connecting to the database. I figured I could change the application pool identity, but I wasn't satisfied with having to remember another configuration setting. I really wanted the Web.config to be the only place for this and I was perplexed as to why the main thread's identity wasn't getting propagated. <br><br>
I still am not sure as to why this is the case since the documentation for <a href="http://msdn2.microsoft.com/en-us/library/4yd16hza.aspx">ThreadPool.QueueUserWorkItem</a> makes it seem like this should work in .NET 2.0. I ended up augmenting the AsynHelper class to impersonate a WindowsIdentity. Here's the code and it's usage (comments/suggestions welcome!):
<pre>
Imports System.Threading
Imports System.Security
Friend Class AsyncHelper
Private Shared wc As New WaitCallback(AddressOf CallMethod)
Public Shared Sub FireAndForget(ByVal d As [Delegate], _
ByVal wi As Principal.WindowsIdentity, _
ByVal ParamArray args As Object())
ThreadPool.QueueUserWorkItem(wc, New TargetInfo(d, args, wi))
End Sub
Private Shared Sub CallMethod(ByVal o As Object)
Dim ti As TargetInfo = DirectCast(o, TargetInfo)
<b>'This is necessary so this thread impersonates the
'calling thread's identity. This is important when
'running under ASP.NET explicit impersonation.
ti.Identity.Impersonate()</b>
'Invoke the method, passing the arguments
ti.Target.DynamicInvoke(ti.Args)
End Sub
Private Class TargetInfo
Private m_target As [Delegate]
Private m_args As Object()
Private m_wi As Principal.WindowsIdentity
ReadOnly Property Target() As [Delegate]
Get
Return m_target
End Get
End Property
ReadOnly Property Args() As Object()
Get
Return m_args
End Get
End Property
ReadOnly Property Identity() As Principal.WindowsIdentity
Get
Return m_wi
End Get
End Property
Sub New(ByVal d As [Delegate], _
ByVal args As Object(), _
ByVal wi As Principal.WindowsIdentity)
m_target = d
m_args = args
m_wi = wi
End Sub
End Class
End Class
</pre>
And here's a usage example:
<pre>
Private Delegate Sub ExecuteQueryDelegate(ByVal personID As Integer)
Public Sub BeginFetch(ByVal personID As Integer)
Dim dlgt As New ExecuteQueryDelegate(AddressOf ExecuteQuery)
' Initiate the asynchronous call.
AsyncHelper.FireAndForget(dlgt, Principal.WindowsIdentity.GetCurrent(), personID)
End Sub
'This method runs on an asynchronous thread
Private Sub ExecuteQuery(ByVal personID As Integer)
Dim resultSet As DataTable = Me.LongRunningProcesses()
Me.SaveResults(resultSet)
End Sub
</pre>Beth Massihttp://www.blogger.com/profile/07884372636469739761noreply@blogger.com3tag:blogger.com,1999:blog-9581590.post-1153151885633205332006-07-17T08:45:00.000-07:002006-07-17T08:58:05.693-07:00Linq's the WordMany thanks to all those who came out on Thursday to play with <a href="http://msdn.microsoft.com/data/ref/linq/">the latest Linq CTP </a>at the <a href="http://www.baynetug.org">East Bay.NET User's Group</a> in Pleasanton! Here's the <a href="http://www.baynetug.org/uploads/LinqsTheWord.zip">link to all the presentation code</a>. <br><br>
The presentation went really well and the samples sparked a lot of discussion and interest with the group who had never seen language integrated query. Most of the attendees were very excited and anxious for it to release, as am I. <br><br>
Linq changes the way you think about solving problems in your code. That coupled with Visual Basic's dynamic interfaces and XML literals you definately have the most flexible language I have ever seen. <a href="http://msdn.microsoft.com/vbasic/Future/default.aspx?pull=/library/en-us/dnvs05/html/vb9overview.asp">Read here for an overview</a> of these features coming in the next version.Beth Massihttp://www.blogger.com/profile/07884372636469739761noreply@blogger.com0tag:blogger.com,1999:blog-9581590.post-1151106231195329382006-06-23T16:36:00.000-07:002006-06-23T16:43:51.213-07:00Bay.NET UG presentation codeMany thanks to all those who came out on Tuesday to see me speak at the <a href="http://www.baynetug.org">Bay.NET User's Group</a> in San Fransisco! Those of you who missed it, I did a more in-depth presentation of the Data Sources and Data Binding in VS2005 session that I gave at DevTeach. Here's the <a href="http://www.baynetug.org/uploads/DataBinding-BethMassi.zip">link to all the presentation code</a>. Have Fun!Beth Massihttp://www.blogger.com/profile/07884372636469739761noreply@blogger.com0tag:blogger.com,1999:blog-9581590.post-1148401911556005812006-05-23T08:56:00.000-07:002006-07-19T16:14:14.596-07:00Debugging Windows Services in Visual StudioLast week I started writing a Windows Service in Visual Studio for some build and test automation programs. What I have always found annoying (but understandable) about windows services is the debugging. Because your code is set up to run as a service when you select the Windows Service template in VS that means you have to install the service, start it, and then attach to the process in the debugger instead of being able to click the "start debugging" button on the debugger toolbar like I'm used to with other project types. <br><br>
Previously, I followed the advice <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvsdev05/html/vs05d1.asp">in this article</a> by creating a setup program that easily allowed me to install and uninstall the service directly from the Solution Explorer in VS. However I still have to either call System.Diagnostics.Debugger.Break() in my code (and remember to remove it when I'm done!) or attach to the process in order to debug it. <br><br>
There's an easier way. If you look in the Main entry point of the service you will see how the service is loaded. (In C# this is in the Program.cs file that's created for you and in VB.NET this code resides in the service's Designer.vb file.) You can modify this code by adding a DEBUG compiler directive to control how the process starts:
<pre>
<MTAThread()> _
Shared Sub Main()
#If DEBUG Then
' Start the process as a non-service for debugging only.
' Stop the debugger to stop the process.
Dim service As New MyService
service.Execute()
System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite)
#Else
Dim ServicesToRun() As System.ServiceProcess.ServiceBase
' More than one NT Service may run within the same process. To add
' another service to this process, change the following line to
' create a second service object. For example,
'
' ServicesToRun = New System.ServiceProcess.ServiceBase () {New Service1, New MySecondUserService}
'
ServicesToRun = New System.ServiceProcess.ServiceBase() {New MyService}
System.ServiceProcess.ServiceBase.Run(ServicesToRun)
#End If
End Sub
</pre>
Now when your configuration is set to debug, you can hit F5 to debug like normal. Stop the debugger to stop the process. Keep in mind that the OnStart and OnStop methods of your service will not run so you should break your functionality into a callable method on your service class (in this example, I called it "Execute()"). Have fun!Beth Massihttp://www.blogger.com/profile/07884372636469739761noreply@blogger.com6tag:blogger.com,1999:blog-9581590.post-1147926938080988472006-05-17T19:35:00.000-07:002006-05-17T22:12:53.840-07:00Programming ComputersToday I spoke to some of my mom's computer students about programming <a href="http://www.stisidore.org/classrooms/teacher_pages_total/amassi.html">at the school where she teaches</a>. What a change from last week where I'm teaching other developers advanced programming topics at DevTeach. Today I'm encouraging 14 year olds to get into the field and demo-ing <a href="http://msdn.microsoft.com/vstudio/express/vb/">Visual Basic 2005 Express</a> and the <a href="http://msdn.microsoft.com/vstudio/express/vb/starterkit/default.aspx">starter kits</a>. We had a blast poking around the <a href="http://msdn.microsoft.com/vstudio/express/vb/starterkit/default.aspx#blackjack">black jack starter kit</a>. <br><br>
I started the presentation by introducing myself and telling them the kind of software products we write at <a href="http://www.giftrapcorp.com">GiftRAP Corporation</a>. I told them that I worked at Microsoft a couple years ago on the <a href="http://msdn.microsoft.com/vfoxpro/">Visual FoxPro</a> team in the developer division. Then I explained what a <a href="http://mvp.support.microsoft.com/">Microsoft MVP</a> is and that I still get to contribute ideas to Microsoft even though I don't work there. <br><br>
Since I wanted to encourage them to start programming, I went through some of my history as a kid learning to program. I showed them my first computer, <a href="http://oldcomputers.net/atari400.html">the Atari 400</a>, and <a href="http://www.atariarchives.org/basic/showpage.php?page=cover">my first programming language</a>; it was 1980 and I was 8 years old. I got some bright eyes in a couple kids when I said that. I got some gasps when I told them it retailed for $595.00. I realize now that my parents really sacrificed to buy that computer for me; they didn't spend that type of money back then. Then I skipped to 1986, the year I was in 8th grade and showed them the <a href="http://www.old-computers.com/MUSEUM/computer.asp?c=63">Amiga 2000 HD</a>. I think HD meant that you got a hard drive, something I didn't have on my Franklin "IBM PC clone". I wanted to draw all day when I was a young teen but I loved computers, so I begged my mom for an Amiga; the best in computer graphics at the time. And as a bonus, it came with an 8086 motherboard so I could run <a href="http://en.wikipedia.org/wiki/Microsoft_BASIC">MS-BASIC</a>. With 1MB RAM I was cooking with gas. Finally I showed them a picture of a few of the machines I have today including my 2 year old <a href="http://www.shopping.com/xPF-Audiovox_SMT5600">SmartPhone</a>. I waved it in the air and told them it had 32 times more memory than my Amiga 2000. A couple kids laughed and a couple wanted me to cut to the chase -- let's program already!<br><br>
I opened up VS and selected the card game starter kit template and we started tweaking it. I changed the card skins to a snoopy face and made Player 1 a picture of the president. They laughed, they stared, they asked questions. I'd say they seemed pretty darn interested (for teenagers). I pointed them to a <a href="http://www.upgradeyourgame.com/">VS Express Edition game programming site</a> that looked pretty fun. I think I proved to them that programming is not only a scientific process but also a creative one. Mom said to save the presentation and she wants me back earlier in the year next year. I'm really glad I had the opportunity to do this with the kids today, it's almost harder to do these types of lessons than the professional sessions I do. It's cool, I think some things I was saying to them sunk in and hopefully will make a tiny impression on their future career choices. It was a very rewarding talk for me.
<br><br>
Here's the links I gave them. This is VB Express free edition:<br>
<a href="http://msdn.microsoft.com/vstudio/express/vb/">http://msdn.microsoft.com/vstudio/express/vb/</a><br>
These are the starter kits:<br>
<a href="http://msdn.microsoft.com/vstudio/express/vb/starterkit/default.aspx">http://msdn.microsoft.com/vstudio/express/vb/starterkit/default.aspx</a><br>
Here's the sweepstakes and more games:<br>
<a href="http://www.upgradeyourgame.com/">http://www.upgradeyourgame.com/</a>
<br>
Links to beginer videos and learning links:<br>
<a href="http://msdn.microsoft.com/vstudio/express/vb/next/default.aspx">http://msdn.microsoft.com/vstudio/express/vb/next/default.aspx</a><br><a href="http://msdn.microsoft.com/vstudio/express/vb/learning/default.aspx">http://msdn.microsoft.com/vstudio/express/vb/learning/default.aspx</a><br>
Here's the community forum:<br>
<a href="http://forums.microsoft.com/msdn/showforum.aspx?forumid=24&siteid=1">http://forums.microsoft.com/msdn/showforum.aspx?forumid=24&siteid=1</a><strong></strong>Beth Massihttp://www.blogger.com/profile/07884372636469739761noreply@blogger.com0tag:blogger.com,1999:blog-9581590.post-1147816376439174472006-05-16T14:45:00.000-07:002006-05-16T14:52:56.460-07:00"Best and Worst of .NET" Interviews at DevTeach<a href="http://www.mariocardinal.com/">Mario Cardinal</a> interviewed the speakers at DevTeach on what we thought were the best and worst parts of Microsoft .NET. Mario snuck up on me and put me on the spot. If he asked me again today I would probably have thought of completely different things to say. There's just so much I like ;-). <a href="http://www.mariocardinal.com/blog/Posts/20060516.html">Check it out here</a>!Beth Massihttp://www.blogger.com/profile/07884372636469739761noreply@blogger.com0tag:blogger.com,1999:blog-9581590.post-1147536202762593672006-05-13T09:01:00.000-07:002006-05-13T09:17:31.026-07:00Amazing CountrysidesSo now that <a href="http://www.DevTeach.com">DevTeach</a> is over, Alan and I are in beautiful Vermont staying with <a href="http://www.thedatafarm.com/blog/">Julie Lerman</a> and her husband Rich. What a great feel this countryside has, rolling green hills and birch trees everywhere. Living in the East Bay Area of California we have lots of rolling green hills but the grass is very different; much longer, and dies in the summer. We also have oak trees, not these white wood birch so it's so cool to see a different countryside. (Although all this birch is a little <a href="http://www.blairwitch.com/">Blair Witch</a>-y for me at night ;-P) It's my first time in Vermont but I'm sure I'll be back.Beth Massihttp://www.blogger.com/profile/07884372636469739761noreply@blogger.com0tag:blogger.com,1999:blog-9581590.post-1147536088059890442006-05-13T08:33:00.000-07:002006-05-13T09:01:28.073-07:00Wonderful Montreal in May<a href="http://www.DevTeach.com">DevTeach</a> is over; what a great time! Montreal was absolutely beautiful. No rain, nice and warm, in the 70s. I couldn't have asked for anything more. My sessions went very well and I got great feedback from the attendees on the conference as a whole. For session coverage <a href="http://www.utcoverage.com/DevTeach/2006/">check out the UT</a>. The focus was on Data and <a href="http://blogs.msdn.com/yag">Alan</a> gave a great keynote on <a href="http://msdn.microsoft.com/data/ref/linq/">LINQ</a>. If you haven't done it already, <a href="http://www.microsoft.com/downloads/details.aspx?familyid=1e902c21-340c-4d13-9f04-70eb5e3dceea&displaylang=en">download the latest CTP</a> and start playing with it now. It really will change the way you program... everything.Beth Massihttp://www.blogger.com/profile/07884372636469739761noreply@blogger.com0tag:blogger.com,1999:blog-9581590.post-1144381486976637732006-04-06T19:57:00.000-07:002006-04-06T20:44:49.616-07:00Another MVP year!Yahooo! I was awarded <a href="https://mvp.support.microsoft.com/default.aspx/profile=8df4eef4-89a1-4c5b-8895-e4688b11ffdb">Microsoft Solutions Architecture MVP</a> again this year. Thanks to everyone involved over at Microsoft and to all the readers of my blog in this awesome community. Hope to see you all next month in <a href="http://www.devteach.com">Montreal</a>!Beth Massihttp://www.blogger.com/profile/07884372636469739761noreply@blogger.com1tag:blogger.com,1999:blog-9581590.post-1143569437008691542006-03-28T09:58:00.000-08:002006-03-28T10:10:37.026-08:00The best definition of software architecture I've heardMy friend and fellow Architect MVP, <a href="http://www.iona.com/info/aboutus/management/eric_newcomer.htm">Eric Newcomer</a> mentioned in a <a href="http://www.iona.com/blogs/newcomer/archives/000276.html">blog post</a> something I said when we were having dinner last week in SF and it ended up in <a href="http://webservices.sys-con.com/read/198903.htm">SOA Web Services Journal</a>. I'm glad all my ranting pays off once in a while ;-).Beth Massihttp://www.blogger.com/profile/07884372636469739761noreply@blogger.com0tag:blogger.com,1999:blog-9581590.post-1143563834461440672006-03-28T08:33:00.000-08:002006-03-28T08:38:00.710-08:00I'm speaking at DevTeach 2006I'm speaking again this year at <a href="http://www.DevTeach.com">DevTeach 2006 </a>in Montreal May 8th-12th. <br><br>
I'm doing three sessions this year, one called "VS2005 Data Sources and Data Binding" and a two part session on "Designing Applications for Multiple Smart Client UIs". That one also demonstrates a server architecture that supports windows clients as well as mobile devices against the same centralized data. We'll also discuss occasionally connected scenarios and architecture options we have today and in the future. You can see all the speakers and sessions listed <a href="http://www.devteach.com/Session.asp">here</a>. Hope you can make it!Beth Massihttp://www.blogger.com/profile/07884372636469739761noreply@blogger.com0