Archive

Posts Tagged ‘Programming’

Encode your JSON data before sending it

January 18th, 2012 No comments

A problem I was facing recently, that the JSON was being receive properly on Firefox 3.6 my work development machine. Finished the project and deployed it. I haven’t tested it on other machines, how clever am I?! I opened my laptop to see how it would appear on other browsers, and shockingly, it wasn’t working at all!

After spending hours trying to locate the line where the error occurs and find out what’s the problem it turned out that I have to decode the JSON output before sending it. I wasn’t using any PHP built-in functionality for JSON, that’s because at work, we are still using PHP4 which has none. I was basically writing the JSON output explicitly. The text output can contain some special characters that need to be encoded and escaped before sending it. After digging around a bit I found out a solution from this post. Everything is pretty much explained there.

In a nutshell, you’ll have to use json_encode() to encode the data from an array and then output it. A JSON library is provided along with that post. There is also a decoding function, but I haven’t use it since I’m receiving my data on a javascript.

Q8CPC – Kuwait’s National Collegiate Programming Contest

April 18th, 2010 2 comments

[UPDATE: the competition has been postpond to September.]

For the first time, the ACM’s International Collegiate Programming Contest is coming to Kuwait by the American University of Kuwait. The contest will be held by May 1st, 2010. The opening ceremony and the practice session will be held two days earlier. More information will be revealed soon.

This contest is a good opportunity for students to prepare for the regional contest ACM ACPC formally known as (ACM ICPC ANARC).

Check the PDF for the “Call for Participation” letter: Q8CPC Call for Participation.

Categories: Programming Tags: , , , ,