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):


This is a hack! "path.module": is great for aliasing content paths. But stay away from it for stuff in your module.

Drupal's "drupal_get_breadcrumb": actually calls "menu_get_active_breadcrumb": 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": flag on them. Both "MENU_NORMAL_ITEM": and "MENU_ITEM_GROUPING": have that flag by default.

Basically, if you write your "menu hook": 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": 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": 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:


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": to put node creation forms where you want them or using "views_view_page": 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":!

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": 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":, and "DVI": 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)": 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/!

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

Side of LVDS: !sites/!

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:


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:


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


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": "the 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":

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":

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": 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": It consistently shaved 30 minutes off of my runtime when it was set to "smart sleep."

Continue reading...

I Am Neither Ignorant Nor Intolerant

Posted on: 2009-06-03 23:14:10

After moving out of Waco, I truly feel that a veil has been lifted from my eyes. As if, suddenly I am able to reason and think clearly. There are many benefits to this, however it has pretty much made me an outsider politically and socially as far as my views and beliefs are concerned. Some are open to this idea, and I am appreciative to this. Some however, are pretty much convinced that my views and beliefs make me both "ignorant" and "intolerant."

And to those that think that I am both ignorant and intolerant, I will present the evidence that you are the ignorant, intolerant one.

Firstly, I have the right to speak my mind about whatever I want. Yes, I think Obama was the worst possibly choice for president. Yes, I think abortion is wrong. Indeed, the bible tells us that homosexuality is a sin and is wrong. Now, these are my views, and it just so happens that these views are not only shared with me by my wife, the members of our church and many of our friends. You might consider it intolerant, that I oppose "women's rights" or homosexuality. Friend, the moment you disrespect my right to express myself, you yourself are showing intolerance.

I was listening to a radio show a few days ago and they were talking about how the word "discriminate" used to have a positive connotation. A person with "discriminating tastes" only like the best. It was a good thing to be labeled discriminating in certain respects.

But now, the world is crazy, and a group of people who are already have equal protection under the law want something that I don't think they deserve: the right to call their union a "marriage." If I am ignorant and intolerant, then so were the millions and millions of people who came before me who thought the same way. You see it as intolerance, but I say it's calling it what it really is. Homosexual relationships can never be fully equal to a real marriage. It's physiologically and spiritually impossible. And if you think can read all of the material that has brought us this far and conclude that something in there says otherwise... then you probably need to really re-evaluate your reading and/or comprehension abilities.

Another thing: I know several gay couples, not many on a very personal basis, but I've worked with a few over the years. I don't think they are bad people. I've never hated gays, or talked down to them or even treated them any differently than I did and I attempt to be respectful and polite. Do I approve of their relationship? No. I still think it's wrong, but there is a difference between these people and the people I read about in the newspaper.

None of these people make a big deal about it. It is not the defining factor of their lives. I do have a problem with people who make it their goal to impress on others a lifestyle which for the past, you know, 5000 years, has been looked at as physically unhealthy, spiritually sinful, and socially disgraceful. They want it to be actively accepted like "regular" people and you know what? I won't stand for it.

If you want to live your life quietly and don't want to involve me or flaunt your "pride" up and down the street, that is fine, and I can respect that. So what is it? Am I intolerant? Tolerant? Confused, mistaken, or maybe just fed up? How about ignorant? Am I missing something here? I'm all ears. You can e-mail me, call me, or reply here.

P.S. Obama, you've officially ruined June.

Continue reading...

What We Are Supposed To Know About Abortion

Posted on: 2009-04-04 12:16:42

I had a conversation with a friend last night and during this conversation, they said that they didn't want to argue about abortion because "no one knows! is it murder? is it not?"

There are some people that don't know the answer to that question. But some people, especially Christians should know the answer to that question.

bq. "I do. I understand that nowhere in the bible does it dictate that it is a baby at conception"

I have to admit when I heard this, I was absolutely shocked. I wonder if this person has read their bible lately. The bible indicates that we are created by God, for God. Each and every one of us.

What matters here is the understanding that God creates life. All life is precious. If you call yourself a Christian and think that a "fetus" is not life, then you need to seriously revisit your beliefs.

Maybe this will jog your memory:

Jeremiah 1:5 says "Before I formed you in the womb I knew you, before you were born I set you apart;..." (he is, of course, speaking to Jeremiah, but these apply to us also.)

David writes in Psalm 139:13 "For you created my inmost being; you knit me together in my mother's womb."

"Did not He who made me in the womb make him, And the same one fashion us in the womb? (Job 31:15) It's very apparent. Job understands this. Why don't you?

Continue reading...

Diving Into God's Word: Rebuilding my Foundation Part 2

Posted on: 2009-02-08 09:09:32

I have a big problem reading God's Word every day. My boss gave me daily-read bible that you through everything chronologically. It's great and I really look forward to reading it. But i'm behind a couple of days now, but I'll catch up this afternoon. Sunday afternoons are always my catch-up days. (Right now it's going through Leviticus and Numbers, which, imo(In My Opinion) are semi-boring because they are very repetitious.)

I had a conversation with myself a couple days ago. It went something like this:

"Why didn't I read the Bible today?" "Because I was busy." "Yes, but watched 5 youtube videos and looked at lolcats for almost 10 minutes during lunch." "Well, yeah, that was taking a break." "God's Word = best break evar." "I didn't have my bible handy." "Perhaps you've used <a href="">BibleGateway or <a href="">Youversion?" "Yeah, but what am I supposed to read?" "<a href="">This." "Yeah, but I'm not always at my computer..." "<a href="">Ownt."

Unless you are phone-less, computer-less, and bible-less, there really isn't a reason to not dive in, even for a little bit, every day. We need it to survive. Our spiritual food. I'll skip the cheesy analogies that our Pastor gave us a few weeks ago and skip straight to the meat. Living a Christian life in this world takes so much. I can't tell you how many times I can feel anger in my heart or how many times I almost (or do) speak harsh words to someone. No matter how much I try to cover up that those words were rooted in truth, you would never tell because they were shaped and brought forth by anger and not love.

"The Word of God is a seed": A little bit of it gets put in us when we our saved, but it is our duty to make sure it is cared for so that it "grows and produces fruit": We are expected to be grow and do something with what God gives us. "The Parable of the talents Matthew 25:15-30": gives us a really clear picture of the expectations that God puts on us. It's a lot of work, really. But it's all worth it.

After all, we get God's protection with his Word in us. Ephesians 6:17 says "Take the helmet of salvation and the sword of the Spirit, which is the word of God.": His Word is also our protection. Like I said in my last post, being able to lean back on the sturdiest foundation of all has been my best defense against the one who would rather not see me thrive in Christ.

There are so many ways to get into the Word. "BibleGateway": was my favorite for quite some time, but "YouVersion": seems to have a much more interesting interface and is really made for people like me (web-enabled, bloggers, etc). I go back and forth between the two. If you know of any other good ones, please e-mail me or add a comment.

Continue reading...

Coming To Grips With My Fears: Rebuilding My Foundation

Posted on: 2009-02-02 22:26:42

There is a lot going on in my life right now. You might be able to tell that from my previous post. I'm going to try my hat at some different writing for the time being. There is quite a bit of adjusting going on from myself, my family and Sarah's family. It's all going really well (I think). During this adjustment I feel like I've really been able to open up and be really honest with myself and with others. It's tough for me to be open about what I'm thinking about because of how I think and the processes that go through my head.

I've had a chronic problem since the 7th grade with two specific problems: "autophobia": (fear of being alone and something that some "people on the internet have dubbed": "rapturephobia" (fear of the apocalypse).

Anyone who knew me in high school and early in my college years might have easily guessed that I really didn't like being alone. I got really antsy and acted very immature whenever I was alone. I spent a lot of time in front of the computer and it seemed to help assuage the pangs of anxiety. I constantly had to have something in front of me to distract me from the reality of being alone whenever I was. Luckily I had some good friends and roommates and that was never a problem and, for the most part, never really adversely affected me in deep painful ways. It was usually what followed in those times when my thoughts would creep down a path that I dare not tread.

Fear is a powerful force. It can spread the fastest of any sickness and cripple armies, "spreading from one person to another": It can cause you to act rashly and "trip over yourself":, even when there is nothing to truly be afraid of. Lord knows that I've done my fair share of tripping, running and being overly fearful for things that, as a Christian, should not even have a place in my life. I guess that is why they call them "phobias":, though. There is that irrational characteristic that gives that edge any other common fear.

I can't tell you why I fear the end of the world. I just know that when the fear grips me, it holds me tight and fiercely. The fear itself might not be the biggest issue. For me, it's always been my reaction to the fear: running away, hiding, or just plain panic. It cuts me off from the world. It destroys the peace in my heart. As a man in battle, if my training was completed, my weapon issued, and my life and my freedom were at stake my reaction would be to fight. The fear of engaging in combat and possibly losing my life would be swallowed up by what I've been trained to do to protect myself and defeat the enemy. And in my heart, I believe that I have a fight inside me that would not be easily conquered.

What is at stake here is not my physical life and freedom, but my mental and spiritual well being. I have no reason to fear. I never had one. There is no reason to fear anything that is coming because in Christ we have a promise:

bq. John 3:16 says "For God so loved the world that he gave his one and only Son, that whoever believes in him shall not perish but have eternal life." (NIV)

This script is quoted so often, I think, because it sums it all up (John had a way with words and putting things in such a way that made it that way.) The message is plain, overt, and unmistakably clear: we have nothing to fear if we trust in Jesus Christ. This is my foundation, my training, and my song. Now, when I feel the sword of fear coming down upon me, my weapon will be ready and I will fear no more. I will stand fast in the promise that has been made by the only one who is capable of making it.

Continue reading...

The Sound of Crickets

Posted on: 2009-01-28 15:01:16

Been really quiet since Do It With Drupal. Life has taken a few exciting turns the past few months. I got engaged to my Fiancé, Sarah! I've completely moved out of my old place and into the new house. There is still quite a bit of work to be done on the Condo, but it is moving along (albeit at a snail's pace). My weekends are pretty much spent between that, Church, and just hanging out with Sarah and friends.

I've started going to GymX down the road to shed some unwanted poundage as a new year's resolution. So far, so good. I've lost about 8 pounds or so. Sarah got me a grill for Christmas and man, have I been using it! Chicken, fish, steaks, potatoes, corn, scallops, squash, you name it! It's taken some getting used to... but it's been tasty and healthy.

I haven't really spent much time working on my side-gig. Partially because it's really calmed down and partially because my role at RVOS has taken over. There is a lot of exciting stuff going on and some new opportunities that will be making themselves available really soon.

Originally, the idea of moving here to Temple seemed really dull and death by boredom seemed like a possible outcome. I haven't really felt any of that. The fact that I can go home and watch some TV, fire up the grill and have dinner is very soothing. The ability to wake up at 7, make breakfast (a real one) and get read and leave 10 minutes before work (and be early!) is great. One of the best decisions I have ever made.

As things settle down more over the next few weeks/months... I will hopefully get some time to start working on my Drupal contrib plans again. Until then!

Continue reading...