Skip to content

Instantly share code, notes, and snippets.

View massahud's full-sized avatar

Geraldo Massahud massahud

View GitHub Profile
@massahud
massahud / README.md
Last active August 29, 2015 13:56
Disable IE compatibility mode with Primefaces

Disable IE compatibility mode with PrimeFaces

Add this to the xhtmls that you want to disable compatibility rendering, because the meta X-UA-Compatible must come before any tag that starts the rendering engine.

<h:head>
  <f:facet name="first">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
 
@massahud
massahud / gist:b7fd98dfeb5bdf54c83f
Last active August 29, 2015 14:01
Remove sonar duplicated last build
update sonar.snapshots old_snap set old_snap.islast=0
where islast=1
and exists (
select * from sonar.snapshots new_snap
where new_snap.created_at > old_snap.created_at
and new_snap.project_id = old_snap.project_id
and new_snap.islast=1
);
@massahud
massahud / skipcomments.md
Last active December 14, 2015 08:38
java jsf facelets comentários

JSF facelets comentários

adicionar ao web.xml

<context-param>
    <param-name>facelets.SKIP_COMMENTS</param-name>
    <param-value>true</param-value>
</context-param>
@massahud
massahud / jsfexpression.md
Last active December 14, 2015 08:38
java jsf expression java expressão EL

Executar expressão JSF EL

FacesContext context = Context.getCurrentInstance()
context.getApplication().evaluateExpressionGet(context, "#{bean}", Bean.class);
@massahud
massahud / coberturahudson.md
Last active December 14, 2015 08:39
java cobertura hudson maven sonar

Configurando cobertura no hudson para maven e sonar

Editar o pom.xml

<project>
  ...
  <build>
    ...
 
@massahud
massahud / 1-README.md
Last active December 14, 2015 08:39
pom.xml maven inicial cdi tomcat6 jsf primefaces jpa entitymanager request

Projeto maven inicial CDI Tomcat 6

Contém

  • Arquivos pom.xml, web.xml e context.xml que ativam cdi no tomcat 6. O pom contém também outras APIs que eu normalmente uso em meus projetos, além de uma lista de repositórios e um repositório local que fica no diretorio lib dentro do projeto.
  • Algumas classes de utilitários para CDI e JPA.

Onde devem ficar os arquivos

@massahud
massahud / AutoboxTest.java
Created March 18, 2013 18:12
Java autoboxing cache
public class AutoboxTest {
public static void main(String[] args) {
Integer i1 = 127;
Integer i2 = 127;
System.out.println(i1 + " == " + i2 + "? " + (i1==i2));
i1 = 128;
i2 = 128;
System.out.println(i1 + " == " + i2 + "? " + (i1==i2));
i1 = -128;
i2 = -128;
@massahud
massahud / gist:5805193
Created June 18, 2013 13:07
Inicializar Collection com n cópias de uma mesma referência.
ArrayList<BigDecimal> v = new ArrayList<>(Collections.nCopies(15, BigDecimal.ZERO);
@massahud
massahud / Adicionar "Abrir com programa" no menu do windows.md
Last active December 25, 2015 05:28
Adicionar "Abrir com programa" no menu do botão direito

Adicionar "Abrir com programa" no menu do botão direito

Como fazer

Basta adicionar uma das seguintes entrada de registro:

  • Para todos os usuários:
    HKEY_CLASSES_ROOT*\shell\NOME DO COMANDO DO MENU\command
  • Para o usuário atual:
import java.util.Arrays;
import java.util.List;
public class RadixSort {
public static List<String> sort(List<String> strings, int maxDigits) {
List<String> sorted = strings;
for (int i = maxDigits - 1; i > 0; i--) {
sorted = countSort(sorted, i);
}
return sorted;