Thursday, April 23, 2009

Browsing Nirvana - Achieved?

So as anyone who has worked with me since around 1995 or so knows that I am a notoriously heavy browser of the web. Since tabbed browsing came out, I have been using a complex two-level hierarchical system to manage my web pages. I'll have a window that has a general sort of topic - like maybe a web page I'm developing - plus several tabs for some php functions that I'm using or MySQL documentation or whatever. And several other windows set up similarly - sometimes 'singletons' for various links I've clicked off that people have AIM'ed or Twittered to me. The end result is I can never find anything, and when my browser crashes, I'm screwed. This is why I've been so excited about Google Chrome coming to Mac, and about Stainless browser for Mac. Which I still play with, and is getting better every week.

However, I think I've just made a change that might have switched up how I use them all. I've added a third layer of hierarchy using Fluid. Fluid lets you make little Site-Specific Browsers (SSB's) for websites you keep open all the time. They show up on the dock as separate applications with their own sets of windows. Basically indistinguishable from a regular Mac OS X application. So here's how it's made a difference for me. There are certain sites that I keep open all the time, and certain sites that I'm just browsing and not finished with (hence the window staying open). The ones that I keep open all the time I've made little SSB's for, and closed their windows within my main Safari application (Safari is today's browser of choice, I switch back and forth from Stainless lately). Now, when I'm trying to find something that's in one of my always-open applications, it shows up in the dock. I can command-tab to it. Once I'm in it, I can command-squiggle (tilde) to the correct window. Anything that isn't in one of my always-open applications is in my regular Safari, which only has 5 windows of its own to flip through.

It may sound insane, and probably is, but now that I have this new third layer of hierarchy I feel like a great weight has been lifted. Whereas before I would have to go through ruthless window-culling rampages - "Seriously, I'm not going to do anything about this thing I've been sent, I've left this window open for 3 hours, let's accept I'm going to do nothing here and close it" - now I don't need to, because I can get to everything I need. Furthermore, as a bonus (though I haven't seen it in action yet) I should have some level of crash-isolation - it should hopefully only knock down one of my SSB's, and not everything. We'll have to wait and see how that turns out to be.

I've tried Fluid before, once, and it didn't stick. This time, I still have one main problem - cookies won't pass between SSB's and/or Safari. For most people this may be okay but it's annoying for me. Not a huge deal, just annoying. The other thing I did was spend a full 30 minutes or so making sure I had identifiable icons for my SSB's - this has helped IMMENSELY. Why they haven't set up a protocol for this that just requests the icons from the websites is totally beyond me, but, whatever, I just did it and it looks...mediocre. Which is good enough for me! I even made a little icon for my own web application that I run all the time.

I shall report back with how it goes, but it really does feel like a huge weight has been lifted from my shoulders right now.

Tuesday, April 21, 2009

Rails Documentation

Is the worst fucking thing on the planet. I've actually googled for stuff, clicked on it, and gone to redirecting cybersquatter pages, it's so goddamned bad. Maybe I'm spoiled. The bulk of the professional development I've done has been with PHP, though I was pretty heavy into Perl, Tcl and other such languages at their time. Compared to any of them, Rails documentation is, hands down, the absolute worst.

Half the time I feel like they're being too goddamned clever for their own good. But the 'sensible defaults' that they espouse aren't documented anywhere, so how the hell am I supposed to know what they are? What seems sensible to me might not be sensible to you. I've found myself drilling down into source code more times than I'd like to count to try and figure out what's going on. That is total and complete fail. It's lucky that it's so powerful and cool regardless, or I would've left it in the dust a million years ago.

Maybe I have to be more...loquacious in PHP. That's fine. At least I know what to do and how to do it. 70-80% of the time I'm working in Rails, I have no friggin clue how to tell it how I want to do something. Then when I find out, it's always something like - type two magic words into the right file, then Rails reads your mind. Awesome. I just hate that sickening feeling during that not-20-to-30 percent of the time. I feel helpless.

Then when you do find documentation, it's all stories. "So here's what active record aims to do, here's different ways you can make it do things, blah blah blah." I like my programming docs terse. I look it up, it tells me what that does. But the documentation, especially, just seems all jumbled together and awful. Or the other thing I'll find is the opposite granularity - "Class Foo::Helper::Doodad::fwipple::dingus has methods 'get','put','set','be','execute'. The source code to method 'execute' is: ......." That doesn't help either. That's why it's called DOCUMENTATION. Not fucking SOURCE CODE. I feel like it's some kind of 'hipster' framework - if they actually explained it to you, and regular unhip people "got it", then the hip people would all switch to using Scala.

And, embarassingly enough, I only just 'got' the yield command in Ruby. That's just sad, man. Though I don't see the difference between a yield and an anonymous function, but I guess I'm just not that bright.

I assume it's one of those things where as soon as you buy into it 100%, completely, and spend time just soaking in it, then you'll fully understand. But I don't like having to commit to that level of buy-in. I'll continue to fiddle with it, and even choose it as a framework in whichever contexts it seems right for, but I'll always look slightly askance at it - perhaps until I've been so steeped in it that I can't look at it objectively anymore. But until then, fix your fucking docs Rails, it's horrible.

Saturday, April 04, 2009

divs vs. tables, part II - the compromise (maybe?)

<div class='tablesque'>
   <div class='rowesque'>
      <div class='cellish'>A</div>
      <div class='cellish'>B</div>
   </div>
   <div class='rowesque'>
      <div class='cellish'>C</div>
      <div class='cellish'>D</div>
   </div>
</div>
stylesheet:
.tablesque { display: table; }
.rowesque { display: table-row; }
.cellish { display: table-cell; }

There - it looks like a table, because you told it to look like a table in the CSS. But the markup doesn't say it's a table - it just says you have a hierarchy.

I sorta fell into this idea because I'm working on making a web application work for iphone or for a regular browser, and in the plain browser context I wanted something to be a table, but on the iphone, I wanted it to act more like spans and divs.

To give you an idea of what a moron I am, you should know my first idea was to have a big table, and on the iphone, do things like: display: block, display: inline, etc. But the iPhone (and even Safari on the desktop) had problems with letting me convince it to display tables as non-tables. So finally I switched it to divs, and made the regular browser side do display: table, display: table-row, display: table-cell. And that seems to work okay for now.

So, standards people, there, I'm standardy. My 'layout-like-a-table' CSS is all in the CSS. I think this CSS looks a hell of a lot prettier than the crazy 'float, clear, width, etc' routines. And it should stretch better based on its contents รก la tables.
As a bonus, within the table DOM stuff I don't have mysterious invisible 'tbody' tags that chuck themselves in my table. I lost 3 or 4 hours to that a while ago.