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
sudo su | |
apt-get install wordpress | |
ln -s /usr/share/wordpress/ wordpress | |
cd /usr/share/doc/wordpress/examples/ | |
setup-mysql -n wordpress localhost | |
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
#1 - Pare o serviço do MySQL: | |
$service mysqld stop | |
#2 - Inicie o MySQL sem senha: | |
$mysqld_safe --skip-grant-tables | |
#3 - Conecte ao MySQL usando o mysqlclient: | |
$mysql -u root | |
#4 - Configure uma nova senha para o MySQL: |
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
//Executando o VACUUM no SQLite: | |
//código C: | |
sqlite_exec(db, "VACUUM;", 0, 0); | |
//Objective-c com FMDB: | |
FMResultSet *resultQuery = [db executeUpdate:@"VACUUM;"]; | |
//utiliário SQLite: | |
sqlite> VACUUM; | |
//ou |
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
FMDatabase* db = [FMDatabase databaseWithPath:@"/tmp/tmp.db"]; | |
if (![db open]) { | |
NSLog(@"Could not open db."); | |
} | |
// Depois crie uma tabela, "a" será texto e "d" será data | |
[db executeUpdate:@"create table test (a text, d double)", nil]; | |
// Iniciando a transação. | |
[db beginTransaction]; | |
if ([db executeUpdate:@"insert into test (a, d) values (?, ?)", @"oi'", [NSDate date], nil]){ |
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
db.beginTransaction(); | |
try { | |
//Função de inserção. | |
saveTest(); | |
db.setTransactionSuccessful(); | |
}catch { | |
//Alguma falha da transação | |
}finally { | |
db.endTransaction(); |
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
#A instalação é bastante simples como poderá ver nos passos abaixo: | |
sudo su | |
apt-get install mongodb mongo-clients php5-dev | |
apt-get install git | |
git clone https://github.com/mongodb/mongo-php-driver.git | |
cd mongo-php-driver |
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
sudo su | |
apt-get install wordpress | |
ln -s /usr/share/wordpress/ wordpress | |
cd /usr/share/doc/wordpress/examples/ | |
setup-mysql -n wordpress localhost | |
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
DECLARE @name VARCHAR(50) -- nome do banco de dados | |
DECLARE @path VARCHAR(256) -- path para o arquivo de backup | |
DECLARE @fileName VARCHAR(256) -- nome do arquivo de backup | |
DECLARE @fileDate VARCHAR(20) -- usado para o nome do arquivo | |
SET @path = 'C:\Backup\' --diretório onde tudo será salvo | |
SELECT @fileDate = CONVERT(VARCHAR(20),GETDATE(),112) | |
DECLARE db_cursor CURSOR FOR |
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
#!/usr/bin/python | |
# versao.py – captura e mostra a versão do MySQL database server. | |
# importe os modulos do MySQLdb e sys | |
import MySQLdb | |
import sys | |
# Abra uma conexão com o banco de dados | |
# Tenha certeza de ter trocado o IP, usuario, senha e database para os seus. | |
connection = MySQLdb.connect (host = “192.168.1.1″, user = “username”, passwd = “password”, db = “database_name”) | |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import sys | |
import dialog | |
import os | |
from hashlib import md5 | |
dial=dialog.Dialog() | |
curr=os.path.abspath('') | |
print curr |
OlderNewer