Skip navigation.

exploreopera

| Help

Sign up | Help

Software Development

Correcting The Future

Refactoring (Updated)

One night, I was listening to Coast to Coast AM and they had Neal Adams as the guest. Neal Adams is best known for his work on Batman and Green Arrow. He was asked how come movies have such a hard time with their heroes, but comic books really have done a good job? What Neal said really surprised me. He said back in the early days, every single idea no matter how good or bad was tried. EVERYTHING!!! Not one single idea was left unturned. If an artist had an idea, it was tried. So it did not take long that new and original ideas were hard to come by until it became very difficult for new artists to get something published. He also said that none of the heroes we know today exist as they did originally. So basically, everything stems from really bad ideas.

How can this be? How could every single comic book hero come from bad ideas? Neal discussed more of the process. They would have limited trial runs. Many of these became limited editions collectors items if the comic was later picked up for general publication. If they did not do well, they were scrapped. Those that did well, the heroes evolved over time depending on the readers' response to them. He mentioned so many examples that I can hardly remember any of them. One example that everyone knows about is that Superman could originally only jump over tall buildings. Today, he can fly and even turn back time.

Read more...

Lego Robot that Solves Rubik's Cube

I'm a big fan of the 80's, especially the Rubik's Cube. This blew my mind. In fact, my mind is still blown over this. Check it out.

Tilted Twister

D3D: Drawing Transparency Front to Back

In a previous article, I showed how you can draw from front to back using OpenGL. Here is the final set of equations that we used for blending. S is the source and D is the destination.

D[B] += S[B] * D[A]
D[G] += S[G] * D[A]
D[R] += S[R] * D[A]
D[A] *= S[A]


Source and destination are in precomputed format. A precomputed format is where you apply the following transformation.

B *= A
G *= A
R *= A
A = 1-A


A on the right hand side is the original Alpha value. All values are relative to 255. So 128 for alpha would actually be 128/255 in all the above equations. D3D takes care of all this for you automatically.

You do not need to convert all your images beforehand to precomputed format. Instead, you can use the fixed function pipeline to precompute your image on the fly.

  // Set texture for texture stage 0
  pD3DDevice->SetTexture(0,pMyTexture);

  pD3DDevice->SetTextureStageState(0,D3DTSS_COLOROP,D3DTOP_MODULATE);
  pD3DDevice->SetTextureStageState(0,D3DTSS_COLORARG1,D3DTA_TEXTURE|D3DTA_ALPHAREPLICATE);
  pD3DDevice->SetTextureStageState(0,D3DTSS_COLORARG2,D3DTA_TEXTURE);
  pD3DDevice->SetTextureStageState(0,D3DTSS_ALPHAOP,D3DTOP_SELECTARG1);
  pD3DDevice->SetTextureStageState(0,D3DTSS_ALPHAARG1,D3DTA_TEXTURE|D3DTA_COMPLEMENT);

  pD3DDevice->SetTextureStageState(1,D3DTSS_COLOROP,D3DTOP_DISABLE);
  pD3DDevice->SetTextureStageState(1,D3DTSS_ALPHAOP,D3DTOP_DISABLE);


This should work on ALL video cards no matter how old. Then we would apply the alpha blending equations.

Read more...

More on Project V's Type System

I'll start off by warning the reader that if you ever get a crazy idea like designing a type system, may I suggest to STOP! Drop what you are doing. Take a step back. And knock some sense into yourself. It's pure insanity. There are no rules to go by. There are no guidelines. Oh sure, you can redo what is already out there, but the quest for elegance will prove irresistible. And it's mostly for naught.

Anyhow, one thing I learned quickly is that a type system on paper is quite different than one that has been implemented and put to use. In any case, now that I have type comparisons nearly done completely, I thought I'd share some details. I'm also writing this now to make sure I didn't miss anything. It's better I do that now than realise later I've implemented something that can't be easily changed. Note that implementing the type system is by far the biggest obstacle out of all this. I could have done something simple, but apparently I'm a sucker for punishment.

Ok, onto the details.

Read more...

To Compiler and Debugger Writers

Ok, so if you're on a Windows XP box and you're developing something like a compiler or debugger, you're gonna need some tools, right? Tools like an API for loading and unloading modules. Tools that let you inspect symbols and line information stored in the debug section of your object and exe files. Tools that let you query what module, what source file, what line number a certain function that caused a breakpoint or bad memory allocation occurred. Tools that let you walk the stack and display a stack trace. These are things that compiler and debugger writers need to deal with. Even people who just want self inspecting code will need this stuff.

So I'm going along doing all of this. And as a good little boy, I didn't make my own tools though I nearly ended up doing so trying to work around the problems I was getting. I'm using the Borland C++ Builder compiler because it has properties and closures and I don't feel like writing extra code to enable a feature I've been using for ages. So BCB it was. Only problem is that it uses a different name mangling scheme to MS. Not only that, but Borland doesn't output CodeView debug format that Windows debugging API wants. So I wrote some code that converts Borland debug format to CodeView format. I got some of this code online, but it worked badly and didn't work for the newer versions of Borland. I also output line numbers which wasn't available in the original online code.

So I'm good to go, right? I can add this to my code to automatically check for memory leaks and see where each and every allocation and deallocation is made. All this isn't so much for the final product of Project V as it is a standard set of tools I've used for ages on larger projects for personal use to make life easier. It's basically like having a debugger within your application that tells you right away if anything is wrong. And for those who dislike debuggers, this is useful to find out WHERE the error is. Not to fix it.

Read more...

Couple Links

A few posts from an author who is tackling the topic of why software fails. Only four articles there so far, so start from the beginning (at the bottom) if you go there.

Metaphor Crash

Excellent presentation (talk, audio only). I wish I had the visual presentation material, but it's not necessary. This is definitely the future of computing.

Why Can't a Computer Be More Like a Brain?

update:

Nice presentation (video). Has a some nice and smart strategies about how to produce anything from software to manufacturing that may not be well known.

Competing on the Basis of Speed

update July 2:

Via Slashdot,
Thousands of Cores

OH YEAH!

Computability

What is computability? Computability is the ability to obtain a result from a set of inputs for a specific objective. Simple operations are additions, multiplication, etc. Sorting is another example. So what is needed to be able to compute everything that is computable?

Alan Turing created a mathematical model of his Turing machine which is described as being able to compute anything that is computable. What it does not say is what is required to satisfy this requirement. This means there are many mathematical models that are equivalent. Before getting into that, let's look at what operations are required by a Turing machine to be truly universal.

  • Ability to hold a state.
  • Ability to select where next data item comes from.
  • Ability to select where output is stored.
  • Boolean algebra (enables AND, OR, NOT, ADD, SUB, MUL, DIV, REM, etc.)

Read more...

Battlestar Galactica: The Final Cylon

Everyone has a theory about the final five Cylons, so I thought I’d present mine.

Read more...

Massively Parallel Code

Parallel programming will come in many forms. Right now, most people think of multicore systems as the main type of parallel programming. However, I don't think this will be the way of the future. In the past, I said things will get smaller and faster and more numerous. Before we get there, there is an alternative and I've somewhat discussed it on a prior date. It's to have massive amount of data being transformed by the exact same piece of code. That's why I'm really fascinated by 3D hardware. In every image operation, the same set of operations is done on each and every pixel. Before that, each and every vertex is operated upon by its own, but identical, set of operations.

Why is this important? Anyone that's taken a parallel computing course knows that there are four types of computing.

1. SISD
2. SIMD
3. MISD
4. MIMD

Read more...

Who Is The Safe Choice For The White House? (Updated May 11, 2008)

I wanted to crunch some numbers just for fun. I'm a Canadian and do not care who wins. I'll state up front that I'm a big fan of Bill Clinton. But I wanted to put my personal feelings aside and see who would be the best choice. I've tried to put Hillary at a disadvantage. Even though I think she can win WA and OR, I went strictly with the numbers with a few exceptions explained below.

Here is the map between the Democrats and Republicans this year where each party is certain to win their respective states. Blue is where both Obama and Hillary would win against McCain by 5% or more. Red is where McCain would win by 5% or more against both Obama and Hillary.

(edit May 11, 2008: Hillary now leads by 6% in Oregon. Oregon is now safe Dem)

(US Map taken from WikiMedia commons.)


Read more...

July 2008
SMTWTFS
June 2008August 2008
12345
6789101112
13141516171819
20212223242526
2728293031