Do you know how much memory the string has? I have heard all kinds of answers to this question, ranging from "do not know" to "string has 2 bytes". Here are some more questions: How much space does empty string take? How much space does the class object of Integer take? How much space will take your own class object with three Integer fields? It is funny, but none of my Java programmer friends could answer these questions ... Most of us do not need it, and nobody will think about it in the real java projects. After all, this is the same as you would not know the engine capacity of vehicle that you drive every day. You can be a great driver and did not even know what 2.4 or 1.6 means on your car. But I am sure that there are few people who are not familiar with the meaning of these numbers. So why do java programmers know so little about this part of their tool?

Integer vs int

We all know that in java - everything is an object. Except, perhaps, primitives and references to the objects themselves. Let us consider two typical situations:
ZimerMan 8 february 2012, 14:12

In the Web you can find a lot of solutions to emulate multithreading in php. Most often they are based on the forks, but there are variations about using curl, proc_open and etc.

I did not like the alternatives that I found, so I had to write my own solution.
Here is the following set of requirements:

• Use of the forks
• In-sync state with the interface in the absence of the necessary extensions
• Multiple use of child processes
• A full data exchange between processes. That is, running with the arguments and getting results at the end
• The event exchange between the child process-"thread" and the basic process at work
• Handling the thread pool with the multiple use, transferring arguments and getting results
• Error handling
• Timeouts for the work performance, waiting for work thread, initialization
• Maximum performance

The result is a CThread library.

Here is a link to the sources:
github.com/amal/CThread
xially 7 february 2012, 13:10

In C language, you may use functions without defining them. Pay attention that I speak about C language, not C++. Of course, this ability is very dangerous. Let us have a look at an interesting example of a 64-bit error related to it.
Andrey2008 7 february 2012, 5:47

imageIn today's world three-dimensional technologies have become very popular. 3D comes in the life of ordinary man rapidly and diversely, starting from 3D TVs, 3D scanners and even printers. Although the last two types of devices are available so far only to specialists. However, the technologies are not standing still. There have already become available three-dimensional printers that cost about $ 2,000 dollars. That fact is bringing closer the day when these devices will become available for every student, engineer or designer. Concerning methods to get the 3D model of a real physical object, then here is not everything that clear. It requires an expensive laser scanner, or you can try your luck with a web camera and the special software. Today anyone could have all these things.
However, there is a very simple way to scan the object into the 3D model using a conventional digital camera. How to do all that will be discussed further.
KlauS 5 february 2012, 11:20

It is hard to believe that a modern processor (CPU) is the most complex product in the world. What is so complex in this piece of metal?

image

In this article I will try to explain how a modern processer (CPU) is made from the sand.

Processor Manufacturing

It takes about $ 5 billion dollars to build a processor manufacturing factory. This factory approximately has 4 years to return the invested funds in its technology, before it will start making the profit. If we make some simple calculations that comes to 100 microchips per hour that the factory should manufacture in order to return the invested funds.
Papay 4 february 2012, 14:10

After I have read some article about the handling of critical errors in PHP, I noticed that the error codes were customized specially for the bitwise operations in PHP, however, in the article’s examples and the comments are used regular operators for comparison in order to check the error codes.

For example, there were such variations:

if ($error['type'] == E_ERROR || $error['type'] == E_PARSE || $error['type'] == E_COMPILE_ERROR){…}
or

if(in_array($error['type'], array(E_ERROR, E_PARSE, E_COMPILE_ERROR)) {…}
Thereby, I decided to write a short article about the bitwise operations with examples of their use.
BumBum 2 february 2012, 21:20

While developing the code analyzer PVS-Studio intended for searching issues in 64-bit and concurrent software, we came to the need of collecting fresh information on the Internet on some topics. For example, it is always useful to answer the questions of programmers who may be interested in our tool on various forums and blogs. While collecting the data we found out that there is much information on the Internet and therefore manual search might be very long and tiresome. Thus the task of automating the process of searching for fresh data appeared. In this post we will tell you how we do this.
But I bet you have said right now: "Ha-ha! The guys are reinventing the wheel and are not aware of Google Alerts". Well, we are aware of Google Alerts. And it is almost the thing we need but not quite :-). We have been using Google Alerts for more than half a year and did not manage to get what we needed. And here is what we need:
Tags: Google, html, Php, script
Andrey2008 31 january 2012, 17:00

I decided to find out if there is practical sense in writing ++iterator instead of iterator++ when handling iterators. My interest in this question arouse far not from my love to art but from practical reasons. We have intended for a long time to develop PVS-Studio not only in the direction of error search but in the direction of prompting tips on code optimization. A message telling you that you'd better write ++iterator is quite suitable in the scope of optimization.

But how much relevant is this recommendation nowadays? In ancient times, for instance, it was advised not to repeat calculations. It was a good manner to write:

TMP = A + 10;
X = TMP + B;
Y = TMP + C;

instead of

X = A + 10 + B;
Y = A + 10 + C;

Such subtle manual optimization is meaningless now. The compiler would handle this task as well. It's just unnecessary complication of code.
Andrey2008 30 january 2012, 13:18

imageAccording to some saying, the programmers are human devices that convert caffeine into the programming code :)

If you ask any programmer when the most productive time to work, most likely that will be the night time. Someone may start earlier, somebody else could start later, and some people prefer to go to bed at 4 am. However, the most popular one to get up at 4 am and do the job before the daily turmoil will start.

The purpose of all this is to get rid of distractions during the day. What is so special about the night?

I think it all comes to three things: the maker’s schedule, sleepy brain and the bright computer screen.
Sparks 29 january 2012, 19:24

imageThere arises a question why tabs are better than spaces, so today I am going to discuss the most significant misconceptions about the tabs and how to use them properly.

Let's start with the fact that most people (at least on umumble) prefer tabs.
In fact, it is strange that many people still do not see the difference between indentation and alignment. Well, here it is - indentation:

for (int i = 0; i < 10; i++) {
if (a[i] == 0)
do_something(i);
}
And this is - alignment:

int some_variable = 0;
int v1 = 0;

The first one can be done by both tabs and spaces, but when you use the tabs the width of indent could be adjusted as you like. The the second one is strictly done by the spaces.
KlauS 26 january 2012, 13:56