RSS
 

Archive for the ‘How-To’ Category

WORDPRESS HOW-TO: Ignore/Hide A Category On Your Home Page

28 Feb

Sometimes you don’t want a particular category to appear on your WordPress home page.  For me, I create weekly Twitter digests, and I’d rather they not be part of the page welcome.

The process of hiding them actually took me a little bit to figure out, so I thought I’d share.  It’s rather simple, so don’t blink!  :)

Simply edit “index.php” in the wp-content/themes/<your_theme_here>/ directory.

Between the lines:

<?php if (have_posts()) : ?>

and

<?php while (have_posts()) : the post(); ?>

Insert the line:

<?php if (is_home()) { query_posts("cat=-XXX"); } ?>

Be sure to replace “XXX” with the unique numeric ID of the category you want to ignore.  To find the ID, log into your admin, navigate to your categories, and select the one you want to ignore.  The number will then appear in the URL.

NOTE: Make sure you don’t delete the “-” before the “XXX” or else you will ONLY show entries from the category.

If you update your theme, you will probably have to repeat this procedure.

If you want to hide multiple categories simply append the other categories to the string with a comma: (Example: “cat=-12,-82,-4″)

It also follows, then, that this technique can also be used to hide tags, posts, etc.

 

Verizon Wireless USB760 USB Modem Ubuntu Howto

13 Feb

This is a repost of information located at: Verizon Wireless USB760 on the Ubuntu Forums.

I am putting it here because I found it very useful, and wanted people to be able to find it.  If you anyone takes issue with my publishing it here, please contact me.

At any rate, the Verizon USB760 does not work right away, so you have to modify two files.  This solution was posted by Databit. I added a few notes for clarification purposes and enclosed them in brackets.

File 1: /etc/udev/rules.d/70-persistent-cd.rules

Find the line that contains "Novatel_Mass_Storage" and append the following to it:

RUN+="/usr/bin/eject %k"

[You will probably need to use a comma before this part]

File 2: /usr/share/hal/fdi/information/10freedesktop/10-modem.fdi [Will require superuser privileges]

Add this in the USB section:

      <!-- Verizon USB760-->
      <match key="@info.parent:usb.vendor_id" int="0x1410">
        <match key="@info.parent:usb.product_id" int="0x6000">
          <match key="@info.parent:usb.interface.number" int="0">
            <append key="info.capabilities" type="strlist">modem</append>
            <append key="modem.command_sets" type="strlist">IS-707-A</append>
          </match>
        </match>
      </match>

I have tested this and it worked without issue in Jaunty Jackalope 9.04.

 
 

Linux BASH Script: Convert mp3 to avi with static image (command line)

21 Jan

This is a script I made to take advantage of the ffmpeg package in linux to quickly convert an mp3 to avi using a static image. I personally use this technique for uploading my songs to YouTube. I originally found the conversion command here.

All you need is a linux distro with ffmpeg installed, a jpeg or png image, and an mp3. Note: It is highly likely other image formats, audio formats, and output video formats will work, but I have only used jpeg/png+mp3+avi and so cannot attest to results otherwise.

Usage: bash mp32avi.sh <image_file> <mp3_file> <output_file.avi>

Code (mp32avi.sh):

#!/bin/bash
FFMPEG=`which ffmpeg`
if [ "$FFMPEG" = "" ] ; then
	echo "Please install ffmpeg.";
	exit 0;
fi
if [ $# != 3 ] ; then
	echo "Usage: $0 <image_file> <mp3_file> <output_file.avi>";
	exit 0;
fi
if [ ! -f $1 ] ; then
	echo "Source image '$1' not found.";
	exit 0;
fi
if [ ! -f $2 ] ; then
	echo "Source mp3 '$2' not found.";
	exit 0;
fi
if [ -f $3 ] ; then
	echo "Output file '$3' exists.  Overwrite? (y/n)";
	read CONFIRM
	if [ "$CONFIRM" == "y" ] ; then
		echo "Overwriting '$3'"
	else
		if [ "$CONFIRM" == "Y" ] ; then
			echo "Overwriting '$3'"
		else
			echo "Operation canceled.";
			exit 0;
		fi
	fi
fi
TIME=`$FFMPEG -i $2 |& grep 'Duration' | awk '{ print $2; }' | sed -e 's/,//g'`
$FFMPEG -loop_input -i $1 -i $2 -acodec copy -y -t $TIME $3
 

I always wondered how a sewing machine works!

29 Jul

http://home.howstuffworks.com/sewing-machine1.htm

Beautiful diagrams explaining it all.

Actually, I hadn’t really heard of the bobbin-less “chain stitch.” I can see why it was invented first.

However, I could never understand how the top thread with a bobbin worked — now I see the upper thread wraps all the way around the bobbin assembly, looping the top around.

Obviously, there is a lot of thread twisting going on, and I still don’t really see how the top thread goes around the bobbin when it is mounted in on a pin, but at least I get the concept!

 
 

Why GoDaddy can’t get it right, and why you should not use their Grid Hosting

23 Jun

Grid hosting is a somewhat recent technology that essentially emulates a single server, but whose processing power is distributed over multiple servers.  There are several technologies used to accomplish this, but essentially it can be thought of as a cluster or as a self-scaling server arrangement.

The concept of it is to get the best of both worlds — you upload your website to a single server, or at least a single IP address, but depending on how much traffic your site is getting, more servers are added or removed to maintain stability.  In other words, easy, 100%, infinite scalability.

It is very attractive.  However, after spending the last few months using GoDaddy’s Grid Hosting BETA, I simply have to conclude that GoDaddy has it all wrong.  I believe from their perspective, they consider it one of their lower end solutions, and indeed, during the beta, it is only $4.99 a month.  However, infinite scalability is not something of value to someone whose websites will never scale.  Scalability is a point of interest for large sites, especially large sites that could become gargantuan.

So, the truth is, the service works very well with the exception of one important factor:  You can’t directly connect to any hosted file.  That’s right — if you attempt to post data to a script hosted on their server, you will, at least once ever so often, be forced through a 302 File Temporarily Moved redirect.  And, according to the W3C:

The requested resource resides temporarily under a different URI. Since the redirection might be altered on occasion, the client SHOULD continue to use the Request-URI for future requests. This response is only cacheable if indicated by a Cache-Control or Expires header field.

The temporary URI SHOULD be given by the Location field in the response. Unless the request method was HEAD, the entity of the response SHOULD contain a short hypertext note with a hyperlink to the new URI(s).

If the 302 status code is received in response to a request other than GET or HEAD, the user agent MUST NOT automatically redirect the request unless it can be confirmed by the user, since this might change the conditions under which the request was issued.

      Note: RFC 1945 and RFC 2068 specify that the client is not allowed
      to change the method on the redirected request.  However, most
      existing user agent implementations treat 302 as if it were a 303
      response, performing a GET on the Location field-value regardless
      of the original request method. The status codes 303 and 307 have
      been added for servers that wish to make unambiguously clear which
      kind of reaction is expected of the client.

Summary: Any posted data cannot be forwarded through the redirect.  Again, I’ll reiterate that this only happens on occasion, but it happens 100% of the time for a service I was trying to implement:  PayPal IPN.

That’s right, every time PayPal tries to send an IPN (Instant Payment Notification) they are sent a 302 File Temporarily Moved header.  Given that PayPal sends payment data via POST, and that PayPal is so fixated with security, and that the W3C expressly prohibits the forwarding of posted data through a 302 redirect, well it just doesn’t work.

And ultimately, anyone who uses any form on their website cannot reliably expect to get any results, as this redirect will prohibit the form from working.

The fact of the matter is, it really makes no sense anyway.  A logical conclusion would be, well why not have PayPal submit the data to the destination of the temporary redirect?  Short answer, the redirect goes to the same file.

Let’s say my IPN handler is at http://mysite.com/handler.php.  PayPal sends POST data to that URL, only to receive a 302 reply to redirect to the location http://mysite.com/handler.php?3ecvxYara (3ecvxYara is just a random string of characters, and it can change).  Ok so PayPal is then redirected to http://mysite.com/handler.php?3ecvxYara, where it can’t resubmit the POST data, but that’s where GoDaddy sends them.  Once they hit that URL, they receive yet ANOTHER 302 which directs them back to the original URL, only this time it works.  However, 2 steps ago, we were prohibited from resubmitting the POST data.

Let me summarize, GoDaddy, this SUCKS.

I have spent almost 6 months back and forth with their technical support.  I would send an email, only to get the reply “Hey we got your question.”  Then, a few hours later, I would get a reply “Your request has been forwarded to the high level tech guys because we low-level guys barely know how to turn a computer on.”  Finally, a day or so later, I would get “We think it is a problem with your scripting.  Check your script and make sure you’re not screwing up.”

At this point, all I knew was that PayPal couldn’t connect because they were getting a 302 reply.  I had theorized that there was some kind error in the Grid Hosting redundancy system.  Ultimately, GoDaddy admitted that it was something happening on their end.  Then, finally, someone on the PayPal boards triggered me to look up the protocol for a 302, and I realized the problem.  Then, I used FireBug to track the headers, and sure I enough, I found what I needed to know.  So, I questioned GoDaddy as to why the 302 is necessary.

The reply:

Dear Sir/Madam,

Thank you for contacting Hosting Support.

Your issues with communicating with Paypal are related to the methods which we use
to protect our network. For security reasons, we cannot get into the technical
explanations as to why this configuration will not work.

Please contact us if you have any further issues.

Regards,

Aaron R.

Hosting Support

In other words, they can’t come up with a solution that makes the Grid Hosting system behave like a normal server, and, as I mentioned before, that is supposed to be the appeal of this technology.  Give me a break … temporarily redirecting every file somehow protects their network?  Wow!  I guess I know now how to try to bring down their other hosting services right??

Needless to say, I will not be using Grid Hosting from GoDaddy anymore.  I will next try Media Temple, as it is more matured and I have not read about any such issues.  I doubt GoDaddy cares about losing my $4.99 a month, but I will deter as many people as possible from using their system at all.  Their slow, inefficient, vague technical support is a frustration in itself, and the fact that they can’t get their system to work properly, well that’s just bad business.

 

Internet Explorer Legacy Issues — 100% width and horizontal scrolling

22 Jun

One of the beautiful idiosyncrasies (some calls ‘em bugs I call ‘em idiosyncrasies) of IE that I just had the pleasure of dealing with has to do with the use of the width: 100% property.

Basically, I fixated the html and body elements, then built a 100%, 100% height div (no padding, margins) inside it so that I could better control the scrolling of my page compared to other fixed objects.

At the top of that replacement div, I had 3 linear objects making a header.  One was 110px tall at the top, the next was 22px immediately below that (top: 110px), and the next was 10px, immediately below that (top: 132px).

Each of these elements was 100% width (entire width of the viewport).  For some bizare, wacky reason, I kept getting a horizontal scroll bar, even though everything fit on the page.

It was my top element, which made no sense to me because they were all 3 position: absolute; width: 100%; and fixed height, just with varied positioning.  In debugging, I was stumped, as it didn’t matter where I put the objects, in what order, etc.  That top div (the one that was originally on top) was always wider than the screen — in fact, it was wider by the width of the scrollbar.  For some reason, it was getting its width of the viewport from BEHIND the vertical scrollbar, whereas the other 2 for some reason did as they should and excluded the width of the vertical scrollbar in their calculations.

Then I realized, but “no it couldn’t be?!?” — the 2 divs that were working properly had a background image.  More specifically, their background was defined as background: #xxxxxx url(/file/location) repeat-x; but the other div simply had background-color: #111111; as its definition.

So for some reason, using background: vs. background-color: causes the always intelligent IE to change its interpretations.  Go figure right?

So the workaround?  Use background: instead.

background: #111111 url() no-repeat;

And voila, it was fixed.

I HATE YOU IE.

 
 

Quickly duplicate a barcode!

04 Jun

Fairly often in inventory circles, you just need to take a barcode  label you have and duplicate it to put on another item.  The quickest way to do so is on the Instant Barcode Duplicator by geeXmedia!  Just navigate to http://duplicator.ezbarcodez.com and scan the barcode into the box.  You can even add a title.

It currently supports 2″x1″ and 3″x1″ labels as well as label rotation.  And, if you need further barcode abilities, there is a full featured WYSIWYG label/barcode creator at http://www.ezbarcodez.com.

Currently only 128-B 1D style barcodes are supported, as it supports both numbers and letters, as well as some symbols, but it’s quick, and it will work for almost any application.

 

2005.5 VW Jetta — Yay I get a new clutch

25 Feb

I bought this car last year (Feb. 24, 2008), and it’s been a pretty good vehicle — starting with low miles (about 40k) — smooth ride. Hard to get used the acceleration of a small diesel engine, especially compared to my previous 99.5 2.0… Anyway, 49mpg and 700 miles on a tank are fantastic. The $380/month price tag is a little tough, but you’ve got to have reliability right?

Well reliability started going to hell at about 58000 miles (a few months ago). I had some major shuddering going on — turned out it was only in need of a fuel filter and air filter, but in the meanwhile a grinding started occurring that I could feel in the clutch pedal. When it first happened, it made a very loud noise — almost like a piston went out.

The car ran fine though, and eventually the grinding went away — ironically the instant I took it to the dealership to have them listen. (I’m not kidding — I shut the car off at the dealership, and it never made the noise again.)

Anyway, on Friday (Feb. 20, 2009) on my way home, I pressed the clutch in to coast, and I could feel a knock in the pedal about 2-3 times a second. When coasting in gear, the knocking picked up based on RPMs. I knew something happened in the clutch.

So, I drove the car home, knowing full well those 15 miles or so would likely cause more damage, but the car was running, no knocking while I was driving, so I figured I’d take the risk. I made it home, no issues.

I had the car towed to the VW dealership who told me the DMF (dual mass flywheel) broke, taking the clutch disk, pressure plate, and throwout bearing with it, and they want $1610 to replace it. They also charged me $99 to tell me all this.

Fair enough, I’m sure that’s pretty accurate, but they also told me they could replace my fuel filter for $110, and replace my broken brake light for $30.

WTH

So, as it turns out, you can replace the crappily designed DMF with a much more solid, less complicated, more reliable SMF (single mass flywheel). Found the parts at MJM Autohaus for $324.95. I will update this post, hopefully with a howto and results of the undertaking of installing the clutch myself.

I’m stuck with my car — probably not a bad thing, but it’d be nice to lose that payment … BUT, the warranty is through, so I can mod it however I like now … maybe I can tweak a lot more than the 49mpg out of it.

 
1 Comment

Posted in Cars, How-To

 

Verizon Wireless Pantech UM-150 on Ubuntu 8.04 Hardy Heron

15 Feb

This is easy enough, but since I recently did it and had difficulty finding definite information I thought I would post it myself.

Truth is, it’s a piece of cake. First things you need to know:

Your modem is just that — a modem, and it is connecting like any dialup modem.

Dialup number: #777
Username: xxxxxxxxxx@vzw3g.com (replace xxxxxxxxxx with you 10-digit phone number associated with your modem)

Plug your UM150 into your USB port. Ubuntu should detect it as /dev/ttyACM0

Now, simply run “sudo wvdialconf”

It will detect your modem and do pretty much all the configuration.

Edit /etc/wvdial.conf — put in the appropriate phone number, your username, and anything as the password (I used “abcd”).

Now, run “wvdial”

and you’re golden. Good luck!