workin’ nine to five
I’ve switched to a more “normal” 9-5 work routine, instead of the usual 7:30-4 routine I had before. I guess that leaving at 4pm makes me look like a slacker maybe.
I have no idea why so many people work a 9-5 shift. I mean, when I walk to/from work at 6:30am or 4pm, there is no fanfare – I get to /enjoy/ my walk and think about things as I walk.
If I leave at 8am/5pm, though, I can’t think clearly, as I am surrounded by cars and people.
I think it’s quite funny really, to see people navigate through towns in cars. An example in case: my boss gave me a lift part of the way home. I got out in Monaghan town. He asked me to post some letters while I was there. It took about ten minutes to go to the post office, post the letters, then walk along my route until I got to the cross-roads by Dunnes Stores, where I overtook my boss who was still driving through town. Hilarious!
On the KFM side of things, I’ve slowed down substantially, as my daughter demands quite a bit of time (I got home yesterday – me: “hi”, Jareth: “mm!”, Boann: “wah!”, Brownyn: “here you go. take her”).
I’m working on a small problem at the moment, which I’m taking my time over. The problem is that “:hover”, the CSS selector which allows you to style the element that the mouse is over, does nothing if the mouse is dragging when it enters the element.
The obvious and computationally expensive solution is to check each element whenever the mouse moves, to see if the mouse has entered it.
I’m mentally constructing a more efficient method, but it will take a little time to come out of my head (I’m not concentrating on it fully – got other stuff to do).
What I have so far, though, is:
- action: mouse moves, calls function
getContainer(mouse_position, elements_to _check, clear_afterwards)
- get cached array of elements to check
- if no cache exists, create it, populating it with every element that needs checking
- check through list of elements to see if mouse is contained in them. if so:
clear_afterwards is set, clear the cache
- return the element
- if the number of elements is greater than 2, try to group elements that are in the same area together in an object (this bit is tricky) and edit the cache accordingly
- return null
The part that I’m mulling over is the bit marked “this bit is tricky”.
The idea is that if you have four objects with positions and widths,
a[0,0,1,1], b[4,0,1,1], c[0,1,1,1], d[4,4,1,1], the element check could be reduced a bit by creating new container objects
e, f containing the first four, geographically segregated:
With the above, the position check would be vastly quicker, when huge numbers of elements are checked, especially if the segregation is recursive; ie, each container object contains sub-containers, etc, until no container contains more than two objects/elements.
I think you can see why I think this is tricky writing the position-checking algorithm is very simple, but deciding how which elements get segregated from which others is complex.
Maybe this has been solved before by other people? I don’t know. I’ll check my Bumper Book Of Algorithms when I get home.
oh – here’s one: why is it that you get a voltage difference when you measure both sides of the same battery, but not if you measure the plus of one battery versus the negative of another? In other words, if one side of the battery is like a tower of water, and the other is like an empty hole, then why do the electrons prefer one hole over the other?
nyeh, I say. nyeh.