lazy

toshok | diabetes, geek, journal | Sunday, March 30th, 2008

I’m so glad I don’t act on half the ideas I have. If I did, not only would I get much less done on any one of them, but I also wouldn’t be pleasantly surprised often that someone had the same idea and got it to a state where I don’t have to act on it at all.

Today peter pointed me at SugarTracker

silvermandel

toshok | moonlight, mono, geek, journal | Wednesday, March 12th, 2008

Over on Steven Engelhardt’s blog there’s a mandelbrot viewer written using silverlight 1.0 (meaning just xaml + javascript). In his post he listed a few problems he had, and one caught my eye:

  • I can’t figure out how to do progressive (e.g. line-by-line) rendering to give the user feedback.

I figured this would be pretty easy with the help of setTimeout() and some more global state, so I hacked it together here. Instead of the line by line rendering I implemented a progressive jpg style interlaced rendering, with multiple passes of smaller and smaller pixels. As you can see in the demo, you can mouse over and click while it’s in the middle of rendering, and it’ll start the new render. No more waiting.

One thing he’s doing (that he notes is quite heavyweight) is using rectangles. To lessen the hit, he uses 1 rectangle for many contiguous pixels of the same color on the same line. I’d imagine using an InkPresenter and adding stylus points might be a less heavyweight approach (at least I think it will be in the case of moonlight.)

update: realized how to make mouse events faster - specify IsHitTestVisible=”false” on all the rectangles.  That way the event system doesn’t have to worry about generating enter/leave events for each scan line (and for many individual pixels on those scanlines).  And speaking of scan lines, add an translucent red indicator line that shows the next line to be drawn.  Add more precision (down to pixel_size == 1), and when we’re finished rendering, display how many rectangle children of the main canvas there are (for the first render there are over 13000.  that’s a lot of children.  moonlight seems to handle it ok too :)

last trainer test

toshok | geek, journal | Friday, March 7th, 2008

Did 50 miles on the trainer today. I started out at 160 BG, had dropped to 86 in an hour, and hovered around 90 for the 2:50 it took to complete the ride. Ended at 96.

Ate a little under 200g CHO over the course of the ride, with no insulin injected. My ratio today is pretty stupid: around 1U/47g CHO.

Anyway, I don’t think I need any further tests. Time to start riding outdoors again.

low

toshok | geek, journal | Saturday, March 1st, 2008

I woke up this morning and had a BG of 179, even with the ride yesterday and the lantus in the evening.  dawn effect and all that, I’m sure.  I ate two bowls of cheerios and injected enough to cover the meal and correct for the high.  I give myself more than 1U/25g in the morning, so 2 bowls of cheerios rates at between 2.5 and 3U.  my correction factor is 1U/75, so I gave myself 3.5 units (which should have left me around 100), ate my breakfast, drank my coffee, and started cleaning house.

About an hour and a half later I was feeling kinda funky so I checked again.  58.

So, I ate a glucose tab and a couple more bowls of cereal.  And now, 20 minutes later as my blood sugar climbs out of the toilet (it’s at 71 now) I feel like utter crap.  Palms are sweaty and fingers are shaking bad enough that it’s hard to type.  Heart is racing, balance is shot, and I can’t focus on anything.

It’s weird.  at 70 (or even 80) are start feeling shaky and get sweaty palms.  At 58 I feel fine.  I feel kinda spacey, sure, but I can push through it if I’m focusing on something (like cleaning the house).  If I hadn’t had a momentary pause to think of what to clean next, I wouldn’t have noticed how weird I felt.

I bet at 40 I’d feel fantastic.  I wonder if it’s an asymptotic approach to peace, getting closer and closer until you finally kick off.  Scary.

windowless moonlight

toshok | moonlight, mono, geek, journal | Tuesday, February 26th, 2008

A little while ago I committed the first ugly pass at windowless support in moonlight. By ugly I just mean I cut corners wherever I could, just to get it working. The changes to support both windowed and windowless modes, with events coming in as either GdkEvents or Xlib events.. well, they’re a little gross :) but we’ll get them refactored and beautified soon enough.

On to the goods.

Silverlight 1.0 has no built-in text input support, so the conventional wisdom says “use windowless mode, and use an overlayed html form element to allow input.” Many sites use this, such as the weatherwidget:

The vista simulator (which is a pretty crazy body of code. *Tons* of javascript, and an architecture that leads me to believe it wasn’t originally intended for silverlight) uses windowless mode for another reason. It doesn’t hook up events handlers to any of the xaml elements. Instead, it adds JS event handlers to the <object> tag that surrounds the plugin. Since there are no event handlers in the plugin, we return FALSE to signal we didn’t handle the event, which bubbles up the dom hierarchy to the object.

You need svn HEAD of the moonlight code for this to work, and you also need to run it against a build of firefox3.  Unfortunately, given our use of unfrozen apis for dealing with the dom element reflection into managed code, you’ll more than likely run up against undefined C++ symbols for pages that do that sort of thing.  But there are a number of sites which don’t.  So give it a try :)

Next Page »

Powered by WordPress | Theme by Roy Tanck