mardi 24 mars 2009

Drupal : Override strings without touching the code

What's up ?
I was trying to implement the "wall to wall" feature using the guestbook drupal module when i noticed that it will be more funny if the user can see wall instead of 'guestbook'.

So ...
So the question now is how do I change the string without touching the module code ? :-? (i don't know if this smiley exists :-))

The vision ...
Then i got a vision :-). Promise me that you won't laugh.

I remembered that when you are using another language in drupal the string displayed is in english only if the language is not enabled or if the string is not translated. Thus if i create a language, enable it, and translate only "guestbook" to "wall" then every where a string should be displayed only guestbook will change to wall and the rest will be in english !!! Isn't that cool ? My mum said that i'll be a good drupaler hehehehe (even though she doesn't know what drupal is :-D).

Don't worry my mum said also that you can be a good drupaler!

How can you do the same thing ?

1- Enable the "locale" and " modules
2- Create a fake language (mine is called fake with the code fk-fake) on /admin/settings/language/add
3- Make the fake language the default one on /admin/settings/language/
4- Search and translate the 'guestbook' (or the string you want) on /admin/build/translate/search
5- Be happy.


PS: In case you can't find the string when searching check if the t() function is used in the module.

vendredi 20 mars 2009

Firefox : Can 2 profiles share one history file ?

I was wondering if it was possible to have many profiles with one history file ? In case this is possible I can have the same autocompletion in all my profiles.

So let's start the investigation (Sherlock Holmes...)

1- I searched what was related to 'history' in one of my profile folder.
I found that:

- Firefox is using 'sqlite' as DBMS (hmmm interesting)
- There are many databases : places.sqlite, and many other sqlite files (content-prefs.sqlite, cookies.sqlite, downloads.sqlite, formhistory.sqlite, permissions.sqlite, places.sqlite, search.sqlite, urlclassifier3.sqlite, webappsstore.sqlite).

2- I started opening some of them and I focused on places.sqlite.

3- I created a link of profileA/places.sqlite in profileB/places.sqlite and rename profileB/places.sqlite. So now i have only profileA/places.sqlite. But I was surprise to see that when I start the 2 profiles, B is working fine but A has lost its memory. There is no autocompletion available for A even when i go to an address that i opened in another tab.

4- After some magick manipulations :-) what I understood is that when a profile is accessing a database, the file is locked so that another profile can't access it at the same time.

So the answer to my question is right now no (because you may never know), 2 profiles can't share the same history file.

BUT I was thinking that a small script (shell or firefox add-on) can update the history (or other databases) on the event 'close firefox' or '... event' :-)

Maybe I'll try it a friday night ... (friday is said to be the inspiration day :-))

See you next time for euuhhh i don't know, we'll see :-)

dimanche 15 mars 2009

Drupal : Change the installation language

Here are the steps to follow when you want to translate the installation interface of drupal.

1- Download the language package from http://drupal.org/project/translations.

2- Copy from the extracted folder of the translation package (french in my case) the 'translations' folder "fr-6.x-1.0\profiles\default\translations" .

3- Paste the folder in "mydrupal\profiles\default".

4- Go and select your language on the installation page.

and here are the installation screens.

mercredi 11 mars 2009

A cool blog i just discovered !!

From somebody close to the drupal dream team :-)

She is called Sacha, she writes well, she is into Drupal, she was at the last Drupal Con 2009 so , read it, bookmark love it :

http://sachachua.com/wp/category/drupal/

jeudi 5 mars 2009

Twitter updates on Drupal

I integrated Twitter in Drupal today !!

Nothing special maybe but it was funny how easy it was. You can also do it in 15min.

All you need is to
- go to this page http://twitter.com/badges/which_badge (you'll need a twitter account even if the updates will be for another account).
- follow the instructions :
+ choose the flash or html widget,
+ choose the number
+ choose the title of the posts' area

- copy the code generated and put it in the content of your block or wherever you want to display it.

PS:

-- Hot tip! To ensure loading of your page even in the case of twitter.com non-loading, move the two lines that start with < type="text/javascript"> to the bottom of your page (just
above the closing 'body' tag )

-- Use the "full html" for your block content in case you are using one to display the updates.

And that's it :-)

mercredi 4 mars 2009

Weird message regarding the Firefox 'Friendbar' add-on

I have noticed something funny and weird today.

Friendbar (https://addons.update.mozilla.org/en-US/firefox/addon/10223), the cool add-on for firefox 'seems not available for linux' when you try to install it on your firefox using Linux(Ubuntu).

But when i download the extension on windows and copy it in my firefox profile on Linux it works like a charm :-).

So my doubt now is about the message I read; is the add-on really available for linux or not (or maybe sometimes it's available and sometimes not) ?

Can you tell me ? yes you why are you smiling, if you know just answer ...

Combine Friendbar with Firefox Profile

Hello folks,
One more funny tip for today .

Friendbar(https://addons.update.mozilla.org/en-US/firefox/addon/10223?lang=en-US):
This add-on will display all updates of your twitter and facebook accounts. You can search on twitter from the same toolbar. You can also change settings like (the update time, the number of latest updates, etc.).

The link with Firefox profile Manager ?

You may not want to always see updates when working or maybe the currrent firefox profile (we use the default profile when none is created) has too much extensions.

So what you can do is to create a new firefox profile before installing the add-on.

Don't cry i'll show you how to do it ok :) ?


1- Start firefox with the '-ProfileManager -no-remote' option

(windows) "C:\Program Files\Mozilla Firefox\firefox.exe" -ProfileManager -no-remote
(Linux) > firefox -ProfileManager -no-remote



2- Create a new profile (mine is called the social_boy :-))

3- Go to the add-on page and install it. You'll need to restart the browser.

4- Create a shortcut to your new profile
(windows) "C:\Program Files\Mozilla Firefox\firefox.exe" -P social_boy -no-remote
(linux) > firefox -P social_boy -no-remote


(change social_boy with your new profile name).

Now that you know how to do it you can cry :-)

dimanche 1 mars 2009

Development tools are important ...

I am more and more aware of the fact that tools can make the difference between 2 developers having the same level. And today when "be able to deliver tasks/projects as quick as possible" is the sucess key we need to know the right tool to use at the right time.

Here are some steps in case you also agree with me (i know nobody wants to change his tool but think of how you can finish quickly your project and watch a cool nice movie :-)) ...


/**
* Know the limits of your tools
*/

Think of how you do things (display line numbers, duplicate a line, etc.) ; if you think you should do it in an easier way then it's time to go back to the tool user guide (I rarely read this precious document before using tools ;-)).
In case your favourite tool doesn't have that feature, don't panic , don't shed tears. Search for other tools having that in addition of the features of your favourite tool.
There is no use to leave a tool having 10 features to another one with less feature.

/**
* Try different tools
*/

It's only by doing so that you'll know if your 'everyday' tool is enough. And the more you try tools, the more you master them. This step will help you identify by yourself what exactely the tool is capable of.
You can for example use Fireworks for images but it's better to work on photos using other tools like Gimp. You can code 1000 lines with Vim but if in Eclipse you can have colours and collapse block of code hmmm...

/**
* "Don't forget me please " is your favourite tool saying :-)
*/

Love a tool but be able to use all tools. Depending on situations you'll have to adjust (on servers you won't have IDEs; you'll need to resolve issues with the old vim ;-)).
You can still code with your notebook at home (in your small room, on your small notebook, with your small drink, while praying that the small packet of chips never finish -i know you like small things-) BUT at office, on project you should think of going faster.


Now i know 1950's geeks will comment saying that they can do as fast as today's tools but it's okay, we are in 2009 :-D