Skip to content

Instantly share code, notes, and snippets.

View NandoKstroNet's full-sized avatar
🎯
Focusing

Nando Kstro Net NandoKstroNet

🎯
Focusing
View GitHub Profile
@NandoKstroNet
NandoKstroNet / exception_ao_iniciar_pentaho_sw
Created October 8, 2014 16:29
exception_ao_iniciar_pentaho_sw
"Exception in thread "main" java.lang.NoClassDefFoundError: org/pentaho/di/core/exception/KettleDatabaseException
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2688)
at java.lang.Class.privateGetMethodRecursive(Class.java:3035)
at java.lang.Class.getMethod0(Class.java:3005)
at java.lang.Class.getMethod(Class.java:1771)
at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Caused by: java.lang.ClassNotFoundException: org.pentaho.di.core.exception.KettleDatabaseException
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
<?php
$file = '/home/dllopes/www/teste.php';
$ext = strrchr($file, '.');
$countChar = strlen(str_replace('.', '', $ext));
if($countChar == 4) print 'Extensão possui 4 caracteres além do "."';
if($countChar == 3) print 'Extensão possui 3 caracteres além do "."';
<?php
return [
// http://www.cidades.ibge.gov.br/download/mapa_e_municipios.php?uf=ac (Thu May 14 16:30:15 BRT 2015)
'AC' => [
1200013 => 'Acrelândia',
1200054 => 'Assis Brasil',
1200104 => 'Brasiléia',
1200138 => 'Bujari',
1200179 => 'Capixaba',
Verifying that +nandokstronet is my blockchain ID. https://onename.com/nandokstronet
@NandoKstroNet
NandoKstroNet / silex-application-middlewares.php
Created February 29, 2016 13:03
Silex Middlewares Pt-1
<?php
use Silex\Application;
$app = new Application();
/**
* Middlewares
**/
$app->before(function(){
//Exemplo
@NandoKstroNet
NandoKstroNet / stripSpecialChars.sql
Created August 31, 2016 10:10
Replace Special Chars
/** http://stackoverflow.com/questions/12652234/sql-query-to-remove-special-characters **/
DROP FUNCTION IF EXISTS `stripSpecialChars`;
DELIMITER ;;
CREATE FUNCTION `stripSpeciaChars`(`dirty_string` varchar(2048),allow_space TINYINT,allow_number TINYINT,allow_alphabets TINYINT,no_trim TINYINT) RETURNS varchar(2048) CHARSET utf8 DETERMINISTIC
BEGIN
/**
* MySQL function to remove Special characters, Non-ASCII,hidden characters leads to spaces, accents etc
* Downloaded from http://DevZone.co.in
* @param VARCHAR dirty_string : dirty string as input
<?php
namespace CodeExpertsApps\App\MVC;
use Silex\Application;
class View
{
private $data = [];
private $view;
private $app;
@NandoKstroNet
NandoKstroNet / list_files.php
Created May 17, 2017 22:03
List files in a specific directory, in a pattern based.
<?php
$link = '';
$pattern = "*.pdf";
function mountLink(string $file, string $link, string $ext = '.pdf') :string
{
return "<a href=\"{$link}{$file}\" target=\"_blank\">" . str_replace($ext, '', $file) . "</a>\n";
}
foreach (glob($pattern) as $file) {
@NandoKstroNet
NandoKstroNet / PostController.php
Created May 24, 2017 17:47
Controller Posts - Série de Posts da Code Experts Learning no Medium sobre Symfony
<?php
namespace AppBundle\Controller;
use AppBundle\Entity\Post;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
/**
* @Route("/posts")
@NandoKstroNet
NandoKstroNet / index.twig
Created May 24, 2017 17:54
View Twig da série sobre Symfony da Code Experts Learning
{% extends 'base.html.twig' %}
{% block stylesheets %}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.css">
{% endblock %}
{% block body %}
<div class="container">
<div class="col-md-12">
{% for p in posts %}