Category Archives: programming

What DirectX 12 means for gamers and developers – PC Gamer

Abstraction is good for developers, right? Why else would you be programming in high-level languages like C++, Go, Python instead of assembly language? Well, it turns out the situation is not so straightforward for game programming.

In terms of graphics programming, after years of high-level graphics API, the trend has been to go as close to metal as possible (Apple’s Metal, OpenGL reborned as Vulkan, and now DX12). This article does a very good explanation of why this is happening.

In a way, this is a manifestation of the break-down of Moore’s law – at least in terms of clock-speed improvements. Games are among the most demanding type of applications in terms of performance, and for years we have been riding along the wave of “free” performance thanks to Moore’s law. In case you haven’t noticed, the party has ended. That, combined with increasing performance of the GPU, means we can no longer get free performance from CPU alone. Someone has to do the work to manage the GPU+CPU dichotomy and ensure that the “pipeline is full” so as to speak. Thankfully game engines are now taking on that role, but the graphics API needs to allow them to have full access to the low level capabilities.

Hint: it’s exciting. Expert Peter “Durante” Thoman takes a technical deep dive into the promising potential of DX12.

Source: What DirectX 12 means for gamers and developers – PC Gamer

Cracking JXcore… Again |

JXcore butchered. Twice. Ouch.

Besides being quite easy to reverse engineer, the central flaw here is that they still don’t obfuscate your source code! It’s sitting there in its original form, ready for easy extraction by anybody that you distribute your application to. I mentioned obfuscation in my previous article on JXcore and I’ll repeat that assertion here: obfuscation is the only reasonable protection to defend high level source code from reverse engineering. Nothing can prevent reverse engineering, but good obfuscation can raise the cost substantially.

Source: Cracking JXcore… Again |

Main is usually a function. So then when is it not?

A break from the usual cybersecurity stories. Here’s a nice one on obfuscated C, if you can call it that.

$ cat test.c
const int main[] = {
-443987883, 440, 113408, -1922629632,
4149, 899584, 84869120, 15544,
266023168, 1818576901, 1461743468, 1684828783,
$ gcc test.c -o a.out
$ ./a.out
Hello World!

Yes I tested and it works. Want to know how it works? Here’s the link:
Main is usually a function. So then when is it not?.

“Easter egg” on Mozilla Developer website

Not sure if it qualifies as an easter egg, but visiting Mozilla developer website like this with your console open and you’ll get the following message:

           7''  Q..\
        _7         (_
      _7  _/    _q.  /
    _7 . ___  /VVvv-'_                                            .
   7/ / /~- \_\\      '-._     .-'                      /       //
  ./ ( /-~-/||'=.__  '::. '-~'' {             ___   /  //     ./{
 V   V-~-~| ||   __''_   ':::.   ''~-~.___.-'' _/  // / {_   /  {  /
  VV/-~-~-|/ \ .'__'. '.    '::                     _ _ _        ''.
  / /~~~~||VVV/ /  \ )  \        _ __ ___   ___ ___(_) | | __ _   .::'
 / (~-~-~\\.-' /    \'   \::::. | '_ ` _ \ / _ \_  / | | |/ _` | :::'
/..\    /..\__/      '     '::: | | | | | | (_) / /| | | | (_| | ::'
vVVv    vVVv                 ': |_| |_| |_|\___/___|_|_|_|\__,_| ''

Hi there, nice to meet you!

Interested in having a direct impact on hundreds of millions of users? Join
Mozilla, and become part of a global community that’s helping to build a
brighter future for the Web.

Visit to learn about our current job openings.
Visit for more ways to get involved and
help support Mozilla.


Splitting Thunderbird mailbox

Mozilla Thunderbird uses the mbox format, which makes it incredibly portable and easy to process. Unfortunately, it also means that all of your messages within a Thunderbird folder is in single file*. This can cause problems if you keep using a folder for many years. For instance I have a mbox file that is >1GB and it’s mounted in a network share. Opening, modifying, backing up takes quite a while. I finally gave up and decided to do something about it.

I wanted to organize my mailbox by year, while preserving its folder organization. A quick online search did not find anything I can use. So I whipped up my trusty PHP and wrote this.

Usual disclaimer applies.

* I’m simplifying here. If your folder contains subfolders, each subfolder actually has it’s own file

All software have bugs. Period.

I’m recently reminded of this old article by Josh Bloch when dealing with some of our clients. Some people can’t seem to accept that software can have bugs and software can crash (note: in this case it’s not our software). For those of them, I leave them with the following quote from the article I mention:

We programmers need all the help we can get, and we should never assume otherwise. Careful design is great. Testing is great. Formal methods are great. Code reviews are great. Static analysis is great. But none of these things alone are sufficient to eliminate bugs: They will always be with us. A bug can exist for half a century despite our best efforts to exterminate it. We must program carefully, defensively, and remain ever vigilant.

via Extra, Extra – Read All About It: Nearly All Binary Searches and Mergesorts are Broken.

If we can’t even get a “simple” binary search working bug-free – by someone with such distinguished credentials – what hope is there for the rest of us for getting complex software to work correctly 100% of the time?

Alexander Brevig : The //* /*/ //*/ comment toggle trick

Just saw this on HN. Alexander Brevig : The //* /*/ //*/ comment toggle trick.

I’ve been using something very similar – the only difference between the last comment //*/ vs /**/


This technique is surprisingly “portable” – works in C++, Javascript, PHP, amongst others. And it works better than if (0) { someFunction(); } else { someOtherFunction(); } ‘cos syntax-highlighting works.

Another trick that I’ve used by abusing comments is to produce output that are both valid Javascript as well as HTML – at least to most browsers:

//<html><body>some text</body></html>

In Javascript context it’ll show a “hello” prompt, whereas in HTML context it’ll show “// //some text”. This can be used when say you’re returning a Javascript API and someone is misinterpreting it as HTML. You can of course be creative about the “some text” part. 🙂