Blog

Sometimes, there is a tight line that separates content from configuration. It's really common to have pages that define a structure, but those pages are content. For example, if I want to create a blog, usually it has an "about" page, that is content, but it's also part of the structure of the page, that is usually considered configuration.

In Drupal, handling these between environments, can be quite troublesome. But there are solutions: you can create the empty nodes programmatically and add them to a menu:

I usually recommend using alternatives to the Drupal core block system, as it's not easy to export and has several limitations like not being possible to put the same block in two different regions, even if they are in different pages. But sometimes it can be useful, mostly if you render them from the code (because you will not export them and then you can place them wherever you want.

If we are using them like that, we can get rid off the hook_block_info. That hook is not really necessary. Here is a small snippet of code:

Before starting with this post, you should have a look at the previous post: Drupal projects architecture.

On the previous post, we have seen another way to organize our projects and to work with Drupal. But, what happens if we already have a site structured in a different way? This post will cover all the different steps we have to follow to re-structure the project into our new architecture.

1.- Create the installation profile

Creating the installation profile it's easy, pick a name for it and create the folder under the profiles folder. Then, create the three files we will be using. With the profile name you choose, create the [profile].info, [profile].profile and [profile].install. Make sure that you don't use a file name of a module that already exists!

This blog post is an overview of what I will talk about (or I have talked) in my workshop of the DrupalDay Bilbao 2014. Slides: https://rawgit.com/DavidHernandez/reveal.js/dday2014/index.html

Before starting, what do I understand as "Drupal project architecture"? A software project architecture includes from folder structure to the workflows and processes of how do we work and what tools do we use. There is no one right solution for this. This is just another approach that I found works well with most of the Drupal projects that I do.

Every project architecture should have different goals:

Community summit

The aim of the discussion was to talk about how the different local groups are organized and what kind of problems do they find and document all of this so it can be used by potential group organizers.

The attendees of the discussion have different backgrounds, from their location having people from Spain, Czech Republic, Austria, Greece, Brazil, Germany, Scotland, Slovakia, Sweden, Holland, England and France, to their experience organizing groups, having people who has been involved in a group for years to people who wanted to start one.

We divided the discussion in all the areas that we think that affect to the organization of a local group, being this areas marketing and promotion, local group websites, reducing burnout and attracting organizers, collaboration, business presence in the group, different types of events, topics and speakers, funding and logistics.

Decisions made and next steps

While giving support about web development, it's surprising how many times you encounter with questions about how to do some stuff that I completly advise against. Most of us find this kind of things disgusting, but there is people who still does it and people who want to do it! So, please, don't do the next things on your website:

Adding background music to your site

I shouldn't have to explain this one. After the frames, this is the worse thing you can do to your website. Is annoying and when browsing several sites, it's impossible to know from where comes the music. Slows down the load of your page, due to the weight of the file, and if it's a light file, probably will be of a low quality.

Opening popups after X time

Last night I was playing a bit with Nodejs, trying to set up a webserver using HTTPS with a websocket. Technically, the code should be almost the same as the HTTP websocket, but the process didn't work as expected and I couldn't find enough information. The problem I found was an internal error from Chrome (actually Chromium), complaining about an insecure connection. The error happend on Firefox (well, IceWeasel) too, but with a different error message.

After several times trying the built-in https server, socket.io and express with no luck, I stumbled with express.io, a library that puts together express and socket.io to make it easier to use. And the code was super simple! So here is the snippet

Requirements:

I want to travel. I want to travel a lot. I like to meet new and different developer communities all around the world. The problem is: I have to work.

But for us, who are developers, that's not a problem as we usually can work anywhere in the world. So, let's make a deal: if you have room for one more in your office or working place, let me know. I don't mind if you are just a freelance who works in a coworking space or at home or you are part of a big company. In exchange, you can come to Valencia, Spain, to our little office, I can even give you a place to sleep! (this last part might not be always possible).

I recognize it, I love science fiction. A few years ago, I started around the internet, checking a lot of lists about the bests sci-fi books and I created my own list of books that I would like to buy and read. I've almost completed my little collection and I'm writing a list with all of them. At the moment, is not fully complete and only contains the books I already read, so I will keep updating it!

You can find it on a Gist I created.

Check the size of a database:

SELECT table_schema "Database",
sum( data_length + index_length ) / 1024 / 1024 "Size in MB",
FROM information_schema.TABLES
WHERE table_schema = 'DATABASE NAME;'
GROUP BY table_schema;

Truncate multiple tables:

SELECT concat('TRUNCATE TABLE ', TABLE_NAME, ';')
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME LIKE 'cache%';

Then, you copy & paste the result into the mysql client.

Pages