Snippets code from my daily experience

August 29, 2010

Sunday thought: Discarding localizations from extensions

Filed under: extension,localization,sunday_thought — dafi @ 11:30 am

XUL is so flexible that creating localized extensions is incredible easy, adding new languages is simple and the developer effort is very low.

So adding locales is technically trivial but having locales updated can have a dramatic impact on release process.

Everything is based on voluntary contribution and this is simply awesome but very often localizers stop translation without tell anything, other translators can’t respect deadlines, this is voluntary activity so if they can’t do it means simply they can’t do!

I’m very sad but I’ve decided to drop localizations inclusion from my extensions I leave only my mother tongue and obviously English.

Epic fails

A short list of attempts I’ve done to obtain completed locales but without success

  • Contacting localizers asking to complete localization without receiving reply (bad citizens???)
  • Searching other people to continue translations
  • Asking translations for less than ten strings per release (including accesskeys and key)
  • Setting long deadlines (two/three weeks) discarding periods closer to holidays (summer/winter)

Technical workarounds

I know there are many ways to have an incomplete locale using en-US for missing strings, (read Firebug lesson) but I really dislike mixed locales and I’m a zero-or-one man so complete locales go inside XPI, incomplete locales not bundled!

I surrender

So finally I’ve decided to stop locales inclusion, I will continue to write code compliant with locale rules (eg no hard coded strings) because it’s easy and really useful.

January 10, 2010

Sunday thought: Please don’t kill XUL

Filed under: sunday_thought,xul — dafi @ 3:33 pm

After reading the Mike Connor’s blog post and the Firebug’s post blog I realized XUL developers are closer to a revolution.

I have only a few questions in my mind and my stupid answers.

Q: Is it really so difficult to write XUL extensions?

A: For me no and I’m not a so clever person! OK there is a learning curve but every complete (non strictly complex) system requires to study, to learn and to compare itself with other people. Please don’tΒ  confuse “rich” with “complicated“.

Q: We really need new addons ecosystem?

A: Maybe we need a lightweight ecosystem but XUL is the right way, Jetpack sounds good but today it is strongly tied to the browser, this will change when Jetpack for Thunderbird will be published.

I love Jetpack believe me πŸ˜‰

Jetpack suffers from its so called “JQuery oriented syntax”.

I don’t like the sentence “JQuery oriented syntax” simply because doesn’t exists a “JQuery syntax”. JQuery uses Javascript closure syntax construct, I admit sometime it is very ugly and code tends to became naturally obfuscated

Are we sure “JQuery oriented syntax” is really so simple for newbies?

I agree with Daniel Gazman blog post, solution can be worst than the problem.

Q: Is restarting the browser after an addon installation so terrible?

A: I want my Operating System doesn’t require to me to restart after an update but I don’t care if my browser must be restarted after an addon installation/update. People are so lazy, people are so stupid? They accept OS reboots but suffer browser restarts? This is really a strange world!

Q: Is the problem related to Google Chrome success?

A: I don’t like so much Google Chrome, ok its startup time is amazing, then? What other feature is so fantastic? I’m a programmer and maybe I don’t see “commercial” related problem.

Maybe someone forgets that “Firefox is a platform”, Firefox isn’t a simple browser.

You can reuse your XUL platform know-how to create extensions for other applications; Thunderbird, Komodo, Songbird, Prism (my favorites four XUL applications)

You can create standalone applications using the XUL platform, too.

You can use extensions also on your mobile phone thanks to Fennec.

Please apologize me for my bad English and my rant

December 20, 2009

Contributions, now it’s my turn (Sunday Thought)

Thanks to the contribution platform available at AMO I bought one book and a couple of software licenses (not open sourced).

I can say that the AMO contribution feature is a great success for me, dozen of donors for two ‘not so famous‘ extensions like Table2Clipboard and ViewSourceWith.

Now I’ve a little budget to use to make contributions because NOW it’s my turn!

I’ll contribute to Firefox extensions without forget other open source projects especially the utilities, I love the little time saver applications πŸ˜›

I chosen low ‘Suggested Donation’ amount for my extensions but this has generated very expensive PayPal fees per transaction so I’ll make fewer contributions but all higher than 5$, I would the software authors take maximum profits from donations.

I hope in my country (Italy) PayPal made available micropayments very soon.

I would like to receive contributions also for my Komodo extensions, strangely the official dafizilla website doesn’t attract donors (I don’t like to fill it with banners and donations messages), I hope rumors about the Add-On Store will be confirmed and the store will host not only browser (i.e. Firefox) extensions and more important it will host also free/open source components.

April 12, 2009

Should Komodo macros have to support auto update? (Sunday Thought)

Filed under: komodo,macro,sunday_thought — dafi @ 1:00 am
Tags: , , , , ,

The Komodo macro ecosystem grows quickly and many state-of-art macros born every day.

I’ve already said in the past that Komodo macro environment is powerful like Microsoft VBA although it has many lacks (like UI creation).

I would have a similar environment on every Mozilla based application something like a KoMonkey or GreaseModo πŸ˜› (Komodo macros plus GreaseMonkey).

Macros become more complex and the authors release many revisions thanks to community feedback but today it is difficult to stay tuned when new versions are published.

Adding an update checker to KPZ files is possible but not easy, many technical aspects must be considered.

Today the best approach consists to pack macros like extensions (XPI files) but developers need deeper knowledge and this should be frustrating.

I’m sure the Komodo macros are at the beginning of a radical evolution

January 25, 2009

XUL developers please add id attribute to elements (Sunday Thought)

Filed under: sunday_thought,xul — dafi @ 1:00 pm

The XUL overlay mechanism is great, it allows to extend virtually any UI widget.

Damn, why developers continue to forget to add id attributes to elements candidate to be re-used (ie all)?

Please dear developers follow these simple rules

  • Please don’t forget windows and dialogs or simply refer to this short list πŸ˜›
  • Please don’t forget menu and menuitems (not generated dinamically)
  • Add id attribute to every element
  • Add id attribute to every element (#1)
  • Add id attribute to every element (#2)
  • Add id attribute to every element (#n)

iwilluseid

Based on my experience no application is fully compliant: Firefox, Thunderbird, SeaMonkey and also Komodo contain elements I needed to access without an associated id attribute

How to survive to bad practices

Sometimes (but not always) it is possible to use some workaround.
Consider that workarounds can be worst than initial problem

  • Find target element with getAttributesByName method, it is especially useful for menuitems passing the ‘value’ attribute
  • Find an element closer to the target using its id then navigate DOM with methods/attributes like firstChild & co.

December 28, 2008

Spread XUL (Sunday Thought)

Filed under: sunday_thought,Uncategorized,xul — dafi @ 11:26 am

My friend Hamen made me a question about context menu on statusbarpanels, the answer was very trivial for me but I realized should be complicated to find XUL snippets using only web search engines (eg googling).

Are duplicated informations present on the web the hell?

Suppose you need to write some code to read a socket in C/C++ or Java or your preferred language and you use Google or Yahoo to find a snippet, your search produces millions ofΒ  interesting results so the information is duplicated and this duplication can confuse you but it has a great advantage, you can copy and paste like a monkey πŸ˜› discovering the code fits your needs.

Please consider duplication different from clone, duplication from my point of view means “the same topic explained many times in different manner”, clone means “exactly the same code reported in many different places”.

I don’t consider duplicated informations the hell because you can compare found results, you can discover new techniques or simply you can study deeply some aspect of the original problem.

Today XUL/XPCOM searches rarely produces hundreds (certain not millions) of results, the developer is like a pioneer.

I like to be a pioneer πŸ˜‰ but a novice developer can feel discouraged.

XUL developer isn’t alone, he/she has many friends

Ok, actually web search results about XUL are not comparable to other programming languages but developer can use al least two types of resources: human and software

  • Human

The irc channels are great, I always found people ready to help me, also forums and mailing lists are very useful.
Honestly I consider some forum less useful, rarely I’ve received reply to my posts but I’m sure my ugly english didn’t helped me.

  • Software

lxr is the first resource developer must learn to use, searching XUL code directly inside code

MDC and XUL Planet don’t require presentation πŸ˜‰

Many novice developers don’t know DOMInspector, this is also due to the fact last Firefox releases removed it from standard installation

Help the community to help you

I admit, IRC is my preferred way to ask help but to speed up the process I try to prepare the code to discuss about so developer encounter another friend, the pastebin service.

I’ve written a Komodo macro that quickly submits a code selection to pastebin detecting language and other stuff.

You can find more info here, I’m sure other text editors allow similar solutionsΒ  (if they don’t, drop them and use Komodo)

Unzip the world

Dear novice XUL developer, you must simply unzip the world!

What you are trying to do probably is already yet been done, so unzip extensions and take a look at their javascript/xul code.

The 80% of extensions don’t contain platform specific binary code so you can find all inside the XPI.

If you can’t access to Internet try to obtain a tarball with Firefox (or any other Mozilla application) source code and use your editor ‘Find in Files’ feature.

Take a look also inside the chrome directory of your installed Firefox πŸ˜‰

I will try to spread XUL

Using this blog I want to create duplicated informations πŸ˜€ (garbage??)

I will start a new section dedicated to XUL snippets for beginners users (like me at all), this snippets will be ready to run (when possibile).

I hope to spread XUL know-how starting from the basics.

July 27, 2008

The importance of donations for indipendent software developers

Filed under: sunday_thought — dafi @ 9:06 am

Today is Sunday so I do some thought…

My bonsai Mozilla extensions are used by many users, I receive many ‘Feature Request’ on related forums and I try to satisfy users when their ideas are compatible with my free time.

Users can donate to me and 5% of donations go to SourceForge, where I host my bonsai extensions.

Since 2005 I’ve received only one donation (5 US dollars) so I think my donation requests have failed.

ViewSourceWith and Table2Clipboard receive many new feature requests but nobody donate to them.

I’ve a laptop ASUS L2420 with 512 Mb (RAM) and 20Gb (HD) and I want to replace it, believe me it is very difficult to run KomodoEdit and Firefox 3 together under Feisty.

I love MacBook (Pro) but it is impossibile to buy it for me at this time, my budget is 300-500 euros (500-800 US dollars).

I found a real PC (not Asus EEEPC) at 500 euro but if I have had some donation…

Suppose all my extensions are daily used by 500 satisfied users and all decide to donate 5$.

After subtracting SF fees and SF donation 5% I receive 3.8$, -3% of paypal fee I arrive to ~3.6$.

3.6 * 500 = 1800$ enough to buy a MacBook (no PRO) with 4Gb of RAM…

But I’ve only 5 dollars…

Blog at WordPress.com.