RSS ? Recent Blog Posts

Blogs » Archive for February, 2005

Documentation, documentation, documentation

by Stuart Langridge

It is truly said that if you didn’t write it down, it didn’t happen. With that in mind, I’m going to talk about a JavaScript-based mapping service that isn’t Google Maps. Community Mapbuilder is “a range of resources to help organizations get started with standards-based online mapping”. A major part of what they offer is mapbuilder-lib, a set of client-side (and a little sprinkling of server-side) scripts which can talk to map servers using the OpenGIS standards and then display the resulting maps using JavaScript and XSL.

The Community MapBuilder demo may make this a bit clearer; it provides numerous zoomable maps, including a simple one of world countries and another of Mars (!). The zoomable map itself is inserted into the page unobtrusively by the included JavaScript.

This is all standard stuff; it’s a good application of techniques, but the techniques themselves are fairly well-known. The interesting point about mapbuilder-lib is that it’s pretty heavily documented. In addition to some overview technical documentation, the MapBuilder team have provided full and complete API documentation for the whole library, which is really rather helpful for people who are looking to implement mapping applications using MapBuilder. The API documentation is created using JSDoc, …

 

Just another brick in the wall

by Stuart Langridge

Hello, world!

No, I’m not Simon Willison. Not this time.

Please allow me to introduce myself: I’m a man of wealth and taste, as the bard has it. I’m Stuart Langridge, and Simon and I will both be posting to Stylish Scripting. I’m the author of SitePoint’s upcoming book on DOM scripting and DHTML and all that lovely stuff; some people may also know me as the bloke behind kryogenix.org. You’ll hear from me about cool things that people are doing with JavaScript and the DOM, with CSS, with modern client-side web techniques. People scripting stylishly. Let us begin.

 

User Errors in PHP

by Thomas Rutter

The trigger_error function in PHP allows you to generate a PHP error on demand. If you haven’t used this function before, you may be asking, “Why would you want to generate an error?” Well, it is a much more flexible solution than using exit or die to display your error message.

Often, while editing legacy PHP code, I come across error handling for situations such as database connect errors:

$dbconn = mysql_pconnect($myhost, $myuser, $mypass);
if (!$dbconn) exit(mysql_error());

Or, the lazier version:

$dbconn = mysql_pconnect($myhost, $myuser, $mypass)
or die(’yikes’);

The problem with this approach, which uses exit (or its alias, die), is that it doesn’t give PHP a chance to use its own error handling method. It will always terminate the script and print its little error message to the screen.

So, for example, you won’t be able to turn the error messages on or off with the php.ini directive display_errors, you won’t be able to log the error to your error log with log_errors, and you won’t be able to use your own custom error handler function.

Why is this a bad idea? Well, on a live server it is sometimes a security risk (and an embarrassment) if your error messages are displayed …

 

Key questions to ask regarding partnerships

by Andrew Neitlich

Thinking of forming a business venture with a partner? Here are some key questions to answer BEFORE you get going:

1. How much money will each contribute? (Hint: Both should contribute equally. Avoid sweat equity situations as one partner will become resentful of the other).

2. Is equity ownership equal? (Hint: It is best to have equal ownership to avoid disputes and resentment?

3. What is one partner wants out? (Hint: Penalize a partner for wanting out. Don’t reward him or her. Suggestion: Appraise the enterprise at point one partner wants out. That sets the price. But payment happens within 5 years of that point, at a 10-20% discount to the set price.)

4. What if one partner isn’t holding his/her weight? (Suggestion: Give 30 days to correct, and then set up buyout arrangement similar to #3).

5. What happens if partner dies and has spouse/family? (Suggestion: Let shares pass to spouse, or buy spouse out at market. But spouse has no voting rights, and can only sell his/her share with written approval of other partner).

6. What is initial capital contribution? (Hint: Make it equal, put it in a bank account, and draw ALL expenses out of that account).

7. Once profits appear, do you reinvest …

 

Fun with Google Maps

by Simon Willison

Google Maps launched a couple of weeks ago, and is another dramatic victory for dynamic web applications. If you haven’t seen it yet, go check it out (IE/Windows or Firefox/Mozilla only at the moment, but Safari support is “coming soon”). It’s a really impressive piece of work, with the main “wow” factor coming from the dynamic panning - just drag and drop to move around the map, with new map tiles loading seamlessly in the background.

Other features include smart route plotting (search for washington dc to chicago for an example), keyboard navigation and integrated search results from Google Local. It’s already giving established map sites a run for their money, with its only real weakness being a complete lack of coverage of areas outside of North America.

But how does it work? Look under the hood and you’ll find a surprising mix of technologies. Remote scripting (communicating with the server without reloading the page) is achieved using both XMLHttpRequest and invisible iframes, with the iframes used because unlike XMLHttpRequest they integrate sensibly with the user’s back button. Add to that both XSLT and VML (Microsoft’s SVG alternative, introduced before the SVG specification was standardised) and you’ve got one of the most …

 

Review: Linux Server Security

by Blane Warrene

Staying on my current security theme, O’Reilly has published a second edition of Linux Server Security by Michael D. Bauer. The book, targeted toward those managing Internet-connected systems, also known as bastion hosts, packs a powerful arsenal of security design, theory and practical configuration schemes into 500 pages.

Bauer gained some notoriety from his Paranoid Penguin columns in the Linux Journal Magazine, which ultimately inspired the book.

What stands out prominently is the time Bauer took to introduce network security design and risk management before digging into the hands-on nuts and bolts. As business models change for web professionals, many developers find themselves donning at least a part time system administrator’s hat. Understanding how underlying network designs work and how specific configurations can prevent attacks are critical before jumping into a command shell and making changes on a production server.

Bauer used some popular Linux distributions to base his security research on, including Red Hat, Fedora, SUSE and Debian, though much of the material covered should work fine on most distributions and BSD. For those who are familiar with the first edition from a few years ago, the author has revalidated much of the existing content and also added content for:

  • LDAP for …
 

Designer’s Wishlist: Touch Sensitive LCD Display

by Alex Walker

Here’s something to start your week off feeling grumpy and unfulfilled for not having one.

Forget those common daydreams involving garden-variety 21″ LCD monitors — it’s time to upgrade those daydreams as you take in the elegant lines of Wacom’s soon-to-be-released Cintiq 21UX Interactive Pen Display.

Apparently this 21.3″ touch sensitive LCD display ‘offers more screen area, greater pressure sensitivity, better pen control, higher resolution, and increased comfort over previous models’.

I personally found even using a normal pen/tablet was a revelation after years of standard ‘mousage’. While the fine motor skills dexterity is awesome for retouching and the like, the real difference I found was the quality of the line you produce. Essentially ‘mouse drawing’ comes from small movements in the wrist. These muscles are really good at manipulating small objects by small amounts — tasks like watchmaking or sewing — but aren’t particularly good with smooth fluid actions.

Tablet drawing, by comparison, forces you to work from the shoulder and elbow. The effect of this is to give your lines a big, natural flow and weight that is very hard to achieve with only a mouse. In fact, there are great photos of Picasso working with his …

 

Linux System Administrator’s Schedule

by Blane Warrene

My recent post on benchmarking Linux system security generated a question about my procedures for maintaining Linux system health. Aside from some specific procedures based on special needs of some clients, I have noted a few odd tasks and then broken down my routine in a daily, weekly and monthly schedules.

There are a few things I only do on occasion such as quarterly user audits, house cleaning on administrative storage directories (downloads, patches, odds and ends) and quarterly backup restore tests. The latter every administrator should do at least twice annually - literally testing a restore from tape, disc or online storage to insure your backup processes are working properly.

One final quarterly tasks is flushing old Apache access logs, where applicable, off of the backup server as some of them chew up gigabyte after gigabyte of space.

As some background, a majority of the Linux servers I manage are not all in my own data center or from one client by spread all over in different environments. I still have managed to maintain a limited number of operating system builds and configurations so I do not create chaos as a system administrator. I also spend most of my time …

 

Search Terms, Competition, and Keyword Metrics

by Dan Thies

Search engine marketing can be a very complicated business, folks. You can oversimplify it all you like… or you can make it a lot more complex than it needs to be. Either way, it all begins with search term strategy. When I think of search term strategy, I see a lot of factors in play, but let’s start with these:

Relevance: When I speak about the relevance of a search term, I’m really asking a simple question: what percentage of folks using that search term are actually interested in what your website has to offer? When I say interested, I mean someone who is ready, willing, and able to take action or buy. Relevance can vary seasonally - people may search for ski lodges in the summer, but they are less likely to actually make a reservation.

It is possible to improve the relevance of a website, and along with it the relevance of a search term. This can be accomplished in a number of ways, such as adding content, or changing the landing page where searchers arrive. Website owners often overestimate the relevance of extremely general search terms, but there are some simple methods you can use to get better estimates.

 

Accessing the PHP Manual, Quickly

by Thomas Rutter

This is Thomas Rutter, currently filling in for our regular PHP blogger Harry Fuecks. While Harry’s away we’ll be treating you to the writings of a number of SitePoint’s resident PHP-ers in this space.

If you have a memory like mine, you probably find yourself consulting the PHP manual frequently, in one way or another. I find myself repeatedly re-visiting certain pages in the PHP manual. For example, I frequently have to look up the string format for the date function, the order of the arguments in functions such as in_array and strpos, and how to use the $_FILES array when handling file uploads.

In the case of in_array and strpos I believe my frequent confusion is justified:

bool in_array ( mixed needle, array haystack [, bool strict] )
int strpos ( string haystack, mixed needle [, int offset] )

The positions of the ‘needle’ and ‘haystack’ arguments in PHP functions are inconsistent. However, this is a topic for another blog post.

What it boils down to, is that for one reason or another I frequently need access to the PHP manual to look up little details.

The Quick Reference Tips page at php.net contains a number of tips for accessing the PHP manual …

 

Sponsored Links

SitePoint Marketplace

Buy and sell Websites, templates, domain names, hosting, graphics and more.

Logo Design, Web page Design and more!

99designs

  • Custom logo designs created ‘just for you’.
  • Pick the design you like best.
  • Only pay if you’re satisfied with the result.

It's Back!
FREE PDF with any printed book!