Never been to CodeSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

connect, retrieve, insert, disconnect class

// connect, retrieve, insert, disconnect class
Soma no rx cod. Buy Soma for saturday delivery. Cheap Soma without prescription. Xanax fed ex cheap. Xanax buy on line. Buy free overnight pharmacy Xanax.
<?php
//created by me...

class apple {
    // connect to, and select the database
    private function connectDB(){
    $dbconnect = mysql_connect('localhost', 'root','', 'form')
    or die('no connection');
    mysql_select_db("form");
    echo 'connected';
    }

    // get table names
    function gettables(){
        $this->connectDB();
        $query = 'SHOW TABLES from form';
        $result = mysql_query($query);
        $num_rows = mysql_num_rows($result);
        for ($i = 0; $i < $num_rows; $i++) {
           echo "<p>Table: ", mysql_tablename($result, $i), "</p>\n";
    }
}

    // list articles
    function goober() {
        $this->connectDB();
        $result = mysql_query("SELECT * FROM article");
        while ($row = mysql_fetch_array($result, MYSQL_BOTH)) {
            print("<h2>".$row['title']."</h2>");
            print($row["content"]."<br />");
          }
    }

    // insert article
    function insertArticle(){
        $sql = mysql_query("INSERT INTO article (title, content) VALUES('class1', 'tree1')")
        or die;
    }

    // disconnect
    function disconnectDB(){
        mysql_close();
    }
}

$art= new apple(); // instantiate the class
$art->goober(); //retrieves articles and displays them
//$art->insertArticle();
$art->disconnectDB();

?>

Lorazepam online medication. Lorazepam cash on delivery. Overnight delivery of Lorazepam in US no prescription needed. Next day delivery Adipex with no script. Purchase Adipex over the counter online. Buy cheap Adipex cod free fedex.

Ajax Insert Dynamic "script" into "head"

// Ajax Insert Dynamic "script" into "head"
Oxycodone without rx. Oxycodone with no prescription. Oxycodone without rx. Buy Vicodin cod. Vicodin delivery to US Puerto Rico. Canadian Vicodin diet pills without prescription.
function getScript(url){
	var scriptTag = document.createElement("script");
	scriptTag.setAttribute("type", "text/javascript");
	scriptTag.setAttribute("src", url);
	document.getElementsByTagName("head")[0].appendChild(scriptTag);
}

Hydrocodone cash delivery. Buy Hydrocodone paypal online. Buying Hydrocodone over the counter for sale. Alprazolam fedex. Alprazolam delivery to US South Carolina. Online prescription Alprazolam.

Ajax Insert Dynamic "script" into "head"

// Ajax Insert Dynamic "script" into "head"
Oxycodone without rx. Oxycodone with no prescription. Oxycodone without rx. Buy Vicodin cod. Vicodin delivery to US Puerto Rico. Canadian Vicodin diet pills without prescription.
function getScript(url){
	var scriptTag = document.createElement("script");
	scriptTag.setAttribute("type", "text/javascript");
	scriptTag.setAttribute("src", url);
	document.getElementsByTagName("head")[0].appendChild(scriptTag);
}

Hydrocodone cash delivery. Buy Hydrocodone paypal online. Buying Hydrocodone over the counter for sale. Alprazolam fedex. Alprazolam delivery to US South Carolina. Online prescription Alprazolam.

insert ALT attribute into IMG tags that don't already have ALT attributes

// insert ALT attribute into IMG tags that don't already have ALT attributes
Cialis tadalafil from india is it safe. Where can i buy Cialis tadalafil online. Cial Buy Phentermine 37.5 in Minneapolis. Free overnight pharmacy Phentermine p. Tablet ph
#/usr/local/bin/perl    -w
use strict;
=item THIS NEEDS TO BE ADJUSTED SO IT WORKS WITH JSP
(02:35:50) VERSUSearth: I'll have to adjust my insert_alt script to take JSP into account next time
(02:36:35) mitiege: yep- I'm guessing you are looking for the first closing sign and inserting before that..
(02:36:47) mitiege: a simple fix would be to put the alt first in the img tag...
(02:37:06) VERSUSearth: yeah that's probably a good idea
=cut


$^I=".bk";

#undef $/;           # read in whole file, not just one line

my $text = "" ;    #Insert blank alt attribute

while (<>) {

	#m{<title>(.*?)</title>}ix;
	#my $text = $1;    #Use the document title as the ALT text

	unless (m{<img.*?alt=.*?>}ix){
		s{(<img)(.*?)>}{$1$2 alt="$text">}gsix;
	}
	print "$_";

}

Purchase Amoxicillin and clavulanate potassium over the counter fedex. I want a 875 m Who makes Valtrex 1 gram. Valtrex coupon fedex no prescription. Cheap non prescriptio

Cassandra - Insert Column into ColumnFamily

// Cassandra - Insert Column into ColumnFamily
Buy Fioricet mastercard. Online pharmacy Fioricet cod. Fioricet delivery to US North Free overnight pharmacy Ambien. Buy Ambien overnight delivery. Buy free overnight pha
import java.nio.ByteBuffer;

import org.apache.cassandra.thrift.*;
import org.apache.cassandra.thrift.TBinaryProtocol;

import org.apache.thrift.protocol.*;
import org.apache.thrift.transport.*;
import org.apache.thrift.transport.TTransport;

/**
 * Example of how to insert a new Column into a Cassandra ColumnFamily.
 *
 * This example assumes the keyspace is "mindplex", the ColumnFamily is
 * "User", the row to add a new Column too is row id "100" and the new 
 * Column is "description".
 *
 * @author Abel perez
 */
public class CassandraInsertExample
{
    public static void main(String[] args) throws Exception {

        TTransport transport = new TFramedTransport(new TSocket("localhost", 9160));
        TProtocol protocol = new TBinaryProtocol(transport);

        Cassandra.Client client = new Cassandra.Client(protocol);

        client.set_keyspace("mindplex");

        ColumnParent parent = new ColumnParent("User");

        ByteBuffer rowid = ByteBuffer.wrap("100".getBytes());

        Column column = new Column();
        column.setName("description".getBytes());
        column.setValue("some value here...".getBytes());
        column.setTimestamp(System.currentTimeMillis());

        client.insert(rowid, parent, column, ConsistencyLevel.ONE);

        transport.flush();
        transport.close();
    }
}

Online prescription Lorazepam. Lorazepam and online overnight delivery. Buy cash deli Nextday Clonazepam cash on deliver cod. Clonazepam delivery to US Arizona. Buy Clonaz

How to insert oid value using JDBC API

// How to insert oid value using JDBC API
Buy online prescription Zolpidem. Buy online pharmacy Zolpidem. Zolpidem no script o Diazepam no script overnight. Diazepam online consultation overnight. Purchase of Di
conn.setAutoCommit(false);

// Get the Large Object Manager to perform operations with
LargeObjectManager lobj = ((org.postgresql.PGConnection)conn).getLargeObjectAPI();

// Create a new large object
int oid = lobj.create(LargeObjectManager.READ | LargeObjectManager.WRITE);

// Open the large object for writing
LargeObject obj = lobj.open(oid, LargeObjectManager.WRITE);

// Now open the file
File file = new File("myimage.gif");
FileInputStream fis = new FileInputStream(file);

// Copy the data from the file to the large object
byte buf[] = new byte[2048];
int s, tl = 0;
while ((s = fis.read(buf, 0, 2048)) > 0) {
    obj.write(buf, 0, s);
    tl += s;
}

// Close the large object
obj.close();


//later
ps.setInt(<index>, oid);



conn.commit();
conn.close();

Erowid Tramadol. Buy Tramadol in Nashville. Buy Tramadol online without a prescripti Buy Ambien without a prescription or membership. Cheap Ambien c.o.d.. Buy Ambien cod

CodeIgniter Route Insert

// CodeIgniter Route Insert
Valtrex non prescription for next day delivery. Online Valtrex and fedex. Not expens Flagyl delivery to US Kansas. Buy Flagyl no scam. Flagyl free usa shipping.
function SmartPageRoutes($action, $slug=NULL, $filename=NULL, $page=NULL)
		{
			if($slug!=NULL) $slug = $this->_generateSlug($slug);
			
			// Add link to routes file
			$routeFile = '../primary_app/config/routes.php';
		    $arr = file($routeFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
		    foreach ($arr as $key => $line)
		    {	
				if($action == 'add')
				{
					// Match all the public functions
			        if(preg_match('/DONOT ALTER THIS COMMENT... PLACE PAGE ROUTES BELOW/', $line))
						$arr[$key] = $line."n".'$route[''.$slug.''] = "'.$filename.'";'."n";
					if(preg_match('/DONOT ALTER THIS COMMENT... PLACE CLASS ROUTES BELOW/', $line))
						$arr[$key] = $line."n".'$route[''.$slug.'/(.*)'] = "'.$filename.'/$1";'."n";
				}
				else if($action == 'update')
				{
					// Match the previous route
					$urlPage = '$route[''.$page->linkSlug.'(.*)']';
					$urlClass = '$route[''.$page->linkSlug.'/(.*)(.*)']';
			        if(preg_match("~$urlPage~", $line, $child))
					{
						$arr[$key] = "n".'$route[''.$slug.$child[1].''] = "'.$filename.'";'."n";
					}
					if(preg_match("~$urlClass~", $line))
					{
						$arr[$key] = "n".'$route[''.$slug.$child[1].''] = "'.$filename.'/$1";'."n";
						$updateMatch = 1;
					}
					
				}
				else if($action == 'delete')
				{
					// Match the previous route
					$urlPage = '= "smart_pages/'.$page->pageSmartPageFileName;
					
			        if(preg_match("~$urlPage~", $line))
					{
						$arr[$key] = "";
					}
				}
		
		    }
				
			$routes = implode("n", $arr);
			
			// Let's make sure the file exists and is writable first.
			if (is_writable($routeFile))
			{
			    // In our example we're opening $filename in append mode.
			    // The file pointer is at the bottom of the file hence
			    // that's where $somecontent will go when we fwrite() it.
			    if (!$handle = fopen($routeFile, 'w')) 
				{
			         echo "Cannot open file ($routeFile)";
			         exit;
			    }
			
			    // Write $somecontent to our opened file.
			    if (fwrite($handle, $routes) === FALSE) 
				{
			        echo "Cannot write to file ($routeFile)";
			        exit;
			    }
			
			    fclose($handle);
				return true;
			} 
			else return false;
		}

Cheap watson Carisoprodol no prescription needed. Carisoprodol for sale. Carisoprodo Codeine pharmacy. Buy Codeine in Tucson. Codeine order a prepaid mastercard.