admin

Categories:

alt
Name: Facebook
Parent: Social
Posts: 2
alt
Name: Tumblr
Parent: Social
Posts: 1
alt
Name: Ubuntu
Parent: Linux
Posts: 13
alt
Name: Linux
Parent: No category
Posts: 1
alt
Name: Content
Parent: No category
Posts: 2
alt
Name: Google Chrome
Parent: Google
Posts: 1
alt
Name: YouTube
Parent: Social
Posts: 1
alt
Name: Composer
Parent: No category
Posts: 4
alt
Name: Codeigniter
Parent: Framework
Posts: 1
alt
Name: Laravel
Parent: Framework
Posts: 5
alt
Name: Notepad++
Parent: IDE
Posts: 1
alt
Name: XAMPP
Parent: Server
Posts: 2
alt
Name: NetBeans
Parent: IDE
Posts: 3
alt
Name: Google Maps API
Parent: Google
Posts: 1
alt
Name: iPage.com
Parent: Hosting
Posts: 1
alt
Name: DHTMLX
Parent: No category
Posts: 1
alt
Name: Git, Git Bash
Parent: No category
Posts: 1
alt
Name: Command line CMD
Parent: No category
Posts: 1
alt
Name: PhpStorm
Parent: IDE
Posts: 2
alt
Name: ApiOK
Parent: Social
Posts: 1
alt
Name: Nginx
Parent: No category
Posts: 1

Posts:

Displaying 91-100 of 273 results.
Resolved: Yii 1: Uncaught TypeError: jQuery(...).yiiactiveform is not a function
posted by admin on October 10, 2016
In form pages I have got an error like this

Yii 1: Uncaught TypeError: jQuery(...).yiiactiveform is not a function

Form:

<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'login-form',
'enableClientValidation'=>true,
'clientOptions'=>array(
'validateOnSubmit'=>true,
),
)); ?>
...
<?php $this->endWidget(); ?>

head:

...
<?php Yii::app()->clientScript->registerScriptFile(app::baseUrl(false, "/js/", "jquery-1.9.1.min.js"), CClientScript::POS_HEAD);?>
...

Warning:
app::baseUrl(false, "/js/", "jquery-1.9.1.min.js") - it is my function and class, repace it by Yii baseURL propertyRead more
Wiki: Yii 1: Как задавать стили css (class, id) для CMenu, пунктов меню и ссылок в менюwiki
posted by admin on October 10, 2016
Часто хочется задать свои стили css, своё оформление для меню CMenu. Это сводится к добавлению классов и идентификаторов id в html (виджет Cmenu формирует ненумерованный список <ul>, <li>;). В Yii для этих целей предусмотрены htmlOptions, itemOptions, and linkOptions.
1. Добавление названий id и class к CMenu.
Используются id и htmlOptions для добавления своих идентификаторов и классов.

//in your view
$this->widget('zii.widgets.CMenu', array(
'id'=>'myMenu',
'items'=>$this->myMenu,
'htmlOptions'=>array('class'=>'span-24 last'),
'encodeLabel'=>false, // чтобы можно было в label использовать html-теги (жирность, наклон, цвет и т.д.)
));

Это сформирует следующий html:

<ul class="span-24 last" id="myMenu">
...
</ul>

2. Добавление названий классов (class names) к пунктам CMenu (CMenu items) и ссылкам в пунктах меню (CMenu item links).
Используем itemOptions и linkOptions. Например:

//in your controller
$this->myMenu = array(
'id'=>'myMenu',
'items'=>array(
array(
'label'=>'Home',
'url'=>array('site/index'),
'itemOptions'=>array('class'=>'visited'),
'linkOptions'=>array('class'=>'bar'),
),
array('label'=>'Sign Out', 'url'=>array('site/signout')),
),
);

Эти команды позволят Yii сгенерировать следующий кусочек меню:

...
<ul id="myMenu">
<li class="visited">
<a class="bar" href="/site/index">Home</a>
</li>
...

Установив таким образом идентификаторы и классы в шаблоне html, далее расписывайте в файле стилей .css соответствующее оформление для них.Read more
Wiki: Yii 1.1 Minimizing Script Files by clientScript - scriptMap. CGoogleApi - initwiki
posted by admin on October 6, 2016
Complex pages often need to include many external JavaScript and CSS files. Because each file would cause one extra round trip to the server and back, we should minimize the number of script files by merging them into fewer ones. We should also consider reducing the size of each script file to reduce the network transmission time. There are many tools around to help on these two aspects.

For a page generated by Yii, chances are that some script files are rendered by components that we do not want to modify (e.g. Yii core components, third-party components). In order to minimizing these script files, we need two steps.

First, we declare the scripts to be minimized by configuring the scriptMap property of the clientScript application component. This can be done either in the application configuration or in code. For example,

$cs=Yii::app()->clientScript;
$cs->scriptMap=array(
'jquery.js'=>'/js/all.js',
'jquery.ajaxqueue.js'=>'/js/all.js',
'jquery.metadata.js'=>'/js/all.js',
......
);

What the above code does is that it maps those JavaScript files to the URL /js/all.js. If any of these JavaScript files need to be included by some components, Yii will include the URL (once) instead of the individual script files.

Second, we need to use some tools to merge (and perhaps compress) the JavaScript files into a single one and save it as js/all.js.

The same trick also applies to CSS files.

We can also improve page loading speed with the help of Google AJAX Libraries API. For example, we can include jquery.js from Google servers instead of our own server. To do so, we first configure the scriptMap as follows,

$cs=Yii::app()->clientScript;
$cs->scriptMap=array(
'jquery.js'=>false,
'jquery.ajaxqueue.js'=>false,
'jquery.metadata.js'=>false,
......
);

By mapping these script files to false, we prevent Yii from generating the code to include these files. Instead, we write the following code in our pages to explicitly include the script files from Google,

<head>
<?php echo CGoogleApi::init(); ?>

<?php echo CHtml::script(
CGoogleApi::load('jquery','1.3.2') . "\n" .
CGoogleApi::load('jquery.ajaxqueue.js') . "\n" .
CGoogleApi::load('jquery.metadata.js')
); ?>
......
</head>
Read more
Resolved: How to create gitignore and htaccess files on xampp
posted by admin on October 6, 2016
I want to create gitignore and htaccess files on xampp, without errors. I have got errors on file type places.Read more
Resolved: Yii cactiverecord not saving model
posted by admin on September 6, 2016
My model:

<?php

/**
* This is the model class for table "tbl_test".
*
* The followings are the available columns in table 'tbl_test':
* @property integer $id
* @property string $name
* @property integer $status_id
*
* The followings are the available model relations:
* @property TblQuestion[] $tblQuestions
* @property TblStatus $status
*/
class Test extends CActiveRecord
{
public $status_list;
public $status_listdata;
/**
* @return string the associated database table name
*/
public function tableName()
{
return 'tbl_test';
}

/**
* @return array validation rules for model attributes.
*/
public function rules()
{
// NOTE: you should only define rules for those attributes that
// will receive user inputs.
return array(
array('name, status_id', 'required'),
//array('status_id', 'numerical', 'integerOnly'=>true),
array('name', 'length', 'max'=>255),
// The following rule is used by search().
// @todo Please remove those attributes that should not be searched.
array('id, name, status_id', 'safe', 'on'=>'search'),
);
}

/**
* @return array relational rules.
*/
public function relations()
{
// NOTE: you may need to adjust the relation name and the related
// class name for the relations automatically generated below.
return array(
'question' => array(self::HAS_MANY, 'Question', 'test_id'),
'status' => array(self::BELONGS_TO, 'Status', 'status_id'),
);
}

/**
* @return array customized attribute labels (name=>label)
*/
public function attributeLabels()
{
return array(
'id' => 'ID',
'name' => 'Name',
'status_id' => 'Status',
);
}

/**
* Retrieves a list of models based on the current search/filter conditions.
*
* Typical usecase:
* - Initialize the model fields with values from filter form.
* - Execute this method to get CActiveDataProvider instance which will filter
* models according to data in model fields.
* - Pass data provider to CGridView, CListView or any similar widget.
*
* @return CActiveDataProvider the data provider that can return the models
* based on the search/filter conditions.
*/
public function search()
{
// @todo Please modify the following code to remove attributes that should not be searched.

$criteria=new CDbCriteria;

$criteria->compare('id',$this->id);
$criteria->compare('name',$this->name,true);
$criteria->compare('status_id',$this->status_id);

return new CActiveDataProvider($this, array(
'criteria'=>$criteria,
));
}

/**
* Returns the static model of the specified AR class.
* Please note that you should have this exact method in all your CActiveRecord descendants!
* @param string $className active record class name.
* @return Test the static model class
*/
public static function model($className=__CLASS__)
{
return parent::model($className);
}

public function __construct() {
$this->status_list = Status::model()->findAll();
$this->status_listdata = CHtml::listData($this->status_list,'id','name');
}
}


My Controller actionCreate:

public function actionCreate()
{
$model=new Test;

if($model->save()){
$this->redirect(array('view','id'=>$model->id));
}else{
die("asd");
}// Uncomment the following line if AJAX validation is needed
$this->performAjaxValidation($model);

if(isset($_POST['Test']))
{
$model->attributes=$_POST['Test'];

}

$this->render('create',array(
'model'=>$model,
));
}
Read more
Resolved: jquery click doesnt work on ajax generated content
posted by admin on September 4, 2016
I am using $(".button").on("click", function(){ });

to click to a button which is on a container but then an ajax call is done and the content gets updated with new stuff and then when i try to click .button it wont work... nothing will get returned when i click the button.

I even tried

$(".button").live("click", function(){ });

or

$(".button").click(function(){ });
Read more
Resolved: Copy textarea text to the clipboard in JavaScript?
posted by admin on August 26, 2016
What is the best way to copy text to the clipboard? (multi-browser)
Like CTRL + CRead more
Wiki: Задача MySQL. Выбрать из таблицы те книги, у которых два и более автораwiki
posted by admin on August 24, 2016
Таблица авторов:

CREATE TABLE `tbl_author` (
`id` int(10) NOT NULL,
`name` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

ALTER TABLE `tbl_author`
ADD PRIMARY KEY (`id`);


Таблица книг

CREATE TABLE `tbl_book` (
`id` int(10) NOT NULL,
`name` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

ALTER TABLE `tbl_book`
ADD PRIMARY KEY (`id`);


Таблица связей межу таблицей книг и авторов

CREATE TABLE `tbl_book_author` (
`id` int(10) NOT NULL,
`book_id` int(10) NOT NULL,
`author_id` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

ALTER TABLE `tbl_book_author`
ADD PRIMARY KEY (`id`),
ADD KEY `book_id` (`book_id`),
ADD KEY `author_id` (`author_id`);


Решение

SELECT book.id, book.name, COUNT(ba.author_id) AS cnt FROM `tbl_book_author` ba
LEFT JOIN tbl_book book
ON book.id = ba.book_id
GROUP BY ba.book_id
HAVING cnt > 1
Read more
Resolved: Remove focus from an input field in a jquery dialog
posted by admin on August 24, 2016
I have a button onclick of which a jquery dialog appears with two input fields which are jquery datepickers. Whenever the dialog appears, the first fields gets focus automatically, hence the datepicker pops up. I have resolved this for now by adding another dummy input field. Is there a better way ?

Sorry if the question is repeated. I tried searching for one already existing but couldn't get one. Please point me to an existing question if present.

Edit:

Okay my code goes as follows. onClick of a button the jdialog appears and there are 2 datepicker input fields inside the div "select_date_dialog".

$("#select_date").click(function(){
$("#select_date_dialog").dialog({
modal: true,
dialogClass: 'connect-dialog',
height: 100,
width: 500
});
});

afaik: can you be a bit more specific how blur will help me ? I tried adding this as suggested.

open: function(event, ui) {
$('#custom_from_date').blur();
}

blur happens when there input field loses focus. can i use blur to specify whether that field should get focus or not ?Read more
Wiki: Responsive multilevel menu with Bootstrap 3 - Second and Third level submenuwiki
posted by admin on August 18, 2016
HTML

<div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">NavBar</a>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav navbar-right">
<li><a href="https://github.com/fontenele/bootstrap-navbar-dropdowns" target="_blank">GitHub Project</a></li>
</ul>
<ul class="nav navbar-nav">
<li class="active"><a href="#">Home</a></li>
<li>
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Menu 1 <b class="caret"></b></a>
<ul class="dropdown-menu multi-level">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
<li class="divider"></li>
<li><a href="#">One more separated link</a></li>
<li class="dropdown-submenu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown</a>
<ul class="dropdown-menu">
<li><a href="#">Action</a></li>
<li class="dropdown-submenu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown</a>
<ul class="dropdown-menu">
<li class="dropdown-submenu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown</a>
<ul class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
<li class="divider"></li>
<li><a href="#">One more separated link</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li>
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Menu 2 <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
<li class="divider"></li>
<li><a href="#">One more separated link</a></li>
<li class="dropdown-submenu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown</a>
<ul class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
<li class="divider"></li>
<li class="dropdown-submenu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown</a>
<ul class="dropdown-menu">
<li class="dropdown-submenu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown</a>
<ul class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
<li class="divider"></li>
<li><a href="#">One more separated link</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div><!--/.nav-collapse -->
</div>
</div>

CSS

.dropdown-submenu {
position: relative;
}

.dropdown-submenu>.dropdown-menu {
top: 0;
left: 100%;
margin-top: -6px;
margin-left: -1px;
-webkit-border-radius: 0 6px 6px 6px;
-moz-border-radius: 0 6px 6px;
border-radius: 0 6px 6px 6px;
}

.dropdown-submenu:hover>.dropdown-menu {
display: block;
}

.dropdown-submenu>a:after {
display: block;
content: " ";
float: right;
width: 0;
height: 0;
border-color: transparent;
border-style: solid;
border-width: 5px 0 5px 5px;
border-left-color: #ccc;
margin-top: 5px;
margin-right: -10px;
}

.dropdown-submenu:hover>a:after {
border-left-color: #fff;
}

.dropdown-submenu.pull-left {
float: none;
}

.dropdown-submenu.pull-left>.dropdown-menu {
left: -100%;
margin-left: 10px;
-webkit-border-radius: 6px 0 6px 6px;
-moz-border-radius: 6px 0 6px 6px;
border-radius: 6px 0 6px 6px;
}
Read more