Oracle-building

Oracle Snippets

This post will be updated with snippets for Oracle. I hope you find it useful.   Escape single quotes and ampersands on strings Single quotes: select ‘D”Angelo”s’ from dual; Ampersands: SET DEFINE OFF;   Truncate a table Be careful: You cannot roll back a TRUNCATE TABLE statement. truncate table mytable;   Copy all output to an external log file spool …

How to redirect stdout / stderr to a file

Redirecting all your program output to a file is very simple and can be accomplished like this: myapp > output.log This line will send all the output generated by myapp to a file named output.log. The contents of output.log will always be overwritten; but you can use a second > to append to the current content like this: myapp >> …

Intro to Responsive Web Design

This weekend I was invited to have a remote presentation on Responsive Web Design with students from the Autonomous University of Queretaro (UAQ) in Mexico. Introductory concepts are presented in code, so you have the chance to apply them immediately. The video is in spanish. Happy coding.

Create a connection to MySQL in Java

This time we are going to create a basic connection to MySQL in Java and pull some data from it. // Compile it: // javac Mysql.java // // Try it: // java -classpath mysql-connector-java-5.1.27-bin.jar:. MySQL import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.Properties; public class MySQL { public Connection getConnection() throws SQLException { Connection conn = …

Installing Lucene/Solr on CentOS 6

This time we are going to install Solr, the super text search platform on CentOS. The installation process requires a couple extra libraries in order to work: Apache Commons Logging and SLF4J.   Installing Java yum install java java -version You must have at least version 1.6 in order to run Solr. If you got Java 1.5, I recommend you …

Installing Java 1.6 on CentOS 6

Nowadays more and more Java applications require at least a 1.6 JVM to run. However, the default CentOS 6 repositories still take you to the 1.5 version. By following this step by step tutorial you’ll be able to get version 1.6 running on your system.

wordpress-logo

WordPress Snippets

As a WordPress developer I have collected / created / curated many snippets that I’ve used in my projects. I hope you find them useful.   General HTML / WordPress tags Get your template’s directory <link href=”<?php echo get_template_directory_uri(); ?>/style.css” rel=”stylesheet” media=”screen”>   Check if this is the home page <?php if (is_home()) { … } ?>   Remove the …

Installing MongoDB/PHP Driver on CentOS 6

Since the module is not included with the default PHP installation, you have to download it from the official repository: cd mkdir mongo-php-driver cd mongo-php-driver curl https://codeload.github.com/mongodb/mongo-php-driver/zip/master > mongo-php-driver-master.zip Unzip it unzip mongo-php-driver-master.zip cd mongo-php-driver-master You need phpize to build the module. You can install it from the remi repository: wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm rpm -Uvh remi-release-6.rpm yum –enablerepo=remi install php-devel Configure and build phpize …

Installing MongoDB on CentOS 6

The first step is to configure the repositories. Create the following file /etc/yum.repos.d/10gen.repo with the following contents: For 32-bit systems: [10gen] name=10gen Repository baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/i686 gpgcheck=0 enabled=1 For 64-bit systems: [10gen] name=10gen Repository baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64 gpgcheck=0 enabled=1 Install Mongo yum install mongo-10gen mongo-10gen-server   Configure MongoDB You can configure Mongo by editing the following file: /etc/mongod.conf Set Mongo to autostart on system boot: …

Unresponsive iOS7 beta 2 touch screen

Since I installed iOS7 beta 2 version, my touch screen started to go unresponsive from time to time. After a couple hours of internet research this is what I found: iPhone unresponsiveness is mainly caused by notification messages being sent behind the lock screen. For example, when your battery reaches 20% you get a notification on your screen. There is …

Installing the PHP/MongoDB extension on Mac OSX 10.8

Installing PHP/MongoDB extension is a two steps task on OSX: Install the autoconf tool required for compiling the extension Install the Mongo extension You have to install autoconf in order to avoid the following error: Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF environment variable. Then, rerun this script. ERROR: `phpize’ failed Enough talk, hands on work… …

Isn’t this scary?

I found some articles like this today, all related to Google Wallet: “The report says the goal for Google wasn’t necessarily to make money via fees with Wallet, but rather to collect data on consumer habits and target ads towards them. In fact, Google is forced to pay such high fees to credit card companies that it loses money on …

When I was twelve…

When I was twelve I learned something that changed my life: 10 print “Hello” 20 goto 10