« December 2009 | Main | February 2010 »

January 28, 2010

CTO Breakfast Tomorrow - Free Pizza Tonight

Tomorrow is the CTO Breakfast. I know, kind of late notice, but this one snuck up on me. I've been heads down with a major ope-heart surgery of the Kynetx rules engine. I'll tell you all about it tomorrow at the breakfast--refactoring code provides lots of opportunity for reflection on software development.

The breakfast will be held in the usual place (Novell Cafeteria in Provo - map) at 8am.

Anyone interested in how information technology is used to build products or run companies. Despite it's name, you don't have to be a CTO to attend--just interested in technology, where it's headed, and the problems of starting and building a high-tech business in Utah. I

Also, tonight at 5pm, Kynetx is hosting Kynetx Fireside Chat (code-bash and developer get-together) at our offices in Thanksgiving Point (map). Free pizza, interesting discussions, and good friends. You're invited, so come on over.

I hope you can make it to one or both of these events. See you there!

6:59 AM | Comments () | Recommend This | Print This

January 21, 2010

Starting a High Tech Business: Do What's Important by Embracing the Urgent

ANAHEIM, CA - MARCH 20:  Jimmer Fredette #32 o...

Image by Getty Images via Daylife

I'm starting a new business called Kynetx. As I go through some of the things I do, I'm planning to blog them. The whole series will be here. This is the twenty-second installment. You may find my efforts instructive. Or you may know a better way---if so, please let me know!

Last Saturday I attended the BYU vs Colorado State basketball game and came away with a lesson I hadn't anticipated. When the game first started, things seemed pretty even matched and you'd have had a hard time seeing significant differences between the teams. They were both executing pretty well and the score was close. Over time, however BYU pulled away so that by half-time they were a dozen or more points ahead and ended the game with BYU ahead 91-47. BYU won because they were executing well as a team and playing good ball. Over time BYU's small wins compounded to result in resounding defeat.

I think the same thing's true in business. Watch any set of startups in their early stage and you might not see huge differences--but they're there. There's one or two that are executing better and over time, that difference will compound.

Steven Covery talks about "urgent" vs "important" tasks. We see those all the time in business. Urgent tasks, like raising money, often get done at the expense of important tasks, like meeting with customers. On the tech side, we spend time getting new machines configured in the data center or setting up a mail server, rather than adding new features to the product. Over time, some companies are getting the important things done and others aren't. Guess who succeeds.

The problem is that you can't simple say "I'll ignore the urgent tasks." They're urgent, after all. You won't survive if you ignore urgent tasks, but you'll never thrive until to get past them and move onto important tasks.

Getting past the urgent tasks means dispatching them as quickly and efficiently as possible. In other words, you have to embrace and fully attend to urgent tasks in order to keep them from eating you up. That's contrarian, but it's true. Much of this series has been focued on exactly those kinds of issues. Here are a few things we've learned:

  • Automate everthing you can. This is one important task that you can do that will help slay the merely urgent ones. There's never been a greater set of tools for automating the mundane tasks of administering high-tech products. Kynetx went two years without a fulltime sysadmin and we spent only a few hours per week making all the IT work. An additional benefit of automation is that tasks not only get done, but they get done consistently, improving uptime and reliability. That's a huge win.
  • Outsource everything you can. There are all sorts of tasks that you can just give to someone else and largely forget about. This includes, PR, HR, payroll, travel, finance, email, servers, storage, and so on. Sometimes "outsource" means hiring part-time consultants (like PR or HR specialists) and other times it means using a Web service (like GMail or TripIt). Most urgent tasks can be handled this way. Don't spend your time doing something that isn't core to the business.
  • Take care of finances now. We hired a part-time CFO early on for strategic advice, but neglected the books until later. Once we got them set up it was like someone had switched on the lights. Next time, I'll do it sooner. Having your books set up right and tracking your company's financial health from the start is critical. The longer you take to get your books set up the hard it will be and then you'll not have the information you need to make critical decisions.

Have the discipline to do urgent tasks "right" rather than just doing enough to get by. Whenever something urgent pops up, figure out how to accomplish the task in a way that ensures that you won't have to do it again. That kind of execution is what will separate you from the competition over time. Your ability to spend just a little more time on what's important each day will compound over time and lead to crushing victories in the end.

8:42 AM | Comments () | Recommend This | Print This

January 13, 2010

Using OAuth to Access Twitter from KRL

Kynetx Logo

The latest build (Build 391) of the Kynetx Rule Language (KRL) includes support for accessing Twitter data intrinsically within the language. Integrating interesting data with KRL is an important part of what makes the language so useful for building cross-site applications that mash-up data and user interactions. But what's really interesting about this release is that we're using OAuth to access the Twitter API and have built primitives into the language for dealing with the Twitter OAuth interaction to save developers from doing it.

Not only are we making it easy for developers to write apps that use Twitter, but this is also the first time that end users will see significantly different behavior from an app than their friend might. An app that uses the Twitter library will use my Twitter data for me and your Twitter data for you. Using OAuth, Kynetx apps can now be personalized.

Using Twitter data inside a KRL app generally involves two KRL patterns: authorize then use and initialize then populate

In the authorize then use pattern, a rule is put in place to check if the app is authorized to take a certain action and, if not, do what is necessary to complete the authorization. What makes this work is using the rule postlude to ensure that the rest of the rules (which presumably rely on the authorization) don't run. Here's an example from an app I wrote to demonstrate using the the new Twitter library:

rule auth is active {
  select using ".*" setting ()
  if(not twitter:authorized()) then
      twitter:authorize()
        with opacity=1.0 and
             sticky = true

  fired {
     last
  }
}

Notice that this rule only fires if the predicate twitter:authorized() is false. The action, twitter:authorize(), is what initiates the OAuth ceremony. The action will pop up a notification in the user's browser that looks like this:

OAuth ceremony initiated by a KRL application

The postlude of the rule (fired {...}) runs the last statement if the rule fires to ensure that nothing else happens. Of course, if the app is authorized, the rule doesn't fire, the OAuth ceremony is not initiated, the last is never executed, and the remaining rules in the ruleset are evaluated.

The initialize then populate pattern is important any time you're working with complex data. With complex data, you will frequently need to do something for each component of an array. That's what the foreach statement does as part of the rule selector: executes a rule once for each member of an array.

The problem is that if we use a foreach to loop over the tweets we get back and use notify to place them on the page, we'll end up with one notification box for each tweet. Not very pretty.

A better solution is to use a rule to place the notification box (the initializer) and another rule to loop over the tweets and place them in the notification box (the populater).

Here's the initialization rule:

rule init_tweetdom is active {
  select using ".*" setting ()

  pre {
    init_div = <<
<div id="tweet_list">
</div>
>>
  }

  notify("Friends Tweets", init_div)
    with sticky=true and
         opacity = 1.0

This is a pretty simple rule that places an empty notification box on the page.

The real work is done by the populating rule:

rule populate_tweetdom is active {
  select using ".*" setting ()
    foreach tweets setting (tweet)
      pre {
        text = tweet.pick("$..text");
        div = "<div style='background-color:#666;margin:2px'>" +
              text + 
              "</div>";
      }
      append("#tweet_list", div)
}

This rule loops over the tweets, grabs data out of them using pick, and appends the result to the div in the notification box.

The tweets variable was set in the global block:

tweets = 
  twitter:authorized() => twitter:friends_timeline({"count": 8})
                        | [];

After you've gone through the OAuth ceremony at Twitter, wherever you run this app, you will see a box like this that contains the last eight tweets from your friends timeline on Twitter. Here's the results for me:

The last eight tweets from my friends timeline on twitter.

Of course, if you run this app, either by card or bookmarket, you'll see the results from your friends timeline.

Craig Burton has created a nice tutorial about how all this works. There's some important data in the tutorial about how to get the keys from Twitter for your application. The library is also well documented and the source code for the ruleset is available.

The ability to personalize apps by appealing to personal data elsewhere on the Web is a huge step forward for KRL. Look for other APIs to be embedded in KRL in the near term and, eventually, more general support for OAuth so that developers can use any OAuth protected data source.

9:18 AM | Comments () | Recommend This | Print This

January 12, 2010

UtahPolitics.org All Over the Web: A Kynetx App

Utah Politics Tweeter App

Since 2003, I've been running a site called UtahPolitics.org. The site started off as a blog on which I and others posted articles. When I started UtahPolitics.org there was some speculation about my motives. But my motives are simple: create a place I can experiment with new media in an arena that interests me.

Last year, in an effort to continue the experiment, I put up a retweeter for UtahPolitics.org that would retweet any tweet from friends of the @utahpolitics account that contained the tag #utpol. When I did that I also morphed the web site--imperfectly--to a site that just aggregated those tweets. The idea was to move the discussion off of UtahPolitics.org and onto Twitter.

The problem with this is that it's sometimes difficult to follow the thread of a conversation, particularly those about particular pages on the Web. To try to solve that problem, I've build a Kynetx app that will show all the #utpol tweets about page on that page when you visit it. Here's a picture to show you what I mean:

UtahPolitics.org app running on a legislative page

The box on the right is showing any tweets that reference the page its on and contain the tag #utpol. Right now it's tweets by anyone. If that gets to be a problem, I'll restrict it to friends of @utahpolitics so that I have a way to block people.

I'm hoping that you'll use this app to follow Utah Politics during the next legislative session and contribute to the Twitter discussion about specific bills or newspaper articles. Using this app and your Twitter account, you can comment on legislative pages, newspaper pages, and so on. Anyone else who has the app will see your tweets and be able to respond on the page.

You can use this app in one of three ways:

  1. Download the AzigoLite Card selector and install the Utah Politics card - this is the most flexible solution since once you have the card selector installed, you can also use other Kynetx apps without any further downloads. Just install the card and go.
  2. Install a browser extension - this is probably the fastest and most convinient way to get going. Just download the right extension for the browser you want to use (or several if you regularly use more than one browser) and you're good to go. The following extensions are available:
  3. Use a bookmarklet - this is the simplest, but has the drawback of working only when you click on it. You may not always remember to do so and will miss out on people's comments. To use the bookmarket, drag this link to your bookmark bar at the top of your browser
    UtahPolitics Bookmarklet

Once you've got something installed, head on over to House Bill 10 on the Utah Legislature's page to see it in action. I've left some test tweets there.

You don't need to do anything special to use it. Just tweet about a page and include the tag #utpol. All the tweets about a particular page will show up in the app--even from people who don't have it installed. This is an assymetrical communication tool. Note, if there are no tweets about a particular page, you won't see anything--the app doesn't do anything in that case.

If you're interested in how this was made, I've made the source available on the app page. Feel free to ask questions or just copy it and build your own--Kynetx developer accounts are free.

I'm excited to see how this works--I hope it leads to some interesting discussions about Utah politics and gives some insight about how apps like this one--that work on multiple Web sites--can be made more effective.

9:35 PM | Comments () | Recommend This | Print This

January 11, 2010

On Science, Society, and Democracy

Test tubes

Image via Wikipedia

A few weeks ago a friend said something about science that helped me understand why many people misunderstand it. He said "science isn't the only way I have of knowing the truth." He was looking at science as a way for individuals to know things. Certainly science informs us all--and that's at the heart of the misunderstanding--but that's not the point of science. Science is how we as a society can know the truth about the world we live in.

Another example of a societal truth-finding system is the justice system. A court of law is a way to find the truth about events involving several people. While far from perfect, courts are still the best way we have to determine the truth in these situations and as a society we work very hard to ensure that they function well. We all have legally prescribed duties towards them like jury duty.

Science is best viewed the way we view democracy: Democracy is the best way for societies to organize themselves and make decisions in ways that respect and protect individual rights and freedoms. Science is the best way for society to understand the world around us and ourselves. Science and democracy serve each other and niether can long survive without the other.

If society comes to distrust science--and many do--then where will we turn for answers? What other system does our public discourse have for finding out about the world? Our democratic institutions depend on science being healthy and trusted. Democracy is no substitute. It's a great system for making decisions, but a rotton system for finding the truth. Science is the best societal tool at our disposal for knowing thing about our world.

I'm not arguing that science is infallible. Scientists are people and are consequently subject to all the same foibles as the rest of us. But like a court of law, there are rules in science that ensure that these human failings have limited affect on the result. Do scientists sometimes doctor results and cheat? Sure. Are they sometimes decieved? Sure. But, like a court of law or the democratic process, science is a system for getting good results in spite of these problems.

Politicians frequently misuse science. Anti-intellectual politicians (populists in all parties, but more so in the Republican party than the Democractic party as of late) dismiss it as just another special interest. Progressives and environmentalists (who I'm distinguishing from scientists, although a single person may, obviously, be both) frequently use science to scare us into adopting their agenda. Most people don't know enough science to distinguish the political wrangling from the science.

This is to bad, because it causes us to distrust science. People will always use social institutions like science, the courts, and democracy to get their way. That is human nature. The way we protect these institutions is by understanding them and being vigilant in their defense.

Most people, despite a dozen years of compulsory education in science as children don't understand it or how it works. Like democracy, the ultimate defense of science lies in education. My kids learn a lot about science facts. They learn little about the methods of science or how to read reports and think critically about what they read, using their knowledge of science.

I don't expect politicians to change anytime soon, but I do think more of us need to speak out in defense of science and what it represents for our society. Unless we do so, we will find our society adrift without any means of getting the good, trustworthy information that democracy needs to make good decisions.

8:49 AM | Comments () | Recommend This | Print This