Leaky Code…

I had heard lots and lots about leaky code so far, but never actually learned about it or read about it until tonight… so here it is below: a sample of LEAKY CODE (source: Wikipedia)

#include <stdlib.h>
 
void function_which_allocates(void) {
    /* allocate an array of 45 floats */
    float * a = malloc(sizeof(float) * 45);
 
    /* additional code making use of 'a' */
 
    /* return to main, having forgotten to free the memory we malloc'd */
}
 
int main(void) {
    function_which_allocates();
 
    /* the pointer 'a' no longer exists, and therefore cannot be freed,
     but the memory is still allocated. a leak has occurred. */
}

via Wikipedia Memory Leak Article

EiD: Hugs, Eidi and GUNS

First and foremost; EID MUBARAK TO ALL… I have been awfully lazy this Eid and didn’t even send Eid Greetings SMS to anyone except a select few.

LED Eid Mubarak - from Ejaad
LED Eid Mubarak – from Ejaad – http://facebook.com/EjaadTech

If someone looked down on Karachi, PK via satellite on Eid days, he would see

  1. Large gatherings of Muslims
  2. Hugging each other like its the last time they’ll meet
  3. Pakistani Flags and badges and stuff [14th August is also almost here]
  4. Children armed with guns…. YES, GUNS..!!!

Every Eid for the past some years I have been seeing GUNS, lots and lots of guns, Eid day reminds me of the scene in Matrix where Neo asks for Guns and gets em.

I mean why Guns, why not any other toy, why not board games, why not card games, why not sports gear, why not wheel-walay-jootay, why did it had to be guns…. and once the little ones have guns, they start having street wars form into gangs and its not only the little ones I see kids of almost 15 years old wandering around showing off their bad-ass BIGGER guns leading those gangs.

This has got to change. It is already done this year but next year and on next coming Eid (Bakra-Eid) I plan on at least trying in my own family to NOT let the kids buy guns. I will RE-post this before the next Eid too so to remind others and let’s stop this. I can force it upon a few but unless we show these little kids that there are other great things, other toys and play things which open the imagination for the better, which encourage healthy and safe outdoor  activities which encourage sharing rather than killing this trend isn’t going anywhere.

Let’s not even start on the hazards of these Guns and how one wrong aim can put out the light in one’s eye.

I hope that most of you will agree with me and some will share this thought this time and the next time on Eid.

[I should better familiarize myself with the latest toys too, so next time, I can give my kid-bro and little cousins a better choice, hopefully before next Eid, I will post here a list too.]

Bottle Cap Runaway Car….!

I have a little cousin, in 7th grade… he has recently been getting more and more interested in hacking and tinkering his toys, taking them apart and playing with the LEDs and motors inside. When I met him last week, he showed me this car that he made, all by himself. he was like kinda over-excited presenting his creation to the only engineer (engineering student) in the family :)

The Runaway Bottle-Cap CAR
The Runaway Bottle-Cap CAR

Rear Wheel Drive, single DC Motor, 3 AA cells, barbecue sticks as wheel axles, bottle caps for wheels, plastic beads to hold the axles and a cardboard for the base/body. Push in the 3rd cell and the car starts going, never to stop unless it hits something.

Am going to give him a couple motors, some jumper wires, LEDs and batteries etc to see what he comes up with, for him, these little tiny electronic things literally are a treasure cause he got all these by breaking/opening his toys and he had very limited jumper wire stock treating it as some rare commodity.

the car and the little MAKER
the car and the little MAKER, thinking

Posted this cause the car made me so proud and took me back in time when I used to do stuff like this with my little brother’s toys (never broke any of mine), maybe after some time, I will show him Arduino…

a couple of VIDEOs of the car in action, the car is all prettified for the video-making..!

Hacking the Xbox [Book+Xbox] – to play or to hack that is the question

xboxnew

As I was completing the first few pages of the book “hacking the Xbox”, Nasir Jumani was teasing me with his texts about how good the games are and that I am to bring my own controller if I want to play.

After getting the soft copy of the book Hacking the Xbox for free, thanks to the writer Andrew “bunnie” Huang (whom I remember as the guy who designed his own Laptop) I mentioned the book to Nasir who also liked it and suggested if we were to get an Xbox for this book or not, so before even starting the book, we looked at OLX.com, found a seller, possibly the only Xbox 1 on OLX (Karachi) and we bought it the next day for less than Rs. 5,000 (less than 50$). Actually Nasir bought it and now he has started playing with it as we got some games with it as well while I am stuck here reading the README.1ST portion of the book and waiting for my chance to get my hands on our newly-bought-old-second-hand-modded game console.

About the Book: Hacking the Xbox is one of the finest books on reverse engineering ever written. Even though it covers the original Xbox (not 360), the lessons contained therein and analytical processes presented serve as a primer for both beginners and experienced hackers alike, serving as an inspiration for anyone wanting to delve deeper into the workings of the tech you bought and paid for. You can find the link to Hacking the Xbox (PDF version) at No Starch Press. [copied from DangerousPrototypes.com]
Oh, and here is a pic and a tweet from Nasir, cause it did happen, even if I haven’t even seen the damn thing in person yet