You’re not allowed to believe in coincidence son.

July 28, 2012 Leave a comment

Dark Knight Rises

I can’t decide where to start. My thoughts are as messed up as the film itself. From weeks before the premier, the very days I had been counting patiently to see Nolan’s last Batman, I was thinking, what if he let us down, what if he take the legacy from The Dark Knight, which is still one of most favourites in its genre, and turn it into yet another Hollywood blockbuster. Why would he do that?

The second chapter raised excpetections for many people with its reasonably good and consistant plot, very good cinematography, and of course its A-class list of cast and crew.

But for me, the most respectable aspect of The Dark Knight was its fully baked characters. Nolan brothers successfully pictured those characters with insightful details. They remembered there is no pure good or evil. They remembered the villain also needs to be explained and undestood. Although arguably Ledger’s powerful performance formed the better part of the realism of his character, the story constantly hints us to get to know him. The story ‘shows’ us who Joker is, it doesn’t just ‘tell’ us. The clever boats inter-bombing scenes although admittedly cliché and rather predicable but still don’t fail to ‘explain’ people of Gotham, and why they deserve their city. And then of course there’s Harvey Dent (and his lucky coin). The two-faced man was another excellent example of a multi-dimentioanl character. A character we understood (appreciated?) his (and his’ lucky coin’s) transition through the film.

But Just like officer Blake told the billionaire philanthropist he has stopped paying attention to details, I thought Nolan himself was got caught  in the sane trap trap with the final part of The Dark Knight Trilogy.

I personally always praised Nolan for his exceptional talent in story-telling (and not film-making). But TDKR felt liked he had lost his greatest weapon. He had forgotten about the details. This film is full of characters that are not well explained. they are not fully baked.
All we learn about their personalities is purely based on dialogues. The story-teller fails to ‘show’ us his characters but rather discribes them using their own words.

Yes Bane was indeed a good choice of villain. Yes we do hear his story, why he’s masked and why he left the League of Shadows. But what about his intuitions? What about how he managed to convince his criminal friends to help him destroy an entire city? What about his relationship with Talia like? Something a bit more than a few words in the final revealing scenes. Both Talia and Miranda are also left out. What are her intentions? Does she really believe in destroying Gotham would “restore balance” in the world? Or as she said, she just wants to take revenge for the death of Ras Al Gul?
But these are not the main left out characters. In my opinion, the most important character was completely abandoned in details. People of Gatham, they’re never explained in this city. All we know is apparently under Bane’s regime, the already classified society of gotham has been divided into two another class system. With two main groups. The (former) rich and powerful class, which are sentenced to either death or exile, the poor and the “organised criminals” join force two form the other group. They attack the other group, invade their houses and ultimately kill them. Now the question is if this is the real (and only) face of these people, do they not deserve the League of Shadows’ master plan? Bane keeps speaking of “giving the power back to people”. Was that a decent society those few million citizens ended up with after a few months.
Where’s the inevitable “Resistance”? Surly more than a handful of un-trapped police officers?

Moving on from this characters dilemma. There is another chaos that weakens the entire trilogy the very moment those bridges fall down. There’s a timed bomb with a decrementing timer on it. seriously? this again? When the Russian siencntist diosconnetectd the core from the fusion reactor (which by the way is scientifically VERY wrong) you could predict with good confidence that the film will end with the bomb’s timer getting closer to 00:00:00 and the town will be saved in the last seconds. What I wasn’t expecting though, was that it would actually follow the exact same routine “The hero willing to scarifies his life takes the bomb with him, it’ll go off somewhere faraway. Everyone thinks the hero’s dead, but he’s not”. And here vaporises my story-teller idol.

And then there’s of course this other element. The element almost every hollywood action title “suffers” from heavily.
In a scene, Gordon tells Blake “You’re not allowed to believe in coincidences son”. as if Nolan is trying to pre-justify the number of times he is going to get help from some suddenly-out-of-nowhere (aka chance) events. Bruce shows up right where, and exactly when Gordon, Selina or Blake are seconds away from death. Selina gives back the favour by finding the Batman and shooting Bane. Gordon uses the EMP to disarm the bomb’s radio communication at the very moment Miranda (then Talia) is trying to trigger it.
Indeed we’re not allowed to believe in coincidence.

All in all, The Dark Knigth Rises is still a good film for a super budget hollywood project. Surprisingly, Anne Hathaway delivers a very good performance and of course Hans Zimmer’s magic made the entire experience more enjoyable. For me The Dark Knigth remains on the top of the list and the other two are join-3rd, with a lot, and I mean a lot of points behind and if we were still living in the DVD era, I would have bought the box-set. Surely, the next person who will reboot the franchise will have a difficult challeng topping what Nolan achieved. The only reason (well other than practicing my English writing!) I went out of my way and wrote about something I don’t know much about (that is cinema) was because I liked the previous films. I loved The Dark Knight and I think I (and everyone else) deserved a better plot. To be convinced that a superhero blockbuster can be good, very good in fact, and then watch the joy breaking in pieces with a not-so-good attempt at wrapping it all up is… bad. It’s just that Nolan “didn’t give us everything we deserved”. And I wish I could continue the quote with “Not everything, not yet” but we all know this is over.

Categories: Cinema

July 23, 2012 Leave a comment

I came across this fantastic, fantastic tutorial and found it very useful. I do recommend reading the entire article. What I’m going to do in this post is to pick up the important bits from that article and write a step by step guide for quick references in the future.
So her we go.
Part one is all about setting things up using Apples Provisioning Portal, Keychain, and Terminal.

Step1: Create an AppID in the provisioning portal if you haven’t already
Step2: Enable Push Notifications for that app and click on configure in front of “Development Push SSL Certificate” (this is the certificate used during development, when the app is ready to hit the appstore same steps need to be followed for the “Production Push SSL Certificate” option.
Step3: Open Keychain Access on your Mac and from Keychain Access -> Cerificate Assistant click on “Request a certificate from a Certificate Authority”. Then enable “save to disk” radio button. use any email or name and save it to your disk.
Step4: Now from Keychain Access, in the Keys section you should see two keys with the name you specified (one private, on public) right click on the private key, and select export key. then select the .p12 type and save it. you’ll be asked to give it a password and then asked for the Mac’s admin password.
step5: Now go back to the provisioning portal and upload the certificate (the file you generated in step3). The portal will generate a SSL certificate for you. Download the certificate (this will be valid for 3 months) we now have three files. put them in one folder.
step6: for this step we assume you’ll be using the SSL certificate for a PHP service and therfore we’re going to generate PEM files out of our CER and P12 files and then concatinate them in a single PEM file. The following Commands will be written in the Terminal opened in the same directory that our files are in:

Step6-1: Converting the CER to PEM:
$ openssl x509 -in aps_developer_identity.cer -inform der -out CER.pem
Step6-2: Converting the P12 to PEM, it will ask you for a password. you MUST provide a password.
$ openssl pkcs12 -nocerts -out P12.pem -in {YOUR_P12_File_Name_Here}.p12
Enter Import Password:
MAC verified OK
Enter PEM pass phrase:
Verifying - Enter PEM pass phrase:

Step6-3 combining the two .PEM files:
$ cat CER.pem P12.pem > ck.pem

step7: Now that we have our .pem file, go back to provisioning portal, and if you already haven’t create a new provisioning profile for this app ID. for this click on the Provisioning option on the side bar then click on New Profile and fill it the form. Hit submit. wait a few seconds and refresh the page. You must be able to download the profile now. Download it and drag it onto Xcode to add the profile to Xcode.

And that’s pretty much it for the setting up. Part two will focus on how to make your app ready for Push Notifications and also how to write a simple web service for your Notifications.

Categories: Apple

Muse Survival Piano and Vocal cover

July 14, 2012 Leave a comment

So they released a new single and I couldn’t resist covering it!

Categories: Uncategorized

Adding SearchBar to filter TableView Data

July 8, 2012 Leave a comment

step1: add a searchBar UI element to your tableView and create and outlet for it.

step2: in viewDidLoad (or similar), set the searchBar as self-delegate:


step3: add a bool variable to your class, I’ve called mine isFiltered

step4: implement the searchBars textDidChange delegate method:

 -(void)searchBar:(UISearchBar*)searchBar textDidChange:(NSString*)text
  if(text.length == 0) self.isFiltered = FALSE;
    self.isFiltered = true;
    newData = [[NSMutableArray alloc] init];
    NSObject *item;
    for ( item in tableFullDataArray){
    NSRange nameRange = [item.sometextproperty rangeOfString:text options:NSCaseInsensitiveSearch];
    if(nameRange.location != NSNotFound) [newData addObject:item];
  [self.updateTableView reloadData];

step5: alter the tableview datasource if isFiltered is True. You must change the rowsInSections, and cellForRowAtIndexPath methods. if isFiltered is true, you want to use the newData array. if not, you want to use your complete data array.
step6: finally, to get rid of the keybaord when user taps on the search button, you must also implement the searchButtonClicked delegate method:

-(void) searchBarSearchButtonClicked:(UISearchBar *)searchBar{</pre>
[self.searchBar resignFirstResponder];


Categories: Uncategorized

Instagram Puzzle solution

November 16, 2011 1 comment

Instagram challengeSo. I managed to solve Instagram’s puzzle and submit it hoping to get a job (or at least a T-shirt!). I understand there are quite a few people who’d be interested to see the solution so I decided to publish it here. It goes without saying that by now thousands of people have submitted their solutions so if you’re planning to send this in, well you’re an idiot. jk feel free if you want 🙂

Before showing you the code let me tell you a cool story my bros 🙂


00:00 am Tuesday Nov 13 : I’m browsing through tech blogs and see the challenge advertised on TechCrunch. Immediately start drawing possible solutions on paper. it seems to be really easy.

00:30 am: I decide to stay awake and write the code, shouldn’t be hard. The challenge tips to use of PIL, a python library. Python… it’s been 3 years since last time I barely spoke any python. I Try to get DrPython and PIL installed on OS X. no luck. then I download Ubuntu,  install it on my machine.

01:30 am: DrPython and PIL work fine on Ubuntu. Time to think of an algorithm, then draw a few flowcharts to get an idea of how to write the code.

02:00 am: It seems like I have a solid and logical solution, shouldn’t take much to write the code. start coding

03:00 am: dear lord, I can’t speak any python at all 😦 help Google!

04:00 am: Migrane kicks in, terrible headache. but Google’s once again proven to be helpful!

05:00 am: I’m making progress managed to score the shreds based on their compatibility now need to find out how to find the right order (didn’t think of this when I did the flowchart :/ ) My head, it is in a BAD situation.

07:30 am: Phew! it works!! spent ages on figuring out how to crop the regions from the original and place them in the out put only to realise it was actually written on Instagram’s blog post as a “hint” 😐 at this point I feel like someone’s axing my head… from inside.

08:00 am: solution submitted. now I can get some sleep… oh wait. need to be in uni at 10 :/


Now, these few lines took me 8 hours to write. Surely if I knew python i wouldn’t have taken so long. It sounds dead simple. yeah it is to read, but certainly not to come up with! I hereby grant permission to anyone to use any part (or the entire) code for any (peaceful) reason. Credit is not demanded but much appreciated 🙂 feel free to ask any questions.

NOTE: you need to download the shredded puzzle from here, name it in.png and put it in the same folder as your .py file

"""Instagram Challenge"""

from PIL import Image
import math
import operator 

def bigpick(matrix,i):
    for j in range(20):
        if newtemp>temp:
    return index
def make_list(size):
 mylist = []
 for i in range(size):
 return mylist
def make_matrix(rows, cols):

 matrix = []
 for i in range(rows):
 return matrix
def getpix(x, y):
       width, height = image.size
       pixel = data[y * width + x]
       return pixel

image ='in.png')
data= image.getdata()
x, y = 20, 90
scores= make_matrix(20,20)

width, height = image.size
for shred_number in range(20):
 x1, y1 = shred_width * shred_number, 0
 x2, y2 = x1 + shred_width, height
 points= x1,y1,x2,y2
for i in range(20):
    for j in range(20):
        for y in range(359):
            for p in range(3):
                if diff<10:
            if tempscore==3:

for i in range(20):

resault.sort(key=lambda x:x[0],reverse=True)


while orderIndex>0:
 for item in resault:
    if item[2]==order[orderIndex]:
    order[orderIndex]=newIndex"RGBA", image.size)
for i in order:
    unshredded.paste(source_region, destination_point)

Long Texts And GridViews: What A Tooltip

September 13, 2011 Leave a comment

Yet another GridView tweak. Ever tried to display a big chunk of text into a GridView and saw your entire page ultimately ruined? Fear no more. There’s a very, very simple solution and that is using a Tooltip. It’s easy to do, just follow these steps:

1Cut a hole in a box: First, we need to create a RowDataBound event for our GridView. You can find this from GridView properties -> Events -> Data-> RowDataBound

In your .aspx page it should look something like this:


2- You put your junk in that box: in the code behind, populate RowDataBound

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
            if (e.Row.RowType == DataControlRowType.DataRow)
                ViewState["myToolTip"] = e.Row.Cells[0].Text;
                if (e.Row.Cells[0].Text.Length >= 30)
                    e.Row.Cells[0].Text = e.Row.Cells[0].Text.Substring(0, 30) + "...";
                    e.Row.Cells[0].ToolTip = ViewState["myToolTip"].ToString();


3- Make her open the box: now if you just hover your mouse over the row containing … a tooltip will appear with the complete string in it.

And that’s the way you do it!

Categories: Uncategorized

The HTTP verb POST used to access path […] is not allowed. (ASP.NET)

August 9, 2011 Leave a comment

Hello dear developer who found this page by Google-ing the infamous error message! This error might show up for a number of various reasons. It’s widely discussed on the forums etc and is often over complicated.

Now, if you get this error after clicking on a link button there is a very simple solution to this. Don’t use LinkButton ! Instead grab a HyperLink control from the Toolbox. HyperLink has a property named “NavigateUrl” which can be set from either code behind or in Properties window.

From what I understand the difference between HyperLink and LinkButton (which well explains this error message) is that a LinkButton performs a server PostBack while HyperLink simply redirects you to the URL you set for its NavigateUrl property.

Therefore LinkButtons can’t be directly use to redirect the browser to another directory root. If you haven’t noticed, when you get this error, click on the address bar and hit enter. Yes, it does load your requested page. And that’s because you don’t PostBack this time.


However if the LinkButton is not why you get this error, your solution might be a bit tricky and it usually has to do with handler mappings that IIS does. Have a look at the following link for an example:

Luke Melia » ASP.NET – The HTTP verb POST used to access path … is not allowed 

Categories: Uncategorized