Hyperdesk

Posted on July 31st, 2008 in PHP by Russ

The hyperdesk site is finally live. It’s been a long road of about eight months of nightly work. Once the client was satisfied that the html(link)/css he wanted was out of my league ( way out of my league ) he had another company set up the html(link) and CSS(link) (Cascading Style Sheets) and start up the javascript.

Their work with mootools was a lot smoother than my work with prototype. :)

The site owes a lot to mootools.net, PEAR and smarty. I went with using the Pear libraries for database access, the Smarty tools for templating and the mootools for javascript. I’ve built a secondary site at hyperdesk themes that’s using the same stuff and also the blueprint css(link) libraries. Once nice thing about building a site for myself ( or to my own standards ) is that while I can say “this is ugly” ( the animation is currently ugly ), I can also say “make this better via the blueprint grid.” and not “move this over 2 pixels, no too far!”

Competitive?

Posted on July 22nd, 2008 in PHP by Russ

How does one “become more competitive?”

Competetiveness is a virtue of companies. Basically, people who believe in it consider that there’s a limited amount of income available ( or public attention or whatever ) and they’re driven to get “their fair share” or “most of what’s out there.”

Here’s a list of values a client poses for his company. It’s not my list, but I think it’s an interesting one to look through:

  • Creative in approach to solving problems
  • dedicated to his own ideas
  • high value on time
  • competitive
  • thinks big
  • forward thinking/future oriented
  • innovative

I like to think t hat I’m dedicated to my own ideas, innovative and creative with regards to problem-solving. However, I’m not sure I place a high enough value on time, or that I think big enough. As far as “competitive,” don’t make me laugh. :)

How does one groom oneself to become more competitive?

Fail2Ban and Spammers

Posted on June 8th, 2008 in PHP by Russ

I thought that Fail2Ban would work well with the spammers we’ve been getting through one of the mail servers. Basically, I wanted to keep track of who had connected to the server and was from one of the spam sources listed at spamhaus.org. I wanted to configure a firewall rule so we didn’t even have to listen to their message.

I configured it to watch the mail log and when a connection was rejected because of spamhaus.org, it would trigger. It would remember the IP for an hour and then let the spammer try again. Why an hour? Our list is currently averaging around 2500 ips, and I didn’t want it bigger than that. :o

This is the jail.conf entry:

[spamhaus]
enabled = true
filter = spamhaus
action = iptables[name=SPAMHAUS, port=smtp, protocol=tcp]
logpath = /var/log/maillog
findtime = 60
bantime = 3600
maxretry = 1

And the filter entry:

[Definition]
failregex = [[](?P\S*)[]] (?:did not issue|[(]may be forged[)])
failregex = (?P
\S*) listed at sbl-xbl.spamhaus.org

However, here’s an intriguing question: at some point fail2ban just “stopped working.” It was like the regex didn’t match any more. Nothing obvious in the logs, et cetera. But when it stopped working, we were hammered by inbound spam. In fact, I originally thought the problem was a DOS attack. But maybe when the iptables rules expired, the spam mail servers carried on their normal mail sending ( when a mail server comes back online, send any waiting mail to it ). Maybe I’m not helping the problem and I should go back to a plain 5.7.1 reject?

Pear’s Services_Amazon

Posted on May 21st, 2008 in PHP by Russ

I don’t recommend it yet. Of course, it’s in beta, so cavet programmeur and all that. However, I had to comment out an include for the PEAR.php file ( for some reason site5 is automatically including it ) and then the response from Amazon, when I finally got one of their example scripts running was “410,” which means “gone, left with no forwarding address.”

So I’m imagining that it’s not really being maintained at the moment. Feel free to argue with me :) For now, I guess, I’m rolling my own class. And that’s ok too.

ie6

Posted on March 27th, 2008 in PHP by Russ

can DIAF.

That is all.

Building Blog Traffic

Posted on October 25th, 2007 in PHP by Russ

At the risk of becoming a “links” blog … here’s a tip for those of you just starting out blogging.

How to build Blog Traffic

In a nutshell:
1) useful, entertaining or timely
2) focus, focus, focus
3) post frequently but not at the expense of quality
4) use images
5) write well
6) consider your headlines
7) make the audience care.

Optimizing your php

Posted on October 16th, 2007 in PHP by Russ

A lot of these php optimization tips are new to me.

I was already familiar with 5,13, 17, 19, 30 and 31. The rest are news. :) Let’s hope they become my standards.

Preventing Complex Failure

Posted on September 12th, 2007 in PHP by Russ

“Complex things break in complex ways.” (
Steven M. Bellovin
) “The threat is complexity itself.” (same article, Andreas M. Antonopoulos).

As one webpage to email script grows to encompass an entire content management project, or one product listing grows into a storefront and shopping cart, how do we keep our simple tools from becoming complex tools that could break and require a complicated repair?

People who have read my code might notice that I rely on subroutines and functions to keep me on track. I try to break a project into numerous problems, so that each more or less discrete problem is solvable in its own right. To take as an example the form->email project I mentioned above, I’d have one function to accept the variables from the form and “clean them up” so that I could protect the system from people trying to break my form, and another function to handle the actual emailing ( since I usually work in php, a wrapper to the mail() function).

To me, this is what “making legos to build programs” is about; which is how I learned. Once I’ve written those functions, I can put them into a separate file and include that file as a library. The next time I have to write a similar tool, I can use those same functions. Unfortunately, that also flavors my approach to object oriented programming, but that’s a post for a different day.

When I’m banging away at the keyboard like Hephaestus, I’ve usually got the problem in my head. So, I know the six or ten or maybe even twenty functions I’ve got going, and I can apply them as necessary. However, once the forge has cooled and someone brings back a broken lightning bolt and I must reforge it ( days, weeks, even months or years later), I often have to take a few minutes to reacquaint myself with the tools I had to build for that particular project.

So if I keep my creating simple with the use of functions that break a project down to atoms, and then reassemble the atoms to finish the project, how do I keep the resulting project from being a complex group of simple things that itself will break in complex ways? It’s easiest to lump together functions to larger groups. Actually the process is reversed; I break a large problem into slightly smaller problems, then break those problems into slightly smaller still problems, et cetera. What I’m describing now is more of recombining these problems back into the larger problems. So two or three functions that are always called together can be called with the same function.

However, this doesn’t help, really, when I come back days or months later and stare at the project, what helps me the most is the documentation I included above each function and frequently within each line. As well as documentation during the “main processing part” of the project.

Sometimes, however, a project is too big for me to load entirely into memory; Wordpress is one example. It’s just too big for me to see all the pieces of it. And when I try to work on it, I can sense that I’m losing visualizations of projects I’m currently working on. Another time when a brain->computer analogy works well. I have to swap some of the projects I have in RAM down to disk in order to look at other problems. To keep from breaking a large project catastrophically, I have to have some understanding of the complexity of the entire project, so I build my way up from the smaller functions through the aggregate functions and then look at how the aggregate functions are applied to each other. This takes a lot of processing power, and usually about the time I have got the functions sorted out, something else more urgent will call my attention to real life, and I’ll lose my place.

So, how do we, we of perhaps smaller RAM, catch up and understand a larger project without it conflicting in our mind space with other projects and real life issues?

I don’t know. What are your suggestions?

RCS and Subversion

Posted on September 8th, 2007 in PHP by Russ

I’m a revision management junkie. Since I discovered it, I’ve been very pleased with subversion. I’ve even thought about setting up some code on a public svn server, but I don’t believe I have anything of interest to the general person.

Currently, one of my main clients uses Subversion for their normal development. However, I also wind up creating more one-off scripts for system maintenance; things like “compare this database list against the files actually on the disk” which are not part of the general development branch.

So, since each of these little one-off scripts might contain one or more scripts, and since the files will change over time as the goals get tweaked a little with each one, I started using RCS for these smaller development environments. This way, I have a record of what changes I’ve made, but I don’t have the overhead of the creation and use of a full svn repository.

Here’s what I do;
In the directory I’m working in, I create a new directory “RCS.” Then I ‘check in’ the file for the first time ‘ci -u $filename’ and enter a log entry (generally “initial import”). Since someone else might come along behind me and screw something up, I mean, change my file, I check it back out and leave it checked out until next time: ‘co -l $fiename’.

I’ve also started using the RCS Keywords within the file, which causes an interesting thing in my header. Since I’m trying to do “better” with regards to documenting the file, and since I’m trying to stick to the phpDocumentor style, I’m winding up using something like this:

* @version 0.7
* Revision $Revision$

Weird, huh? But I don’t think that the phpDocumentor @version keyword processing is compatible with the RCS $revision$ keyword processing.

The Keys to Arbitrage

Posted on August 21st, 2007 in PHP by Russ

This is the last post I’m making on arbitrage. I think my focus on it has been unhealthy and I’d rather encourage myself to pursue more interesting ways to make money.

  1. Keywords
  2. Domain
  3. Content
  4. Google Adsense code
  5. Hosting
  6. Google Adwords Advertising

I admit I took these steps primarily from this crazy experiment.

You’ll want to find a spot within these steps where you can shine. You can go down the steps here and look for what resonates with you. Keywords; do you know where or how to get keyword lists, especially with search statistics? How about Domains– can you register domains cheap enough to make your riches by selling domains? Or do you have the knack (and funds) for registering a bunch of domains regarding an up and coming hot topic? For instance, LinkedIn, the social network, is getting an IPO next year; what if you bought LinkedIn domains and speculated (like people do with penny stocks).

Are you any good at writing? How about churning out some content? And do you have the savvy to run a hosting environment? Maybe you could hunt out a niche of people who need hosts? ( take a look at adsense hosting for instance).

Next Page »