avatar

Andres Jaimes

Compiling and Debugging Oracle's Pro*C files in OS-X / Xcode

Part of my work as a Web/UNIX developer includes maintenance and development of tools using Oracle’s Pro*C. In text interfaces, VIM is a pretty decent tool for creating source code and their companion make files. If you created the right make file, compiling is also a breeze. However things get kind of tricky when you have to debug. Oh my! This can be a difficult task. Many may say that there’s nothing like gdb, but come on guys, even you can’t deny the beauty of a visual debugger.

The Rationale behind the Creation of a Model-View-Controller Framework: Fantastic

Important: This is a work in progress document. The Model-View-Controller is a software pattern frequently used for web development. As its name states, it is composed by three components: A Model or domain representation of a problem. It receives commands, processes them and modifies its state according to the input provided. A View whose main task is to retrieve information from the model and turn it into a useful representation for the user.

Oracle Snippets

This post will be updated with snippets for Oracle. I hope you find it useful.  1. Change the default date format Most useful snippet of the year! 😉 ALTER SESSION SET NLS_DATE_FORMAT = 'MM/DD/YYYY HH24:MI:SS'; select sysdate from dual; 2. Escape single quotes and ampersands on strings Single quotes: select 'D''Angelo''s' from dual; Ampersands: SET DEFINE OFF; 3. Adjust page width and size set pagesize 1000 set linesize 100 4.

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 = null; Properties p = new Properties(); p.put("user", "username"); p.put("password", "superpassword"); String cs = "jdbc:mysql://localhost/demo"; conn = DriverManager.

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 wp_generator tag in the Head section of your HTML I recommend you to add this line for security reasons.

1000 song names SQL test data

This time I want to share a 1000 rows SQL table that you can use for text searches. It includes a table with 1 column, 1000 rows song title names. It is plain standard SQL so you can use it with any database manager. Download it here. Hope you find it useful.

How many bytes does an "int" have in c++?

Well, that depends on several things, like your current processor and compiler. The best way to know it, is by using the sizeof operator. Copy the following code, compile it and run it: #include <iostream> using namespace std; int main() { cout << "char: " << sizeof(char) << endl; cout << "int: " << sizeof(int) << endl; cout << "long: " << sizeof(long) << endl; return 0; } Happy coding…

A simple Makefile

Learning how to create a Makefile is one of those tasks every C/C++ programmer has to do. Since there are many good make tutorials on the web, I’m only going to share a simplistic makefile that you can use for your projects. CFLAGS=-c -Wall -Iinclude LDFLAGS=-lPocoFoundation -lPocoData SOURCES=a.cpp b.cpp main.cpp OBJECTS=$(SOURCES:.cpp=.o) VPATH=src all: pre $(OBJECTS) g++ $(OBJECTS) -o build/main $(LDFLAGS) .cpp.o: g++ $(CFLAGS) $< -o $@ pre: mkdir -p build clean: rm -Rf build rm -f *.

How to setup a FastCGI development environment in CentOS 6

Install the development environment Install the C/C++ development tools to your server: yum install gcc gcc-c++ autoconf automake Now, before installing fcgi we need to add the epel repository: rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-7.noarch.rpm Once it is installed we can proceed to get the fcgi packages: yum install fcgi-devel spawn-fcgi Let’s see if we can compile a simple file. Create a file named example.c and copy and paste the following code in it:

A simple C++/Wt (Witty) skeleton for starting an application

The objective of this lesson is to show you how to make a simple web page navigation using Wt. Before starting you have to remember that Wt can be used to create 1 URL applications. That means you can have a full application that runs using just one URL. However it is also useful to give your users different URL’s to take advantage of some browser features like bookmarks or the back and forward buttons.