Thursday, January 29, 2015

Monday, December 29, 2014

Angels


Tribal Design


Cobra

source: tattoosforyou.org

Tribal Design

source: car-memes.com

Change screen resolution in Fedora

You can use xrandr to set specific resolutions.
  1. First generate a modeline. This is very easy using cvt. For example, to create a mode for 1920x1080 you would run
    cvt 1920 1080 60 -r
    
    The 60 corresponds to a 60Hz refresh rate (a common refresh rate for modern monitors). The -r means to enable reduced blanking, which is useful for LCD monitors.
  2. Add the new mode to your mode list using xrandr. Copy the output of cvt (except the word "Modeline") and paste it after xrandr --newmode
    xrandr --newmode "1920x1080R"  138.50  1920 1968 2000 2080  1080 1083 1088 1111 +hsync -vsync
    
  3. Add the new mode to the proper connector. If the monitor is connected to the first HDMI port on your video card, the command would be
    xrandr --addmode HDMI1 1920x1080R
    
    A list of valid connector names is given in the output of running xrandr with no arguments.
  4. Enable the new mode. Sometimes the new mode is automatically enabled after step three. If not, you can enable it by opening "Settings" and clicking on "Displays", or through xrandr
    xrandr --output HDMI1 --mode 1920x1080R

Thursday, November 27, 2014

Yii 1.1 CHtml

    CHtml::activeCheckBox()

    Generates a check box for a model attribute. The attribute is assumed to take either true or false value. If the attribute has input error, the input field's CSS class will be appended with errorCss.
    Syntax:
    public static string activeCheckBox(CModel $model, string $attribute, array $htmlOptions=array ( ))
    Example:
    $model = Post::model()->findByPk(1);
    echo CHtml::activeCheckBox($model, 'status', array('1'=>'Draft','2'=>'Publish'));

    CHtml::activeCheckBoxList()

    Generates a check box list for a model attribute. The model attribute value is used as the selection. If the attribute has input error, the input field's CSS class will be appended with errorCss.
    Syntax:
    public static string activeCheckBoxList(CModel $model, string $attribute, array $data, array $htmlOptions=array ( ))
    Example:
    /**
    Suppose that:
    1. category_id is an attribte of Post model.
    2. id, title are attribtes of Category model.
    */
     
    $model = Post::model()->findByPk(1);
    echo CHtml::activeCheckBoxList($model, 'category_id', CHtml::listData(Category::model()->findAll(), 'id', 'title'));

    CHtml::button()

    Create a html button
    Syntax:
    public static string button(string $label='button', array $htmlOptions=array ( ))
    Example:
    echo CHtml::button('Submit', array('submit' => array('post/create')));

    CHtml::textField()

    Create a html textfield input.
    Syntax:
    public static function textField($name,$value='',$htmlOptions=array())
    Example:
    CHtml::textField('Text name', 'This is default value');

    CHtml::dropDownList()

    Generates a drop down list.
    Syntax:
    public static string dropDownList(string $name, string $select, array $data, array $htmlOptions=array ( ))
    Example:
    $selected = 1;
    echo CHtml::dropDownList('status', $selected, 
                  array('1' => 'Draft', '2' => 'Publish');

    CHtml::listOptions()

    Generates the list options.
    Syntax:
    public static string listOptions(mixed $selection, array $listData, array &$htmlOptions)
    Example:
    $selection = 'M'; // or 'F'
    $htmlOptions = array('id' => 'option_id');
    echo CHtml::listOptions($selection, 
                  array('M' => 'Male', 'F' => 'Female'),
                  $htmlOptions
                  );

    CHtml::listData()

    Generates the data suitable for list-based HTML elements. The generated data can be used in dropDownList, listBox, checkBoxList, radioButtonList, and their active-versions (such as activeDropDownList)
    Syntax:
    public static array listData(array $models, mixed $valueField, mixed $textField, mixed $groupField='')
    Example:
    $models = categories::model()->findAll();
    //format models resulting using listData     
    $category_list = CHtml::listData($models,'category_id', 'category_name');    
    print_r($category_list);

    CHtml::cdata()

    Encloses the given string within a CDATA tag.
    Syntax:
    public static string cdata(string $text)
    Example:
    <![CDATA[This is CData content]]>

    CHtml::label()

    Generates a label tag.
    Syntax:
    public static string label(string $label, string $for, array $htmlOptions=array ( ))
    Example:
    echo CHtml::label('Click here','checkbox-id');
    echo CHtml::checkbox('checkbox_name',true,array('id'=>'checkbox_id','class'=>'checkbox_class'));

    CHtml::checkBoxList()

    Generates a check box list. A check box list allows multiple selection, like listBox. As a result, the corresponding POST value is an array.
    Syntax:
    public static string checkBoxList(string $name, mixed $select, array $data, array $htmlOptions=array ( ))
    Example:
    echo "".CHtml::label('Simple Poll','checkbox-list-id') . "

"; echo CHtml::checkBoxList('checkbox_list_name', 'codexamples', array( 'codexamples' => 'Codexamples.com', 'google' => 'Google.com', 'wikipedia' => 'Wikipedia.com', 'youtube' =>'Youtube.com' ), array('id'=>'checkbox-list-id','class'=>'checkboxlist'));

CHtml::checkBox

Generates a check box.
Syntax:
public static string checkBox(string $name, boolean $checked=false, array $htmlOptions=array ( ))
Example:
echo CHtml::label('Click here','checkbox-id');
echo CHtml::checkbox('checkbox_name',true,array('id'=>'checkbox_id','class'=>'checkbox_class'));

CHtml::link()

Generating a link tag.
Syntax:
public static string link(string $text, mixed $url='#', array $htmlOptions=array ( ))
Example:
CHtml::link('Post Link',array('post/index'));

CHtml::cssFile()

Links to the specified CSS file.
Syntax:
public static string cssFile(string $url, string $media='')
Example:
$url = '/css/style.css';
echo CHtml::cssFile($url,'screen');

CHtml::dateField()

Generates a date field input.
Syntax:
public static string dateField(string $name, string $value='', array $htmlOptions=array ( ))
Example:
echo CHtml::dateField('date_name',date("Y-m-d"),array('id'=>'date_id'));

CHtml::emailField()

Generates an email field input.
Syntax:
public static string emailField(string $name, string $value='', array $htmlOptions=array ( ))
Example:
echo CHtml::emailField('email_name','default@email.com',array('id'=>'date_id','placeholder'=>'Email field'));

CHtml::error()

Displays the first validation error for a model attribute.
Syntax:
public static string error(CModel $model, string $attribute, array $htmlOptions=array ( ))
Example:
echo $form->error($model,'attribute_name');

CHtml::encodeArray()

Encodes special characters in an array of strings into HTML entities. Both the array keys and values will be encoded if needed. If a value is an array, this method will also encode it recursively. The application charset will be used for encoding.
Syntax:
public static array encodeArray(array $data)
Example:
$array = array(
    'cat1'=>'This is content of category number 1',
    'cat2'=>'This is content of category number 3',
    );
 
$encodeArray = CHtml::encodeArray($array);
print_r($encodeArray);

CHtml::fileField()

Generates a file input. Note, you have to set the enclosing form's 'enctype' attribute to be 'multipart/form-data'. After the form is submitted, the uploaded file information can be obtained via $_FILES[$name] (see PHP documentation).
Syntax:
public static string fileField(string $name, string $value='', array $htmlOptions=array ( ))
Example:
echo CHtml::fileField('file_name','');

CHtml::getIdByName()

Generates a valid HTML ID based on name.
Syntax:
public static string getIdByName(string $name)
Example:
echo CHtml::getIdByName('title');

CHtml::image()

Generates an image tag.
Syntax:
public static string image(string $src, string $alt='', array $htmlOptions=array ( ))
Example:
echo CHtml::image('http://codexamples.com/themes/responsive/img/logo-dark.png','Code Examples',array(,'onclick'=>'js:alert("Welcome to Codexamples.com.\n This is Codexamples logo")'));

About

Blogger templates