Why it’s good to take breaks (Drupal + Fences + Field tpl.phps + Dumbness)

So I’m working on a redo of my site in Drupal (finally). I’ve got a custom content type, where I have a term reference that’s displaying taxonomy terms. I’m using the Fences module to cleanup Drupal’s “div diarrhea” issue. And I really wanted my set of taxonomy terms + label to properly wrap themselves in a div so I can easily separate them from other content – but with Fences, the combination of label + terms is wrapped in absolutely nothing. I can’t find a tpl from the Fences options that would work, and then adding a field–[fieldname].tpl.php wasn’t working either: because of Fences being enabled for that field, I’m assuming.

And then I take a break, come back, and realize I can just wrap the render statement for that field, living in my custom node tpl, in a <div>. Welp!

I painted and varnished a table that someone threw out

So there’s a spot in the basement of my apartment building where people, usually when moving out, will dump unwanted items, primarily furniture. I always pass this spot when I take out my recycling, usually 1 out of every 3 times there’s something there. On one lucky day about 2 weeks ago, someone had dumped several pieces of furniture, including this little table:

little table

The paint job was poor, the colors mismatched, and I’m not sure what was going on with the sheet music at the top. While the concept of sheet music collage is a good one, taking 3 sheets and just plastering them on there (not even fully covering the table) is not exactly the best execution of that idea.

So I decided to repaint it to match a table I’d repainted about 2 years back. Picked up some pink and black acrylic, dug out my varnish, and had at it. Did 3 coats of paint, and then 2 coats of varnish. Took slightly longer than it could have, however; I needed to dry the varnish outside to due cancer-causing fumes and whatnot, and while I was crossing my fingers for sunny skies, the weather had other plans.

snowy table parts

I’m pretty happy with the outcome. The drawer is a little wobbly (this was clearly originally a cheap IKEA-esque piece of furniture), but aside from that it’s sturdy enough. My pens and notepads finally have their own home!

painted end table

And, here it is with it’s matching table (please ignore the shoes!):

table set

Profitability & hotfix to release ratios in Agile environments

So I have this theory that, for the average company that uses Agile, the hotfix to release ratio directly correlates with the success of a company.

OK, so “success” is pretty vague, so let’s look at it in more specific terms.

Profitability

Let’s say a given company’s hotfix to release ratio is very high. So they’re doing at least as many hotfixes as releases (if not more). This suggest that their development team’s primary focus is on fixing existing bugs and/or rushing in changes to the application. Which leaves less time for developing new products/features/advancements. Thus less value added to their existing product, meaning fewer shinies (as it were) that marketing can use to drive in leads. Or fewer products to add to the market. All of which will shrink profits.

Customer Satisfaction

One thing that could cause very frequent hotfixes to be necessary is the discovery of bugs on the production version of the application. So if these are major bugs, it’s probably guaranteed that users are noticing them, and are none too pleased about them. Regular occurrences of bugs on production imply a lack of solid QA, meaning there might be even deeper flaws in the application that simply haven’t been discovered yet.

Even minor bugs that are getting hotfixed, such as grammar edits, imply a sloppiness in the application itself. And who wants to use a sloppy application?

Employee Satisfaction

Frequent hotfixes also imply a process issue. Lack of proper QA is in itself a process issue, and will lead to frustration for all parties involved when development work isn’t properly tested – or when a proofreading process for copy is inconsistent to nonexistent. And, if the hotfixes aren’t QA-related and are simply “mini releases that couldn’t wait”, this implies a team that’s overly focused on the short term and missing out on the long view of the project (well, long view in Agile terms, at least) and are stuck rushing slapped together solutions rather than properly being able to focus to building a good solution (a frustration for anyone who actually likes making high quality work).

So I’d like to make there be a thing called the HFR ratio (for Hotfix Release). You can magically get access to protected Github data and calculate the HFR ratio for different companies (assuming companies generally have a naming schema that indicates if that push is a regular or hotfix release). This could be useful for many purposes, such as determining what companies to invest in, what applications to pay (or not pay) money for, and what companies to pursue employment with.

Hey look I made a frilly EGL head thing

Gonna do the Harajuku fashion walk this Friday at NDK. Taking a stab a pulling off gothic lolita style. So I made this headdress and these bracelet things.

EGL headdress & bracelets

Unlike most of my sewing experiments, the headdress actually came out looking pretty decent. Sewed a long, narrow rectangle out of some tulle-like fabric for the base. Added tying straps to the side, then sewed the ruffle in a ring around the entire thing. Made bows out of more of the tulle, plus thread + hot glue gun + ribbon. Then just hot glued the ribbons to each side.

As inspiration, I looked at this pattern for a headdress as well as this headdress from Baby, The Stars Shine Bright.

I chopped up an old bra and used the straps as the base for the bracelet, glueing some velcro to secure the ends around the wrist. Then, took some fabric from the front of the bra for the bows, with ribbon wrapped around, and everything held in place with hot glue.

Still gotta figure out a decent necklace, plus something to make my shirt look better. I actually have a skirt that ordered from Bodyline a little while back, along with a petticoat + socks. In terms of ordering Japanese clothing, shirts are a bit of an issue (and dresses unlikely to happen), as I am not shaped like the average Japanese person. But I’m sure I’ll figure something out.

Getting a local install of Drupal on your Nexus/Android device using Bit Web Server

I wanted to get a Drupal local on a tablet. My original thought was to get a Windows tablet, wipe it, install some Linux flavor, and go from there. However, that seemed like a big ole pain. Conveniently, around that time I learned about Bit Web Server for Android, & decided to go that direction instead.

Got a super sweet deal on a 2nd gen Nexus 7, and here’s what ended up working for me:

1. Downloaded Bit Web Server
Super easy to set up. Note: your localhost files will live in storage/sdcard0/www. If you’re on a 2nd gen Nexus 7 at least. I’m assuming other Android devices would be similar. However, as this is the first Android device I’ve ever owned, you might not wish to listen to me!

2. Downloaded Astro File Manager
You’ll need to navigate your file structure somehow, after all. There’s probably a decent selection of file managers out there, and I’m sure any of them would work fine. However, my brief and frantic research led me to this one, and it’s working out quite nice for me thus far.

3. Download AWD
This is an IDE for Android. Seems like the most recommended one (based, again, on my brief and frantic research). I ended up dropping the $5 for the paid version, so I could have git capabilities, among other things. Which brings us to…

4. Grab some Drupal files
I tried cloning this from git at first. (Here’s the instructions in case you wanna try it.) I, uh, failed. The first time I failed, it was because my tablet display only stayed active 2 minutes before the tablet fell asleep. Oops. So I bumped it up to 30 minutes. And then git stalled at 24%. So I gave up and just downloaded it directly from the site.

So, technically step 4.5 here is “Download a zip program” (I ended up grabbing Winzip). But, hopefully others have better luck with git cloning than I did and thus don’t need to worry about that part.

5. Move it into your localhost dir
Astro made this pretty simple.

6. Create your database
If you open up your Bit Web Server, there’s a PHPMyAdmin link, will take you right in there. Just make yourself a nice little empty db.

6. Navigate to your drupal root dir in your browser, and commence setup
Open up Bit Web Server, and click Localhost, and your directory should be sitting there. Assuming all goes well, once you go into your dir, you should see the standard Drupal setup screen.

Setup was super easy for me. Simpler than standard setup – no renaming default.settings.php, no dir creation or permissions changing. Slightly concerned about that, tbh. But, it works.

Still need to explore a bit more, give it some stress testing, load in some modules. Also on the list is to figure out how to get some sort of command line. Would be amazing if I can get Drush on this thing. Or SASS, for that matter. We’ll see!

Rendering fontcustom icons in print view in Chrome and Safari

So, I’ve got a bunch of fontcustom icons I’m using on a website. Great project, makes it really easy to generate icons into a font that renders well on pretty much every device. Except when printing in Chrome and Safari. I had several icons sitting in table cells, and their height expanded to the height of the full printable page. Meaning, there was a single row per page, and a giant chunk of white space under the row. The icon was doing something to tell the print view to start a new page. Super strange.

Unfortunately, I didn’t figure out why the heck this was happening. However, I did figure out a workaround. This guy in your css stylesheet will apply changes only to the print view for Chrome and Safari:


@media print and (-webkit-min-device-pixel-ratio:0)

I created .gif versions of the icons I needed. Then, for these icons, I overwrite the :before pseudo-element to render the .gif I created instead of the font. I also needed to set the font-family to none. So, basically this (included within that @media element) (Also, this is SASS, but if you know CSS you can figure out what’s up):


.icon-skip{
  &:before{
    font-family: none;
    content: url('../images/icon-skip-print.gif');
  }
}

Watch out for form fields when doing a javascript-based find and replace in your DOM!

So let’s say you’re having a bomb night in, and get a sudden urge to build a Google Chrome extension. Let’s say that your extension involves finding and replacing text in the dom. So, you can cycle through all of the nodes in the dom, and grab anything with a nodeType of 3, which means it’s text. You get that bad boy working, get all of your buddies to install it. And then someone has to edit some content.

And, oops. The swapped copy is now live for all to see, regardless of having any extension installed, or even being on Chrome.

Soo, you can check┬ánode.parentNode.nodeName, and if it’s INPUT or TEXTAREA or a similarly potentially sneaky form element, I suggest skipping those when doing your find and replace!

Drupal menu_callback item using ajax callback renders full page

It’s pretty annoying when you only want a few variables, rendered nicely on screen with your tpl.php, and you end up getting the entire page when you do an ajax callback to that function. Apparently you need to print/echo whatever you want rendered on the page rather than return it (as you would for a normal menu item).

Which is how I ended up with infinitely nested page instances. Fun!

So like 12 years ago, I wrote a song about Java

I don’t know why I’m not asleep right now. I got distracted and was looking through old stuff, and apparently I wrote a song about Java a long time ago. So I’m gonna post it, because the internet is for po…sting songs about java.

I met it in a program due the week
before last, and it's future is looking quite bleak

oh the data
d-a-t-a data

I tried to do a ParseInt but it wouldnt work
When I typed "javac" the whole thing went berzerk

oh the data
d-a-t-a data

I've got 5000 methods and they all look the same
Nothing is working and I just want to maim

all my data
d-a-t-a data

my prog 5 is fickle, my brain calls defeat,
the 80x86 assembler aint lookin' 1337

poor poor data
d-a-t-a
da da da da data...

Well I've been staring at this class for hours
So I write crappy songs while my brain sprouts flowers
I'm pushing the limits crankin' out schloads of code
If I push any more my pancreas will explode!


Pick up the pen, write some "if" "then" "else" "while"
Try to make it come together as I stare at a pile
of my data
d-a-t-a data

so I took .stack
subtract from LOC
I find .stack length
And I'm getting sick of writing this so I'll stop...

Failing to load a large Drupal database locally on your Mac Mountain Lion system

OK, so technically this could apply to non-Drupal databases, but Drupal was my particular issue here. Had a new hard drive, trying to get all of my sites up, and was having a tough time with a several gig large Drupal database. When it’s pretty big, you’ve gotta load it into MySQL via the command line. And, I was getting this error:

MySQL server has gone away

And then I’d go check MySQL and it would would still be there and I’d be all like, “You is a liar!” to my error. Cause that’s real effective.

As it turned out, I just needed to go into /etc/my.cnf and crank max_allowed_packet up to 64MB. Database loaded fine after that.

On a related note, once I loaded in my Drupal site, it looked all janky, like there was no css. Just straight up clearing caches wasn’t doing it. Had to go into /admin/config/development/performance and turn off pretty much all of the cache options, and from there my theme finally took hold.