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 11-20 of 273 results.
Wiki: PHP file with array with key value from MySQL table columns generator functionwiki
posted by admin on April 18, 2017

public function array_from_table_generator($table, $id, $name, $prefix = 'tbl_'){
try
{
$sql = "SELECT t.".$id.", t.".$name." FROM ".$prefix.$table. " t ORDER BY t.id DESC";
// it is select query by mysql query or mysqli or by your way
/* $results = SELECT($sql); */ //change this field by your SELECT and
// end of select query
$string = '';
$filename = '../array/'.$table.'.php';

$string .= '<?php $array = '.PHP_EOL.'array('.PHP_EOL;
foreach($results as $key => $value){
$string .= chr(9).'"' . $value[$name] . '" => ' . $value[$id] . ','.PHP_EOL;
}
$string = rtrim(trim($string),',');
$string .= PHP_EOL.');';

$handle = fopen($filename, 'w');
fwrite($handle, $string);
fclose($handle);
echo $prefix.$table . " array generated successfully!
";
}catch ( Exception $e ) {
// send error message if you can
}
}

Usage:

array_from_table_generator('device', 'id', 'name');

Result:
device.php

<?php $array =
array(
"mobile device" => 2,
"desktop" => 1
);
Read more
Resolved: PHP fopen fwrite tab tabulation
posted by admin on April 18, 2017
I have code, where I create file and write string in that file
PHP:

$string = "Some text \t any text";
$handle = fopen($filename, 'w');
fwrite($handle, $string);
fclose($handle);

Output as same as I try to create

Some text \t any text
Read more
Resolved: PHP fopen fwrite new line
posted by admin on April 18, 2017
I have code, where I create file and write string in that file
PHP:

$string = "Some text \n any text \r\n more text \n\r";
$handle = fopen($filename, 'w');
fwrite($handle, $string);
fclose($handle);

Output as same as I try create

$string = "Some text \n any text \r\n more text \n\r";

How to write text in file with new line?Read more
Resolved: Odnoklassniki OK api apiok users.getInfo all fields without errors
posted by admin on April 17, 2017
I try to get all allowed fields from user by id, and got some error

{
error_code:100
error_msg:PARAM : Invalid parameter fields value : [accessible,age,allows_anonym_access,allows_messaging_only_for_friends,birthday,blocked,blocks,can_vcall,can_vmail,capabilities,common_friends_count,current_location,current_status,current_status_date,current_status_date_ms,current_status_id,current_status_track_id,email,feed_subscription,first_name,friend,friend_invitation,gender,has_email,has_service_invisible,invited_by_friend,is_activated,last_name,last_online,last_online_ms,location,login,modified_ms,name,notifications_subscription,online,photo_id,pic1024x768,pic128max,pic128x128,pic180min,pic190x190,pic224x224,pic240min,pic288x288,pic320min,pic50x50,pic600x600,pic640x480,pic_1,pic_2,pic_3,pic_4,pic_5,pic_base,pic_full,pic_max,premium,presents,private,ref,registered_date,registered_date_ms,relationship,show_lock,uid,url_chat,url_chat_mobile,url_profile,url_profile_mobile,vip]
error_data:null
}

All fields I got from apiok official page

[{
accessible:Boolean
age:Integer
allows_anonym_access:Boolean
allows_messaging_only_for_friends:Boolean
birthday:String
blocked:Boolean
blocks:Boolean
can_vcall:Boolean
can_vmail:Boolean
capabilities:String
common_friends_count:Integer
current_location:{
altitude:Float
cellId:Integer
city:String
country:String
ipAddress:String
latitude:Float
longitude:Float
}
current_status:String
current_status_date:Date
current_status_date_ms:Long
current_status_id:String
current_status_track_id:String
email:String
feed_subscription:Boolean
first_name:String
friend:Boolean
friend_invitation:Boolean
gender:String
has_email:Boolean
has_service_invisible:Boolean
invited_by_friend:Boolean
is_activated:Boolean
last_name:String
last_online:String
last_online_ms:Long
locale:String
location:{
city:String
country:String
countryCode:String
countryName:String
}
login:String
modified_ms:Long
name:String
notifications_subscription:Boolean
online:String
photo_id:String
pic1024x768:String
pic128max:String
pic128x128:String
pic180min:String
pic190x190:String
pic224x224:String
pic240min:String
pic288x288:String
pic320min:String
pic50x50:String
pic600x600:String
pic640x480:String
pic_1:String
pic_2:String
pic_3:String
pic_4:String
pic_5:String
pic_base:String
pic_full:String
pic_max:String
premium:Boolean
presents:[{}]
private:Boolean
ref:String
registered_date:Date
registered_date_ms:Long
relations:[{}]
relationship:{}
show_lock:Boolean
uid:String
url_chat:String
url_chat_mobile:String
url_profile:String
url_profile_mobile:String
vip:Boolean
}]
Read more
Wiki: Loads a JavaScript file asynchronously with a callback, like jQuery's $.getScript() except without jQuerywiki
posted by admin on April 13, 2017

function j(u, c) {
var h = document.getElementsByTagName('head')[0], s = document.createElement('script');
s.async = true; s.src = u;
s.onload = s.onreadystatechange = function () {
if (!s.readyState || /loaded|complete/.test(s.readyState)) {
s.onload = s.onreadystatechange = null; if (h && s.parentNode) { h.removeChild(s) } s = undefined;
if (c) { c() }
}
};
h.insertBefore(s, h.firstChild);
}
Read more
Wiki: How to make an AJAX call without jQuery with GET and POST?wiki
posted by admin on March 27, 2017
Using the following snippet you can do similar things pretty easily, like this:

ajax.get('/test.php', {foo: 'bar'}, function() {});

Here is the snippet:

var ajax = {};
ajax.x = function () {
if (typeof XMLHttpRequest !== 'undefined') {
return new XMLHttpRequest();
}
var versions = [
"MSXML2.XmlHttp.6.0",
"MSXML2.XmlHttp.5.0",
"MSXML2.XmlHttp.4.0",
"MSXML2.XmlHttp.3.0",
"MSXML2.XmlHttp.2.0",
"Microsoft.XmlHttp"
];

var xhr;
for (var i = 0; i < versions.length; i++) {
try {
xhr = new ActiveXObject(versions[i]);
break;
} catch (e) {
}
}
return xhr;
};

ajax.send = function (url, callback, method, data, async) {
if (async === undefined) {
async = true;
}
var x = ajax.x();
x.open(method, url, async);
x.onreadystatechange = function () {
if (x.readyState == 4) {
callback(x.responseText)
}
};
if (method == 'POST') {
x.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
}
x.send(data)
};

ajax.get = function (url, data, callback, async) {
var query = [];
for (var key in data) {
query.push(encodeURIComponent(key) + '=' + encodeURIComponent(data[key]));
}
ajax.send(url + (query.length ? '?' + query.join('&') : ''), callback, 'GET', null, async)
};

ajax.post = function (url, data, callback, async) {
var query = [];
for (var key in data) {
query.push(encodeURIComponent(key) + '=' + encodeURIComponent(data[key]));
}
ajax.send(url, callback, 'POST', query.join('&'), async)
};
Read more
Wiki: Yii2 basic include css js files to module views layout main from module assetswiki
posted by admin on March 1, 2017
Module Information
Module Admin

app/modules/admin/Module.php
app/modules/admin/views/default/index.php

Create Module ASSETS in Web folder with content

app/modules/admin/web/assets/css/style.css
app/modules/admin/web/assets/js/main.js

Create Module views layouts

app/modules/admin/views/layouts/main.php

Change your Module and change layouts way in your config web.php

<?php
$config = [
'id' => 'basic',
'basePath' => dirname(__DIR__),
'bootstrap' => ['gii'],
'modules' => [
'gii' => [
'class' => 'yii\gii\Module',
'allowedIPs' => ['127.0.0.1', '::1', '192.168.0.*', '192.168.178.20'] // adjust this to your needs
],
'admin' => [
'class' => 'app\modules\admin\Module',
// the layout that should be applied for views within this module
'layout' => 'main',
],
],
...........

Create Module new assets settings class
In modules/admin directory create file AdminAsset.php with content

<?php
namespace app\modules\admin;
use yii\web\AssetBundle;

class AdminAsset extends AssetBundle
{
public $sourcePath = '@app/modules/admin/web/assets';
public $css = [
'css/style.css',
];
public $depends = [
'yii\web\YiiAsset',
'yii\bootstrap\BootstrapAsset',
];
}

Go to your Admin Module layouts/main.php and replace your assets registration and namespace with

use app\modules\admin\AdminAsset;

AdminAsset::register($this);
Read more
Resolved: Yii2 basic render path problem in modules
posted by admin on March 1, 2017
In my layouts I have code with render

. . .
<div class="wrap">
<?= $this->render('/partials/menu'); ?>
</div>
. . .

And when I run my Module I have got error

The view file does not exist: The view file does not exist: /var/www/html/vktracker2/modules/admin/views/partials/menu.php

I tried to fix by

<?= $this->render(dirname(_FILE__) . '/partials/menu'); ?>

But it didn't helpRead more
Resolved: Yii2 Gii Module Generator error
posted by admin on March 1, 2017
Error Message:

yii2 module generator gii There was something wrong when generating the code. Please check the following messages.

Wrong operations

Generating code using template "/home/ssdd/app/etp.loc/app/vendor/yiisoft/yii2-gii/generators/module/default"...
generating modules/admin/Module.php
Unable to create the directory '/home/ssdd/app/etp.loc/app/frontend/modules/admin'.
generating modules/admin/controllers/DefaultController.php
Unable to create the directory '/home/ssdd/app/etp.loc/app/frontend/modules/admin/controllers'.
generating modules/admin/views/default/index.php
Unable to create the directory '/home/ssdd/app/etp.loc/app/frontend/modules/admin/views/default'.
done!
Read more
Wiki: Install Notepad ++ on Ubuntu 16.04wiki
posted by admin on February 28, 2017
To add the PPA, update apt-get and run install - open terminal (Ctrl+Alt+T) and run:

sudo add-apt-repository ppa:notepadqq-team/notepadqq
sudo apt-get update
sudo apt-get install notepadqq
Read more