mercredi 22 avril 2009

Drupal: Integrate Feedly shared links

I am pretty sure you have heared about Feedly (http://feedly.com/), a firefox plugin, a feed reader integrated with Google Reader (all your feeds can be read in feedly and what you share in feedly is accessible in Google Reader) .

Now my dilemma was to get "feedly shared links in my drupal instance". ?????????


I first as usual went to the headquarter (drupal.org :)) but nobody seemed interested by feedly right now. Then I changed my search; if I can get the Google Reader feeds that are shared then all shared links from feedly will be in the list (I can't imagine a better day ;-)).

So I went back to the HQ and I found 2 modules (don't ask me how :))
  • Activitystream: http://drupal.org/project/activitystream (thanks to akalsey )
  • Activitystream_greadershared: http://drupal.org/node/293402#comment-966480 (thanks to eojthebrave)
The first module is an API for "streams" created in other platforms (delicious, facebook, etc.)
The second, that is a patch/module, gets shared feeds from Google Reader.

How to use them ...

1- Download and install (enable) both modules
2- Get your Google Reader user Id ( in your google reader, click on the “Shared items” and then “Show details”). The user id is displayed in this format Feed URL: http://www.google.co.in/reader/public/atom/user/USER_ID/state/com.google/broadcast
3- Go to "My account" in your drupal instance
4- Paste your Google reader user Id in the “User ID Number: “ field

And you can start going home ;-)

mercredi 15 avril 2009

A new drupal module: userdashboard

I am working this last days on a new drupal module "userdashboard". You will probably say "another module?", "what is so cool about it?", etc. And you may be right but I need to tell first why this new module needs to be checked.

- The dashboard feature ...
Having my page, with my 'content containers' that I can arrenge as I want is something we all look for when we visit a portal/web site.

- The key here is the fact of using 'blocks'...
A block can have all type of information and in case a module is not providing a block that by default the 'views' module is there to help to display the content generated.

So the idea is that if I can display blocks , I can display everything I want (at least what the site admin want me to :), he is the boss).

Thus the module is allowing the admin to select 'allowed' blocks, that the user can 'manage' and then be able to view them on his dashboard.

There are things (especially the UI) I need to improve but I think this can ROCK...

Now why don't you take a look at it http://202.53.13.107:9007/ and tell me why I should stop/continue dreaming about it ? :)

lundi 13 avril 2009

How to add Google analytics to your blogspot blog ?

I finally figure out how to get and see statistics of my blogger blog (when I think I almost shifted because of that hehehe)...

Anyway I was searching and found some tips but they were not working. The main cool tool often mention is Google Analytics BUT it wasn't working for me because for security purpose "the code of google analytics" was parsed (the javascript code).

So before start yelling :) I thought of paying a visit to blogger's gagdets and I realised that this was in fact THE INSPIRATION :).

So now that it is working I'll show you the way, follow me ...

1- Create an account on Google Analytics (I won't show you how to do it, at least not today:) )
2- Copy the javascript code to your blog address
3- In your blogger administration panel go to "Layout" > "Page elements"
4- And in your footer choose "add a gadget" (you may need this http://help.blogger.com/bin/answer.py?hl=en&answer=141483)
5- Choose an "HTML/javascript code block" and paste the google analytics code in the block content.

And you are done. From now on you can view cool statistics for your :)

mercredi 1 avril 2009

Drupal: Modifying core code

I was thinking of one of the best way to "touch" core code (drupal or contributed modules).
This aspect matters when an upgrade is needed. The easier it is the happier you are.

And right now I think I find a "smooth" way.
Let's assume I really need to change the node_save function in the node.module file (I know you were saying: "ALWAYS TRY TO AVOID TOUCHING people's code" :-)).

1- I'll rename the default function to mv_node_save (in node.module) for example.

2- Include, in node.module, my file modif_node.module created in "sites/all/modif_code/modif_node/". And in my new file i will put the code in the node_save function.
So my new instructions will be taking into account without having to do many 'gymnastics'.

3-Keep track of patches : Once the code is in production (basically after major testing), generate patch file to keep track of what has changed. So in my case node.patch will mention only my include and the function renamed.

Thus the day i will need to upgrade, i will change only my code and maybe rename function.
I need to check all this and probably think of some details after some projects.

But I think this approach will make life less painful every time the "upgrade" word is appearing somehere :-).





! test and see ...

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 :-)