Archive for June, 2012


Core Database Functions

I work with databases probably more than the next guy. Along those lines I spent a few minutes to compose a list of functions that I think are a healthy starting point for “core functionality.” There are some things so basic I did not bother to include them (like trim). I think the list below can get the average developer pretty good mileage and it would be in the interests of most database vendors to support this list.

greatest
least

timestamp_to_epoch
time_to_epoch
date_to_epoch
epoch_to_date
epoch_to_time
epoch_to_timestamp

to_timestamp(value,format)
to_char(value,format)
to_date(value,format)
to_time(value,format)

bitwise_shift_left
bitwise_shift_right
bitwise_and
bitwise_or
bitwise_xor
bitwise_not

ascii
chr

quote_literal
quote_ident

repeat

to_hex
from_hex
to_base64
from_base64

get_byte
set_byte
get_bit
set_bit

md5

sprintf

translate
replace

sleep

row_to_json
json_to_row

get_json_object
set_json_object

row_to_xml
xml_to_row

get_xml_object
set_xml_object

concat
concat_ws

uuid
guid

if

reverse

 

regex_replace

regex_match

[aggregrate]
bit_and
bit_or
bit_xor
bit_not
concat
concat_ws

[table function]
sequence
build_ngrams
top_ngrams
sentences
regex_split
strtok_split
string_split

ggplot2 blog

I see Hadley Wickham has launched a new ggplot2 blog.

I got to meet Hadley for a day long tutorial session and later share dinner. I am truly impressed by what he has delivered and by how he continues to foster its growth.

If you are not familiar with ggplot2, it is a graphical package for the R project.

Personally, ggplot2 was my gateway into the land of R and I still very much use it almost daily. For me, it provided the building-block type of functionality that allowed me to gradually learn. Its strength for me was how readily I could re-use each building-block that I learned.

All in all, I look forward to seeing ggplot2 grow and I’m thankful for Hadley’s contributions.

Profiling Thread Activity

I’ve been working on a Java program for a little bit.

In effort to understand what it’s doing I’ve been monitoring the host network and CPU activity. I know what I’m looking for but it’s not always clear why I’m not achieving maximum CPU or network consumption.

To help understand I tried period stack dumps using jstack looking for shared object contention. I found a few items there so that was good.

I also tried using generic Java profiling where it shows which methods are using the largest percentage of CPU. That was semi-helpful but I still felt like I need more information.

So I started looking for something that would show me thread wait/monitor/run behavior. I was wanting to verify my assumed program behavior with what was really going on. What I found to help me in this case was the Java utility jvisualvm. I attached a couple screenshots below.

Ultimately I ended up enabling remote JMX connections then started up $JDK_HOME/bin/jvsiualvm and attached to the running process. From there I went to the thread view and began running tests. The results were very helpful to me in understanding thread behavior taking into account wait/monitor time.

What I show in these two screenshots is basically different behavior between data consumers and producers. It adequately verified assumed behavior with measured behavior.

What is your biography?

How would you write your biography in 150 words or less? A simple enough exercise but I think one that can help gauge where you are with your career in regards to where you want to be.

Ok, well that’s that. But I was thinking what are some incredible yet short biographies, here’s one:

George Washington: A successful farmer turned general. Led the fledgling American Revolutionary Army to defeat one of the most powerful nations of the time. Helped draft the Constitution then continued on to become the first president of the United States of America.

Sounds pretty awesome and that’s probably just thirty words. My biography on the other hand is not so noble. But I can aspire…

 

 

Follow

Get every new post delivered to your Inbox.

Join 25 other followers