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.
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
select 'D''Angelo''s' from dual; Ampersands:
SET DEFINE OFF; 3. Adjust page width and size
set pagesize 1000 set linesize 100 4.
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 to follow this tutorial to get version 1.6.
Installing Tomcat yum -y install tomcat6 tomcat6-webapps tomcat6-admin-webapps chkconfig tomcat6 on service tomcat6 start Use a web browser to check it is working correctly.
Java 1.5 is the default Java version you get when you ask yum to install it on CentOS. However, several applications need 1.6 in order to run. Just follow the next steps to install it.
Remove Java 1.5
yum remove java-1.5-* Install the rpmforge repository
cd rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt Check if you have a 32 or 64 CentOS version
uname -a For 32 versions (i686) download and install the following repository
In few words, you have to configure MySQL to allow remote connections, create a user for connecting and setup your firewall to allow it. You don’t have to do this if you are only connecting from a local application like WordPress.
You need root permissions to perform the following commands.
Configuring MySQL Edit the MySQL configuration file.
nano /etc/my.cnf Allow connections from all your network interfaces by commenting out the following line:
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:
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.
In this entry I’m going to create a simple form that shows how to add items to WComboBox in two different ways. The first one is useful for static combo items while the second one might be used to populate a combo from a database.
The code is based on our previous Hello World application. There are few lines that changed.
Using Static Combo Items Adding items to a WComboBox is just a matter of calling the addItem method.
In this entry I’m going to create a simple form. This form will show you how to use controls and events in a very simple way.
A couple things you have to notice before we start:
I’m going to inherit from WContainerWidget. As you now know, I could have inherited from WApplication too. Most controls like, WLabel, WLineEdit and WPushButton include a “parent” parameter in their constructors. But you can also create them and add them later to any WContainerWidget.
Let’s start by talking a little bit about some elements and methods you will find in the code.
Inheriting from WApplication or WContainerWidget are the most common ways to start an application using Wt. A WApplication instance will be in charge of creating your html, head and body tags. A WContainerWidget is usually a div tag (it can also be turned into a ul or ol by using its setList method).