Blog

Getting a java.io.CharConversionException with pdftk while using MAMP?

Posted on: 2010-02-05 10:08:10

Man, talk about a frustrating problem! I kept getting this errors while calling pdftk (from the mac installer, which the version as of this writing is 1.12):

Unhandled Java Exception: java.io.CharConversionException <>

Anyway, after much hair pulling, the answer was found! Before calling "shell_exec":http://php.net/shell_exec (or whatever function you use to call pdftk) you need to unset the DYLD_LIBRARY_PATH environment variable.

<code lang="php"># unset this so pdftk will work! putenv('DYLD_LIBRARY_PATH');

put the output in a variable

$pdf_data = shell_exec('/usr/local/bin/pdftk '. $file_name .' fill_form '. $fdf_fn. ' output - flatten');

Continue reading...

Attaway, Outrage, and Prediction for Week 1, 2010

Posted on: 2010-01-08 08:42:56

I listen to "AFR Talk":http://action.afa.net/Radio/ in the morning on the way to work... specifically the "Matt Friedeman Show":http://inthefight.wbs.edu/, and every Friday morning they do "Attaway awards, outrages of the week, and a prediction for the days to come."

Since my commute is only roughly about 7-10 minutes, I figured that I'd start documenting it here instead of trying to call in... so here we go!

h3. Attaway Award

Gotta go to "Brit Hume":http://en.wikipedia.org/wiki/Brit_Hume when on the Fox News Network, told everyone watching that

bq. The extent to which he can recover seems to me depends on his faith, he’s said to be a Buddhist, I don’t think that faith offers the kind of forgiveness and redemption that is offered by the Christian faith, so.. my message to Tiger would be, “Tiger, turn your faith–turn to the Christian faith, and you can make a total recovery and be a GREAT example to the world.”

<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/szVYlDSb7nM&hl=en_US&fs=1&"><param name="allowFullScreen" value="true"><param name="allowscriptaccess" value="always"><embed src="http://www.youtube.com/v/szVYlDSb7nM&hl=en_US&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344">

There have been a whole slew of people beating him up over it. A "Haredi community was asked to speak out against his comments":http://content.usatoday.com/communities/Religion/post/2010/01/jerusalem-spitting-brit-hume-christianity-evangelism-/1. People are "calling him intolerant":http://www.washingtonpost.com/wp-dyn/content/article/2010/01/07/AR2010010703244.html and are "asking him to apologize":http://www.azcentral.com/arizonarepublic/opinions/articles/2010/01/08/20100108frilets087.html and "take a class in religions."

Brit Hume explains himself more in a "Q&A Article in Christianity Today":http://www.christianitytoday.com/ct/2010/januaryweb-only/11-42.0.html. The fact that he is getting lashed at by other proves that God is at work here. If we all were so lucky!

h3. Outrage

During his presidential campaign, "Obama promised to put the Healthcare negotiations on C-SPAN":http://www.cbsnews.com/stories/2010/01/06/eveningnews/main6064298.shtml. Now he wants them to be secret. Downright shameful.

h3. Prediction

It's going to be a "cold weekend":http://www.wunderground.com/cgi-bin/findweather/getForecast?query=76502. Also, the "cold weather will cause big media to forget about Global Warming":http://noteviljustwrong.com/blog/general/317 for a little while, until it's time to push their agenda again.

I would encourage you to post your attaway, outrage, and prediction each week and share them with us.

Continue reading...

My First (contributed) Drupal Module: Permission Report

Posted on: 2009-12-29 16:17:12

Very proud to announce my first contributed drupal module! "Permission Report":http://drupal.org/project/usage/permission_report:

bq. Permission Report calculates and displays permissions a user has and shows which roles grant those permissions. It also provides ability to list users in a role, look at role membership information, view which users have a particular permission, and dig down into complicated role and permission problems.

Hope that this is the first of many contributions to come!

Continue reading...

From Mindless to Mindful

Posted on: 2009-12-23 16:06:24

Looking at the internet though the eyes of a web designer while browsing the web is a lot sitting at a high school lunch table with a bunch of the "preppy girls":http://www.urbandictionary.com/define.php?term=preppy%20girls. You judge everything. It's instinctual. You know all the latest tools, lingo, and trends. Everything gets evaluated by how it appears. Sure, finding that a site runs on a certain language/platform/cms/framework or uses a certain library/flash component/technology can be interesting when it doesn't meet your expectations, but let's face it: Everything gets judged by how it looks and performs to our standards.

And those are pretty high.

Every time I visit any website, whether it's big or small, low- or big-budget, corporate or homegrown, it goes through a rigorous set of evaluations that happen in the background while I'm purchasing, researching, or just plain looking around. I do this because as a web guy myself, I tend to be "mindful":http://www.merriam-webster.com/dictionary/Mindful or "aware" of all of these things going on behind the scenes.

Awareness of what is going on around you is always a good thing. It's required by people on a daily basis. We are all called to be mindful on a daily basis. We get paid to be mindful when we notice a mistake that needs to be corrected before getting published online or in print. We get rewarded for being mindful when we send our wives flowers on anniversaries (or for no occasion at all!). We feel a little bit safer when we see a police officer walking around being mindful of the environment and looking out for danger.

With all of this reward and need for being so mindful all of the time, why is it that we have become such a mindless society?

It seems like hardly a few hours go by where someone, somewhere has to make reference some sort of "jingle":http://en.wikipedia.org/wiki/Jingle, "slogan":http://en.wikipedia.org/wiki/List_of_political_slogans or some other such bite-sized talking point used to sell or influence someone or something into changing their behavior. Sure, the change might be to get someone to go to Jack in the Box instead of Wendy's. It still achieves it's purpose. We mindlessly receive, consume, and slowly change our behavior.

This isn't a bad thing, though, right? I mean, chances are you were going to go out to eat somewhere why not make one place instead of the other. Chances are unless you've built up some unnatural amount of distrust or distaste for someone or something, you'll probably be swayed to try it at some point.

Take me and McDonalds for instance. I despise McDonalds. I dislike them so much I won't even take my wife or step-daughter there. The closest I get to one is the Red box outside when the one down the street doesn't work. Their advertising is horrible and cheesy. I'm "not the only one that feels this way":http://www.thebestpageintheuniverse.net/c.cgi?u=lovin_it, either. Their "McLatte" radio ads turned the fire against them so bad, I smell ashes every time I drive by.

But I've been down this road before and I'll be down it again. Probably within the next year or so, I'll have one of those days where I suddenly become stupid and say to myself, "Maybe I'm wrong about McDonalds. Maybe their 'McLattes' are actually worth checking out and perhaps having a McRib and fries wouldn't cause me to get sick." And so I'll go to McDonalds, have my 10 minutes of omnomnomnom and then i'll take another 3 to 5 year trip to regretsville via the experience express. All because of those stupid, incessant, carefully placed, disturbingly bad yet catchy jingles that bombard me whenever I happen to leave the radio, TV, or stray browser window on.

Why can't I be mindful about those things as I am with other websites? Why can't I approach conversations with the same well-thought out and emotionally balanced arguments I generally have with people I trust? Why can't I filter out crappy advertisements for food I know I'll regret eating later on? Why is it that I find myself singing songs in my head that are inappropriate/stupid/or otherwise meaningless? Why do I see others doing the same thing? Why does it feel like I don't have any control over this?

Why am I not mindful on a weekly/daily/hourly basis of the fact that Christ died for my sins, the sins of my brothers/sisters, and for all humanity? Why can't I see that everyone is just like me: lost without Him? Why can't I look at problems and ask the right questions? Why do I look to myself for answers instead of to the Truth? Why do I not always seek Light when I see darkness approaching? Why do I not yearn for the Word as if it were my only sustaining source?

Why do I always seem to treat Jesus like the friend I call when I've tried everyone else and nobody has answered?

These questions keep me up at night. I take some comfort in that seeking him is better than not seeking him at all. I know that Prayer should be my first line of defense, not my last bastion of hope.

So here it is: I want to be a mindful person. Not just when I'm browsing websites. Mindful all the time. Mindful of my thoughts, words, actions, emotions, and what is going on around me. Mindful of what the God who saved me might have me do for Him or on His behalf while I'm here to put Him first and myself second that He might be glorified.

I want my mindless life to be transformed into a mindful life. Aware. Awake. Not asleep.

What do you want your life to be?

Continue reading...

A Curious Anomaly in AMD vs. Intel

Posted on: 2009-11-16 14:19:07

At a recent get-together, a bunch of IT people were asked about their preference in processor technology. Not surprisingly, Intel was the most preferred and AMD was all but left in the low-end bargain bin.

This observation is not new by any means, and I personally subscribe to this way of thinking. What strikes me as interesting though, was this recently "ZDNet article about the Cray XT5 Jaguar":http://blogs.zdnet.com/gadgetreviews/?p=9469&tag=nl.e589:

bq. Irrelevant factoid that may only interest me: Four of the top five systems are based on AMD tech, while 402 of the top 500 are powered by Intel.

I'm not sure of the author's numbers, but here is what "the November top500.org list":http://www.top500.org/list/2009/11/100 has. In the US AMD has 4 of the top 10. PowerPC has 3. Intel has 2. PowerXCell (IBM) has 1.

Why is it that the IT masses think that AMD processors are low-end value processors but yet they power 4 out of the top 10 supercomputers in the US?

Continue reading...

Avoid Using The Drupal \"path\" Module To Create Clean Paths In Your Module

Posted on: 2009-11-05 11:35:09

I've been doing a lot of cleanup of certain modules at the office. Two in particular are heavily used apps that incorporate pre-made default views with screens to add nodes or do information lookups.

Part of the problem with this is that although I had a decent URL structure (many paths were aliased), my breadcrumbs were never right. I usually had to override them to make them work the way I wanted to (Drupal 5 on my end):

drupal_set_breadcrumb(array(...))

This is a hack! "path.module":http://api.drupal.org/api/drupal/modules--path--path.module/5 is great for aliasing content paths. But stay away from it for stuff in your module.

Drupal's "drupal_get_breadcrumb":http://api.drupal.org/api/function/drupal_get_breadcrumb/5 actually calls "menu_get_active_breadcrumb":http://api.drupal.org/api/function/menu_get_active_breadcrumb/5 to figure out what to put in the breadcrumb list. Essentially, this function goes through the url, and looks at each element, gets the title of them if they have the "MENU_VISIBLE_IN_BREADCRUMB":http://api.drupal.org/api/constant/MENU_VISIBLE_IN_BREADCRUMB/5 flag on them. Both "MENU_NORMAL_ITEM":http://api.drupal.org/api/constant/MENU_NORMAL_ITEM/5 and "MENU_ITEM_GROUPING":http://api.drupal.org/api/constant/MENU_ITEM_GROUPING/5 have that flag by default.

Basically, if you write your "menu hook":http://api.drupal.org/api/function/hook_menu/5 properly, your breadcrumbs will automatically populate for you without any extra work.

The key here is putting this in your menu hook. If you use path.module's "path_set_alias":http://api.drupal.org/api/function/path_set_alias/5 or you add it manually via the interface, it won't work! The reason is due to the fact that this is an alias. If you do this, "menu_get_active_breadcrumb":http://api.drupal.org/api/function/menu_get_active_breadcrumb/5 will see the "true" path and not the "aliased" path.

For example: Let's say you have a node form that you want to put inside your path somewhere. If you do:

path_set_alias('node/add/claim','agents/claims/create')

Your breadcrumb for "agents/claims/create" will show the breadcrumb you will see on "node/add/claim." (probably just "Home")

However, if you do this:

$items[] = array( 'path' => 'agents/claims/create', 'type' => 'callback', 'callback' => 'node_add', 'callback arguments' => array('claim') );

Your breadcrumb will display something along of:

Home » Agents » Claims

Which is exactly what you want!

There is always a way to make the menu do what you want it to do. This includes using "node_add":http://api.drupal.org/api/function/node_add/5 to put node creation forms where you want them or using "views_view_page":http://drupalcontrib.org/api/function/views_view_page/5 for displaying views. It will make your breadcrumbs work right and make your code cleaner since you won't be putting urls and menu information in your "default views hook":http://drupal.org/node/99568!

Continue reading...

A Homemade LCD Picture Frame From Laptop Parts, Part 1: Treasure Hunting & Research

Posted on: 2009-09-14 09:15:27

My wife had an old Toshiba A75-S213 that had some sort of "a battery/charging malfunction":http://www.hardwareanalysis.com/content/topic/38964/. The system was basically unusable. I ended up taking out the ram, the HDD, and the CD-RW drive for us in other machines.

Her screen was in very good condition (the whole machine was) so since I've had the builders urge lately, I decide to see what I could do to take the 15.4" LCD and actually convert it into a widescreen photo frame. This post (and probably the next several posts) will document my efforts.

To start off, we'll begin with some background at why this project might not be very easy and the processes used to figure out how we're going to attempt to get this done.

Desktop machines have (mainly) 2 primary interfaces for connecting displays: "VGA":http://en.wikipedia.org/wiki/VGA, and "DVI":http://en.wikipedia.org/wiki/Digital_Visual_Interface. These two interfaces are high-bandwidth and high-powered. They have plenty of room for things like shielding and whatnot. They also use a specific type of signaling to communication with their devices.

Laptops on the other hand, don't have room for that. Space is at a premium. They use something called "Low-voltage differential signaling(LVDS)":http://en.wikipedia.org/wiki/Low-voltage_differential_signaling over a 30-pin connector. This signaling system is much faster, but smaller and requires much less power-consumption. It seems as if there are 2 "standard" LVDS LCD connectors, a 30-pin and a 40-pin, but I've mostly seen 30-pin in my research. Here are some pictures showing the LVDS connector as well as gives you some idea of the size!

Bottom of the LVDS 30-pin connector: !sites/nickvahalik.com/files/lvds_bottom.png!

Size: roughly half the size of a VGA cable, but 2x as many possible pins. !sites/nickvahalik.com/files/lvds_size.jpg!

Side of LVDS: !sites/nickvahalik.com/files/lvds_side.jpg!

The gist of the two paragraphs above is that LCDs from laptops do not have the same connectors that your nice 24" widescreen monitor at home has. Not even close. Also worth noting is how power gets to these devices. All screens have a separate power supply for their bulb. In this case, the bottom of the monitor included a small (and very long) power inverter:

!sites/nickvahalik.com/files/cf_inverter.jpg!

Where my thumbs are is a 2-pin power output that plugs directly into the bulb. The other side has a power input. It's 7-pin, and also very small:

!sites/nickvahalik.com/files/inverter_power_side.jpg!

Now, this particular module used a set of reserved pins on LVDS connector to actually get it's power for the inverter. (I'm not entirely sure which pins just yet by number, but they are the "middle ones"). This is not going to be the case all of the time and so far doesn't seem to be the case at all when matching up motherboards to these monitors.

Okay, so first off, start by getting all of the part-numbers you can off of everything you are taking out of the laptop. For instance:

  • Laptop Model Number: (bottom of machine) Toshiba A75-S213
  • LCD Model Number (and revisions, if appl.): LP154W01 (TLA2)
  • LCD Manufacturer: LG/Philips

!sites/nickvahalik.com/files/model_and_revision.jpg!

Continue reading...

It Amazes Me That AT&T Stays in Business

Posted on: 2009-09-10 08:57:43
  • I can never get someone to call me back. They only respond if I happen to get them on the phone or I start sending e-mails.
  • With our account rep, there is always an excuse: "I was out of the office, family emergency" or "I was away from my desk" or "our unicorn was have babies."
  • The tone of our account reps voice doesn't seem to be "I'm glad you got me on the phone because you're going to spend more money with me" but rather "I don't want to talk to you right now so let me get this done so I can get off the phone"
  • The answers to my questions aren't correct. Maybe it's just my rep, but she likes to answer questions she thinks I'm asking, and not what I really asked.
  • Have you ever had them do something right the first time? Me neither.
  • "Working to":http://libcom.org/organise/work-to-rule "the rule":http://en.wikipedia.org/wiki/Work-to-rule.
  • It's all fun and games until it's 7:30 pm on a friday, and you've got 7 people on a conference call trying to figure out a single problem.
  • It's no wonder they are unionized. If they didn't have them, most of them would be out of a job because they are useless!
  • They want you to pay for mistakes because you "signed off" on a change order that had the mistake on it.
  • Have you ever seen their change orders? I'd rather try to order chinese food from a hieroglyphic menu written in egyptebonics!
  • Voicemails go nowhere. I end up calling back every 30 minutes in order to talk to someone.
  • Know why AT&T gives you an account team? Because 2 out of those 3 people will never answer!
  • After looking at how we were serviced, I'm starting to wonder if the NSA warrantless wiretapping stuff even worked!
Continue reading...

Things AppleScripts

Posted on: 2009-08-25 09:32:56

Just thought I'd throw these out here. They are a couple of AppleScripts that have helped me manage what I have going on in Things.

"Followup Tomorrow":http://nickvahalik.com/sites/nickvahalik.com/files/Followup%20Tomorrow.scpt

This script closes the task for today, creates a new one for tomorrow and adds the label "follow-up." This gives me a warm fuzzy that I got something accomplished for the day but that there is something else tomorrow that needs to be followed-up on. It doesn't copy notes, just the title.

"Followup Next Business Day":http://nickvahalik.com/sites/nickvahalik.com/files/Followup%20Next%20Business%20Day.scpt

This script functions the same was as the one above, but if you execute it on a friday, it will schedule it for Monday.

Just throw these guys in ~/Library/Scripts/Applications/Things and you're set! To use them, click on a task and then select them from the Scripts menu in the top-right corner of the screen (or assign them a hot-key).

Anyway, hope this helps someone!

Continue reading...

SmartSleep Can Kill Your Battery Life

Posted on: 2009-07-07 14:17:25

I usually switch my system to "Better Energy Savings" while on battery. It kept switching back to "Custom." I ended up tracking the problem down to a program called "SmartSleep":http://www.jinx.de/SmartSleep.html. It appears that it was changing my settings to Custom about every 30 seconds or so:

de.jinx.SmartSleepDaemon[54] SmartSleepDaemon: setting hibernation state to: 0

If you are wanting to get the best out of your battery life while not connected to a power source, you might want to disable "SmartSleep":http://www.jinx.de/SmartSleep.html. It consistently shaved 30 minutes off of my runtime when it was set to "smart sleep."

Continue reading...