Filed Under (Others) by admin on 20-05-2010

If your tired of the limited fonts available on your customers pc, try the hosted fonts made available by google
In the example code below we will be using the tangerine font
<html>
<head>
<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Tangerine">
<style>
body {
font-family: 'Tangerine', serif;
font-size: 48px;
}
</style>
</head>
<body>
<h1>Making the Web Beautiful!</h1>
</body>
</html>
Here are more starter guide samples
check out the google fonts directory
Filed Under (codeigniter, php) by admin on 13-04-2010
Error when uploading your file using codeigniter upload
“The filetype you are attempting to upload is not allowed”
Causes:
1. Invalid file type uploaded by the user your uploading (.doc when only .xls is allowed)
2. The file uploaded is not within the specified file types added in the upload config
3. Mime type error in codeigniter caused by the mime type of the extension does not match the mime type specified in /application/config/mimes.php
Start by checking what is the mime type of the file your uploading
$data = array('upload_data' => $this->upload->data());
$mimetype= $data['upload_data']['file_type'];
echo $mimetype;
then check in the mimes.php if that mime type matches the extension you want to upload
Example:
word document
'doc' => 'application/msword'
excel file has many mime types, if its missing just add it in the array
'xls' => array('application/excel', 'application/vnd.ms-excel','application/x-msexcel')
Filed Under (php) by admin on 19-02-2010
Tagged Under : php
The code below shows how to open a file from the server which cannot be accessed by the web server
$path = "/home/files/documents.doc";
header("Cache-Control: pre-check=0, post-check=0, max-age=0");
header('Content-Type: application/octet-stream');
header("Content-Disposition: attachment; filename=documents.doc);
header("Content-Description: File Transfer");
header("Content-Type:documents.doc);
header("Last-Modified: " . now());
echo readfile($path);
Filed Under (Others) by admin on 04-02-2010

A code view theme for dreamweaver based on zenburn low contrast console theme more info on zenburn official site.
To use in dreamweaver here are the Instructions:
1. Download file here
2. Go to C:\Documents and Settings\\Application Data\Adobe\Dreamweaver CS3\Configuration\CodeColoring
3. Backup first the original Colors.xml rename it as Colors-back.xml
4. Then paste our downloaded Colors.xml file
5. In your dreamweaver go to edit->preferences->code coloring then change your background color to #3f3f3f
Filed Under (mediawiki) by admin on 02-02-2010
Images on a MediaWiki wiki will by default, link to the description page
Here is a work around that when you click an image it will link to an ariticle
[[Image:Wiki.png|50px|link=MediaWiki]]
Note: The code above will work in mediawiki version 1.14 and above only
——————————————————————————————————-
Here is the workaround for older versions
Edit the Common.css
.imagelink_somename a {
width:100px;
height:100px;
display:block;
text-decoration:none;
background-image: url("http://fullurltoimage")
}
In your wiki code:
<div class="imagelink_somename">[[Some link| ]]</div>
——————————————————————————————————–
Or try the quick way
<div style="position: relative; width: {{{width}}}; height: {{{height}}}; overflow: hidden;">
<div style="position: absolute; top: 0px; left: 0px; font-size: 100px; overflow: hidden; line-height: 100px; z-index: 3;">[[{{{link}}}| ]]</div>
<div style="position: absolute; top: 0px; left: 0px; z-index: 2;">[[Image:{{{image}}}|{{{width}}}|{{{link}}}]]</div>
</div>
More workarounds found at mediawiki docs
http://www.mediawiki.org/wiki/Help:Linked_images#link.3D_Syntax_available_since_version_1.14
Filed Under (mediawiki) by admin on 28-01-2010
Edit the LocalSettings.php
add the notes:// protocol
where you find this line (add it as an array item)
$wgUrlProtocols = array( 'http://', 'https://', 'mailto:' ,'notes://');
Filed Under (php) by admin on 25-01-2010
Tagged Under : php
The mt_rand() function is a drop-in replacement for rand().
It uses a random number generator with known characteristics using the Mersenne Twister from the php docs website
I somehow noticed php rand() has a pattern, So I dug up the php docs for a better rand function and end up discovering this neat random function
Use mt_rand()
<?php
echo mt_rand() . "\n";
echo mt_rand() . "\n";
echo mt_rand(5, 15);
?>
Output
1604716014
1478613278
6
Filed Under (php) by admin on 22-01-2010
Tagged Under : php

I was able to figure out how to run Simple_html_dom php library on codeigniter
Download the simple html dom library here simple html dom
I copied the file Simple_html_dom.php to
/system/libraries
Then in my controller I call it using
require_once(‘Simple_html_dom.php’);
To use it, I initialized it using this line
$html = new Simple_html_dom();
Load a page or link using the line
$html->load_file(‘http://www.google.com’);
and parse or find elements using this line
$html->find(‘table tr td’)->plaintext;
works fine and fits right to what I needed to do.
Filed Under (Others) by admin on 04-01-2010
Visit google today and see an animated logo of a falling apple

http://www.google.com
Newton himself often told the story that he was inspired to formulate his theory of gravitation by watching the fall of an apple from a tree.
Cartoons have gone further to suggest the apple actually hit Newton’s head.
GRAVITY……… and there goes the apple