Archive for July, 2009

Using Python to Format Json

I have been working quite a bit with Json. Json disregards whitespace by implementation this makes the standard format of Json being a single very long line of not so readable text.
Simple example.
{"query":"some text","results":[{"title":"some result","id":"213"}]}
I had some plan to write some simple python script to format it nicely. I have used the json module before, I wasn’t aware it had a format function as part ofjson.tool.

curl + Json + Python
curl http://domain.com/api.json 2> /dev/null | python -mjson.tool

I found that with our redirection the error output to /dev/null i was getting.

% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 67 0 67 0 0 76 0 –:–:– –:–:– –:–:– 0

Formated Json

{
    "query": "some text", 
    "results": [
        {
            "id": "213", 
            "title": "some result"
        }
    ]
}

Tags: , ,

Tuesday, July 14th, 2009 Programing Comments Off on Using Python to Format Json

So Shiretoko isn’t Firefox So Why Call It That?

I have been using the standard Ubuntu Jaunty repo version of Firefox-3.5 since before it was in the standard security repo when it was in fta’s ppa With this version I expected it to be buggy or have oddities such as being called Shiretoko. With the standard repository version I expect it to be Firefox

I know the reasoning was mentioned here some of the reasoning makes sense but if a user chooses to manually install firefox-3.5 they expect to get Firefox since this wont ever auto auto-update from 3.0 to 3.5 with out the users expressed permission I see this as an annoyance.

Calling it Shiretoko is annoying. Having the user-agent string below tends to break sites.

Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1) Gecko/20090701 Ubuntu/9.04 (jaunty) Shiretoko/3.5

Now I am not saying call this thing Firefox if it is really an ubuntu build of Shiretoko but since Shiretoko isn’t a standard or mainstream browser it wont be in any Device Database. such as WURFL or DeviceAtlas I say these because I mostly work with mobile related technology but the reasoning applies for any device db or user-agent checker.

Face Book makes horrid pop-up windows.

Use the Chat list on the right to start a conversation.You’re using an old web browser to browse Facebook. To use the full version of Chat from within a normal Facebook window, please upgrade your browser. Switch to Firefox.

Changing the user-agent of a browser in this day and age severely impacts on a users browsing experience. Since most websites now try to do browser detection (Some better then others) they generate different output for different browsers or even worse sorry this website only works in Netscape Navigator and IE 5 and above.

Tags: , , ,

Wednesday, July 8th, 2009 Ubuntu 16 Comments

Re Dumping currently loaded Firefox URLs

bryce posted his Perl version of Dumping currently loaded Firefox URLs.

I decided perl is unreadable 🙂 and the file is json any way. So with the python-json package You can get some pretty readable code so I wrote a pretty simple Python version ff-pages.

Usage:
python ff-pages.py /path/to/location/sessionstore.js

I am starting off with python so all comments are welcome.

Update 02/06/2009:
python-json isn’t needed.
Seems to only work with firefox3.5

Tags: ,

Thursday, July 2nd, 2009 Programing 7 Comments

Gmails Label Improvements Broke BetterGmail2

Today Gmail released their improved label support. This update provided some very nice features like drag and drop emails into labels. and changing the order of your labels.

This change did how ever break BetterGmail2 a Firefox add-on. The most noticeable change was the break in the “Sub Labels“. Some of my labels only fit on the screen because the first bit is removed and then indented. Ie I have Mailing List/Ubuntu-za which now only displays Mailing List/Ubu which is rather annoying. The reason for this naming convention is Gmails Imap support does this.

but if you try to add subfolders in your mail client, they’ll become labels that look like this: Folder/Subfolder.

I hope there will be a release patch for this soon.

Thursday, July 2nd, 2009 General 2 Comments

Setting Up MMS On Android

I have had my G1 for quite some time. When I first got it I added the APN settings for basic Internet. Over the last 2 days I have received 2 mms’s I kept getting “Failed to download” oops I had forgotten to set up the MMS proxy settings.

How to get there; Settings -> Wireless Controls -> Mobile Networks -> Access Point Names -> (Select One or create one via Menu->Add APN)
Correct APN settings:
Vodacom:
Name: Vodacom Internet
APN: Internet
Proxy: Leave blank
Port: Leave blank
UserName: Leave Blank
MMSC: Leave Blank
MMS Proxy: 196.6.128.13 (I had it as mmsc.vodacom4me.co.za but this doens’t work)
MMS Port: 8080
MMC: 655
MNC: 01
APN Type: Leave Blank

MTN(I haven’t tested these but they should work):
Name: Internet
APN: Internet
Proxy: Leave blank
Port: Leave blank
UserName: Leave Blank
MMSC: Leave Blank
MMS Proxy: 196.11.240.241
MMS Port: 8080
MMC: 655
MNC: 01
APN Type: Leave Blank

Hope this at least helps some one.

Tags: , , ,

Wednesday, July 1st, 2009 Mobile 7 Comments