EntBlog
Code, 3D, Games, Linux and much more...
Compile-Time Strings
April 28, 2009 @ 23:19 | In CodeGems, Programming | 6 Comments |
It would be nice if we had such a feature in the C language, wouldn’t it? The term ‘compile-time string’ is referred here as strings that are converted to unique integer identifiers at compile time. At run-time those identifiers are simple integers that can be compared and hashed very fast. In other languages, like for example Smalltalk, the concept of Symbol implements a similar idea. The following post describes a possible implementation of this feature in C/C++.
Click to read the full article
Andrew Glassner’s Notebook
March 9, 2009 @ 1:52 | In Books | 1 Comment |
Andrew Glassner’s Notebook
Author: Andrew Glassner
Pages: 304
Published: 1999
During periods in which I need to stay focused in hard technical problems I try to avoid reading dense books because they distract me from my work. I found this book in my bookshelf, in the stack of unread books :), and decided to skim it a little bit. “This book is about having fun with computer graphics”, that’s the beginning of this book written by Andrew Glassner (editor of the mythical The Graphics Gems series, when the gem series were not a virus, and the classic Principles of Digital Image Synthesis among others). As soon as I started to read the first chapter I couldn’t stop.
I was expecting to find a book very similar to the Jim Blinn series, the Jim Blinn’s Corner. And although the structure and the origin is the same, a compilation of articles published by Glassner in a column of the bimonthly magazine IEEE Computer Graphics & Applications, this book is radically different to other books about graphics and mathematics. No formulas, no algorithms, no code in this book. Instead, you will learn about origami and the platonic solids and the teapotahedrom, how to organize the LCD segments of a digital display, the phenomenon of moiré patterns, designing tiles that are aperiodic (I didn’t know it was possible) or even how to layout box designs in a single piece of cardboard. After reading this chapter, the next time you unpack a box from Amazon you will pay attention to those little details that usually pass unnoticed.
Apart from the old revised chapters you can find columns that were never published too. Disparate topics, but all of them related to graphics and 3D in some sense. The visual quality of the book is excellent with all the pages in full color and the style of the author is even better. Andrew Glassner is among the best writers in the Computer Graphics field.
I give my full recommendation to this book. Andrew Glassner’s Notebook will appeal to both novice readers and experienced mathematicians.
Rating: 8 / 10
Planet 51 Trailer
January 16, 2009 @ 11:26 | In Internet, Personal, Videogames | 2 Comments |

Since the first day I saw content from Planet51 I knew it was going to rock. I am emotionally attached to this movie because I worked in the Videogame for a few months and because I have worked in the past with several member of the technical team that is behind the movie. I know first hand they are very talented people.
And finally, the trailer is now live: Planet51 trailer!
Congratulations to all the team. All the best for them.
Stripping comments from Shader bytecodes
January 15, 2009 @ 21:37 | In CodeGems, Programming | 1 Comment |
In DirectX, when compiling a shader with D3DXCompileShader() a buffer containing the shader bytecodes is received. Apart from the bytecodes, extra content like debug and symbol table information is embedded. That extra information is added in form of comments that probably can be eliminated because you are already processing it at compile-time and it is not needed at run-time when loading the shader.
If you can do without that information the following code will help you to save a few bytes, even halving the size of the byte-code in the best cases.
Although not documented in the DirectX SDK, this CodeGem is not an undocumented hack. The Direct3D shader code format is documented in the MSDN, so it probaly won’t change in future revision of DirectX v9.0 (if there is going to be any more…)
D3DPtr<ID3DXBuffer> StripComments(const D3DPtr<ID3DXBuffer>& code) { // Calculates the new size (without comments) int* codeData = static_cast<int*>(code->GetBufferPointer()); unsigned int sizeInWords = code->GetBufferSize() / 4; unsigned int strippedSizeInWords = sizeInWords; for (unsigned int i = 0; i < sizeInWords; i++) { if ((codeData[i] & 0xffff) == D3DSIO_COMMENT) { int commentSize = codeData[i] >> 16; strippedSizeInWords -= 1 + commentSize; i += commentSize; } } // Creates a new buffer with the original code but omitting the comments D3DPtr<ID3DXBuffer> strippedCode; V(D3DXCreateBuffer(strippedSizeInWords * 4, strippedCode.GetPtrForInit())); int* strippedCodeData = static_cast<int*>(strippedCode->GetBufferPointer()); size_t offset = 0; for (unsigned int i = 0; i < sizeInWords; i++) { if ((codeData[i] & 0xffff) == D3DSIO_COMMENT) { int commentSize = codeData[i] >> 16; i += commentSize; } else { strippedCodeData[offset++] = codeData[i]; } } return strippedCode; }
Three free productivity booster tools
December 20, 2008 @ 17:30 | In Internet, Programming | 4 Comments |
We, as programmers, see optimization opportunities everywhere, and more when they can be applied to our work tool, the computer. What follows is an enumeration of three tools that will save you precious time in your daily work. To me, they have become indispensable tools. Hope they will become the same for you:
- Launchy. Launchy is a keystroke launcher that clones the behaviour of Quicksilver in Mac OS. With this tool you will say goodbye to your start menu and desktop icons. Everything is now accessible from a few keystrokes: folders, applications and even websites, all with a simple alt + space. The perfect complement for Launchy is StartKiller, a tool for removing the Start button from the taskbar. To me, Launchy is as revolutionary as 4DOS was back in MS-DOS days. How much time did you save? (bonus: and now that you can have a 100% clean desktop it is time to use a decent wallpaper…).
- AutoHotkey. Whatever can not be done with a few launchy keystrokes most likely can be programmed with an AutoHotkey macro. AutoHotkey incorporate a powerful script language that will allow you to automate almost anything: instant access to disk folders, internet tabs, activate tray programs, change visual studio layouts, send email, check calendar, etc.
- xplorer². xplorer² is a file manager with enough features to say good bye to Windows Explorer (Microsoft, admit it, it is not designed for advanced file manipulation). Although there is a professional version, the free lite version is enough to me, especially the Tabbed dual-pane interface feature. With AutoHotkey you can easily redirect Win + E to xplorer².
And that closes out my small contribution to reduce energy wastage in the world
. I am sure you can share more gems like these. One more time, thanks for reading.
Hacker’s Delight
November 4, 2008 @ 4:56 | In Books, Hacking, Programming | 11 Comments |
Hacker’s Delight
Author: Henry S. Warren, Jr.
Pages: 306
Published: 2003
You may think that I have become obsessed with books about hacking but this book is totally different from any of the others. In this book the term hacker is meant in the traditional sense (before the negative definition was popularized) of someone interested in understanding how things work and how to solve problems efficiently. Although the hacker term can be applied to whatever domain, in this book the domain is computing technology.
‘Hacker’s Delight’ is a book about bits and small programming tricks applied to machines. With ’small’ I mean that you won’t find here a description of the Merge sort or Radix sort but, for example, you will learn to determine in constant time if an integer is a power of two or not.
In more that 300 pages and with a mixture of pseudo assembler and C you will find all kind of tricks for arithmetic bounds, counting bits, searching bits, multiplications, elementary functions, floating point, etc. Even wondered if the base2 used by computers is the most efficient? This question and a lot more are covered in this book.
Although the book is a little bit oriented towards compiler developers, every ‘real’ programmer can get a huge benefit from reading and thoroughly understanding this book.
I read this book on several flights and really enjoyed this little gem book of tricks. I would definitely recommend to have it in your bookshelf.
Rating: 8 / 10
Tangential Software Usage
September 30, 2008 @ 9:30 | In Internet, Programming | 6 Comments |

As you probably know I am working in a very small (3) team through internet. We do not share a physical place and we have very limited resources. All the infrastructure is based on servers we have at our own home (code repository, wiki, bug tracking service, build machines, web server, backup machines, NAS servers, etc). As you can imagine, we try to optimize our time and bandwidth as much as possible. I want to share with you in this post two examples of this optimizing philosophy with the idea of discussing them and discovering other interesting usages you may be doing (if you want to share of course)
- Twitter: I like to know where the rest of the team is working on. We have weekly voice meeting, we have emails and IM accounts but that is not enough to know with precision where each part is working on. Twitter, a micro-blogging service you probably know is ideal for this purpose. We have private twitter accounts (nobody out of the team can read it) where we update or current status: developing a new package, fixing a ticket, writing documentation, meeting a client, etc. With a simple look at your twitter account you get the status of the team.
-
Dropbox: I am absolutely impressed with this software. If you don’t know about it I recommend that you have a look at its tutorial. The service is incredibly simple to use and it just works without problems. We have created a dropbox account for internal distribution and testing of our binary releases. Our build machine copy each generated distribution to a shared dropbox folder. This dropbox folder is shared with our team giving us the following advantages:
- Every member on the team have the binaries everywhere and in all machines we want to test.
- Logs for each execution are saved in the shared folder and are automatically synchronized in all the accounts. The logs give us useful information about the execution of the software that every developer can inspect.
- Crashes are stored as minidumps in that same folder. And, as we distribute pdb with our releases, this means that everybody in the team can open any dump from any release and reproduce the exact crashing conditions everywhere. For more information about symbols, read my previous article about Setting up a Symbol Server
Do you have more interesting related ideas? Please, share them with us.
Practical Efficient Memory Management
August 19, 2008 @ 3:26 | In Programming | 27 Comments |

A good memory management architecture is one of those key features that can make the difference between a successful application and an unsuccessful one. For realtime applications the memory architecture becomes critical. This article discovers how memory management is more than tracking where your malloc() and free() are located. Although the focus will be on realtime applications implemented in C, all the techniques described here can be translated to other scenarios because the terms described are language-independent.
The best memory management is doing no allocation at all. You should architect your software to minimize the interaction with the memory manager. In the past that was a realistic option but in modern architectures that objective becomes harder to achieve. Modern requisites for realtime architectures like, for example, content streaming or hot loading force us to have frequent interactions with the memory manager. This article describes how this can be done efficiently. The ideas provided plus the links to other articles will give you enough information to implement your own solution. No downloadable code is provided with this article but if you need help implementing the ideas described here do not hesitate to contact the author.
Click to read the full article
GameLab 2008
June 27, 2008 @ 2:01 | In Programming, Videogames | 8 Comments |

Oviedo will hold the fourth edition of the GameLab conferences on July 10th - 11th. Undoubtedly the place to be if you want to meet lot of interesting people related to the Videogames industry. This event is growing bigger and bigger each time and is becoming a point of reference here in Spain.
Like the last year I will be giving a course on Advanced real-time 3D techniques the first day.
Hope to see you there!
The Art of Intrusion
May 10, 2008 @ 18:48 | In Books, Hacking | 9 Comments |
The Art of Intrusion
Author: Kevin D. Mitnick & William L. Simon
Pages: 349
Published: 2005
Kevin Mitnick is one of the most famous hackers in the world. In the 80’s he was able to break the most secured systems and computers getting lot of private information. In 1995, with lot of controversy, he was arrested.
After five years in prison and as a logical maturation process, he changed sides and became a computer security consultant. A “white” hacker.
This book is about “real” hacking stories that have been contrasted by Mitnick himself. Although all the stories are presented as real, all the relevant details are altered so that nobody can try the same hack again.
This book got to my hands, months ago, while I was in a library. A first look at the book revealed interesting technical details of each episode and lots of external web links with more information. So I decided to buy it. This book can be perfectly read by a person without computer knowledge although the book is targeted to techy readers.
The book is structured in ten episodes about hacking, cracking, phreaking and social engineering. Some stories are greatly exaggerated to be believable (for example, I think that the story about social engineering is absolutely 100% fiction) but others (like the one about cracking) are incredible believable with lots of technical information about the details. It is hard to believe that those details are being invented. Working in a big Video-Game Studio (at least when I wrote this article), one detail that made me smile was in the episode about cracking. In that chapter the hacker being interviewed reveals that their team was successfully able to break most of the big Video-Game companies. Probably there are lots of fantasy elements in all of this, but my intuition tells me that there is something real under the hood…
The book is very easy to read and if you have spare time I recommend it. Probably I will read the book Mitnick wrote before this: The Art of Deception. It is getting quite good reviews.
Rating: 7 / 10
Fri, 03 Jul 2009 06:07:33 +0200 / 21 queries. 1.984 seconds / 1 User Online
|
|
|
|
|
Theme modified from Pool theme. Valid XHTML and CSS



Previous Page
About
Categories