November 2, 2009
October 29, 2009
PluginChecker v0.2
I’ve received great and unexpected feedback about PluginChecker on my previous post so I’ve decided to refactor its code and better integrate with the standard Extensions Manager.
The original ugly dialog has been removed and informations about the new installed plugins are shown directly onto the Extensions Manager.
PluginChecker v0.2 can be downloaded from SourceForge and from AMO.
October 18, 2009
.NET Framework Assistant, automatic plugin installation and PluginChecker
In these days the net is populated by blog posts about the .NET Framework Assistant plugin for Firefox, its disabling and the fact Firefox does not warn user when a plugin installs itself without explicit permission.
Well, this is a old problem at least for me, indeed I discovered it some time ago when my Firefox crashed (apparently) without reason, discovering after a couple of days that Microsoft Office 2003 plugin fought with Foxit Reader and Google update plugins.
The problem was that I never installed Office plugin!
Disabling Office plugin Firefox stopped to crash.
After that experience I decided to write a simple (very simple) extension that at every Firefox startup checks if there are new plugins installed.
Nothing so cool, only a quick and dirty solution implemented in a few of hours.
Waiting Mozilla implements a better solution than mine you can install PluginChecker.
If you expect to find PluginChecker innovative or the “I-can-live-without-it” extension you are on the wrong place, if you expect a not intrusive and simple solution to unattended plugins installation than you can take a look at it.
You can download PluginChecker from SourceForge.
October 9, 2009
September 14, 2009
Table2Clipboard 1.0 now preserves styles
Finally after almost a year I release a new version of Table2Clipboard, one of twelve extensions that won in 2008 the Firefox 2 Contest in the section Runners Up.
What’s new
Until now Table2Clipboard has pasted to clipboard the structure of HTML tables without the styles (colors, borders, fonts) but many users have asked me that the behavior was much more similar to that of Internet Explorer (IE) which indeed maintains many details.
Well, the version 1.0 preserves the styles and in certain cases the result is better than that obtained with IE.
IE inserts also the DOM elements declared “not visible”, for example the table shown in Figure 1 is pasted in Excel as shown in Figure 2.
Figure 1
Table selection on Internet Explorer
Figure 2
Copy from Internet Explorer paste to Microsoft Excel
Table2Clipboard discards hidden DOM elements as shown in Figure 3, this makes more sense for me.
Figure 3
Copy from Firefox with Table2Clipboard paste to Microsoft Excel
Other little improvements
Now web links are copied and user can choose to copy images (tag IMG), too.
All defaults settings can be modified from configuration dialog.
The copy of styles on OpenOffice doesn’t work as well as the one on Microsoft products.
The “Paste Special” feature available on OpenOffice doesn’t recognize CSS styles but only deprecated tags like FONT.
I will add support for OpenOffice soon but I prefer the “release early release often” (after a year???
) approach so this version has poor styles support on the popular open source office automation suite.
Compatibility issues with Thunderbird 3.x are now fixed.
Table2Clipboard can be installed from AMO or from the project site on dafizilla.
August 17, 2009
Experimenting with Bespin plugins
I’ve started to use Bespin intensively, long editing sessions to test how much it fits my needs.
Bespin is very good and I’m really satisfied to use it as general purpose collaboration editor but I’m a very lazy developer and I need many little features, not yet present on Bespin, making my coding life easier.
Bespin supports plugins allowing users to write Javascript code that is easily “plugged” into editor so I started to study its programming model.
There are hundred of APIs but I focused my attention to the specific sections shown below, discovering an excellent support.
- General text handling (unicode support, cursor position and so on)
- Text selection
- Undo/Redo groups of text operations
- Clipboard
More details about installing and using plugins are available at Bespin wiki
A brief survey of Bespin architecture
When plugins interact with the editor soon or later they must use some core components.
- editor itself; It holds reference to all editor structures
- edit session; The current file buffer user are editing
- model; The most important component, it allows to access to text abstracting internal character representation (eg unicode), you see anything as rows and columns
- actions; move cursor, handle history (undo/redo) and many other text actions
It is possible to access to components using the Bespin singletons
bespin.get('editor') // access to the editor component
or navigating the data structure (ok you must use always a starting singleton
)
bespin.get('editSession').editor // access to the editor component starting from editSession
The “Comment Selection” plugin
To understand how Bespin APIs work I’ve written a stupid but useful (at least for me) plugin used to comment out a text selection based on file language, so CSS selected lines are commented using /* … */, HTML using <!– … –> and so on.
The “comment selection” is treated as a single text operation, if ten lines are commented and user makes undo all lines are undone, user doesn’t need to make ten times undo!
Grouping operations for undo/redo it is possible thanks to beginEdit()/endEdit() methods
editor.ui.actions.beginEdit("commentSelection");
...
editor.ui.actions.endEdit();
Stop blah blah blah, I want to read code!
The plugin code is very easy.
We get the selection info (not the text) and then use the model to insert characters, this allows to take benefits of history manager (undo/redo) and character internal representation.
exports.commentSelection = function(instruction) {
var currPath = bespin.get('editSession').path;
var extFile = bespin.util.path.fileType(currPath);
var commentDelimiters = exports.getCommentDelimitersByLang(extFile);
if (typeof (commentDelimiters) == "undefined") {
return;
}
var selection = bespin.get('editor').getSelection();
var model = bespin.get('editSession').editor.model;
var editor = bespin.get('editSession').editor;
var startRow;
var endRow;
if (selection) {
startRow = selection.startModelPos.row;
endRow = selection.endModelPos.row;
} else {
startRow = endRow = editor.getCursorPos().row;
}
instruction.addOutput(startRow + "," + endRow + " model" + model);
editor.ui.actions.beginEdit("commentSelection");
for (var r = startRow; r <= endRow; r++) {
var modelPos = {row : r, col : 0};
model.insertCharacters(modelPos, commentDelimiters.begin);
modelPos.col = model.rows[r].length;
model.insertCharacters(modelPos, commentDelimiters.end);
}
editor.ui.actions.endEdit();
}
You can view the full plugin code following me at bespin.mozilla.com, do login and from command line type
follow dafi
SVN aficionados can browse the code here
August 1, 2009
Table2Clipboard and clipboard application interoperability
Many users asked to me to add to the extension Table2Clipboard (T2C for friends) the ability to preserve web links and maintain the styles during tables copy.
Preserving links and other HTML tags was a very easy task, I’ve written the code very quickly and both OpenOffice Calc and Microsoft Excel have handled correctly the pasted content.
When I started to support style preservation I discovered different and ugly results on the two popular office suites making harder to write cross platform XUL code.
Actually T2C pastes to clipboard inserting data in two different formats (flavors), unicode plain text and HTML format.
When users do “Paste Special” the HTML format is pasted and applications (Excel or Calc) render inside the data sheet.
Both Excel and Calc handle only the deprecated FONT tag and a subset of TABLE tag attributes and this represents a great limitation for style preservation from T2C.
If you try to paste from Microsoft Explorer to Microsoft Excel you discover everything is copied, the styles are totally preserved but if you paste from Explorer to OpenOffice Calc all style are lost!!!
Well, Explorer inserts to clipboard also RTF formatted text and Excel works very fine with the barely public RTF file format.
Clipboard application interoperability goes to hell, HTML is not fully supported by the “Paste Special” feature available on both suites, and as usual Microsoft uses semi proprietary data formats to exchange informations between applications.
I think at least OpenOffice should improve its “Paste” feature simply adding support for HTML style attribute.
T2C can preserve correctly styles only implementing platform specific code for OpenOffice and Microsoft Office and I really hate write specific platform.
I’m considering other alternatives but I see only the darkness of C++, OLE and core dump…
July 18, 2009
Discontinue extensions support for some applications
Before publish new updates for my extensions I try to test them on every application declared supported on install.rdf, this is a very expensive activity when a specific extension runs on different kind of applications and versions.
I add support for a new application (e.g browser, email client, multimedia applet)
- when I use the application itself and I need the extension functionality on it
- when other users ask to me
Now I must decide to drop support for some applications and for specific versions to simplify my release tests cycle.
In some cases it’s easy to decide, for example Firefox 2.x is no longer supported by Mozilla and users continuing to use it are braves or simply fools.
Supporting SeaMonkey 1.x is very hard for me, no special technical problems SM is a very good product but I simply don’t use it.
Instead I’m a satisfied SeaMonkey 2.0 user since alpha1 version.
Supporting Flock, the “social” browser, is easy due to the fact is very compatible with Firefox 3.x but sometimes little differences caused me headaches.
I think to drop support for extensions not Flock centric considering the decision taken from its team last December
Komodo 4.x is no longer upgraded by ActiveState but many people continues to use it, Komodo has a commercial version, KomodoIDE, and not all users purchased the upgrade (me too) so it is very difficult to drop the very old 4.x architecture.
NVU is dead but many users continue to use it also if its sibling/son Kompozer should be strong preferred.
What specifically means “discontinue support”
I would to remove specific tricky code present in extensions to make them cleaner but this can be a bad solution, regressions are always possible so the cure can be worse than the disease…
Removing SeaMonkey 1.x support will make my extension build system cleaner no longer install.js, contents.rdf and informations present both in install.rdf and chrome.manifest, obviously I don’t discard support only to remove a couple of configuration files but I consider it another complication.
So, “discontinue support” for me means moving attention and energies on applications (and versions) I can test easily, on application I daily use, on applications I receive feedback from other users.







