Made of Everything You're Not

Thoughts on programming, people and life
  • Home
  • Projects
  • Portfolio
  • Resume

Posts Tagged ‘web development’

Care About What Matters

Posted in Code, Programming on October 22nd, 2010 by Eric Lamb – Be the first to comment

It’d been a while since I’ve had the free time to write something and I really didn’t think it’d be a bitch post but it is and here we are. But, as I sit here at midnight browsing Reddit, and, yes, a little drunk, I find myself raging about the idea of the dumb stuff we care about and why we probably shouldn’t.

Case in point, an article called “PHP require vs. include vs. require_once vs. include_once Performance Test” written by Arin Sarkissian way back in 2007. Forgiving the obscenely long and verbose title, Arin goes over the process and code he created to test which of 4 statements (require, include, require_once, includes_once) was the most efficient in terms of performance. It’s definitely a good read if for no other reason than the insight into how to test and benchmark code but I think there’s more to the article than that.

That said, the article left me unsettled for a couple reasons. First, with the amazement and appreciation that someone had taken the initiative to test a theory instead of just drawing conclusions (something that’s pretty rare in my experience). Second though, well the second thing bothered me because of the other more applicable and meaningful question I couldn’t shake. Why do we care about this nonsense?

For years I’ve read articles about how best to handle certain circumstances to improve performance. Some are good. Things like how to use the dir() function to iterate over directories or how to properly write SQL are great and definitely worthwhile reads. On the other hand though, there are tons of articles talking about the advantages of using single quotes over double quotes or, as Arin wrote, which function is better suited for file inclusion; scenarios that matter so minimally that the effort in thinking about the issue is far greater than the gains of switching techniques.

As my friend Caroline would say, “Rubbish; all of it.” (she’s British).

Care about your SQL. Care about your file system interaction, your loops and your math. Care about your logic. And, because it’s so important it demands repeating, care about your SQL.

I promise you, there are zero circumstances where whether you used include_once over require_once is going to be the bottleneck. It will never matter one bit if you concatenate with single quotes rather than use double quotes with nested variables. Hand to fucking god; it will not matter nearly enough to spend any time debating which approach is better.

So before you start spending all your time wondering what is the best technique or method for a specific scenario as yourself how much does it matter.

SQL
Bookmark and Share

Welcome to The McDonaldification of Web Development

Posted in Brain Dump, Business, Rant on November 2nd, 2009 by Eric Lamb – 2 Comments

When I was a kid I remember McDonald’s as having some of the best food and providing the best experience ever. Just the thought of going there was exciting. Breakfast, lunch and dinner; it didn’t matter what meal it was. They went out of their way to, at least try, to make the experience fun for the kids. Yes, this was part of a plan to get the kids hooked to bring in the family (which it did in spades) but it was one of those rare strategies that was win-win for both the customer and company.

Welcome to The McDonaldification of Web Development

Welcome to The McDonaldification of Web Development

Fast forward 20 years (sigh…) and McDonalds and it’s ilk are the lowest of the low when it comes to quality of service and product. It’s been years since any fast food restaurant has provided me with an experience worthy of my money; the food is always horrible processed shit, and the service (even at the most basic of basic levels) is completely nonexistent. Hell, I can’t remember the last time I was given ketchup with fries without having to ask for it…

Having worked in web development professionally for the last eight years I’m starting to notice a similar pattern in this industry. What was once an industry ruled by high profits for a job performed by professionals (mostly anyway) has quickly become an industry full of amateurs and scammers (mostly) trying to make as much money with as little thought to quality as quickly as possible. I’ve spoken before about the lack of quality I find in a lot of programmers I work with, and while I’m not saying it’s the complete cause, I do think there’s a link.

Oddly, I’m in the minority here. In my, limited, exposure to other programmers I can say definitively that the majority just plain suck; mostly because they refuse to grow and learn.

I’ve heard all the arguments before, “My weekends are mine”, “I work hard enough; I don’t have the energy”, and the best ever, “My employer should pay for this like Google does. Whah!!”. (I know Google doesn’t, in fact, do this but people still say it.) All just pure crap excuses for maintaining a level of competence just high enough to not get fired.

Bottom line: working 8 hours a day is just not enough to matter. If you think you’re a programmer and you don’t spend time improving your skills you’ll quickly, really quickly, become obsolete. It just doesn’t matter if .Net is going to be around forever and your employer won’t ever upgrade from 1.1; you’re a hack (and not in a good way).

Now that I’m an active freelancer I’m really, really, starting to see the differences. Time and time again I end up taking a meeting with someone who has just been worked over by others in this field. The stories some of these companies and people have are just appalling and I’ve heard some doozies. Worst of all, behavior like this tends to skew their perspective and they view all freelancers as suspect.  Too much of my time is spent building confidence in me as a professional it’s really starting to become laughable.

It was all really quite the mystery until I recently reached out on craigslist to find a designer for a WordPress theme (I need to update this site BAD). I was pretty explicit that all I was looking for was a PSD file that I would personally turn into a WordPress theme but 4 out of 5 responses to the ad indicated that the respondent hadn’t even read the post. Frankly, it was irritating wading through the crap and, obviously, automated responses.

This is troubling for a couple reasons. For one thing it basically indicates, to me anyways, that the person (company, freelancer, whatever) had very little regard for what I wanted, instead opting for a fastest gun approach. The number of emails I received immediately after posting my ad was around 20 and after reviewing each one it was obvious they were automated. I pity the individual or company who entertains these people.

The long term harm this can cause for other programmers (much less themselves) is completely short sighted. Crappy work begets a crappy experience for the client. Simple.

Bookmark and Share

When Did Performance Stop Being Important?

Posted in IT, Programming on September 21st, 2009 by Eric Lamb – 10 Comments

Now that I’m finally starting to “get” the Zend Framework I’m starting to have some serious doubts on whether I made the right choice; not in choosing Zend over another framework but in choosing any framework at all. The memory usage is just abysmal across the board and after working with the Zend Framework for about a month or so it’s not entirely clear if it’s going to scale as I need it to.

When Did Performance Stop Mattering?

When Did Performance Stop Mattering?

Which lead to the question of why.  At the moment it seems like a question of speed of development versus performance (which is ironic because Zend Framework is not easy or speedy to develop with).

<disclaimer>
To be fair, it’s not just frameworks that have an uncomfortable overhead. Just take a look at Joomla and Drupal; 2 popular content management systems with an absurd overhead. It’s just easier to focus on my current interest rather than the CMS’es.
</disclaimer>

One thing I’m having a hard time getting comfortable with is how much memory is required when using a php web framework. Out of the box both Zend and Symfony (for example) use around 5MB per request. Understand, this is without any custom code. Just setting up the MVC and Autoloader for the default views and models. Nothing impressive or useful and 5 fucking MB to run that?

After having been on the wrong end of this issue on my own code I’m pretty sensitive to how my code performs; I’ve written some nasty algorithms and watching them crumble in real time has a tendency to turn you around ;)

Researching the issue doesn’t really help. There’s a lot of advice on how to improve the performance but it seems to always center around common sense improvements you should be using anyway.

The most touted improvement I’ve heard is that you have to use a PHP accelerator and opcode cache. I just find that response flawed but not because it’s bad advice but because it’s common sense. Yes, it’s true, but not using a framework in combination with a PHP accelerator and opcode cache is still better in my experience. All relying on those tools does is move the baseline for performance, which you’re supposed to do already, and a framework still consumes a good amount of resources on it’s own.

In my experience you get about a 50% reduction in memory usage when using something like x-cache but using the Zend Framework  still leaves a total of 2.5MB of memory usage to accomplish the bare minimum setup.

One saving grace is that hardware is cheap. Scaling with hardware is usually the go-to escape when the bottleneck is the code but it’s not without it’s own set of issues. For one thing while it’s true that hardware is cheap the labor to maintain that hardware is not. Especially if you want to maintain the server in a proper and responsible manner.

Another option, that’s really only available when using the Zend Framework, is decoupling the project from a direct dependence and not use the MVC components. In anticipation of doing this I’ve been writing a lot my recent code and projects in a style that’ll allow easy(ish) separation when the time comes.

At this point I haven’t used a framework in a production environment so all of this consternation might be for nothing. I just have a hard time accepting the performance hit of half a MB for using something trivial like a content management system (drupal) or, for example, a component like Zend_Navigation compared to the benefit. What are they actually doing to make the cost worth while?

Still another option is to just walk away from this whole OOP thing and head back to the familiar touch of procedural php and using functions and classes as more of decorators to apply than core components.  From my personal experience, and only my experience, using OOP is way more expensive than procedural. At the end of the day I need my programs to work fast, be easy to operate for my users and have a low impact on the server. How does using OOP help that?

At the moment I’m not sure how this is going to work out. I am confident it’ll be an adventure though. Hopefully, I find out how Zend will scale before a project of mine goes viral or gets popular. Hopefully.

Bookmark and Share

The Framework is the Language

Posted in Programming on September 18th, 2009 by Eric Lamb – 6 Comments

As I’ve mentioned I’m trying to move all my programming to a web framework. It was tough going though because of the sheer complexity and my naivete about the  undertaking.

The Framework is the Language

The Framework is the Language

After about a month of working with the Zend Framework I’m a little… bored with it. If this is what working with a framework is like I don’t want it (thank you very much). I, naively, thought using a framework would increase my productivity and highlight some of the joy I feel when developing and learning but, so far, all I have is frustration and a pretty heavy headache.

Since then, I’ve spent some time looking at Symfony (a fine, but overly complicated, framework), looking at Code Igniter and digging deeper into the Zend Framework. It was while doing all of that, and struggling with the enormity of learning an entire freaking framework, that a thought occurred to me; I need to look at this as learning a new language instead of learning a component.

You can’t approach learning a framework as anything less than you would when learning a new language. Anything less and you’re in for pain. After this realization the framework came together pretty quickly though it still hurt like hell.

So, what does that mean? IMO you should have total absorption; learning a framework can not be done very effectively a couple hours at a time. Frameworks are just too damn big. They have too many parts and all the frameworks I’ve looked at seem to have very different philosophies in the architectural design and structure.

The strategy I took was, and the one I use when learning a new language BTW, is to make the project my world. Everything else is gone and all that’s left is the problem. There is no break, no rest and sleep is used to further solve problems more than it is to recharge. It’s really the only way I can accomplish something as complex and challenging as learning a new programming language.

The good news is that I now feel very comfortable using the Zend Framework though I still have my doubts as to how good of a decision it is to use a framework at all (that’s another discussion though).

Bookmark and Share

Keeping an Eye on Your Development

Posted in Code, Programming on September 7th, 2009 by Eric Lamb – 3 Comments

Oh, var_dump()… Poor, pathetic, little vardump()… There was a time when you were my favorite little go-to for debugging. Once upon a time, you were the end all be all of problem solving tools; this would be during my idiot phase of life. Not anymore though; thanks to some god (or whatever) someone smarter than me (and apparently with more time on their hands) went and invented the Debug Toolbar.

Keeping an Eye on Your Development

Keeping an Eye on Your Development

In case you didn’t know, a Debug Toolbar (I don’t know if that’s the universal name for it but it makes sense to me) is a nifty little widget that allows for easy access to all sorts of info on your web program. Since I work primarily in php that’s what I’m going focus on; I’m sure they’re available in other languages. Like most things; Google is your friend on this.

Usually, a Debug Toolbar contains information on included files, any sessions and cookies available, the database calls with timers and a breakdown of memory usage and performance.

Debug Toolbars usually work by encapsulating different code blocks or functions around “timer” functions to record the time it took for a block to run. All the Debug Toolbars I’ve used also included a memory component; really helps to see where the spikes are. There’s also the database integration; it’s just good sense to know where the bottlenecks are in a project.

As I said in the intro var_dump() is a handy little tool for debugging issues in php scripts. It works pretty well for small scripts but, the thing is, on larger projects it just becomes unpractical. Not only is it limited to arrays and objects but you have to manually place the call in the code and depending on the issue, you can get a HUGE amount of data back in a horrible tangle of strings. Makes XML look good.

Instead, using a Debug Toolbar, you get a nicely formatted unobtrusive way to keep an eye on how your code is performing while creating it. Needless to say, these are handy little tools.

PHP_Debug

A little disclosure: My first experience with a debug toolbar was with a really early, think pre alpha, version of PHP_Debug. PHP_Debug, at that time, worked by displaying the debug information at the bottom of a page in a table. This was definitely a step up from using var_dump(), to be sure, but it was still a little painful to decipher. Clients would complain.

Then PHP_Debug pretty much innovated the Microsoft way and copied a feature from another application; Symfony. (I kid, I kid.)

Seriously though, PHP_Debug does claim inspiration from the Symfony which I think is pretty classy of them; it seems too many times credit goes unsaid.

Keep in mind, this was the first time I saw anything like a debug toolbar. I don’t want to break down to hyperbole but to say the sky parted and angels sang would be a fucking understatement.

PHP_Debug Toolbar

PHP_Debug Toolbar

PHP_Debug is perfect for those stand alone projects that are started from scratch. It’s not impossible to integrate PHP_Debug into an existing program, I’ve done it a few times, but unless you’ve abstracted out a good deal of the logic it’s going to be a little painful. Put aside a few hours if you’re going to attempt it.

The script displays the output in 2 different ways; through a floating div at the top of a page or as an HTML table displayed at the bottom of the page. Installation is pretty easy and straightforward, either as a PEAR module or as a stand alone script.

ZFDebug

ZFDebug is a plugin for the Zend Framework that acts pretty much like PHP_Debug except with a simple and easy integration into the Zend Framework and it’s quite a bit slicker. Smooth animations, version details, sticky states and full of detail. If you use the Zend Framework I can’t recommend it highly enough.

ZFDebug

ZFDebug

There are some installation instructions which at the time of this writing are just broken though. Follow the linked instructions but use the below code in place of the code provided in the instructions:

protected function _initZFDebug()
{
    $autoloader = Zend_Loader_Autoloader::getInstance();
    $autoloader->registerNamespace('ZFDebug');
 
    $options = array(
        'plugins' => array('Variables', 
                           'File' => array('base_path' => '/path/to/project/'),
                           'Memory', 
                           'Time', 
                           'Registry', 
                           'Exception')
    );
 
    # Instantiate the database adapter and setup the plugin.
    # Alternatively just add the plugin like above and rely on the autodiscovery feature.
    if ($this->hasPluginResource('db')) {
        $this->bootstrap('db');
        $db = $this->getPluginResource('db')->getDbAdapter();
        $options['plugins']['Database']['adapter'] = $db;
    }
 
    # Setup the cache plugin
    if ($this->hasPluginResource('cache')) {
        $this->bootstrap('cache');
        $cache = $this->getPluginResource('cache')->getDbAdapter();
        $options['plugins']['Cache']['backend'] = $cache->getBackend();
    }
 
    $debug = new ZFDebug_Controller_Plugin_Debug($options);
 
    $this->bootstrap('frontController');
    $frontController = $this->getResource('frontController');
    $frontController->registerPlugin($debug);
}

Using ZFDebug is as simple as that. Once installed you’ll have a div laying at the bottom of the page with all the details you could want. Plus, it comes preinstalled with the hooks for database and cache profiling. It’s still possible to manually insert timing blocks but the hard part is already done for you.

Symfony

If you’re using Symfony you’re in luck (and none of this is probably news to you); Symfony comes with a Debug Toolbar (the original maybe?) preinstalled and read to use. All you have to do is either hit up frontend_dev.php in a browser or change:

$configuration = ProjectConfiguration::getApplicationConfiguration('frontend', 'prod', false);

to

$configuration = ProjectConfiguration::getApplicationConfiguration('frontend', 'dev', false);

in your bootstrap file.

Symfony Debug Toolbar

Symfony Debug Toolbar

It’s not as robust as PHP_Debug or ZFDebug out of the box (oddly, there’s no included file reference) but it does allow for customization so it has the potential to be very informative and useful.

One last thing about Web Debug Toolbars; they aren’t a replacement for good practices. You can’t rely on them too much and sometimes your instinct will contradict the output of the toolbar. In my experience you should trust that instinct. A Web Debug Toolbar should only be used to provide insight not replace common sense.

One thing to keep in mind is to not focus too much on the

Bookmark and Share

Eclipse for PHP Dev: One Month In

Posted in Programming on September 2nd, 2009 by Eric Lamb – Be the first to comment

As I previously mentioned I’m using Eclipse IDE for a good deal of my php development at the moment. At first, I was a little skeptical of how much Eclipse would improve my productivity. Initially, it was kind of painful but after changing my work flow to work better with Eclipse I do admit it’s an improvement.

Eclipse IDE

Eclipse IDE

My initial “look” at Eclipse was Eclipse for PHP Developers; this was on my old laptop but sine I no longer had it I had to reinstall Eclipse again. This time I’m using Eclipse standard with the PHP Developer Tools (PDT) extensions added on instead. No real reason, “just ’cause”.

First the good.

Right off, the most important and very coolest of the very cool features, is the built in function reference. I LOVE the ctrl+click feature! You can click on any function, class or method call and it will open the file containing that call. It’s really, REALLY, helpful. This feature is incredible, and one I’m sure isn’t unique to Eclipse. Still, after doing the alternative (see function, search for file with function, search for function in file and read) a feature like this is simply magical.

Hell, just hovering over an element will display the comment info if you used docblock style comments (you do write docblock comments right?).

Eclipse Code Inspector

Eclipse Code Inspector

Combining the above two features pretty much kills off a pretty signifigant portion of development; digging through code looking for something.

But wait! There’s more:

There’s also the integration with Subversion; it requires an add-on plugin to work but work it does. It’s a little confusing to use at first, but after reading How to use Subversion with Eclipse article by IBM it started to make sense. I started working with Eclipse before I dug into the Subversion integration so the change to workflow was a little disruptive at first. If you’re planning on using Subversion you should definately check out the Subversion integration before using Eclipse full time.

One last thing about the Subversion plugin; it’s written by the same guys (CollabNet) who make TortoiseSVN and Subversion itself so you can still use Tortoise if you want to. I appreciate that.

One of my first “misconceptions” was that there wasn’t any FTP or SFTP functionality. This is technically true but there is a plugin that handles this in a basic manner. There isn’t any way to work directly on the server (by this I mean, upload on save type functionality) but you can download and upload files to a server using either FTP or SFTP.

Now the petty, petty, stuff

One gripe I have is that Eclipse doesn’t syntax highlight Smarty tags; not even the HTML is syntax highlighted.

I was also hoping for some sort of customization on the syntax highlighting colors. Personally, I like the colors to be a little more vibrant than most IDEs default to. Small gripe to be sure but it would have been nice to have.

At this stage I haven’t really dug into the build process but from what I’ve read it should be able to improve the deployment work. Since I do php work I’m hoping “deployment work” means automated replication and setup. I know there’s ANT integration but having never used ANT before this is a whole other discussion.

Still, all and all Eclipse isn’t bad. Not even close. I still use EditPlus for some development, especially since there isn’t remote access, but more and more I’m finding myself open Eclipse for the real work.

http://eclipse.org/
Bookmark and Share

Fiddler Web Debugger

Posted in Programming on August 26th, 2009 by Eric Lamb – Be the first to comment

Let’s not kid ourselves: web development isn’t that hard. Nope, the server side stuff (php, .NET, etc) or even what happens in the browser (JavaScript, CSS, etc) isn’t too difficult. Not all of it’s easy though; sometimes when dealing with the HTTP level things can get a little… random.

Fiddler Web Debugger

Fiddler Web Debugger

In FireFox I use a couple plugins to help make HTTP debugging a little less painful; HttpFox and the venerable FireBug. There’s also a cool tool called Fiddler written by Eric Lawrence of Microsoft.

Fiddler is a Web Debugging Proxy which logs all HTTP(S) traffic between your computer and the Internet. Fiddler allows you to inspect all HTTP(S) traffic, set breakpoints, and “fiddle” with incoming or outgoing data. Fiddler includes a powerful event-based scripting subsystem, and can be extended using any .NET language.

Fiddler is freeware and can debug traffic from virtually any application, including Internet Explorer, Mozilla Firefox, Opera, and thousands more.

First, it should be noted that Fiddler is covered under a Microsoft license. That might matter to you or your company…

Anyway, in order to get Fiddler to work with anything other than IE, I’m talking about programs like FireFox or similar, you have to do some tampering and configuring of Windows, including the registry, along with the program you want ot send requests from, so for now I only tested it using IE (this can’t last though; I’m just NOT going to develop in IE).

Fiddler does the basic HTTP sniffing you’d expect but it also has tools to inspect and tamper with the data in the traffic; this is where HttpFox and Firebug drop the ball. Fiddler allows you to see the basics as you would expect any HTTP sniffer to allow but also displays out an XML rendering as well as the Hex view (if you need that sort of thing).

You can mess with a bunch of the different parts of the session including the session itself using custom built “rules”. These rules are written in JavaScript and contain commands that extend Fiddlers UI to allow for extensibility. Needless to say, this is a cool part of the tool.

Another really cool feature of Fiddler is that it can hook into the session for pretty much any Microsoft program that connects to the Internet like Microsoft Office. (I’d always been curious what connections Office makes while open and finding that out scratched a long standing itch.)

It’s definitely worth a look if you need to debug any HTTP traffic (AJAX anyone?).

Bookmark and Share

What’s In Your Toolbox?

Posted in IT, Programming, Servers on August 5th, 2009 by Eric Lamb – 1 Comment

One thing almost all computer users have in common, regardless of vocation, is that we use the computer to achieve some goal. The actual goal doesn’t matter so much as the fact that we’re using the computer to do something that, otherwise, we wouldn’t be able to do. To do so though we use various tools that are, usually, purpose built for the task.

Let’s be honest; without the tools we would be useless.

What's in your Toolbox?

What's in your Toolbox?

Personally I love my tools; specifically, I find developer tools to be some of the most interesting and fun toys available. I don’t want this to turn into a fanboy post but, in the interest of honesty, it just might. You have been warned…

What’s in my Web Developer Toolbox?

My toolbox is full of programs that are purpose built to help every step along the way for building Internet applications. Over the years, like pretty much all developers I’d guess,  I’ve come to rely on the below tools to ease the pain of development as much as possible. I totally vouch for these tools.

Version Control

This one’s crucial. If I had to rank these (and I really don’t plan to) version control would be at the top of the list. There’s a whole slew of options available but, for me, version control starts and ends with Subversion.

Yes, there are all sorts of hype surrounding GIT and Mercurial but, because right now, I work alone my needs are way too simple for anything like distributed version control. Nope; just give me Tortoise and an SVN URL, with credentials, and I’m a happy camper.

Local Development Web Server

Once upon a time the thought of using a local development web server was heresy to my style and philosophy. Now that I’ve been using one for the last year I have to admit I was dead wrong. Dumb even.

Previously, I would always use an external Linux server for all my development. The idea was that since the finished site would be hosted on a Linux server it was important to develop the site in the same environment. There are 2 big problems with this approach though; one is that the project is more likely to be dependent on the environment which can make relocation a problem, and two, is that continued progress on the project requires a connection to the Internet.

On the other hand, developing your projects on a local machine requires finesse and forethought to ensure porting the site from one environment to another doesn’t lead to anarchy. There’s also the knowledge and insight gained from setting up an environment by hand; there’s so much to gain from doing this it’s just silly not to without some edge condition.

Text Editor

Only masochists use Notepad for text editing. In today’s world of fast CPUs and large amounts of RAM it’s really hard to believe anyone would use Notepad for anything other than the most basic of basic editing tasks. If you plan on having a file open, for editing, for any extended period of time it’s just stupid (yes; STUPID) to use it.

Instead, I prefer EditPlus for all my text editing needs. Why? For one killer feature; a right click context menu item. Right click over any file and choose EditPlus to open the file for editing; it makes working very fluid and continuous.  It even handles files in the hundreds of MBs with ease.

There are other options for a text editor (Notepad2 comes to mind) but EditPlus is tough to beat.

Database Tools

Sure, a command line tool is perfectly adequate for administering a database server. The problem though is that I develop on a Windows machine and not using a GUI tool for database administration is kind of silly. It’s like the people who only use VIM for text editing; it’s like trying to prove a point against all logic.

Using MySQL, the easiest, and most familiar tool, is phpMyAdmin; but for remote administration phpMyAdmin starts to break down. Instead, you can’t beat the MySQL Administrator. It offers all the functionality as phpMyAdmin as well as a slew of advanced functionality like the ability to create stored procedures (which you should never, ever, do) and functions.

Remote Connectivity

Since pretty much everything I work on has to go somewhere and I usually need to connect directly to a server for administration I need tools that’ll allow me access. These tools really come down to 3; FTP, SSH and RDP.

For simply moving files between servers FTP or SFTP is obviously the choice. There’s bunches and bunches of options when it comes to FTP clients but I’ve been using CuteFTP for years and, pretty much, I swear by it. Yes, it’s a paid product but CuteFTP is also low impact, easy to use and, more important, doesn’t get in the way of my productivity.

And then there’s system administration which requires full control and access to a server or computer.

Linux has SSH which requires a small client utility. There’s a shitload of options available here but they’re all pretty similar so there’s not much difference between using, say, PuTTy or SSH Secure Shell Client (or any of the myriad other SSH clients out there). You just need to have one.

For Windows as far as I’m concerned there’s really only 2 options; Remote Desktop Connection (RDP) and VNC. For ease of use and quality of experience RDP is the way to go. HINT: There’s a setting to allow mapping of HDDs on the client machine to the server for easier file transfers.

Virtual Machines

In my opinion there’s been no bigger advance in quality assurance (QA) then the advent of the virtual machine (VM). QA probably wasn’t even a goal when VMs were first conceived but, boy, have they filled the gap well.

I’ve already gone into detail about my choice of VM tool as being Virtual Box:

VirtualBox handles the resource detail pretty elegantly; in that it doesn’t use the resource until it needs it. This means that instead of instantly having 10GB of your hard drive used up VirtualBox will only use the amount already taken. You can tweak the settings for a VM whenever you want so you can get just the right mix.

Web Browsers

You need pretty much every modern browser under the sun here. Um… duh?

So, there you go; those are the primary tools I use for web development. There are definitely some other tools I use that didn’t make the list (RegexBuddy, Photoshop and diff tools come to mind) but I didn’t feel they deserved mention because of how rare they’re used.

Did I miss anything else?

Bookmark and Share

The Bad Behavior Spam Blocker Part 1

Posted in Code, Programming on May 8th, 2009 by Eric Lamb – 5 Comments

Anyone with a blog has seen comment spam. This is the stuff that shows up talking about Viagra, written in Russia and are usually stuffed with links.

There are a couple tactics for combating this sort of thing; some sites require registration to comment, some people manually delete the stuff and some sites use technology to help.

Bad Behavior

Bad Behavior

What to do? What to do…?

Well, I don’t think it’s a good idea to add barriers in front of users participating in a discussion, so registration is out. I’m pretty lazy and don’t want to manually delete comment spam so moderation isn’t going to work. I am a programmer though so I have an innate confidence in technology to deal with this (mostly anyway). To that end I like to use 2 different services to deal with comment spam; Akismet, which I’m not going to talk about now, and Bad Behavior.

According to the official site:

Bad Behavior complements other link spam solutions by acting as a gatekeeper, preventing spammers from ever delivering their junk, and in many cases, from ever reading your site in the first place. This keeps your site’s load down, makes your site logs cleaner, and can help prevent denial of service conditions caused by spammers.

Thankfully, there are already WordPress plugins for both Akismet and Bad Behavior, so my blog is pretty well protected, but I also work on custom programs and need to protect them too. This got me thinking about how to to get Bad Behavior up and running on your systems; which is why you’re here I’m sure.

Like most things php, installing Bad Behavior is pretty easy. To install just download the files, unzip and place the files somewhere in your applications include path. Then just include the below preferably in a file included in all your pages after you upload the files. Using the below will only protect your site

1
2
3
4
<?php
$path_to_bb = '/path/to/';
require_once("$path_to_bb/bad-behavior-generic.php");
?>

The above is nice and all; your site’s pretty well protected from there but it would be nice to know what was happening behind the scenes. Just how many spam attempts are being blocked?

Bad Behavior does include a logging system but, oddly, at the time of this writing using 2.0.26, they don’t include any sort of install script. The instructions state:

If you just can’t live without logging, you will need to provide a database connection. Bad Behavior uses callbacks whenever it needs to run a database query; in order to provide this functionality, you will need to provide the appropriate hooks into your PHP-based software’s database and add them into the bad-behavior-generic.php file. The code has stub functions which show what is needed, and you can use the bad-behavior-wordpress.php file as an example to work from, though your implementation will necessarily be different.

I’ll go into detail in the next post; I’m still sick so I can’t write anymore.

Bookmark and Share
  • Subscribe: Entries | Comments
  • About Me

    Email Email
    Twitter Twitter
    310.739.3322
  • Categories

    • Brain Dump
    • Business
    • Code
    • IT
    • Programming
    • Rant
    • Servers
  • Archives

    • October 2011
    • August 2011
    • July 2011
    • June 2011
    • May 2011
    • April 2011
    • March 2011
    • February 2011
    • January 2011
    • December 2010
    • November 2010
    • October 2010
    • September 2010
    • August 2010
    • July 2010
    • June 2010
    • May 2010
    • April 2010
    • March 2010
    • February 2010
    • January 2010
    • December 2009
    • November 2009
    • October 2009
    • September 2009
    • August 2009
    • July 2009
    • June 2009
    • May 2009
    • April 2009
    • March 2009
    • February 2009
    • January 2009
    • December 2008
    • November 2008
    • October 2008

Copyright © 2008 - 2012 Eric Lamb - All rights reserved