timtamboy63
Members
-
Joined
-
Last visited
Reputation Activity
-
timtamboy63 got a reaction from lukeluukeluuuke in The big list of HTML and code editorsCame here to post this. Sublime text is easily the best ide I've ever seen. I'd buy it if it wasn't for the high price, just to support the developer. Also, that screenshot is from ST1, ST2 has a slightly nicer gui (better shaped tabs, etc)
-
timtamboy63 got a reaction from Renaissance-Design in Light up roll-over buttons?I think he assumed you already knew a bit of CSS, if you don't, please don't use W3Schools, they're pretty bad to learn off.
Try HTMLDog.com instead, they have some kickass CSS tutorials.
-
timtamboy63 reacted to MikeChipshop in Windows 8Probably to late for Windows 8 but you can prob get in the loop for 9.
Monitor the tech news sites and join Microsoft technet/connect. Sign up to test lesser services and make sure to actually submit real bugs and feedback.
-
timtamboy63 reacted to Gibson in My database class, feel free to use itI found something similar.
Question - in the execute() function , should it be bindValue, not bindParam? I'm just reading up on the difference between them. When I run "bindParam" it results in what Webdesigner93 is talking about, however when I run bindValue it inserts the correct data into the database.
-
timtamboy63 got a reaction from Gibson in My database class, feel free to use itSo I do want to contribute something to the forum, so I give you my database class!
It is mostly finished, but I'm always improving it. Unfortunately, it's not commented very well (yet).
Anyway, feel free to use it in your own projects, it's easy enough to figure out, and supports chaining methods.
<?php /** * Basic class to deal with mySQL databases, can be easily changed to deal with other types of databases * * @version 1.0 * @author Chintan Parikh (timtamboy63@gmail.com) * @license Creative Commons */ class Database { /************PROPERTIES************/ /** * The username for the database * * @var string */ protected $username; /** * The password for the database * * @var string */ protected $password; /** * The database host - usually 'localhost' will do fine * * @var string */ protected $host; /** * The port for the database * * @var int */ protected $port; /** * The name of the database * * @var string */ protected $databaseName; /** * Holds the PDO Object * * @var object */ public $connection; /** * Holds the Prepared Query * * @var NUL */ public $statement; /** * Holds the status of transaction * * @var boolean */ public $transaction = false; /** * Holds the status of whether the query has been prepared or not * * @var boolean */ public $isPrepared = false; /** * Holds the instance of the Database class, used for the Singleton Design Pattern * * @var object */ private static $instance; /** * Gets the current instance of the class, or initiates the class of no Instance is present (Singleton Design Pattern) * * @access public * @param array $databaseInfo * @return object */ public static function getInstance(array $databaseInfo) { if(!self::$instance){ self::$instance = new Database($databaseInfo); } return self::$instance; } /** * Constructor function, takes $databaseInfo and sets local class variables * * @access private * @param array $databaseInfo * @return void */ private function __construct(array $databaseInfo) { /* try{ if(!is_array($databaseInfo)){ throw new exception('Database Information is not an array'); } } */ extract($databaseInfo); $this->host = $host; $this->port = $port; $this->databaseName = $database; $this->username = $username; $this->password = $password; } /** * Destructor function, disconnects the database * */ function __destruct() { $this->disconnect(); } /** * Connects to the database * * @access public * @return object (allows for chaining methods) */ function connect() { $dsn = "mysql:host=$this->host;port=$this->port;dbname=$this->databaseName"; $this->connection = new PDO($dsn, $this->username, $this->password); return $this; } /** * Disconnects from the database * * @access public * @return object (allows for chaining methods) */ function disconnect() { $this->connection = null; return $this; } /** * Prepares the query * * @access public * @param string $query The query that needs to be executed, with a '?' for each parameter that needs to be binded * @return object */ function prepare($query) { $this->statement = $this->connection->prepare($query); $this->isPrepared = 1; return $this; } /** * Binds parameters to the query and executes the query * * @access public * @param array $param An array of the parameters that need to be binded * @return object */ function execute($param = null) { if($this->isPrepared == 1){ $paramNumber = 1; if($param){ foreach($param as $bind){ $this->statement->bindParam($paramNumber, $bind); $paramNumber++; } } $this->statement->execute(); return $this->statement; } else{ throw new Exception("Statement must be prepared before executing"); } } /** * Starts a PDO Transaction (changes aren't made to the database until $this->commit is called, and changes can be rolled back via $this->rollBack) * * @access public * @return object */ function beginTransaction() { $this->connection->beginTransaction(); $this->transaction = true; return $this; } /** * Commits a PDO Transaction (changes aren't made to the database until $this->commit is called, and changes can be rolled back via $this->rollBack) * * @access public * @return object */ function commit() { if($this->transaction == true){ $this->connection->commit(); $this->transaction = false; return $this; } else{ throw new Exception('Transaction as not been initated'); } } /** * Rolls back a PDO Transaction (changes aren't made to the database until $this->commit is called, and changes can be rolled back via $this->rollBack) * * @access public * @return object */ function rollBack() { if($this->transaction == true){ $this->connection->rollBack(); $this->transaction = false; return $this; } else{ throw new Exception('Transaction as not been initated'); } } /** * Makes whatever variables passed to it into an array, then returns that array. Used with $this->execute. * * @access public * @return array */ function makeArray() { return func_get_args(); } /** * Finds the number of rows in a table * * @access public * @param string $table * @return object */ function numRows($table) { $this->prepare("SELECT * FROM $table"); return count($this->execute()->fetchAll()); } function exceptionHandler($exception) { echo "Uncaught exception: " , $exception->getMessage(), "\n"; $this->disconnect(); } } /* Example Usage $databaseInfo = array('host' => 'localhost', 'port' => '3306', 'database' => 'testdb', 'username' => 'root', 'password' => ''); $db = Database::getInstance($databaseInfo); try{ $output = $db->connect()->prepare('SELECT Name FROM testing WHERE Job = "Dentist"')->execute()->fetchObject(); foreach($output as $name){ print $name . '<br />'; } } catch(Exception $e){ echo 'Caught exception: ', $e->getMessage(), "\n"; $this->disconnect(); } try{ $db->prepare('INSERT INTO testing (Name, Job) VALUES (?,?)')->execute($db->makeArray('Calvin', 'Janitor'))->execute($db->makeArray('Kyle', 'Musician')); } catch(Exception $e){ echo 'Caught exception: ', $e->getMessage(), "\n"; $this->disconnect(); } */ ?>
EDIT: I should say that I know I've used exceptions incorrectly, and I'll be fixing that soon
EDIT 2: I fixed the exceptions, and commented the **** out of it
-
timtamboy63 got a reaction from Demonolith in Facebook feed on my siteNot sure if this is what you need, but I found this:
http://developers.facebook.com/docs/reference/fql/stream/
Also, it appears in the past, your updates were available as an RSS feed, not sure if that's still available - if it is, im not sure how to access it.
-
timtamboy63 got a reaction from idny99 in programmer's portfolioVery awesome. One small suggestion though, make the hover state of the images darker than the normal state, not lighter. This is just because of the background.
-
timtamboy63 got a reaction from OwenONeill in '.php' homepage instead of '.html'I disagree with your premise, but if you do want to do it, it's quite easy.
Copy the contents of index.html to index.php, then delete index.html
In your .htaccess file add the line:
DirectoryIndex index.php
-
Have you tried zeroing margins on the left and right
-
img{display:block;} might work
Also, try removing the whitespace between img and footer.
-
Actually, I tell a lie! I reckon it's cos your footer isn't clearing the padding of the floated divs. Try
footer:after{ content:" "; display:block; clear:both; }
-
timtamboy63 got a reaction from ayoungh in Smart404A while back, I created a 'smart' 404 script, and thought you guys might want to use it:
Basically, it detects whether you linked to the wrong extension. For example, if you link to foo.php instead of foo.html, the script will detect that a foo.html is there, and instead of throwing a 404, will redirect to foo.html.
The code is really messy, as I did it a long time back, but it works. If anyone wants to fix it, feel free, just push the changes to the github repo.
Download and code available at the github repo:
https://github.com/timtamboy63/Smart404
-
timtamboy63 got a reaction from kingy da killa in Smart404A while back, I created a 'smart' 404 script, and thought you guys might want to use it:
Basically, it detects whether you linked to the wrong extension. For example, if you link to foo.php instead of foo.html, the script will detect that a foo.html is there, and instead of throwing a 404, will redirect to foo.html.
The code is really messy, as I did it a long time back, but it works. If anyone wants to fix it, feel free, just push the changes to the github repo.
Download and code available at the github repo:
https://github.com/timtamboy63/Smart404
-
timtamboy63 reacted to Rafay. in The big list of HTML and code editorsEditor name: Sublime Text 2
Web site link: http://www.sublimetext.com/2
Price: 59$ (There is currently no enforced time limit for the evaluation.)
Brief description: Sublime Text is a sophisticated text editor for code, html and prose. You'll love the slick user interface and extraordinary features.
-
timtamboy63 got a reaction from Renaissance-Design in My database class, feel free to use itSo I do want to contribute something to the forum, so I give you my database class!
It is mostly finished, but I'm always improving it. Unfortunately, it's not commented very well (yet).
Anyway, feel free to use it in your own projects, it's easy enough to figure out, and supports chaining methods.
<?php /** * Basic class to deal with mySQL databases, can be easily changed to deal with other types of databases * * @version 1.0 * @author Chintan Parikh (timtamboy63@gmail.com) * @license Creative Commons */ class Database { /************PROPERTIES************/ /** * The username for the database * * @var string */ protected $username; /** * The password for the database * * @var string */ protected $password; /** * The database host - usually 'localhost' will do fine * * @var string */ protected $host; /** * The port for the database * * @var int */ protected $port; /** * The name of the database * * @var string */ protected $databaseName; /** * Holds the PDO Object * * @var object */ public $connection; /** * Holds the Prepared Query * * @var NUL */ public $statement; /** * Holds the status of transaction * * @var boolean */ public $transaction = false; /** * Holds the status of whether the query has been prepared or not * * @var boolean */ public $isPrepared = false; /** * Holds the instance of the Database class, used for the Singleton Design Pattern * * @var object */ private static $instance; /** * Gets the current instance of the class, or initiates the class of no Instance is present (Singleton Design Pattern) * * @access public * @param array $databaseInfo * @return object */ public static function getInstance(array $databaseInfo) { if(!self::$instance){ self::$instance = new Database($databaseInfo); } return self::$instance; } /** * Constructor function, takes $databaseInfo and sets local class variables * * @access private * @param array $databaseInfo * @return void */ private function __construct(array $databaseInfo) { /* try{ if(!is_array($databaseInfo)){ throw new exception('Database Information is not an array'); } } */ extract($databaseInfo); $this->host = $host; $this->port = $port; $this->databaseName = $database; $this->username = $username; $this->password = $password; } /** * Destructor function, disconnects the database * */ function __destruct() { $this->disconnect(); } /** * Connects to the database * * @access public * @return object (allows for chaining methods) */ function connect() { $dsn = "mysql:host=$this->host;port=$this->port;dbname=$this->databaseName"; $this->connection = new PDO($dsn, $this->username, $this->password); return $this; } /** * Disconnects from the database * * @access public * @return object (allows for chaining methods) */ function disconnect() { $this->connection = null; return $this; } /** * Prepares the query * * @access public * @param string $query The query that needs to be executed, with a '?' for each parameter that needs to be binded * @return object */ function prepare($query) { $this->statement = $this->connection->prepare($query); $this->isPrepared = 1; return $this; } /** * Binds parameters to the query and executes the query * * @access public * @param array $param An array of the parameters that need to be binded * @return object */ function execute($param = null) { if($this->isPrepared == 1){ $paramNumber = 1; if($param){ foreach($param as $bind){ $this->statement->bindParam($paramNumber, $bind); $paramNumber++; } } $this->statement->execute(); return $this->statement; } else{ throw new Exception("Statement must be prepared before executing"); } } /** * Starts a PDO Transaction (changes aren't made to the database until $this->commit is called, and changes can be rolled back via $this->rollBack) * * @access public * @return object */ function beginTransaction() { $this->connection->beginTransaction(); $this->transaction = true; return $this; } /** * Commits a PDO Transaction (changes aren't made to the database until $this->commit is called, and changes can be rolled back via $this->rollBack) * * @access public * @return object */ function commit() { if($this->transaction == true){ $this->connection->commit(); $this->transaction = false; return $this; } else{ throw new Exception('Transaction as not been initated'); } } /** * Rolls back a PDO Transaction (changes aren't made to the database until $this->commit is called, and changes can be rolled back via $this->rollBack) * * @access public * @return object */ function rollBack() { if($this->transaction == true){ $this->connection->rollBack(); $this->transaction = false; return $this; } else{ throw new Exception('Transaction as not been initated'); } } /** * Makes whatever variables passed to it into an array, then returns that array. Used with $this->execute. * * @access public * @return array */ function makeArray() { return func_get_args(); } /** * Finds the number of rows in a table * * @access public * @param string $table * @return object */ function numRows($table) { $this->prepare("SELECT * FROM $table"); return count($this->execute()->fetchAll()); } function exceptionHandler($exception) { echo "Uncaught exception: " , $exception->getMessage(), "\n"; $this->disconnect(); } } /* Example Usage $databaseInfo = array('host' => 'localhost', 'port' => '3306', 'database' => 'testdb', 'username' => 'root', 'password' => ''); $db = Database::getInstance($databaseInfo); try{ $output = $db->connect()->prepare('SELECT Name FROM testing WHERE Job = "Dentist"')->execute()->fetchObject(); foreach($output as $name){ print $name . '<br />'; } } catch(Exception $e){ echo 'Caught exception: ', $e->getMessage(), "\n"; $this->disconnect(); } try{ $db->prepare('INSERT INTO testing (Name, Job) VALUES (?,?)')->execute($db->makeArray('Calvin', 'Janitor'))->execute($db->makeArray('Kyle', 'Musician')); } catch(Exception $e){ echo 'Caught exception: ', $e->getMessage(), "\n"; $this->disconnect(); } */ ?>
EDIT: I should say that I know I've used exceptions incorrectly, and I'll be fixing that soon
EDIT 2: I fixed the exceptions, and commented the **** out of it
-
timtamboy63 reacted to MikeChipshop in My database class, feel free to use itFixed. Cheers for the code dude.