Links a webmaster should have handy, in case there is an urgent need to create a website overnight
mod_rewrite specific
http://www.askapache.com/htaccess/mod_rewrite-variables-cheatsheet.html
http://httpd.apache.org/docs/2.2/rewrite/rewrite_guide.html
http://httpd.apache.org/docs/2.0/mod/core.html
Color palettes to evoke specific moods
http://www.efuse.com/Design/palettes.html
Good Practices
http://webdesignfromscratch.com/current-style.php
http://www.sitepoint.com/article/fundamentals-web-design/
http://www.sitepoint.com/article/fundamentals-web-design/3/
http://www.andyrutledge.com/bad-layout-conventions.php
http://www.sitepoint.com/article/top-15-meta-tag-tricks/
http://www.devx.com/projectcool
W3C Validator
http://validator.w3.org/
#1: choose a correct doctype e.g.
Note: "transitional" DOCTYPE I cite doesn't include the URL of a DTD, or document type declaration. This is because using URLs in a DOCTYPE element sends some browsers, including IE, into Strict mode, defeating the purpose of the "transitional" DOCTYPE.
UPDATE: the resources got the author of this blog a win in a web design event.
Saturday, January 17, 2009
Sunday, September 21, 2008
iGoogle Sandbox for OpenSocial gadgets
#1: Register for your testing grounds http://www.google.com/ig/sandbox/
#2: Install the Developer Tools gadget and set up your optimal environment
http://tinyurl.com/5vwwaz
http://code.google.com/apis/igoogle/docs/igoogledevguide.html#dev_env
#3: Add demo friends (real people who sign up for your sandbox), if your gadget goes into the social realm and requests friends lists through API.(*)
#4: Use GGE (Google Gadget Editor) to write your experimental gadgets. Saves the trouble of uploading files to your own server, decent interface.
http://code.google.com/apis/igoogle/docs/igoogledevguide.html#gge
#5: Upload/manage gadgets through the 'My Gadgets' gadget that becomes visible after you've configured developer env (see #2)
Tip: If you're modifying and testing continuously, TURN OFF CACHING for your gadget
*: Currently, the iGoogle sandbox friends gadget is not working. It's not sending out any invitations or showing me the list of friends I've invited. I don't know what the devs get by ignoring the bug at the very entry point.
#2: Install the Developer Tools gadget and set up your optimal environment
http://tinyurl.com/5vwwaz
http://code.google.com/apis/igoogle/docs/igoogledevguide.html#dev_env
#3: Add demo friends (real people who sign up for your sandbox), if your gadget goes into the social realm and requests friends lists through API.(*)
#4: Use GGE (Google Gadget Editor) to write your experimental gadgets. Saves the trouble of uploading files to your own server, decent interface.
http://code.google.com/apis/igoogle/docs/igoogledevguide.html#gge
#5: Upload/manage gadgets through the 'My Gadgets' gadget that becomes visible after you've configured developer env (see #2)
Tip: If you're modifying and testing continuously, TURN OFF CACHING for your gadget
*: Currently, the iGoogle sandbox friends gadget is not working. It's not sending out any invitations or showing me the list of friends I've invited. I don't know what the devs get by ignoring the bug at the very entry point.
Labels:
experiment,
gadget,
gadgets,
google,
opensocial,
sandbox,
scripting,
tutorial
Thursday, September 11, 2008
Tag Clouds and Word Clouds
A tag cloud is something very new (considering the age of the technologies that it builds upon) but very catchy. It ought to be so, since it is simple enough to program and has great visual appeal.
Let's say you decide to display the 50 most popular tags for your pics or your articles or for what people search through your website right on your homepage.
You can do so using a long list.
You can do so using a more elaborate graph that plots the tags on their count.
You are, now, not far from being kicked by both who look for information as well as those who fall for aesthetics.
Nobody wants too much of facts. My day isn't gonna be any better looking through long lists and learning about occurence of each term and their spatial representation. Selfish me only wants to see them being of some use to myself. The tags should promote activity, not have people correlating their usage statistics to build their thesis. And that is where Tag Clouds drive home the point. They present the information in more novel ways; in ways that would catch your eye and become a navigational aid. One can find them on several websites and being used in many presentations where too much detail mean popping a sleep pill in your audience's glasses. Read the Wikipedia article for more.
They are really IMPRESSIVE to see and EXCITING to implement!
An article titled "Building Tag Clouds" by Jim Bumgardner (O' Reilly) piqued my interest into this stuff (On a personal note, I'd had a rough day and anything connecting back to my geeky days and ways was only waiting to be consumed). So I decided to implement a Word Cloud - something that takes in text, and presents the words visually weighted by their frequencies (much akin to the occurence of a tag). The method of operation was simple: Throw in any text and the rest is logic.
You get a nice word cloud. Put in random text, and its fun. Put in your emotions and its introspection. Put in your old diary entries and its retrospection.
Now only if my website server weren't down will I upload the slick file.
See and use SAoS' Word Cloud Generator. It uses regular expressions to extract individual words. The frequencies were extrapolated to font sizes using a log function, which helps to balance the graph visually otherwise some entries would be HUGE while some very small. The log function was a revealation, and its just plain maths! Spread the link around.
Let's say you decide to display the 50 most popular tags for your pics or your articles or for what people search through your website right on your homepage.
You can do so using a long list.
You can do so using a more elaborate graph that plots the tags on their count.
You are, now, not far from being kicked by both who look for information as well as those who fall for aesthetics.
Nobody wants too much of facts. My day isn't gonna be any better looking through long lists and learning about occurence of each term and their spatial representation. Selfish me only wants to see them being of some use to myself. The tags should promote activity, not have people correlating their usage statistics to build their thesis. And that is where Tag Clouds drive home the point. They present the information in more novel ways; in ways that would catch your eye and become a navigational aid. One can find them on several websites and being used in many presentations where too much detail mean popping a sleep pill in your audience's glasses. Read the Wikipedia article for more.
They are really IMPRESSIVE to see and EXCITING to implement!
An article titled "Building Tag Clouds" by Jim Bumgardner (O' Reilly) piqued my interest into this stuff (On a personal note, I'd had a rough day and anything connecting back to my geeky days and ways was only waiting to be consumed). So I decided to implement a Word Cloud - something that takes in text, and presents the words visually weighted by their frequencies (much akin to the occurence of a tag). The method of operation was simple: Throw in any text and the rest is logic.
You get a nice word cloud. Put in random text, and its fun. Put in your emotions and its introspection. Put in your old diary entries and its retrospection.
See and use SAoS' Word Cloud Generator. It uses regular expressions to extract individual words. The frequencies were extrapolated to font sizes using a log function, which helps to balance the graph visually otherwise some entries would be HUGE while some very small. The log function was a revealation, and its just plain maths! Spread the link around.
Labels:
folksonomies,
information,
presentation,
tag cloud,
visual,
word cloud
Friday, July 4, 2008
When users submit incomplete links, quite unknowingly so
I myself didn't notice this earlier...
If one creates a link to a page 'x.php' (e.g. <a href="x.php">), then the resolved address points to that page on the same website. To link to another website, you provide the full address, (e.g. <a href="http://www.saos.org/x.php">).
But if you provide www.saos.org or saos.org (no www) for the href attribute, the browsers don't transform it into an external link, quite logically so. It will point to yoursite.com/www.saos.org
This was something I came across while fixing up commenting on {ego}trips. If one put a sitename without http:// it would show up as a link local to our website, which is NOT welcome. There is nobody to blame, though.
Fixing this was simple, though. I just appended a http:// to those which were missing it, using PHP's parse_url() function.
Note: haven't checked, or tried to append www to the links without it.
If one creates a link to a page 'x.php' (e.g. <a href="x.php">), then the resolved address points to that page on the same website. To link to another website, you provide the full address, (e.g. <a href="http://www.saos.org/x.php">).
But if you provide www.saos.org or saos.org (no www) for the href attribute, the browsers don't transform it into an external link, quite logically so. It will point to yoursite.com/www.saos.org
This was something I came across while fixing up commenting on {ego}trips. If one put a sitename without http:// it would show up as a link local to our website, which is NOT welcome. There is nobody to blame, though.
Fixing this was simple, though. I just appended a http:// to those which were missing it, using PHP's parse_url() function.
Note: haven't checked, or tried to append www to the links without it.
//here is a sample list of links of varying types.
$urls = array('www.google.com', 'http://www.yahoo.com', 'microsoft.com', 'www.saos.org/x.php');
//here is where we transform, then output them
foreach($urls as $url) {
$parsed = parse_url($url);
echo '<a href="';
if(empty($parsed['scheme']))
echo 'http://';
echo $url;
echo '">'.$url.'</a><br />';
} //end of foreach loop
?>
Wednesday, July 2, 2008
exg anew
Started with exg - the 'thing' that drives {ego}trips on my website - once again, after almost an year. I was skeptical about getting a hold of the code again, but that wasn't much of a problem. I can easily understand my retard coding practices anytime.
I wished to make some changes, which I started to pen down (and simultaneously work upon a solution).
Change #1 was to put a 'latest uploaded galleries' listing on the homepage. Quite simple, isn't it? But again, generating relative rankings was a bit of a problem. There didn't seem any way that SQL would work. Ideal way to tackle it would've been through complex queries, but I chose to put PHP to use to do so.
That led me to discover some serious flaws in my earlier scripts, which notably had to do with relative ranking of image galleries (with respect to trips) and the consequent changes on enabling/disabling them. Not only did it lead to some errors but also exposed private galleries.
Then I came to realise that there was some problem in the clan page as well. Private galleries were also visible through the generated links. Fixed that as well.
By the end, my sheet was littered with headings:
Task
-Problem
--Problem
---Bigger Problem
----Added Problem
-Another Problem
--Existing Problem
-Still a Problem
Ended up jumping between code for about 3 hours. Quite a sudden change in my daily routine of idleness. Here's a small query to pull some stuff from the database. BEAT THAT!
Now I'll start with building the feature to upload docs for the trips, anything that helps.
I wished to make some changes, which I started to pen down (and simultaneously work upon a solution).
Change #1 was to put a 'latest uploaded galleries' listing on the homepage. Quite simple, isn't it? But again, generating relative rankings was a bit of a problem. There didn't seem any way that SQL would work. Ideal way to tackle it would've been through complex queries, but I chose to put PHP to use to do so.
That led me to discover some serious flaws in my earlier scripts, which notably had to do with relative ranking of image galleries (with respect to trips) and the consequent changes on enabling/disabling them. Not only did it lead to some errors but also exposed private galleries.
Then I came to realise that there was some problem in the clan page as well. Private galleries were also visible through the generated links. Fixed that as well.
By the end, my sheet was littered with headings:
Task
-Problem
--Problem
---Bigger Problem
----Added Problem
-Another Problem
--Existing Problem
-Still a Problem
Ended up jumping between code for about 3 hours. Quite a sudden change in my daily routine of idleness. Here's a small query to pull some stuff from the database. BEAT THAT!
select * from
(select @rn := @rn + 1 as rank, ptjoin.*
FROM (SELECT pm.perspective_id, pm.trip_id, t.trip_title, pm.title,pm.member_id,pm.member_name
FROM (
SELECT p.perspective_id,p.trip_id,p.title,p.member_id,p.created,m.member_name
FROM perspective p
INNER JOIN members m
ON p.member_id=m.member_id
WHERE p.trip_id = XXXX
)as pm
INNER JOIN trip t
ON pm.trip_id=t.trip_id
ORDER BY pm.created
) as ptjoin
) as rankedptjoin
where rankedptjoin.rank = XXXX;
Now I'll start with building the feature to upload docs for the trips, anything that helps.
Thursday, May 8, 2008
PHP Woes: Getting pspell to work
The pspell extension allows some language tools like spell checking and similar-word recommendations.
To get pspell working, Aspell is required. Aspell is an OpenSource spellchecker, that has become the preferred one, replacing pspell and Ispell. Only the name remains, pspell functions in PHP are waiting to be renamed to Aspell ones.
I'm listing out the following steps for a Windows-specific installation. This has nothing to do with the server you're using (IIS or Apache)
To get pspell working, Aspell is required. Aspell is an OpenSource spellchecker, that has become the preferred one, replacing pspell and Ispell. Only the name remains, pspell functions in PHP are waiting to be renamed to Aspell ones.
I'm listing out the following steps for a Windows-specific installation. This has nothing to do with the server you're using (IIS or Apache)
- Get the Windows port of Aspell from http://aspell.net/win32/ (v0.50.3 installer here)
- Alongside, download a language dictionary as well (English dictionary here)
- Install Aspell followed by the language dictionary
- Make aspell-15.dll and pspell-15.dll available to PHP by either
- Adding your Aspell bin directory (C:/Program Files/Aspell/bin in my case) to system's PATH variable OR
- Copying the files to your PHP folder (C:/PHP in my case), if your PHP folder is already listed in PATH variable OR
- Copying the files to windows folder (C:/Windows/) or system folder (C:/Windows/System32/)
- Enable the pspell extension in your php.ini file
- Open your php.ini (generally in the PHP root folder or in Windows folder)
- Firstly, make sure you have pspell.dll in your extentions folder (configured by variable 'extension_dir' in php.ini)
- scroll down to where your extensions are listed, and decomment (remove the semicolon) so it looks like extension=php_pspell.dll - doing so enables the extension
- Parsing of the ini file is cranky on some systems, so make sure that the above line goes to top of other commented/disabled extentions.
- Restart your server. It reloads the PHP module, which in turn reads the ini file and loads respective extensions again.
- Test if working: Saving as little code as <?php $pspell = pspell_new('en'); ?> in a script, and executing the script should do it.
Labels:
aspell,
installation,
opensource,
php,
pspell,
tutorial,
windows
Friday, December 7, 2007
MYSQLDUMP Cheatsheet
MYSQLDUMP CLI UTILITY CHEATSHEET
- you access mysqldump.exe through the dos prompt
- the file is located in bin folder of your mysql installation dir
General Format
mysqldump [options] db_name [tables]
mysqldump [options] --databases db_name1 [db_name2 db_name3...]
mysqldump [options] --all-databases
-----------------------------
normal: mysqldump -uUSERNAME -pPASSWORD db_name > file
nodata: mysqldump -uUSERNAME -pPASSWORD -d db_name > file
nocreate: mysqldump -USERNAME -pPASSWORD -t db_name > file
-----------------------------
TO IMPORT A FILE
mysql db_name < backup-file.sql
mysql -e "source /path-to-backup/backup-file.sql" db_name
-----------------------------
MYSQLDUMP OPTIONS
--quick: dumps tables row by row, instead of caching them into memory. --opt enablesit by default
--add-drop-database
--add-drop-table
--all-databases, -A: dump all tables in all databases. same as specifying --databases followed by names of all of em
--comments,-i: insert comments and addl info into the dump file
--extended-insert, -e : Use multiple-row INSERT syntax that include several VALUES lists. This results in a smaller dump file and speeds up inserts when the file is reloaded.
--host=host_name, -h host_name : Dump data from the MySQL server on the given host. The default host is localhost.
--ignore-table=db_name.tbl_name : Do not dump the given table, which must be specified using both the database and table names. To ignore multiple tables, use this option multiple times.
--no-create-info, -t : Do not write CREATE TABLE statements that re-create each dumped table.
--no-data, -d : Do not write any table row information (that is, do not dump table contents). This is very useful if you want to dump only the CREATE TABLE statement for the table.
--order-by-primary : Sorts each table's rows by its primary key, or by its first unique index, if such an index exists.
--xml, -X : Write dump output as well-formed XML.
-----------------------------
SHORTHANDS
--opt: --add-drop-table --add-locks --create-options --disable-keys --extended-insert --lock-tables --quick --set-charset
--compact: suppresses comments and enables --skip-add-drop-table, --skip-set-charset, --skip-disable-keys, and --skip-add-locks
-----------------------------
NOTES
- you access mysqldump.exe through the dos prompt
- the file is located in bin folder of your mysql installation dir
General Format
mysqldump [options] db_name [tables]
mysqldump [options] --databases db_name1 [db_name2 db_name3...]
mysqldump [options] --all-databases
-----------------------------
normal: mysqldump -uUSERNAME -pPASSWORD db_name > file
nodata: mysqldump -uUSERNAME -pPASSWORD -d db_name > file
nocreate: mysqldump -USERNAME -pPASSWORD -t db_name > file
-----------------------------
TO IMPORT A FILE
mysql db_name < backup-file.sql
mysql -e "source /path-to-backup/backup-file.sql" db_name
-----------------------------
MYSQLDUMP OPTIONS
--quick: dumps tables row by row, instead of caching them into memory. --opt enablesit by default
--add-drop-database
--add-drop-table
--all-databases, -A: dump all tables in all databases. same as specifying --databases followed by names of all of em
--comments,-i: insert comments and addl info into the dump file
--extended-insert, -e : Use multiple-row INSERT syntax that include several VALUES lists. This results in a smaller dump file and speeds up inserts when the file is reloaded.
--host=host_name, -h host_name : Dump data from the MySQL server on the given host. The default host is localhost.
--ignore-table=db_name.tbl_name : Do not dump the given table, which must be specified using both the database and table names. To ignore multiple tables, use this option multiple times.
--no-create-info, -t : Do not write CREATE TABLE statements that re-create each dumped table.
--no-data, -d : Do not write any table row information (that is, do not dump table contents). This is very useful if you want to dump only the CREATE TABLE statement for the table.
--order-by-primary : Sorts each table's rows by its primary key, or by its first unique index, if such an index exists.
--xml, -X : Write dump output as well-formed XML.
-----------------------------
SHORTHANDS
--opt: --add-drop-table --add-locks --create-options --disable-keys --extended-insert --lock-tables --quick --set-charset
--compact: suppresses comments and enables --skip-add-drop-table, --skip-set-charset, --skip-disable-keys, and --skip-add-locks
-----------------------------
NOTES
- --opt is on by default in v5.0 and up
- To disable certain features, use --skip-[feature name] e.g. --skip-extended-insert
- When you selectively enable or disable the effect of a group option, order is important because options are processed first to last.
- You can leave the password blank, it would ask for it upon the execution of the command
Subscribe to:
Posts (Atom)