Blog

Druplified Netoteric Site Now Live

Posted on: 2008-07-15 15:18:22

As a side note, the new, druplified "Netoteric site is now live":http://netoteric.com/. The intention was to do a 1-to-1 conversion of the old site (which was just hand-coded... yes I know, tsk tsk). The result was almost a complete pixel-for-pixel duplication of the site. There were some changes made on the newer site: links removed, text changed... but other than that, it's almost a perfect replication.

Just in case you were wondering, "Netoteric":http://netoteric.com/ is a company I started in January 2007 that builds and hosts websites and software. Now you know... the rest of the story.

Continue reading...

Alternating Alignments On Full Node Views With Contemplate

Posted on: 2008-07-14 23:43:59

While converting my "Netoteric":http://netoteric.com/ site to "Drupal":http://drupal.org/, there was a small problem with the "portfolio":http://netoteric.com/portfolio page. The items in it alternate between left and right. Views Theme Wizard didn't work. It was time for more desperate measures.

I added a function in my custom template file, which created an index number and assigned it to a node member.

<code type="php">/**

  • Display the nodes of a view as plain nodes. */ function theme_views_view_nodes_portfolio($view, $nodes, $type, $teasers = false, $links = true) { $i=0; foreach ($nodes as $n) { $node = node_load($n->nid); $node->__views_index_number = $i++; $output .= node_view($node, $teasers, false, $links); } return $output; }

theme_views_view_nodes_portfolio overrides the "Views":http://drupal.org/project/views default theme function, but only for the portfolio view.

Then inside the contemplate body template I just added a modulo function to alternate between left and right:

<code type="php"><div class="thumbnail __views_index_number % 2 ? 'right':'left')?>">

And voila! Now the images alternate between left and right...

Continue reading...

Fixing a Quiet Volume Problem on the iPhone Speakerphone

Posted on: 2008-07-14 14:14:48

Yet another design flaw in the iPhone. The speakerphone worked great for a long time. Then one day, it got so quiet I couldn't use it anymore. I tried a volume hack when it was jail-broken but to no success. My problem wasn't a bad speaker, it was the iPhone equivalent of ear-wax.

While pocket lint is nothing more than a nuisance for you and me, to the iPhone, it's kryptonite. The phone has little holes on the bottom so sounds can go through. And you know what? Those little holes eat pocket lint for breakfast, lunch, and dinner.

!sites/nickvahalik.com/files/iphone_bottom.jpg! The little holes in question.

Only the holes on the left (if you are holding the phone during regular usage) are utilized when playing music or using the speakerphone. Take a peek down there. Do you see any white, gray, or anything in those holes? If yes, please read on. If not, then I can't help you. Move along.

Now, I have to warn you that if you do this too hard you can damage your phone and/or void your warranty. But, you probably don't care, do you? I didn't think so. So go grab your handy-dandy iPhone speaker-hole cleaner. Don't have one? Just use a bulletin board stick-pin.

!sites/nickvahalik.com/files/the_mighty_iphone_fixer.jpg! It's hard to see, but it's slightly bent at the end. Perfect!

Just gently fish it around in each hole. It should come out with a little time. Be patient. Push too hard and you could damage your speaker. That would suck. I blew a little in mine and a bunch of junk came out. A couple minutes later, the speakerphone was working great again. Hope this helps you!

Continue reading...

New Snail Mail SPAM Tactic: Seek & Destroy

Posted on: 2008-07-12 15:38:26

So in my weekly ritual of going through mail and shredding everything not of interest... my shredder choked pretty badly. Reverse. Forward. Still stuck. Pulled gently. Wouldn't budge. Pulled harder. Used two hands. Finally it came out. Turned shredder back on. Still stuck.

What the hell?

After 5 minutes, a screwdriver, and some needle-nose pliers, I finally found the culprit:

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

One of the auto dealerships had put a key in an envelope. My guess is that in an effort to stop the spamicide of their mailing, they tried to take my shredder out ninja style.

Luckily, my shredder-fu is much greater than their spam-fu. After removal, the shredder kept devouring without a hitch.

Continue reading...

Building a Website with Drupal: A Methodology

Posted on: 2008-07-06 12:51:34

"How do I build X with "Drupal":http://drupal.org?" I've received the question a few times... over the past few weeks as my friends and colleagues have been persuaded to give "Drupal":http://drupal.org? a shot.
But there is still one question that remains. Once you get past that initial step of getting your feet wet, you want more... and how do you get it? Here is a guide.

h3. Step 1: Ask yourself "What am I really trying to achieve?"

Don't limit yourself by what you know. Write down what you really want your site to do and have. Make a list, but keep it general -- don't write down any specifics. Drupal is extremely powerful and flexible, but unless you can write PHP, it's easy to forget that you've got to play by the rules and use what is already available in order to get the most out of it.

h3. Step 2: Find out the "Drupal" way of solving your problems

This is probably the toughest task you'll have in your endeavor. In this step, you'll take the list of wants from Step 1 and find a module (or combination of modules) to make your ideas work in Drupal. There are a couple of ways you can go about this. One might work for you, but it'll usually take combination to get your list taken care of.

Head over to "drupal.org Modules Page":http://drupal.org/project/Modules and start your search. Modules are arranged by category. If you create an account and login, you can filter by the version you are using.

Just search "Google":http://google.com for a rough idea of what you want. drupal.org is indexed very well and not only will it return module search results, but forum posts and handbook pages that might have exactly what you need.

Check out the "Drupal showcase":http://drupal.org/forum/25. There might be a site that has already done what you want and you can benefit from their experience.

Post in the forums. There are sections for "Post Installation":http://drupal.org/forum/22 and "Converting to Drupal":http://drupal.org/forum/37 where you can ask your questions, post scenarios. Be nice, though.

Some modules that can really solve a whole blanket of problems easily are:

"CCK (Content Creation Kit)":http://drupal.org/project/cck - The Content Construction Kit allows you create and customize fields using a web browser. Custom content types can be created in core, and CCK allows you to add custom fields to any content type.

"Views":http://drupal.org/project/views - The views module provides a flexible method for Drupal site designers to control how lists of content (nodes) are presented. Traditionally, Drupal has hard-coded most of this, particularly in how taxonomy and tracker lists are formatted.

"Content Templates (Contemplate)":http://drupal.org/project/contemplate - This module was written to solve a need with the Content Construction Kit (CCK), where it had a tendency toward outputting content in a not-very-pretty way. And as such, it dovetails nicely with CCK, adding a "template" tab to CCK content-type editing pages and pre-populating the templates with CCK's default layout. This makes it easy to rearrange fields, output different fields for teaser and body, remove the field title headers, etc.

h3. Step 3: Have fun and play around

Install your modules, give it all a shot, and be patient. Drupal has a learning curve, but it's well worth it if you play around with it and try not to rush. It's tough to approach it with that frame of mind if you've got a site you "just want built" and don't have the time (or the patience) to sit down and play around with it. There is a wealth of resources out of there on the intertubes. You just have to look for it.

There is a lot that can be achieved with what is out there now. It's all about finding the right modules and implementing them correctly. You can build some pretty interesting sites without even touching a single line of PHP.

h3. Step 4: Write a module

If you just can't find the solution to a particular problem (or, more likely, the exact implementation of a solution, you'll need a module. Modules in drupal are tough to start off. The "API for drupal":http://api.drupal.org is pretty big. There may already be a "hook that does what you need":http://api.drupal.org/api/group/hooks/5.

At any rate, there are some problems that can only be solved with a module. Also, there are some problems that can only be solved by patching drupal core. I don't recommend the latter, because it can create problems down the road with upgrading. In general, you may want to explore a trade-off or look at another way to solve the problem if it involves making a change to the drupal core.

Drupal core, by the way, is anything that comes with a default installation of a downloaded drupal source tarball. "There are reasons why certain things aren't in core":http://api.drupal.org/api/group/hooks/5. Keep this in mind.

Writing about module development tactics could take up another post, so we'll just leave Step 4 where it is.

I hope you found this post useful.

Continue reading...

Peace and Quiet... or not.

Posted on: 2008-06-17 09:46:03

I've been quiet for the past week or so... mainly because if I haven't been really busy then I've been asleep or just being a bum. I ended up getting a new Plasma TV for my birthday (as well as a Blu-Ray player and some movies) so the majority of my bum-time has been spent gawking at 42" of pure technological beauty.

I was really surprised to find that (unlike other TV of similar size) I could play Guitar Hero 3 without calibrating for lag. In fact, the only calibration I ended up making was a 4ms audio lag. Not bad considering some of the previous adjustments I had made with other TVs or projectors.

Setting it all up was super-easy and I've even gotten my remote reprogrammed for it. Yay Logitech Harmony. Now it's just a matter of time before the HDMI cables come in and all of the component cables can be put into storage. Call me silly, but I was unaware that HDMI also carried audio until hooking all this stuff up. The whole setup is much cleaner and getting rid of the top of the entertainment center has really opened up the living room.

Lately my place has started feeling much more like home. I hung up curtains, really cleaned, moved a bunch of stuff around, and thrown away stuff that I had been holding onto. It's been my way of being productive during this period where I really don't feel like doing anything web-oriented. I'm sure it's just a phase, though.

Continue reading...

Download Adium X 1.3b2

Posted on: 2008-06-10 13:41:17

Saw "this article on Ars Technica":http://arstechnica.com/journals/apple.ars/2008/06/10/adium-1-3-beta-brings-new-contact-organization-performance earlier, and had to try it out. Latest beta of Adium has a Facebook module. Sure enough, it works like a charm. I can see and chat to everyone just as if they had IM, all from the comfort of Adium.

!sites/nickvahalik.com/files/facebook_contact_list.png!

"Go download the Adium Beta":http://beta.adiumx.com/

UPDATE: It appears that by using this module, it continuously logs you out of your browser session. Trying to browse the Facebook site while logged into the IM client through Adium was a painful experience. Just FYI.

Continue reading...

For all your Bruce Schneier Facts

Posted on: 2008-06-09 09:42:32

"!sites/nickvahalik.com/files/bruce-schneier-1.jpg!":http://geekz.co.uk/schneierfacts

"Bruce Schneier Facts":http://geekz.co.uk/schneierfacts

My favorite... "Bruce Schneier's secure handshake is so strong, you won't be able to exchange keys with anyone else for days.":http://geekz.co.uk/schneierfacts/fact/26

Continue reading...

How I Cut My Server's Load Average In (More Than) Half

Posted on: 2008-05-27 22:08:47

I try to monitor my hosting server pretty closely. It's rare that a days goes by when I haven't checked logs and monitored process and memory usage. For the most part nothing big happens. It just makes me feel important. But over the past few months the load average appeared to be above normal.

After attending a session on "APC":http://pecl.php.net/package/APC at "php|tek":http://tek.phparch.com/, I installed it on my primary hosting box.

For the past few months, I'd ssh in and see something like this:

nick@hosting$ w
22:41:12  up 135 days, 13:33,  1 user,  load average: 0.78, 0.91, 1.18
...

Today, it looks something like this:

nick@hosting$ w
21:45:40  up 35 days, 23:33,  1 user,  load average: 0.18, 0.18, 0.21
...

I must say... quite an improvement!

So this brings up a question... if it can improve performance this dramatically, how well would it do if say... the Drupal caching mechanism were rewritten to use this as a cache? It uses SQL, so taking out a bunch of SQL queries per page load might dramatically improve it's performance on single-server setups.

Actually, a bit of searching reveals that "someone else has already thought of this":http://drupal.org/project/apc. One user says that his app was able to "handle 50% more traffic after using this new cache.inc file":http://drupal.org/node/224213. Interesting. Wonder why this hasn't been push into core yet? Would it be too hard to detect APC and use one set or the other?

Continue reading...

Drag and Drop File Uploads in Adobe AIR

Posted on: 2008-05-26 14:25:37

After doing quite a bit of research and testing, it seems as though drag-and-drop file uploads in AIR can't have progress monitors. If I'm wrong, I'd really like to hear about it. Drop me a line... nick @ <this domain>

Looking through the Flash Documentation, it would appear that the Progress event for file uploads only fires from the FileReference object. You can't instantiate this object from inside Javascript. It appears to work if you use the select dialog box... <code type="javascript">file = air.file.desktopDirectory file.addEventListener( air.ProgressEvent.PROGRESS, function() { air.trace('this will fire') }); file.browseForOpen( 'Select File' );

and then upload the file, but doing something like this will never fire the event:

<code language="javascript">// inside drop event handler myfile = new air.File() myfile.url = event.dataTransfer.getData("text/uri-list") ur = new air.URLRequest('http://127.0.0.1/~nvahalik/upload_test.php') ur.method = 'POST' myfile.addEventListener(air.ProgressEvent.PROGRESS, function (event){ air.trace('upload in progress') });

This isn't a show-stopper for this particular project, but knowing my audience, they are going to want to know what the status of the upload is.

It does strike me as rather strange that you can't monitor those kinds of uploads. Maybe it's coming soon? I hope.

Continue reading...