Skip to content

Instantly share code, notes, and snippets.

@ifsantos
ifsantos / MicroBenchmarks.java
Created July 1, 2022 18:16
Measure the performance between "foreach adding items" and "map collecting items" using jmh . Further possibilites include mapWithParallelStream
import org.openjdk.jmh.annotations.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.Random;
import static java.util.stream.Collectors.joining;
import static java.util.stream.Collectors.toList;
@ifsantos
ifsantos / repeat.sh
Created May 9, 2022 02:49
Keep trying on update driver when it fails
nvidia-driver-update 510.60.02
while [ $? -ne 0 ]; do
sleep 5
nvidia-driver-update 510.60.02
done
@ifsantos
ifsantos / LookupContext.java
Created December 9, 2013 12:57
Lookup external Weblogic context for JMS.
Properties properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
properties.put(Context.PROVIDER_URL, "t3://external.host.com:8001");
jndiContext = new InitialContext(properties);
@ifsantos
ifsantos / Table_Indexes.sql
Last active December 20, 2015 20:58
1: Query used to discover the table indexes. 2: Query used to show table metadata.
-- 1: Query used to discover the table indexes.
select
table_name,
index_name,
column_name
from
dba_ind_columns
where table_name = &table
order by
table_name,
@ifsantos
ifsantos / datasource_weblogic.conf
Last active December 20, 2015 11:19
Configuração para datasource Weblogic quando instalado em linux, para casos em que ocorre erro de conversão de caracteres.
URL:
jdbc:oracle:thin:@host01:1571:dsv
Nome da Classe do Driver:
oracle.jdbc.xa.client.OracleXADataSource
SQL Inicial:
SQL ALTER SESSION SET NLS_LANGUAGE='PORTUGUESE' NLS_TERRITORY='BRAZIL'
@ifsantos
ifsantos / sqlnet.ora
Created July 22, 2013 14:23
Oracle authentication config file. when used out of a domain, use (none). when in a domain, use (NTS)
#
# C:\oraclexe\app\oracle\product\11.2.0\server\network\ADMIN\sqlnet.ora
#
# This file is actually generated by netca. But if customers choose to
# install "Software Only", this file wont exist and without the native
# authentication, they will not be able to connect to the database on NT.
SQLNET.AUTHENTICATION_SERVICES = (none)
/**
*
*/
package br.com.util.conversor;
import java.util.Date;
import java.util.GregorianCalendar;
import javax.xml.datatype.DatatypeConfigurationException;
import javax.xml.datatype.DatatypeFactory;
@ifsantos
ifsantos / jvmParameters.txt
Created January 30, 2013 18:22
Important JVM parameters: Proxy configuration and SOAP messages XML dump.
-Dhttps.proxyHost=localhost
-Dhttps.proxyPort=8080
-Dcom.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.dump=true
@ifsantos
ifsantos / BasicService.java
Last active December 11, 2015 14:18
Webservice example, using only JAX-WS (without CXF). Comments describe what else to do in the deploy conguration.
package com.hcllearning.webservice;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
/*
* Use wsgen to generate web service artifacts
@ifsantos
ifsantos / TesteMail.java
Created January 2, 2013 12:08
Mail Client, to test javamail-1.4.5 API.
package mail.client;
import java.util.Enumeration;
import java.util.Properties;
import javax.mail.Address;
import javax.mail.Folder;
import javax.mail.Message;
import javax.mail.Session;
import javax.mail.Store;