Skip to main content

Posts

Equivalente XPATH para JSON

Trabalhando com estruturas complexas de JSON, eu estava precisando de um biblioteca que executa-se sintaxe equivalente ao XPATH no universo XML porém com estruturas JSON. Nesta pesquisa me deparei com diversas bibliotecas, duas me chamaram a atenção: JSONPath Defiant Testei primeiro o JSONPath por parecer bem simples mas infelizmente sem sucesso, por exemplo, tentei usar um dos exemplos do site e não funcionou : $..book[?(@.price<10 data-blogger-escaped-code=""> Para o teste com JSONPath usei o site http://jsonpath.curiousconcept.com/ e também um código meu. Pode ser um erro meu, algo que não entendi, mas o fato é que apos varias tentativas o filtro não funcionava. Obs: versão 0.8.0 Em seguida passei para o Defiant com grata surpresa, além de ser mais completo é mais próximo a sintaxe XPATH, funcionou de primeira. Abaixo segue um exemplo de estrutura JSON onde se pode testar alguma expressões. {    "store": {       "book": [ ...

Desbloqueando SMTP de uma conta do Gmail para enviar email de aplicações ou serviços!

Construindo um pequeno aplicativo para enviar emails recebidos de um formulário de site, ao testar com alguns emails do Gmail descobri que não estavam sendo enviados, estes emails receberam alertas de tentativa de uso do usuário e senha por uma aplicativo. Pesquisei um pouco como desbloquear o e-mail do Gmail para aplicativos, segue os passos. Efetue login na sua conta do Gmail usando o seu endereço do Gmail e Senha e deixe essa página aberta para as próximas etapas. Acesse a página https://accounts.google.com/b/0/DisplayUnlockCaptcha Tente executar o aplicativo (ou serviço) novamente.

Multi-Tenancy e Cloud Computing

D ue to the traditional software offering "On Premisse" where the application is installed and configured to operate in "data centers" of companies, subject to specific contracts use license, we have a wide range of offerings frameworks, platforms, architecture models, "patterns" and professionals available. The SAAS model has required new architectures specifically designed for Cloud Computing, along with these drawings certain terms gain new status to identify models and technology needs of the moment. One of these terms is the "Multi-Tenancy". The model "Multi-Tenancy" is a model architecture that enables resource optimization of infrastructure and software systems through sharing retaining tenants, businesses / customers, logically separated. At the same time it is desired in supplier´s side a pattern of application / service for highly scalable applications. "Multi-Tenancy" applications typically need to be able to pro...

Parsing XML with namespace in Java

Introduction Yesterday, again, I needed parser a XML stream using Java. Then I went to Google try to find a exemple code. Because I needed the value of two specific fields, TAGs, I decided use XPATH to get directly this values. How ever, I needed do several tried until get a result. Keywords JAVA, XML, NAMESPACE, XML PARSE; Article I will show how to read XML without namespace and after we will read a XML streams with namespaces. This is the first XML that I have used in this example without namespaces <?xml version="1.0" encoding="UTF-8"?> <root>   <head>     <title>My Book</title>   </head>   <bookreview>     <title>This is a book about special girls</title>     <girls>       <girl>         <name>Mata Hari</name>       </girl>       <girl>     ...

URL Parameters & JavaScript

Diogenes Painting by Jean Leon Gerome T oday I was in need of a simple solution to get targeted parameters to a HTML page I'm in a platform that only accepts a page as home page HTML. In my case my login page. I needed that if the login had not success, then one message would be passed to this same page be reloaded,  reading and showing  the message. I did not want to create a second page that is always overlooked when changing the layout or css. After a little search I wrote the follow code: to use, create a HTML file like: parametro.html open with your browser, type something like: file:///yourfolder/parametro.html?param=Hello World&param2=21/12/1966 <!DOCTYPE HTML> <HTML LANG="pt-br"> <HEAD> <SCRIPT> /**  * Example of how to read the parameters of   * a URL when loading a page using javascript  * @author Nivio dos Santos  * @version 1.0  */ /**  * Creating namespace in order to av...