<?xml version='1.0' encoding='utf-8' ?>
<!--  If you are running a bot please visit this policy page outlining rules you must respect. http://www.livejournal.com/bots/  -->
<rss version='2.0' xmlns:lj='http://www.livejournal.org/rss/lj/1.0/' xmlns:media='http://search.yahoo.com/mrss/' xmlns:atom10='http://www.w3.org/2005/Atom'>
<channel>
  <title>Journal de Jamber</title>
  <link>http://draci.livejournal.com/</link>
  <description>Journal de Jamber - LiveJournal.com</description>
  <lastBuildDate>Sun, 11 Feb 2007 17:21:44 GMT</lastBuildDate>
  <generator>LiveJournal / LiveJournal.com</generator>
  <lj:journal>draci</lj:journal>
  <lj:journalid>287765</lj:journalid>
  <lj:journaltype>personal</lj:journaltype>
  <atom10:link rel='hub' href='http://pubsubhubbub.appspot.com/' />
  <image>
    <url>http://l-userpic.livejournal.com/48550059/287765</url>
    <title>Journal de Jamber</title>
    <link>http://draci.livejournal.com/</link>
    <width>100</width>
    <height>100</height>
  </image>

<item>
  <guid isPermaLink='true'>http://draci.livejournal.com/70331.html</guid>
  <pubDate>Sun, 11 Feb 2007 17:21:44 GMT</pubDate>
  <title>Meh browsers..</title>
  <link>http://draci.livejournal.com/70331.html</link>
  <description>&lt;em&gt;Opera sez: You are about to open 71 bookmarks. Wtf, foo&apos;? [Y/Ack,NNN!]&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;I love little things like this. They are proof of real thought going into a program, and a suggestion they might have even done that elusive thing, user testing. This is not the first time I&apos;ve slipped with the mouse, and doing so in Firefox or in explorer can be deadly.&lt;br /&gt;&lt;br /&gt;I loathe to say it--but I actually am getting really sick of FF. It&apos;s great for all the cool plugins, and for web dev. But the trouble is all the &quot;browser logic&quot; is Javascript... and sluggish JS for me at that. You know the feeling you get running .NET or Java apps? You can TELL it&apos;s not native code. By the time I add all my favorite extensions, it gets two or three times worse.&lt;br /&gt;&lt;br /&gt;And to top it off, I recently upgraded to FF2.  Instead of just hanging for 2-3 seconds on a page load, it locks my system too. That &quot;I&apos;m pushing 50MB through the swapfile&quot; sorta freeze, nevermind I have plenty of RAM. Obviously this brings it from &quot;maddening&quot; to &quot;unusable.&quot;&lt;br /&gt;&lt;br /&gt;I was pleased to find that Opera offers a lot of the same features, even down to my favored window layout, so I think I will try that out for awhile. It&apos;s definitely not as fast as IE6 (they have a silly theme engine too, and do too much graphics buffering), but it isn&apos;t jamming up.</description>
  <comments>http://draci.livejournal.com/70331.html</comments>
  <lj:mood>disappointed</lj:mood>
  <lj:security>public</lj:security>
  <lj:reply-count>2</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://draci.livejournal.com/69970.html</guid>
  <pubDate>Sun, 28 Jan 2007 23:52:39 GMT</pubDate>
  <title>Momentarily outwitted</title>
  <link>http://draci.livejournal.com/69970.html</link>
  <description>&lt;p&gt;My code—or rather&amp;nbsp;my bugs, you could say—have&amp;nbsp;apparently been trying to make an&amp;nbsp;artistic statement.&lt;/p&gt; &lt;p&gt;&lt;a href=&quot;http://pics.livejournal.com/draci/pic/0003xyp4&quot; atomicselection=&quot;true&quot;&gt;&lt;img height=&quot;165&quot; src=&quot;http://pics.livejournal.com/draci/pic/0003wtyg&quot; width=&quot;264&quot;&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;No comment, except... I think&amp;nbsp;they succeeded. o..o&lt;/p&gt;</description>
  <comments>http://draci.livejournal.com/69970.html</comments>
  <lj:security>public</lj:security>
  <lj:reply-count>3</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://draci.livejournal.com/69649.html</guid>
  <pubDate>Sun, 07 Jan 2007 21:07:11 GMT</pubDate>
  <title>Parents and the search for advice</title>
  <link>http://draci.livejournal.com/69649.html</link>
  <description>Very paraphrased and condensed, but this is what I heard (not specifically the words we said, but what I got out of it):&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Me:&lt;/strong&gt; Okay, I hate these things (rant rant rant). ALL the interview advice I&apos;ve ever seen or heard assumes I&apos;m perfect, which is ridiculous. They also say the questions are very specific and nonintuitive &lt;em&gt;[ed: for ex, &quot;tell me about yourself?&quot;]&lt;/em&gt;. But here&apos;s an example that crops up in just about every job interview. What do I say if they ask about X? I know next to nothing about X. If I tell the truth I&apos;m certainly not going to get the job.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Parent:&lt;/strong&gt; You&apos;ll learn as you go through them. They&apos;re not manipulative and prejudgemental. Stop looking for advice and just try it, figure it out yourself, be honest. I had to, what&apos;s your problem? By the way, you had plenty of time to learn about X in school so what are you complaining about? &lt;em&gt;[ed2: fine, but you know the circumstances almost as well as I do, and wherever the problem lies&amp;mdash;the fact is I didn&apos;t pick it up, whining about the past is a waste of time, and I need help &lt;em&gt;now&lt;/em&gt;, not another slap in the face, okay?]&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;I think from one angle, this sums up a lot of my problems.&lt;br /&gt;(This is also why I don&apos;t usually ask for help.)&lt;br /&gt;&lt;br /&gt;Ignoring the serious issue of not having enough sleep all month, and really only being able to sleep well in the &lt;em&gt;daytime&lt;/em&gt;, what am I supposed to do? I need some hard answers here and she just won&apos;t give me any. I honestly don&apos;t think she KNOWS outside her limited experience, but I wish she would at least consider my feelings... -..-;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;[Ed3: She says I don&apos;t express them. Well, the same could be said of her, and her husband. Some of this comes down to him, and some of it comes down to being convinced/terrified of rejection were I to share my identity. In the end, metaphorically speaking, none of us are getting comfort or hugs. So it should make more sense I stay upset about everything, having noone to go to. That is one of my biggest problems, and needing work falls out of that, in a catch-22 sort of fashion. I hope I can work something out with the counsellor eventually.&lt;br /&gt;&lt;br /&gt;I suppose one could argue against putting this stuff in a public post. Well, soddit. It kinna stops being private when it affects me, and (rather indirectly) some of my friends. Nor am I ashamed to have problems. I need an outlet and a place to keep track of my thoughts, and the feedback might be helpful.&lt;br /&gt;&lt;br /&gt;And I think most of my friends list knows better than to judge everything from a few sparse LJ entries. This is, after all, spur of the moment and colored by mood, not an impartial biography. Disclaimer off.]&lt;/em&gt;</description>
  <comments>http://draci.livejournal.com/69649.html</comments>
  <lj:mood>rejected</lj:mood>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://draci.livejournal.com/69618.html</guid>
  <pubDate>Sat, 30 Dec 2006 04:54:12 GMT</pubDate>
  <title>Dracus has shiny! (+ friend codes)</title>
  <link>http://draci.livejournal.com/69618.html</link>
  <description>Well, amongst smaller things, I requested (and got) a DS lite over Christmas. This should be no surprise to anybody, what with the supplied Pointy Thing and all the talk of touching... gah! Nintendo is &lt;em&gt;so&lt;/em&gt; flaming gay now. AC is proof enough of that...&lt;br /&gt;&lt;br /&gt;Which is probably exactly why I&apos;m pleased, thus far.&lt;br /&gt;&lt;br /&gt;(See, all you teen gamers? The lesson is, don&apos;t make fun of the artsy folks. If you do, their revenge will be a series of games focused on coffee shops, mortgage payments, gardening and interior design! See: The Sims, Sims 2, Second Life&amp;mdash;okay it&apos;s not a majority but JUST YOU WAIT!)&lt;br /&gt;&lt;br /&gt;Well seriously, the whole thing is better built than the $400+ PDA I got a few years ago, and it has smexier hardware too. I&apos;m definitely gonna order a key and a media adapter and see what I can do.. The SC has 32MB (!) of RAM in it, and reads nice large SD cards, which should be more than enough to run things like an organizer, MP3 player or a port of Gaim. I don&apos;t think there&apos;s a compelling browser yet, but I don&apos;t really need to squint at LJ either...&lt;br /&gt;&lt;br /&gt;Anyway!&amp;mdash;&lt;table&gt;&lt;tr&gt;&lt;td&gt;Mario Kart DS&lt;/td&gt;&lt;td&gt;060217 402007&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Animal Crossing WW&lt;/td&gt;&lt;td&gt;4811-2421-4391&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;M&apos;still figuring out how all this stuff works, and the wireless doesn&apos;t reach too well upstairs. But hey, someone might be interested?</description>
  <comments>http://draci.livejournal.com/69618.html</comments>
  <lj:mood>sleepy</lj:mood>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://draci.livejournal.com/69136.html</guid>
  <pubDate>Sat, 02 Dec 2006 02:03:38 GMT</pubDate>
  <title>Brrrr!</title>
  <link>http://draci.livejournal.com/69136.html</link>
  <description>See also, &lt;a href=&quot;http://pics.livejournal.com/draci/gallery/0000g6gr&quot;&gt;visuals&lt;/a&gt;.</description>
  <comments>http://draci.livejournal.com/69136.html</comments>
  <lj:mood>cold</lj:mood>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://draci.livejournal.com/68977.html</guid>
  <pubDate>Sun, 26 Nov 2006 16:36:23 GMT</pubDate>
  <title>Dream distraction</title>
  <link>http://draci.livejournal.com/68977.html</link>
  <description>Last night I dreamt about little subworlds. There was one peculiar thing about them&amp;mdash;they had more &quot;there&quot; there. What I mean is, if you did a quarter turn four times, as measured by a house wall for example, you wound up looking down a fifth hallway. Indeed, outside, the square buildings were five-sided.&lt;br /&gt;&lt;br /&gt;Some guy had set them up and was showing people around. It was a subtle thing you tended not to notice for a minute, until you got lost. Also, one of them had a society living there that seemed under threat somehow&amp;mdash;unsure whether it was meant to be real or fictional. (Insert lots of colors and details that probably made more sense at the time.)&lt;br /&gt;&lt;br /&gt;My geography and chemistry teachers also made reappearances, doing catchy presentations ala Bill Nye on things I can&apos;t quite remember.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Ed note:&lt;/em&gt; Google says this is called hyperbolic space. And in fact it is very easy to get lost, because instead of having cubic amounts of &quot;here and there&quot; in an increasing radius, it&apos;s exponential! I feel sorry for the search teams, don&apos;t you?&lt;br /&gt;&lt;br /&gt;Unfortunately I knew about that before my dream did. But I love the notion of quaint old houses and school buses and green fields pulling these tricks.</description>
  <comments>http://draci.livejournal.com/68977.html</comments>
  <lj:mood>sleepy</lj:mood>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://draci.livejournal.com/68853.html</guid>
  <pubDate>Thu, 23 Nov 2006 06:59:19 GMT</pubDate>
  <title>State of things</title>
  <link>http://draci.livejournal.com/68853.html</link>
  <description>Hurrrrrgh. What a morbid night.&lt;br /&gt;&lt;br /&gt;Actually it hasn&apos;t been that great a year, either. Besides that nothing much has happened, this is another reason I haven&apos;t been posting much. I hate to write despairing entries. I just feel like I&apos;m guilt-tripping the one or two people who probably still read this. And it feels like needless brooding. (Then again, I&apos;ve been sort-of brooding on and off all year, I&apos;m just used to it.)&lt;br /&gt;&lt;br /&gt;That nothing has happened is exactly the problem. Abstaining from LJ was in retrospect probably a mistake&amp;mdash;it just leaves the days free reign to blur together. More like weeks and months, now. And as a result I haven&apos;t given more than token thought to where I&apos;m going.&lt;br /&gt;&lt;br /&gt;Not that I would necessarily remember if I did. I&apos;m horrible at organization and goals. I can&apos;t even get my damn feelings set on one. They&apos;re always shifting, it seems.&lt;br /&gt;&lt;br /&gt;The glasses are amazing, though. I can&apos;t help looking back. This is the first real sign of aging and the notion that, if these last three or four years went so much faster than the three before that, my time is running out faster than I thought. I can&apos;t stay here too much longer...&lt;br /&gt;&lt;br /&gt;Of course, now I feel I have nowhere to go. It quite frankly scares me to think I logged onto Chaotic almost &lt;em&gt;nine years&lt;/em&gt; ago, because I know I&apos;m not the same person today, because I fear I&apos;m losing important parts of myself I gained there...&lt;br /&gt;&lt;br /&gt;I don&apos;t think I even know who my friends there have become anymore, because virtually all I ever see of them is LJ. Though I hesitate to say anything, I find it rather painful to hear about them now. It makes me wonder why I&apos;m not over there, with them, what I&apos;m doing wrong, what I should be doing, if I even belong anywhere anymore. And I wonder how well they remember &lt;em&gt;me&lt;/em&gt;...&lt;br /&gt;&lt;br /&gt;Everyone makes it look so easy, and I don&apos;t even know where to start.&lt;br /&gt;&lt;br /&gt;I did start volunteering at the library. It probably says a lot about the situation&amp;mdash;that I&apos;m only too eager to get out of the house, because that&apos;s pretty much why. I&apos;m willing to work for free just to get away from my parents. Well, I&apos;m sure the library folks appreciate the help too, which is some small consolation. Better to be wanted somewhere...&lt;br /&gt;&lt;br /&gt;Which I&apos;m sure will sound like typical teenage emo, but I&apos;m not sure how else I&apos;m supposed to feel. &lt;br /&gt;&lt;br /&gt;Consider that my father-if-you-can-call-him-that hasn&apos;t even &lt;em&gt;tried&lt;/em&gt; to talk to me in months, and hasn&apos;t made reasonable effort in years... the idiot somehow manages to get promoted to a job in the Pentagon, and he can&apos;t even apologize to his own son! Or at least openly refuse to change. At least then he&apos;d be showing a spine. But he acts like the silence is normal, and/or he just doesn&apos;t care.&lt;br /&gt;&lt;br /&gt;Consider that I couldn&apos;t truly talk to my mother if I wanted to. I hear no fondness in her voice; if the conversation ever drifts to my future, something I avoid, it will inevitably turn into a rant on her part on how much money they spend, how I need a job but apparently can&apos;t work, and any amount of hurtful venting that just ends in an argument. (While it&apos;s partly a matter of opinion, don&apos;t even get me started about what they spend it on. :P)&lt;br /&gt;&lt;br /&gt;Still, being starved, I wind up talking to her anyway. Way more than I wish I did. But it&apos;s hard to engage her in intelligent conversation. Whether it&apos;s art, computers, politics... I feel like I&apos;m talking to a wall. This might not be intentional on her part, as she hates reading and avoids anything but the tv and the newspaper... but the effect is the same. I can see now why she responded the way she did when I tried to come out many moons ago. This alone is bad enough; it makes me feel ignored at best, rejected at worst.&lt;br /&gt;&lt;br /&gt;I&apos;m already 23, so I guess everyone thinks I should be self-sufficient or something, but no. I wish I knew what to do. The parents&amp;mdash;well, parent&amp;mdash;aren&apos;t making me leave. They hardly ask me to cook, they don&apos;t ask me to clean, my rooms aside (though sometimes out of sheer boredom I do it anyway).. I&apos;ve been here so long I&apos;m afraid to leave the house without them, yet I&apos;m excruciatingly lonely in a twisted way that makes me feel a bother to anyone online...&lt;br /&gt;&lt;br /&gt;So I don&apos;t try to talk much over IMs. Quite a few I&apos;ve met there seem to want snuggle (among other things) instead of conversation as it is. I never really figured out why, but it just makes me feel worse.&lt;br /&gt;&lt;br /&gt;I&apos;m afraid of a lot of things. I&apos;m afraid of the freaking cat dying. I&apos;m.. well, not as much afraid of art or coding anymore, moreso because I&apos;m finding it harder and harder to care. I have nobody around here to appreciate it, even myself for very long it seems... since there&apos;s no way I&apos;m displaying all of it in here, with the parents around. And nobody to talk or compete with about it, which is one of the best things...&lt;br /&gt;&lt;br /&gt;Well, I guess it&apos;s Thanksgiving. Quite an ironic time for such a post. I&apos;m sure there&apos;s someone to thank (indeed some of them already have been)... erf. But it doesn&apos;t change the situation as is.&lt;br /&gt;&lt;br /&gt;I&apos;m off to brush and sleep, so I can go try and get up and bake a pie before the turkey goes in. I can at least enjoy the cooking, if not so much the company... -..-;</description>
  <comments>http://draci.livejournal.com/68853.html</comments>
  <lj:mood>distressed</lj:mood>
  <lj:security>public</lj:security>
  <lj:reply-count>1</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://draci.livejournal.com/68455.html</guid>
  <pubDate>Wed, 22 Nov 2006 01:07:56 GMT</pubDate>
  <title>Code omens...</title>
  <link>http://draci.livejournal.com/68455.html</link>
  <description>&lt;pre&gt;template&amp;lt;&amp;gt; struct promote&amp;lt;byte, unsigned &lt;strong&gt;shirt&lt;/strong&gt;&amp;gt; { ... }&lt;/pre&gt;Hmm, might be enough coding for today. You know&amp;mdash;first it&apos;s &lt;tt&gt;shirt&lt;/tt&gt;s, next thing it&apos;ll be &lt;tt&gt;volatile unsigned dryer lint&lt;/tt&gt;. Then I&apos;ll be casting off &lt;tt&gt;box&amp;lt;short&amp;gt;&lt;/tt&gt;s and &lt;tt&gt;long&lt;/tt&gt; johns; and destructing &lt;tt&gt;Tokyo()&lt;/tt&gt;.&lt;br /&gt;&lt;br /&gt;A purely &lt;tt&gt;virtual&lt;/tt&gt; notion I&apos;m sure, but you just can&apos;t be too careful...</description>
  <comments>http://draci.livejournal.com/68455.html</comments>
  <lj:mood>weird</lj:mood>
  <lj:security>public</lj:security>
  <lj:reply-count>1</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://draci.livejournal.com/68209.html</guid>
  <pubDate>Tue, 21 Nov 2006 17:09:09 GMT</pubDate>
  <title>Mysterious Eastern Coily ThingTM Brand Levitation</title>
  <link>http://draci.livejournal.com/68209.html</link>
  <description>Nothing much up, really. &lt;em&gt;[Ed: Except a proper Jamber post. OMG, the world ends.]&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;I did get computer components, unfortunately not the upgrade I would have liked though. They work, for now. Still need a USB2/FW card for the hard drive. Didn&apos;t realise how slow USB1 is.&lt;br /&gt;&lt;br /&gt;The pumpkin fuzzed up before I settled on what to carve, so all I got were seeds out of it. I don&apos;t feel that inclined to do &lt;a href=&quot;http://www.nanowrimo.org/&quot;&gt;NaNoWriMo&lt;/a&gt; either, no matter how cool it is. I guess that&apos;s the caveat of too many latent hobbies.&lt;br /&gt;&lt;br /&gt;The parent took me for an eye exam last week, since they&apos;d been paying the health plan and simply forgot to take me the past couple years. Turns out my eyes have, to put it politely, &quot;aged&quot; slightly during that time (betrayal! BETRAYAL!), and that this vaguest of groggy haze I&apos;ve been walking through has less to do with grog (or various bits of TMI ;p) than I&apos;d thought. The glasses aren&apos;t desparately needed by any means, but they make things interestingly more pleasant in some ways.&lt;br /&gt;&lt;br /&gt;At first I felt like I was walking around Second Life with all the hawk-sharp edges. (Well, not SL, but certainly something with an actual framerate. You know what I mean.)&lt;br /&gt;&lt;br /&gt;Speaking of SL, I remain simultaneously irked and &quot;ooh! shiny art-things!&quot; with it. In particular, making avatars is just too damn hard. But! I have partly deciphered the avatar model, and I&apos;m looking at ways to make av creation easier.. especially getting a good preview without spending a bundle on L$ or just living with the flaws. This is sommat an issue for free accounts, and even more an issue for less average shapes, as I am.&lt;br /&gt;&lt;br /&gt;I still keep putting off art, and art posts. I&apos;m sure I could dig up something, but.. meh. I could rather use the encouragement, and more artist-friends, it&apos;s boring drawing alone.&lt;br /&gt;&lt;br /&gt;This morning&apos;s dreaming consisted of a lot of tangentially related things, including but not limited to:&lt;br /&gt;&lt;br /&gt;* Drawing eyes with Mysterious Eastern Coily Thing&lt;sup&gt;TM&lt;/sup&gt; Brand Levitation*;&lt;br /&gt;* Large crowds;&lt;br /&gt;* Boring trips to the relatives&apos; retirement home;&lt;br /&gt;* Stumbling on a presidential speech by the Shrub;&lt;br /&gt;* Being suddenly embarrassed because I was prancing and rolling about in the grass at the time, and I hear you can be apprehended as a terrorist simply for having &lt;em&gt;fun&lt;/em&gt; these days;&lt;br /&gt;* Pretty sunsets wherein in its haste, the sun forgets to hide first, and turns into the moon as it rushes to set;&lt;br /&gt;* Forgetting my camera, erf;&lt;br /&gt;* Finding some old fart&apos;s camera, thinking it was ours, then putting it down, which leads to..&lt;br /&gt;* My getting framed (cue cryptic SL name/group title that isn&apos;t mine) and subsequently descended up upon by a throng of 400lb, presumably rival, gang members.&lt;br /&gt;&lt;br /&gt;Unfortunately I woke up before I had the sense to cook and eat them all. Damn this dream-self.&lt;br /&gt;&lt;br /&gt;About the Mysterious Eastern Coily Thing&lt;sup&gt;TM&lt;/sup&gt; Brand Levitation: It&apos;s kinda weird.&lt;br /&gt;&lt;br /&gt;Way back while hop-skipping across the playgrounds of yesteryear, I never quite managed to defy gravity. But inexplicably, in my dreams gravity is sometimes more tenuous. I find I can often glide a few yards before settling back down. It&apos;s a bit (only a bit) like &lt;a href=&quot;http://agtp.romhack.net/doukutsu.html&quot;&gt;Cave Story&lt;/a&gt; &lt;span style=&quot;font-size: 1pt;&quot;&gt;&amp;lt;= go play this now :3&lt;/span&gt;, or Yoshi&apos;s Island without all the squinting and wriggling. Another thing that feels oddly natural by the way&amp;mdash;despite my incongruous human sensory map&amp;mdash;is galloping.&lt;br /&gt;&lt;br /&gt;This time I nailed it, and settled into a steady state a few inches off the floor, drifting around the crowds.&lt;br /&gt;&lt;br /&gt;Which really only helps my impression that porky though Jamber is, he is as much a Coily Dragon as one of the Wing-a-Lings.</description>
  <comments>http://draci.livejournal.com/68209.html</comments>
  <lj:mood>awake</lj:mood>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://draci.livejournal.com/67924.html</guid>
  <pubDate>Wed, 04 Oct 2006 03:08:53 GMT</pubDate>
  <title>Syntax, mark two</title>
  <link>http://draci.livejournal.com/67924.html</link>
  <description>I wish I could write in two or three languages at once. Witness the following hypothetical example which might be used to disassemble machine code:&lt;br /&gt;&lt;pre&gt;(decoderGroup new: `x86ArithmeticRegOps
    memberWhen:   `($code[0]  ~ @00??????
                 &amp;&amp; $code[0] !~ @00????11)
    memberIndex:  `($code[0] takeBits: %00111000)
    members:      [ADD OR ADC SBB AND SUB XOR CMP]
    details:      [
        `(if `($code[0] ~ @???????1)
            ($dataSize = [32 16] choose:
                (bits16 in $cpuMode
                    ^^ toggleSize in $prefixes))
            ($dataSize = 8)
            )
        `($args = ($code[0] takeBits: %00000110)
            selectFrom: [
                (ModRMArgs bytes: code[1..] dest: regOrMem  src: reg)
                (ModRMArgs bytes: code[1..] dest: reg       src: regOrMem)
                (ImmedArgs bytes: code[1..] dest:
                    ([8:regAL 16:regAX 32:regEAX]
                        choose: $dataSize))
            ])
    ])&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;a name=&quot;cutid1&quot;&gt;&lt;/a&gt;Now compare with the Pascal I&apos;d prolly have to write:&lt;br /&gt;&lt;pre&gt;type TX86ArithRegOpDecoder = class(TX86Decoder)
public
    function TryDecode(codes: String): TX86Instruction; override;
end;

function TX86ArithRegOpDecoder.TryDecode(codes: String): TX86Instruction;
const arithOps: array[0..7] of TX86Operation = (
    xopADD, xopOR, xopADC, xopSBB, xopAND, xopSUB, xopXOR, xopCMP
    );
begin
    Result := nil;
    if not ($00 &amp;lt;&amp;gt; codes[1] and $c0) or ($03 = codes[1] and $c3)
        then Exit;

    Result := TX86Instruction.Create;
    with Result do begin
        oper := arithOps[codes[1] shr 3 and 7];

        if $00 = codes[1] and $01
            then dataSize := 8
            else if Boolean(Integer(bits16 in cpuMode)
                            xor Integer(toggleSize in prefixes))
                then dataSize := 16
                else dataSize := 32;

        case codes[1] and $06 of
        $00: args := TX86ModRMArgs.Create(codes, argRegOrMem, argReg)
        $02: args := TX86ModRMArgs.Create(codes, argReg, argRegOrMem)
        $04: begin
            case Result.dataSize of
             8: args := TX86ImmedArgs.Create(codes, argAL);
            16: args := TX86ImmedArgs.Create(codes, argAX);
            32: args := TX86ImmedArgs.Create(codes, argEAX);
            end;
          end;
        end;
    end;
end;&lt;/pre&gt;&lt;br /&gt;Uhhhhh... yeah.&lt;br /&gt;&lt;br /&gt;This sort of want happens to me a lot. Can you count how many languages I&apos;ve plagiarised? How about the number of features missing from C++ or Delphi?&lt;br /&gt;&lt;br /&gt;Myself, I see a little Smalltalk, Lisp, C++, even Perl and (oh gods) INTERCAL. There are literal lists, tri-valued booleans, hashes, class fields, and closures with named parameters.&lt;br /&gt;&lt;br /&gt;I know people are going to tell me, &apos;learn LISP.&apos; And I would agree, but there needs to be an infix   expression syntax for numerical work. Haskell is interesting that way, as it sort of has both. &lt;br /&gt;&lt;br /&gt;The lack of closures alone pains me so much, I can&apos;t imagine why anyone would leave them out! I love them in JavaScript. JS also has some great LISPy structured literals. These really should be a standard language feature--literal code, structures, and arrays, just like literal numbers or strings.&lt;br /&gt;&lt;br /&gt;I don&apos;t know there&apos;s any language that does what I want. That&apos;s the thing... they all have different strengths. It would be great to be able to use the right syntax/structure for the right problem.&lt;br /&gt;&lt;br /&gt;Hurrrf. Guess I&apos;ll be expecting that right around the time programmers stop treating language and technique as religion...</description>
  <comments>http://draci.livejournal.com/67924.html</comments>
  <lj:music>Super Mario 64 - Snow Mountain</lj:music>
  <media:title type="plain">Super Mario 64 - Snow Mountain</media:title>
  <lj:mood>confused</lj:mood>
  <lj:security>public</lj:security>
  <lj:reply-count>1</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://draci.livejournal.com/67511.html</guid>
  <pubDate>Mon, 18 Sep 2006 01:34:32 GMT</pubDate>
  <title>Not quite C++</title>
  <link>http://draci.livejournal.com/67511.html</link>
  <description>&lt;p&gt;I thought I&apos;d try the Visual .NET Forms stuff in MSVC++ 2005. I hoped I could get a decent GUI up and keep the rest of my code as clean, platform-independent C++.

&lt;p&gt;Maybe I&apos;m just stupid, but this is the simplest way I could find to get a std::wstring path out of an explorer icon dragged atop the form:

&lt;pre&gt;System::Void MainWin_DragDrop(
    System::Object^ sender,
    System::Windows::Forms::DragEventArgs^ e
) {
    array&amp;lt;String^&amp;gt;^ dropList =
        dynamic_cast&amp;lt;array&amp;lt;String^&amp;gt;^&amp;gt;(
            e-&amp;gt;Data-&amp;gt;GetData( DataFormats::FileDrop ));
    
    String^         filePathCLR = dropList[0];
    std::wstring    filePathSTL;
    	 
    // &quot;Obvious&quot; method
    //for each( wchar_t c in filePathCLR )
    //	filePathSTL.push_back(c);
    
    // Suggested method (MSVC documentation... srsly)
    using namespace Runtime::InteropServices;
    const wchar_t* filePathRaw = (wchar_t*)(
        (Marshal::StringToHGlobalUni( filePathCLR )).ToPointer()
    );
    filePathSTL = filePathRaw;
    Marshal::FreeHGlobal(IntPtr( (void*)filePathRaw ));
    
    m_MyObj = new SomeDocumentObject(filePathSTL);
    // ...
}&lt;/pre&gt;

&lt;p&gt;There are several interesting things to be seen here. I&apos;m not sure what to think of them.

&lt;p&gt;For one thing, this isn&apos;t even C++! They&apos;ve added a whole chunk of C# as completely new syntax. Seen here are the ^ which is their garbage-collected heap pointer, &lt;em&gt;array&lt;/em&gt; (which is a keyword and derives from System::Array), and a few bits of their class library. Also notice the &lt;em&gt;for each&lt;/em&gt;, where &lt;em&gt;each&lt;/em&gt; and &lt;em&gt;in&lt;/em&gt; are context-sensitive (!!) as keywords.

&lt;p&gt;Oh, and don&apos;t even get me started on the freaking casts.

&lt;p&gt;This syntax is completely required. The form designer generates it, and their library depends on the special references. That&apos;s because if you compile in &quot;safe&quot; mode, hoping to run under someone&apos;s tight security policy (and they encourage you to)... pointers aren&apos;t even allowed!

&lt;p&gt;Naturally, this breaks just about every useful piece of C and C++ out there, including the all-important STL which sets C++ apart. While I understand the security motivation, I think this is misleading on MS&apos;s part, since at that point, it&apos;s not C++ anymore! It&apos;s just another dialect of C#, or maybe C# with templates. :/

&lt;p&gt;I could simply compile in &quot;pure&quot; mode (effectively, insecure bytecode), and use the STL with the bureaucracy above, but it&apos;s still annoying. Mmmfeh.</description>
  <comments>http://draci.livejournal.com/67511.html</comments>
  <lj:music>Pixel - Cave Story - On to Grasstown</lj:music>
  <media:title type="plain">Pixel - Cave Story - On to Grasstown</media:title>
  <lj:mood>surprised</lj:mood>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://draci.livejournal.com/67156.html</guid>
  <pubDate>Wed, 13 Sep 2006 00:08:05 GMT</pubDate>
  <title>Too smart for me</title>
  <link>http://draci.livejournal.com/67156.html</link>
  <description>&lt;p&gt;So tonight, I was perusing some annoyingly table-y tech reference, and I wondered if it was feasible to print this out, four pages to a double-sided letter sheet, and bind it into bookish form. To my surprise, OpenOffice actually has some basic stuff documented, and I was able to get proper page headering and left/right page margins.&lt;/p&gt; &lt;p&gt;Time to print!&amp;nbsp;I checked the &lt;a href=&quot;http://www.mothteeth.com/bookmaking/calculator/&quot;&gt;Bookbinding Page Calculator&lt;/a&gt;, and got the following 2-up page orderings:&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;&lt;em&gt;Front:&lt;/em&gt; 32,1,30,3,28,5,26,7,24,9,22,11,20,13,18,15,&lt;br&gt;1,33,1,35,1,37,1,39,1,41,54,43,52,45,50,47&lt;br&gt;&lt;em&gt;Back:&lt;/em&gt; 2,31,4,29,6,27,8,25,10,23,12,21,14,19,16,17,&lt;br&gt;34,1,36,1,38,1,40,1,42,55,44,53,46,51,48,49&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;Feeling wary, I tried this first with the excellent &lt;a href=&quot;http://www.pdfforge.org/products/pdfcreator&quot;&gt;PDFCreator&lt;/a&gt;. And fortunately so--can you&amp;nbsp;guess what I got? Why, yes...!&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;1,3,5,7,9,11,13,15,18,20,22,24,26,28,30,32,33,35,37,39,41,43,45,47,50,52,54&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;So apparently some programmer thought he was ZOMG CLEVER!!@ and decided to &quot;helpfully&quot; union and sort the list. Except&amp;nbsp;(nevermind,&amp;nbsp;I think, that MS Word doesn&apos;t)&amp;nbsp;that&apos;s not the purpose of this option at all! If anyone wanted foolproof consecutive numbers, they&apos;d type a &lt;em&gt;page range&lt;/em&gt;... yeah. Real smart.&lt;/p&gt; &lt;p&gt;*growls*&lt;/p&gt; &lt;p&gt;On another note, &lt;a href=&quot;http://windowslivewriter.spaces.live.com/&quot;&gt;Windows Live Writer&lt;/a&gt;&amp;nbsp;is&amp;nbsp;still very sparse and beta,&amp;nbsp;but actually kinda promising. For one thing, it works with LiveJournal&amp;nbsp;(!) among others. I can take screenshots and paste them right in, and it uploads to Scrapbook without ever needing to save in between. They also try to grab your blog style and display it all WYSIWYG-like in the editor, although it doesn&apos;t completely work for me yet. Supposedly, it supports plugins.&lt;/p&gt; &lt;p&gt;Bah. I don&apos;t remember what else I wanted to say.&lt;/p&gt;</description>
  <comments>http://draci.livejournal.com/67156.html</comments>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://draci.livejournal.com/66676.html</guid>
  <pubDate>Sat, 02 Sep 2006 15:32:51 GMT</pubDate>
  <title>PLogisticGraph.exe (Or: Hi Markus! Scaling is fun! :P)</title>
  <link>http://draci.livejournal.com/66676.html</link>
  <description>&lt;pre&gt;width   = 2{page} * 10.5{in} * 600{dpi};
height  = 2{Page} *  8.0{in} * 600{dpi};
iters   = 10,000;
samples = 10,000;

let p&lt;sub&gt;n+1&lt;/sub&gt; = µ * (1 - p&lt;sub&gt;n&lt;/sub&gt;) * p&lt;sub&gt;n&lt;/sub&gt;;

let pixels[] = 1.0;
let pixels[xc, yc] = 0,
where
  xc = floor(µ * width / 4),
  yc = floor(p&lt;sub&gt;iters&lt;/sub&gt; * height),
  p&lt;sub&gt;0&lt;/sub&gt; = 0.5 * index / (samples - 1),
  index = floor(x), x over [0..samples-1],
  µ over [0..4];
&lt;/pre&gt;

&lt;p&gt;CPU: 88%&lt;br&gt;
Working set:  9,420K&lt;br&gt;
Virtual size: 478,228K&lt;br&gt;
Page faults:  238,735&lt;br&gt;

&lt;p&gt;Rendering... 42.381%&lt;p&gt;I think this is gonna be awhile. :&amp;gt;

&lt;p&gt;Yanno, I really wish there was a language like this. The compiler ought to be able to slurp up all these clauses at once, and then say:

&lt;blockquote&gt;&quot;Hey, pixels at &lt;em&gt;xc&lt;/em&gt; and &lt;em&gt;yc&lt;/em&gt; should be zero, but what are those? Oh, I see &lt;em&gt;xc&lt;/em&gt; is an integer coming from a formula involving &lt;em&gt;µ&lt;/em&gt; which covers the range 0..4. So we&apos;ll try all the integers 0..&lt;em&gt;width&lt;/em&gt;. And &lt;em&gt;yc&lt;/em&gt; involves &lt;em&gt;p&lt;sub&gt;iters&lt;/sub&gt;&lt;/em&gt;, and okay, I can get that starting with &lt;em&gt;p&lt;sub&gt;0&lt;/sub&gt;&lt;/em&gt;, but then I have to try all values of &lt;em&gt;index&lt;/em&gt;... Of course with two variables involved I have to try all the combinations, and &lt;em&gt;p&lt;/em&gt; is an iterated function so it&apos;s really a triply nested loop..&quot;&lt;/blockquote&gt;

&lt;p&gt;Well, you get the idea. Maybe there is something like that already, but it sounds pretty academic. For now, the actual code&apos;s in Delphi.

&lt;p&gt;&lt;strong&gt;[13:40] Edit:&lt;/strong&gt; Well, it&apos;s always the littlest things. I rotated the whole thing 90&amp;deg; so it stopped thrashing the processor/page caches, and killed a couple (!) of redundant zero-fills in the graphics stuff. Kinda important when the graphics get that huge! And noticably faster. No trying to commit that virtual 500MB at once.

&lt;p&gt;Still the same size, but now it&apos;s more like 90+% CPU, 6MB working set and 1,690 pagefaults. It should just stream out to the swapfile as it touches the rest, since it never reads them except to save at the end. Yay or sommin.

&lt;p&gt;I wonder how much this sorta tuning conspires to wreck the notions above. In this case, the value (and not just the curse) of imperative languages is being, well, imperative! A good inferential compiler would have to think pretty hard about this stuff, maybe even experiment at runtime. (Now that I think of it, perhaps the SQL people have already been there, it&apos;s quite similar in spirit.)</description>
  <comments>http://draci.livejournal.com/66676.html</comments>
  <lj:music>Trapezoid - Secret of Monkey Island 2 Monkey Brain Soup for the Soul OC ReMix</lj:music>
  <media:title type="plain">Trapezoid - Secret of Monkey Island 2 Monkey Brain Soup for the Soul OC ReMix</media:title>
  <lj:mood>sleepy</lj:mood>
  <lj:security>public</lj:security>
  <lj:reply-count>5</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://draci.livejournal.com/66432.html</guid>
  <pubDate>Wed, 30 Aug 2006 10:35:53 GMT</pubDate>
  <title>1-up?</title>
  <link>http://draci.livejournal.com/66432.html</link>
  <description>So. A few people have tempted me back onto Second Life lately, and it&apos;s got me itching for computer parts again. After a good bit of on and off reading, I finally felt good enough to sit down and check prices.&lt;br /&gt;&lt;br /&gt;My budget is about $350 and I don&apos;t need new drives or peripherals. So this is the best I could find. I&apos;ll probably order these tomorrow (er, later today) if no disturbing revelations crop up.&lt;br /&gt;&lt;br /&gt;&lt;table cellspacing=&quot;8&quot;&gt;
&lt;tr&gt;&lt;th&gt;&lt;small&gt;List&lt;br&gt;price&lt;/small&gt;&lt;/th&gt;&lt;th&gt;&lt;small&gt;Discount&lt;/small&gt;&lt;/th&gt;&lt;th&gt;&lt;small&gt;Mail-in&lt;br&gt;rebate&lt;/small&gt;&lt;/th&gt;&lt;th&gt;&lt;small&gt;Shipping&lt;/small&gt;&lt;/th&gt;&lt;th&gt;&lt;small&gt;Total&lt;/small&gt;&lt;/th&gt;&lt;th&gt;&lt;small&gt;Item&lt;/small&gt;&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;$120&lt;/td&gt;&lt;td&gt;-$20&lt;/td&gt;&lt;td&gt;-$50&lt;/td&gt;&lt;td&gt;free&lt;/td&gt;&lt;td&gt;$50&lt;/td&gt;&lt;td&gt;&lt;a href=&quot;http://www.circuitcity.com/ssm/Ultra-MicroFly-Micro-ATX-Case-with-400-Watt-PSU-ULT33114-/sem/rpsm/oid/159033/catOid/-13015/rpem/ccd/productDetail.do&quot;&gt;Ultra MicroFly M-ATX Case with 400W PS - Black&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;$66&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;free&lt;/td&gt;&lt;td&gt;$66&lt;/td&gt;&lt;td&gt;&lt;a href=&quot;http://www.newegg.com/Product/Product.asp?Item=N82E16819103537&quot;&gt;AMD Athlon64 3000+ Venice 2GHz HT 512KB L2 S939&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;$58&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;-$10&lt;/td&gt;&lt;td&gt;+$6&lt;/td&gt;&lt;td&gt;$54&lt;/td&gt;&lt;td&gt;&lt;a href=&quot;http://www.newegg.com/Product/Product.asp?Item=N82E16813186085&quot;&gt;Foxconn 6100K8MA-RS S939 NV GeForce6100 M-ATX AMD&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;$98&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;-$8&lt;/td&gt;&lt;td&gt;+$5&lt;/td&gt;&lt;td&gt;$95&lt;/td&gt;&lt;td&gt;&lt;a href=&quot;http://www.newegg.com/Product/Product.asp?Item=N82E16820227039&quot;&gt;OCZ Value Series 1GB (2x512MB) 184-Pin DDR PC3200&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;$69&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;-$15&lt;/td&gt;&lt;td&gt;+$5&lt;/td&gt;&lt;td&gt;$59&lt;/td&gt;&lt;td&gt;&lt;a href=&quot;http://www.newegg.com/Product/Product.asp?Item=N82E16814130030&quot;&gt;eVGA 256-P2-N437-LR Geforce7300GS 256MB GDDR2 PCIE&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;6&quot;&gt;&lt;hr&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;$411&lt;/td&gt;&lt;td&gt;-$20&lt;/td&gt;&lt;td&gt;-$83&lt;/td&gt;&lt;td&gt;+$16&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;$391 up front, $324 after rebates&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;Comments are of course appreciated if anyone gets to this before then. I look forward to having the spare cycles. :3</description>
  <comments>http://draci.livejournal.com/66432.html</comments>
  <lj:mood>sleepy</lj:mood>
  <lj:security>public</lj:security>
  <lj:reply-count>2</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://draci.livejournal.com/66210.html</guid>
  <pubDate>Fri, 25 Aug 2006 03:50:38 GMT</pubDate>
  <title>Diet sabotage, editors, and crappy write(fd, &amp;amp;mystruct, sizeof(mystruct))-style log formats</title>
  <link>http://draci.livejournal.com/66210.html</link>
  <description>&lt;p&gt;So DietPower, the food logger I use, decided as long as I&apos;m sitting here, I could wait two minutes for the food log to open. It was already slow, but now it&apos;s firmly in the realm of code that &lt;em&gt;doesn&apos;t scale&lt;/em&gt;.&lt;/p&gt; &lt;p&gt;C&apos;mon, it&apos;s clearly a C job. No excuse. I know people who write &lt;a href=&quot;http://xb95.livejournal.com/442896.html&quot;&gt;faster apps in Perl&lt;/a&gt;!&lt;/p&gt; &lt;p&gt;&lt;a href=&quot;http://pics.livejournal.com/draci/pic/0003a4xw&quot; atomicselection=&quot;true&quot;&gt;&lt;img style=&quot;border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px&quot; height=&quot;138&quot; src=&quot;http://pics.livejournal.com/draci/pic/00039hq4&quot; width=&quot;180&quot; align=&quot;right&quot; border=&quot;0&quot;&gt;&lt;/a&gt;Another irritating thing is it&apos;s missing&amp;nbsp;an export option, so the only way to get the logs out involves manual inspection,&amp;nbsp;and then writing the code. The latter&apos;s not so hard, but I always used to cringe at binary files. Maybe the braver people would drag out a hex editor.&lt;/p&gt; &lt;p&gt;Well, the first thing I reach for is EDIT.COM.&amp;nbsp;That used to be because it&apos;s all I had that reliably saved binaries... too bad it doesn&apos;t do hex, right? But after awhile I noticed that an ascii&amp;nbsp;view is really useful, quite possibly moreso.&lt;/p&gt; &lt;p&gt;For one, you get the best use of screen space, which reveals a lot of patterns. Intel code is very dense, with the occasional word-size&amp;nbsp;data thrown in. C structs with small numbers (e.g. most of them) leave a lot of zero padding. Pointers and offsets can be seen growing throughout the file. Text, of course,&amp;nbsp;is immediately readable.&lt;/p&gt; &lt;p&gt;&lt;a href=&quot;http://pics.livejournal.com/draci/pic/0003cawg&quot; atomicselection=&quot;true&quot;&gt;&lt;img style=&quot;border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px&quot; height=&quot;323&quot; src=&quot;http://pics.livejournal.com/draci/pic/0003bkbr&quot; width=&quot;300&quot; align=&quot;left&quot; border=&quot;0&quot;&gt;&lt;/a&gt; Repeated data shows up especially well, since nearly every byte has a unique glyph. The exceptions, 0x00/0x20/0xff, are blank. Happily, this includes various representations of &lt;em&gt;nil&lt;/em&gt;:&amp;nbsp;space, the integers 0 and -1, floating-point zero--and unused&amp;nbsp;numeric precision.&lt;/p&gt; &lt;p&gt;Other values show up too, for example values centered around 0x3f (?, @, A) which&amp;nbsp;are sign/exponent bits for small positive floats. &quot;&amp;nbsp; Ç┐&quot; happens to be 0xbf800000, or -1.0. At left, it marks unspecified nutritional values. (Sloppy coding has introduced&amp;nbsp;other negative values&amp;nbsp;as well!)&lt;/p&gt; &lt;p&gt;If the file is just a series of structs, it shows up as angular striations, betraying the length and number of the records. Usually somewhere nearby is the count. If you know your hex and ascii (essentially base-16/256), you&apos;ll quickly find it, and now you can write a skeletal reader.&lt;/p&gt; &lt;p&gt;And then you can go try all the program&apos;s special cases, and make note of what it spits out. This is how I wrote my OpenCanvas reader. Maybe I can get DietPower&apos;s logs into&amp;nbsp;a spreadsheet or something...&lt;/p&gt; &lt;p&gt;It does give me thoughts, though. Using EDIT works great, but it&apos;s still a pain to do the math. I wonder if there&apos;s a better editor out there. I think I should be able to select regions, say &quot;this looks like a record&quot;, and have the thing pattern-matched down the whole file. Then I could say &quot;these are float fields&quot;, and it would update everywhere.&lt;/p&gt; &lt;p&gt;I think I would have circular tooltips, where you hover over some data and it shows you all the different values it could be in each representation it knows, and then the most likely one. (0&apos;s&amp;nbsp;or 1&apos;s on the left = small int, high bits near 0xbf, 0x3f = small float, compare to values in other instances of the record...) Then you&apos;d right-drag through a pie menu&amp;nbsp;to choose one&amp;nbsp;of them.&lt;/p&gt; &lt;p&gt;There could even be a hex view, either through a lens tool, or using a color mapping on top of the numbers, to show patterns. Or you could space things out and display assembler inline with all the other data, using&amp;nbsp;heuristics (statistics, file headers)&amp;nbsp;or manual selection to identify the code.&lt;/p&gt; &lt;p&gt;Ideally it would come with different plugins for the known formats, and people could write their own. You could use it as a teaching tool for Operating systems 101, or to help debug things, or repair&amp;nbsp;corrupt files.&lt;/p&gt; &lt;p&gt;Ohwell, I&apos;m probably dreaming. But it would be helpful right now.&lt;/p&gt;</description>
  <comments>http://draci.livejournal.com/66210.html</comments>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://draci.livejournal.com/65176.html</guid>
  <pubDate>Wed, 26 Jul 2006 23:39:59 GMT</pubDate>
  <title>Level up!</title>
  <link>http://draci.livejournal.com/65176.html</link>
  <description>&lt;p&gt;If you can stand the quirks/don&apos;t need C++, &lt;a href=&quot;http://fabrice.bellard.free.fr/tcc/&quot;&gt;Tiny C&lt;/a&gt; is amazing. Where GCC takes entire seconds &lt;em&gt;per file&lt;/em&gt; on my machine, a Makefile running TCC spills output faster than the xterm can display. I only wish I was kidding!

&lt;p&gt;TCC also comes in a library form that you can plug into your apps to compile C &quot;scripts&quot;, can do optional bounds and pointer checking at runtime, and it even squeezes onto a floppy. Mind, it doesn&apos;t generate the best code, but then again, most isn&apos;t time-sensitive&amp;mdash;and if your algorithms depend on a clever optimizer to be usable, they probably won&apos;t scale as it is... But I digress. In fact, there was a problem...
&lt;pre style=&quot;white-space: wrap;&quot;&gt;
Kahmynx@FRANCIS /c/Code/Magenta_bloo $ make run
tcc -g -o build/magenta.exe Fuschia.o Cyan.o White.o
  -L/Dev/gc6.6 -lkernel32 -luser32 -lgdi32 -lgc
build/magenta.exe
Segmentation fault

make: *** [run] error 5

Kahmynx@FRANCIS /c/Code/Magenta $ gdb build/Magenta.exe
The debugging information in 
  `c:\Code\Magenta_bloo/build/Magenta.exe&apos; is corrupted.
The file has a `.stabs&apos; section, but no `.stabstr&apos; section.
(gdb) break main
No symbol table is loaded.  Use the &quot;file&quot; command.
(gdb) . o O ( wtf? )
&lt;/pre&gt;

Further investigation revealed that compiling *.c to a binary worked, but compiling to *.o and linking these somehow mangled the debug symbols. And sure enough, an incriminating remark in tcc/src/tccelf.c:
&lt;pre style=&quot;white-space: wrap;&quot;&gt;
/* load an object file and merge it with current files */
/* XXX: handle correctly stab (debug) info */
static int tcc_load_object_file(
  TCCState *s1, int fd, unsigned long file_offset)
{
&lt;/pre&gt;

&lt;p&gt;&quot;Correctly?&quot; Erk!! Well they don&apos;t call it v0.9 for nothing, but it&apos;s not the sort of commentary one wants to see in a compiler!

&lt;p&gt;But with the company of lazyweb, and some quick if &lt;a href=&quot;http://www.cs.ucdavis.edu/~haungs/paper/node10.html&quot;&gt;mind&lt;/a&gt;-&lt;a href=&quot;http://www.linuxjournal.com/article/1060&quot;&gt;numbing&lt;/a&gt; &lt;a href=&quot;http://sources.redhat.com/gdb/download/onlinedocs/stabs.html&quot;&gt;research&lt;/a&gt;, things are looking up. Many hours later:
&lt;pre style=&quot;white-space: wrap;&quot;&gt;
# Why not? Btw, no visible delay here
Kahmynx@FRANCIS /Dev/tcc/src $ ../tcc -g tcc.c -lkernel32
Kahmynx@FRANCIS /Dev/tcc/src $ ./tcc -g mathtest.o win32/lib/crt1.o
  -L./win32/lib -B./win32/lib
Kahmynx@FRANCIS /Dev/tcc/src $ gdb mathtest.exe
(gdb) break main
Breakpoint 1 at 0x4011da:
  file c:/Code/Magenta_bloo/scraps/mathtest.c, line 94.
(gdb) list
85              unsigned overflow = xor &amp; (x ^ modulo) &amp; 0x80808080;
86              unsigned over_p = overflow &amp; modulo;
87              over_p = over_p - (over_p &amp;gt;&amp;gt; 7);
88              unsigned over_np = overflow - (overflow &amp;gt;&amp;gt; 7);
89              return (modulo ^ overflow) &amp; ~over_np | over_p;
90      }
91      
92      int main(int argc, char**argv)
93      {
94              if( argc &amp;lt; 4 )
(gdb)
&lt;/pre&gt;

&lt;p&gt;And right now this is the most gratifying thing, being able to go and hack on the compiler, and even sort of comprehend what I&apos;m doing. It&apos;s the wonderful feeling of a warm light shown on things that are black magic to most people...

&lt;p&gt;&lt;small&gt;Or maybe the feeling I might take over the world next Tuesday. That doesn&apos;t seem substantiated, though.&lt;/small&gt;</description>
  <comments>http://draci.livejournal.com/65176.html</comments>
  <lj:music>2A03_v3/Covers/robokabuto/Final Fantasy IV - Troia.nsf</lj:music>
  <media:title type="plain">2A03_v3/Covers/robokabuto/Final Fantasy IV - Troia.nsf</media:title>
  <lj:mood>satisfied</lj:mood>
  <lj:security>public</lj:security>
  <lj:reply-count>1</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://draci.livejournal.com/64994.html</guid>
  <pubDate>Fri, 14 Jul 2006 01:14:42 GMT</pubDate>
  <title>Cute bitwise math tricks</title>
  <link>http://draci.livejournal.com/64994.html</link>
  <description>Some months ago I found a couple of brilliant pages (&lt;a href=&quot;http://www.slack.net/~ant/info/&quot;&gt;1&lt;/a&gt;, &lt;a href=&quot;http://www.stereopsis.com/doubleblend.html&quot;&gt;2&lt;/a&gt;) on dealing with graphics data. By which I mean, four-component vectors packed into machine words. E.g. 0xAARRGGBB or &lt;tt&gt;struct { uint8_t r, g, b, a; }&lt;/tt&gt;.&lt;br /&gt;&lt;br /&gt;Applications like Photoshop or OC, are really just a slick interface over all these vectors. Since there are naturally quite a lot (e.g. tens of megabytes) of them, the authors have invested quite a lot of effort to speed up the math.&lt;br /&gt;&lt;br /&gt;This is the lovely part. You don&apos;t have to know calculus, but you do need a twisted mind. For example, these two snippets &lt;a href=&quot;http://www.slack.net/~ant/info/rgb_clamped_add.html&quot;&gt;add&lt;/a&gt; and &lt;a href=&quot;http://www.slack.net/~ant/info/rgb_clamped_sub.html&quot;&gt;subtract&lt;/a&gt; vectors, limiting the results to byte range. So annoying to do componentwise, but look!&lt;table cellspacing=&quot;16&quot;&gt;&lt;tr valign=&quot;top&quot;&gt;&lt;td&gt;&lt;tt&gt;sum = x + y;&lt;br /&gt;low_bits = (x ^ y) &amp; 0x010101;&lt;br /&gt;carries = (sum - low_bits) &amp; 0x01010100;&lt;br /&gt;modulo = sum - carries;&lt;br /&gt;clamp = carries - (carries &amp;gt;&amp;gt; 8);&lt;br /&gt;result = modulo | clamp;&lt;/tt&gt;&lt;br /&gt;&lt;br /&gt;&lt;small&gt;&lt;em&gt;(modified, the original page did 16 bits)&lt;/em&gt;&lt;/small&gt;&lt;/td&gt;&lt;td&gt;&lt;tt&gt;diff = (x - y) + 0x01010100;&lt;br /&gt;low_bits = (x ^ y) &amp; 0x01010100;&lt;br /&gt;borrows = (diff - low_bits) &amp; 0x01010100;&lt;br /&gt;modulo = diff - borrows;&lt;br /&gt;clamp = borrows - (borrows &amp;gt;&amp;gt; 8);&lt;br /&gt;result = modulo &amp; clamp;&lt;/tt&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;They compile to 12..14 intel instructions, adding in parallel and saving up to three expensive branches. Some manual assembler can even fix the carry problem (on the add) and do the full vector.&lt;br /&gt;&lt;br /&gt;Here&apos;s a &lt;a href=&quot;http://www.stereopsis.com/doubleblend.html&quot;&gt;premultiplied alpha blend&lt;/a&gt;, resembling code from the linked page. They are computing dest&lt;sub&gt;C&lt;/sub&gt; = dest&lt;sub&gt;C&lt;/sub&gt;*(255-src&lt;sub&gt;A&lt;/sub&gt;)/255 + src&lt;sub&gt;C&lt;/sub&gt;. The first is approximate, and the second (in a not so obvious way) exact:&lt;table cellspacing=&quot;16&quot;&gt;&lt;tr valign=&quot;top&quot;&gt;&lt;td&gt;&lt;tt&gt;dest_ag = (dest &amp; 0xff00ff00) &amp;gt;&amp;gt; 8;&lt;br /&gt;dest_rb = dest &amp; 0x00ff00ff;&lt;br /&gt;alpha   = 0x100 - (src &amp;gt;&amp;gt; 24);&lt;br /&gt;dest_ag *= alpha;&lt;br /&gt;dest_rb *= alpha;&lt;br /&gt;dest_ag =  dest_ag &amp; 0xff00ff00;&lt;br /&gt;dest_rb = (dest_rb &amp;gt;&amp;gt; 8) &amp; 0x00ff00ff;&lt;br /&gt;dest    = dest_ag + dest_rb + src;&lt;/tt&gt;&lt;/td&gt;&lt;td&gt;&lt;tt&gt;dest_ag = (dest &amp; 0xff00ff00) &amp;gt;&amp;gt; 8;&lt;br /&gt;dest_rb = dest &amp; 0x00ff00ff;&lt;br /&gt;alpha   = 0xff - (src &amp;gt;&amp;gt; 24);&lt;br /&gt;dest_ag = alpha * dest_ag + 0x00800080;&lt;br /&gt;dest_rb = alpha * dest_rb + 0x00800080;&lt;br /&gt;dest_ag = ((dest_ag &amp;gt;&amp;gt; 8) &amp; 0x00ff00ff) + dest_ag;&lt;br /&gt;dest_rb = ((dest_rb &amp;gt;&amp;gt; 8) &amp; 0x00ff00ff) + dest_rb;&lt;br /&gt;dest_ag = dest_ag &amp; 0xff00ff00;&lt;br /&gt;dest_rb = (dest_rb &amp;gt;&amp;gt; 8) &amp; 0x00ff00ff;&lt;br /&gt;dest    = dest_ag + dest_rb + src;&lt;/tt&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;This is based on the principle that 4 * 1020304 = 4 * (1000000 + 20000 + 300 + 4) = 4081216. The coefficient multiplies digits independently, preserving their place values. So while it looks complicated, it saves two multiplies and (in the second case) four (!) divides. The remaining logic is easily parallelized on its own, a cinch for modern compilers and CPUs.&lt;br /&gt;&lt;br /&gt;Finally, here&apos;s one I noticed! It&apos;s just a componentwise product, treating the bytes as unit fractions:&lt;table cellspacing=&quot;16&quot;&gt;&lt;tr&gt;&lt;td&gt;&lt;tt&gt;dest_ag = (dest &amp; 0xff00ff00) &amp;gt;&amp;gt; 8;&lt;br /&gt;dest_rb = dest &amp; 0x00ff00ff;&lt;br /&gt;src_ag = (src &amp; 0xff00ff00) &amp;gt;&amp;gt; 8;&lt;br /&gt;src_rb = src &amp; 0x00ff00ff;&lt;br /&gt;dest_ag *= src_ag + 0x00010001;&lt;br /&gt;dest_rb *= src_rb + 0x00010001;&lt;br /&gt;dest_ag = (dest_ag &amp;gt;&amp;gt; 16 &amp; 0xff000000) + (dest_ag &amp; 0x0000ff00);&lt;br /&gt;dest_rb = (dest_rb &amp;gt;&amp;gt; 24 &amp; 0x00ff0000) + (dest_rb &amp;gt;&amp;gt; 8 &amp; 0x000000ff);&lt;br /&gt;dest = dest_ag + dest_rb;&lt;/tt&gt;&lt;/tr&gt;&amp;lt;/tr&amp;gt;&lt;/table&gt;This one&apos;s approximate, and needs a 32x32-&amp;gt;64bit multiply (usually an inline library function or some assembler). Though 0*0 = 0, and 255*255 = 255, as intended. It&apos;s actually not so obvious why this works. The short story is that it&apos;s based on the expansion of (a + b)(x + y)...&lt;br /&gt;&lt;br /&gt;(2&lt;sup&gt;16&lt;/sup&gt;*b + a) * (2&lt;sup&gt;16&lt;/sup&gt;*y + x) = 2&lt;sup&gt;32&lt;/sup&gt;*b*y + 2&lt;sup&gt;16&lt;/sup&gt;*(b*x + a*y) + a*x&lt;br /&gt;&lt;br /&gt;&lt;a name=&quot;cutid1&quot;&gt;&lt;/a&gt;The cool part about this is if you&apos;re using intel asm, b*y and a*x wind up in separate registers! You just have to mask off the products. There&apos;s only one problem, and that is the middle 2&lt;sup&gt;16&lt;/sup&gt; &quot;garbage&quot; term above. It can be as large as 17 bits, and it shows up in the middle of the result. The first 16 are no problem since they can be masked. But the 17th overlaps the b*y product...&lt;br /&gt;&lt;br /&gt;Well, the products here are 8 bits, so you don&apos;t have to worry about the low halves. The only bad thing that might happen is garbage bits carrying over and incrementing the high half of b*y, if b*y has no zero bits to absorb it. But b*y is at most 0xff00, which has the zero bits, so it can&apos;t overflow.&lt;br /&gt;&lt;br /&gt;Still, if b*y = 0x100*N + 0xff, the product will ripple over and increment the N portion we cared about. When does that happen? Kind of complicated:&lt;br /&gt;- Think of it this way. b and y must obviously be factors of 0x100*N + 0xff (there are quite a number of these);&lt;br /&gt;- Then the garbage, 2&lt;sup&gt;16&lt;/sup&gt;*(b*x + a*y), has to be large enough (&amp;gt;= 0x10000) to spill (when b*y &amp;lt; 0x4000, this won&apos;t happen);&lt;br /&gt;- None of a/b/x/y ever go over 0x100, so this also weeds out a ton of factor pairs.&lt;br /&gt;&lt;br /&gt;So I logged onto Chaotic, wrote some MUSHcode, and worked it out. Turns out, there are 63 byte-sized pairs giving b*y = 0x100*N + 0xff, but most of them fail the second point. Only about 26 combinations (0.00000060536% of 2&lt;sup&gt;32&lt;/sup&gt;!) should even touch the bits I want.&lt;br /&gt;&lt;br /&gt;Pretty nice. I tested it (18 instructions), displaying OC drawings, it&apos;s fast and looks great. The only thing I need is a real benchmark, I&apos;ve never really seen how the speed compares between all the different algorithms. It seems like it&apos;d be most useful on the old Pentiums, and on RISC platforms that prefer word-size loads.&lt;br /&gt;&lt;br /&gt;(I realise this is totally irrelevant since the PCs nowadays have fancy processors with the cheatish SIMD instructions that do it all for you. Or, better yet, you can run this sort of integer code in &lt;br /&gt;parallel with the SIMD stuff.)</description>
  <comments>http://draci.livejournal.com/64994.html</comments>
  <lj:mood>amused</lj:mood>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://draci.livejournal.com/64568.html</guid>
  <pubDate>Wed, 05 Jul 2006 03:50:00 GMT</pubDate>
  <title>Bad programmer! No document.cookie!</title>
  <link>http://draci.livejournal.com/64568.html</link>
  <description>So I just realized what OpenCanvas is doing. It&apos;s almost bad enough to make me stop using it entirely.&lt;br /&gt;&lt;br /&gt;Thing is, this beautiful 17&quot; (~13&quot;x11&quot;) flatpanel is simply too big for my 6&quot;x8&quot; tablet. Everything I draw is enlarged, and never fits onscreen. I can try to draw smaller, but it&apos;s quite awkward given the smoothness of the tablet pen and the urge to stroke with my arm. I would be much better served with the 12&quot;x12&quot;, if I could ever fit it on my desk. Barring that, the next best thing is to map the smaller tablet (in painting apps) to about half of the screen.&lt;br /&gt;&lt;br /&gt;Well OC hits a little snag here. Turns out it totally bypasses the normal tablet logic and uses raw tablet coordinates, mapping the tablet to the entire screen. This is wrong for two big reasons:&lt;br /&gt;&lt;br /&gt;* The aforementioned remapping doesn&apos;t work, I&apos;m stuck with fullscreen;&lt;br /&gt;* My screen is 1280x1024, i.e. a shape of 5:4, and not the 4:3 of the tablet. Wacom accounts for this, but OC does not. That means everything I draw in OC is the wrong aspect ratio!!&lt;br /&gt;&lt;br /&gt;Nnngh!&lt;br /&gt;&lt;br /&gt;...&lt;br /&gt;&lt;br /&gt;The fireworks were pretty decent, though. I always wanna make a screensaver afterwards, &apos;cause I&apos;ve never seen a simulation that looks enough like the real thing. Hmm.&lt;br /&gt;&lt;br /&gt;The people behind us were amusing, but the car alarms were outright hilarious! I never heard the fireworks trigger them before, but this time it happened with a good 10-25% regularity, and half the time I couldn&apos;t stop laughing...</description>
  <comments>http://draci.livejournal.com/64568.html</comments>
  <lj:music>Star Salzman - Chrono Trigger The Incredible Singing Robot OC ReMix</lj:music>
  <media:title type="plain">Star Salzman - Chrono Trigger The Incredible Singing Robot OC ReMix</media:title>
  <lj:mood>pissed off</lj:mood>
  <lj:security>public</lj:security>
  <lj:reply-count>2</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://draci.livejournal.com/64449.html</guid>
  <pubDate>Tue, 04 Jul 2006 23:38:03 GMT</pubDate>
  <title>while( day++, !doom.impending() ) dracus.mane--;</title>
  <link>http://draci.livejournal.com/64449.html</link>
  <description>In reply to &lt;a href=&quot;http://doubletake.livejournal.com/63656.html&quot;&gt;http://doubletake.livejournal.com/63656.html&lt;/a&gt;:&lt;br /&gt;&lt;em&gt;(Spilled off into a rambly entry, &apos;cause it got so long and random that it might as well be a note to myself... sorries, I&apos;m just grasping at straws here.)&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;Oh gods, I do pretty much the same thing. Maybe not on such an explicit level, but it is just as bad.&lt;br /&gt;&lt;br /&gt;When I got my palm pilot for example, it was exquisitely easy to make memos and lists. So aside from micro-journalling and doodling and games of Rogue, I naturally took to the ToDo application.&lt;br /&gt;&lt;br /&gt;Indeed, I soon outgrew ToDo and migrated to the heirarchical Progect, constructing entire trees with pretty little checkboxes and progress indicators, exquisitely prioritized and organized by category. Like you said, it&apos;s actually more fun making and preening the lists than checking them off!&lt;br /&gt;&lt;br /&gt;You can guess how much got done. &lt;strong&gt;Nrrgh!&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Another problem I have with lists is that if it&apos;s a daily thing I look at, I cringe every time I do.. soon developing an aversion to the most neglected items, and gradually, to the entire list itself. Therefore much emo ensues, and I never look at them in the end, defeating all my effort. Still, if I don&apos;t &lt;em&gt;make&lt;/em&gt; those lists, these things stay in my mind, instead, for months or even years... which is even worse.&lt;br /&gt;&lt;br /&gt;Day-specific schedules and todos are even more of a guilt trap. I always wound up rewriting them for the &lt;em&gt;next&lt;/em&gt; day, and then... you know.&lt;br /&gt;&lt;br /&gt;So what to do?? @..@&lt;br /&gt;&lt;br /&gt;The solution advocated in GTD is actually (in part) what you&apos;re leaning towards:&lt;ul&gt;&lt;br /&gt;&lt;li&gt;Eliminating the expectation on a given day (within deadlines, just do the next doable thing);&lt;br /&gt;&lt;li&gt;Never writing anything down, or thinking about it (to decide whether to actually do it, etc), more than -once-;&lt;br /&gt;&lt;li&gt;Reviewing the notes and such, so you keep them off your brain;&lt;br /&gt;&lt;li&gt;Making sure the &quot;todo items&quot; (as distinct from &quot;projects&quot;) are actually things you can do in exactly one step. Otherwise, if it is sufficiently complex, it will be unclear and scary and confusing, and never get done (this stalls many of my programming ideas).&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;Another thing to consider is that if you have undone things of &quot;top&quot; priority, and the world hasn&apos;t ended... reconsider the priority. Sometimes enthusiasm and/or real-world use, fade with time, and that&apos;s fine.&lt;br /&gt;&lt;br /&gt;Also, for things like &apos;clean cat box&apos;, he points out it&apos;s a waste of time to write them down. If you have nothing else pressing, just do the next small thing that comes to mind. If you don&apos;t want to spend all day, you could set a timer or something. This one small piece of advice, has, if nothing else, been a small victory over my emotions, and kept my room a lot cleaner...&lt;br /&gt;&lt;br /&gt;Deadlines might work, but of course you need good time estimation skills, and I&apos;m bad at that. An advantage in theory is that, when in doubt, you always know what you should work on first&amp;mdash;order by due date.&lt;br /&gt;&lt;br /&gt;&quot;Should&quot; is &lt;em&gt;my&lt;/em&gt; dirty word, by the way. The very mention reminds me that I &lt;em&gt;should&lt;/em&gt; and I &lt;em&gt;haven&apos;t&lt;/em&gt; yet. Ye gah.&lt;br /&gt;&lt;br /&gt;I personally don&apos;t feel so great about the self-punishment. Basically that&apos;s because I already do it: I feel bad about putting things off, and underconfident about finishing them, which is why I put them off, which is why... d&apos;oh! If I had the heaps of physical evidence on my desk to say &quot;Wow! Draci&apos;s a great artist!&quot;, I might be a little more motivated. I need to like myself, first. The Shame Game is easily self-perpetuating, and anyway I have not seen myself actually follow any supposed &apos;punishments.&apos;&lt;br /&gt;&lt;br /&gt;Hm, maybe now that I&apos;m succeeding with the diet, positive junkfood reinforcement would work better. I&apos;m not a big sweet tooth, though. n..n And I guess I could start printing art, and putting it back up on my desk/wall.&lt;br /&gt;&lt;br /&gt;OMG, daily art... I am perpetually forgetting. &amp;gt;..&amp;lt; How could I get a reminder? This actually is near the core of my problem. I have no &apos;trigger&apos; to task-switch, and if I&apos;m on a roll and unprovoked, will go on coding for 6-8 hours. These days, with my stressing over things-to-be-done, I just end up reading blogs and messageboards and crap. Slowly reading less, which has resulted in me pacing the house (in a proportionately greater amount) and bothering the cat instead.&lt;br /&gt;&lt;br /&gt;Now if I could just find a way to stop stressing over all the things I *won&apos;t* be doing if I make a choice to do *something.* I don&apos;t know if there&apos;s an antidote to that, aside from a nice cold dunking.&lt;br /&gt;&lt;br /&gt;Blah, I dunno. Time for posty, then maybe some drive-by artings. And fireworks, if I&apos;m feeling up to it.</description>
  <comments>http://draci.livejournal.com/64449.html</comments>
  <lj:music>Mustin, Kassie!, JAXX - Secret of Mana Secret of Spram (8 Bells Mix) OC ReMix</lj:music>
  <media:title type="plain">Mustin, Kassie!, JAXX - Secret of Mana Secret of Spram (8 Bells Mix) OC ReMix</media:title>
  <lj:mood>anxious</lj:mood>
  <lj:security>public</lj:security>
  <lj:reply-count>1</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://draci.livejournal.com/64030.html</guid>
  <pubDate>Wed, 28 Jun 2006 21:21:19 GMT</pubDate>
  <title>OC&apos;s *.wpb</title>
  <link>http://draci.livejournal.com/64030.html</link>
  <description>&lt;p&gt;Not much progress on the code front, but I did take the time to work out OC&apos;s image format for future compatibility. I haven&apos;t seen this anywhere, so I might as well put it here. This is what goes into the *.wpb&apos;s.

&lt;p&gt;&lt;a name=&quot;cutid1&quot;&gt;&lt;/a&gt;Note that all numbers/words are 32 bits little-endian. Reserved fields, as usual, should be ignored and preserved, or initialized to zero if writing a new file.

&lt;table cellspacing=&quot;8&quot;&gt;
&lt;tr valign=&quot;top&quot;&gt;&lt;th&gt;Offset&lt;/th&gt;&lt;th&gt;Type&lt;/th&gt;&lt;th&gt;Name&lt;/th&gt;&lt;th&gt;Value (default)&lt;/th&gt;&lt;th&gt;Description&lt;/th&gt;&lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;&lt;td align=&quot;right&quot;&gt;0&lt;/td&gt;&lt;td&gt;byte[4]&lt;/td&gt;&lt;td&gt;signature&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;&quot;WPB2&quot;&lt;/td&gt;&lt;td&gt;Magic file signature.&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;&lt;td align=&quot;right&quot;&gt;4&lt;/td&gt;&lt;td&gt;word&lt;/td&gt;&lt;td&gt;reserved&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;0&lt;/td&gt;&lt;td&gt;&amp;mdash;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;&lt;td align=&quot;right&quot;&gt;8&lt;/td&gt;&lt;td&gt;unsigned&lt;/td&gt;&lt;td&gt;imageWidth&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;(480)&lt;/td&gt;&lt;td&gt;Image dimensions in pixels.&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;&lt;td align=&quot;right&quot;&gt;12&lt;/td&gt;&lt;td&gt;unsigned&lt;/td&gt;&lt;td&gt;imageHeight&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;(320)&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;&lt;td align=&quot;right&quot;&gt;16&lt;/td&gt;&lt;td&gt;word&lt;/td&gt;&lt;td&gt;paperColor&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;(0x00ffffff)&lt;/td&gt;&lt;td&gt;The color beneath the bottom layer (0x00rrggbb).&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;&lt;td align=&quot;right&quot;&gt;20&lt;/td&gt;&lt;td&gt;unsigned&lt;/td&gt;&lt;td&gt;lastLayer&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;(0)&lt;/td&gt;&lt;td&gt;Index of the topmost layer; one less than the total layer count.&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;&lt;td align=&quot;right&quot;&gt;21&lt;/td&gt;&lt;td&gt;unsigned&lt;/td&gt;&lt;td&gt;activeLayer&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;(0)&lt;/td&gt;&lt;td&gt;Index of the layer active when file was saved.&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;&lt;td align=&quot;right&quot;&gt;22&lt;/td&gt;&lt;td&gt;byte&lt;/td&gt;&lt;td&gt;eventsMissing&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;(0)&lt;/td&gt;&lt;td&gt;External images cannot be stored in the event stream. If you try to open or paste JPEG/bitmap data, OC will warn you and set this to 1. Then all prior events are removed (!), leaving just the 8 header/end bytes.&lt;p&gt;What&apos;s odd is that, though OC refuses to export these flagged files, it continues writing events to them! Everything &lt;em&gt;after&lt;/em&gt; the last paste stays intact.&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;&lt;td align=&quot;right&quot;&gt;23&lt;/td&gt;&lt;td&gt;byte&lt;/td&gt;&lt;td&gt;reserved&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;(0)&lt;/td&gt;&lt;td&gt;Use unknown, but seems to show up in fancier images. Could well be some flags. Values observed: 0, 196, 197, 198, 204, 205 ...&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;&lt;td align=&quot;right&quot;&gt;24&lt;/td&gt;&lt;td&gt;unsigned&lt;/td&gt;&lt;td&gt;eventsLength&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;&amp;mdash;&lt;/td&gt;&lt;td&gt;Size of the event stream in bytes.&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;&lt;td align=&quot;right&quot;&gt;28&lt;/td&gt;&lt;td&gt;byte[4]&lt;/td&gt;&lt;td&gt;reserved&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;0&lt;/td&gt;&lt;td&gt;&amp;mdash;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;&lt;td align=&quot;right&quot;&gt;32&lt;/td&gt;&lt;td&gt;&amp;mdash;&lt;/td&gt;&lt;td&gt;layers&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;&amp;mdash;&lt;/td&gt;&lt;td&gt;One or more layers, as below. They are written in order: 0 .. &lt;em&gt;lastLayer&lt;/em&gt;, bottom to top.&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;&lt;td colspan=&quot;5&quot;&gt;&lt;hr width=&quot;85%&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;&lt;td align=&quot;right&quot;&gt;(layer+0)&lt;/td&gt;&lt;td&gt;byte&lt;/td&gt;&lt;td&gt;layerMode&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;(0)&lt;/td&gt;&lt;td&gt;Layer compositing mode, where:
&lt;table cellpadding=&quot;4&quot;&gt;
&lt;tr&gt;&lt;td&gt;0 = Multiply&lt;/td&gt;&lt;td&gt;: &lt;em&gt;r&lt;/em&gt; = &lt;em&gt;top&lt;/em&gt; ∙ &lt;em&gt;bottom&lt;/em&gt; / 255&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;1 = Add&lt;/td&gt;&lt;td&gt;: &lt;em&gt;r&lt;/em&gt; = min(&lt;em&gt;bottom&lt;/em&gt; + &lt;em&gt;top&lt;/em&gt;, 255)&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;2 = Subtract&lt;/td&gt;&lt;td&gt;: &lt;em&gt;r&lt;/em&gt; = max(&lt;em&gt;bottom&lt;/em&gt; - &lt;em&gt;top&lt;/em&gt;, 0)&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;
and the output is &lt;em&gt;bottom&lt;/em&gt; + &lt;em&gt;alpha&lt;/em&gt; ∙ (&lt;em&gt;r&lt;/em&gt; - &lt;em&gt;bottom&lt;/em&gt;) / 255 . Alpha comes from the layer; pixels have none of their own.
&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;&lt;td align=&quot;right&quot;&gt;(layer+1)&lt;/td&gt;&lt;td&gt;byte&lt;/td&gt;&lt;td&gt;layerAlpha&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;(255)&lt;/td&gt;&lt;td&gt;Layer alpha intensity; 0 leaves it invisible, 255 is fully blended.&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;&lt;td align=&quot;right&quot;&gt;(layer+2)&lt;/td&gt;&lt;td&gt;byte&lt;/td&gt;&lt;td&gt;layerVisible&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;(1)&lt;/td&gt;&lt;td&gt;Layer visibility; 0 to hide, 1 to show.&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;&lt;td align=&quot;right&quot;&gt;(layer+3)&lt;/td&gt;&lt;td&gt;byte[5]&lt;/td&gt;&lt;td&gt;layerReserved&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;0&lt;/td&gt;&lt;td&gt;&amp;mdash;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;&lt;td align=&quot;right&quot;&gt;(layer+8)&lt;/td&gt;&lt;td&gt;unsigned&lt;/td&gt;&lt;td&gt;layerPackedLength&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;&amp;mdash;&lt;/td&gt;&lt;td&gt;Length in bytes of the packed layer pixels.&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;&lt;td align=&quot;right&quot;&gt;(layer+12)&lt;/td&gt;&lt;td&gt;byte[]&lt;/td&gt;&lt;td&gt;layerPackedStream&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;&amp;mdash;&lt;/td&gt;&lt;td&gt;The layer&apos;s pixels. These are run-length encoded and run left-to-right, &lt;em&gt;bottom-to-top&lt;/em&gt; (don&apos;t ask, crazy Windows thing). The stream is a mixture of two types of packets:
&lt;table cellpadding=&quot;4&quot;&gt;
&lt;tr&gt;&lt;td&gt;&lt;em&gt;repeatCount b g r&lt;/em&gt;&lt;/td&gt;&lt;td&gt;where &lt;em&gt;repeatCount&lt;/em&gt; ≤ 120&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;em&gt;pixelCount b1 g1 r1 .. bN gN rN&lt;/em&gt;&lt;/td&gt;&lt;td&gt;where &lt;em&gt;pixelCount&lt;/em&gt; &amp;gt; 120 and N = 255 - &lt;em&gt;pixelCount&lt;/em&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;
It should be just long enough to fit in &lt;em&gt;layerPackedLength&lt;/em&gt; and fill &lt;em&gt;imageWidth&lt;/em&gt;∙&lt;em&gt;imageHeight&lt;/em&gt;&apos;s worth of pixels.
&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;&lt;td colspan=&quot;5&quot;&gt;&lt;hr width=&quot;85%&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;&lt;td align=&quot;right&quot;&gt;&amp;mdash;&lt;/td&gt;&lt;td&gt;byte[]&lt;/td&gt;&lt;td&gt;eventsStream&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;&amp;mdash;&lt;/td&gt;&lt;td&gt;Trailing after the layers is a stream of commands and brush strokes, recorded as the image was drawn. Extracting this should yield a valid event file (*.wpe)... see last year&apos;s &lt;a href=&quot;http://www.livejournal.com/users/draci/39313.html&quot;&gt;OC event notes&lt;/a&gt;.&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</description>
  <comments>http://draci.livejournal.com/64030.html</comments>
  <lj:music>McVaffe - Zelda 3 TheDarknessAndTheLight OC ReMix</lj:music>
  <media:title type="plain">McVaffe - Zelda 3 TheDarknessAndTheLight OC ReMix</media:title>
  <lj:mood>bouncy</lj:mood>
  <lj:security>public</lj:security>
  <lj:reply-count>2</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://draci.livejournal.com/63745.html</guid>
  <pubDate>Tue, 27 Jun 2006 08:13:11 GMT</pubDate>
  <title>FF: Still the Save&apos;n&apos;Boss to me</title>
  <link>http://draci.livejournal.com/63745.html</link>
  <description>And then, whilst fixing waffles and coffee, I caught my brain remixing Final Fantasy and Billy Joel.&lt;br /&gt;&lt;br /&gt;Huh, zilla? Anyone got a repro on that?</description>
  <comments>http://draci.livejournal.com/63745.html</comments>
  <lj:music>Shadow - Earthbound Funky Bookas OC ReMix</lj:music>
  <media:title type="plain">Shadow - Earthbound Funky Bookas OC ReMix</media:title>
  <lj:mood>amused</lj:mood>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://draci.livejournal.com/63735.html</guid>
  <pubDate>Mon, 26 Jun 2006 12:11:31 GMT</pubDate>
  <title>OMG Internets!: Not so OMG anymore?</title>
  <link>http://draci.livejournal.com/63735.html</link>
  <description>So, I noticed a few odd things lately.&lt;br /&gt;&lt;br /&gt;One was MySpace. Apparently as popular amongst teens as LJ, teachers have finally caught sight of it, and a month or two ago it found mention in the local newspaper. People are worried because the teens have found a public forum online, unsupervised by less educated adults.&lt;br /&gt;&lt;br /&gt;Not to mention the feds are on the snooping trail&amp;mdash;goddamned if pesky laws or an entire judicial branch are going to get in the way. Employers are getting online; reportedly they have been learning how to use Google. Some poor lady gets tied up in a child custody case for her Internets Church membership. Srsly. Even the homeless have email addresses.&lt;br /&gt;&lt;br /&gt;Now, I got on before MySpace or Google or Monster.com ever existed, very much still a teen. My parents never imagined there were any considerations to it, and barely understand the technology to this day. That is something I&apos;m thankful for, but it occurs to me that this is not an equilibrium state, and there just isn&apos;t anyone around who hasn&apos;t heard of the net anymore. It&apos;s no longer some super-seekrit place we can dance and romp and hang out (nevermind let it &lt;em&gt;all&lt;/em&gt; hang out.. -cough-) without worrying what the parents or boss think.&lt;br /&gt;&lt;br /&gt;It&apos;s not just a public-space issue either. Word is that headhunters have taken to using accounts on alumni sites, and other more private venues. LJ accounts are free, like many others. If anyone knew my SL name, I might fully expect to meet my future employer &lt;em&gt;in the purple&lt;/em&gt; there, even if they otherwise have no business playing. What if, as some have suggested, I had public scores on an XBox Live account? Then they can see my dedication to the latest episode of GTA or whatever.&lt;br /&gt;&lt;br /&gt;If this were a real blog, someone would rightly cut in at this point and say that this is all obvious, and WTF, dude, am I going on about? Of course publishing things means that other people will read them. It&apos;s just that I hadn&apos;t had to think too much about it before. T&apos;be honest, I&apos;m not sure what to do. Currently the situation is, my stuff is fairly public, and the parents (if maybe not the whole world) could find it if they really tried.&lt;br /&gt;&lt;br /&gt;It is public because I don&apos;t really want to hide. Doing so feels somehow dishonest, and makes me sad. I would rather people take me at face value, and I don&apos;t want shy creatures to have to ask to see a friends-only journal. I myself tend to pass over those. I also feel that the &quot;professional&quot; world is not nearly personal enough and that employees might be happier if they could foster such relationships without fear. (Though if mom&apos;s accounts are true, a lot of people are simply not mature enough...)&lt;br /&gt;&lt;br /&gt;However, discrimination makes me sad as well. There are laws against asking certain irrelevant things in a job interview, aimed at preventing it. What&apos;s changed is that with the internet, &lt;em&gt;they don&apos;t have to ask&lt;/em&gt;.&lt;br /&gt;&lt;br /&gt;Yeah, I realise these are kinna scattered thoughts. Why is this a problem for me anyway?&lt;br /&gt;&lt;br /&gt;Thing is&amp;mdash;I promised some family I&apos;d get last week&apos;s photos put online. Having known me before, I doubt the kids and maybe an uncle or two would gawk much, but the other adults are set in their ways. So posting them on this account is out of the question. That&apos;s a shame, seeing as I have gigs of space available. LJ remains fantastically generous...&lt;br /&gt;&lt;br /&gt;Sucks. I&apos;m not even sure I want to use my current emails since they might be linked in some obscure way.&lt;br /&gt;&lt;br /&gt;I know of at least two artists on FA who voiced similar concerns over the subjects of their artwork. Both of them are using alter-egos... a third, fairly well known, recently took his gallery down. All of their technique was amazing no matter what you think of the subject, and in an ideal world should have reflected positively.&lt;br /&gt;&lt;br /&gt;I&apos;m not sure where I&apos;m going on this. I wish I did. But I&apos;ll have to think about it if I want to be less isolated. :/</description>
  <comments>http://draci.livejournal.com/63735.html</comments>
  <lj:mood>concerned</lj:mood>
  <lj:security>public</lj:security>
  <lj:reply-count>1</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://draci.livejournal.com/63342.html</guid>
  <pubDate>Fri, 09 Jun 2006 05:09:13 GMT</pubDate>
  <title>Kah flees the state.</title>
  <link>http://draci.livejournal.com/63342.html</link>
  <description>G&apos;dammit... OpenCanvas&apos; networking has taken to taunting me. Some 30-60 minutes in it&apos;ll just stop reading data from everyone else, so I&apos;m effectively bumped out of the session, even though it&apos;s receiving it. Naturally this happens as soon as I really get into it.&lt;br /&gt;&lt;br /&gt;So, I guess there&apos;s my motivation. I want a replacement, and I know roughly how I want it to work. I&apos;ll prolly try and think on the class design for a few days. I&apos;ve been flailing way too much with microscopic C++ issues, so maybe the trip will be an opportunity to step back from the compiler, and work out something minimal and reasonable on paper. (I honestly don&apos;t think anything on the level of OC should be more than 3-5,000 lines of code.)&lt;br /&gt;&lt;br /&gt;Wait, Kah, &lt;em&gt;trip&lt;/em&gt; you say? What trip? Gah. Some relatives from the east coast are having a wedding up in Delaware, and we were all invited. It&apos;s a fifteen-hour drive. Yeeeesh. Since past the first day we will probably be bored beyond belief, we&apos;re doing a day of driving each way, and a day at the wedding. So I leave in 3-4 hours (x..x!) and get back &lt;em&gt;on my birthday&lt;/em&gt;, e.g. Sunday. Double-yeeesh!&lt;br /&gt;&lt;br /&gt;Honestly I&apos;m tempted both ways... it would be a peaceful relaxing weekend at home with the parents gone, but I need to get out too. Total tradeoff. For better or worse, I haven&apos;t seen these people in years. That will be nicely awkward. Wheeee.&lt;br /&gt;&lt;br /&gt;So, I&apos;ll see you all in a few days.</description>
  <comments>http://draci.livejournal.com/63342.html</comments>
  <lj:music>rushjet - Final Fantasy Prelude.nsf</lj:music>
  <media:title type="plain">rushjet - Final Fantasy Prelude.nsf</media:title>
  <lj:mood>awake</lj:mood>
  <lj:security>public</lj:security>
  <lj:reply-count>2</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://draci.livejournal.com/63128.html</guid>
  <pubDate>Thu, 01 Jun 2006 05:52:56 GMT</pubDate>
  <title>Stupid C++ tricks</title>
  <link>http://draci.livejournal.com/63128.html</link>
  <description>I was staring at all the getters and setters in my GUI classes, boring things like:&lt;blockquote&gt;&lt;pre&gt;struct Blah {
    Point p1, p2;
    Point&amp;amp; p1() { return p1; }
    Blah&amp;amp; p1(const Point&amp;amp; newPt) { p1 = newPt; return *this; }
    ...
}&lt;/pre&gt;&lt;/blockquote&gt;And although I don&apos;t really mind the foo() and foo(newValue) syntax, or alternately getFoo() and setFoo(...), it is not as clear as plain assignment. To my amusement, I discovered today that it&apos;s possible to replicate the property syntax of certain other languages which shall remain unnamed. :-)&lt;br /&gt;&lt;br /&gt;The idea is that all your properties are public member objects. Calling &lt;code&gt;operator=&lt;/code&gt; with the appropriate type will call the setter to change the property, and attempting any explicit or implicit cast to the same type (&lt;code&gt;operator &lt;type&gt;()&lt;/code&gt;) calls the getter to read it.&lt;br /&gt;&lt;br /&gt;Now if that were all, you could define a class for every property, with those operators, and be done with it. But it&apos;s far too awkward. It would be nice to have a template, with constructors to use existing getters and setters, fabricate new ones for simple &quot;field access&quot;, or even the ability to use &lt;code&gt;boost*::lambda&lt;/code&gt; (!)...&lt;br /&gt;&lt;small&gt;* The &lt;a href=&quot;http://www.boost.org/libs/libraries.htm&quot;&gt;Boost&lt;/a&gt; libraries are incredibly snazzy. However, they may disturb your notion of C++ as a language.&lt;/small&gt;&lt;br /&gt;&lt;br /&gt;&lt;a name=&quot;cutid1&quot;&gt;&lt;/a&gt;&lt;blockquote&gt;&lt;pre&gt;#include &amp;lt;boost/bind.hpp&amp;gt;
#include &amp;lt;boost/function.hpp&amp;gt;
#include &amp;lt;boost/lambda/lambda.hpp&amp;gt;

template&amp;lt; typename ClassT, typename PropT &amp;gt; class Property {
public:
	typedef boost::function&amp;lt; void(PropT&amp;amp;) &amp;gt; Setter;
	typedef boost::function&amp;lt; PropT() &amp;gt; Getter;
	typedef boost::function&amp;lt; void(ClassT*, PropT&amp;amp;) &amp;gt; MemberSetter;
	typedef boost::function&amp;lt; PropT(ClassT*) &amp;gt; MemberGetter;

	Property() {}
	
	Property(const Property&amp;amp; src) {
		*this = src;
	}
	Property&amp;amp; operator=(const Property&amp;amp; src) {
		get = src.get;
		set = src.set;
		return *this;
	}
	// Construct with custom getters and setters
	Property(const Getter&amp;amp; newGetter, const Setter&amp;amp; newSetter)
		: get(newGetter), set(newSetter)
	{}
	// Construct with member getters and setters
	Property(ClassT* thisptr,
			const MemberGetter&amp;amp; newGetter, const MemberSetter&amp;amp; newSetter)
		: get(boost::bind(newGetter, thisptr))
		, set(boost::bind(newSetter, thisptr, ::_1))
	{}
	// Construct with member data reference
	Property(PropT&amp;amp; member)
		: get(boost::lambda::var(member))
		, set(boost::lambda::var(member) = boost::lambda::_1)
	{}
	// If rvalue of the property type requested, return getter&apos;s value
	operator PropT() {
		return get();
	}
	// If assigned with the property type, call setter and return same value
	PropT operator= (PropT newValue) {
		set(newValue);
		return newValue;
	}

protected:
	Getter get;
	Setter set;
};&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;With this in hand, there are three ways to construct a Property. The first two can go in the ctor initializer list, but it&apos;s probably easier to dedicate a method called from all constructors.&lt;blockquote&gt;&lt;pre&gt;// Read/write member; takes a reference
Property&amp;lt;Class,PropT&amp;gt; myprop(_memberdata);
// Calls static functions, functors, or lambdas
Property&amp;lt;Class,PropT&amp;gt; myprop(getter, setter);
// Calls member functions
Property&amp;lt;Class,PropT&amp;gt; myprop(this, mem_fn(&amp;mygetter),
                                   mem_fn(&amp;mysetter));
&lt;/pre&gt;&lt;/blockquote&gt;I also made a classical braindead Point class to try it out. Unfortunately I wasn&apos;t able to get nontrivial lambdas working under MSVC.&lt;br /&gt;&lt;br /&gt;&lt;a name=&quot;cutid2&quot;&gt;&lt;/a&gt;&lt;blockquote&gt;&lt;pre&gt;#include &amp;quot;Property.hpp&amp;quot;
#include &amp;lt;iostream&amp;gt;
#include &amp;lt;iomanip&amp;gt;
#include &amp;lt;boost/mem_fn.hpp&amp;gt;
#define _USE_MATH_DEFINES
#include &amp;lt;math.h&amp;gt;

using namespace std;
using namespace boost;

template&amp;lt;typename T&amp;gt; class Point {
protected:
	typedef Point&amp;lt;T&amp;gt; Pt;

	T _x, _y;

	T getT() { return atan2(_y, _x); }
	T getR() { return sqrt(_y*_y + _x*_x); }

	void setTR(T t, T r) { _x = r*cos(t), _y = r*sin(t); }
	void setT(T&amp;amp; t) { setTR(t, getR()); }
	void setR(T&amp;amp; r) { setTR(getT(), r); }

public:
	Property&amp;lt;Pt, T&amp;gt; x, y, t, r;

	Point(T newX, T newY)
		: _x(newX), _y(newY), x(_x), y(_y)
		// Questionable, but looks nicer. Note, *this is not accessed.
		, t(this, mem_fn(&amp;amp;Point::getT), mem_fn(&amp;amp;Point::setT))
		, r(this, mem_fn(&amp;amp;Point::getR), mem_fn(&amp;amp;Point::setR))
	{
		// Stupid, but more correct.
		//t = Property&amp;lt;Pt,T&amp;gt;(this, mem_fn(&amp;amp;Point::getT), mem_fn(&amp;amp;Point::setT));
		//r = Property&amp;lt;Pt,T&amp;gt;(this, mem_fn(&amp;amp;Point::getR), mem_fn(&amp;amp;Point::setR));
	}

	friend ostream&amp;amp; operator&amp;lt;&amp;lt;(ostream&amp;amp; str, const Point&amp;lt;T&amp;gt;&amp;amp; p) {
		str &amp;lt;&amp;lt; &amp;quot;(&amp;quot; &amp;lt;&amp;lt; p._x &amp;lt;&amp;lt; &amp;quot;, &amp;quot; &amp;lt;&amp;lt; p._y &amp;lt;&amp;lt; &amp;quot;)&amp;quot;;
		return str;
	}
};


int main() {
	Point&amp;lt;double&amp;gt; p(5, 6);

	cout &amp;lt;&amp;lt; &amp;quot;New point p&amp;quot; &amp;lt;&amp;lt; p &amp;lt;&amp;lt; endl;
	cout &amp;lt;&amp;lt; &amp;quot;  p.x == &amp;quot; &amp;lt;&amp;lt; p.x &amp;lt;&amp;lt; endl;    // 5
	cout &amp;lt;&amp;lt; &amp;quot;  p.y == &amp;quot; &amp;lt;&amp;lt; p.y &amp;lt;&amp;lt; endl;    // 6

	p.x = 3, p.y = 4;
	cout &amp;lt;&amp;lt; &amp;quot;Assigning p.x = 3, p.y = 4&amp;quot; &amp;lt;&amp;lt; endl;
	cout &amp;lt;&amp;lt; &amp;quot;  p   == &amp;quot; &amp;lt;&amp;lt; p &amp;lt;&amp;lt; endl;    // (3, 4)
	cout &amp;lt;&amp;lt; &amp;quot;  p.r == &amp;quot; &amp;lt;&amp;lt; p.r &amp;lt;&amp;lt; endl;    // 5
	cout &amp;lt;&amp;lt; &amp;quot;  p.t == &amp;quot; &amp;lt;&amp;lt; p.t &amp;lt;&amp;lt; endl;    // 0.927295

	p.r = 10, p.t = M_PI;
	cout &amp;lt;&amp;lt; &amp;quot;Assigning p.r = 10, p.t = M_PI&amp;quot; &amp;lt;&amp;lt; endl;
	cout &amp;lt;&amp;lt; &amp;quot;  p   == &amp;quot; &amp;lt;&amp;lt; p &amp;lt;&amp;lt; endl;    // (-10, 1.22461e-015)
	cout &amp;lt;&amp;lt; &amp;quot;  p.r == &amp;quot; &amp;lt;&amp;lt; p.r &amp;lt;&amp;lt; endl;    // 10
	cout &amp;lt;&amp;lt; &amp;quot;  p.t == &amp;quot; &amp;lt;&amp;lt; p.t &amp;lt;&amp;lt; endl;    // 3.14159
	return 0;
}&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Now it&apos;s possible to treat p.x, p.y, p.r, p.t as either lvalues or rvalues, even though they aren&apos;t simple members. This should also work with copy/assignable class types.&lt;br /&gt;&lt;br /&gt;Heheh, anyway... yeah, it&apos;s probably more trouble than it&apos;s worth; the dispatch is done at runtime (not a problem if you&apos;re using setters tho) and you have to remember to initialize the properties. Maybe some more macro/template abuse would help. I&apos;m not wizardly enough to tell.&lt;br /&gt;&lt;br /&gt;Still, it&apos;s kinna cool that you can do these things if you really, really want to.</description>
  <comments>http://draci.livejournal.com/63128.html</comments>
  <lj:mood>awake</lj:mood>
  <lj:security>public</lj:security>
  <lj:reply-count>2</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://draci.livejournal.com/62745.html</guid>
  <pubDate>Sat, 27 May 2006 23:23:00 GMT</pubDate>
  <title>Spaghetti code for fun and profit?</title>
  <link>http://draci.livejournal.com/62745.html</link>
  <description>Something I&apos;ve been wondering for awhile.&lt;br /&gt;&lt;br /&gt;Discussions of the Halting Problem tend to talk about the paradox of a program that asks about itself, and then contradicts the answer. But that doesn&apos;t seem very interesting except as a proof! I&apos;d really like, say, a program which is surprisingly difficult to pry apart and understand, or to make some desired modification without screwing it up.&lt;br /&gt;&lt;br /&gt;For example, I hear some UNIX vendors sold systems with the source code, filtered so it was an obfuscated mess. You could compile and run it, but it would have been more effort to do your own dev work. Another one are viruses that decrypt themselves. This is still pretty primitive since either way, the machine language winds up as &quot;plaintext&quot; in memory anyway, and then you can just fire up your hardware debugger...&lt;br /&gt;&lt;br /&gt;So is it possible to foil even that? Say you have the parse tree for some C++, is there some way to preserve &lt;em&gt;what it does&lt;/em&gt; while seriously obscuring &lt;em&gt;how it does it&lt;/em&gt; after compilation, and without requiring prior decryption? Preferably this would have to be many-to-few sort of thing, so you couldn&apos;t tell what a construct represented in the source, and semi-randomized. It should be a like a hash, where many bits of code depend on many other bits of code&amp;mdash;dependencies, self-modification and side effects everywhere.&lt;br /&gt;&lt;br /&gt;Now I don&apos;t suppose this would be all that useful, except for the really paranoid of the closed-source folks. More of a joke otherwise... heh! Maybe in that vein a C-to-&lt;a href=&quot;http://www.madore.org/~david/programs/unlambda/&quot;&gt;Unlambda&lt;/a&gt; or &lt;a href=&quot;http://www.catb.org/~esr/intercal/&quot;&gt;Intercal&lt;/a&gt; or even &lt;a href=&quot;http://en.wikipedia.org/wiki/Befunge&quot;&gt;Befunge&lt;/a&gt; compiler would work... XD&lt;br /&gt;&lt;br /&gt;Other than that, I can&apos;t think of a good way to do it. Ahwell.</description>
  <comments>http://draci.livejournal.com/62745.html</comments>
  <lj:music>Nobuyuki - Axl Rose</lj:music>
  <media:title type="plain">Nobuyuki - Axl Rose</media:title>
  <lj:mood>amused</lj:mood>
  <lj:security>public</lj:security>
  <lj:reply-count>2</lj:reply-count>
</item>
</channel>
</rss>
