This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Cria um map | |
Map<String, String> m = Maps.newHashMap(); | |
// Aplica uma função ao entrySet() do map que transforma cada entry em um BasicNameValuePair | |
Iterable<BasicNameValuePair> transformed = Iterables.transform(m.entrySet(), new Function<Entry<String, String>, BasicNameValuePair>() { | |
public BasicNameValuePair apply(Entry<String,String> input) { | |
return new BasicNameValuePair(input.getKey(), input.getValue()); | |
}; | |
}); | |
// Cria uma lista de NameValuePair | |
List<BasicNameValuePair> list = newArrayList(transformed); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Remove tudo que não for dígito ou / | |
"ab1s/3hae/2s1h".replace(/[^\/|\d+]/g, "") | |
// Matches a date pattern | |
"01/02/2014".match(/^(\d{1,2}\/){2}(\d{2}){1,2}$/g) // true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if [ -z $ECLIPSE_HOME ]; then | |
ECLIPSE_HOME=$1 | |
fi | |
HOME=$(pwd) | |
#echo $HOME/libs-compiled | |
java -jar $ECLIPSE_HOME/plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar -application org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher -metadataRepository file:$HOME/libs-compiled -artifactRepository file:$HOME/libs-compiled -source $HOME/libs -configs gtk.linux.x86 -compress -publishArtifacts |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static ComboBoxViewerCellEditor criarColumnComboBox(TableViewerColumn tvc, final Class<?> clazz, final String property, Object[] values, String titulo) { | |
return criarColunaComboBoxEditable(tvc, clazz, property, values, titulo, new ColumnLabelProvider() { | |
@Override | |
public String getText(Object element) { | |
if (clazz.isInstance(element)) { | |
return element.toString(); | |
} else { | |
Object value = ReflectionHelper.getValue(element, property); | |
return value == null ? StringUtils.EMPTY : value.toString(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
StringBuilder sb = new StringBuilder(); | |
sb.append("SELECT new ").append(SaldoContaParteB.class.getName()).append("(sum(a.valor), conta) "); | |
sb.append("FROM ContaLalurParteB conta "); | |
sb.append("LEFT JOIN AjusteLalurParteB ajuste on ajuste.conta = conta AND ajuste.data < :dataInicio "); | |
sb.append("WHERE conta.empresa = :empresa"); | |
TypedQuery<SaldoContaParteB> query = getEntityManager().createQuery(sb.toString(), SaldoContaParteB.class); | |
query.setParameter("empresa", empresa); | |
query.setParameter("dataInicial", dataInicio); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Subindo o trackr | |
cd /home/deploy/trackr/current | |
mina up | |
# Subindo interfaces web, para acessar de fora | |
cd /scripts | |
sudo sh em1.sh | |
sudo sh interfaces.sh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected void bindAction(Button btn, final String methodName) { | |
try { | |
final Method method = this.getClass().getMethod(methodName, new Class[] {}); | |
btn.addSelectionListener(new SelectionAdapter() { | |
@Override | |
public void widgetSelected(SelectionEvent e) { | |
try { | |
method.invoke(GermantechEditor.this, new Object[] {}); | |
} catch (Exception ex) { | |
ex.printStackTrace(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# script to add apt.postgresql.org to sources.list | |
# from command line | |
CODENAME="$1" | |
# lsb_release is the best interface, but not always available | |
if [ -z "$CODENAME" ]; then | |
CODENAME=$(lsb_release -cs 2>/dev/null) | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Install Microsoft Fonts (Including Tahoma) | |
if [ "$(id -u)" == "0" ] | |
then | |
if apt-get install msttcorefonts; then | |
mkdir temp-tahomafont | |
cd temp-tahomafont | |
if wget http://download.microsoft.com/download/ie6sp1/finrel/6_sp1/W98NT42KMeXP/EN-US/IELPKTH.CAB; then | |
cabextract IELPKTH.CAB |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select a.*, | |
c.descricao, | |
l.nome | |
from componenteativo c | |
join ativo a on a.id = c.ativo_id | |
join localizacao l on l.id = a.localizacao_id | |
where c.componente_id = 23 | |
and a.ativado is true |