Archive for August 2012

WPFSharp: A WPF Searchable TextBlock Control with Highlighting

So I needed a TextBlock that was searchable and from searching online, it seems a lot of people need one too. So I decided to inherit TextBlock and write a SearchableTextBox. It is really easy to use. I wrote the blog post over on my other site:

A WPF Searchable TextBlock Control with Highlighting

Can a mother somehow either influence the DNA or influence changes in addition to the DNA of their offspring?

So when my son Aiden was in my wife’s womb, my wife had a growth on her ear. It may have been a fungus, I don’t know, but it was just a little bump. Well, Aiden was born and wouldn’t you know he has a skin tag in the exact same spot.

Shout coincidence all you want, coincidence just doesn’t cut it for me. Somehow, this change in my wife was passed down to my son. I can’t prove it, but how likely is it that my wife had a growth in the exact same place on the exact same ear as my son’s ear tag? If I apply Occam’s Razor, I have to be honest, it is more likely that the fetus took after the mother than it was two random natural occurrences happened in the exact same place on the exact same ear.

Could the theory of slow evolution over time be slightly off. Maybe it still takes generations, but it is way faster than previously believed. If my son was able to make this small evolution, based on the mother, perhaps other changes that occur in the mother are passed down to their children.

So what is my theory? My theory is that a mother can somehow either influence the DNA or influence changes in addition to the DNA of their offspring.

If this theory is true, think about how the scientific view of evolution would change?

Of course, I am just a software developer, what do I know? Maybe it was just some random fluke.

3 Column Table Layout verses 3 Column HTML5 Layout

Has HTML5 and CSS3 solved the layout problem? Or are tables layouts with CSS still a better solution.

You decide. Please post comments about other pros and cons you find. We all become experts when we all contribute.

Note: With both a table layout and an HTML5 layout, CSS is used, so this is not a CSS versus anything article. No matter which you use, lets agree that CSS should be used for style. However, CSS3 does add to the layout with the HTML5 solution.

3 Column HTML Table Layout with CSS Style

Click this link to see this layout: 3 Column HTML Table Layout with CSS Style

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>HTML Table Layout with CSS Style - 3 Column</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
 
html, body 
{
  height: 100%;
}
 
body 
{
    margin:0
}
 
table.layout 
{
  height:100%;
  width: 100%;
  border-collapse:collapse;
}
 
td.header 
{
  padding: 15px;
  height: 120px;
  color: white;
  background: black
}
 
td.nav-bar 
{
  padding: 15px;
  height:20px;
  background:DarkGrey;
}
 
td.leftcol 
{
  padding: 15px;
  width: 170px;
  min-width: 170px;
  background-color:Navy;
  color: white;
}

td.midcol 
{
  padding: 15px;
  min-width: 625px; /* Make 425px for min res of 800x600 */
}
 
td.rightcol 
{
  padding: 15px;
  width: 205px;
  min-width: 205px;
  background-color:Navy;
  color: white;
}
 
td.footer 
{
  height: 120px;
  background: DarkGrey;
  text-align: center;
}

</style>
</head>
<body>
<table class="layout">
	<tr>
		<td class="header" colspan="3">Header</td>
	</tr>
	<tr>
		<td class="nav-bar" colspan="3">Nav bar</td>
	</tr>
	<tr>
		<td class="leftcol">Aside left</td>
		<td class="midcol">Article</td>
		<td class="rightcol">Aside right</td>
	</tr>
	<tr>
		<td class="footer" colspan="3">
			<a href="http://validator.w3.org/check?uri=referer">
				<img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0 Strict" height="31" width="88" />
			</a>
		</td>
	</tr>
</table>
</body>
</html>

HTML Table Layout Pros

  • Validated with W3C
  • Only 95 lines of code with everything on its own line
  • Works with every browser according to BrowserShots.org
  • Very easy to use.
  • Making the table be 100% height is easy
  • Changing the width or height of any part of the page is easy

HTML Table Layout Cons

  • Layout is coupled to the HTML, layout would be best decoupled – Solved by using scripting languages like PHP and ASP.NET
  • Left column is found in HTML before the article body – No current solution

3 Column Layout HTML5 with CSS Layout/Style

Click this link to see this layout: 3 Column Layout HTML5 with CSS Layout/Style

<!DOCTYPE html>
<head>
<title>Layout HTML5 with CSS Layout/Style - 3 Column</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
 
html, body 
{
  height: 100%;
}

body 
{
    margin:0
}

header 
{
  padding: 15px;
  min-height: 150px;
  color: white;
  background: black
}
 
nav
{
  padding: 15px;
  min-height:20px;
  background:DarkGrey;
}

#main 
{ 
  /* height:100%; */ /* Broken with it, broken without it */               
  display: -moz-box;				/* Firefox */
  display: -webkit-box;				/* Safari and Chrome */	
  display: box; 					/* Future standard */
}

#main-aside-left
{
  padding: 15px;
  width: 170px;
  min-width: 170px;
  -moz-box-ordinal-group: 3; 		/* Firefox */
  -webkit-box-ordinal-group: 3; 	/* Safari and Chrome */
  box-ordinal-group: 3; 			/* Future standard */
  background-color:Navy;
  color: white;
}

article 
{ 
  padding: 15px;
  min-width: 625px;					/* Make 425px for min res of 800x600 */
  -moz-box-flex: 2; 				/* Firefox */
  -webkit-box-flex: 2; 				/* Safari and Chrome */
  box-flex: 2; 						/* Future standard */
  -moz-box-ordinal-group: 2; 		/* Firefox */
  -webkit-box-ordinal-group: 2; 	/* Safari and Chrome */
  box-ordinal-group: 2; 			/* Future standard */
}

#main-aside-right
{
  padding: 15px;
  width: 205px;
  min-width: 205px;
  -moz-box-ordinal-group: 1; 		/* Firefox */
  -webkit-box-ordinal-group: 1; 	/* Safari and Chrome */
  box-ordinal-group: 1; 			/* Future standard */
  background-color:Navy;
  color: white;
}

footer 
{
  height: 120px;
  height: 120px;
  background: DarkGrey;
  text-align: center;
}

</style>
</head>
<header>Header</header>
<nav>Nav bar</nav>
<div id="main">
   <article>Article</article>
   <aside id="main-aside-left">Aside left</aside>
   <aside id="main-aside-right">Aside right</aside>
</div>
<footer>
  <a href="http://validator.w3.org/check?uri=referer">
    <img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0 Strict" height="31" width="88" />
  </a>
</footer>

HTML5 Layout Pros

  • W3C validated (experimental)
  • Article data comes before the data in the asides – This is a huge SEO bonus
  • Only 97 lines of code both CSS and HTML code, with everything on its own line
  • Very easy to use.
  • Making the table be 100% height is easy
  • Changing the width or height of any part of the page is easy

HTML5 Layout Cons

  • It doesn’t work on IE 9 or below and fails in many other browsers according to Browsershots.org. – No current solution.
  • Much of the CSS has to be duplicated – No current solution but when it is fixed, the code will be another 10 lines smaller
  • If the content does not fill the screen, there is no way to make the screen exactly 100% – No current solution but as long as the content is larger than the screen this doesn’t matter
  • Layout is coupled to CSS,  a styling tool, layout should be decoupled – Solved by having a separate CSS file just for layout

Conclusion

Use Table layouts for now if your browser support is high priority.

Use HTML5 layouts if you can enforce uses to use HTML5 capable browsers.

Reasons to use MonoTouch and MonoDroid

MonoTouch and MonoDroid allow us to write our apps in C# and this is the right solution for our mobile apps and here are the reasons why.

Note: These reasons were ones I provided to a C# shop so some may not be valid for places where the majority of developers are not C# developers.

  1. MonoTouch is native. See monotouch is both a wrapper for the native code and the ability to access C# libraries. It is not like flash or html 5, where it is completely different technology. It is just the ability to use native code from C# with an added C# framework.
  2. MonoTouch uses the native UI (and MonoDroid does too). So UX’s desire to have a native UI is met by MonoTouch.
  3. Many companies already use MonoTouch and MonoDroid: Microsoft, 3M, VMWare, Novartis, Target, Acenture, Cisco, AT&T, AOL, Monster, Cornell University, Raytheon, Intuit, HP, and many more companies.
  4. The number of C# language experts we have: All of us
    The number of Objective-C language experts we have: Zero
    With C# everybody can work on the code, not just one or two Objective C engineers.
  5. If we use Objective C, we will have a huge ramp up expense and this expense will occur over and over, because every time someone quits, it is more likely that we will have to incur the cost of training a C# developer to become an Objective C developer than it is likely we will hire. As you know, hiring a replacement may or may not happen.
  6. Shared C# code. A large portion of our code the code write for SharePoint, iOS, Windows, and Android can be used and unit tested in one place. I have personally experienced this re-use of code at my previous company. We starting an Android app and our project was finished more than three weeks early by using MonoDroid, because we were able to use all the C# code we had already written.
  7. C# is a more developed language and is far easer to write code in. For example, to connect to a web service using windows integrated security is just a few lines of code in C# but requires extra libraries and a massive amount of effort in Java or Objective C.
  8. Shared Unit Test libraries. Since much of the code is shared, separate unit tests are not needed. Also, the C# unit testing frameworks we are already familiar with can be used and there is no need to ramp up on and implement a new unit testing technology. This is just another cost saving.

I recommended MonoDroid and MonoTouch at LANDesk and I will do the same here. The cost of using Ojbective C is far greater and the time to market is far longer. The SDLC of Objective C will have a greater cost. Choosing it will be a costly.

Since this isn’t my team and since it isn’t my decision, this is the last I am going to say about it.