Friday, August 24, 2012

Balumgala 2012-08-23 Department of Motor Vehicles

Don’t use short tags in PHP

Don’t use short tags and try to using , It can create a problem for you if you are going to deploy your application on another server.

Wednesday, August 22, 2012

UpdateByPk Yii


updateByPk() method
public integer updateByPk(mixed $pk, array $attributes, mixed $condition='', array $params=array ( ))
$pkmixedprimary key value(s). Use array for multiple primary keys. For composite key, each key value must be an array (column name=>column value).
$attributesarraylist of attributes (name=>$value) to be updated
$conditionmixedquery condition or criteria.
$paramsarrayparameters to be bound to an SQL statement.
{return}integerthe number of rows being updated
Updates records with the specified primary key(s). See find() for detailed explanation about $condition and $params. Note, the attributes are not checked for safety and validation is NOT performed.
-----------------------------------------------------------------------

Update By Primary Key
User::model()->updateByPk($model->id,array("username"=>'jerome'))
-----------------------------------------------------------------------
Source Code: framework/db/ar/CActiveRecord.php#1678 (hide)
public function updateByPk($pk,$attributes,$condition='',$params=array())  {      Yii::trace(get_class($this).'.updateByPk()','system.db.ar.CActiveRecord');      $builder=$this->getCommandBuilder();      $table=$this->getTableSchema();      $criteria=$builder->createPkCriteria($table,$pk,$condition,$params);      $command=$builder->createUpdateCommand($table,$attributes,$criteria);      return $command->execute();  }

Monday, August 20, 2012

SQL Fairy

http://sqlfairy.sourceforge.net/


SQL::Translator is a group of Perl modules that manipulate structured data definitions (mostly database schemas) in interesting ways, such as converting among different dialects of CREATE syntax (e.g., MySQL-to-Oracle), visualizations of schemas (pseudo-ER diagrams: GraphViz or GD), automatic code generation (using Class::DBI), converting non-RDBMS files to SQL schemas (xSV text files, Excel spreadsheets), serializing parsed schemas (via Storable, YAML and XML), creating documentation (HTML and POD), and more. New to version 0.03 is the ability to talk directly to a database through DBI to query for the structures of several databases.

Through the separation of the code into parsers and producers with an object model in between, it's possible to combine any parser with any producer, to plug in custom parsers or producers, or to manipulate the parsed data via the built-in object model. Presently only the definition parts of SQL are handled (CREATE, ALTER), not the manipulation of data (INSERT, UPDATE, DELETE).

PHP Regular Expressions

Source: http://www.roscripts.com/PHP_regular_expressions_examples-136.html


//Credit card: All major cards
'^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6011[0-9]{12}|3(?:0[0-5]|[68][0-9])[0-9]{11}|3[47][0-9]{13})$'

//Credit card: American Express
'^3[47][0-9]{13}$'

//Credit card: Diners Club
'^3(?:0[0-5]|[68][0-9])[0-9]{11}$'

//Credit card: Discover
'^6011[0-9]{12}$'

//Credit card: MasterCard
'^5[1-5][0-9]{14}$'

//Credit card: Visa
'^4[0-9]{12}(?:[0-9]{3})?$'

//Credit card: remove non-digits
'/[^0-9]+/'

Online Regular Expression Checker
http://gskinner.com/RegExr/

http://cybernetnews.com/online-regular-expression-builder/

Windows 7 - Removing Unwanted Fonts to speed up the system


click on any font in the font folder and select show or hide. Hidden fonts don't load when a program is opened, which, as I understand it, is when a long fonts list slows things down.

Generally it is safe to delete the default 'hidden' fonts in the folder.


OR

open Command Prompt (cmd.exe) as Administrator

go C:\Windows\Fonts

type this ATTRIB +H *

ATTRIB +H * | find "Acccess Denied" to get the ones failed :)

Sunday, August 19, 2012

Miss Philippines Shows Off Her Beatboxing Skills

The On-Line Encyclopedia of Integer Sequences™ (OEIS™)



The On-Line Encyclopedia of Integer Sequences™ (OEIS™)

http://oeis.org/

PHP Year 2038 problem


What exactly is the Year 2038 problem?

"The year 2038 problem (also known as Unix Millennium Bug, Y2K38 by analogy to the Y2K problem) may cause some computer software to fail before or in the year 2038. The problem affects all software and systems that store system time as a signed 32-bit integer, and interpret this number as the number of seconds since 00:00:00 UTC on January 1, 1970."

About

Blogger templates