This is James.

Archive

© James Billingham 2010–2013.
  • Tech
  • Moods & Feelings
  • Ideas
  • $0.02
  • Facebook
  • Twitter
  • Making it JSON

    Last night, I was in a Twitter thread which went like this:

    @AlexanderGMiles - “Why must dealing with XML be such a pain with Windows 8 apps.”

    @alexerax - “@AlexanderGMiles DOIN IT WRONG. http://pastebin.com/6rwYPfHW”

    @BillinghamJ - “@AlexanderGMiles @alexerax Or use JSAWN”

    @AlexanderGMiles - “@BillinghamJ @alexerax I’m using an api that only returns in XML :P”

    @alexerax - “@AlexanderGMiles @BillinghamJ Convert that XML to JSON like a real man.”

    @BillinghamJ - “@AlexanderGMiles @alexerax Don’t use that API. It’s not returning worthy data. In other news, I just had an idea for an API which takes in XML or an XML URL and gives JSON back.”

    @AlexanderGMiles - “@BillinghamJ @alexerax Seems like a good idea.”

    I thought it was a good idea too, so this morning, I quickly chucked together an API to help. It’s called “Make it JSON”.

    MiJ allows the conversion of XML to JSON, either by providing a URL to get the XML from, or by POSTing the document directly to the API.

    For now, it does not support any other input formats. If there is demand for it, I can code in more input formats. Obviously, JSON will always be the sole output.

    The API also provides full JSON-with-padding support (JSONP). It’s on http://makeitjson.com and naturally, the documentation is all in JSON-format.

    Example usage

    Below, I’ve provided a few examples of how you can use my API in a few cool ways. All my live examples (noted as such) are making use of jQuery and JSONP.

    My example XML file, (pinched from MSDN) is a database of books - makeitjson.com/sample.xml.


    Firstly, you can just pass that XML file in as a parameter:

    http://makeitjson.com/?url=http%3A%2F%2Fmakeitjson.com%2Fsample.xml
    

    Which will return:

    {"success":true,"result":{"?xml":{"@version":"1.0","@encoding":"utf-8"},"catalog":{"book":[{"@id":"bk101","author":"Gambardella, Matthew", [...]},{"@id":"bk102","author":"Ralls, Kim", [...]} [...]]}}}
    

    You can also POST data straight to makeitjson.com, for example:

    <?xml version="1.0" encoding="UTF-8"?>
    <note>
        <to>Alex</to>
        <from>James</from>
        <heading>Reminder</heading>
        <body>Don't forget to be at the office by 10am!</body>
    </note>
    

    This will return:

    {"success":true,"result":{"?xml":{"@version":"1.0","@encoding":"UTF-8"},"note":{"to":"Alex","from":"James","heading":"Reminder","body":"Don't forget to be at the office by 10am!"}}}
    

    Finally, a live running example (hopefully it’s working). I’ve got this URL:

    http://images.apple.com/main/rss/hotnews/hotnews.rss
    

    Which is an RSS feed from Apple’s “Hot News” page. RSS is a type of XML feed - a perfect example of how you might want to use JSONP: (the callback ? is replaced by jQuery)

    http://makeitjson.com/?url=http%3A%2F%2Fimages.apple.com%2Fmain%2Frss%2Fhotnews%2Fhotnews.rss&callback=?
    

    This is the code: (relies on jQuery)

    <p class="output">Loading...</p>
    
    <script>
    var url = 'http://makeitjson.com/?url=http%3A%2F%2Fimages.apple.com%2Fmain%2Frss%2Fhotnews%2Fhotnews.rss&callback=?';
    
    $(document).ready(function () {
      $.getJSON(url, function (data) {
        if (!data.success) return;
    
        var item = data.result.rss.channel.item[0];
        $('.output').html('<a href="'+item.link+'">'+item.title+'</a>');
        $('.output').append(' - '+item.description);
      });
    });
    </script>
    

    Apple Hot News

    Loading…


    So that’s what I did this morning. Writing this post actually took about 4x longer than actually making the API. Oh well. Hopefully someone might find it useful.

    permalink 3 notes
  • There are two kinds of lazy programmers

    As a developer, I have this perception. Also, I hope I fit into the latter category…

    There are shitty lazy developers and amazing lazy developers. Let me explain:

    Shitty lazy programmers

    These programmers really are lazy. They just write lazy & crap code - end of. It would not be unusual to see a 1000-line-long method which should be split into multiple classes and sub-methods.

    Amazing lazy programmers

    These programmers are good-lazy. They refuse to write any non-DRY code (DRY = do not repeat yourself). These programmers will put in a bit of extra work initially because they can’t be arsed writing more later.

    In large projects, these programmers will actually write less overall, so are arguably even more lazy than the shitty lazy programmers.

    permalink 0 notes
  • EE

    All the details, as they’re announced - apologies, but I don’t have clever auto-refresh stuff - grab your F5 key

    Network name is definitely EE - @EE. Hashtag they’re using - #4GEE

    4G will not come to T-Mobile/Orange. EE only. EE will cover both 4G and “superfast” fibre broadband.

    11 million households by the end of the year will be able to receive the broadband. Available for both business & consumer.

    EE logo

    Seemingly in various colour combinations:

    EE logo variation

    EE logo variation 2

    Nothing said about the iPhone 5 yet – doubt it will be as Apple haven’t officially announced yet. That’s tomorrow.

    5x faster than 3G. Launching in “coming weeks” Live for testing right now in London, Birmingham, Cardiff.

    250% year-on-year growth in mobile data usage. Boris Johnson apparently looking bored. :P

    Debate as to how on earth you’re meant to pronounce the name.

    LTE coverage by christmas in these places:

    • London
    • Birmingham
    • Cardiff
    • Bristol
    • Edinburgh
    • Belfast
    • Leeds
    • Sheffield
    • Manchester
    • Liverpool
    • Glasgow
    • Newcastle
    • Southhampton
    • Hull
    • Nottingham
    • Derby

    1/3rd UK’s population by end of 2012. 16 cities. 98% coverage by 2014

    Announcing more devices “very shortly” - iPhone 5

    70% coverage by 2013

    So that’s:

    • 2012 - 33%
    • 2013 - 70%
    • 2014 - 98%

    Though 3 do actually have a portion of the 1800mhz spectrum which EE are using for 4G - required by laws, etc.

    Boris Johnson presenting & explaining benefits, etc.

    EE website - www.ee.co.uk Officially pronounced “Eee Eee”

    All 700 Orange & T-Mobile stores to become EE stores. Presumably killing them off long term.

    Handsets for launch:

    • Samsung Galaxy SIII
    • HTC One XL
    • Huawei Ascend P1
    • Lumia 820 & 920 - both exclusive
    • Huawei 4G mobile dongles.

    EE business vision

    Existing T-Mobile & Orange customers will have to move to EE to get 4G. Really would be surprised if those brand names weren’t gone in the next two years or so, despite them saying otherwise.

    At present, EE are the only 4G network and are going to be for a while. Spectrum isn’t going to be auctioned off for another 8 months or so. Three do have some spectrum from what EE had, so they might be able to launch fairly soon - here’s hoping, don’t want monopolies on something as important as this.

    Would be VERY surprised if the iPhone 5 didn’t join this list tomorrow.

    EE phone line up

    Proving the speeds. 28mbps down, 22mbps up.

    EE 4G speed test

    I wonder whether the iPad 3’s 4G is compatible with this. I don’t think Apple really knew which frequencies, etc. we’d be using when they released it.

    Note - there is no set release date for this. It’s been in testing for a month though - Tweet from a tester

    EE logo

    Demo showing incredible browsing speeds - virtually instant

    Browsing the web on EE

    As previously mentioned, there is a “period of exclusivity” on the Lumia 820/920, but no mention of how long yet.

    Another big question is data allowance. Unlimited sounds very, very unlikely.

    Big point here:

    So #4GEE success depends on apple announcing an iPhone 5 with 1800 antenna?

    — MRAJPalmer (@MRAJPalmer) September 11, 2012

    OM4G - presumably one of the keywords for an imminent campaign.

    OM4G

    In other, but very related news, Apple’s prepping the Yerba Buena Center.

    Yerba Buena Center

    Hopefully the iPhone 5 will be immediately compatible with EE.

    Press release from Everything Everywhere corporate site - www.everythingeverywhere.com/2012/09/11/everything-everywhere-launches…

    New signal indicator already appearing on handsets

    EE signal indicator

    And now starts the debate on whether to stick with existing networks and hope that they introduce 4G asap, or whether to jump ship to EE. Personally… I’m really not sure. Depends on pricing, but I like the freedom of my one-month-rolling Three contract.

    Details on how Three are going to handle 4G - much faster than the other non-EE networks.

    http://www.theinquirer.net/inquirer/news/2200893/three-picks-samsung-to-supply-lte-equipment

    EE are working on an easy upgrade path for Orange & T-Mobile customers.

    Glasgow are looking pretty happy.

    Glasgow celebrate early rollout

    iPhone with the new EE signal indicator

    permalink 1 note
  • Convo between my 7-year-old students today

    (Names have been altered slightly, just in case.)

    Josie: I have a new crusshhhhh

    Matt: Me too! On a boy!

    Pearl: You're a boy with a crush on a boy?

    Matt: Yeah he's really cute.

    Pearl: Oh.

    (pause for a bit)

    Matt: Boys can like boys. I just an't marry him because boys can't marry boys.

    Me: Yeah they can. You can marry whoever you want.

    Matt: Really?

    Josie: YEAH my tia has a wife so now I have a titi and a auntie.

    Matt: Okay. Then maybe I'll marry him.

    Dave: (from across the room) No you can't you're seven.

    (Age was apparently the only foreseeable problem anyone of my elementary schoolers could see with gay marriage. I almost cried out of happiness. Later, when I was asked if boys could kiss anyone they wanted, I replied "only if they want to kiss you back." And Josie responded "Yeah! Your body your life.")

    My students are the shit.

    permalink 188,562 notes
  • ichi.co.uk: Bypassing The UK Pirate Bay Blocks via Proxies/Mirrors and VPNs

    ichiuk:

    I would like to start by pointing out that I’m not endorsing copyright infringement with this post, however The Pirate Bay has a massive amount of totally free downloads, from music promos to open source software, which the music and movie lobby groups have managed to get blocked in the UK…

    permalink 32 notes
  • Call of Duty vs. Valve games

    The RRP for CoD is £59.99. This is not including ELITE, DLCs or your XBL membership. They release a new one every year. ELITE is £34.99, DLCs are 1200 MS points (£10.20) and I’ll assume there will be three of them, XBL is £34.99. Total yearly cost if you have everything is (59.99 + 34.99 + (3 * 10.20) + 34.99) = £160.57.

    The Valve Complete Pack costs £49.99. Steam is free. This contains every game Valve has ever made (24 of them). Each and every game in this collection is individually better than any CoD game (IMO). All online playing, content, etc. is totally free and will always be. DLCs & updates are free. There is no premium membership. There is no monthly/yearly cost. Total price: £49.99.

    So…

    • £160.57 will get you: CoD plus all the extras. (£125.58 if you don’t include XBL)
    • £49.99 will get you: 24 of the highest quality games ever made, and if you want them next year, you don’t have to pay any more.

    Then on top of that, each of the Valve games are amazing. CoD gets boring and old very quickly. Add on Valve’s amazing anti-cheat engine and (IMO) the quality of the players, and CoD is beginning to look pretty pathetic.

    So why, I ask… why are you all buying all these shitty Call of Duty games when you could spend a third of the money to get all of Valve’s offerings?

    permalink 0 notes
  • Native Steam client for Linux

    Came across the URL for the Mac Steam client today:

    http://store.steampowered.com/public/client/steam_client_publicbeta_osx

    Comes back with a JSON string. Wondered about Linux as have heard about it, so tried:

    http://store.steampowered.com/public/client/steam_client_publicbeta_linux

    No luck - 404. Tried:

    http://store.steampowered.com/public/client/steam_client_beta_linux

    Once again - 404. Then tried:

    http://store.steampowered.com/public/client/steam_client_linux

    Lo and behold, we get a 403. Meaning it exists but I’m not allowed to see it.

    Draw your own conclusions. Seems interesting to me. (Though does seem like it has been around for a while.)

    permalink 0 notes
  • Brendan Eich: people are not always as they seem

    Obviously this is post is all very subjective and opinionated, but this is how I generally feel…

    For a long time, I’ve held a high level of respect for people like Linus Torvalds (creator of Linux), for Richard Stallman (GNU) and generally the people who have done amazing things without having to pile patents or copyright on them and have worked with open source heavily, etc.

    Along with advocating open source and not being evil, I generally feel they’re good with things like human equality and I like to feel that they think “open source” when it comes to equality.

    Today, I heard about Brendan Eich, the man who invented Javascript - something I use on a daily basis and something which is forms key part of the work I do and the services I use.

    A close friend of mine mentioned him. I said I didn’t recognise the name and he said the guy invented Javascript. Instantly I’m thinking “wow! how didn’t I know about him?” and thinking the world of the guy who has changed a LOT about how my life works. Problem is that this guy isn’t quite so lovely and nice and, specifically, he doesn’t really seem to be into equality. He’s strongly against same-sex marriage.

    This surprises me. The guy works at (& is the Chief Technology officer of) Mozilla - an amazing company which works with a massive variety of people from all over the world. Their community is incredibly accepting and inviting of anyone who wishes to be a part of it. How can he fit into that?

    Three years ago, California was debating Proposition 8. This was there to remove the right of gay or lesbian couples from getting married. Brendan Eich donated $1,000 in favour of passing Proposition 8. Brendan Eich is no longer one of the people I look at fondly as a “nice open sourcey guy”. (See: http://projects.latimes.com/prop8/donation/8930/)

    So the friend who told me about this wrote a letter about it a while back. He couldn’t summon the courage to send it, but showed me today and gave me permission to publish it. I think it’s quite a powerful read and maybe might help some people see why equality is important from the personal feelings of someone it is important to.

    Dear Sir or Madam,

    I’m a human. I’m a boy. And I’m gay. I was born nearly 15 years ago in a civilized country and I’m a future webmaker. Since I was born, I always had the illusion that my future would be bright and that people would support me to become what I want to be. I’ve been growing up in a nice country and I have lots of friends who like me, not because I’m like everyone else but because I’m just myself. Diversity has always been a huge and important part in my life.

    Seeing the discussions against same-sex marriages is painful. Every time I see them, I feel like someone is piercing a needle right through my heart. Years ago, I promised myself to always respect other people and treat them in a way in which I want to be treated too. But unfortunately, I’ve learned about what the world really is like and that my life will be quite hard.

    Politicians already put obstacles in my way. I’m only 14 and I want to have a normal like just like everybody else. It was not my choice to be what I am right now, I just want to live in a world where I have the same rights as other people do. Although people say that marriage is only a minor thing, I strongly disagree and to be honest, it is a really personal thing that currently makes me feel misunderstood, disgusted and unwelcome.

    Mozilla is a really huge community. Diversity plays a huge role. There are black people, white people, men, women, kids, Africans, Asians, Europeans, Muslims, Christians, straight and gay people. If you’re against one of these groups, you’re automatically against the whole community. Luckily, there’s no discrimination going on. All members are respecting each other, which is a very good thing. In a community, you have to respect everyone, even their opinions. But it’s important to have a border between opinions and discrimination, and in my opinion, this border has been crossed.

    In a community, we need to be strong. We need to respect each other’s rights and we should never forget how far we’ve come by working in a team. Some comments highly disappointed me. In fact, sometimes, people don’t have a real reason to discriminate someone or something in general, because they don’t have their own opinions. It has happened very often in my life. At school, outside, yes, even some of my friends are discriminating to a point.

    Having your own opinion is important. In fact, it’s one of the main reasons why Mozilla and many other organizations are so successful. We promote choice. We don’t do things like the others do, we do it in a way in which we think about other people, because doing something without keeping other people in your mind would be egoistic.

    Mozilla is definitely one of the best communities ever. The members are very accepting, understanding and whenever I talk to them, I feel like I’m wrapped in a warm blanket made of welcomeness, joy and pride.

    When I’m older, I want to look back and be satisfied about my life, my achievements. I’ve set myself some personal goals that I want to reach by the end of my life:

    I’m determined to move to another country when I’m older, to find a partner and to travel around the world, and I’m determined to marry somebody I love. Yes. There are definitely politicians who can take away my rights to marry someone.

    But they can not take away my pride.

    Faithfully Yours,

    Someone who wants to be like you

    permalink 0 notes
  • alexanderashe:

    So got this office, so here is some photographs… :)

    Bit fuzzy - oh well. We’ve finally cleaned up the boxes and rearranged the desks a bit to be more collaborative.

    permalink 1 note
  • This is an amazing end to the week. We leased our first premises (and omg walking into it knowing it’s ours is an amazing, but also slightly scary feeling). Tomorrow, I will receive my iPad 3. On Saturday, we will be kitting out our office. Good work.

    permalink 0 notes
Older →