|
|
I’ve been tasked at coming up with a standard architecture for us to apply to our future projects. Yeah, I know, there’s no blanket answer for everything, but given the requirements I expect, I think a single architecture can handle 95% of what we’ll be doing and we can deviate/improve as necessary for the other 5%.
Ultimately I don’t yet know what this is going to look like but this is the direction I’m leaning in:
(more…)
March 11th, 2010
Categories: Random Thoughts | Author: Shane Milton | Comments: No Comments |
On Day 0 of Microsoft PDC, I attended the Software in the Energy Economy workshop. Much to my surprise (and disappointment), we didn’t talk about energy for the entire first half of the workshop. Instead, it was about Azure’s Service Bus. BAD Microsoft!! It was explained to us by Juval Lowy that he wanted to do it entirely on energy but Microsoft forced him to have half of the talk on the service bus. Now I can understand this from Microsoft, but this should have been clear to the people there. Honestly, I would have much preferred to go to another workshop than to learn about the Azure Service Bus. Cool stuff but my current analysis of it is that it’s way too unreliable (I don’t mean bugs, I mean lack of transactional support) and it is simply missing some of the things that I would want/need in such a system, like queues! There are hacks to implement them, but I don’t want to have such an important foundational part of my architectures built on hacks! Anyways, that can be for another day (gotta get to the keynote).
(more…)
November 17th, 2009
Categories: .NET, Community Events, Programming | Author: Shane Milton | Comments: 2 Comments |
So I was performing some maintenance work on some webform stuff in an application and ran into a problem where an existing custom control, which I have the source for so I can fix it (yay!), wasn’t properly disabling itself when it was in a container that became disabled. The way it works, it overrides the rendering process and spits out lots of HTML and javascript (eww!) but for the important things for this rendering, it looks at a custom “ReadOnly” property on the control to enable/disable the appropriate things. So essentially the control is always enabled except when that flag is set to false – a bad idea!
(more…)
October 1st, 2009
Categories: Random Thoughts | Author: Shane Milton | Comments: No Comments |
Yesterday I got the thumbs up that I’m being sent to PDC 2009 by my company! I planned on going whether I was sent or not but it’s nice to not have to foot the bill out of my own pocket this year. In 2005 I was lucky enough that my company covered airfare and hotel while Telerik was generous enough to cover my registration for the conference and the pre-conference. Last year I wasn’t so lucky and had to cover almost all of it out of pocket but that’s what you expect as a contractor.
Here’s what I have to do:
(more…)
August 23rd, 2009
Categories: .NET, Community Events, Programming | Author: Shane Milton | Comments: No Comments |
I was working with Cody Collins and we ran into a problem recently with detecting whether the OS running was 32-bit or 64-bit from within NAnt. We’re trying to automate the installation of some software that has separate installers for 32-bit and 64-bit and we need to determine which installer to run from NAnt.
The problem begins with NAnt being compiled for 32-bit mode only which means all 64-bit functionality is transparent to it. If it weren’t for that, then we could simply depend on the PROCESSOR_ARCHITECTURE environment variable. So if you try to ask the OS if it’s 64-bit, it will tell you that it isn’t. Luckily there is an IsWow64Process WinAPI call that you can make to determine if you are running in WoW64. From these two pieces of information, you can infer whether or not the OS is 64-bit.
Cody and I were able to come up with the following scripts to determine this.
Note: This runs unmanaged code and does not protect you from crashes there – this could be better but this should get you 90% of the way there. This has been tested on Windows XP (32-bit), Windows 2003 (64-bit), Windows Vista (32-bit and 64-bit), Windows 2008 (32-bit), and Windows 7 RC (64-bit). Not an exhaustive test but it covers many of the bases.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
| <property name="Is64BitOperatingSystem" value="false" />
<property name="Is64BitProcess" value="false" />
<property name="IsWow64Process" value="false" />
<target name="DetectOperatingSystemArchitecture" depends="DetectIfWow64Process,DetectIf64BitProcess">
<description>
This will detect whether the current Operating System is running as a 32-bit or 64-bit Operating System regardless of whether this is a 32-bit or 64-bit process.
</description>
<property name="Is64BitOperatingSystem" value="${IsWow64Process or Is64BitProcess}" />
<choose>
<when test="${Is64BitOperatingSystem}">
<echo message="The operating system you are running is 64-bit." />
</when>
<otherwise>
<echo message="The operating system you are running is 32-bit." />
</otherwise>
</choose>
</target>
<script language="C#" prefix="MyWin32Calls">
< code>
< ![CDATA[
[System.Runtime.InteropServices.DllImport("kernel32.dll")]
public static extern bool IsWow64Process(System.IntPtr hProcess, out bool lpSystemInfo);
[Function("IsWow64Process")]
public bool IsWow64Process()
{
bool retVal = false;
IsWow64Process(System.Diagnostics.Process.GetCurrentProcess().Handle, out retVal);
return retVal;
}
]]>
< /code>
</script>
<target name="DetectIfWow64Process">
<description>
Detects whether we are currently in a WoW64 process or not.
</description>
<property name="IsWow64Process" value="${MyWin32Calls::IsWow64Process()}" />
<echo message="Setting the [IsWow64Process] property to ${IsWow64Process}." />
</target>
<target name="DetectIf64BitProcess">
<description>
Detects whether we are currently in a 32-bit or 64-bit process (not necessarily what the OS is running). Note that as of the time of this writing, this will ALWAYS return false because NAnt is compiled to run in 32-bit mode only.
</description>
<!-- This can return x86, x64, AMD64, or IA64 as of the time of this writing. This works for a 32-bit process in a 64-bit OS because the OS makes the 64-bitness transparent to the process in this environment variable. -->
<property name="Is64BitProcess" value="${environment::get-variable('PROCESSOR_ARCHITECTURE')!='x86'}" />
<echo message="Setting the [Is64BitProcess] property to ${Is64BitProcess}." />
</target> |
On a 64-bit OS, it has the following output:
D:\bin\deleteme\nanttest>build DetectOperatingSystemArchitecture
NAnt 0.85 (Build 0.85.2344.0; rc4; 6/2/2006)
Copyright (C) 2001-2006 Gerry Shaw
http://nant.sourceforge.net
Buildfile: file:///D:/bin/deleteme/nanttest/test.build
Target framework: Microsoft .NET Framework 2.0
Target(s) specified: DetectOperatingSystemArchitecture
[script] Scanning assembly "lsbw4oxa" for extensions.
DetectIfWow64Process:
[echo] Setting the [IsWow64Process] property to True.
DetectIf64BitProcess:
[echo] Setting the [Is64BitProcess] property to False.
DetectOperatingSystemArchitecture:
[echo] The operating system you are running is 64-bit.
BUILD SUCCEEDED
Total time: 0.2 seconds.
D:\bin\deleteme\nanttest>
Happy NAnting!!!
*heads off to the IndyALT.NET meeting on Continuous Integration now…*
July 16th, 2009
Categories: Random Thoughts | Author: Shane Milton | Comments: No Comments |
IndyTechFest registration is now open! This year there is a limit of 500 registrations (I believe last year’s was like 400 and it was booked up within just a couple weeks). So I strongly encourage you to register sooner rather than later!
There is a great lineup of speakers and sessions at this year’s IndyTechFest! Some of the speakers I have seen speak before include Paul Hacker, Larry Clarkin, Michael Eaton, Arie Jones, Tom Pizzato, Dan Rigsby, and Bill Steele. There are many other great speakers that I know or have heard of. This should be an excellent event and one that is worth a good long drive to get to!
Some of the sessions that I’m really looking forwards to include Test Driven Development (TDD) w/ VS 2008, Tips and Tricks for the New C#, Tips and Tricks for the New VB .NET, Duplexing WCF in the Enterprise, and Virtualization of SQL Server. There are many other sessions that I’m going to hope to get to but alas, with it being a one-day event, I doubt I’ll get to most of the ones I really want to see.
Props to the people who worked hard to make this event possible, including Brad Jones, Dave Leininger, John Magnabosco, Mark McClellan, and Bob Walker, as well as all of the support of the local user groups to help drive the event!
Just as I was wrapping this post up, I received a phone call. Apparently as of 1pm (1 hour after registration opened), nearly HALF of all available registration slots were filled! If you read this post and have not registered, go register NOW and don’t wait or you’ll be left out!
August 22nd, 2008
Categories: .NET, Programming, SQL Server | Author: Shane Milton | Comments: No Comments |
On Tuesday (July 8, 2008) evening, Sasha Kotlyar, Dean Weber, and I made a spontaneous trip to Cincinnati to check out the CinArc group (not to be confused with this CinARC). This group is Cincinnati’s Architecture User Group and seems to be mostly .NET-based. They are a very new group as this was only their second meeting. They meet monthly on the second Tuesday of the month. Their current meeting-format is that of a fishbowl meeting. You can read more on Wikipedia about this here.
I must say, the three of us Hoosiers really enjoyed ourselves at CinArc! Despite the downpours, rush-hour construction, and construction barrels we had to dodge in the middle of the road, it was great! Oh, and I won a door prize as well! I walked out with a VS2008 Pro license (only had MSDN-based licenses before, now I have a permanent license!). The group is led by Mike Wood, who also happens to lead the Cincinnati .NET User Group. Lots of other people were also in attendance (I’m not even going to attempt to name them because I’m horrible with names and I’ll surely forget some of them but turns out I follow lots of them on Twiter). There was a total of 19 people there with 5 chairs in the middle of the fishbowl (1 moderator, 3 speakers, 1 open). It was great that they veered away from the norm where it was a very interactive discussion and almost everybody participated in it.
The agenda for the meeting was different than what I’ve been used to for user group meetings, and I really liked it! I’m used to food before hand, kicking things off with announcements, then going into the discussion for the rest of the night, and door prizes at the end. What they did, instead, was kick things off with the discussion, about an hour into it take a break for food, kick the second half off with announcements, go back into the discussion after the nice little break, and then door prizes at the end. The trick to accomplishing this is timing on the food and if it can be pulled off, I may actually try to assimilate this style into the ALT.NET meetings! However, one important part of the ALT.NET meetings, I feel, is the social time spent before the meeting. Perhaps we can have snacks and drinks available then and real food available at “Halftime”.
One other thing that was really neat was that the meeting attendees were able to choose the topics to discuss. Ideas were put up on a whiteboard as recommended by the people there, and then everybody voted on the ones that they were most interested in participating in discussion with. There were 3 topics that seemed to be the most popular, and it turned out that we had time to discuss 3 topics. So it worked out perfectly!
As I said before, I had a great time at CinArc and I highly recommend it to anybody who is in the area and is interested in best architecture practices and bouncing ideas off of one another! There were some extremely intelligent guys at this group and it’s great that they are trying to expand knowledge in the community and help one another! I can already see this is going to be a very popular user group in the future! I hope some of those guys come visit some of our Indy events, and I just may try and pick up some Reds tickets some second Tuesday of the month afternoon so I have a good excuse to be in town again for another CinArc meeting!
-Shane
July 10th, 2008
Categories: .NET, ALT.NET, Programming, SQL Server, Visual Studio | Author: Shane Milton | Comments: 3 Comments |
I was complaining on Twitter about the long time it takes to compile a Compact Framework application and Steve Schoon informed me of a hack you can do to DRASTICALLY speed up the time it takes to compile! You can get the details here.
Read the entire thing so you are aware of what you’re disabling by performing this hack but unless you are constantly flipping back and forth to various different target platforms with your mobile development, you shouldn’t need this feature very often at all! It dropped our compile times down from about 3 minutes to about 10 seconds. It was amazing!
-Shane
April 25th, 2008
Categories: .NET, Compact Framework, Programming | Author: Shane Milton | Comments: 2 Comments |
I was recently given the task to generate some API documentation for all of the code on a project I was working on (11 different projects, 3 different solutions) so I began looking into what was available. I remember using NDoc with old 1.1 projects, but that project was apparently abandanded. Microsoft has an October 2007 CTP release for a replacement called Sandcastle. It’s a suite of files that provide the core functionality of generating HTML and CHM files for documentation in an MSDN-like style. Apparently, this is what Microsoft uses internally to generate their MSDN documentation.
Unfortunately, Sandcastle comes with no GUI to use it but fortunately, there are several free GUIs written out there to do it for you. To find out more about it, I thought this site was most helpful.
-Shane
January 4th, 2008
Categories: .NET, ASP.NET 2.0, C#, Programming, Visual Studio | Author: Shane Milton | Comments: No Comments |
I’m working on a project where we use Deployment Projects to deploy our public application. We’re still in beta phase so we don’t have a huge number of releases under our belt yet but so far things have been going pretty well (well, at least since we’ve gotten past the initial hurdles in getting our first installer out). Well, something new has jumped up and surprised us. And honestly, now that I understand it, I’m shocked that we’ve not seen it in any of our last 5ish releases.
So here’s the context: We had a prior version of our app installed and we wanted to upgrade from that version to the newest version. We have the installer uninstall the old version (for this part hopefully by now you know that it’s good and important for all assemblies in the installer to be properly versioned and at or above 1.0). This is done by the freebie stuff and the Uninstall events that get fired within our Installer Class/custom action to manage a few things, including our databases. Next the new version gets installed (again by the freebie stuff and custom actions). The last thing our custom action class does is upgrades our databases from the older verson to the newer version. This is how we’ve done things for the past 5ish versions and everything has worked just fine and dandy as long as we’re on the ball with versioning our assemblies correctly.
Well, this version I updated all of our installer files just as I had done with the previous versions and when I went to test it, I was surprised. For some reason the install seemed to work fine EXCEPT for our custom actions. To make a long story short, what was happening was that our custom actions from our previous version were getting executed when the installer was installing the newer version!! So obviously since our databases are maintained by these custom actions, the problems were pretty obvious from the beginning.
I ultimately found this article online which points to this KB article of Microsoft’s (EDIT: this is the VS2005 version of the bug, I previously linked the VS2003 version of the bug) and it turns out that this is a bug in Visual Studio 2005 that was posted in August of 2004. The short version of the problem is with the assembly name for our custom action. When Windows Installer loads CustomAction v3 for the uninstall and attempts to load CustomAction v4 for the new install, it unreliably does not load v4 because it sees it already has CustomAction loaded but forgets to care about what version it is. So then when the new version of the app fires the events for our DLL, they get handled by the old code and not by the new code.
There are two things to be aware of with this scenario to fix it. The first is an end-user work-around in case you need such a thing for an installation that you might have already made public. If the end-user runs your installer and this happens, running the installer again and selecting “Repair” will then run the correct version of the DLLs. Now this may or may not help you, depending on your scenario. Luckily for us, this is an acceptable work-around without trashing any data because of our architecture around updating our client databases with each release. Now the second thing to be aware of is a more permanent fix. If you change the Assembly name for your custom action to be unique with each deployment, this will allow you to prevent this from happening again. So instead of my custom action’s assembly name being “Company.Project.Installer.CustomAction” it is now “Company.Project.Installer.CustomAction_v1.0.0.3″ and of course I change this with each release.
Good luck and I hope you find this problem and solution before wasting hours of time like I did!
October 15th, 2007
Categories: .NET, ASP.NET, Programming, Visual Studio | Author: Shane Milton | Comments: 1 Comment |
Next Page »
|