brettbrewer.com

Programming + Design

Home
Install APC on a WHM/CPanel based server
Written by Administrator   
Sunday, 06 April 2008

If you've ever tried to install the Alternative PHP Cache (APC) on your Linux server, you've probably tried to use the PECL installer and discovered that you just get an error. When this happens you will need to manually compile the module from source and install it yourself. It's actually quite easy, but it's a pain if you don't know how. Here's how it was done on one of my WHM/CPanel based servers. Please note, you may first wish to try the PECL package installer built into WHM, but that has never worked right for me, so below is a list of commands you can enter to install it manually from a root commandline.

Last Updated ( Sunday, 06 April 2008 )
Read more...
 
How to turn a wireless router into a switch.
Written by Administrator   
Friday, 28 March 2008

If you're like me, you've probably upgraded multiple generations of routers over the years and have old routers lying around that could be used as switches. I happen to have two old Linksys routers collecting dust in my closet. Recently I built my girlfriend a new PC and I did not have an extra network connection near her PC, so as a temporary measure, (I'm waiting for a new $29 gigabit switch to arrive from NewEgg), I decided to turn a spare router into a switch. So here's how I did it on a Linksys WRT54G version II using the latest official Firmware from Linksys.

Last Updated ( Sunday, 06 April 2008 )
Read more...
 
Hacking the "Top Message" box in X-Cart
Written by Administrator   
Tuesday, 25 March 2008

Sometimes in developing various mods or hacks for x-cart, you may want to display a message to the user on the next page load after taking some action. To do this, x-cart supplies the $top_message session variable which is automatically registered on every page load and made available in your scripts. The $top_message variable is an array with a few flags you can set to control how the message displays.

$top_message['content'] .= "My warning";

$top_message['type'] = "W"; 

You can set the flag to "I" for info, "E" for errors, and "W" for warnings. The top message box will be styled accordingly. 

Also, if your script doesn't already assign the top message to a smarty template variable, you'll want to assign it before displaying your template:

$smarty->assign("top_message",$top_message); 

Sometimes you may notice that your messages don't show up no matter what you try. Usually this is due to a page redirect happening in the background which clears the $top_message before you can display it. To get around this, put the following snippet in your script to keep the $top_message from being cleared on the next page load:

$adaptives['is_first_start'] = 'Y' ;    

Usually that will do the trick.  

Last Updated ( Tuesday, 25 March 2008 )
 
How to recursively copy directories in Linux
Written by Administrator   
Monday, 24 March 2008

I had a problem using the Linux "cp" command to recursively copy directories today. Normally you can use the following command to recursively copy directories and overwrite any existing files in the target directory:

cp -Rfd /source/dir  /destination

 however, this will not work on many RedHat based systems because the "cp" command is aliased by default to "cp -i" which forces interactive mode to confirm overwrites of all files. If you don't know this it can be very infuriating. You could simply re-alias the cp command, but it's probably better to create a new alias so you don't alter the expected default system behavior of the cp command in case your system is touched by admins who don't expect the cp command to be re-aliased to allow non-ineractive file overwrites. Instead, you can creatie your own alias to the main cp binary to bypass the aliasing of the cp command entirely and run your own command line switches. Usually cp is located at "/bin/cp" but to find yours you can usually type "which cp" at the command line and it will tell you the full path to the cp binary. Once you know the path, just create a new alias such as:

 alias cprecursive='/bin/cp -Rfd' 

If you want to make this a permanent alias, you might want to add it to the /root/.bashrc  or the corresponding file in your /home/userdir. 

Also, please note, that when copying one directory to another, you specify the source directory normally, but for the target you only specify the directory that should CONTAIN the directory you are copying. So for example if you wanted to copy the images directory from a test site to a live site (and assuming you've already created the above alias) you might do something like this:

cd /home/userdir/public_html

cprecursive mytestsite/images mylivesite

this would copy the "images" directory from the "mytestsite" directory into the "mylivesite" directory, creating the mylivesite/images directory if necessarry and recursively creating/overwriting any files/directories contained within. 

Last Updated ( Tuesday, 25 March 2008 )
 
Windows XP Clock stuck on AM or PM?
Written by Administrator   
Friday, 21 March 2008

I had a strange thing happen to my desktop system running WindowsXP Pro recently, where the clock would only read AM and would never let me change it to PM. After many days of searching for a solution and running every utility I could find to fix my system's internal time server. Finally I tried doing a search of my entire registry for the string "AM" and woldn't you know it, the first thing I found was a the following key that fixed the problem....

[HKEY_CURRENT_USER\Control Panel\International]

Under that key you will find two subkeys named

s1159
s2359

The values should be set to "AM" and "PM" respectively. I changed key s2359 to "PM" and everything seem to be working properly now.

Last Updated ( Monday, 24 March 2008 )
 
Getting IE8 to behave like IE7 without user intervention
Written by Administrator   
Thursday, 20 March 2008

The Microsoft IE8 Beta was released recently and with it, a slew of new layout problems with sites that formerly worked on IE7. The interface looks similar enough to IE7 that I forgot I upgraded my laptop to IE8 Beta a couple of weeks ago. As a result I spent 4 hours debugging a navbar layout problem before I remembered I had upgraded to IE8 when I noticed the "Emulate IE7" button at the top of the window. I turned on IE7 emulation and suddenly everything started working properly again in IE. Fortunately Microsoft had the foresight to make this feature truly useful by letting content authors turn this feature on an off transparently using a meta tag in the page header. To get IE8 to render like IE7 simply add the following to the <head> section of your page: 

<meta http-equiv="X-UA-Compatible" content="IE=7" />

Voila! No new IE bugs to deal with today! I can hardly believe Microsoft did something this nice for web developers after all the years of obvious indifference. I've heard some ranting in the CSS community about this new meta tag being added just to satisfy IE, but honestly, who cares at this point. CSS is so stupid and broken it can't get any worse and if they want to give me a meta-tag to make dealing with this horrible technology easier then I'm 100% for it. In fact, I can think of about 10 other meta tags I'd like to add. I'd like one that would let me override both the standards-compliance and all browser hacks with one single browser hack that would make boxes properly resize themselves vertically to fit their contents. Or how about a simple way to get a bar to sit at the bottom or top of the screen without overlapping anything when the screen is resized. There's so many holes in the CSS specs and browser implementations of those specs that we are all lucky we can get even the simplest of layouts to look good on multiple browsers. Things have definitely gotten worse instead of better for web developers over the past few years. Microsoft is the primary cause of all of this, though the folks at Opera and Mozilla have done their fair share of crappy CSS rendering too. Hopefully with Microsoft's new policy of making IE8 work in standards-compliant mode by default will start a new trend, but I'm not optimistic. Let's not forget, we've been waiting for a way to easily make a 3-column layout with CSS for well over 7 years now without a single elegant solution from the CSS standards bodies or browser makers. Layout tricks that remain trivial to do with tables are STILL nearly impossible with CSS2. If you don't know what those things are, then you are lucky you haven't been using CSS for very long. This post is about a paragraph longer than it was supposed to be, but every time I get started talking about CSS it just turns into a rant. Sorry folks. Enjoy your new "standards-compliant" IE8 and the new meta tag...they are by far the best things to happen to a Microsoft browser in a loooooong time. 

Last Updated ( Thursday, 20 March 2008 )
 
PHP Stream Wrappers Rock!
Written by Administrator   
Sunday, 16 March 2008
Today I'd like to give a big shout out to PHP's stream wrapper functions . I was listening to the PHP_Abstract podcast recently and they interviewed Manuel Lemos, the guy who started PHPClasses.org , and he was talking about "Stream Abstraction" in PHP.  Stream wrappers basically let you treat any kind of stream as a regular file that you can read and write to using the standard file handling functions such as fopen. During the interview Lemos mentioned some cool stream wrapper classes they had at PHPClasses.org and mentioned several cool stream wrappers including a Microsoft Excel stream wrapper class written by an overachieving Aussie named Ignatius Teo. Basically it lets you take associative arrays in PHP and save them directly to Excel spreadsheet files with keys as column names....how cool is that!? Scarecely 24 hours later I had a request from a client to export some x-cart data to an Excel spreadsheet and thanks to this stream wrapper class it was a breeze (I might even say FUN) instead of an annoyance. So thanks PHP , PHP_Abstract , PHPClasses.org , and Ignatius Teo, for making my job as a web developer that much easier today!
Last Updated ( Sunday, 16 March 2008 )
 
Camera stores to avoid like the plague
Written by Administrator   
Wednesday, 12 March 2008

Wow, I have haven't come upon a company this shady since SuperMicro in the '90s. I recently made the mistake of doing a Froogle search for a Casio Exilim EX-V8 8MP Digital Camera with 7x Anti-Shake Optical Zoom. I found the cheapest price at site called Preferred Photo (preferredphoto.com) and placed an order for the refurbished model. I then recieved a followup email telling me to call them to expidite my order. Since I'm not in a hurry I did't bother calling them and instead did a little research on the company so that I would know what to expect if I had to talk to them about anything. Immediately I found droves of forum postings warning people to steer clear of this company. Most people were telling stories of the salespeople calling them and claiming they purchased a "Japanese version" of the camera and that they needed to spend $100 more to get a US version. Others were told that the camera would only come equipped with a "10 minute battery". Basically they won't ship your order until they talk to you and try to upsell you a bunch of overpriced junk and tack on some shipping and handling fees. Well, sure enough that's exactly what happened to me. They called me today around noon to try to upsell me a longer life battery, a warranty, and then after I refused everything they still gave me an order total that was $20 more than my original order. I told them just to send the camera and initally agreed to the extra charges because I didn't realize there WERE any. After I checked my original order receipt I realized they had still scammed me out of an extra $20 in hidden "handling fees" which were not listed on my original orders. I immediately called them back. After a few minutes on hold I ended up talking to the same guy who had tried to upsell me the junk. He wanted to know why I was cancelling my order so I lit into him with such a torrent of consumer angst that he almost immediately gave in and agreed to refund my order. We shall see if it is actually refunded in full or if this saga continues to garner them the kind of publicity they don't want. After doing a bit of research, I've discovered that this company is doing business under a variety of web sites. Normally I am loathe to mention the specific names of companies that piss me off on my web site as I generally consider it to be unprofessional, but I'm making an exception here because I feel since many of the visitors of my site are pretty likely to be into digital photography that everyone who visits my site should know about this horrible company. SO, here is a list of the camera sites that you should avoid at all costs:

  • Broadway Photo - http://www.bwayphoto.com/
  • A&M Photo World - http://www.amphotoworld.com/
  • Regal Camera - http://www.regalcamera.com/
  • Prestige Camera - http://www.prestigecamera.com/
  • Preferred Photo - http://www.preferredphoto.com
  • Royal Camera - http://www.royalcameras.com/

You can do a google search for the name of any of these sites and the first link will be a link to the company and the second link will be a link to a horror story about them. In fact, Royal Camera isn't even showing up in the #1 spot for their own name...a negative review of them is the #1 search result .

But don't take my word for it, here's what other people have to say about these incredibly shady web sites:

Sigh.....I could find hundreds of similar stories, but I feel much better now and should really be working. I'll probably just end up ordering from Amazon if I can't find a better reseller to re-buy this camera from.

UPDATE: I did receive an email from PreferredPhoto.com shortly after I cancelled my order stating that  my order would be refunded in full and that I should see the credit on my account within 24-48 hours. I will post another update once I know if my card was really refunded in full.  

Last Updated ( Sunday, 27 April 2008 )
 
<< Start < Prev 1 2 3 4 5 6 Next > End >>

Results 9 - 16 of 44

Search

Who's Online

We have 1 guest online

Brett highly recommends...

Get Your War On: The Definitive Account of the War On Terror 2001-2008

My favorite comic is getting ready to be relased as a single volume. You can preorder now. If you hate the war and love to laugh, do yourself a favor and order this. You can also read all the GYWO comics online for free here.

BBS The Documentary

This is by far the most comprehensive and entertaining documentary I have ever seen regarding the early BBS system. If you're serious about knowing your internet history, or you just want some extra geek-cred, this is your new favorite documentary.

The Nada Chair "BackUp"

The best alternative I have found to overpriced ergonomic office chairs, especially for very low pain around the sacral joint. Works better than my Aeron chair ever did. Also, it comes in navy blue and black, in case you're not into the whole pregnant woman aesthetic (pictured).It's really not meant for sitting on the floor, it's really better for seats that offer poor back support, and works great at sporting events to make sitting in bleachers much more comfortable.

Antec Quiet PC Case

At just under $120 including a 500 Watt power supply, this "quiet pc" case has worked great for me for over 2 years. In fact I now own two great Antec cases/PSUs. For the money, it's hard to beat this combination.

Valid XHTML 1.0 Transitional

© 2008 www.brettbrewer.com

Spam bots check out this page.

Joomla! is Free Software released under the GNU/GPL License.