Skip to content

Instantly share code, notes, and snippets.

View fernandor777's full-sized avatar
🏠
Working from home

Fernando Miño fernandor777

🏠
Working from home
  • Geosolutions
  • Ecuador
View GitHub Profile
@fernandor777
fernandor777 / tomcat_jndi_jdbc.xml
Created June 14, 2023 16:40
tomcat jdbc JNDI resource
<Resource
name="jdbc/postgres"
auth="Container"
type="javax.sql.DataSource"
driverClassName="org.postgresql.Driver"
url="jdbc:postgresql://postgres/mydb"
username="***********"
password="***********"
initialSize="5"
minActive="5"
@fernandor777
fernandor777 / java2d-transparency.md
Created May 13, 2021 14:33
Java graphics2d transparency example
package com.zetcode;

import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.EventQueue;
import java.awt.Graphics;
import java.awt.Graphics2D;
import javax.swing.JFrame;
import javax.swing.JPanel;
@fernandor777
fernandor777 / java_home.md
Last active November 10, 2020 17:04
Declare java home

Option 1

vim /etc/profile.d/java.sh

#!/bin/sh
export JAVA_HOME=/tomcat/jdk
export PATH=$PATH:$JAVA_HOME/bin

Option 2

@fernandor777
fernandor777 / community_module.md
Last active August 28, 2020 16:39
Community module example

pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>org.geoserver</groupId>		
	<artifactId>community</artifactId>
@fernandor777
fernandor777 / clean_code.md
Created August 11, 2020 16:45 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@fernandor777
fernandor777 / geotools_proposal.md
Last active May 15, 2020 16:49
geotools_proposal
  • Contact: fernandor777
  • TLDR: StreamingRenderer Symbolizers pre-processor extensions handling

Description

This proposal if for adding Symbolizers pre-processor extensions handling to StreamingRenderer class. This means StreamingRenderer class will contain a new configurable Symbolizers pre-processor collection allowing to add or remove instances as needed.

The interface SymbolizersPreProcessor will be implemented for handling and enhance the current Symbolizers list, adding new symbolizers at runtime. If no changes are applied to the current Symbolizers list, null or the former Symbolizers list can be returned.

SymbolizersPreProcessor interface definition:

@fernandor777
fernandor777 / spark-quick-start.md
Created July 26, 2019 19:30
spark quick start

build.sbt:

name := "MovieSimilarities1M"

version := "1.0"

organization := "com.sundogsoftware"

scalaVersion := "2.12.8"
@fernandor777
fernandor777 / Build_geoserver_bin.md
Created June 13, 2019 15:33
Build Geoserver bin package from sources

On command line from geoserver/src folder:

mvn clean install -T1C -Prelease -DskipTests
mvn assembly:attached -nsu
cd target/release
unzip geoserver-2.16-SNAPSHOT-bin.zip
./bin/startup.sh
<?xml version="1.0"?>
<wfs:FeatureCollection numberOfFeatures="4" timeStamp="2019-04-24T12:42:55.933Z" xsi:schemaLocation="http://www.opengis.net/wfs http://localhost:8090/geoserver/schemas/wfs/1.1.0/wfs.xsd http://www.stations.org/1.0 file:/home/fernando/Documents/temporary/appschema-mappings-href/meteo.xsd">
<gml:featureMembers>
<st:Station gml:id="7">
<null:name>Bologna</null:name>
<st:stationCode>BOL</st:stationCode>
<st:observation>
<st:Observation id="3">
<st:parameterMember xlink:href="http://stations.org/1.0#1"/>
</st:Observation>
@fernandor777
fernandor777 / xml_java.md
Created February 18, 2019 00:39
XML java

Document to String, to file.

Document doc = getResultDoc();
TransformerFactory tf = TransformerFactory.newInstance();
Transformer transformer = tf.newTransformer();
transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
StringWriter writer = new StringWriter();
transformer.transform(new DOMSource(doc), new StreamResult(writer));
String output = writer.getBuffer().toString();