<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-4957742841515787198</id><updated>2026-10-10T12:28:13.426+08:00</updated><category term="linux"/><category term="ubuntu"/><category term="java"/><category term="drupal"/><category term="php"/><category term="mysql"/><category term="spring"/><category term="cxf"/><category term="hibernate"/><category term="jax-ws"/><category term="jaxb"/><category term="jdbc"/><category term="openvpn"/><category term="rest"/><category term="rsyslog"/><category term="spring boot"/><category term="apache"/><category term="codeigniter"/><category term="css3"/><category term="hadoop"/><category term="html"/><category term="misc"/><category term="radius"/><category term="sql"/><category term="ssh"/><category term="windows"/><category term="apns"/><category term="authentication"/><category term="aws"/><category term="broadband"/><category term="dc"/><category term="debian"/><category term="dns"/><category term="drupal commerce"/><category term="excel"/><category term="fedora"/><category term="fonts"/><category term="freeradius"/><category term="grep"/><category term="hive"/><category term="ibm"/><category term="image"/><category term="input"/><category term="ipvs"/><category term="javaone"/><category term="jmeter"/><category term="jms"/><category term="jsf2"/><category term="kohana"/><category term="kvm"/><category term="messageformat"/><category term="mongodb"/><category term="mq"/><category term="nebula"/><category term="network"/><category term="placeholder"/><category term="postfix"/><category term="python"/><category term="regular expression extractor"/><category term="shorewall"/><category term="solaris"/><category term="stripesframework"/><category term="theme"/><category term="timestamp"/><category term="usb"/><category term="videos"/><category term="webform"/><category term="ws-security"/><category term="xml"/><title type='text'>Tech Tots</title><subtitle type='html'>Random thoughts on Linux, Java, security and other technical stuff...</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://techtots.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4957742841515787198/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://techtots.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/4957742841515787198/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Mike</name><uri>http://www.blogger.com/profile/12828408134779227322</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>90</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4957742841515787198.post-4279269647127344113</id><published>2024-04-21T14:22:00.005+08:00</published><updated>2024-04-21T14:25:49.304+08:00</updated><title type='text'>Setting CPU min, max and governor</title><summary type="text">Use the script below to set the min, max and CPU governor in Linux:#!/usr/bin/env bashMIN_FREQ=800000MAX_FREQ=1000000GOVERNOR=powersavefor i in `seq 0 3`;do&amp;nbsp; echo ${GOVERNOR} &amp;gt; /sys/devices/system/cpu/cpu${i}/cpufreq/scaling_governor&amp;nbsp; echo ${MAX_FREQ} &amp;gt; /sys/devices/system/cpu/cpu${i}/cpufreq/scaling_max_freq&amp;nbsp; echo ${MIN_FREQ} &amp;gt; /sys/devices/system/cpu/cpu${i}/cpufreq/</summary><link rel='replies' type='application/atom+xml' href='http://techtots.blogspot.com/feeds/4279269647127344113/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4957742841515787198/4279269647127344113' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4957742841515787198/posts/default/4279269647127344113'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4957742841515787198/posts/default/4279269647127344113'/><link rel='alternate' type='text/html' href='http://techtots.blogspot.com/2024/04/setting-cpu-min-max-and-governor.html' title='Setting CPU min, max and governor'/><author><name>Mike</name><uri>http://www.blogger.com/profile/12828408134779227322</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4957742841515787198.post-6081318192266873169</id><published>2021-06-09T20:59:00.006+08:00</published><updated>2021-06-13T15:44:27.772+08:00</updated><title type='text'>Enabling PAM Authentication in Hive (HDP 2.6)</title><summary type="text">&amp;nbsp;OverviewThis article describes how to enable PAM authentication in Hive.&amp;nbsp;By default, there&#39;s no authentication to Hive server.&amp;nbsp;With PAM, authentication is performed against local OS user credentials.ProcedureStep 1 - JPam LibraryDownload latest copy JPam library from http://jpam.sourceforge.net/Latest version is 1.1 (JPam-Linux_amd64-1.1.tgz)Once downloaded, create /usr/hdp/ext/</summary><link rel='replies' type='application/atom+xml' href='http://techtots.blogspot.com/feeds/6081318192266873169/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4957742841515787198/6081318192266873169' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4957742841515787198/posts/default/6081318192266873169'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4957742841515787198/posts/default/6081318192266873169'/><link rel='alternate' type='text/html' href='http://techtots.blogspot.com/2021/06/enabling-pam-authentication-in-hive-hdp.html' title='Enabling PAM Authentication in Hive (HDP 2.6)'/><author><name>Mike</name><uri>http://www.blogger.com/profile/12828408134779227322</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4957742841515787198.post-4898267682074936480</id><published>2020-03-21T19:29:00.000+08:00</published><updated>2020-03-21T19:29:02.933+08:00</updated><title type='text'>Clearing table locks in MariaDB ColumnStore (MCS)</title><summary type="text">If you encounter the following error running MCS:

Internal error: CAL0009: Truncate table failed:&amp;nbsp; IDB-2009: Unable to perform the cpimport operation because 30084 with PID -1 is currently holding the table lock for session .&amp;nbsp;&amp;nbsp;

It&#39;s due to locks placed on the objects.&amp;nbsp; Use the following command to view locked objects in MCS:

$ /usr/local/mariadb/columnstore/bin/</summary><link rel='replies' type='application/atom+xml' href='http://techtots.blogspot.com/feeds/4898267682074936480/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4957742841515787198/4898267682074936480' title='10 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4957742841515787198/posts/default/4898267682074936480'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4957742841515787198/posts/default/4898267682074936480'/><link rel='alternate' type='text/html' href='http://techtots.blogspot.com/2020/03/clearing-table-locks-in-mariadb.html' title='Clearing table locks in MariaDB ColumnStore (MCS)'/><author><name>Mike</name><uri>http://www.blogger.com/profile/12828408134779227322</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>10</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4957742841515787198.post-4058288573471048008</id><published>2017-03-09T19:07:00.001+08:00</published><updated>2017-03-09T19:07:14.410+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="hadoop"/><category scheme="http://www.blogger.com/atom/ns#" term="hive"/><title type='text'>Hive External Table</title><summary type="text">Script to create an external table in Hive to read records from a HDFS folder:

CREATE EXTERNAL TABLE Mytable (
    Id int,
    PlanID string,
    ServiceID string,
    SessionDuration int)
STORED AS TEXTFILE
ROW FORMAT DELIMITED
FIELDS TERMINATED BY &quot;,&quot;
LOCATION &quot;/user/hive/staging/&quot;
TBLPROPERTIES(
    &quot;skip.header.line.count&quot;=&quot;1&quot;
);

Using the script above, it&#39;ll use the files in /user/hive/</summary><link rel='replies' type='application/atom+xml' href='http://techtots.blogspot.com/feeds/4058288573471048008/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4957742841515787198/4058288573471048008' title='16 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4957742841515787198/posts/default/4058288573471048008'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4957742841515787198/posts/default/4058288573471048008'/><link rel='alternate' type='text/html' href='http://techtots.blogspot.com/2017/03/hive-external-table.html' title='Hive External Table'/><author><name>Mike</name><uri>http://www.blogger.com/profile/12828408134779227322</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>16</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4957742841515787198.post-8182892859626086178</id><published>2016-08-23T14:09:00.001+08:00</published><updated>2016-08-23T14:24:11.577+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="authentication"/><category scheme="http://www.blogger.com/atom/ns#" term="mongodb"/><title type='text'>Enabling client authentication in MongoDB</title><summary type="text">Before enabling authentication in MongoDB, we&#39;ll have to create a user and assign it a built-in role.  We&#39;ll use the built-in &quot;root&quot; role that provides admin access to all databases.

I&#39;ve done this in Ubuntu using MongoDB 3.2.  

 

Issue the following commands to create a new user in the &quot;admin&quot; database:

use admin
db.createUser({
    user: &quot;admin&quot;,
    pwd: &quot;password&quot;,
    roles: [
        { </summary><link rel='replies' type='application/atom+xml' href='http://techtots.blogspot.com/feeds/8182892859626086178/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4957742841515787198/8182892859626086178' title='9 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4957742841515787198/posts/default/8182892859626086178'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4957742841515787198/posts/default/8182892859626086178'/><link rel='alternate' type='text/html' href='http://techtots.blogspot.com/2016/08/enabling-client-authentication-in.html' title='Enabling client authentication in MongoDB'/><author><name>Mike</name><uri>http://www.blogger.com/profile/12828408134779227322</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>9</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4957742841515787198.post-6074926820688914683</id><published>2016-08-07T00:00:00.003+08:00</published><updated>2016-08-23T14:24:27.151+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="grep"/><category scheme="http://www.blogger.com/atom/ns#" term="linux"/><title type='text'>Limiting grep output</title><summary type="text">Here&#39;s a quick way to limit output of the grep command.

Most of the time, we issue the following to find needle in the haystack:

grep needle file.txt
This prints out the matching pattern.  If the output is way too long and we only need a section of it, we can use the extended grep (a.k.a. egrep) option.

 

Here&#39;s how to use regular expressions to instruct grep to only display 40 characters </summary><link rel='replies' type='application/atom+xml' href='http://techtots.blogspot.com/feeds/6074926820688914683/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4957742841515787198/6074926820688914683' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4957742841515787198/posts/default/6074926820688914683'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4957742841515787198/posts/default/6074926820688914683'/><link rel='alternate' type='text/html' href='http://techtots.blogspot.com/2016/08/limiting-grep-output.html' title='Limiting grep output'/><author><name>Mike</name><uri>http://www.blogger.com/profile/12828408134779227322</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4957742841515787198.post-3942535740329663785</id><published>2016-07-27T10:52:00.000+08:00</published><updated>2016-08-23T14:23:41.767+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="cxf"/><category scheme="http://www.blogger.com/atom/ns#" term="jax-ws"/><category scheme="http://www.blogger.com/atom/ns#" term="jaxb"/><category scheme="http://www.blogger.com/atom/ns#" term="spring boot"/><category scheme="http://www.blogger.com/atom/ns#" term="ws-security"/><title type='text'>Enabling WS-Security in Spring Boot using CXF, JAX-WS and JAXB</title><summary type="text">In my previous post, I&#39;ve shown how to quickly create a WSDL/SOAP based web service.  This post will build on top of that to include WS-Security.  We&#39;ll be using simple username/password authentication.

 

Add the following artifact into your Spring Boot pom.xml:


    org.apache.cxf
    cxf-rt-ws-security
    3.1.6


We create a callback handler class to perform our custom authentication.  This</summary><link rel='replies' type='application/atom+xml' href='http://techtots.blogspot.com/feeds/3942535740329663785/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4957742841515787198/3942535740329663785' title='10 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4957742841515787198/posts/default/3942535740329663785'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4957742841515787198/posts/default/3942535740329663785'/><link rel='alternate' type='text/html' href='http://techtots.blogspot.com/2016/07/enabling-ws-security-in-spring-boot.html' title='Enabling WS-Security in Spring Boot using CXF, JAX-WS and JAXB'/><author><name>Mike</name><uri>http://www.blogger.com/profile/12828408134779227322</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg0ESMgR_CDcp2hVzBFOQIcLQbHBRjxW2oAI5r-OS31Jfa4AyxWkjzPKNYRxB9eO_TF-5I9OtylOg8jyR-IfQQsmeqBYxmgea7nxEhuj-ff264DEtSM6Mqg_3OSmPc_i1QgGV86I35GEGs/s72-c/Screenshot_20160727_105130.png" height="72" width="72"/><thr:total>10</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4957742841515787198.post-4606446468232532581</id><published>2016-07-22T21:21:00.000+08:00</published><updated>2016-08-23T14:25:23.059+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="cxf"/><category scheme="http://www.blogger.com/atom/ns#" term="jax-ws"/><category scheme="http://www.blogger.com/atom/ns#" term="jaxb"/><category scheme="http://www.blogger.com/atom/ns#" term="spring boot"/><title type='text'>Getting Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions...</title><summary type="text">My previous post shows how we can easily create a SOAP based web service using Spring Boot, CXF, JAX-WS and JAXB.

There&#39;s a small matter to note when naming functions.  The following function naming works:

package com.techtots.services;

import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.xml.bind.annotation.XmlElement;

</summary><link rel='replies' type='application/atom+xml' href='http://techtots.blogspot.com/feeds/4606446468232532581/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4957742841515787198/4606446468232532581' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4957742841515787198/posts/default/4606446468232532581'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4957742841515787198/posts/default/4606446468232532581'/><link rel='alternate' type='text/html' href='http://techtots.blogspot.com/2016/07/getting-caused-by-comsunxmlbindv2runtim.html' title='Getting Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions...'/><author><name>Mike</name><uri>http://www.blogger.com/profile/12828408134779227322</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4957742841515787198.post-7783081341469696067</id><published>2016-07-22T21:09:00.001+08:00</published><updated>2016-08-23T14:25:38.297+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="cxf"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="jax-ws"/><category scheme="http://www.blogger.com/atom/ns#" term="jaxb"/><category scheme="http://www.blogger.com/atom/ns#" term="spring boot"/><title type='text'>Creating WSDL/SOAP web services in Spring Boot using CXF, JAX-WS and JAXB</title><summary type="text">Here&#39;s a quick way to use Spring Boot to expose web services via WSDL/SOAP using CXF, JAX-WS and JAXB.

Add the following artifacts into your Spring Boot pom.xml:


    org.apache.cxf
    cxf-rt-frontend-jaxws
    3.1.6



    org.apache.cxf
    cxf-rt-transports-http
    3.1.6


 

We start off by creating the request and response classes.  These classes act as the value objects for the </summary><link rel='replies' type='application/atom+xml' href='http://techtots.blogspot.com/feeds/7783081341469696067/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4957742841515787198/7783081341469696067' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4957742841515787198/posts/default/7783081341469696067'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4957742841515787198/posts/default/7783081341469696067'/><link rel='alternate' type='text/html' href='http://techtots.blogspot.com/2016/07/creating-wsdlsoap-web-services-in.html' title='Creating WSDL/SOAP web services in Spring Boot using CXF, JAX-WS and JAXB'/><author><name>Mike</name><uri>http://www.blogger.com/profile/12828408134779227322</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4957742841515787198.post-3223309034490524720</id><published>2014-07-26T14:39:00.000+08:00</published><updated>2014-08-05T17:41:15.385+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="apache"/><category scheme="http://www.blogger.com/atom/ns#" term="drupal"/><title type='text'>Configuring Apache to return CORS headers for Drupal Services</title><summary type="text">Here&#39;s what I did to configure Apache to return the proper CORS headers for my webapp consumption which is written in AngularJS:

Header always set Access-Control-Allow-Origin &quot;*&quot;
Header always set Access-Control-Allow-Methods &quot;GET, POST, OPTIONS&quot;
Header always set Access-Control-Allow-Headers &quot;accept, content-type&quot;
Header always set Access-Control-Allow-Credentials &quot;true&quot;

That can be set in the</summary><link rel='replies' type='application/atom+xml' href='http://techtots.blogspot.com/feeds/3223309034490524720/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4957742841515787198/3223309034490524720' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4957742841515787198/posts/default/3223309034490524720'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4957742841515787198/posts/default/3223309034490524720'/><link rel='alternate' type='text/html' href='http://techtots.blogspot.com/2014/07/configuring-apache-to-return-cors.html' title='Configuring Apache to return CORS headers for Drupal Services'/><author><name>Mike</name><uri>http://www.blogger.com/profile/12828408134779227322</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4957742841515787198.post-1117305962662340633</id><published>2014-02-11T15:28:00.001+08:00</published><updated>2014-02-11T15:29:16.796+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="image"/><category scheme="http://www.blogger.com/atom/ns#" term="linux"/><title type='text'>Resizing images in batch using mogrify</title><summary type="text">Here&#39;s a quick way to resize images via shell using mogrify.  It&#39;s part of ImageMagick package.

mogrify -resize 60% *.jpg

This will resize all files ending with .jpg extension to 60% of their original size.

We&#39;re only scratching the surface of what mogrify can do.  Have fun exploring :)</summary><link rel='replies' type='application/atom+xml' href='http://techtots.blogspot.com/feeds/1117305962662340633/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4957742841515787198/1117305962662340633' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4957742841515787198/posts/default/1117305962662340633'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4957742841515787198/posts/default/1117305962662340633'/><link rel='alternate' type='text/html' href='http://techtots.blogspot.com/2014/02/resizing-images-in-batch-using-mogrify.html' title='Resizing images in batch using mogrify'/><author><name>Mike</name><uri>http://www.blogger.com/profile/12828408134779227322</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4957742841515787198.post-1784456060109220295</id><published>2014-02-03T10:01:00.000+08:00</published><updated>2014-02-03T10:01:15.580+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="php"/><title type='text'>Default Parameter Values in PHP Functions</title><summary type="text">Here&#39;s a neat way to set some default parameter values in a PHP function.  This only works if a function param is passed in as associative array.

function create_profile($values) {
  if (!is_array($values)) {
    $values = array();
  }
  
  // Default key/values
  $values += array(
      &#39;uid&#39; =&gt; NULL,
      &#39;username&#39; =&gt; &#39;&#39;,
      &#39;mobile&#39; =&gt; &#39;99999999&#39;,
      &#39;location&#39; =&gt; &#39;POINT(0 0)&#39;,
      </summary><link rel='replies' type='application/atom+xml' href='http://techtots.blogspot.com/feeds/1784456060109220295/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4957742841515787198/1784456060109220295' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4957742841515787198/posts/default/1784456060109220295'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4957742841515787198/posts/default/1784456060109220295'/><link rel='alternate' type='text/html' href='http://techtots.blogspot.com/2014/02/default-parameter-values-in-php.html' title='Default Parameter Values in PHP Functions'/><author><name>Mike</name><uri>http://www.blogger.com/profile/12828408134779227322</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4957742841515787198.post-4697453439328635931</id><published>2014-01-28T21:59:00.001+08:00</published><updated>2014-01-28T21:59:54.692+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="drupal"/><title type='text'>Setting &quot;placeholder&quot; attribute in Drupal 7 form elements</title><summary type="text">Here&#39;s a quick way on how to use HTML5 placeholder attribute in Drupal forms.  Example below is altering the login form in a custom theme:

function mytheme_form_alter(&amp;$form, &amp;$form_state, $form_id) {
  if ($form_id == &#39;user_login&#39;) {
    $form[&#39;name&#39;][&#39;#attributes&#39;] = array(&#39;placeholder&#39; =&gt; $form[&#39;name&#39;][&#39;#title&#39;]);
    
    $form[&#39;pass&#39;][&#39;#attributes&#39;] = array(&#39;placeholder&#39; =&gt; $form[&#39;pass&#39;][&#39;#</summary><link rel='replies' type='application/atom+xml' href='http://techtots.blogspot.com/feeds/4697453439328635931/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4957742841515787198/4697453439328635931' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4957742841515787198/posts/default/4697453439328635931'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4957742841515787198/posts/default/4697453439328635931'/><link rel='alternate' type='text/html' href='http://techtots.blogspot.com/2014/01/setting-placeholder-attribute-in-drupal.html' title='Setting &quot;placeholder&quot; attribute in Drupal 7 form elements'/><author><name>Mike</name><uri>http://www.blogger.com/profile/12828408134779227322</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4957742841515787198.post-6327344024792978431</id><published>2013-09-11T20:03:00.000+08:00</published><updated>2013-09-11T20:03:13.436+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="jmeter"/><category scheme="http://www.blogger.com/atom/ns#" term="regular expression extractor"/><title type='text'>Using JMeter&#39;s Regular Expression Extractor</title><summary type="text">Here&#39;s how to use JMeter&#39;s Regular Expression Extractor post-processor to extract the response from a HTTP Request sampler and use it in the subsequent request.




In the screen above, I&#39;m extracting the value of the hidden form element named &quot;t&quot;. &amp;nbsp;If there&#39;s no match to the regular expression, the default value &quot;NO TOKEN&quot; will be returned.

To use the extracted value in subsequent HTTP </summary><link rel='replies' type='application/atom+xml' href='http://techtots.blogspot.com/feeds/6327344024792978431/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4957742841515787198/6327344024792978431' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4957742841515787198/posts/default/6327344024792978431'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4957742841515787198/posts/default/6327344024792978431'/><link rel='alternate' type='text/html' href='http://techtots.blogspot.com/2013/09/using-jmeters-regular-expression.html' title='Using JMeter&#39;s Regular Expression Extractor'/><author><name>Mike</name><uri>http://www.blogger.com/profile/12828408134779227322</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj1s8T9DXQm8eZOrNNQ2lG8Zir3-CDWOKAQFzYCxJ3S-k8U4sPb8bfHvH6yeKxPWSW2kDn-rw74Jv1zssKfHRWrQmqwvc3NAG_pTEawsgdtT7sDkabkQvbon1QB8Mhcj382XNLIrMDAnnw/s72-c/jmeter1.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4957742841515787198.post-885647910845718949</id><published>2013-08-15T01:46:00.000+08:00</published><updated>2013-08-15T01:46:09.575+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="drupal"/><category scheme="http://www.blogger.com/atom/ns#" term="theme"/><title type='text'>Using Drupal&#39;s hook_theme() for custom theming</title><summary type="text">This is a short post on how to use Drupal&#39;s hook_theme() to customize a layout within your own custom module.

Start off with implementing the hook_theme() function in your module:

/**
 * Implements hook_theme()
 * @param type $existing
 * @param type $type
 * @param type $theme
 * @param type $path
 * @return array
 */
function mypm_theme($existing, $type, $theme, $path) {
  $themes = array(
</summary><link rel='replies' type='application/atom+xml' href='http://techtots.blogspot.com/feeds/885647910845718949/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4957742841515787198/885647910845718949' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4957742841515787198/posts/default/885647910845718949'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4957742841515787198/posts/default/885647910845718949'/><link rel='alternate' type='text/html' href='http://techtots.blogspot.com/2013/08/using-drupals-hooktheme-for-custom.html' title='Using Drupal&#39;s hook_theme() for custom theming'/><author><name>Mike</name><uri>http://www.blogger.com/profile/12828408134779227322</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4957742841515787198.post-538047580578666960</id><published>2013-08-14T21:17:00.000+08:00</published><updated>2013-08-14T21:25:09.276+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="hibernate"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="jdbc"/><category scheme="http://www.blogger.com/atom/ns#" term="rest"/><category scheme="http://www.blogger.com/atom/ns#" term="spring"/><title type='text'>Spring 3 MVC + Hibernate 4 + JdbcTemplate + Partial REST controller (Part 3)</title><summary type="text">Last part of the article is to use either Hibernate or Spring&#39;s JdbcTemplate to retrieve data.  The following class is the BaseDao where DataSource and Hibernate SessionFactory are injected and used by concrete DAO classes:

package com.techtots.services.api.dao;

import javax.sql.DataSource;

import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
</summary><link rel='replies' type='application/atom+xml' href='http://techtots.blogspot.com/feeds/538047580578666960/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4957742841515787198/538047580578666960' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4957742841515787198/posts/default/538047580578666960'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4957742841515787198/posts/default/538047580578666960'/><link rel='alternate' type='text/html' href='http://techtots.blogspot.com/2013/08/spring-3-mvc-hibernate-4-jdbctemplate_7272.html' title='Spring 3 MVC + Hibernate 4 + JdbcTemplate + Partial REST controller (Part 3)'/><author><name>Mike</name><uri>http://www.blogger.com/profile/12828408134779227322</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4957742841515787198.post-5501165771059374784</id><published>2013-08-14T20:56:00.004+08:00</published><updated>2013-08-14T21:18:01.652+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="hibernate"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="jdbc"/><category scheme="http://www.blogger.com/atom/ns#" term="rest"/><category scheme="http://www.blogger.com/atom/ns#" term="spring"/><title type='text'>Spring 3 MVC + Hibernate 4 + JdbcTemplate + Partial REST controller (Part 2)</title><summary type="text">Second part of the article will focus on the controllers which will process clients&#39; requests as well as other helper classes.

We start off with a custom exception.  We add on a HttpStatus code into the exception to return to clients:

package com.techtots.services.api.common.exceptions;

import org.springframework.http.HttpStatus;

public class RestException extends Exception {

 private static</summary><link rel='replies' type='application/atom+xml' href='http://techtots.blogspot.com/feeds/5501165771059374784/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4957742841515787198/5501165771059374784' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4957742841515787198/posts/default/5501165771059374784'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4957742841515787198/posts/default/5501165771059374784'/><link rel='alternate' type='text/html' href='http://techtots.blogspot.com/2013/08/spring-3-mvc-hibernate-4-jdbctemplate_14.html' title='Spring 3 MVC + Hibernate 4 + JdbcTemplate + Partial REST controller (Part 2)'/><author><name>Mike</name><uri>http://www.blogger.com/profile/12828408134779227322</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4957742841515787198.post-8735815062562950599</id><published>2013-08-14T19:36:00.000+08:00</published><updated>2013-08-14T19:36:44.560+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="hibernate"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="jdbc"/><category scheme="http://www.blogger.com/atom/ns#" term="rest"/><category scheme="http://www.blogger.com/atom/ns#" term="spring"/><title type='text'>Spring 3 MVC + Hibernate 4 + JdbcTemplate + Partial REST controller (Part 1)</title><summary type="text">This is post serves as a reference point to quickly setup a Java web application with Spring 3 MVC, Hibernate 4, JdbcTemplate and a partial REST controller.  We&#39;ll be consuming and responding JSON content via the REST controllers.

I&#39;m using Eclipse as the IDE and will be connecting to MySQL database.

Let&#39;s start off with the libraries:

antlr-2.7.7.jar
aopalliance.jar
bonecp-0.7.1.RELEASE.jar
</summary><link rel='replies' type='application/atom+xml' href='http://techtots.blogspot.com/feeds/8735815062562950599/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4957742841515787198/8735815062562950599' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4957742841515787198/posts/default/8735815062562950599'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4957742841515787198/posts/default/8735815062562950599'/><link rel='alternate' type='text/html' href='http://techtots.blogspot.com/2013/08/spring-3-mvc-hibernate-4-jdbctemplate.html' title='Spring 3 MVC + Hibernate 4 + JdbcTemplate + Partial REST controller (Part 1)'/><author><name>Mike</name><uri>http://www.blogger.com/profile/12828408134779227322</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4957742841515787198.post-729706037015355050</id><published>2013-08-01T20:47:00.000+08:00</published><updated>2013-08-01T20:47:12.606+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="kohana"/><category scheme="http://www.blogger.com/atom/ns#" term="php"/><title type='text'>Two things to get Kohana up and running</title><summary type="text">Here are 2 things to do right after meeting all requirements dictated by Kohana&#39;s install script:


Set Cookie::$salt value in application/bootstrap.php:

Cookie::$salt = &#39;my*salt*value*&#39;;


Change base_url value in application/bootstrap.php to match the server configuration:

Kohana::init(array(
 &#39;base_url&#39;   =&gt; &#39;/my_app/&#39;,
));

In this example, you should be calling http://myserver.com/my_app/
</summary><link rel='replies' type='application/atom+xml' href='http://techtots.blogspot.com/feeds/729706037015355050/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4957742841515787198/729706037015355050' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4957742841515787198/posts/default/729706037015355050'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4957742841515787198/posts/default/729706037015355050'/><link rel='alternate' type='text/html' href='http://techtots.blogspot.com/2013/08/two-things-to-get-kohana-up-and-running.html' title='Two things to get Kohana up and running'/><author><name>Mike</name><uri>http://www.blogger.com/profile/12828408134779227322</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4957742841515787198.post-3292832419098522692</id><published>2013-07-31T12:07:00.000+08:00</published><updated>2013-07-31T12:07:43.950+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="messageformat"/><category scheme="http://www.blogger.com/atom/ns#" term="placeholder"/><title type='text'>Java Message Format Using Named Placeholder</title><summary type="text">The Java MessageFormat class allows user to pre-define a string with placeholders and then fill the placeholders with actual strings later to construct a proper message.

It&#39;s all fine if you&#39;re used to numbered placeholders e.g. {0} and {1}.  Since I&#39;m used to Drupal&#39;s format_string() function, here&#39;s a better alternative.  Apache Commons has a StrSubstitutor class which allows use of named </summary><link rel='replies' type='application/atom+xml' href='http://techtots.blogspot.com/feeds/3292832419098522692/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4957742841515787198/3292832419098522692' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4957742841515787198/posts/default/3292832419098522692'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4957742841515787198/posts/default/3292832419098522692'/><link rel='alternate' type='text/html' href='http://techtots.blogspot.com/2013/07/java-message-format-using-named.html' title='Java Message Format Using Named Placeholder'/><author><name>Mike</name><uri>http://www.blogger.com/profile/12828408134779227322</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4957742841515787198.post-5082275780178543184</id><published>2013-07-30T21:53:00.001+08:00</published><updated>2013-07-30T21:53:24.238+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="drupal"/><category scheme="http://www.blogger.com/atom/ns#" term="sql"/><title type='text'>SQL UNION using Drupal db_select</title><summary type="text">Here&#39;s how to use Drupal&#39;s db_select function to perform a SQL UNION like below: 

select uid from users where type = &#39;i&#39;
union
select uid from users_archive where type = &#39;i&#39;

Bad example, but I can&#39;t think of a proper example now :)

Drupal db_select version:

$q1 = db_select(&#39;users&#39;, &#39;u&#39;)
       -&gt;fields(&#39;u&#39;, array(&#39;uid&#39;))
       -&gt;condition(&#39;type&#39;, &#39;i&#39;);

$q2 = db_select(&#39;users_archive&#39;, &#39;ua&#39;)</summary><link rel='replies' type='application/atom+xml' href='http://techtots.blogspot.com/feeds/5082275780178543184/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4957742841515787198/5082275780178543184' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4957742841515787198/posts/default/5082275780178543184'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4957742841515787198/posts/default/5082275780178543184'/><link rel='alternate' type='text/html' href='http://techtots.blogspot.com/2013/07/sql-union-using-drupal-dbselect.html' title='SQL UNION using Drupal db_select'/><author><name>Mike</name><uri>http://www.blogger.com/profile/12828408134779227322</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4957742841515787198.post-721871090579936003</id><published>2013-07-26T10:31:00.001+08:00</published><updated>2013-07-26T10:31:56.826+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="codeigniter"/><category scheme="http://www.blogger.com/atom/ns#" term="php"/><title type='text'>Getting last run SQL from CodeIgniter&#39;s DB class</title><summary type="text">Here&#39;s a convenient way to obtain the last executed SQL query when using CodeIgniter&#39;s database class.  

Code snippet for this example:

$this-&gt;db-&gt;select(&#39;status&#39;);
$this-&gt;db-&gt;from(&#39;tbl_user&#39;);
$this-&gt;db-&gt;where(&#39;user_id&#39;, $user_id);

$results = $this-&gt;db-&gt;get();

echo $this-&gt;db-&gt;last_query();

The last call to last_query() will output the actual SQL executed.</summary><link rel='replies' type='application/atom+xml' href='http://techtots.blogspot.com/feeds/721871090579936003/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4957742841515787198/721871090579936003' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4957742841515787198/posts/default/721871090579936003'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4957742841515787198/posts/default/721871090579936003'/><link rel='alternate' type='text/html' href='http://techtots.blogspot.com/2013/07/getting-last-run-sql-from-codeigniters.html' title='Getting last run SQL from CodeIgniter&#39;s DB class'/><author><name>Mike</name><uri>http://www.blogger.com/profile/12828408134779227322</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4957742841515787198.post-1386124726116667411</id><published>2013-07-17T08:59:00.000+08:00</published><updated>2013-07-17T08:59:35.101+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="drupal"/><title type='text'>SQL JOINS using Drupal db_select</title><summary type="text">Here&#39;s how to use Drupal&#39;s db_select function to perform a SQL INNER JOIN like below:

SELECT n.*, u.name FROM node n 
INNER JOIN users u on n.uid = u.uid
WHERE u.id = 3

Drupal db_select version:

$q = db_select(&#39;node&#39;, &#39;n&#39;);
$q-&gt;join(&#39;users&#39;, &#39;u&#39;, &#39;u.uid = n.uid&#39;);

$q-&gt;fields(&#39;n&#39;);
$q-&gt;fields(&#39;u&#39;, array(&#39;name&#39;));

$q-&gt;condition(&#39;u.uid&#39;, 3);
  
$results = $q-&gt;execute();
</summary><link rel='replies' type='application/atom+xml' href='http://techtots.blogspot.com/feeds/1386124726116667411/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4957742841515787198/1386124726116667411' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4957742841515787198/posts/default/1386124726116667411'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4957742841515787198/posts/default/1386124726116667411'/><link rel='alternate' type='text/html' href='http://techtots.blogspot.com/2013/07/sql-joins-using-drupal-dbselect.html' title='SQL JOINS using Drupal db_select'/><author><name>Mike</name><uri>http://www.blogger.com/profile/12828408134779227322</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4957742841515787198.post-4494441933042498519</id><published>2013-07-15T21:40:00.001+08:00</published><updated>2013-07-15T21:40:33.524+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="excel"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="stripesframework"/><title type='text'>Output XLS file to servlet output stream using JExcelAPI</title><summary type="text">Here&#39;s a quick way (although not the best one) to stream an Excel file generated by JExcelAPI (http://jexcelapi.sourceforge.net/).  I&#39;m using the servlet output stream in this case.  

HttpServletResponse response = getContext().getResponse();

ServletOutputStream sos = response.getOutputStream();

WritableWorkbook workbook = Workbook.createWorkbook(sos);
WritableSheet sheet = </summary><link rel='replies' type='application/atom+xml' href='http://techtots.blogspot.com/feeds/4494441933042498519/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4957742841515787198/4494441933042498519' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4957742841515787198/posts/default/4494441933042498519'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4957742841515787198/posts/default/4494441933042498519'/><link rel='alternate' type='text/html' href='http://techtots.blogspot.com/2013/07/output-xls-file-to-servlet-output.html' title='Output XLS file to servlet output stream using JExcelAPI'/><author><name>Mike</name><uri>http://www.blogger.com/profile/12828408134779227322</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4957742841515787198.post-4228209480731256990</id><published>2013-07-01T21:39:00.001+08:00</published><updated>2013-07-17T19:20:13.563+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="drupal"/><category scheme="http://www.blogger.com/atom/ns#" term="mysql"/><category scheme="http://www.blogger.com/atom/ns#" term="timestamp"/><title type='text'>Formatting Drupal&#39;s UNIX timestamp dates</title><summary type="text">Drupal stores date/time value as int columns in MySQL.  Its value is UNIX timestamp based.  You will not be able to determine the actual date/time by selecting from the table.

Here&#39;s a convenient way to convert the date/time columns directly from SQL:

SELECT cid, data, FROM_UNIXTIME(created) FROM main_cache

You can also use this in the WHERE clause like below:

SELECT COUNT( * ) 
FROM  </summary><link rel='replies' type='application/atom+xml' href='http://techtots.blogspot.com/feeds/4228209480731256990/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4957742841515787198/4228209480731256990' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4957742841515787198/posts/default/4228209480731256990'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4957742841515787198/posts/default/4228209480731256990'/><link rel='alternate' type='text/html' href='http://techtots.blogspot.com/2013/07/formatting-drupals-unix-timestamp-dates.html' title='Formatting Drupal&#39;s UNIX timestamp dates'/><author><name>Mike</name><uri>http://www.blogger.com/profile/12828408134779227322</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZc0mKlTP7BKLzk5j14cPL1cqlBvVnYF-eEtnBhi8mEJNE_wXJX_1V-Q8PJ1FrqSRCmp22gvH8uCDHptzTs_TqSd3WhYvbW3xBhvYnfeXEVmA2-WgOo2yfGYvPXAa6gaz0RFN416TMS7g/s72-c/snapshot10.png" height="72" width="72"/><thr:total>1</thr:total></entry></feed>