Softcore software development
It's all about the cycles
  • Home
  • About

Google Maps and geolocation

Web, hugs, programming No Comments »

I was first made aware of the fact that maps.google.com now uses geolocation by sdwilsh, which is new in Firefox 3.5. But when I loaded maps, I was surprised to see that it didn’t work when I visited the site. And I was using something even more recent than Firefox 3.5, Minefield. Surely, it has geolocation, so what is going on?

The reason maps doesn’t support Minefield is because of *drumrolls* … browser sniffing. Developers… no wait… GOOGLE web developers, I thought we moved on?

The actual bit of code is here unminimized and tidied up ;

function isBrowserGeolocationSupported(){
    if (window.navigator &&
        navigator.userAgent.search("Firefox") != -1 &&
        navigator.geolocation)
        return true;
    if (window.navigator &&
        navigator.userAgent.search("Chrome") != -1)
        return Number(String(/Chrome\/[0-9]+/.exec(navigator.userAgent)).substr(7))>=2;
    var gearsFactory=null;

The hell? Ok, so I understand they do a bit of browser sniffing because it looks like Chrome had a old/broken implementation of geolocation. But I wish there was a more graceful way of doing this (maybe something like navigator.geolocation.version < 1). One that didn't break every application that may implement geolocation that isn't named Firefox. Because, those exist too.


July 10th, 2009 |

Tags: browser compatibility, google chrome, Web




Oh Windows

hugs No Comments »

You are an endless source of joy in my otherwise frustrating Linux life.
Microsoft Windows Operating System has encountered a problem and needs to close.


February 11th, 2009 |

Tags: microsoft, windows error




Dear reddit

Uncategorized No Comments »

Please, please, please stop defending Phelps on this pot thing. You’re not only really bad at defending him (and really, he can defend himself. He’s an adult), but you might be actively hurting the pot movement you are so obviously championing for. You are well intentioned, but please keep thought-deprived comments and headlines to yourself.

If you want to learn more about the movement, both for and against. You can read more about it at the National Institute on Drug Abuse or the National Organization for the Reform of Marijuana Laws. Either of these do a much, much, much better job.


February 8th, 2009 |



Uncovering the underlying metadata

Web, hugs No Comments »

A few weeks ago, I wanted to do some C++ Mozilla coding to make sure I wasn’t going soft. But I didn’t really know what to do. I left it for a bit until I found something weird about the HTML5 spec – there was a method of testing whether metadata has been loaded, but no way to expose the metadata (eg. song title, artist, album, etc) to the user such as through page info.

I think this will be useful. As media starts being embedded into the web browser, it would make sense to start exposing this to the user. I know there have been a few instances where I was listening to something on the radio, but there was little hint of what the song was called (I usually tried to remember a few lyrics and did a Google search. Mixed success).

I brought this up in the whatwg irc channel, and apparently this is being considered for the next version of the spec. Which is understandable, because the server can always display the metadata. But often, media may not be central to the website. For example, background music.

I started look at the Audio/Video backend stuff that moz uses. It got confusing real quick (it doesn’t help that the audio code itself is completely empty). Plus I was in a hurry. So I decided to implement it as an extension.

It was a lovely experience. I had a few problems, including finding out that audio/video wasn’t actually being saved to the cache (bug 469446). It was checked-in like 2 days after I found it out. Also, I hate string very much. The string guide helped, but it is still awful. And I made firefox crash a few times because I’m a nsCOMPtr n00b.

Right now, this extension is working only with ogg vorbis files. Which is stupid because <audio /> is rarely used anywhere, and if it is used, only with certain conditions (wikimedia commons uses the audio tag, but not really. Apparently, the video/audio tags start automatically downloading the media even if it isn’t under autoplay. This is a mess if you have dozens of audio tags in one page. bug 464272). It is so rarely used, that I had to create a audio demo page for testing purposes.

Using it is very simple. Right-clicking on a audio tag brings up the context menu. I decided to use the context menu over Page Info because the media tab of the Page info dialog is very much geared towards images, and that code has to be changed in the firefox source (it’s not easy/pretty to overlay).

audio context menu

Which brings up the audio’s metadata

audio properties

While a lot of metadata is displayed, some isn’t. For example, iTunes has support for cover art as a COVERART header. While you can put that in vorbis, it should be noted that it isn’t widely supported. So I decided to put in only the standard headers for now.

This is dealing with C++ code. Which is much more dangerous than javascript code because NS_ERROR_OMGWTF doesn’t appear in your error console when I try to free an uninitialized pointer. I made basic checks so hopefully nothing bad will happen. But I didn’t do extensive checking in case we have a bad ogg file or something.

Well, to be fair to me, I always save the function’s return value. I just didn’t check whether it passed nor did anything about it. And this won’t just crash at any time. It’ll crash if you try to load the metadata (I’m very nice like that).

The name of the extension is saraswati, named after the hindu God of music and knowledge (really, a Google search helped out a lot here). Please enjoy! (Linux x86, x86-64 and Windows x86 only right now)


January 22nd, 2009 |

Tags: audio, bug, extension, html5, seneca, sleep




Another mix up

personal No Comments »

I came home about a week ago with Toolroom Knights mixed by Mark Knight, instead of my intended target of Mark Oliver. It was OK because I have, and still enjoy, Toolroom Knights mixed by Gabriel and Dresden. Both CD describe themselves as a “journey through the world’s finest house music”. But their styles are so different. I already found it difficult to describe the genre. Now it’s just impossible.


January 13th, 2009 |

Tags: house, microblog, music




Successfully Getting your Addon Reviewed

addons 2 Comments »

As the addon review queue grows beyond 600 nominated and updated addons, it is more important than ever to make sure your extension passes review the first time around. Editors have a review guide, and a well hidden but publicly viewable set of policies. But here is a quick list of the most cited reasons for addon refusal :

  1. Addon should have at least 3 user reviews before being nominated. External reviews count too, but you have to mention them in your nomination message. Softpedia reviews do not count.
  2. Wrap your loose variables. All objects, variables, and anything that your addon makes global should be wrapped to avoid conflicts with other addons.
  3. Look at the error console. Is your extension throwing up javascript errors? Fix it. There are some options you can set in about:config to help you with this.
  4. You break functionality in the host application (Firefox, Thunderbird, etc.).
  5. Your extension doesn’t work properly, or showing unexpected results. This is what user reviews are expected to catch, but you really should get someone who wasn’t involved to test and report bugs.

There are other less common things that can get you busted too. I’ll just list them here for completeness sake :

  1. Including remote javascript/css or other files, anywhere. Include them in your xpi file instead.
  2. CSS warnings on the error console if your submitting a theme.

If you have any doubts, check the public policies page linked above.

And don’t ask when your extension will be reviewed in the comments. Because every answer will be the same : When someone gets around to it. It could be sooner if you’d help!


January 13th, 2009 |

Tags: editor, extension, hugs, mozilla




NSILHNFHDwxyz

hugs, personal No Comments »

This has sorta turned out to be a mashup of NSID. But because I started mid-November, it’s

No Shaving In the Last Half of November and First Half of December. wxyz for the more obtuse title name.

I wasn’t sure when I started. At the very latest, it was November 14th. So yesterday marked the 31st day, and today is the day I can shave it off :) Happy New Years!
It wasn’t easy, and I hate the end result. But I enjoy the not shaving for 31 days part.

I’m covering up my beard here. I wouldn’t look too bad with some facial hair :
In deep thought

A comparison :
Me vs. Waluigi

UPDATE : I originally wrote this mid-December, but kept it in draft until the beginning of January so not to spoil the other participants and for them to get all jealous. Thanks to one of my bank statements, I figured out I most likely started on the 19th, not the 14th. So I shaved 5 days too early. fail


January 4th, 2009 |

Tags: nsid, personal, shaving




deprecate this

Web No Comments »

What I thought was a bug in the jQuery.browser, turns out to be a bug, but on a function that was deprecated (according to their nightly source) and therefore not likely to be fixed. The bug occurred when calling jQuery.browser.safari in Google Chrome. It would return true instead of false because the user agent had the word webkit in it (yes. That’s the browser sniffing method they use). Some simple methods work better than others.

I need browser detection so I can point users to helpful places when they have javascript disabled. Turns out my site is really broken when js is disabled. And when css is disabled as well, but that’s another problem. I made a quick and dirty jQuery plugin that includes konqueror, Google Chrome, and fixes the bug mentioned above.

Using it is as simple as :
$.browser.konqueror
$.browser.chrome

But don’t take my word for it. Try out the demo and view the source! It’s under the MIT license. It’s not included in the source because it is just too much overhead.


January 3rd, 2009 |

Tags: bug, chrome, jquery, konqueror, safari




Cross browser tidbits

Web No Comments »

  1. for each…in doesn’t work in Opera/IE/Safari. So avoid it when creating web pages and use for loops instead. In fact, you shouldn’t even be using it in arrays. oops. (Javascript is special in this way)
  2. While location is defined by most browsers, most let you redefine it in a local scope. Not Opera
  3. $(‘<a>’) may look correct in jQuery, but it will not work properly in IE. You must close the element tag. So it is $(‘<a />’)

January 1st, 2009 |

Tags: browser compatibility, ie, jquery, opera




A lot has changed in 4 years

personal No Comments »

I was bored today. I tried getting Dreamhost to play nice with Django, but they were impartial about the whole idea. It’s not officially supported, so I can’t send angry emails to Dreamhost. In the quest to look for different providers in the future, I found out that my ISP still had some old files that I made back when I was in high school, and beginning college. Back in my old ‘just learning to program’ days.

Ahhh the memories.

I was a big Pokemon/mIRC nerd back then. Yes, Pokemon was still popular to a niche few of us who haven’t grown up completely. It really was a misunderstood strategy game. Definitely a lot more then most people suspect. I stopped playing after the Ruby/Sapphire versions required you to battle for stupid EVs. But I won’t go there (once you know so much, the game gets to be less fun for stupid reasons).

So here is a flashback with links to some of the stuff I did back in the ol’ days :

Revised RBY Bot : this my first big programming project. I wrote a R/B/Y Pokemon battle simulator in mIRC script. It was revised because the first one I did, I took a break from programming after I finished it, and when I went back to it, I couldn’t figure out what the hell I did. I used the worst programming methodology ever: I wrote the entire engine before debugging. No lie.
So I rewrote it, knowing better the second time. It took a while, but I opened sourced it (under no license. In fact, I don’t recall even knowing what open source was. I just gave away the source code. But the objective was pretty much the same).
I pursued this project because there was a competing script authored by someone who wasn’t much liked in the community, but they put up with him because he had a more advanced Pokemon Battle Simulator script (his popularity, IIRC, plummeted when he gave it away to someone else/someone stole it. Rumors were that someone stole it by pretending to be a girl. But that sounds like a complete lie)
So I wrote one because I was fascinated by programming.

I made a blackjack mIRC script. It was fairly popular. I remember giving this away freely too.

MusicTron : A music player was another fun thing I did in mIRC script. I don’t think it was very popular.

Visual GSbot : Because all the advanced pokemon battle simulators where on IRC at the time, they were all command-line. This was an attempt to parse the output of the code and give it a visual representation

One of the 2004 Olympics. The Olympic flame looks like is being used to light a giant joint:
2004 athens olympics

2004 athens olympics

Wow. I haven’t done ambitious projects like those in a while.


November 21st, 2008 |

Tags: lazy, personal




Previous Entries
Next Entries
  • Categories

    • addons
    • hugs
    • Living
    • personal
    • programming
    • Uncategorized
    • Web
  • Recent Posts

    • Update
    • AES and CBC
    • Freshly Baked Bread
    • Minimizing the damage of malware
    • Destination Regina
  • Tags

    "open source" activism audio browser compatibility bug chrome editor extension fennec google chrome house html5 hugs ie intern jquery json konqueror lazy microblog microsoft mozilla music nsid opera personal prism python regina ria safari safe security seneca shaving shoes sleep stats svg tinderbox tip toronto Web wildon windows error
  • Archives

    • February 2010
    • December 2009
    • November 2009
    • October 2009
    • August 2009
    • July 2009
    • February 2009
    • January 2009
    • November 2008
    • October 2008
    • September 2008
    • August 2008
    • July 2008
    • June 2008
    • May 2008
    • April 2008
RSS XHTML CSS Log in
Copyright © 2010 Softcore software development All Rights Reserved
Wp Theme by i Software Reviews
Proudly Powered by Wordpress