Main Page

From Mkhairul's Tome of Knowledge!

Jump to: navigation, search

I bought my first domain, mkhairul.com on 21st May 2006. Aye, this will be one of those stepping stone for me. What's next? who knows.

That's naota-kun. An anime character.About Me


Contents

Work

Getting Started

Wishlist

Reading List

Todolist (not related to work)

Notable Local Companies

Projects

Projects & Stuff

Todolist

Solution Notes / Notes

Quoted from What is the size of A4 in px?

A4 is a document format, as a screen image that's going to depend on the 
image resolution, for example an A4 document resized to:

72 dpi (web) = 595 X 842 pixels
300 dpi (print) = 2480 X 3508 pixels 
(This is "A4" as I know it, i.e. "210mm X 297mm @ 300 dpi")
600 dpi (print) = 4960 X 7016 pixels

And so forth. FWIW document formats like A4 are described by their print 
dimensions (millimeters), which is a whole different thing than screen 
images (pixels) so that's why you don't see anyone using pixels to describe A4. :yes

SOPs / Guides

Web Developer Toolbox


Best Practices

Coding Standards

Design Patterns

Professional Development

Softwares / Open Source

Project Management

I can't exactly find the function for deleting projects. I dont know why they didnt make it.

Hosting

System & Utilities

  • SystemRescueCd - bootable rescue disk includes Disk Partitioning (GParted) and Partition Image (Ghost like software)

Emulator & Terminal

  • UWIN
    • The UWIN package allows UNIX applications to be built and run on Windows XP/2000/NT/ME/98/95 with few, if any, changes necessary.
  • Cygwin
  • Poderosa
    • Poderosa is a tabbed terminal emulator for Windows.

Events

Events


Quotes

Programming/Dev

The urge the reduce the complexity of the tools used to solve software problems is one that every software developer should share.

- Dare Obasanjo, Duct Tape Programmers and the Culture of Complexity in Software Projects

General

"Don’t run from failure — fail often, fail quickly, and learn."

- Programmer Insecurity

There is one final aspect to be considered in any degree of project failure. All success is rooted in either luck or failure. 
If you begin with luck, you learn nothing but arrogance. However, if you begin with failure and learn to evaluate it, 
you also learn to succeed. Failure begets knowledge. Out of knowledge you gain wisdom, and it is with wisdom 
that you can become truly successful.

- Personal and Professional Development Through Reading, CHAOS Report

When you enter a contract or statement of work with a client, you should assume it’s a mutual agreement. 
If things don’t follow the letter of the contract and you let it happen without saying anything, 
you risk appearing as though you accept it.

- A List Apart: Why Did You Hire Me?

Ecchi na no ha ikenai to omoi imasu !
Dirty thoughts are bad!
- mahoromatic
<nero> HTML without CSS is like a gun without ammunition
<nero> you can beat people to death with the butt of a gun, but bullets are so much more efficient

- bash

Procedural code gets information then makes decisions. 
Object-oriented code tells objects to do things.

  — Alec Sharp, "Smalltalk By Example" McGraw-Hill, 1997.


You werent meant to have a boss

In an artificial world, only extremists live naturally.

If you're not allowed to implement new ideas, you stop having them.
-- Paul Graham
"We act as though comfort and luxury were the chief requirements of life, 
when all that we need to make us really happy is something to be enthusiastic about."
- Charles Kingsley
A common mistake that people make when trying to design something completely foolproof is to 
underestimate the ingenuity of  complete fools
- Douglas Adams
Just as self-confidence is a self-sustaining spiral of improvement, 
so the lack of trust in our own good senses is a self-sustaining spiral of decline.

Response to a reddit comment (Above)

What is web design? Understanding Web Design

Web design is the creation of digital environments that facilitate 
and encourage human activity; reflect or adapt to individual voices 
and content; and change gracefully over time while always retaining their identity.

Excerpt from Secrets and Lies (page 389):

“As technology becomes more complicated, society’s experts become more specialized. And in almost every area, those with the 
expertise to build society’s infrastructure also have the expertise to destroy it. Ask any doctor how to poison someone untraceably, 
and he can tell you. Ask someone who works in aircraft maintenance how to drop a 747 out of the sky without getting caught, and he’ll 
know. Now ask any Internet security professional how to take down the Internet, permanently. I’ve heard about half a dozen different 
ways, and I know I haven’t exhausted the possibilities.”

Kereta Mayat Blog

Tidak sanggupkah kita memalukan diri kerana Allah, 
sedang ada riwatat menyatakan siapa yang memalukan diri kerana Allah, 
di akhirat kelak, Allah aka malu untuk hisab mereka..

Reddit Comment on Dilbert Comic

Experience is a hard teacher: she gives the tests first and the lessons after.

Manusia Berhubung dengan Perasaan

People don’t care how much you know until they know how much you care!

SaifulIslam.com

Manusia yang berubah kerana terpaksa adalah mangsa. 
Manusia yang memaksa dirinya untuk berubah, 
mereka itulah yang berjaya.

Bash - #161626

<miksa> I remember the first time I went shitting in the woods at army.
I still have nightmares of how the mosquitos atacked my balls X(
"Things you own, end up owning you" 
- Fight Club

A few quotes taken from Web Application Development with PHP 4.0

Prevent trouble before it arises.
Put things in order before they exist.
The giant pine tree
grows from a tiny sprout.
The journey of a thousand miles
starts from beneath your feet.
We join spokes together in a wheel,
but it is the center hole that makes the wagon move.
We shape clay into a pot,
but it is the emptiness inside that holds whatever we want.
We hammer wood for a house,
but it is the inner space that makes it livable.
When people see some things as beautiful,
other things become ugly.
When people see some things as good,
other things become bad.
When you handle the master carpenter’s tools,
chances are that you’ll cut your hand.
If you realize that all things change,
there is nothing you will try to hold on to.
If you aren’t afraid of dying,
there is nothing you can’t achieve.
Knowing others is intelligence;
Knowing yourself is true wisdom.

Resources

Inspirations / Web Design

There are many more inspirational website, more can be seen at my delicious bookmark

Sec.

General

Database

CodeIgniter

[sql, n] -- Table structure for ci_sessions -- ---------------------------- CREATE TABLE `ci_sessions` (

 `session_id` varchar(40) collate latin1_general_ci NOT NULL default '0',
 `ip_address` varchar(16) collate latin1_general_ci NOT NULL default '0',
 `user_agent` varchar(50) collate latin1_general_ci NOT NULL,
 `last_activity` int(10) unsigned NOT NULL default '0',
 `session_data` text collate latin1_general_ci NOT NULL,
 PRIMARY KEY  (`session_id`)

) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

[xml, n] <?xml version="1.0" encoding="utf-8"?><rss version="2.0"> <channel>

   <title>Mosques.com.my News</title>
   <link>http://www.mosques.com.my</link>
   <description>News for Mosques.com.my</description>
   <lastBuildDate>Thu, 22 Nov 2007 08:52:50 GMT</lastBuildDate>
   <language>en-us</language>
    <item>
       <title>Neque porro quisquam est qui dolorem test</title>
       <link>http://192.168.0.115/mosques.com.my/index.php/news/details/2</link>
       <guid>http://192.168.0.115/mosques.com.my/index.php/news/details/2</guid>
       <pubDate>20 Nov 2007</pubDate>
       <description><![CDATA[ Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Proin tincidunt. Nam a justo. 

Mauris cursus erat consequat lacus. Pellentesque consectetuer nulla et dui. Nam pede nisi, facilisis in, gravida et, euismod ac, dui. Aliquam euismod dignissim ipsum. Nunc at massa non dolor vulputate feugiat. In scelerisque, lacus nec gravida elementum, nisl magna sodales sem, nec congue dolor sem nec magna. Vestibulum et nulla id magna viverra blandit. Aenean in dui vitae magna aliquam molestie. Sed metus. Nulla condimentum dignissim dolor. Nunc ultricies nibh non elit. Aliquam dapibus, enim in... ]]></description>

       </item>
       

</channel> </rss> Example [php, n] <?php echo '<?xml version="1.0" encoding="utf-8"?>'; ?> <rss version="2.0"> <channel>

   <title>Masjid & Surau - View Events Listing</title>
   <link><?php echo site_url('events/view_list'); ?></link>
   <description>test List of entry for Events</description>
   <language>en-us</language>
   

<?php if(getstr($events_list)) {

   foreach($events_list->result() as $row)
   {

?>

   <item>
       <title><?php echo $row->name; ?></title>
       <link><?php echo site_url('masjid/details/' . $row->masjidID); ?></link>
       <pubDate><?php echo date('d M Y', $row->timecreated); ?></pubDate>
       <description><?php echo truncate($row->description); ?></description>
   </item>

<?php

   } 
}

?> </channel> </rss>

Delphi

CSS

Try adding a style for that image and put display: block; inside it.

Images by default are treared as inline elements, leaving space for the 
descenders of letters below them.  Making them block takes that away.  
That should take care of it.
  • Bottom Corner of A Box - Elated
#container {position: relative; width: 100%; height: 125px;}
#copy {position: absolute; right: 10px; bottom: 10px;}

<div id="container">

  <div id="copy">
    © ELATED 2006
  <div>
<div>
  • IE7 CSS Hack

[css,n] p {

 border:1px solid green; /* works in all */
 *border:1px solid red; /* targets IE6 and 7 */
 _border:1px solid blue; /* targets IE6 */
 
 /* IE7, IE8 */
 #veinte { color/*\**/: blue\9; }

}

Joomla

Perl

PHP

[php, n] <?php $str = 'مرحب'; $str2 = 'MOHD KHAIRUL ANUAR'; echo mb_convert_case($str1, MB_CASE_LOWER, "utf-8"); echo mb_convert_case($str2, MB_CASE_LOWER, "utf-8"); ?>

Drupal

nuSOAP

Python

Compiling a python source code to bytecode

[python,n] import py_compile py_compiile.compile('filename')

Pylons

Django

Linux

  • Archive Using Tar
tar cvzf foo.tgz *.cc *.h
  • To extract a tar.bz2 file, use the command (note the j option)
tar -jxvf filename.tar.bz2
  • To extract a tar.gz file, the the command (note the z option)
tar -zxvf filename.tar.gz
  • Get the amount of CPU (FreeBSD too)
dmesg grep cpu
  • Installing AdobeAIR
- Download the installer
- sudo chmod +x AdobeAIRInstaller.bin
- sudo ./AdobeAIRInstaller.bin
  • Know which distribution you're using
1. dmesg | head -1
2. cat /proc/version
3. cat /etc/issue

Oracle

  • Show a list of tables
SELECT * FROM cat;
  • Limit the query
WHERE ROWNUM <= 5

MySQL

mysql -p -h DBSERVER dbname < dbname.sql

[sql,n] GRANT ALL PRIVILEGES ON *.* TO 'monty'@'localhost' IDENTIFIED BY 'some_pass' WITH GRANT OPTION;

GRANT ALL PRIVILEGES ON tablename.* TO 'monty'@'localhost' IDENTIFIED BY 'some_pass' WITH GRANT OPTION;

Add new field to a table [sql,n] ALTER TABLE contacts ADD email VARCHAR(60) AFTER name;

Random Records [sql,n] SELECT * FROM tablename ORDER BY RAND()

Drupal

Flash

ActionScript 3.0 Iterating through array, simulate foreach [actionscript,N] var artist_id:Array = new Array(); for (var key:String in artist_id){

 trace("array[" + key + "] = "+ artist_id[key]);

}

Javascript

This utility can be used to reduce the size of JavaScript source code in a file. It uses some simple parsing and regular expressions to remove comments and unnecessary white space in the script code. Depending on your style of coding, it can produce significant savings in terms of file size.

Need NS6 equivilant of ScrollTop or pageYOffset

var scrollAmount = window.pageYOffset ? 
window.pageYOffset : document[(document.compatMode == 'CSS1Compat') ? 
'documentElement' : 'body'].scrollTop;

Pitfalls

From The 7 Deadly Sins of Javascript

  • Validating user input
  • Popping faux windows
    • You cannot bookmark, print, minimize, maximize, or organize them, but they sure do look real.
  • Striping tables like a Zebra
  • Floating or flying widgets
  • Dragging and dropping
  • Retrieving the date and time
  • Ignoring the rogue error


From Nine Javascript Gotchas

  • Comma Caused Coruption
  • The adulterous "this" can change what it refers to.
  • Identity Theft
  • String replace only replaces the first occurrence
  • MouseOut sometimes means MouseIn
  • ParseInt scoffs at your base ten numbering system
  • for loops over everything including the kitchen sink
  • Event Handler Pitfalls
  • Focus Pocus

Best Practices

From Javascript Toolbox

  • Always use 'var'
  • Feature-Detect rather than Browser-Detect
  • Use Square Bracket Notation
  • Avoid 'eval'
  • Reference Forms and Form Elements Correctly
  • Avoid 'with' statements
  • Use onclick in Anchors instead of javascript Pseudo-Protocol
  • Use the unary + operator to TypeConvert to Number
  • Avoid document.all
  • Don't use HTML comments in Script Blocks
  • Avoid cluttering the global namespace
  • Avoid syn 'Ajax' calls
  • Use JSON
  • Use Correct <script> Tags

jQuery

tb_show("test","ajaxLogin.htm?height=100&width=250");

[javascript, n] jQuery.preloadImages = function() { for(var i = 0; i<arguments.length; i++) { jQuery("<img>").attr("src", arguments[i]); } } $.preloadImages("over.png", "out.gif");

  • Preload Image

[javascript, n] var image_ori = new Array(); function swap_image(name, swapImage) { image_ori[name] = $('#'+name).attr('src'); $('#'+name).attr('src', 'menu/' + swapImage); }

function restore_image(name) { $('#'+name).attr('src', image_ori[name]); } [html, n]

  • <a href="#" onmouseover="swap_image('main_menu_1', 'test-over.jpg');" onmouseout="restore_image('main_menu_1');"> <img id="main_menu_1" src="menu/test.jpg" alt="Test" /> </a> </li>
    • Image Loaded
    [javascript, n] $("img:first").load(function (){ alert("Image loaded!"); });

    Photoshop

    Ajax

    Subversion / SVN

    [shell, n] svnadmin create --fs-type=fsfs "path/to/repo"

    • Adding a file to commit recursively

    [shell, n] svn st | grep "^?" | awk '{ print $2}' | while read f; do svn add "$f"; done

    • Changing repository location

    [shell, n] svn switch --relocate svn+ssh://172.17.244.6/var/svn/itnm_tms svn+ssh://218.208.98.67/var/svn/itnm_tms

    The first url is the old one.

    Web 2.0 Stuffs

    CSS

    I'm still learning about css. Organisation of css contents is important less I get lost in its sea of ids and classes.
    5 CSS Tips
    5 steps to CSS heaven
    Full Fledged CSS Example

    Sample

    /* Design & Code (c) Company Name, Inc. */
    html, body { padding: 0; margin: 0; }
    body {
    	font: normal 12px/1.5em "Lucida Grande", "Verdana", sans-serif;
    	background: #fff; }
    	
    	
    /* Headings H1-H6 */
    h1 { }
    
    h2 { }
    
    h3 { }
    
    h4 { }
    
    h5 { }
    
    h6 { }
    
    
    /* Paragraph and Link Styles */
    p { }
    
    	p a { }
    	
    	
    /* Lists and Navigation */
    


    Resources


    MediaWiki Getting started

  • Personal tools