Showing posts with label web dev. Show all posts
Showing posts with label web dev. Show all posts

Saturday, 7 September 2013

Thursday, 5 September 2013

Godaddy subdomain on different server

http://support.godaddy.com/groups/domains-management-and-services/forum/topic/external-dns-subdomain-linked-to-my-gd-hosting/?pc_split_value=1

Mysql database and table character set

http://stackoverflow.com/questions/367711/what-is-the-best-collation-to-use-for-mysql-with-php

Counting the number of rows affected by Php Mysql PDO

http://stackoverflow.com/questions/883365/count-with-pdo

Domain Transfer Procedure

http://www.quackit.com/domain-names/how_to_transfer_a_domain_name.cfm

StepLosing RegistrarCustomerGaining Registrar
1 Customer purchases a Domain Transfer 
2
Customer must unlock the domain and receive an Authorization Code from the Losing Registrar.Depending on your old registrar, you can do this via your control panel or by contacting support. 
3  Gaining Registrar sends an email to the Customer. This email contains an ID number, a Key Code, and a link to confirm the transfer.
4 Customer confirms the transfer with the ID and Key Code from the email. If the domain being transferred requires one, the Authorization Code from the Losing Registrar will also need to be entered. 
5  Gaining Registrar sends notification to the old registrar to transfer the domain.
6Losing registrar sends confirmation for release of domain.  
7 Customer confirms release with Losing Registrar. 
8Losing Registrar releases domain to Gaining Registrar.  
9  A "transfer success" email is sent to notify the customer that the domain is now located in their account.
10 Customer now has control over the domain at the new Registrar. 

ICANN Domain Transfers Policy

http://archive.icann.org/en/transfers/policy-12jul04.htm
Creating text files in php

http://www.latestcode.net/2010/03/how-to-create-text-file-in-php.html
To open a port permanently in Fedora 19:

sudo firewall-cmd --zone=public --permanent --add-port=80/tcp

Check if port is open

To check if a port is open:

http://www.yougetsignal.com/tools/open-ports/

Making wordpress links relative

Add the following lines in the beginning of functions.php ( of your theme):


update_option('siteurl','http://' . $_SERVER['SERVER_ADDR']);
update_option('home','http://' . $_SERVER['SERVER_ADDR']);


More info:

http://codex.wordpress.org/Changing_The_Site_URL

CSS font stacks

http://cssfontstack.com/

http://gbtech.wordpress.com/2007/06/28/web-safe-font-list/

Saturday, 31 August 2013

count returns the number of elements in an array. If mode is set to COUNT_RECURSIVE (or 1), count() will recursively count the array. This is particularly useful for counting all the elements of a multidimensional array.

count($var)

http://www.php.net/manual/en/function.count.php
Will return the key of the searched value.

mixed array_search ( mixed $needle , array $haystack [, bool $strict = false ] )

strict matches the type of the data also


http://php.net/manual/en/function.array-search.php
Remove a single or multiple trailing or leading characters from a string using rtrim:

rtrim($string, ",") would cut trailing commas.
trim($string, ",") would cut trailing and prefixing commas.


Without the second argument rtrim will remove trailing and and trim will remove leading and trailing whitespace.

JQuery Source maps

JQuery Source maps allows javascript debugging even when using minified javascript.

http://jquerybyexample.blogspot.com/2013/01/all-you-need-to-know-about-jquery-source-maps.html

@font-face kit generator

If font squirrel doesn't work (if the font is blacklisted, for example), you can use

http://www.font2web.com/

Don't use http://convertfonts.com/

Wednesday, 28 August 2013

MySQL Varchar size limit is in bytes

When the length limit of a mysql field is specified, the limit is not on the number of characters but on the number of bytes. The Latin-1 character set takes one byte per character, the UTF-8 takes up to 3 characters.


http://stackoverflow.com/questions/1592702/mysql-varchar-size-limit

PHP Functions optional parameters

In PHP, an optional parameter of a function can be defined by giving it a default value of null.

function some_function($optional=null) { }

Tuesday, 20 August 2013

CMS Market Share

http://trends.builtwith.com/cms
To set the time zone correctly before putting data into a database:

http://www.sitepoint.com/synchronize-php-mysql-timezone-configuration/

http://www.php.net/manual/en/timezones.asia.php


    try
    {
        $DBH = new PDO("mysql:host=hostedresource.com;dbname=somedb", "dbusername", "dbpassword");
        $DBH->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    }   
    catch(PDOException $e)
    {
        print "db error db_connection_10";
        file_put_contents('PDOErrors.txt', "\ntesting 10 " . $e->getMessage() . "\n", FILE_APPEND);       
        DIE();
    }
   
   
    define('TIMEZONE', 'Asia/Kolkata');
   
    date_default_timezone_set(TIMEZONE);

   
    //SET time_zone='offset';
   
    $now = new DateTime();
   
    $mins = $now->getOffset() / 60;     // for India this will be +5.5hrs or +330 mins (Returns the timezone offset from GMT)
   
    $plus_or_minus = ( $mins < 0 ? -1 : 1 );     // find out if the country is behind or ahead
    $mins = abs( $mins );     // remove the sign
    $hrs = floor( $mins / 60 );     // floor just rounds down to the integer (so for India you will get 5 instead of 5.5)

   
    $mins = $mins - ( $hrs * 60 ); // this gives the minutes component of the timezone offset
   
    $offset = sprintf('%+d:%02d', $hrs*$plus_or_minus, $mins); // sprintf formats the string so that it can be used in the mysql command
   
    $DBH->exec("SET time_zone='$offset';");