Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 08 Sep 2001
Offline Last Active May 16 2011 08:03 AM

Topics I've Started

Javascript access to html text

30 December 2008 - 07:00 AM

So I have this HTML table which contains a slew of these:
<td id="id_0_0">
   <div class="b0000">
where ??? is a textual representation of an integer. What I would like to do is get read-only access to that text in javascript. Is this possible?

Unicode in MessageBoxW

24 July 2008 - 02:33 AM

I'm trying to do localization stuff, I pull a unicode string (currently in Russian) out of a file, and I try to do something with it:
const wchar_t * theString = TextManager.Get("ERROR_MSG");

MessageBoxW(gHWND, theString, theString, MB_OK);
The message box that comes up has a series of boxes in it (signifying unrecognized characters). I have russian installed on my machine, and I can type in russian into the text database files. The strings will display in-game with the text-renderer, and if I copy-paste the hex into a word document it displays correctly. Sadly I need this to work outside the renderer because the message may be 'We could not create the renderer' (equivalent). I suspect I'm missing something obvious.

Getting a parse tree in C++

04 March 2008 - 04:27 AM

I've been looking for a way to get a C++ parse tree, I know GCCXML lets you do this, but I don't want to go through installing GCC. I'm using Visual Studio 2008, and I'm comfortable with python, so I searched for Visual C++ Parse Tree, and python C++ parser, and a bunch of other stuff but no luck. Any thoughts? It strikes me as something very useful to have, I'd be surprised if the compiler can't output the parse tree.

An approach for NPR outlines using vertex shaders

02 January 2008 - 02:03 PM

I don't have a working shader environment to test this idea, so I thought I might toss it out here and see what happens. This is a dual pass render. First pass: front-faces filled, your choice of non-photo-realistic (NPR) shading Second pass: back-faces filled, vertex shader displaces each vertex like so:
scale = length(vertex_position - camera_position);
vertex_position += normal * scale * CONSTANT;
the constant tunes the width of the border. the pixel shader associated with this vertex shader just draws black (or whatever color outline you want) pixels. In this way the geometry of the rendered object is bloated from its original shape so that it forms a border. Will this work? it will make strange shapes at sharp corners, and the border will likely appear to have irregular width in some places, to solve the latter problem, the displacement of the vertices could be along the normal projected into the plane perpendicular to the view direction.

From dice to continuous random numbers...

23 December 2007 - 03:08 AM

A while back I developed a PnP RPG combat ruleset. I'm trying now to implement an analogue of this ruleset programmatically. Assuming I have a good random number generator, and I can map values to the [0,1] range then probabilities can be used very sensibly. A simple example: Predication about the value k on 1Ds: probability of less than k: k/s probability of equal-to k: 1/s probability of greater than k: (s-k-1)/s So while working on the translation, I came across an interesting (IMO) problem; in the ruleset, certain successes are measured like so: roll 5D6, count the number of rolls r >= 4, this number is the result. I wondered how to generate a single random number and map that to how many rolls are equal or greater to 4. So on first blush, this is my approach: for nDs, number of rolls GREATER than k. let P = (s-k-1)/s : the probability that one particular roll is greater than k, So probability that every roll is a success is P^n probability that n-1 rolls is a success is P^n-1 and so on... now I'm stuck though, how do I go on to combine these probabilities to get a partition on [0,1] that maps to some number of successes that would be equivalent to counting the dice? Bonus quesiton; is this worth it? I could just compute the predicate n times and count the successes, would that be faster than going through the process of preparing a partition and generating only one random number.