This file contains 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
C:\>sqlcmd -S localhost -U sa -P 1234 | |
1> -- Set TriadWorksDb as the current database | |
2> USE TriadWorksDb; | |
3> GO | |
Changed database context to 'TriadWorksDb'. | |
1> -- Create a new server login name: rponte | |
2> CREATE LOGIN rponte WITH PASSWORD = 'TopSecret' | |
3> GO |
This file contains 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 EXISTS (SELECT name FROM sys.databases WHERE name = N'MyDb') | |
BEGIN | |
drop database MyDb | |
END |
This file contains 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
// Adding js script dynamically into page.. | |
script = document.createElement("script"); | |
script.src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"; | |
document.body.appendChild(script); |
This file contains 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
// http://mybatis.googlecode.com/svn/trunk/src/test/java/org/apache/ibatis/submitted/sptests/SPTest.java | |
Class.forName("org.hsqldb.jdbcDriver"); | |
conn = DriverManager.getConnection("jdbc:hsqldb:mem:sptest", "sa", ""); | |
Reader reader = Resources.getResourceAsReader("org/apache/ibatis/submitted/sptests/CreateDB.sql"); | |
ScriptRunner runner = new ScriptRunner(conn); | |
runner.setDelimiter("]"); | |
runner.setLogWriter(null); |
This file contains 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
CAP - Consistency, Availability and Partition-Tolerant | |
The CAP principle states that in distributed computing when it comes | |
to consistency (C), availability (A) and partition (P) | |
resilience/tolerance you can have only two of the three. | |
I was recently introduced to this principle and find it rather | |
insightful. Basically you can't have your cake and eat it too, | |
otherwise (computing) life would be too easy. |
This file contains 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
Eu tive problemas ao tentar imprimir diretamente na LPT1 via Applet *assinado*. | |
Mesmo o Applet sendo assinado sempre era disparado uma exceção de segurança. | |
Pesquisando pelo Google, por sorte, acabei achando o trecho de código com a solução abaixo: | |
import java.security.AccessController; | |
import java.security.PrivilegedAction; | |
AccessController.doPrivileged(new PrivilegedAction() { | |
public Object run() { | |
Impressao impressao = new Impressao(); |
This file contains 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
-- backuping constraints :p | |
create table antes_da_caca as select * from pg_class; | |
Postgres 8.3: | |
------------ | |
Aqui tu vês as constraints para uma tabela: | |
select nm.nspname, cla.relname, cla.reltriggers, constr.* | |
from pg_constraint constr inner join pg_class cla on cla.oid = constr.conrelid | |
inner join pg_namespace nm on nm.oid = cla.relnamespace; |
This file contains 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
<target name="test" depends="instrument"> | |
<mkdir dir="${test.report.dir}" /> | |
<junit printsummary="on" fork="yes" forkmode="once" haltonfailure="true" haltonerror="true"> | |
<sysproperty key="net.sourceforge.cobertura.datafile" file="${coverage.xml.dir}/cobertura.ser" /> | |
<sysproperty key="basedir" value="." /> | |
<formatter type="xml" /> | |
<classpath> | |
<!-- Adiciona libs necessarias para o build --> | |
<path refid="build-classpath" /> | |
<path refid="acceptance-tests-classpath" /> |
This file contains 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
package base; | |
import java.io.File; | |
import java.io.IOException; | |
import java.net.ServerSocket; | |
import org.mortbay.jetty.webapp.WebAppContext; | |
import org.springframework.stereotype.Component; | |
import br.com.syspdv.initializers.DefineHomeInitializer; |
This file contains 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
#Rode estes comando se tiver problemas de permissão na instalação do nodejs e npm: | |
sudo find node -type d -exec chmod 777 {} \; | |
sudo find node -type f -exec chmod 666 {} \; | |
sudo chown -R $USER /usr/local/{share/man,bin,lib/node} |