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

Archive for January, 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




  • Categories

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

    • Reordering the tab key – tabcomplete
    • (Almost) Can’t touch that new music
    • Endianness, how I loathe you
    • Update
    • AES and CBC
  • 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

    • July 2010
    • May 2010
    • 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