Categories
Google

Google Widget Licensing?

Google’s Personal Homepages allow for some really neat widgets. Interestingly, there are quite a few by Google Inc, that even provide source code, so you can see exactly how they were made (super cool!). There is something that concerns me though. No mention on licensing, or how it would even work.

Say, someone wanted to create an open source framework of code for making widget creation easier (such as copy paste of great libraries such like prototype.js, or jslib among others). How would licensing be noted?

Say someone else wanted to create a project under an open source license, and collaborate to create a widget. Again, how would that be handled? Are you limited to purely a <!-- --> comment to display the licensing block?

Some talented Google employees wrote some great widgets, but there’s no license on how they can be used. Ideally they would be under a very liberal license, so that their code could be included under virtually any circumstance to build derivative works.

Looks to me like the Module Preferences need to have a “license”.

I’d be curious to know Google’s intentions/position on this topic.

Categories
Mozilla

Write File

Can anyone tell me why this code doesn’t work in Thunderbird 0.9 (I haven’t tried Firefox 1.0).

Note: There is a slash in the directory path C:, for some reason wordpress is fudging it up. MovableType did this crud too. So it’s not showing, but it’s there in the code.

function sync()
{
testFileOutputStream("C:\foo.txt", "la la la \n robert");
}
 
function testFileOutputStream(path, buffer) {
  // file is nsIFile, data is a string
  var stream = Components.classes["@mozilla.org/network/file-output-stream;1"]
    .createInstance(Components.interfaces.nsIFileOutputStream);
 
  // use 0x02 | 0x10 to open file for appending.
  stream.init(nsLocalFile(path), 0x02 | 0x08 | 0x20, 0664, 0); // write, create, truncate
  stream.write(buffer, buffer.length);
  stream.close();
}
 
function nsLocalFile(path)
{
    const LOCALFILE_CTRID = "@mozilla.org/file/local;1";
    const nsILocalFile = Components.interfaces.nsILocalFile;
 
    var localFile =
        Components.classes[LOCALFILE_CTRID].createInstance(nsILocalFile);
    localFile.initWithPath(path);
    return localFile;
}

Keep getting this error:

Error: uncaught exception: [Exception… “Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIFileOutputStream.init]” nsresult: “0x80004005 (NS_ERROR_FAILURE)” location: “JS frame :: chrome://extension/content/extension.js :: testFileOutputStream :: line 12” data: no]

Simply want to be able to write to C: (or any place on my HD that I specify). Prefer not to use JSlib, simply because I don’t want dependencies. It’s really borderline insane to think you can’t do something as simple as write out to a file without depending on other lib’s.

Thanks in advance.

Comments/Email as usual.