terça-feira, 7 de dezembro de 2021

How to migrate large ammount of data from Drupal 7 to Drupal 9 (or Drupal 8)

Everyone who works with development of websites faces with a common challenge of keeping the code updated. With Drupal it´s the same. Drupal 7 was widely used for several companies and institutions. Then Drupal 8 came with innovations and different ways of working using composer and symfony. Drupal 8 themes also changed they way it is built using twig templates. Now we are facing with Drupal 9 which improved the performance of the CMS and brings to the developer a better experience, clean code and more secure system. 

So, now we need to plan how to migrate a large ammount of data from a Drupal 7 to Drupal 9, ok? But, we all know that many modules that were used in Drupal 7 were not updated to Drupal 9. Also, the software architecture are not the same. 

Anyway, the first migration test were made using Migrate Drupal UI module. But, as expected, the migration didn´t work well because our Drupal Websites were built using a bunch of modules that are not compatible with Drupal 9. So, many data were not migrated. 

The second and best solution were plan the migration using views to export a JSON content and Feed Importer. Basically, the solution to export the content could also work well using Views Data Export using CSV or XML. But as I´m planning to work with JSON to spread data into multiple websites in my work I decided to use Views Data Export - JSON Support.
Step 1) Copy the taxonomy if it exist 

 - the first step was to export the taxonomy structure using views data export with CSV format (Drupal 7)
- Next step was to import the taxonomy structure using Taxonomy import (Drupal 9) 

 Step 2) Export the content in JSON format using Views Data Export - JSON Support 

 This seconde step was to prepare the JSON structure in Drupal 7 website. I have created a single view with data export format and configured to export JSON format. The fields were set with lowcase letters and no accent. Also, the images path and file path were set as a field. The body content were set to export in html format. This way, the solution to migrate the all the files was to copy the /files folder into the new drupal 9 website. This way, the path were kept the same. After finished the view with data export and set the URL to access it, we are able to download the content. 

Step 3) Create the content types in Drupal 9 structure 

In this step I have prepared the content type with the necessary fields and body content with full html set. We have created simple fields and also paragrapth fields. 

Step 4) Set the Feed Import module in Drupal 9 website 

This final step is related to the feed module which allows data to be importer. In this step, I have tried to import all the data from a specific content type in Drupal 7 but it was so much content that it caused a timeout error. So I decided to migrate data per year. But it also caused an error because of the large ammount of data. This way I download the JSON data first, instead of accessing the data from a URL. The first migration were done with 637 nodes from the year of 2020. After that I just checked with the files and images were copied into the Drupal 9 instance with the root folder /files. 

Step 5) Don´t forget to clean cache, rebuilt and refresh the database. Using drush you can do it easily. 

If you have experienced troubles during the migration of content from Drupal 7 to Drupal 9, don´t hesitate to contact me. My e-mail is keyneskanno at gmail dot com. Have a lot of fun!

terça-feira, 21 de julho de 2020

Como configurar múltiplos websites utilizando o CMS Drupal 8

Para configurar o Drupal 8 para permitir N sites em uma única instalação, faça o seguinte: 

1- Realize a instalação do Drupal, seguindo o passo a passo do site oficial. 

O recomendável é instalar o Drupal utilizando o Composer. O Composer é um gerenciador de pacotes para a linguagem php que auxilia na instalação de dependências e bibliotecas necessárias. Após a instalação do composer, realize o seguinte comando para instalar: 

exemplo: composer create-project drupal/recommended-project:8.9.2 html

Neste exemplo, escolhi a última versão estável 8.9.2 na pasta raiz "html". 

2 - Após a instalação, vá ao diretório onde está o código fonte do Drupal. Localize a pasta "sites". Dentro da pasta sites, existe um arquivo chamado example.sites.php. Renomeie este arquivo para sites.php. 

3 - Abra o arquivo sites.php e insira no final do código o seguinte: 

exemplo: $sites['nomedosite.com.br'] = 'nomedosite.com.br';

Em "nomedosite.com.br', insira o nome do site website. 

4 - Em seguida, crie a pasta com o mesmo nome que você escreveu em /pastaraiz/sites/ : 

exemplo: mkdir nomedosite.com.br

5 - Dentro da pasta "nomedosite.com.br", copie o arquivo default.settings.php que está em /sites/default e renomeie-o para "settings.php"

6 - Siga o passo a passo natural da instalação e sempre que precisa criar outros websites, faça o mesmo procedimento, inserindo código no arquivo sites.php. 









quarta-feira, 6 de fevereiro de 2019

Web Scraping

Uma técnica muito interessante tem sido usada nos últimos tempos. Chama-se web scraping. Não confunda com data mining!

Web Scraping (raspagem da web) é uma técnica de extração de dados da web, usualmente conteúdos html ou xml.

É uma maneira de obter dados de um website por meio de um processo automatizado. As ferramentas realizam consultas para as páginas solicitadas e, em seguida, vasculham o código HTML e recuperam os itens específicos.

Com Web Scraping podemos recuperar dados valiosos e exportar para uma planilha excel ou outro formato para análise de dados.

Existem diversas ferramentas que fazem o webscrapping. Algumas exigem conhecimentos de programação, outros fazem de forma automatizada. Obviamente, as API de web scraping permitem customizar melhor o interesse do seu cliente, podendo aprimorar a extração de dados.

Para mais informações: www.google.com.br




quarta-feira, 29 de agosto de 2018

Best databases for searching articles related to Computer Engineering and Computer Science

Here is the list of databases to search relevant articles in the area of ​​Engineering and Computing. The list is not in order of relevance:

Suggestion:

  • Search for recent articles of maximum 5 years;
  • Give preference to magazine articles whose publication criteria are usually higher;
  • Also search for Google in journals / journals in your research area.

Melhores bases de dados para pesquisar artigos de Engenharia Elétrica, Eletrônica, Computação

Segue a lista de bases de dados para auxiliar na busca de artigos relevantes na área de Engenharia e Computação. A listagem não está em ordem de relevância:

Sugestão: 
  • Pesquise por artigos recentes de no máximo 5 anos;
  • Dê preferência para artigos de revista cujo critério para publicação costuma ser maior;
  • Pesquise também pelo Google em revistas/journal de sua área de pesquisa.



domingo, 5 de fevereiro de 2017

Como apresentar a leitura de um comando de voz no ambiente de Realidade Aumentada Vuforia - UNITY

A seguir será apresentada uma solução encontrada para o problema de inserção de textos em tempo real a partir da leitura de um comando de voz no ambiente de Realidade Aumentada no UNITY for Android.

Primeiramente vamos apresentar o contexto:


  1. O ambiente de Realidade Aumentada adotado chama-se Vuforia ;
  2. O plugin de comando de voz é o  Android Ultimate Plugin ;
  3. O problema em questão é integrar o comando de voz no ambiente de RA utilizando um botão "falar";
  4. A partir do comando, um texto é apresentado no ambiente validando o comando e em seguida é executado o comando caso seja reconhecido;
  5. Comandos de voz como socorro, me ajuda, estou perdido, automaticamente é realizado uma ligação para o cuidador e uma mensagem SMS também é enviada.

Para apresentar o texto em tempo real, utilizou-se o método OnGUI do Monobehavior:

Este método OnGUI atualiza a interface por frame, ou seja, o texto é atualizado em tempo real.

Os botões foram inseridos a partir do GUI.Button;

O GUI.TextField se encarregou de retornar o texto gerado a partir do comando de voz

Com relação ao posicionamentodo botão e do texto na interface, utilizou-se o referencial Screen.width e Screen.height.

Segue o código do GUI interface:


#region "GUI"
    void OnGUI(){

guiStyle.fontSize = 50;
       
        //imprime um campo de texto na interface e posiciona no canto inferior da tela
        resultText = GUI.TextField(new Rect(350, Screen.height - 150, 200, 100), resultText,25,guiStyle);

       //imprime um botão com um ícone "falar" no canto inferior direito
if (GUI.Button(new Rect(Screen.width -250, Screen.height -250, 250, 250), iconeFalar))
        {
            StartListeningWithExtraLanguage();
        }
}
#endregion




sexta-feira, 11 de novembro de 2016

Simple solution to add 3D dynamic text in UNITY Vuforia

Considering that you already know how to build a simple example of Vuforia in UNITY, I´m going to register here a simple way to add dynamic 3D text.

1) First of all, insert a 3D Text in the scene. Go to menu GameObject > 3D Object > 3D Text. Write any text in there and call it "dynamicText";

2) Move this 3D Text into ImageTarget;

2) Create a C# Script. Right button on Asset windows > create > C# Script.


Write this code in there:

using UnityEngine;
using UnityEngine.UI;
using System.Collections;

public class textScript : MonoBehaviour {

         // Define this variable will allow you to associate your 3D Text. 
         // To associate it you have to grab the 

[SerializeField]
private TextMesh changeTextMesh = null;

// Use this for initialization
void Start () {
changeTextMesh.text = "This is the new text";
}

// Update is called once per frame
void Update () {

}
}

3) Save it and go back to the scene. Grab this C# script into the ImageTarget;

4) Grab the dynamicText into the changeTextMesh variable that is obviously located in the ImageTarget inspector (where you input your C# Script)

5) By the time you connect the dynamicText with changeTextMesh it will work like a charm.