deeper-understanding

PHP's USORT Callback Function Parameters

This is a really esoteric question, but I'm genuinely curious. I'm using usort for the first time today in years, and I'm particularly interested in what exactly is going on. Suppose I've got the following array: $myArray = array(1, 9, 18, 12, 56); I could sort this with usort: usort($myArray, function($a, $b){ if ($a == $b) return...

Javascript setTimout within an object/function help

I'm new to closures and have a 'gets me by doing most things' understanding of javascript and so am wondering how I can improve etc on the following which was me trying to have an object that has a counter in it...trying to improve/further my understanding. edit: the following code works, sure...but likely it is wrong (is it?)...I don't...

Examples of "when is good idea implement many-to-many relationships"?

I ask this because need to understand/explain better with examples. clasical examples like: an Article can be published in multiple Publication objects, and a Publication has multiple Article objects. (source) I see is usefull for web2.0 for sharing features. ...

What are the best ways to increase productivity?

Possible Duplicate: What tricks do you use to get yourself in the zone? I am most productive when there are no distractions and absolute silence! But unfortunately with family this is never possible. I have heard that most programmers work early in the morning or late at night when it is silent. I was listening to Jason Fried f...

understand spring xml annotation metadata?

<context:annotation-config/> <context:component-scan... this is used for class that i need to annotated with @Repository @Service @Component... <context:spring-configured /> <context:component-scan... use if i need to use @Configurable <tx:annotation-driven transaction-manager="transactionManager" /> <context:component-sc...

How are exceptions implemented under the hood?

Just about everyone uses them, but many, including me simply take it for granted that they just work. I am looking for high-quality material. Languages I use are: Java, C, C#, Python, C++, so these are of most interest to me. Now, C++ is probably a good place to start since you can throw anything in that language. Also, C is close to...

Delphi: What is Application.Handle?

What is TApplication.Handle? Where does it come from? Why does it exist? And most importantly: why do all forms have it as their parent window handle? The Delphi help says: TApplication.Handle Provides access to the window handle of the main form (window) of the application. property Handle: HWND; Description ...

java immutable object question

String abc[]={"abc"}; String def[]={}; def=abc; def[0]=def[0]+"changed"; System.out.println(abc[0]); by changing "def" object, my abc object is changed as well. Beside String[] array has this characteristic what other java object has similar characteristic? can explain more? in order to prevent abc from changed when i changed def, ...

How are Scala traits compiled into Java bytecode?

I have played around with Scala for a while now, and I know that traits can act as the Scala equivalent of both interfaces and abstract classes. Recently I've been wondering how exactly traits are compiled into Java bytecode. I found some short explanations that stated traits are compiled exactly like Java interfaces when possible, and...

Technically why is processes in Erlang more efficient than OS threads?

Erlangs Characteristics From Erlang Programming (2009): Erlang concurrency is fast and scalable. Its processes are lightweight in that the Erlang virtual machine does not create an OS thread for every created process. They are created, scheduled, and handled in the VM, independent of underlying operating system. As a result, process...

What Does an OS Actually Do?

What exactly does an operating system do? I know that operating systems can be programmed, in, for example, C++, but I previously believed that C++ programs must be run under an operating system? Can somebody please explain and give links? thanks in advance, ell ...

How are IDs for fixtures generated?

I'm using fixtures to hold all the test data that I have. Each row in my DB has the same ID across several rake db:fixtures:loads. That is nice, because I can create folders in the project, like "people/12345" to hold additional data (files) for the models. I'm interested to know, how are these generated IDs kept constant at every fix...

has_attribute? problem

I have an HTML document and I need to examine, whether some attribute is presented in element in question Suppose, that the attribute is not presented. When i say: elem.has_attribute? "data-attr" it returns nil instead of "false". When i say: elem["data-attr"].nil? it returns "true", that is what i need. But, when i say: !elem...

Usefulness of db migrations rollback

Hi, Many people talking about db migrations, especially about its rollback possibility. I doubt, whether it is useful at all, because schema of db and model are tightly connected with application logic (MVC). Suppose i've done rollback of some migration. And what ? The application will not work, because its logic fully relies on db. ...

Sizes calculation with JavaScript and jQuery

Sometimes i'm facing problems, trying to get sizes of an HTML element in question. I'm tracing JavaScript code and see, that width and height of this element are returned as 0. When i do the same piece of code in browser's console, correct sizes are returned. Example code, that demonstrates this problem is following: <!DOCTYPE html> ...