Discussions (53)

Firefox 2.0a3 (BonEcho) for Mac

I like what I see. It’s not quite polished, but it’s surprisingly mature for such an early release.

  • It’s fast, even w/o being a native PPC G4 buld like DeerPark (3rd-party FF build). I’d even go as far to say that it’s faster than my beloved Safari.
  • Doesn’t choke. Test: myspace. Most browsers I try choke pretty easily on the crappy MySpace pages.
  • Tabs can be reordered. You heard me right. Tabs can be moved around the tab bar as you wish. Safari users who are used to switching between tabs with Cmd-Shift-arrow left/right will need to use Cmd-Opt-arrow left/right in Firefox.

As expected my plugins/extensions aren’t compatible with this release, but I’m sure update will be ready sooner or later, especially now that the browser is in alpha. Did I mention it’s fast? It’s even faster than Safari, which is surprising, considering previous versions of FF were slow unless you found a build for your processor (i.e., the G4 DeerPark build).

I didn’t find any errors or inconsistencies on the small numbers of sites I’m testing this build on this morning, though I should make sure to give much credit to the app for not choking very much on MySpace pages. Even when the browser is waiting for data from the servers or is figuring out complex layouts it’s still very responsive, for the most part.

Find BonEcho here.
If you want the current FireFox release builds for the PPC G4 and G5 processors, go here (seriously – TONS faster than the native FireFox builds from the FF people).

Smarty: sections and iterators

Just wanted to point this out to any who may be interested, or can’t seem to figure out how to hop around array indices in the Smarty template.

In straight PHP it’s simple enough to bounce around to different array indices $array[$ii-1] etc. In Smarty, not so easy.

If you want to compare the current array member’s value to the one previous, you have to use a special modifier/keyword in your template: index_previous. Likewise you’d use index_next for the next index.

{section name=ii loop=$people}
{$people[ii].name} is {$people[ii].age}
{if $people[ii.index_prev].age < $people[ii].age}
{$people[ii].name} is older than {$people[ii.index_prev].name}

You can find more info on Smarty sections HERE.

Glossary links, anyone?

We’ve all been to those sites before – the ones that dubiously insert advert links on keywords throughout the page. It’s pretty annoying because they often have nothing to do with the reason(s) why you were on that page to begin with. So now here I am, telling you how to do it easily. But I assure you – my intentions are completely pure!

The task: Link glossary terms to some educational material (coming from a database).

1) Pull your list of terms from the database into an array. Call it $glossary_terms

2) Run a preg_replace command on your page content:

$updated_content=preg_replace('/b('. implode('|',$glossary_terms). ')b/i',$replace,$content);

3) Display the $updated_content link instead of the original $content.

preg_replace() takes either strings or arrays as input, which is really helpful in situations like this where you have an array of terms to which content gets checked against.
The b modifier signifies word boundaries (spaces, punctuation, etc).
The i modifier tells to a case-insensitive search.

Thanks go to xblue and MarkR on PHPBuilder.com for the pointers (especially xblue for pretty much just handing me the answer!).

Google, search engines fat on SPAM?

I recently read an article in The Register about Google’s recent issues with the massive amounts of spam online. Let’s just be honest moment here: SEO is great but it’s exploited WAY too much on what I would consider illegitimate websites. You know – the ones whose sole purpose is for the display of advertisements, portals, etc.

Here’s an idea: Let’s apply a Web 2.0 ideology to our searches in much the same way we see sites like Slashdot, Digg, and Newsvine moderate reader comments. One crucial difference: we don’t necessarily elevate page rankings for any given page – that task is to be completed as it’s always been done. Rather, those irrelevant sites should probably suffer de-listing if enough users give it a thumbs-down based on the nature of the content. Before you begin explaining the counter-arguments, let me save you some keystrokes. What happens if users begin thumbing-down legitimate sites based on their personal viewpoints and beliefs, on the basis of competition, or other that’s-not-the-point-of-this-self-regulating-system reason? Maybe one way around it is to flag the page (or even domain) for review by a select group of people. People could first earn the title of moderator, then even earn rewards for proper moderation, as reviewed by peers (those who want to be moderators?). Either way, it’s a community approach to regulating the quality of search results.

…just ideas I had while reading the article. I’m tired of all the junk on the net and in my email.

Semantic Research: Knowlege Organization

My lab had the opportunity to meet with the folks over at SemanticResearch. Overall, definitely a very intriguing company. But first things first: their offices are located IN the MTv Real World San Diego house, which as some of you might know – is awesome! I really don’t know how they get any work done in such a great view of the harbor.

You may be here to read about the company, but I think you’re probably more interested in hearing about what they (and other companies like them) do. In its simplest form, you create a web, a network, between nodes (typically a noun) by defining certain pre-determined relationships between them (verb). By combining many nodes and their relationships you create something akin to a web. Its usefulness is seen when you find links between two unrelated nodes.

Here’s a brief example, of which I’ll use the following notation:

[John]---(friend of)---[Mike]
[Mike]---(friend of)---[Anthony]
[Anthony]---(owns)---[beach house]
[beach house]---(has address)---[123 Prospect, La Jolla]
[condo]---(has address)---[456 Pearl., La Jolla]

So what’s the relationship between these two seemingly unrelated homes in La Jolla? Ok – it’s pretty easy to see in this example, but imagine a social network with 5,000 nodes where you’re trying to determine the relationships between two individuals.

We definitely look forward to working more with SemanticResearch on incorporating some of their ideas into the DFL. We’ll have 800-100 fish, with several different habitats, and several other defined relationships (e.g., predator/prey, host/parasite, etc).

Cross-browser CSS

I must admit – it’s only been recently that I began creating sites almost exclusively favoring CSS over table layouts. I’m starting to get it, and it’s great! There’s one problem with using CSS: different browsers render pages differently… very differently in some cases.

I choose Safari and Firefox when I’m first building a layout because I know they adhere to standards (Number 1 and 3 top “winners” of the Acid2 tests, respectively). As one would expect, Internet Explorer has some rendering issues issues. But why do I say that? Firefox, Opera, and Safari generally render pages quite consistently, whereas IE does not.

Here are some general tips that I’ve learned over the last few months now that I’m becoming more of a HTML/CSS jockey again.

  • Do initial development for Safari, Opera, and Firefox (SOF).
  • Keep separate stylesheets: One for IE, and another for SOF (or other Acid2-compliant browsers)
  • Use browser detection to load the proper stylesheet(s). Server-side or javascript work.
  • Be patient. Don’t be frustrated if you can’t get both versions to look *exactly* alike. There’s often a level that’s “good enough.”

Browser detection script…

<script language="JavaScript">
var browser=navigator.appName
if(browser =="Microsoft Internet Explorer")
document.write('<link href="/path/to/stylesheet_ie.css" rel="stylesheet" type="text/css">')
document.write('<link href="/path/to/stylesheet.css" rel="stylesheet" type="text/css">')
<link href="/path/to/stylesheet_ie.css" rel="stylesheet" type="text/css">

Notice that I chose the Internet Explorer stylesheet as my default if no javascript is enabled. It’s simply because the market is dominated by IE and not Firefox, so the odds are in your favor.

Take Note…

How to Drive your Website Developer Insane: A Primer

This is great – one of those blog entries you just read and shake your head because you’ve been there before…

Security: Don’t blindly trust $_SERVER variables

Article one: Chris Shiflett: SERVER_NAME Versus HTTP_HOST
Article two: Sean Coates: XSS Woes

I thought both were quite insightful, though Sean’s stands-out more because PHP_SELF is used so often (be sure to check-out his phpinfo(); example at the end of the post). One method, as he explained, is to put the $_SERVER[‘PHP_SELF’] variable into htmlentities() so at least you aren’t potentially echoing dangerous output.

Heed Chris’s advice: treat $_SERVER variable just as you would $_GET and $_POST – all have the potential to be tainted.

The state of PHP Frameworks

Below is a comment I posted on a friend’s dev blog. Looks like he’s turning RoR because RoR just seems pretty sweet to him (originally a Perl programmer, so he welcomes the improvements Ruby’s brought to the field). Just a bit of background: Doug is my right-hand man on Flood’s new website. He’s pretty new to PHP, but has done a really good job picking it up. I should also mention he’s a FANTASTIC DB guy. If you want to query it, he can probably figure it out.


PHP has several pretty good frameworks, but that shouldn’t be a problem for people in the PHP community. We’re used to having options, and lots of them. After listening to a few talks about the new Zend Framework, I think it’s going to be a pretty big deal fairly soon. What’s most exciting, for me at least, is the fact that the community isn’t being snobbish about the ways things should be done – they aren’t sticking to any one game plan (like copying one language or another). Rather, they’re pulling the best features from many languages and combining them into the framework. So RoR may be great, but it also has shortcomings to it, which the ZF community is making sure they don’t repeat.

RoR has some great things about it, or so I hear. I don’t doubt it one bit, but there is soon to be stiff competition from the PHP end. I also like to console my self, knowing that the RoR camp tends to have a few very vocal cheerleaders, so maybe it’s not as big as it may seem. But for now, Ruby just happens to have the “best” (most developed?) framework on the web. I say good for Ruby. In the end what matters most is that FOSS becomes better by building on the strengths of other projects.

–end post–

Most popular posts

So far it looks like my NVDIA Fedora Core 4 video driver install post is by far the most popular. Before we know it, I’ll probably end up doing a Fedora Core 5 NVIDIA video driver install tutorial (though I can’t imagine it would be much different).

Coming in a close second is the rsync backup tutorial from not so long ago. It has actually been working really well so far. The scripts run faithfully at their predestined times and about 2.5 hours later I have a full backup.

A distant third is the Zend Framework review I wrote. Honestly, there probably aren’t a whole lot of people interested in the topic, and I could have done a better job. There just seemed to be some problems installing it that went unresolved (and I didn’t quite have the time to figure them all out before my mini review). I have some new fodder for discussion, though, now that my good friend Doug is now developing a site in RoR for work.

Please comment on the content of this blog. I’d really like to begin posting more about things people are interested in. Certainly I’ll continue to post on all sorts of things I find myself doing, but it also wouldn’t hurt to expand on some more than others. One thing to come will be deploying a site on a 50-node rackmount server farm for the DFL. We’re not using 50 nodes because we think we’ll have enough web traffic to utilize that much horsepower. Rather, it’s for web-based scientific computing – all controlled through the PHP-based site.

So… let me know what you want to see!