avatar

Andres Jaimes

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.

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.

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.

How to use a WComboBox with C++/Wt (Witty)

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.

Creating a simple form using C++/Wt (Witty)

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.

Creating Shortcodes in WordPress

Shortcodes enable developers to create special kinds of content, following the idea of macros. One very famous short code is “gallery” needed to insert a gallery of images into a post. The good thing about shortcode’s is that final users are free to decide where to insert them. WordPress’s Shortcode API handles all the tricky parsing, making developers life much easier. The following is a snippet for a Shortcode – in order to make it work you have to add it to your functions.

Add a Thumbnail to Admin Post Columns in WordPress

Here is a snippet to add 64×64 images to the Admin Post Columns in WordPress. Having thumbnails may result extremely helpful, specially if you have hundreds of posts. You have to copy and paste the following code into the functions.php file of your theme. function posts_columns($defaults){ $defaults['the_post_thumbs'] = __('Thumbs'); return $defaults; } function posts_custom_columns($column_name, $id){ if($column_name === 'the_post_thumbs'){ echo the_post_thumbnail( array(64, 64) ); } } add_filter('manage_posts_columns', 'posts_columns'); add_action('manage_posts_custom_column', 'posts_custom_columns', 10, 2);  Instead of array(64, 64) you can also use default image sizes like ‘featured_thumbnail’, ‘thumbnail’, ‘medium’, ‘large’ and ‘full’.