Skip to content

Instantly share code, notes, and snippets.

@sbarrat
sbarrat / DBConnection.php
Created Feb 8, 2012
Singleton PDO DB Connection PHP
View DBConnection.php
final class DBConnection {
private static $_handle = null;
private static $_dsn = "mysql:dbname=mydb;host=my.host.com;port=3306";
private static $_user = "myUserName";
private static $_password = "myPassword";
private static $_options = array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"); // SET UTF-8
/**
* Deny Construct
*/
@sbarrat
sbarrat / bugzillaWebService.php
Created Jan 31, 2012
XMLRPC_Client Bugzilla with Zend Framework
View bugzillaWebService.php
require_once 'Zend/Loader/Autoloader.php';
Zend_Loader_Autoloader::getInstance();
$server = 'http://bugzilla.mydomain.com/xmlrpc.cgi';
$client = new Zend_XmlRpc_Client( $server );
// Create the http client
$httpClient = new Zend_Http_Client();
$httpClient->setCookieJar();
$client->setHttpClient( $httpClient );
// Bugzilla Login
$params = new Zend_XmlRpc_Value_Struct(
@sbarrat
sbarrat / xmlrpcClientBugzilla.php
Created Jan 28, 2012
XMLRCP Client Bugzilla Login
View xmlrpcClientBugzilla.php
/**
* require PEAR/XML_RPC2 library
* Works fine with bugzilla 4.0.3
*/
require_once 'XML/RPC2/Client.php';
$server = 'http://bugzilla.mydomain.com/xmlrpc.cgi';
$params = array( 'login' => 'bugzilla@mydomain.com','password' =>'mypassword', 'remember' => 1);
$client = XML_RPC2_Client::create( $server );
$userid = $client->__call( 'User.login' , $params );
@sbarrat
sbarrat / Entrada.java
Created Jan 17, 2012
Clase que recoge los datos por teclado y devuelve lo que hemos escrito - JAVA
View Entrada.java
package entrada;
import java.io.*;
/**
* @author Ruben Lacasa
*
*/
public class Entrada {
/**
* @param args