Autoload classes
Takes a bite out of including all your class files… http://php.net/manual/en/language.oop5.autoload.php http://www.codeforest.net/autoload-your-classes-in-php
Takes a bite out of including all your class files… http://php.net/manual/en/language.oop5.autoload.php http://www.codeforest.net/autoload-your-classes-in-php
[code lang=”js”] function post_to_url(path,params,method){ method=method||"post"; var form=document.createElement("form"); form.setAttribute("method",method); form.setAttribute("action",path); for(var key in params){ var hiddenField=document.createElement("input"); hiddenField.setAttribute("type","hidden"); hiddenField.setAttribute("name",key); hiddenField.setAttribute("value",params[key]); form.appendChild(hiddenField); } document.body.appendChild(form); form.submit(); } [/code] Consume it: <a title=”Title” href=”javascript:post_to_url(‘http://www.domain.com’,{‘rsit’:’3528′,’sit’:’2726′})”>Link</a>
Detect subdomain and rewrite the front part of the subdomain: .htaccess [sourcecode] RewriteCond %{HTTP_HOST} ^auto(.*)domain.com >RewriteRule ^(.*)$ http://quotes%1domain.com/$1 [R=301,L] RewriteCond %{HTTP_HOST} ^auto(.*)domain.comRewriteRule ^(.*)$ http://quotes%1domain.com/$1 [R=301,L] [/sourcecode] Search and replace the domain only: [sourcecode] /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#?=~_|!:,.;]*[-A-Z0-9+&@#%=~_|]\/)/i [/sourcecode]
How do you start at a certain row and limit it? Used for paging perhaps, but here it is how: [sourcecode language=”sql”] SELECT Description, Date FROM (SELECT ROW_NUMBER() OVER (ORDER BY Date DESC) AS Row, Description, Date FROM LOG) AS LogWithRowNumbers WHERE Row >= 11 AND Row <= 20 [/sourcecode]
PostgreSQL 9.0 has been released. Here’s a cheatsheet for it: http://www.postgresonline.com/journal/archives/177-postgresql90_cheatsheet.html
I’ve been contemplating about getting a SSD (solid state drive) for my Macbook pro. Been reading many, many articles/blogs and the conclusion is… what am I willing to pay for the speed gain versus less storage space? So, then the next question is… Do I want to give up the …
XType Datatype —————- 34 image 35 text 36 uniqueidentifier 48 tinyint 52 smallint 56 int 58 smalldatetime 59 real 60 money 61 datetime 62 float 98 sql_variant 99 ntext 104 bit 106 decimal 108 numeric 122 smallmoney 127 bigint 165 varbinary 167 varchar 173 binary 175 char 189 timestamp 231 …
Here’s a quick way to see the user tables and fields within a database. [sourcecode language=”sql”] select s.id, s.name as table_name, c.[name] as column_name, t.name as datatype, c.length, c.xprec from sysobjects s inner join syscolumns c on c.id = s.id inner join systypes t on t.xtype = c.xtype where s.type …