<?xml version="1.0" encoding="UTF-8"?><!-- generator="WordPress/2.9.1" -->
<rss version="0.92">
<channel>
	<title>bryanware.com</title>
	<link>http://bryanware.com</link>
	<description>My adventures in life.</description>
	<lastBuildDate>Fri, 19 Feb 2010 02:22:13 +0000</lastBuildDate>
	<docs>http://backend.userland.com/rss092</docs>
	<language>en</language>
	
	<item>
		<title>How to Create an Upload Subscription with MS SQL Server Replication</title>
		<description><![CDATA[<img class="alignright size-medium wp-image-174" title="client server" src="http://bryanware.com/wp-content/uploads/2010/02/client-server-300x225.jpg" alt="" width="300" height="225" />I ran across this problem recently with a mobile application I am writing. I wanted to do some activity and system logs on the device and have it sync to the server with the publication I had setup, but I did not want each devices log data being synced to all the other devices. I wanted it simply to sync and upload the data only.

Sadly, this is where the problem comes in. There are generally only two options when using MS SQL Server replication: bi-directional and download only. Neither of these are really helpful for my problem because I need an upload only option. So how did I solve my problem?

I first thought I could have a job that ran often that would archive the tables and therefore, clear them out. That would reduce the amount of records being synced to all the devices. The problem with this is there is still the overhead of processing all the inserts and deletes. Another problem is the devices sync very often due to them needing the data as near to real time as possible, so there is still a possibility that unneeded data is getting pushed to multiple devices. Also, having a job do this just seemed like a really hacked up way of solving this problem, although I am not sure if my solution is much better.

Along with my production database, I also have an archive database where I want these logs to go anyway. So to get my upload only replication working, I did the a trick with an INSTEAD OF trigger. On my tables, I setup the trigger where it would write the data to my archive table instead of the table I had setup for replication. This allows the data to bypass the production table, and not worry with getting replicated to all the other devices. Since an INSTEAD OF trigger will always execute first, and I am not actually inserting anything into my production table, the replication triggers are never called for insert.

To keep the tables clean on the devices, I cleanup (clear out) the tables on login after the initial sync.

I realize this is probably a really hacked up solution, but I searched around and could not find anything better and this works. So if you have a better solution, please let me know.]]></description>
		<link>http://bryanware.com/2010/02/18/how-to-create-an-upload-subscription-with-ms-sql-server-replication/</link>
			</item>
	<item>
		<title>My 30 minute plan</title>
		<description><![CDATA[How many times do you say “I would like to do that, but I don’t have time”? Probably a lot, huh? I will admit I can definitely be accused of using the phrase too often too. With that being the case, I have tried to come up with a solution for me where I can more efficiently break up my time and make progress on all the things I would like to do.

Right now I have a lot of thing going on that I would like to do:
<ul>
	<li>Write more</li>
	<li>Learn another language</li>
	<li>Read more books</li>
	<li>Learn the iPhone SDK</li>
</ul>
And this list could go on.

So, I have list of what I would like to do. I also know where my priorities lie on the more important things that I must put time on that are not “extras”. So what can I do to put the time needed on the high priority items, but still put some time the other things I would also like to accomplish? I call my plan the 30-minute plan.

When I think about the amount of time I could possibly have free during a day, I have about 5-6 hours that I could put on whatever I wanted. Some of this time must be spent on necessary things like housework and cooking dinner, but that still leaves a decent amount of time to work on other stuff. Since the time is not continuous, I really have to focus on smaller blocks of time which is where the 30 minutes comes in.

For most things I want to do, 30 minutes of time per day would result in a lot of progress. So if I have 5-6 hours, than results in 10-12 blocks of time to devote to something. Removing a couple of blocks for the basics, that would give me time to put 30 minutes of focused activity on possibly 10 different things. Even if I am only half productive, that is still progress on 5 items. Yes, there are things that will take more than 1 block, but even breaking up the task into multiple blocks still has its benefits.

The main goal of this plan is to have short blocks of time focused on one item. Since my mind tends to get distracted on other things, I developed this plan to give myself a limit. Having the limit forces me to cut out other distractions and focus on the task at hand to get something accomplished. I have done just that with this post, and that was to write it, review it, and post it under 30 minutes.

I hope it does not give too much of a headache.]]></description>
		<link>http://bryanware.com/2010/02/03/my-30-minute-plan/</link>
			</item>
	<item>
		<title>Create an Object Without a Constructor</title>
		<description><![CDATA[Do you ever get into a situation where a constructor just does not seem like the best way to create your object? Maybe you are using the constructor with the id of the object as the parameter, then creating the object from the results from the database. I will use a very simple House object as an example:
<pre class="brush: c-sharp;">    public class House
    {
        public int HouseID { get; set; }
        public Address HouseAddress { get; set; }

        public House(int id)
        {
            this.HouseID = id;
            this.HouseAddress = //get data from database
        }</pre>
What happens when there is nothing found in the database? A constructor cannot return null. What happens when you want to also get the house by the owner ID, which is also an int. This will cause two methods with the same signature. The second one maybe a bad example, but you get the idea.

In any case, using a constructor for actions like this can be limiting, confusing, and just bad design. An alternative approach is to take a bit from the <a href="http://en.wikipedia.org/wiki/Factory_method_pattern" target="_blank">factory pattern</a>. Instead of using a constructor, we can create a static method on our class to return the object. This gives us more flexibility, and also the ability to return a null object. So, instead of the above, we can do this:
<pre class="brush: c-sharp;">    public class House
    {
        public int HouseID { get; set; }
        public Address HouseAddress { get; set; }

        private House() {}

        public static House GetHouseByID(int id)
        {
            //Get house by the ID
        }

        public static House GetHouseByOwner(int ownerID)
        {
            //Get house by the owner id
        }</pre>
Beyond allowing us to return a null, you will notice that I named these methods according to what they are actually doing. This is another benefit so you don't have to purely rely on comments to know how you are getting the object.

Yes, the title may be a little misleading because a constructor will be used, just not a public constructor.]]></description>
		<link>http://bryanware.com/2010/01/31/create-an-object-without-a-constructor-kind-of/</link>
			</item>
	<item>
		<title>iPad, what people are missing.</title>
		<description><![CDATA[Why is everyone so negative on the iPad? What am I missing?

I have looked at the specs of the device, and I actually think it is a wonderful device. Why do I think that? Because the interface with this device does not match any other device available. People either try to compare it with a laptop or call it a giant iPod touch. That’s like comparing a midsize SUV to a compact car and a full sized truck. Actually, I will run with that analogy.

The compact car is inexpensive and can easily get people around, but maybe not in the most comfortable way. The full size truck can haul large loads, potentially carry several people comfortably, and do most things that would ever be needed. The problem with the truck comes with the expense of operating it, and the hassle of maneuvering a larger vehicle. Enter the SUV. For the most part, it is not as expensive as the truck, can haul people comfortably, and has additional room for hauling other items. It’s more than the compact car and less that the truck. Trying to push a feature of one onto the other will then also push those issues. Making it smaller makes it less comfortable, making it bigger makes it more costly. You can see that each one has it’s market. (In case you missed it: car = smartphone, SUV = iPad, truck = laptop)

I think this analogy translates perfectly to the current situation. You have to realize that this device is not meant to have all the features of a laptop, we have laptops for that. It is also not meant to have the portability of an iPod. It wants to take that portable experience and the do everything laptop experience, and intuitively have the features meet in the middle.

A couple of the most common complaints:
<h5 style="padding-left: 30px;"><strong>No Camera</strong></h5>
<p style="padding-left: 30px;">Have you actually thought about trying to use a camera on a device like this? How would you hold it? Would you have to set it on a docking station, or are you going to hold in with your hands and give the person you are talking to the Blaire Witch Project I need to puke feeling? I am sure this will eventually be a feature of the device, but I don’t see how the experience could be good unless it is on a stationary dock. At this point, it is trying to be a laptop.</p>

<h5 style="padding-left: 30px;"><strong>No Multitasking</strong></h5>
<p style="padding-left: 30px;">I would love to hear you thoughts on your solution for this? It must intuitively manage the applications without letting all of them continue to run and kill the battery. It has to be simple enough that  you don’t even feel like you have to worry about it. That is the experience that Apple is trying to create.</p>
<p style="padding-left: 30px;">I would love to have the ability to listen to my Pandora radio while I am reading or working on a document. The issue I have with this is I don’t really know how this could be done without creating the management nightmare they were trying to avoid on the iPhone. I understand it is a limitation, but it is also nice to not to have to worry about:</p>

<ul style="padding-left: 60px;">
	<li>Do I need to quite this application, or close it? Because I don’t think I will need it for a while?</li>
	<li>I will just leave all my apps open, so they will load faster. What happened to my battery life, this device sucks.</li>
</ul>
<p style="padding-left: 30px;">Yes, these are very simple things, but they are things I honestly would like to not have to worry about.</p>
<p style="padding-left: 30px;">I don’t want to make this post extremely long and cover every point because you probably get my drift. But my main point is this: many people are quick to complain that it does not have a specific feature. Before you do that, realize that this is a new device for a new market. It is not being made to give you everything that you need, because it then would lose everything that it is trying to be.</p>]]></description>
		<link>http://bryanware.com/2010/01/30/ipad-what-people-are-missing/</link>
			</item>
	<item>
		<title>The Week of Anticipation</title>
		<description><![CDATA[Unless you have been hiding under a rock, you know that this Wednesday will bring Apple's event that will unveil their new tablet device. With hype matching that of the iPhone, it has been an interesting <a href="http://www.engadget.com/tag/apple%20tablet" target="_blank">run of rumor and speculation</a>. After Wednesday, we will switch from the overload of speculation to the onslaught of people loving or hating the device.

It will bring out the people that will buy it because it will make them cool, people that will hate it in because it will make them cool, or people that have a true need and have been waiting for it just like any other device. Right now, I am in the third group. I have been wanting to get an e-book reader for quite some time now, but have not been impressed with the line up. I have also wanted something near the equivalent of a net book, but don't like anything in that lineup either. I am ready to see if this new device will fit what I have been looking for.]]></description>
		<link>http://bryanware.com/2010/01/24/the-week-of-anticipation/</link>
			</item>
	<item>
		<title>3 Common Software Design Approaches</title>
		<description><![CDATA[How do you design software? Are you a “cowboy coder” who starts coding immediately to get it done, quick designer who sketches out a quick design before starting, or acomplete architect who tries to hammer out all details before even writing the first line of code? As most people would say, it really depends on what is being done and the scale and size of the project. I very rarely do no design, unless it’s for a quick throw away utility.

For any piece of software that is going to be maintainable and testable, you really have to have a good thorough design. This does not mean you have to work out every detail before you start, but you at least need to have an approach to your design that allows you to easily makes changes without easily breaking the application. With this in mind, I am going to go over a few common approaches to developing software:
<h5><strong>Data Driven</strong></h5>
<p style="padding-left: 30px;">Data driven design starts with data. This means designing the database first, then developing the rest of the application around that. This approach is very common for business application. If you use .NET, many of its components were designed for this very approach.</p>
<p style="padding-left: 30px;">I have used this approach many times. Once you have an understanding of the entities and their relationships, you have a pretty good understanding of how the application should function. With this, I have found that a lot of good questions come from designing the database, and a pretty good application design is a result of the answers to these questions.</p>

<h5><strong>Domain Driven</strong></h5>
<p style="padding-left: 30px;">Domain driven design starts with the logical entities. This means designing the classes that will be used to hold the data. At this point, it sounds a lot like the data driven approach. But since the classes also hold methods, this approach goes further by also designing all the behaviors of the entities.</p>
<p style="padding-left: 30px;">This is not to say that a data driven approach does not focus on behaviors at all, but domain driven uses objects that can actually perform the actions, so for me, it is a cleaner approach to holding a better design.</p>
<p style="padding-left: 30px;">I like this method for the same reasons I liked the data driven, because they are both designing entities and their relationships, and that makes you ask a lot of important question.  But I like this approach more due to more focus on the behaviors. This allow for even more questions, and a more complete design to start with.</p>

<h5><strong>Test Driven</strong></h5>
<p style="padding-left: 30px;">Test driven development starts with the behaviors. Once a behavior has been defined, a test is written first for all possible outcomes of that behavior. Once the test is written, the case is verified as failed (red). This is to check the integrity of the test. The next goal is to implement the behavior and test until pass (green). This step could also be considered a prototyping phase with the goal only being to pass the test. With this, the next goal is to clean up the code and separate the logic into functions where needed, put simply: (refactor). These steps are easily described as “red/green/refactor”.</p>
<p style="padding-left: 30px;">I have yet to attempt this approach on a project. However, I have a new project in the requirements gathering phases now, and I expect to use it then so I will report back.</p>
<p style="padding-left: 30px;"></p>
This has been far from a complete explanation of all the possible approaches, and really does not do any of the approaches mentioned justice in fully explaining them. The goal here was to give a quick overview of a few common approaches, with the hopes that you will or are using one of these. If you are unfamiliar with any of these approaches, I hope you search for more details, as they provide really good patterns to follow when coding.]]></description>
		<link>http://bryanware.com/2010/01/24/3-common-software-design-approaches/</link>
			</item>
	<item>
		<title>Haiti Before &amp; After</title>
		<description><![CDATA[I saw today where there was a map overlay available for Google Earth that shows a current view of Haiti. I copied the images from the before and after below.

It is hard to imagine trying to create any type of organized approach to helping these people. There is such massive wide spread destruction. I have a friend and wife are heading down now and I certainly wish them the best. I hope their time there helps many people as I am sure it will.]]></description>
		<link>http://bryanware.com/2010/01/18/haiti-before-after/</link>
			</item>
	<item>
		<title>Trying this again</title>
		<description><![CDATA[I have tried several times to start a blog, but I was always trying to over complicate it. So for my new attempt, with a nice, clean design, I plan to just talk about what is on my mind. Nothing more, nothing less.
I am not going to try to follow any &#8220;how to have a successful blog&#8221; tips [...]]]></description>
		<link>http://bryanware.com/2010/01/17/starting-over/</link>
			</item>
</channel>
</rss>
