language-agnostic

Get notifications of new threads / deleted threads under Windows

When you create a DLL you can get notifications about new threads / exiting threads in the DllMain function (DLL_THREAD_ATTACH/DLL_THREAD_DETACH). Is there a way to get these or equivalent notifications from Windows within an (non managed) Executable? ...

How to make my programming designs better?

I'm currently stuck how I should make designing skills as a programmer better. I've seen over a dozen questions about (algorithmic) programming challenges. Defining and verifying a good design isn't as trivial. You can objectively measure how good an algorithm is, but not the design used to implement that algorithm. I do see problems wi...

Is it simpler to group tests or to keep them separate?

I just had a discussion with a colleague where we disagreed about which of the following snippets was simpler: public boolean foo(int x, int y) { if (x < 0) return false; if (y < 0) return false; // more stuff below } OR public boolean foo(int x, int y) { if (x < 0 || y < 0) return false; /...

How can be interpreted code even little efficient? (theoretical)

Hi, OK, first, I dont want any kind of flamewar here or anything like it. My bigger question is more theoretical, and will include few examples. So, as I wrote, I cannot understand how can interpreted language be even little efficient. And since its modern, I will take Java as example. Lets go back to days where there was no JIT compil...

Why are many developers opposed to using the "protected" modifier in OOP?

A co-worker of mine is taking an Introduction to Object Oriented Programming class and was asked a discussion question by his professor: Why are many developers opposed to using the "protected" modifer on/within classes? When the question was brought up at lunch, my co-workers and I couldn't think of reasons why someone might be op...

Cube on Cube collision detection algorithm?

I'm trying to find the most efficient way to check if 2 arbitrarily sized cubes collide with each other. The sides of the cubes are not necessarily all equal in length (a box is possible). Given these constraints, how could I efficiently check if they collide? (each box has 24 verticies) Thanks They are axis alligned ...

Advantages of an IDE?

Possible Duplicate: Why should I use an IDE? I'm not too sure if this question is really on topic, but it seems to be... At first I thought I was missing something or maybe haven't done enough GUI-based programming - I'm a student just starting my programming/software engineering education - but then I thought about the web d...

What are ISO languages?

It's in fact 3 questions : What is required for a programming language to be certified "ISO" ? What does ISO certification guarantee about the language? Does other language can be the same? A list of ISO languages? (made community wiki - not sure about the organisation, maybe the first answer should be edited to have the full ISO lan...

Best practice to monitor program life.

Hi guys! I want to hear your opinion about program life monitoring. This is the scenario. You have a simple program which normally works, that means that it's well written, exception are handled and so on. How will you operate if you want to ensure that this program works FOREVER? No external tools like crontab are available, but any...

Style Question: if block in or around function?

Let's say that I have a function that should only execute if some constant is defined. which of the following would be better option 1: wrap all the function calls in an if block: if(defined('FOO_BAR_ENABLED')) { foobar(); } I figure this way the intent is more clear, but it requires checking the constant every time the function i...

hide real Id on entity from end user.

I'm building e-commerce application. Path to the order looks like /Orders/Details/{orderId}. However I don't want expose orderId to the end-user. How can I identify order, not using database identifier? Is it necessary to generate some random unique string like GUID? ...

Minimum and maximum of a box?

Given the, width, height and depth of a box and its center point, how could I find the minimum, x, y, and z coordinate and the maximum x, y and z coordinate without bruteforcing through each vertex? its an AABB box. Thanks from a top view --------------- | | | | | c | | | |-------------...

Programmatically Installing the Windows Recovery Console (Without a CD)

How can I programmatically install the windows recovery console, without using a CD? Note that I suspect most of the steps would probably be unneeded if the windows recovery console was redistributable, but I doubt it is redistributable. Examining http://www.bleepingcomputer.com/combofix/how-to-use-combofix#manual_recovery leads me to ...

Intelligently extracting tags from blogs and other web pages

I'm not talking about HTML tags, but tags used to describe blog posts, or youtube videos or questions on this site. If I was crawling just a single website, I'd just use an xpath to extract the tag out, or even a regex if it's simple. But I'd like to be able to throw any web page at my extract_tags() function and get the tags listed. I...

Some doubts about what Factory does

Hi, I'm not really sure to understand completely the factory pattern. Let's say I have a class Customer which has basically the following methods: CreateCustomer - static, creates a customer from scratch and adds it to the database, LoadCustomer - static, loads an instance of a Customer from the database, KillCustomer - not static, r...

Generating a list of colors, blue through red, 0% through 100%.

I want to create a list of colors, red-yellow-green-blue, and blend into each other across a span of 100. Anyone have experience in this sort of thing? Edit: Well, RGB actually. Any language will do. I just need the algorithm. ...

Skills to learn to avoid age discrimination (specifically .net)

I am an asp.net programmer and I am getting up there in my age. I wanted to know, from your experience, what skills (please be as specific as possible) would you focus on (.net or generic), what skills would you make sure you are razor sharp on, in order to avoid age discrimination? I have heard from a few recruiters that I have "alot...

When/why to use custom exceptions

I read a thread on this topic on this very forum which listed some reasons to use custom exceptions but none of them really seemed strong reasons (can't remember the reasons now). So why would you use custom exceptins? In particular, I have never understood the decision making process between using a standard or custom exception to indi...

Isn't Composition bad for testability?

Typically Composition and Aggregation are treated the same? But they are different and the choice which one to use changes a lot? For e.g: I believe aggregation would be ideal for testing. But composition is not. Maintenance of dependencies is a pain while using aggregation but less using Composition. So are there any similar views a...

Monads vs. Arrows

I'm broadly familiar with the concepts of monads and arrows as used in functional programming. I also understand that they can be used to solve similar kinds of problems. However - I'm still a bit confused about how to select which one to use in any given situation. When should I use monads and when should I use arrows? ...