Posts Tagged ‘easy’

Php:Variable variables

Tuesday, July 1st, 2008

A variable variable looks like this: $$var

So, if $var = ‘foo’ and $foo = ‘bar’ then $$var would contain the value ‘bar’ because $$var can be
thought of as $’foo’ which is simply $foo which has the value ‘bar’.

Variable variables sound like a cryptic a useless concept, but they can be useful sometimes. For
example, if we have a configuration file consisting of configuration directives and values in this
format:

foo=bar
abc=123
Then it is very easy to read this file and create corresponding variables:

<?php
$fp = fopen(’config.txt’,'r’);
while(true) {
$line = fgets($fp,80);
if(!feof($fp)) {
if($line[0]==’#’ || strlen($line)<2) continue;
list($name,$val)=explode(’=',$line,2);
$$name=trim($val);
} else break;
}
fclose($fp);
?>
Along the same lines as variable variables, you can create compound variables and variable
functions.

<?php
$str = ‘var’;
$var_toaster = “Hello World”;
echo ${$str.’_toaster’};
$str(); // Calls a function named var()
${$str.’_abc’}(); // Calls a function named var_abc()
?>

PHP:Easy Way to Optimize Database Table

Saturday, June 28th, 2008

dbConnect()
$alltables = mysql_query(”SHOW TABLES”);

while ($table = mysql_fetch_assoc($alltables))
{
foreach ($table as $db => $tablename)
{
C(”OPTIMIZE TABLE ‘”.$tablename.”‘”)
or die(mysql_error());
}
}

PHP:Easy Way to List Directory Structure

Saturday, June 28th, 2008

$path = “/home/user/public/foldername/”;
$dir_handle = @opendir($path) or die(”Unable to open $path”);

while ($file = readdir($dir_handle)) {
if($file == “.” || $file == “..” || $file == “index.php” )
continue;
echo “<a href=\”$file\”>$file</a><br />”;
}
closedir($dir_handle);

Firefox:Clear Private Data

Friday, June 27th, 2008

Clear your private data automatically—with just one click or a keyboard shortcut. Your info is gone for good—on your own computer or the one at your local library. It’s that easy.

7 Tips to Improve Your Website Design

Saturday, June 21st, 2008

1 — Fast Loading Pages

Pages should load fast. Most people will leave your site if it’s not done loading in ten or 15 seconds. And even if you have a fast internet connection, not everyone does and 56k modems still exist.

2 — Easy to Read Text

Text should be easy to read. The text size should be big enough, and the background should not obscure your text. If you want to be safe, use black text on a white background. If you want more color, choose very carefully to make sure it’s still easy to read.

3 — Intuitive and Easy to Navigate

Your website should be easy to navigate. Each link should be clearly identified as such and graphic navigation elements like buttons and tabs should be easy to read and use. You do not want people leaving because they could not figure out how your Flash menu works.

4 — Consistent Layout

Your layout and design should be consistent. If you switch between styles too much, you will confuse your visitors. If the design is too different, people will believe that they are now on a different website since the layout changed.

5 — Less is More - Sometimes…

Avoid music and sounds. Very few people like to have music forced on them while they navigate, especially if they are already listening to music or surfing at their job! If you really cannot do without music, turn it off by default and ask visitors to start it themselves.

6 — Pay Attention to Browser Compatability

Design for browser compatibility. Many people do not use Internet Explorer on Windows. Make sure your site is at least viewable in Mozilla Firefox and Opera (if possible, you could even try testing on a Mac). Sites that target markets like technology should be more careful, since readers are more likely to use the newest browsers and gadgets like PDAs.

7 — Screen Resolution - Still Matters

Design for all screen resolutions. You may like to surf in 1240×1080 with your new screen, but some people still use 800×600, or even 640×768! A site that looks perfect in high resolution may turn out to be impossible to view correctly in 800×600.

This is just a begining to what I hope will be a growing list of web design tips (please submit tips through comments) and one that evolves into more advanced design tips. Please provide some feedback and tips of your own so I can get a better sense of the level of our readership.

20 Tips For Good Web Copy

Thursday, June 19th, 2008

Clean is better. Eye-tracking studies say so. Web copy should be bulleted, concise, easy. Photos should be informative, not decorative. White space is good. And guys like looking at George Brett’s protective cup.

You weren’t expecting that last part were you?

I wasn’t either. But this post on effective news article design proves it.

Newspapers have had trouble transitioning from print to the Web. They’re used to doing things differently.

Me, too. I still write difficult, dense copy. See. I still like serif fonts better, too. I also have a pen collection and a wall map fetish. Because I’m old school sometimes.

Well, most of the time.

Laura Ruel and Nora Paul (link above) interviewed people from Nielsen/Norman group about readability and user satisfaction and comprehension.

They said users spent more time reading wordy content, but remembered 34 percent less than when they read really tight copy.

That’s because of the way people read on the Internet. It’s the same reason designers on the Internet use sans serif fonts –so you can read faster.

“If a user is comfortable,” said Nielsen researcher Tara Coyne, “not hindered by clutter and superfluous words, and can scan the main points, he will get the summary of the article quickly and easily.”

Superfluous is superfluous, but it’s not her fault, she’s an academic type. It’s also otiose, but we’ll just call it ‘excessive,’ because it’s easier.

Ruel and Paul said people don’t really look at pictures, either, unless they’re pictures of real people and not models. People like pictures that give them information. They skip pictures that are just there to be pretty.

Also, women might be telling the truth when they say size doesn’t matter. All the men in the eye-tracking study fixated on George Brett’s…strike zone. But women didn’t. Not at all.

So, add this to the other things we know about Web copy and design. Here’s a short list to help you remember, bulleted and subtitled like it’s supposed to be.

20 Things To Remember For Good Web Copy

1.    Tight writing. That doesn’t mean bad or easy writing.

2.    Copy of about 600-800 words is better for SEO and catching the long tail of search.

3.    Title – Subject – Support, in that order, like subject, verb, object.

4.    Titles should be snappy and informative – clickable, but clear.

5.    Leads (first sentence or paragraph) should get to the point. Tell the reader what the article’s about first thing.

6.    No fancy, wordy intros where it’s not clear what you’re talking about.

7.    Information beats fluff every time. Pretty is for books and newspapers (and only sometimes).

8.    Information does not beat style every time. Style keeps people awake.

9.    Sans serif fonts are easier and faster to read on computer screens.

10.    White space is awesome – even better than big, pretty pictures.

11.    Content should be scannable.

12.    Think in bullets and subtitles.

13.    People like lists.

14.    Pictures should be specific and informative, not generic, decorative and ad-like.

15.    Photos should be relevant to content.

16.    People in pictures should look friendly and approachable (and have their whole head).

17.    Photos should be full body if possible (so guys can check out packages and stuff).

18.    Spell stuff right. It makes you look smarter.

19.    Grammar IS important. Unless you’re not really a professional.

20.    Online press releases should be even tighter than Web copy.