Jonathan Birkholz

Introducing Houston JS

It’s about time for a Houston javascript group. So say hello to HoustonJS.

Kevin Lee and I were talking a few weeks ago about how so many people were wishing there was a Houston javascript group. I then replied, well why don’t we start up one. There you have it. The origin of HoustonJS.

We later discovered Brian Garcia was thinking the same thing. And now with our powers combined we set our first meeting date and time.

This Wednesday, Jan 18th at 7pm at the ChaiONE office.

4900 Woodway Drive #880 Houston, TX

There won’t be an official topic or speaker this meeting. We were going to talk a bit about Backbone.js but decided it would be best to do that another meeting.

This meeting will be a meet and greet. We will also bring up potential topics and gauge their interests. We also want to hear from the people attending what they want to get out of HoustonJS.

I am look forward to seeing everyone there and hope they are as excited as I am for HoustonJS 2012.

Learning Bash Aliases and Functions

During our fantastical Lunch and Learn at ChaiOne, we went over customizing bash using aliases and functions. These little tools make normal command line mortals into command line gods… or at least demi-gods.

If you are new to Macs and other Unix based systems, like I am, then what I am about to share will be new to you. It was new to me until today. And for those Unix gurus, if I describe something incorrectly please let me know.

First of all there is a file called .bashrc in your home directory ( ~ ). This file is loaded anytime you run a command script or open a terminal window. In this file we can add aliases, functions, and other customizations for our command line.

With an alias I can create a shortcut ‘g’ for ‘git status’.

1
alias g='git status'

Now I can just type ‘g’ to run ‘git status’.

I can use a function to create a more robust shortcut. For example, I can create a shortcut for ‘git push’. In this function by default I push to ‘origin master’ but if I provide an argument it will push to ‘$argument master’.

1
2
3
4
5
6
7
8
function gpush {
if [[ -z $1 ]]
then
git push origin master
else
git push $1 master
fi
}

gpush => git push origin master

gpush heroku => git push heroku master

Once you add the alias or function to your .bashrc, you can reload the file using

1
source ~/.bashrc

And there is a shortcut for source ( . ) So you can use

1
. ~/.bashrc

Now you know how to create aliases and functions. I must admit, I think its pretty damn cool. This coming from the guy that a year ago was hesitant to use git on the command line.

Houston Techfest - Design Patterns

An email from Claudio reminded me that I completely forgot to link the slides and code from the Houston Techfest presentation!

And just a reminder that everything is offered as is. But that doesn’t mean you can’t email me or Claudio for more information. :)

You can find the slides on slideshare at :

http://www.slideshare.net/RookieOne/techfest-design-patterns

And the code you can find (as is) at bitbucket :

http://bitbucket.org/rookieone/design-patterns

And you can find the code on GitHub at :

http://github.com/RookieOne/Houston-Techfest-Design-Patterns

Lighten Color in C#

The following piece of code was originally written by Marcus Egger in a converter. I did a bit of refactoring to clean up the code and moved the code outside a converter and into an extension method.

The extension method is off of Color and returns another Color. Now since it is an extension method you can use it in a converter or a markup extension (the latter being my favorite use).

You can also get this code from my color project on GitHub :

http://github.com/RookieOne/Colors

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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
public static class LightenColorExtension
{
/// <summary>
/// This method applies lighting to a color.
/// For instance, a color that has a lighting factor of 1 applies, appears at its original value.
/// A color with a lighting factor of 0.5 appears only half as bright as it was before.
/// A color with a lighting factor of 1.5 appears roughly twice as bright as before.
/// A color with a lightning factor of 2 appears white.
/// </summary>
/// <param name="originalColor">Base color</param>
/// <param name="lightFactor">
/// Amount of light applied to the color
/// </param>
/// <returns>Lit color</returns>
/// <remarks>
/// This routine is very fast. Even when using it in tight loops, I (Markus) have not been able to
/// meassure a significant amount of time spent in this routine (always less than 1ms). I was originally
/// concerened about the performance of this, so I added a caching mechanism, but that slowed things down
/// by 2 orders of magnitude.
/// </remarks>
public static Color Lighten(this Color originalColor, float lightFactor)
{
if (TransformationNotNeeded(lightFactor))
return originalColor;
if (RealBright(lightFactor))
return System.Windows.Media.Colors.White;
if (ShouldDarken(lightFactor))
return DarkenColor(originalColor, lightFactor);
return LightenColor(originalColor, lightFactor);
}
private static bool TransformationNotNeeded(float lightFactor)
{
var value = lightFactor - 1.0f;
return value < 0.01f
&& value > -0.01f;
}
private static bool RealBright(float lightFactor)
{
return lightFactor >= 2.0f;
}
private static bool ShouldDarken(float lightFactor)
{
return lightFactor < 1.0f;
}
private static Color DarkenColor(Color color, float lightFactor)
{
var red = (byte) (color.R*lightFactor);
var green = (byte) (color.G*lightFactor);
var blue = (byte) (color.B*lightFactor);
return Color.FromRgb(red, green, blue);
}
private static Color LightenColor(Color color, float lightFactor)
{
// Lighten
// We do this by approaching 256 for a light factor of 2.0f
float fFactor2 = lightFactor;
if (fFactor2 > 1.0f)
{
fFactor2 -= 1.0f;
}
var red = LightenColorComponent(color.R, fFactor2);
var green = LightenColorComponent(color.G, fFactor2);
var blue = LightenColorComponent(color.B, fFactor2);
return Color.FromRgb(red, green, blue);
}
private static byte LightenColorComponent(byte colorComponent, float fFactor)
{
var inverse = 255 - colorComponent;
colorComponent += (byte) (inverse*fFactor);
return colorComponent < 255
? colorComponent
: (byte) 255;
}
}

Wizards of Smart #11 - Glenn Block Part 2

A lot of people have asked about the second part of the Glenn Block interview, so here it is. Ok so it is a month late. A lot of stuff was happening in July (I will explain on another post. Lots of good stuff but it just put the podcast on hold for a bit)

In this podcast Glenn and Ryan dive more into REST. It is a great conversation. I felt like a fly on the wall, but it was a very lucky fly that learned a lot about REST. So enjoy.

Wizards of Smart #10 - Glenn Block Part 1

Ryan and I had a awesome opportunity of having Glenn Block join us on a Skype call a couple of weeks ago. We wanted to have him on and talk about what he is currently doing and try to avoid the whole MEF topic (we did dive a bit into it, but not too deep).

So part 1, Glenn introduces himself and gives a history of his current move from MEF to WCF and his vision on what he hopes to do by joining the team.

Glenn blogs at codebetter.com : http://codebetter.com/blogs/glenn.block/

Visual Studio Theme - Bearkat

Sharing my Visual Studio theme has been on my list of things to do for awhile now. When the site http://studiostyles.info/ came up, I immediately thought here is an easy way to share my color scheme.

I finally created my theme on the site: http://studiostyles.info/schemes/bearkat

Be sure to check it out!

For those who might like the colors but not the way I used them (and for me to remember what the colors are):

  • Black : R22 G22 B22
  • Blue : R43 G145 B175
  • Green : R102 G143 B95
  • Orange : R255 G116 B0
  • Red : R163 G21 B21
  • Gray : R128 G128 B128
  • Light Green : R206 G255 B132
  • Tan : R189 G162 B101

Virtual Brown Bag 6/17/2010

Ed is doing a fantastic job capturing the links and the topics from the Virtual Brown Bags but I think I will still throw some links up on my site.

C# and Lambdas + Events

Shared some code on using Lambdas to listen to events. Alan Stevens recommended the reading of C# in Depth : http://www.manning.com/skeet/

RailsConf + Skills Matter Videos

Uncle Bob : 25-Zeroes : http://www.youtube.com/watch#!v=mslMLp5bQD0&feature=related

Martin Feathers : Good Code : http://www.youtube.com/watch?v=L9ccnRixyMg&feature=PlayList&p=393ECE649BB3813D&playnext_from=PL&index=6

Udi Dahan : CQRS : http://skillsmatter.com/podcast/open-source-dot-net/udi-dahan-command-query-responsibility-segregation

IDEs

Code Bubble : http://www.cs.brown.edu/people/acb/codebubbles_site.htm

Code Canvas : http://research.microsoft.com/apps/pubs/default.aspx?id=80076

http://www.youtube.com/watch?v=d4NEaXajiI0

Software Metaphor

Drive: The Surprising Truth About What Motivates Us : http://www.amazon.com/Drive-Surprising-Truth-About-Motivates/dp/1594488843/ref=sr_1_1?ie=UTF8&s=books&qid=1276794836&sr=8-1

Film Making: A Better Software Development Metaphor http://www.lostechies.com/blogs/rodpaddock/archive/2010/04/15/film-making-a-better-software-development-metaphor.aspx

Ayende : Garden : http://ayende.com/Blog/archive/2007/09/18/The-Right-Metaphor-Software-as-a-garden-not-a-building.aspx

Wizards of Smart - Heroku, Cloud, and Iron Ruby

Sorry for the long delay guys. Ryan and I are both in the middle of deploying applications so other things are on our minds. While we wait for me to edit the recording we did last night and we await Glenn Block’s approval on the fantastic 2 shows we did with him, we can enjoy a smaller conversation Ryan and I had on Heroku, Azure, and a bit about Iron Ruby.