Snippets code from my daily experience

September 19, 2011

Signing extensions, McCoy, Spock, Uhura and private keys

Filed under: Uncategorized — dafi @ 6:15 pm

I’ve written many extensions in these years and not all are present on AMO, many extensions are hosted on customers servers and are updated using signed update.rdf files.

Production environments require automated tasks to create and maintain update and I’ve always used command line tools to pack XPI files and generate corresponding update.rdf files.

I’ve always used McCoy + Spock on from linux boxes to achieve these results.

A customer asked me to migrate the env from Ubuntu 64bit to OSX Lion so I’ve decided to drop Spock in favor of Uhura that uses only Perl scripts to sign extensions and doesn’t need a McCoy profile.

The problem was to migrate private keys generated with McCoy and use them with Uhura, the binary version (v0.5) available from McCoy web page doesn’t allow to export private keys but the code present on mercurial has this feature

 hg clone http://hg.mozilla.org/projects/mccoy

so I’ve compiled it and exported all my private keys in a couple of minutes.

Ok a couple of minutes plus 6/7 hours to compile McCoy, the Mozilla build process is documented very very well but I’m lazy and stupid so compiling McCoy and Mozilla necessary files required me a bit of time.

If you need to export private keys from McCoy you can download my compiled version for Linux i686 from here, if you need a version for Windows or OSX I’m sorry but you must compile yourself.


			

November 30, 2010

Off topic post about XUL, Apple, Google and Open Source

Filed under: Uncategorized — dafi @ 8:41 am

I don’t write about XUL since a long time, this is due to the fact I’m spending all my free time writing a Cocoa application for Mac (no iPhone).

I don’t like Apple policies, and I don’t like its “app store” vision, so why I’m writing a Mac app?

In last months I saw Google Chrome be adopted in many places (dropping Firefox), I saw Google Android growing its market share, I saw the “fascist” Apple policy go ahead like a panzer division and this isn’t the web I love.

I don’t like the technically limited Google Chrome browser and I don’t like the “bells and whistles” java based Android OS.

I believe in the Mozilla’s motto “Make the web a better place” but I need to gain from my (low) skill because I’m a person and I need to eat at least one time per day.

I love the Gecko architecture but it’s very difficult (al least for me) monetize my XUL/XPCOM know-how so why not to make a new experience?

I can invest some months to learn Cocoa (its learning curve is high) and create another unuseful duplicated old-designed app ready to be refused-then-hopefully-approved on the future Mac Store.

Firefox 4 is closer to be released (IMHO), the beta 8 is simply fantastic but people continue to switch to Chrome only because it’s faster, if you ask to normal users why they use Chrome they will say “because it’s faster”, bleah NO COMMENT.

Developers say “Webkit Developers Tools is like Firebug” then I reply “are you sure?”, Firebug has tons of features you don’t know, RTFM!

I’ve a couple of feature requests for ViewSourceWith and Table2Clipboard so I hope to close XCode ugly editor to launch my Komodo Edit and start again to work on my preferred platform, the Mozilla platform!

October 29, 2009

PluginChecker v0.2

Filed under: Uncategorized — dafi @ 6:46 pm

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

PluginChecker v0.2 can be downloaded from SourceForge and from AMO.

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.

December 24, 2008

Dear Santa Claus…

Filed under: Uncategorized — dafi @ 2:22 pm

… I would like

  • to get a Mac Book Pro
  • to be invited to participate to a Mozilla event
  • to be hired for an amazing job possibly where I can use my XUL know-how
  • to mate a wonderful blond girl (like this) πŸ˜›
  • to watch the last Heroes and Lost series

October 8, 2008

nsIProcess, Windows and Unicode

ViewSourceWith (VSW for friends) existence was impossible without nsIProcess, VSW must run programs and pass them at least one file name.

When arguments passed to nsIProcess are ASCII strings all works like a charm but you enter the hell if strings contain Unicode characters like those contained in Cyrillic or Japanese alphabets.

nsIProcess, especially under Microsoft Windows, doesn’t work very well with UTF-8 strings (see bugs 229379, 408923, 411511).

On VSW forum an user asked to me to fix the problem but it isn’t strictly related to VSW because the problem affects the XPCOM implementation.

After many attempts I surrendered and I decided to write my Win32 (Win64??) XPCOM component.

My IWinProcess has the same nsIProcess’s method signatures (Init, Run) but accepts wstrings and calls the unicode CreateProcessW Win32 API instead of its sibling CreateProcessA.

The Javascript caller (eg VSW) must pass UTF-8 strings but this is the only constraint.
Now finally I can open local files containing Unicode characters without tweaking the Windows ‘Regional Options’.

Linux seems to work fine (at least on my Gutsy box) simply converting Unicode strings with nsIScriptableUnicodeConverter.ConvertFromUnicode, no other special workarounds.

I don’t know if MacOSX works like Linux, I’m unable to test under Apple machines.

I don’t like code containing platform checks (if Windows … else if Linux … ) but to simplify VSW development the ‘if’ statement sounds reasonable.

The IWinProcess source and DLL are present on dafizilla SVN repository.

The next VSW release (0.4) will contain the IWinProcess component

June 7, 2008

Overload same xul element twice

Filed under: chrome-manifest,overloading,Uncategorized,xul — dafi @ 10:26 am

My extension MoreKomodo overloads many elements

  • command set
  • toolbar buttons
  • menu items
  • find results tab

Due to my laziness I’ve added all these overloaded elements in main morekomodoOverlay.xul file.

It contains not-strictly-related code all together, for example the find results tab code is separated from other UI elements.

I’ve found very useful to overload more than once the same element inside chrome.manifest to isolate xul code and also javascript code.

It’s very easy

overlay  chrome://komodo/content/komodo.xul chrome://morekomodo/content/modokomodoOverlay.xul
overlay  chrome://komodo/content/komodo.xul chrome://morekomodo/content/findResultsOverlay.xul

That’s all folks πŸ˜›

March 23, 2008

Central extensions repositories

Filed under: extension,firefox,flock,komodo,songbird,Uncategorized — dafi @ 10:21 pm

I spend my time to created extensions based on Gecko expecially for

  • Firefox, Thunderbird and SeaMonkey (all under Mozilla umbrella)
  • Songbird
  • Flock
  • KomodoEdit/KomodoIDE

Every product has its own developer website where you can upload your extensions (Komodo hasn’t a dedicated upload zone).

From a visitor/user feedback’s point of view Flock is the best.

Flock addons site is cool I love it, extension informations are very complete, you can see also the locales supported by extensions.

Songbird has a cool addons site simple and very quick, extension informations are complete.

Mozilla with AMO is the most important but is also the worst.

The outsider KomodoEdit addons site not yet really exists, registered users can’t upload their extensions.
I hope Komodo guys take a look at Flock addons site if they decide to create a similar place.

From a developer feedback’s point of view Songbird is the best.
After signup you can immediately upload and publish extension on Songbird site, the upload process is easy and publication policy very developer friendly.

AMO upload mechanism is simple but publication mechanism is awful. I don’t like its approval mechanism based on sandbox, my RichFeedButton waits approval for an year.

Flock allows to upload extensions immediately after signup but publication waits approval, after a couple of days I’m yet waiting πŸ˜‰

The most mature and important addons site AMO, has IMHO the worst user/developer experience.

I don’t like so much Flock but it has a great develope/user website

February 14, 2008

Extend Firefox 2 Contest and other surprises

Filed under: firefox,mozilla,openkomodo,table2clipboard,Uncategorized — dafi @ 9:06 pm

January and February are very important months for my programming activites.

In January ActiveState guys gave me a KomodoIDE license for my contribution to their OpenKomodo wiki, a great unexpected surprise, the first one.

A couple of days ago Mozilla published the Extend Firefox 2 Contest and I discovered my name on “Runners up” list, a great
unexpected surprise, the second one.
I can figure out ViewSourceWith is the winner, no! The winner is Table2Clipboard my outsider extension, a great unexpected surprise, the third one.

I’m happy that other people appreciates my work.

My feed reader alerts me, LifeHacker has new contents, I take a look and found they speak about Table2Clipboard, a great unexpected surprise, the fourth one.

ActivateState gave me a KomodoIDE license, EF2 prices contain a KomodoIDE license, now I have two KomodoIDE license, another surprise the fifth πŸ˜€

Mumble mumble… may I sell the unused license?

January 8, 2008

Richscrollbar top ten download sorted by locale

Filed under: richscrollbar,Uncategorized — dafi @ 7:58 pm

I’ve created statistics about Richscrollbar, I’m very proud to find Japan at 2nd place.

Place Download count Locale
1 138 en-US
2 78 ja
3 19 it
4 18 fr
5 17 en-GB
6 14 de
7 14 ru
8 12 es-ES
9 7 zh-TW
10 4 zh-CN

Italy, my country is 3th 😦

Next Page »

Blog at WordPress.com.