Pointers made easy

For some reason pointers are very scary. I remember when first learning about pointers, the teacher warned us about all kinds of pointer misuse, crashes, segmentation faults etc… I was so scared I couldn’t fall asleep :)
After growing up I realized there’s nothing to fear but the fear itself (and the god of segfaults).
Even many experienced programmers make mistakes with pointers.

So what are pointers? like you can guess from the name, pointers point to something.
This something can be data or function.
We’ll start with the simplest example:

int a;
int *pa;
pa = &a;

In the first line we defined an integer variable, basically what it means is we tell the computer to create a space in the memory for an integer number.
Another way to look at it, is we tell the computer to create a post-office box with enough space for an integer.
This post-office box must have an address. In order to get the address we use the “&” operator on the name.
In order to save the address, we need to create a post-office box with enough space to save addresses of integers. We use int *variable_name to create a variable that can contain addresses of integers.
On the 3rd line we simply save the address of “a” in the variable “pa”.
Please notice an important point, “pa” is a variable, which means it also has an address, and to find the address of it we can use the “&” operator.
Ok now what? so we have an address of a variable, why do we need it? what can we do with it?
Example:

int a;
int *pa;
pa = &a;
*pa = 2;

Noticed the new line at the end? What we did was use the “*” operator on “pa” in order to fetch the variable that “pa” points at. Then we put inside the variable the value “2”. If we print “a” now we’ll see “2” as a result.
Another way to look at it (which I don’t totally recommend) is that “*” cancels “&”, for example “*&a” = “a”.
So… we can use the address of a variable to use that variable, still why can’t we just use the variable itself?
Well… if we wrote applications using just the main() function and if we didn’t have dynamic memory allocation, we wouldn’t need any pointers and life would be good.
After 398 words we’ve managed to cover the really really basics of pointers.
In order to understand pointers more deeply you need to learn about: dynamic memory allocation, heap, stack and pointers to functions.
These topics sounds complex but in reality they’re not that hard.
I’ll cover those topics in future posts.

Share SHARE

The fall of the free internet and the rise of the Darknet

I remember a time when I still didn’t have internet, that I would connect to BBS servers or directly to a friend’s computer. We would then send games to one another over the wires. I remember it took an entire weekend to download a 40MB game (if I managed to keep my parents from opening the phone and causing disconnection).
This was done privately without fear of government’s interference or censorship. It was truly a free way to communicate and share.
“The term darknet refers to any private, distributed P2P filesharing network, where connections are made only between trusted peers (sometimes called “friends” (F2F)) using non-standard protocols and ports.[1] Darknets are distinct from other distributed P2P networks as sharing is anonymous (that is, IP addresses are not publicly shared), and therefore users can communicate with little fear of governmental or corporate interference.” (Quoted from Wikipedia)
The proposed anti-piracy laws SOPA and PIPA and the recent closure of megaupload that caused other sharing websites to turn off their services and increased government control of the internet are going to give rise to the Darknet.
Piracy cannot be eliminated, that is a fact. Not in this age of digital media. As long as digital media exists it’ll be copied illegally.
The creators of digital media should find new ways of making money in this new age instead of trying to stop the rain from falling.
one example is embedding commercials in movies and making them free to download. Or making the costs really cheap so that some users will prefer to buy and to be able to fast download with less hassle. Proof of concept for that behavior is the paying customers of megaupload.
Anyway instead of attacking websites like megaupload I believe those media companies giants should find new creative ways for income; or else the Darknet will rise and there will be no way of stopping it.
Update: Rovio’s (Angry Birds) CEO says piracy is good for business.

Share SHARE

Hackademic: nice hacking walkthrough

http://g0tmi1k.blogspot.com/2012/01/video-hackademic-rtb1.html?m=1

Share SHARE

MegaUpload Dangerous Secrets affect YOU, Mike Mozart JeepersMedia ACTA / PIPA / SOPA

Share SHARE

Dyson Vacuum Cleaner Commercial

Share SHARE

Israeli hackers took down stock exchange of Saudi Arabia and United Arab Emirates

An Israeli hacker group who calls themselves “IDF-TEAM” took down today the Saudi Arabia and United Arab Emirates stock exchange websites. This is a retaliation to the pro-palestinian group “nightmare” and 0xOmar who took down the Israeli stock exchange website.
It seems that this cyber war is only beginning.
I think in this war there are only winners, the security industry is blossoming, the websites are getting more secured which means our details are getting more secured, at least in the short term.

Share SHARE

Nightmare took down El-Al and Israel Stock Exchange Websites

El-Al an Israeli airline company and the Israel stock exchange websites were taken down today by “nightmare” a pro-palestinians hackers.
On the time of this post they’re still unavailable.

Share SHARE

The cyberwar on Israel escalates

The Saudi hacker 0xOmar told Ynet today that a pro-palestinian hacker group named “nightmare” is planning on attacking the Israel stock exchange website and El-Al, an Israeli airline company.
On the other side a pro-Israel hacker that lives “somewhere in the world” published tonight the details of 20,000 arab facebook account details. He also claims to have 10 million bank account details of Iranians and Saudians that can cause them millions of dollars damage.
The terrorist group Hamas is also calling hackers all over the world to engage in cyberwar or as they call it “cyber jihad” against Israel.

Share SHARE

This commercial isn’t real, neither are society’s standards of beauty

Share SHARE

Israeli Hacker Leaks Hundreds of Saudi Credit Cards

Israeli website Ynet published today that a hacker that belongs to the group that hacked yesterday decided not to wait and published the list of credit card numbers.
This was a retaliation on the attack of the “Saudi” hacker 0xOmar on Israeli website and the publishing of thousands of credit card numbers.
The hackers said he’s a soldier in the intelligence corpse.
The hacker was asked what message does he want to convey to 0xOmar, he replied by “you’re not the only one”.
In Saudi-Arabia the responses were relaxed as they claimed that they received no complaints and their systems are secured. In my opinion they’re delusional and they should have learned something from the quick response of Israeli credit card companies who canceled all the published credit cards even without their owners action.

Share SHARE