Archive for the ‘rants’ Category.

C++11?

The C++0x standard has been approved by ISO/IEC. This probably means that we’re going to be calling this iteration of the language C++11.

It amazes me how much of the language and the standard library people don’t use already. And I mean the C++98 stuff that has been around for 13 fracking years! True, there are professional developers that decide to use a specific subset of the language, or in some situations some design decisions are “inherited” by programmers working on an existing body of code… but I’m not bitching about them (much!) I’m talking about programmers and their new projects and sample code. New programmers (usually university or high school students) don’t learn about most of C++ because their teachers don’t know them and that almost all programming books on C++ suck (sometimes, it’s not the author’s fault; C++ is just too vast and complex.) More “experienced” programmers usually learn about a subset of the language and form a “comfort zone” and stay in there; because anything out of that zone will upset them. The bad thing is that this C++ comfort zone is – more often than not – way too small.

It might (or might not) include good polymorphism and class hierarchies (which I don’t like, incidentally) but almost always it does not include any meaningful use of generic programming, higher order and (some vestiges of) functional programming, attention to memory and layout (I believe many non-trivial programs have ran or are running into address-space limitations as we speak,) exception-safe and exception-correct programming, development of domain-specific mini-languages, real scalability and thread-correctness, etc.

Of course, everybody is free to program the way they want or can. I’m not the one to judge. All I’m saying is that even in the single language we use, there is much that we don’t take advantage of (let alone using other languages that might be more suitable for a job.)

Now, enters a new and feature-rich standard of C++ into an already starved expertise pool. There are so many real features and improvements in this iteration of the standard that they could overwhelm at the first glance. There is (just off the top of my head) r-value references and perfect forwarding, lambdas, variadic templates, compile-time constant expressions, user-defined literals, better enumerations, typedefing templates, initializer lists, better control over inherited methods, better control over compiler-generated class methods, finally some semblance of class- and method-specific directives (alignment, etc.,) extern templates, forwarding constructors, initializing class data members upon declaration, auto and decltype keywords for type inference and whatnot, (oh, I almost forgot!) the cool and hip new way of declaring the return type of a function, and much more.

The above features are just the ones that I could recall right now and in the core language only. I need and want to use these features, additions and improvements right now. They all make my code better and my life easier. These are not some obscure features for practitioners of “black magic”. They benefit the likes of you and I, not language lawyers, but people with real applications and real problems.

I guess what I’m saying is that as a C++ programmer, you should not be afraid of experimenting with the new features today. Don’t wait for the books or libraries and frameworks to pick them up. Books will take years and they will be all wrong and useless anyways (of course, with a couple of stellar exceptions.) Again, only with a few exceptions, libraries and frameworks will be burdened with incompetence, corporate politics, backward and forward compatibility and compiler compatibility (with the most brain-dead compilers. Please don’t rely on Qt or wxWidgets or whatever to do your C++ for you. Please don’t wait for Deitel and Deitel to teach you C++.

Start with Wikipedia. Read various texts and tutorials and overviews that uncle Google finds for you. Start experimenting and teaching yourselves the new features of C++11; and any of the old feature-set that you might be rusty about. It’s a great time for C++, as it is now a better language than it ever was. It’s probably the best general purpose programming language out there for people with actual hardware limitations on their applications. And it can do practically everything. (Also, C++ supports the widest range and mixture of programming paradigms of any programming language that I know of.)

Notes: I have three points to add to the above rant.

First is about the advancements in the standard library. They are much more substantial and accessible for the lazy programmer (I don’t use the term “lazy programmer” as a negative phrase!) as most of the additions are already available with the most popular compilers, or even in Boost if your compiler doesn’t have them yet or if you don’t like your compiler vendor’s standard library! I’m much less enthusiastic about the new C++ standard library features simply because most of them have been available as part of Boost for years and therefore are hardly new. Still exciting, though!

Second. No compiler that I work with has support for all or even most of the new core language features, although GCC is close (not to “all”, but it is close to “much”.) The state of support in Microsoft’s Visual C++ is closer to pathetic. Intel C++’s condition is not much better either. A partial table of the state of support for various new features of the language across quite a few compilers can be found here. Right now, I (and probably everyone else) would suggest using GCC. Get your hands on 4.7 if you can, or use 4.6 or even 4.5. Good luck!

It seems that I’ve forgotten my third note! Maybe it’d come to me later.

VN:F [1.9.13_1145]
Rating: 10.0/10 (4 votes cast)
VN:F [1.9.13_1145]
Rating: +4 (from 4 votes)

Of Pursuit of Programming in Universities

I was reading this post on the AltDevBlogADay and noticed how similar it was to my own experience. The writer’s point is how removed most of academia is from the real world (at least in the programming world) and he relates a couple of anecdotes from his own past. It’s a short and funny read (specially the part about the floating-point number format in memory. I mean, talk about bad bad misinformation, not to mention the idiocy!)

Anyways, near the end of the post, he mentions that he somehow figured out that all the things his professors said were not the truth, the whole truth and nothing but truth. I remember exactly how and when this happened to me.

It was the first semester in my university (which was an absolutely mediocre one.) In the software engineering program over there, there was an “Introduction to Programming” for the first semester, and an “Advanced Programming” (or something like that) course for the second. Back then (in 1999) they taught Pascal in the introductory course and C++ in the advanced. My Pascal teacher was a young guy. A pretty decent teacher and academic (and quite orderly!) Those days, the way to program in Pascal on DOS/Windows and not get into the whole mess of Object Pascal and VCL was to use Borland Pascal (or Turbo Pascal,) which ran on DOS and was primarily targeted to that platform. Not that this was a bad thing, because most (almost all) of the students were unfamiliar with UNIX and programming for Windows was… well, is a mess.

Anyways, when he was teaching Pascal, he mentioned a few times that if you do this or that, the compiler will issue warnings. This was a bit puzzling for me, since I had been using Turbo Pascal for 3-4 years then and I had never seen anything like warnings being issued by the compiler! It either gave errors, or it compiled the code happily. It should be obvious for any programmers in the audience what the problem was by now, but of course, before then I had never actually written any C/C++. My experience was limited to some BASIC variants (Commodore, GW, Q, Visual (shudder),) Pascal and some Assembly. But I was beginning to dabble in C, in anticipation for the next semester and it suddenly became obvious to me that our instructor did no Pascal programming himself. He just had C experience and had read some books on Pascal!

There were many more incidents like this with many more teachers; little mistakes that would absolutely never happen if they had any real experience, and not book knowledge. (I should mention here that not all my teachers were like that. Some of them were surprisingly on top of the subject they taught, e.g. the white-haired 60-year old associate professor who taught Assembly!) I started resenting some of my teachers for their blatant ignorance and shamelessness. In time though, I learned that all of them knew stuff that I didn’t know and could learn. That’s when the university became much more tolerable. I only had to treat all important information the same way: with a grain of saltdoubt, no matter the source.

VN:F [1.9.13_1145]
Rating: 7.3/10 (7 votes cast)
VN:F [1.9.13_1145]
Rating: 0 (from 4 votes)

Imagine No Religion…

World Trade Center Towers on August 26th, 2001

VN:F [1.9.13_1145]
Rating: 8.5/10 (12 votes cast)
VN:F [1.9.13_1145]
Rating: +5 (from 11 votes)

پیام من به قضاوت‌کنندگان گرشاسپ

بازی گرشاسپ که حاصل تقریباً 4 سال عمر بعضی از ماست، کمتر از یک هفته‌ی پیش به بازار عرضه شد. نظرهای بازی‌بازهای ایرانی در مورد گرشاسپ کم و بیش مثبت بوده، ولی انتقادهای برنده و گاهی عجیبی هم در موردش دیدیم که در نگاه اول ناامید کننده، ولی در نهایت مسرت‌بخش هستند. شاید در فرصتی دیگر به دلیل مسرت‌بخش بودن این انتقادها هم بپردازم.

روی صحبت من با همه‌ی کسانی است که گرشاسپ را می‌بینند و نه فقط انتقاد کنندگان. من کاملاً به حق شما برای انتظارِ دیدن یک بازی کامل و بی‌نقص احترام می‌گزارم. من با جدیت تمام عقیده دارم که حق همه‌ی ما به عنوان بازی‌باز این است که بدون هیچ قید و شرطی بهترین بازی‌های ممکن را بازی کنیم. ولی گاهی کمی واقع‌گرا و منطقی بودن هم بد نیست.

مثلاً بودجه‌ی گرشاسپ را در نظر بگیرید. کل هزینه‌ی صرف شده برای تولید گرشاسپ (به اضافه‌ی سوشیانتِ ناکام) و تبلیغات و شرکت در نمایشگاه‌های داخلی و خارجی به 300 میلیون تومان هم نمی‌رسد (این عدد فقط حدس و تقریب شخصِ من است.) این یعنی حدود 300000 دلار (برای راحت‌تر شدن مقایسه‌ها در ادامه‌ی بحث همه‌ی عددها را به دلار بیان می‌کنم.) این عدد را با بودجه‌های بازی‌های مطرح دنیا (اصطلاحاً AAA) مقابسه کنید:

  • Gears of War: $15M
  • Modern Warfare 2: $50M
  • Killzone 2: $45M
  • Gran Turismo 5: $80M
  • Metal Gear Solid 4: $60M
  • God of War III: $44M
  • Assassin’s Creed: $18M
  • Assassin’s Creed 2: $25M
  • Bioshock: $15M
  • Halo 3: $55M
  • Grand Theft Auto 4: $100M

دقت کنید که از ساخت بعضی از این بازی‌ها چندین سال می‌گذرد. همچنین توجه داشته باشید که اعداد بالا تقریبی و فقط شامل هزینه‌ی تولید هستند و نه هزینه‌های تبلیغات و بازاریابی و توزیع، وگرنه هزینه‌ی تمام شده‌ی بازی‌ای مثل Modern Warfare 2 به عدد باورنکردنی 200 میلیون دلار می‌رسد!

بیایید از فاکتورهایی مثل ساخته‌شدن بیشتر این بازی‌ها برای چندین دستگاه و کنسول مختلف، باتجربه بودن همه‌ی این شرکت‌ها و تازه‌کار بودن ما، هزینه‌های بازاریابی که معمولاً بیشتر از هزینه‌های تولید هستند و مانند این‌ها صرف نظر کنیم. تعدادی از متخصصان و باتجربه‌های صنعت بازی در جهان معتقدند که یک بازی بزرگ و مطرح جهانی برای اینکه هزینه‌های خود را جبران کند و اصطلاحاً “سربه‌سر” شود باید حدود یک میلیون نسخه بفروشد. با توجه به قیمت معمول بازی یعنی حدود 60 دلار (حالا شما با توجه به انواع تخفیف‌ها 50 دلار فرض کنید،) یعنی یک بازی AAA حدود 50 میلیون دلار هزینه دارد. باز فرض کنید نیمی از این عدد هم هزینه‌های بازاریابی و توزیع باشد (که معمولاً بیشتر از این حرف‌هاست) پس می‌توان فرض کرد که یک بازی مطرح در جهان حدود 25 میلیون دلار هزینه‌ی تولید دارد. این عدد را به یاد داشته باشید.

بخش بزرگی (تقریباً همه‌ی) هزینه‌ی تولید به صورت مستقیم و غیر مستقیم برای نیروی انسانیِ سازنده‌ی بازی صرف می‌شود (یعنی دستمزد و غیره.) دستمزد دست‌اندرکاران بازی‌سازی در ایران حدوداً بین 12000 دلار و 24000 دلار در سال است (1000 تا 2000 دلار در ماه.) این عدد برای بقیه‌ی دنیا حدوداً 50 تا 100 هزار دلار در سال است که می‌شود حدود 4.16 برابر. یعنی بازی‌سازی در ایران حدوداً چهار و شانزده صدمِ برابر ارزانتر تمام می‌شود، پس باید بودجه‌ی ساخت یک بازی جهانی را بر 4.16 تقسیم کنیم. 25 میلیون تقسیم بر این عدد می‌شود کمی بیشتر از 6 میلیون دلار. یعنی در تئوری، برای تولید یک بازی مثل بازی‌های نام‌برده شده در ایران باید حدود 6 میلیون دلار هزینه شود.

کلِ بودجه‌ی گرشاسپ یادتان هست؟ 300 هزار دلار. یعنی یک بیستمِ مقداری که بنا بر نُرمِ جهانی باید برای این بازی هزینه می‌شد! حالا از همه‌ی شما بازیکن‌ها و طرفداران و منتقدین گرشاسپ خواهش می‌کنم این عدد را همیشه به خاطر داشته باشید. یعنی کیفیت گرشاسپ باید 20 برابر بدتر از بازی‌های روز جهان باشد. یعنی طول بازی، تعداد ویدیوها، تعداد کاراکترها، کیفیت مدل‌ها و صداها باید 20 برابر کمتر و پایین‌تر و تعداد باگ‌ها و crashها و مشکلات مورد انتظار باید 20 برابر بیشتر از آن‌ها باشد. اگر گرشاسپ از این مقدار مورد انتظار بهتر و بالاتر ظاهر می‌شود، یعنی ما کار خود را خیلی خیلی خوب انجام داده‌ایم.

تازه از منظر دیگری هم می‌شود به قضیه نگاه کرد و آن هم قیمت محصول برای مصرف‌کننده است. یک بازی AAA در جهان در حدود 60 دلار قیمت دارد، در حالی که قیمت گرشاسپ بین 3 تا 3.5 دلار است. اگر شما بازی‌های خارجی را به قیمت واقعی می‌خریدید، آن‌وقت قدرِ واقعی بازی‌های ایرانی را می‌دانستید و می‌توانستید درست و منطقی در مورد آن‌ها قضاوت کنید. باور کنید که در این دنیا در همه‌ی زمینه‌ها هر چقدر که پول بدهید آش و سوپ و لازانیا می‌خورید. (این حقیقت که قیمت پایین بازی در ایران نه تنها تولیدکنندگان، بلکه مصرف‌کنندگان و بازی‌بازها را هم نابود می‌کند باید مثل روز بر همگان آشکار باشد. اگر می‌گویید نه، تا آن‌لاین شدن و غیرِ قابلِ کرَک شدنِ همه‌ی بازی‌ها صبر کنید!)

من و بقیه‌ی دوستانم در تیم سازنده‌ی گرشاسپ به کار خود افتخار می‌کنیم و به هیچ وجه شرمنده و عذرخواه نیستیم. درست است که ما می‌دانیم که گرشاسپ اصلاً بی‌مشکل و بی‌ایراد نیست و می‌شد و می‌توانستیم خیلی بهتر از این را هم بسازیم، ولی این نگرشِ ایده‌آلیستی تقریباً در مورد هر محصولی و در هر زمینه‌ای و در هر زمان و مکانی صادق است.

من فقط از شما می‌خواهم که کمی منطقی و منصفانه فکر و قضاوت کنید؛ همین.

VN:F [1.9.13_1145]
Rating: 9.0/10 (22 votes cast)
VN:F [1.9.13_1145]
Rating: +21 (from 31 votes)

Fibonacci Numbers and Bad Teachers

Recursion is a fascinating and essential idea in mathematics, programming and design (among other things.) As a programmer, if you don’t understand this very simple idea (and I mean really understand it) you are pretty much done for. While it’s not a hard concept for any half-intelligent person to grasp, I don’t exactly know how many of us really do grasp it. But it’s not what I’m going to bitch about today.

In programming courses, one of the first examples used to introduce the idea of recursion is the Fibonacci sequence. You know, the series of integers starting with 0 and 1, where every next number is the sum of the two previous ones. (OK, I know that you do know. I was just covering all my bases.)

Anyways, the most simple and elegant introductory way of implementing a function that returns the nth number in the Fibonacci series goes something like this:

1
2
3
4
5
6
7
// Just making things clear!
typedef unsigned long long Integer;
 
Integer Fib (unsigned n)
{
	return n < 2 ? n : Fib(n - 2) + Fib(n - 1);
}

And every half-descent programmer knows that that’s probably one of the worst ways you can implement the idea. I’m not kidding. The teachers just throw this at the students, and the brighter of the students see the elegance and simple beauty of it and it will take years for most of them to realize the problems with this particular implementation. Some of them never do. This implementation performs very poorly for even the small values of n, which of course should be apparent when you contemplate its time complexity and recursion tree (I won’t go into space considerations, because they are not much of a problem until n goes into (many) thousands, at which point the value of the function becomes larger than you can store naively in most languages, which means you should have already given space considerations a serious thought.)

But even later, when the students learn about complexity analysis and Big O notation and crap like that, more often than not, they fail to apply the newly acquired knowledge to the old beliefs. If the teacher is good, and the student is bright and lucky enough, they walk out of their algorithm and data structure course with the new belief that bubble sort is bad, hash tables are good, and disk seek times dominate everything else (all of which are obviously bullshit in the absolute sense.)

For the more astute reader, I need to clarify that the badness of the mentioned implementation stems from the fact that most common languages (including C++) are mainly side-effect-driven languages, in that they rely mostly on the side-effects of expressions and statements to get the intended job done (the usage of the term “statement” is a clear sign of that.) Otherwise, you wouldn’t see so much assignment in our code. A functional and side-effect-free programming language (or more accurately, programming model) could easily cache the result of each invocation of the Fib function for any particular n (because the function call would be without side effects and therefore time-invariant) and would not need to evaluate any Fib(n) more than once. This is something that is being done in some of the better implementations of functional languages, AFAIK.

To emulate this behavior in this case, one can use a hand-coded version of what is known as Memoization, a la:

1
2
3
4
5
6
7
8
9
10
11
12
13
Integer Fib (unsigned n)
{
	static std::vector<integer> Mem;
	if (n < Mem.size() && 0 != Mem[n]) return Mem[n];  // The second condition is redundant, right?
 
	Integer ret = n < 2 ? n : Fib(n - 1) + Fib(n - 2);
 
	if (n >= Mem.size()) Mem.resize (n + 1, 0);
	Mem[n] = ret;
 
	return ret;
}
</integer>

This is not a bad implementation. It does have some issues in multithreaded applications, but I'm willing to overlook that for now. This implementation is linear in both time and space, and it can be faster than simple non-recursive implementations because it never calculates any Fib(n) more than once over the whole lifetime of the process. But it's not pretty (it has its charms, though!) and this way of doing things is error-prone (because you are adding memory and bookkeeping to a mathematical construct that is otherwise free of this stuff.) Not to mention that it is basically impossible to use as an introductory example; because it needs knowledge from all over the map.

A better implementation might be:

1
2
3
4
5
6
7
8
9
10
11
12
13
std::pair<integer , Integer> _fib (unsigned n)
{
	if (n < 2) return std::make_pair(n, 0);
 
	std::pair<Integer, Integer> Fn_1 = _fib(n - 1);
	return std::make_pair(Fn_1.first + Fn_1.second, Fn_1.first);
}
 
Integer Fib (unsigned n)
{
	return _fib(n).first;
}
</integer>

Of course, the meat of this implementation (such as it is) is the _fib function. The other one is just there to present a nicer and more consistent interface. Let me be the first one to say that there are more ways to implement a better Fibonacci and still stay essentially recursive. This is just one way, and not a particularly great one. But it's not bad either.

Now, how come no programming instructor ever teaches the likes of this implementation? Not the ones I studied under, at least. Are they afraid that their students' heads are going to explode? PROGRAMMING IS HARD PEOPLE! If a programmer can't handle a substantial improvement over a bad implementation of a simple idea, they are in for a big (and not at all nice) surprise. I hereby beg any teachers, instructors, professors and whatnot that have anything to do with teaching starting programmers to quit treating them like idiots, because idiots won't make good programmers. The idiots are not going to understand what they need anyways, so why take the chance of profound understanding from those who have the capacity to learn, but might not if you treat them like babies?

For the sake of completeness, here's a non-recursive implementation:

1
2
3
4
5
6
7
8
9
10
11
12
13
Integer Fib (unsigned n)
{
	if (0 == n) return 0;
 
	Integer last = 1, penultimate = 0;
	for (unsigned i = 1; i < n; ++i)
	{
		penultimate += last;
		std::swap (last, penultimate);
	}
 
	return last;
}

This is the fastest of implementations offered here, with the exception of the memoizing one (and only in amortized sense.) But nothing prevents us from applying the memoization technique to an iterative implementation as well, albeit not in a general and automatic way. It might not be apparent or significant in such a simple sample, but for some class of problems, recursive solutions are usually easier to devise and understand, and therefore easier to get right. In any case, nothing is clear-cut when it comes to programming, and I'm almost offended when people (specially people who should know better) behave as if almost everything is.

VN:F [1.9.13_1145]
Rating: 8.0/10 (6 votes cast)
VN:F [1.9.13_1145]
Rating: +2 (from 4 votes)

.NET and I

I learned C# in 2000, when the compiler and tools were still in beta (I think. I know I was working with the beta, but maybe the finals were released unbeknownst to me (hehehe! The Firefox spellchecker does not recognize “unbeknownst”!))

I remember that I liked the language. It was clean and relatively compact, it had a largish and useful library, it was like C++ and Java (benefit? really?) and it had a command-line compiler. My impression at the time was that it was more suitable for small and quick programs, and very suitable for teaching programming. I even suggested it to my teachers at university as a replacement for Pascal, which was then thought as the first language to CE students (this was maybe 4 years before I met Lisp, or better yet, Python.) This was also before the whole .NET fucked-up-ness happened with all the WinForms and ASP.NET and whatever other shit they are peddling these days. In those days, .NET and C# produced console applications, unless you ventured into the river of diarrhea output that is the Win32 GUI API; but that was pretty much what you generally had, back then.

Anyways, my shallow and brief delving into the world of .NET was barely deep enough for me to familiarize myself with the inner workings of MSIL and the JIT compiler and the virtual machine. I learned little about these, and I have not kept up with the new developments in .NET, and I have no regrets there. I generally hate GUIs and network technologies that aim to solve all problems on all levels for everybody. They may suit some, and I have absolutely no doubt that many .NET-based applications wouldn’t have been as easy-to-write for other libraries and runtimes1. But I don’t generally like .NET and this opinion (I suspect) would be very hard to change.

The most obvious reason for this obvious dislike is the one I mentioned above. .NET is the champion of the all-for-all thoughtcrime. More than anything else that I have seen, it tries to do all for everyone and everything; without giving them an inkling of what the hell is really going on on any level below the most superficial. This may suit some, but it shouldn’t.

I seriously believe that every programmer needs to know what’s going on under the hood. Total abstractions almost never work beyond the most simple and trivial cases2. If you don’t know jackshit about your platform and your programs seem to have worked so far, you are just lucky. Let me give you an analogy. If you don’t know anything about how cars work and you drive one, when your cars breaks down in the middle of nowhere and you have no means of communication, the you are royally fucked. The fact that this has not happened so far, it just means that the Random Number Gods have smiled upon you so far. It may never happen, but it just as well might. That’s the way it is with programming. Except that the level of quality discrepancies among software and hardware products that you use is much wider.

All programming languages abstract the platform in some form and manner. But as some languages hide not much and what they hide, they do with much shame and much apologies (Assembly, C, etc.) others do as much as they can to distance you from the hardware. They even boast this feature!

In short, every good programmer that I know and I know of knows the whole stack of software and hardware underneath deeply and intimately. In fact, it might even be true that the better they know this mess, the better they are3.

Let me conclude now. I am not saying that technologies like .NET and Java and all those “high-level” languages are useless. I’m just saying they make it harder to be conscious about the actual platform and the rest that lies under your code. I’m pretty certain that the best .NET programmers can pretty much generate the MSIL code and the machine code that their compiler and the JIT compiler generate for any given part of their code. Maybe you should too.


1: Note that I don’t use the word “platform” here, and any other use of the word for a software technology in unintentional and a result of the force of (a bad) habit. No software is a platform; hardware is. It’s always the hardware that runs the code, and the hardware is always the platform. If you think otherwise, I believe you are the subject of the same kind of conditioning that has affected most of us.

2: Read this post on Joel Spolsky’s great (yet now sadly dormant) blog for the original presentation of the Law of Leaky Abstractions. Also read the Wikipedia page (and then the talk page for an interesting discussion.) Also read this Coding Horror post for a hilarious (well, not really!) example. Fuck LINQ!

3: I don’t believe that it’s this knowledge that they acquired first and it magically made them good programmers. I think on the way of becoming good, they had to acquire this knowledge. I have to ponder this a bit more.

VN:F [1.9.13_1145]
Rating: 8.0/10 (5 votes cast)
VN:F [1.9.13_1145]
Rating: +3 (from 5 votes)

There Should Be Dancing Around a Bonfire!

This should be no news to anybody who has anything to do with writing and distributing C/C++ applications on Windows, but Microsoft has finally decided to drop the fucking SxS shit for Visual C++ 2010 CRT and go back to the sweet old days of plain, distributed-alongside-your-application DLL files! (Read here if you don’t believe me! I don’t know how far one can trust MSDN and how long that link will stay valid (I mean, how hard is that?! Keep your stupid fucking links valid, you idiot douche bags!) but there it is for now, and I have verified it on VC2010 RTM.)

How fucking twisted is that?! I’m actually rejoicing because we are going back to DLL Hell! But after experiencing the abyss of WinSxS Hell, I would happily crawl back to the open and only mildly tormenting depths of the good old DLL Hell. This means that I will (hopefully!) never ever have to mess around with ass-busting manifests and colossally subtle version conflicts and hunting down every single gods-damned version of every single fucking-gods-damned CRT component that might or might not have been subject to some whimsical patch by the morons at Microsoft in the past year, in one or other version of Windows. This means that I will just distribute the fucking version of the CRT that seems to barely work alongside my applications (that is, in the same directory) and it will probably (say 30% instead of 1e-10%) work, and no one will be able to override their usage behind the poor hapless user’s back (using conventional methods; that is. Everybody knows how easy it is to hijack a function call into a DLL in Windows; which I have to say is not necessarily a bad thing.)

And don’t anyone dare ask me why I link to CRT as a DLL in the first place, instead of a statically linked LIB!

P.S. I have decided to write as I think (regarding the usage of curse words.) So no more fraks and friggins and butts and backsides. Deal with it.

VN:F [1.9.13_1145]
Rating: 8.3/10 (6 votes cast)
VN:F [1.9.13_1145]
Rating: +2 (from 4 votes)

Smith, the Ascendant

“Oh God!”
“Smith will suffice.”

VN:F [1.9.13_1145]
Rating: 6.4/10 (5 votes cast)
VN:F [1.9.13_1145]
Rating: +2 (from 4 votes)

The Problem

Religion is harmful. Throughout history so much conflict, war and misery has been caused by organized religion that religious people hardly even see it. They probably attribute it to human nature, or “other religions.”
I believe, and I think people would agree if they think about it, that religion has been the most effective and most used tool for mass conditioning and mass brain-washing. It has always brought an illogical imbalance to societies and has caused endless strife and animosity within them.
I’m not talking here about the wrongness of the concept of religion. All religion is bullshit, and all religion that divides people based on any criteria (believers and non-believers, sinners and saints, etc.) is harmful and must be treated as a disease of mind, but I’m not here to try to prove what seems to be obvious if you forget your childhood upbringing and conditioning. What I’m talking about is the danger and destructive effect of systematic, organized and political religion.

You look at human history, and almost every time there has been a war or oppression or genocide, it has had its roots in religion, in one way or the other. But, you might object, religion has brought happiness and peace of mind to billions. Well, while the extent of the happiness and the number of people affected by it is debatable, it can’t be denied that religious beliefs have been beneficial to many. But so has been the cartoons made by Disney! Have they not brought joy and happiness to hundreds of millions or perhaps billions, too? And there hasn’t been any wars or mass murders or tortures caused by a Walt Disney film. We must start analyzing the benefit/harm ratio of religions rationally.

So for some reason, among all the works of fiction it has been religion and religious materials that have gained special attention and have been given special status. Why? I don’t know. Maybe they have had more time with our collective brains to turn them into mush and turn us into brainless zombies. Maybe if you think about religion in terms of the theory of memes, it will become apparent that everything about a religion, specially the more widespread ones, is evolved with one most important purpose: to let it survive. That usually means spreading to as many people as possible. That means bringing people in and keeping them hooked up and destroying its rivals, be they other religions or science or whatnot. And we humans, have been the tools to be controlled by these vicious, dangerous and single-minded memes to ensure their survival.

If you think the purpose of any long lasting and popular religion is human happiness, you should think again. The purpose of any religion is its own survival and dominance. A few million people here and there doesn’t make much difference as long as the long-term success of that meme is guaranteed.

To those of you who still think, in this day and age, that any idea like religion should be enforced or even be allowed to be advertised or be a part of any government or ruling body, I can only say to look at history. Look at your own lives! Look at our own lives and the lives of those like us!

For those libertarians and agnostics among you, I have to say that I don’t think religion is something to be ignored and always categorized as a personal choice. Religion is harmful and dangerous. It’s not only publicly recognized dangerous religions and ideologies like Nazism that are dangerous, but the idea of any mass of humans controlled by any religion. We cannot afford to remain agnostic any more. People are entitled to their own beliefs of course, but those beliefs should never ever be the basis for special treatment or ever be let to come to power anywhere at any time.

VN:F [1.9.13_1145]
Rating: 7.8/10 (4 votes cast)
VN:F [1.9.13_1145]
Rating: +2 (from 4 votes)

The Human and the Machine

I was watching George Dyson’s interesting presentation at TED about birth of the digital computer, and something rather frightening occurred to me.
When I started out with computers, maybe 18 years ago, I was in awe of them. Computers and what they did were a closed book to me, the way a great musician’s work is shrouded in mystery for me, yet I was enjoying their output and imagining what else they would do. Pretty much everything surprised and delighted me. As I grew more familiar with their working and started writing code, my awe remained but it also transformed, to a kind that maybe a musics student feels when seeing a true master play.
The awe and delight pretty much remained as I grew closer and closer to the machine, I knew more, but it still was like seeing a loved one achieve a great accomplishment or part of a great orchestra that plays a fantastic piece. Seeing beauty even from inside inspires awe. Of course, I’m not suggesting that I was any good at any time, merely describing what I felt.
In general, it was a like a love affair. Every little things, even the hiccups were strangely endearing. I wouldn’t think of computers as a machine. Of course, the hardware is a piece of dead equipment, but there is something else in there and I think I felt it. The Ghost in the Machine. I was in love with the ideas behind the hardware. I never thought of myself as a master of the machine, or it just another tool like a can opener or something. We were conversing with each other and we took nothing for granted. If something didn’t work, it was neither my fault, nor its; the problem was in the communication.
But then my view started to change. I started to rely on certain things to work and certain things to go wrong. I started to view the computer as a terminal for information, as a tool for bilateral delivery of entertainment, data, software or communication with other humans. The machine started to get transparent in the process, the way your door is a transparent method of getting in and out of your home. The door is there, and you know how to use it, but the door itself is not at all important. The stuff and places on either side is what is important.
This change kinda creeped onto me. Today I was forced to think about it, and I was shocked and terrified to realize that most of that awe has shifted from the machine to other people. The machine is no longer there, only those who designed and built the hardware and software. I don’t know how to exactly explain my feeling, and my depiction here is not exactly accurate. But I have lost the reverence for the love of my life, and I am a worse person for it. And I am sadder, and certainly a worse programmer, which is ultimately the most important aspect of my life. Oh, I do write better code and probably design better today than any time in the past, but I am nonetheless a worse coder and programmer, because I have lost the sparkle, and the love and ability to be pleasantly surprised no matter what.

VN:F [1.9.13_1145]
Rating: 7.5/10 (4 votes cast)
VN:F [1.9.13_1145]
Rating: +1 (from 3 votes)

Tonight was the first time ever that I drank alone. I was, am, in a very bad mood. I sat on my couch and downed a third of bottle of whiskey, and then I cooked for myself too (that’s almost another first.) No matter how hard I try to forget what I did that led to this evening, I can’t.
I’m sitting here, alone, and I am sinking. I can’t stop crying. Remorse is not even an option. Even death is not an option.
I realized tonight that I am a real asshole. Not a lazy guy, not a very bad procrastinator, not a liar, not a completely useless person, not a drama queen; a real asshole and a very bad human being.
I think I need professional help. Shit. I do.

VN:F [1.9.13_1145]
Rating: 4.9/10 (7 votes cast)
VN:F [1.9.13_1145]
Rating: -7 (from 9 votes)

Lighning Through the Skull

I am walking on asphalt, on an endless field of black asphalt, when out of the black black sky, a single bolt of lightning hits me.
My eyes are the first things that explode out of their sockets. My hair catches on fire. My brain evaporates instantly, and the high pressure mixture pours out of my ears and nose. The skin on my eyeless face melts off. My skull shatters. My jaws spasm so hard that not only I bite off my tongue that is caught between them, but also most of my teeth are crushed to bits. My blood boils in a flash and my heart explodes inside my chest along with most of my major veins. The liquid in my stomach and my intestines flash boils too and burns through my abdominal wall. Almost all the muscle and flesh and sinew in my body are busy tearing themselves off from the rest or trying to burn. Some of my bones dry out in the space between two seconds and get ground into a thousand pieces. The skin, flesh and tissue of my extremities melt and my fingers and toes (not to mention the rest) are fused together in a shapeless lump. My feet have already turned to liquid wax and are spreading on the ground.
The charred wreckage that once spent his nights trying to optimize his assembly code remains there under the black black sky. Good thing I didn’t have my laptop with me, or the fall could have scratched it.

It’s that damn Gates’ birthday again.

VN:F [1.9.13_1145]
Rating: 7.6/10 (8 votes cast)
VN:F [1.9.13_1145]
Rating: +2 (from 6 votes)

Self-justifying Choices

Running away is a solution to many things. Giving up, throwing in the towel, passing the buck, unshouldering the burden, admitting your incapability, playing dead…
It’s a perfect solution for mediocrity, isn’t it?

If you thought that was the rant, you’re sourly mistaken. Here it is.

Let’s try a thought experiment. Nothing real, just a wild and fantastical fantasy. Suppose you are standing on the edge of a rooftop, contemplating jumping down. As long as you haven’t jumped, the choice is always yours. You can jump, stay on the edge or move back. It’s not like you can’t jump two seconds or two hours later. If the situation changes, you can always weigh the odds again and make a more suitable choice.
But what if you jump? You make a choice and you jump. I think that’s the best choice you can make; the most logical. If you stay on the edge, or you move back, the edge and the jump will always be there, tempting and tantalizing. Why defer the choice?
Some might say because it’s a final choice and because you will always have the option, you can postpone it for later. It’s not like the edge is going anywhere, right? Wrong. I say you should always jump the first chance you get, because once you jump, there is no going back and there is no more choices. Why would you postpone a move that solves your dilemma so quickly? How come people (including myself) defer such obviously logical choices for more than a single second?
I like these kind of choices. I like changes and commitments that you cannot revert. They simplify life so much.

I think it’s kind of funny, I think it’s kind of sad,
The memories in which I’m dying are the best I’ve ever had.

That’s not about death of course. It’s about giving up in despair. It’s about indecision and inability to deal. It’s about petty problems that prove impossible for weak people.
It’s about me.

VN:F [1.9.13_1145]
Rating: 5.5/10 (10 votes cast)
VN:F [1.9.13_1145]
Rating: -1 (from 7 votes)