Tuesday, February 22, 2011

Remove "Empty Text" from a View

Really Views? Why do you hate me so??

How to remove the "Empty Text" text from a view-

$view->display['<display_id>']->handler->options['empty'] = '';

Sunday, February 20, 2011

Adding an email form to a Drupal View

I recently needed to add a form to the top of a view. Never having to do that before, I dove into the world of Views handlers (of which, there are way too many). I chose-


At this stage, you receive a view object right before it is rendered on the screen. However, this applies to all views, so I needed to specify the specific view/display. Selecting the view was easy-

if ($view->vid == %d)
* %d == the required view id

However, I struggled on selecting just the display I wanted to affect. After lots of googling, I found the answer-

if ($view->vid == %d && $view->current_display == %s)
* %s == page_1, page_2, block_1, etc

After that, it was a matter of setting-


equal to my form. All done!

Given my initial impression of Views, the object and handlers could really use some simplification. However, I'm sure there's a reason for all of it that I'm just not aware of yet (please feel free to drop some knowledge in the comments).

Friday, February 11, 2011


Just found this awesome piece of functionality in OS X. From terminal, pipe anything out that would typically go to stdout to pbcopy, and *bam* its in your clipboard! Have something already in clipboard? Type 'pbpaste' in terminal and there you have it!

example: cat file.txt | pbcopy

Work / Life

March 11th will be my last day at Florida Hospital. Technically my last working day will be the 4th, but I plan on going to DrupalCon that last week. Why am I leaving? Not because I dislike my current position at all, but a solid offer came my way in the form of a lead development position at Rise. Its an opportunity to build up a (much) smaller team than I'm used to (16000 employees at FH, 8 at Rise) and try my hand at leading. Its a little nerve racking, but I believe I'm up for the challenge.

Employment begins full-time at Rise on March 21st, although I've already taken on technical lead for two projects, and am actively developing on another. I've committed to an extra 10-12 hours of time per week leading up to my employment to make sure deadlines are met. Also, there's a need for a re-work of Rise's development/staging/vcs environment, so I've taken on that challenge as well. In tandem with that, I'm also working toward wrapping up existing projects at FH, as well as handing off my current responsibilities to my co-workers.


Over the last two weeks, I've become to realize how much of a challenge my current situation is. Between two jobs and finishing up outstanding side jobs, my work/life needle has been buried deep into the former. I have a beautiful wife, great family and friends, but hardly any time to see them. Even when I get those opportunities, its easy for me to drift back into what daemons still need to be set up on a new server, security, refactoring a class, Drupal theming, version control methodologies, books I haven't read, movies I haven't watched, articles in my Google Reader queue...

Its all quite overwhelming.

To compound this busy-ness, as my wife can attest, I have a terrible memory. She has an uncanny ability to remember minute social details (both in the future and past) that I, unless aforementioned event is in my calendar, cannot recall without some sort of cue. This leads to me forgetting simple day-to-day necessities and double-booking events. To combat this issue, I now fully rely on my calendar before committing to anything... which has helped a lot, but makes me feel dependent.

Now, I don't have an ultimate epiphany or really any concrete direction for this post, Its simply therapeutic to see this on screen (and helps with my new goal of blogging). I'm lucky to have a wife who invests in our relationship and helps remind me that work shouldn't be all-consuming. I love her for her support and focus on the lighter side of life (vacations, namely :) ). She truly is the reason why I'm able to pull back from the developer's tendency to completely get lost in work, and move the work/life needle more to the center where it belongs.

Thursday, February 10, 2011

IP Tables

# Allow established connections to communicate back to the server
iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT

iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -p tcp --dport 443 -j ACCEPT

# Drop all other packets
iptables -A INPUT -j DROP

# Accept loopback
iptables -I INPUT 1 -i lo -j ACCEPT

# Log all failed attempts (if more than 5 successive attempts are made)
iptables -I INPUT 5 -m limit --limit 5/min -j LOG --log-prefix "iptables denied: " --log-level 7

# List all iptables in the chain
iptables -L -v

# Save iptables
iptables-save -c > /etc/iptables.rules

# Edit network interfaces to incorporate iptables
vi /etc/network/interfaces

iface eth0 inet dhcp
 pre-up iptables-restore < /etc/iptables.rules