I swear not a day goes by that I find some drawback on any given system. I switch back and forth between linux and windows these days mostly. Linux for all the servers, XP SP2 for most of the workstations, linux again on my laptop. And then of course macs, which I really don’t like for a few reasons. So I realized that really what I want is a frankenstien of a system, that culls the best aspects of all three systems into one badass, perfect one.

Macs are just too expensive for what you get. Plus the whole apple religion, it just seems so superficial, arrogant, snobbish and annoying that I want to have no part of it.

Linux then is wonderful, but the X-windows graphical system STILL to this day cannot produce a 2D UI that is as crisp, sharp, and easy to read as an XP machine. At least, I’ve never seen one. The fonts are always just a little “off”, a little too fuzzy, the spacing isn’t exactly right. The fuzzy fonts is another problem I have with mac displays as well. However, the design of linux itself is just hands down the best OS out there. I love the file system, the security, the stability, the open sourceness of everything, the help on the internet for it. Then things like Compiz Fusion just blow any other OS out of the water in terms of flashy eye candy.

Then XP. I like it because, unlike apple stuff, its very unassuming. There’s a reason like 94% of businesses use PC’s. They are ready to go and just get work *done* … as long as that work you want to do is in Microsoft Office. In linux to get Rails going it was just a few apt-gets. In XP, its much more involved, and just feels like you are being blocked at every turn. To even get close to unix-like command line functionality you have to use cygwin, IE fucking *blows*, etc etc.

So my perfect PC would be a combination of all three. I want a linux filesystem and OS, with its command line elegance and stability, ease of updating and upgrading and low cost. I want XP graphics capability so I can play all the games, have really nice, sharp text with all the standard fonts, and don’t forget all those proprietary drivers for every possible kind of hardware imaginable, not to mention the wealth of PC-only software. And then from apple, they have come up with a couple nice UI ideas here and there, so i’d let apple design my window manager and make it look all nice and shiny and flashy.

Oh, but it still has to work with Compiz ;)

We’re again accepting signups for people who want to test MetaForum on our freely hosted servers.

http://www.blursoft.com/metaForum/

There’s a caveat this time, namely being that you need to provide an actual reason for wanting one. Before we just let anyone and their brother sign up, and 98% of the signups were asdf’s, and 99% went unused. So, all signup requests will simply go through an approval stage before getting setup is all. If you earnestly want to use one, by all means sign up and we’ll get you going.

Because of the nature of AJAX applications, and the fact that the server can send down data to the client without the client initiating anything, often times updates go unnoticed. I suppose its a force of habit — why would a page change, if we’re not looking at it?

When the page IS changing though, it would be nice to have some way to say “Hey! You! I’m different now!”. This especially true with MF, when new threads or posts arrive. So I was working today on building a notification system. Get an update, play a sound, flash the title bar. Thats easy enough; But then we hit the problem of it being annoying, if it went off every time there was an update anywhere, it would be going off even when you yourself made a post.

So I was faced with the problem of being able to figure out whether or not the person is actively looking at the page or not. If they are, leave them alone — they can see with their own eyes that updates are occurring. We only want to do something if they are in another tab, or don’t have the browser visible at all.

I thought it would be as easy as a simple “if (window.hasFocus()) { notify(); }” but alas, no such thing exists. So after failed googling and asking on several forums, I eventually came up with the following test case, that works:


  <body onblur="lostFocus();" onfocus="gainedFocus();">
      <script type="text/javascript">
    
      var windowIsActive;
      
    function lostFocus()
    {
      windowIsActive = false;
    }
    
    function gainedFocus()
    {
      windowIsActive = true;
    }
      
    </script>
  
    </body>

So we’ll just keep a global variable around to store the state of the page ourselves, since the window object doesn’t have anything like that. “window” wouldn’t work anyway, since the window encompasses the entire browser window, which includes ALL the tabs. We want our page only. Using the onblur and onfocus events of the body element work magically. Then whenever its time to notify the user of changes, we’ll just do a quick test:

if (windowIsActive) { notify(); }

Viola. Why this functionality wasn’t included in the DOM is beyond me.

Wherr You At?

21Feb07 Brian

I took a bit of a break from MetaForum development today to do something a bit different. I’ve been wanting to dig into the google maps API for a while now just to see what she’s like, so I whipped up a quick mashup that lets any group, organization, or forum community map out where (geographically) everyone is located.

Check it out: GMeetUp

You can either start your own map, or browse through some of the ones that have already been started. Yeah, I know Frappr was around first and does the same thing, but you can’t really learn anything just by using other people’s stuff. I really wanted to muscle around with it and dig into it.

Conclusion? The Google Maps API is extremely nice, easy to use, and very powerful. Why I’d expect any less is beyond me, but there you have it.

A particular project I’m working on requires graying out options in a drop down box. I discovered the disabled attribute, which can be used as follows:


<select name="range">
    <option value="7">last 7</option>
    <option value="30">last 30</option>
    <option value="60" disabled="disabled">last 60</option>
</select>

Normally you can just write ‘disabled’, but to be valid XHTML, you need the disabled=’disabled’ variant. The point is, this works fine and looks great in Firefox. The options are not selectable and are nicely grayed out.

The problem I discovered is that IE doesn’t support this. They apparently never have and, at least from what I saw, don’t even support it in IE7. So tonight I’ll be working up some hacks to get around this. How much time is lost due to having to pander to IE’s deficiencies?

Beauty in Ruby Syntax

21Dec06 Steven

Inheritance using <
I heartily enjoy Ruby’s use of characters that typically imply directionality. For example, inheritance in class definitions is expressed with the less than sign, which seems to suggest visually that the new class is receiving the contents of the class on the right. In the example below, the ApplicationController is going inside the AuthController. I suppose you could argue that the AuthController is “less than” the ApplicationController, but the presence of the word class should force you to switch contexts.


class AuthController < ApplicationController

In Java you’d write

public class AuthController extends ApplicationController

In C# it’d be

public class AuthController : ApplicationController

And in Python you’d do

class AuthController(ApplicationController)

Hashes using =>
Additionally, the use of => in Ruby hashes is really nice. When I see something like:

redirect_to :action => "list"

I see an arrow pointing to list, which is where I want that to go. Even in a plain old hash definition the => works well by basically pointing from keys to values.

site = {
     "name" => "code in focus",
     "purpose" => "talk of code and such truck",
     "founded" => 2006
}

In Python I found the hashes to be a little less exciting and directly readable. The colon is a neutral character, so each side of the key:value pair seems equal. Not really much to complain about, I just find the arrows communicate a hash more readily. For example,

site = {
     "name" : "code in focus",
     "purpose" : "talk of this and that",
     "founded" : 2006
}

I’ve gone years without knowing this. I can do pretty much what I need to do with Vim, but while hacking some Python recently I realized I’d really like to have the ability to select a block of text and repeatedly indent or unindent it. Visual Studio and PSPad make quick work of tasks like that.

You can, of course, do this in Vim. Here’s how:

First, to enter the visual select mode, type
V

Now, to select lines below that point, type
j

Repeatedly pressing j will move the cursor down line by line, selecting as it goes. You should see the block get highlighted. Finally, to indent the selected block, type
>

Or to unindent, type
<

From time to time it’s nice to take a break from the high-level, web-centric stuff we do and just try for the old CS classics. For example, here’s mergesort in C. Not guaranteed to be fool-proof, but a cursory run tells me it’s working. Leave comments if you have any corrections or tips.

The coolest thing about this is the way it finds the approximate midpoint in order to split the list into two. The loop in the mergesort function pits two pointers against each other, one twice as fast as the other (it moves ahead 2 nodes for every 1 the other does). When one reaches the end, the other is in the middle (roughly).


node *merge( node *a, node *b )
{
  if( a == NULL )
    return b;
  if( b == NULL )
    return a;
 
  node *res = NULL;
 
  if( a->data < b->data )
  {
    res = a;
    res->next = merge( a->next , b );
  }
  else
  {
    res = b;
    res->next = merge( a , b->next );
  }
  
  return res;
}
 
node *mergesort( node *head )
{
  if( head == NULL || head->next == NULL )
    return head;
 
  node *mid = head;
  node *end = head->next;
  
  while( end != NULL && end->next != NULL )
  {
    mid = mid->next;
    end = end->next->next;
  }
 
  end = mid;
  mid = mid->next;
  end->next = NULL;
 
  return merge( mergesort(head),mergesort(mid));
 
}

Price points are tricky

21Nov06 Brian

So after putting up a notice a couple weeks ago that we were going to start charging a $4.95 “setup fee” for new forums, signup requests all but disappeared. We still had a few people request it anyway without paying, and we had one single person actually send us the $5 (thanks dude!). It seems that the price point for this thing is either zero or non zero. I assume that I could charge $0.50 or $50.00 and I would get the same response, because as soon as people see that its not free, they’re gone.

Which sucks, because the only reason we instituted that was to cut down on wasteful forum sign ups and cull down the account requests to only those that were actually going to use them (instead of like the other 80% of forum requests which don’t even get installed by the requesters). Didn’t seem to work though, so I took it back down and just tried to stress more that while these things are free, it just takes up my time to set them up.

In response, we had 11 forum signups in the queue waiting on me today.

Cmon critical mass… where the hell are you.

Today was a momentous day here at blursoft. Our Google AdSense account has hit $101.84. So sometime in the next 4 to 6 weeks, Google will be cutting us a check.

Only took what, 11 months of devoting all of our free time to hacking? Not too bad. Sure I could have be slingin beans into a tortilla at Taco Bell and made 100x more money, but thats not what we’re doing all of this for, are we.


stuff we make

 

Bad Behavior has blocked 20 access attempts in the last 7 days.