Author Archives: Admin

Could not denormalize object of type , no supporting normalizer found.

I tried to create a custom Rest API with Drupal 8 and it was working great with GET operations. Problem is I wanted more, what about POST, PATCH, PUT, DELETE, … operations ?

Only GET examples were found about Drupal Rest API and nobody had any explanation about this POST response error:

Could not denormalize object of type , no supporting normalizer found.

So I had a look in Drupal Core and found out you need this interesting serialization_class comment annotation. Example with EntityResource:

Actually, if you implement GET, you don’t need this serialization_class to be filled because you only deal with primitive types, but if you want to implement something else like POST, PUT, …, this should be filled with an EntityType so Drupal would be able to understand and cast your parameters to the destination Entity.

Example, you create a VoteEntity and you need to implement GET and POST Rest apis, this should do the trick:

 

Hope this helps.

Failed to get available update data for one project.

I had a problem updating modules in my new Drupal 8 install. This error appeared each time Drupal wanted to do a full update check. It couldn’t even find new version available.

Failed to get available update data.

drupal8error

In Drupal recent log entries I found there was an error with curl and ssl verification:

GuzzleHttp\Exception\RequestException: cURL error 60: SSL certificate problem: unable to get local issuer certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html) in GuzzleHttp\Handler\CurlFactory::createRejection() (line 187of C:\www\drupal8\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php).

It seems curl doesn’t have valid certificate authorities for SSL Validation. So I downloaded this cacert.pem I put in C:\Windows\ and added a php.ini setting:

Then restart your web server and try again a manual update check in Drupal.

It should be fixed !

drupal8ok

 

 

LoadError: cannot load such file — bcrypt_ext

I got a bcrypt error when using Devise on Windows 10 and Ruby 2.2.2p95 and rails 4.2.5

You should have DevKit installed and configured correctly to recompile the gem.

Firt stop your server and remove every bcrypt gem or bcrypt-ruby gem.

Don’t forget to include bcrypt in your Gemfile

make a bundle update and recompile the gem like this

Restart your server.

It should do the trick !

Remove old kernel debian version

After a Debian upgrade, you still have to cleanup the mess like removing the old kernel.

For example I upgraded from Wheezy to Jessie and now I have two different kernels.

My current kernel, the one we don’t want to remove is

Run the purge command with the version you want to remove

A grub generation file should be generated after the purge. If this doesn’t happen, use the command

It’s done.

Your boot menu should have changed and old kernel version should have disappeared.

Update from wheezy to jessie

This is a note I use to update my Debian Wheezy to Jessie correctly.

First, update your current wheezy system and make backups if you care about your data.

Then, you have to replace all wheezy references by Jessie in your sources.list file

Mine is like that after the above command

 

You can now start updating to Jessie. Reload packages list and start upgrade with these commands again

During the upgrade process, you will be asked if you want to remove “root” login permission. Be careful if it’s your only user because you won’t be able to log with “root” anymore.

Take your time to analyze conflicts that could appear between old and new config files. If you don’t care at the moment, just pause installation and keep a backup of old config file and you remember that you have to check it afterward.

I know changes I’ve made to my /etc/bash.bashrc file so I’ll check it later after upgrade.

After everything is finished without any issue, you can restart your server

 

 

How to manage or clean gems

I had to clean my ruby gems because it was using a lot of space. So what were my options to get free space ? One single command to rule them all !

Here is a Windows command to uninstall all gems from your computer except a few one you cannot delete.

On Linux, to remove ALL gems, that would be:

Read More →

Install mysql2 gem on windows

I spent almost an entire evening to find out why I couldn’t install the mysql2 gem on my windows 8.1. Don’t know if it’s easier with previous windows but I’ll show you how I did it.

A bundle install gave me this

Read More →

Make your Drupal 7 faster by removing all revisions

Maybe you were in the same case as me. I got a big database full of revision rows in every revision table with their usefulnessofmeter beyond zero. In fact, I’m pretty sure revisions are not needed in 99.999% Drupal installation.

So, I tried to remove them by disabling the create a revision default option in my content type settings but it didn’t change anything. When you check the database manually, you can see every field has it’s own revision table. If you install the field_collection module, every collections and their fields have a revision table too. I got millions of revisions in some tables for just a few nodes. It was hell. Read More →

Learn Ruby programming language by playing a fun game : Ruby Warrior

I played a really cool game to learn Ruby syntax in a funny way! :D You should try it.

Just control and be a player by typing some Ruby code lines.

It was great to improve myself in loops, conditions, method declaration syntaxes.

Even if I liked the music, at lease the first two minutes ‘-_- , you can disable it top-left of your screen.

Be a Ruby Warrior now ! ;)

Read More →

Error running Development: Rails 3.x launcher script was found instead of Rails 4.x one.

Error running Development: XXXX: Rails 3.x launcher script was found instead of Rails 4.x one. You need ‘C:/XXXX/bin/rails’ script to launch Rails server. Please update server launcher according to Rails 4.x documentation.

We had an error when upgrading from rails 3.2 to 4.0.0. To resolve it, you need to adapt the project structure by renaming the script directory into bin.

Now you should have /bin/rails and no more error.

If you still have a problem, just create a new rails project and copy the bin folder to your old one that need an upgrade to 4.0.0.

Rails 4.0.0 Release Notes