Saturday February 11, 2012 @ 10:02:47 GMT+10    ( Weather:  n/a )
Home » Weblog Archives

Powered byD's Bloggie
Weblog Archive browse by category ...
 → Category :
Display order:
Page 1 of 2   ( 12 entries , showing 1 - 10 )
    1 2 Next  

Site accessibility updates - 11:40 pm
The <link>
Site Issue , Site Updates , Standards  -  poster 

Some updates to my site. I added a horizontal navigation menu on the top. Added additional <link> tags in <head> so that some browser can pick it up and display it in navigation bar for accessibility. Examples of them are 'Home', 'Help', 'Author', 'First', 'Previous', 'Next', 'Last'.

Also added an "About" page to my site. Read the about page.

Mozilla Editor - 4:09 pm
Browser , Computing , Internet , Standards , Website Intro  -  poster 

via woeisiong:

It seems that Mozilla is building it's own editor. I suppose that's a WYSIWYG (What You See Is What You Get) web-based editor.
Quote:
The Mozilla editor provides HTML and plain text editing functionality in Gecko-based applications.

This is a good thing to FireFox and other gecko-based browser... BUT, what about IE and Opera ?? They aren't gecko-based. Does that means that they will not be able to use it ?? hmm ??

I've seen a few WYSIWYG but most of them are pretty buggy. They all consist of "complicated and sophisticated" things (codes, lol) in it, but they have the problems of cross-browser-compatibility.

Anyway, aren't those WYSIWYG editor and BBCode tags exists solely for one purpose ? To make lazy people's life easier =)

Visit the Mozilla Editor and the live demo (Note: I got a feeling the demo page is out-dated).

Last edited: Sun 2005-12-18 @ 02:01 , by DaRen 2 time(s)

RSS - 4:11 pm
Computing , Internet , Site Issue , Standards  -  poster 

Lately I'm interested in RSS and I'm considering to prioritize and make it the first thing on my todo list.

RSS

(Really Simple Syndication) A syndication format that was developed by Netscape in 1999 and became very popular for aggregating updates to blogs and the latest news from Web sites. RSS has also stood for "Rich Site Summary" and "RDF Site Summary."

RSS is a family of XML file formats and the information is delivered as an XML file called RSS feed, webfeed, RSS stream, or RSS channel.


Drop me a line if you know any good PHP RSS parser/reader/aggregator. I'm also interested in RSS feed generator in PHP. I wanna learn more about RSS feed and put up a feed on my site.

Some feed parsers that "looks" good among others:
  • Magpie RSS - packed with hell lots of features and functions, used by alot of RSS software
  • LastRSS - light weight RSS parser
  • Lilina News Aggregator - some sort of feeds on feeds, using Magpie library
  • Tiny Tiny RSS - not tiny at all, web based RSS reader works like desktop version. Using Magpie library

Feed generator/writer:
... haven't test them though..

New design approach - 2:54 am
Coding , PHP , Site Issue , Site Updates , Standards  -  poster 

I'm updating my site again. I've been working on the core functions / classes. Yes, the CORE part... The major ones are like user authentication and database connection. I've unified all database access under one global variable, avoiding multiple DB connection objects created locally (class/function scope). The good thing about ? it saves memory and I can know how many SQL queries are made to construct a page. Scroll down to the very bottom and you can see how like "N queries made". Quite surprising though... some pages used like 35 SQL queries... o.O omg... gotna refine them later...

My current approach [ Hide ]
[ Highlight ] [ Text ]
-------site_management.php---------------
// The class of "everything", contains db connection
// and other authentication
class site_management
{
    var $DB_OBJECT;
    function site_management()
    {
        // Let's say MYSQL_DB is your class that contains
        // all functions to access/manipulate the database
        $this->DB_OBJECT = new MYSQL_DB();
    }
}
 
-------foo.php--------------------
// Some class that requires access to database
class foo
{
    // Internal database connection object
    var $_db_object;
 
    function foo()
    {
        // If global variable $SITE->DB_OBJECT exists, make reference
        // to it otherwise instantiate a new copy locally
        if (isset($GLOBALS['SITE']) && $GLOBALS['SITE']->DB_OBJECT)
            $this->_db_object =& $GLOBALS['SITE']->DB_OBJECT;
        else
            $this->_db_object = new MYSQL_DB();
    }
 
    function bar()
    {
        // You need to perform sql query here
        $this->_db_object->query($sql); // for example
        // ...
    }
}
 
------test.php-------------------
// The above two class is located in different files
// and below is also in a seperate script file
<?php
    $SITE = new site_management();
    $foo_obj = new foo();
    $foo_obj->bar();
?>


My old way [ Hide ]
[ Highlight ] [ Text ]
-------foo.php--------------------
// Some class that requires access to database
class foo
{
    // Internal database connection object
    var $_db_object;
 
    function foo()
    {
        // Instantiate a new copy locally
        $this->_db_object = new MYSQL_DB();
    }
}


Let me know what you think about this. You can also leave me a message here.

Read more about referencing global variable:
http://www.php.net/manual/en/language.references.whatdo.php
http://www.obdev.at/developers/articles/00002.html

In authentication part I removed ALL spaghetti-style-redirection when transfering a user through a login/logout. In short, no more hidden values inside <form> to track user, session is used instead. Clean code and it works! Hopefully things will work fine... even though I'm extremely carefully when touching the core part, because almost everything are built on top of it.

You should also have notice the "N visitor(s) online now" thing on the left navigation menu. Although most of the time there is only 1 visitor, me myself lol Talking about the navigation menu, I'm adding options to show/hide the menu with javascript. See that red button with a 'X' ? That's what I'm talking about.

Others updates are misc and minor updates in template/admin control panel.

Redirecting with PHP header() - 11:41 pm
Browser , Bug , PHP , Site Issue , Standards  -  poster 

On the redirection of shoutbox, I've made 2 mistake causing it unable to work on some browsers, example IE 6. In PHP, to do a redirection is very simple.

[ Hide ]
[ Highlight ] [ Text ]
header('Location: http://domain.com/index.php');

However, don't do this [ Hide ]
[ Highlight ] [ Text ]
header('Location: http://domain.com/index.php');
die();


It seems logical if you put a die() after header('Location'). But the truth is, NO you shouldn't ! It will screw your code !
Took me some time to notice the problem. Not sure about header('Refresh') though, I'm calling die() after header('Refresh') and it seems running without problem.

Also remember to use absolute URI for the header instead of relative URI. Browser like Opera accepts relative URI but IE and Firefox ain't too friendly to it. That's the 2nd mistake I've made.

Time zone! Oh come on... - 2:43 am
Bug , PHP , Site Issue , SQL , Standards , Web Hosting  -  poster 

I'm tired of dealing with time zone thing on this server... all my blog entries and calendar don't work out like what I expected... so there's the conversation between me and 100Webspace support team:
Quote:
31 October 2005
Me: Hi. I've noticed that PHP is using GMT+2 time zone but MySQL is set to use GMT+3 time zone. On top of that, apache log is using GMT+3 time zone. Can the time zones be standardized ?
Support: Finding a solution of your problem requires a consultation with our administrators. I have forwarded the issue to them and we will send you our answer as soon as we receive their instructions. If you have any additional questions, do not hesitate to ask. Meanwhile just wait for our next response.
Me: Hi. Thanks for replying. I'll wait for the next reply.
Support: We will contact you when we have solution about this issue.
01 November 2005
Me: Hi. Just wondering hows the progress.
Support: Our administrators haven't replied yet, I will remind them about this issue.
07 November 2005 (a week later...)
Support: The server time is now correct, sorry for the delay.
11 November 2005
Me: (revived) *geez* ... *checking back the access log*, found that the admin already response to it and standardize all the timezone on 31 October as soon as I made the post, but some how the reply from support team reaches me a week later...but at least they still reply, ain't that a good thing ? ;)

Shouldn't they take care of this in early stage when server is set up ?

Major site updates - 3:12 pm
Browser , Site Issue , Site Updates , Standards  -  poster 

Recent site updates:
  • fully XHTML 1.0 compliance (except the banner part from my hosting company)
  • changes in some parts of the layout
  • fixed the css/templates to make layout displayed corrently with Opera, FireFox and IE
  • CAPTCHA (code verification) added to comment section
  • shoutbox added (along with a stupid banner)
  • fixed some broken bbcode parsing (eg. the [list] tag) and other codes
  • added a lot of administration/management features to my admin control panel

Some findings

Im using 3 browsers, Opera, FireFox and IE6 to test my site, a normal routine, and I found that:
  • Opera Smartest and fastest browser, although weak security support in early versions, but using the latest version 8.50, you can do things like online banking without trouble.
  • Firefox A browser that is build 'strict' and doing things in 'strict' mode. I'm not saying this is bad, but sometimes it shows that the browser is somehow dumb, but still a lot better than IE in many ways. One thing I dislike about FireFox is how it handles the cache, clicking a "Back" button and your previous data in a form is lost and you need to retype EVERYTHING.
  • IE6 Im using IE 6, haven't test out the latest IE 7, nothing much to say about it. Any human being who knows how a computer looks like, they surely seen IE in action or at least used it once. Good thing about IE ? they're everywhere...
No chance to use a Netscape browser, not really not having the chance, just that I'm lazy to download and install a 4th browser in my computer. Netscape Communicator was my first choice back in the old days until Opera is born.


Also found a free online XHTML conversion service, not tested.

Quote (from PSE, the website):
Translate a block of HTML, XHTML or XML script and turn it into a format compatible with XHTML. If you have tried translating old HTML into XHTML you will understand what a time consuming exercise this can be. Ensuring all tags are closed and attributes are quoted is tedious work. Finding where alt tags are missing from images is even harder. This utility also formats the document so that proper tag indentation is used, but without interfering with the visual appearance of the document.

Which one ? HTML or XHTML ? - 1:48 am
(X)HTML , Browser , Computing , Internet , Site Issue , Standards  -  poster 

Currently the site's content is HTML 4.01 Transitional compliance, it works fine until I realize doing a <link> thing inside the header breaks everything... one example is:

[ Hide ]
[ Highlight ] [ Text ]
<link rel="shortcut icon" type="image/vnd.microsoft.icon" href='/favicon.ico' />


It doesn't belongs to HTML 4.01...So, Im thinking of changing to XHTML, kinda headache though because I need to search and replace a lot of html tags like <br> to <br /> <input> to <input /> inside my templates...tons of them...omg...gayness...I should standardize my code in the beginning...

Last edited: Mon 2005-10-24 @ 16:35 , by DaRen 1 time(s)

CAPTCHA - 4:24 pm
Computing , Security , Site Issue , Standards  -  poster 

CAPTCHA image
This is what I'll implement it later to shoutbox/comment section. Shoutbox section should generate a smaller image to save space ? Haven't decide...let me think about it...

CAPTCHA ( Completely automated public turing test to tell computers and humans apart ), click here for more info.

Y2K bug ? What about Y2038 ? - 11:38 pm
Computing , Event , Security , Standards  -  poster 

5 years ago, I witnessed the historical moment where time passed by, marking the start of a new millennium. There are a lot of news about the Y2K bug before that, about how it will causes impact to our every day life. But well thanks to those people who done the preparation, fixing and patching on the electronic devices that we rely on, I stepped into the year 2000 without having a single trouble, just that I need to remember not to write year 1999 instead of 2000 when filling up forms.

So, now what? I'm working on some sort of birthday reminder thing in PHP and I got frustrated when it comes to storing a person's birth date. First of all I don't like to use MySQL datetime date type, I prefer using unix epoch which can be easily generated using php time() and mktime(), saving me the steps to converting the format. However unix epoch is only valid from January 1 1970 00:00:00 GMT onwards, making those people who born before 1970 invalid. So I do some google-ing to find out why the developers of Unix or even PHP refuse to start unix epoch from, say, year 1600 ? (Windows Win32 FILETIME epoch is at January 1 1601 00:00:00 UTC, Im guessing windows is using unsigned 32-bit, because windows don't work with negative timestamps... lazy to do the calculations...) Before I got my answers, I dsicovered some interesting news.

After the Y2K problem, are you aware of the next coming bug similar to Y2K's one ?

The Y2038 problem

In computing, the year 2038 problem may cause some computer software to fail in or about the year 2038. The problem affects programs that use the POSIX time representation, which represents time as the number of seconds since January 1, 1970. This representation is standard in Unix-like operating systems and also affects software written for most other operating systems because of the broad deployment of C. On most 32-bit systems, the time_t data type used to store this second count is a signed 32-bit integer. The latest time that can be represented in this format, following the POSIX standard, is 03:14:08 UTC on January 19, 2038. Times beyond this moment will "wrap around" and be represented internally as a negative number, and cause programs to fail, since they will see these times not as being in 2038 but rather in 1970 or 1901, depending on the implementation. Erroneous calculations and decisions may therefore result.

Using a 64-bit architecture will solve this problem, delaying the date problem to about 300 billion years later. To be more precise, it will happen on Sunday, 4 December, year 292,277,026,596. After 292 billion years later, maybe a 128-bit will be used which hmm...really isn't our business anymore. Who cares what will happen after 292 billion years eh ? I don't even really care if my weblog will crash or not in year 2038... hehe... who cares anyway ?

source:
http://en.wikipedia.org/wiki/Unix_epoch
http://en.wikipedia.org/wiki/Year_2038_problem
Page 1 of 2   ( 12 entries , showing 1 - 10 )
    1 2 Next  
$ view_blog.php 2009.09.17 18:16:41 $
Lost? | XML/HTML sitemap | Contact
38.107.179.240 , 21 queries , 0.3616s
Gzip enabled , CSS compressed , JS compressed
Copyright © 2005-2011 Darren's Outpost