Snippets code from my daily experience

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 :P (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 :P
  • 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, 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 :P 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 :D (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.