How To Setup Virtual Hosts Using XAMPP

by on April 27th, 2017

xamppp

  1. Open this file httpd-vhosts.conf present in C:/xampp/apache/config/extra/
  2. add this code, sample :- NameVirtualHost *:80
    <VirtualHost *:80>
    DocumentRoot “d:/websites/sassnew/”
    ServerName sassnew
    </VirtualHost>
  3. Open file hosts present in “C:/Windows/System32/drivers/etc” using auth as admin and add this line
  4. 127.0.0.1 localhost
    127.0.0.1 sassnew
  5. Now restart apache and you can use now sassnew/

I guess this will help you.

How to use ExtJs inside React Js

by on December 3rd, 2016

Reference: Sencha

extjsreat
Just install @extjs/reactor:

.
npm install --save @extjs/reactor
.

…add the following code to your app:
React JS

.
import { install } from '@extjs/reactor';
install();
.

…and you can start using Ext JS components like the grid in your React components. Here’s an example:

.
import { Grid } from '@extjs/reactor/modern';

function MyReactComponent(props) {
return (
&amp;lt;div&amp;gt;
&amp;lt;h1&amp;gt;An Ext JS Grid in React&amp;lt;/h1&amp;gt;
&amp;amp;nbsp;

&amp;lt;/div&amp;gt;
)
}
.

To use any Ext JS component in React, simply import that component by xtype from @extjs/reactor/modern or @extjs/reactor/classic. Because React components are always upper case, @extjs/reactor automatically converts xtypes to lower case for your convenience. In other words:

.
import { Grid } from '@extjs/reactor/modern';
.

…is equivalent to:

.
import { grid as Grid } from '@extjs/reactor/modern';
.

This syntax is made possible by a babel plugin, @extjs/reactor-babel-plugin, which actually converts the above to:

.
import { reactify } from '@extjs/reactor';
const Grid = reactify('grid');
.

The reactify function creates a React component wrapper for any Ext JS class or xtype. You can use reactify on your own classes as well. For example, if you have a custom class with xtype: ‘mygrid’, you can use:

.
import { reactify } from '@extjs/reactor';
const MyGrid = reactify('mygrid');
.

Or, if you have a reference to the custom class, you pass it to reactify as well:

.
import { MyExtJSGrid } from './extComponents/MyExtJSGrid';
const MyGrid = reactify(MyExtJSGrid);
.

Once you’ve imported an Ext JS component, you can use it as you would any other React component. Configs are set using props. Any props starting with “on*” become listeners, so you can do things like:

<Grid
onSelect={(grid, record) => console.log(`${record.get(‘name’)} selected.`)}
/>
Child tags are automatically added to the items config, so Ext JS layouts work like you’d expect:
This panel is on the left.
This panel is on the right.

The @extjs/reactor package also adheres to React’s principle of minimizing changes to the dom. If you change the value of the title prop in this example:

.
function MyReactComponent({ title }) {
return (
My title may change!
);
}
.

…@extjs/reactor automatically calls the corresponding setTitle method on the Ext.Panel instance rather than tearing down and rebuilding the entire component.

Most React projects are built using webpack, so we’ve provided a plugin, @extjs/reactor-webpack-plugin, that produces a minimal build of Ext JS containing only those components that you use in your app. The plugin scans your code for import statements as well calls to Ext.create and Ext.require to determine which classes you use, then sends that information to Sencha Cmd to produce the minimized, optimized build of the framework. Here’s an example config:

.
plugins: [
new ExtJSReactorWebpackPlugin({
sdk: '/path/to/ext',
theme: 'theme-material',
toolkit: 'modern',
packages: ['charts']
})
]

.

Buy ExtJS and ReactJS books:

Hackerrank fibonacci lite

by on September 15th, 2016

Problem Url: Click Here

This is the solution code related to a problem i found at hackerrank.

$count = 0 ;
$total = 0;
$f1 = 1;
$f2 = 0;
while ($count &lt; $number )
{
$f3 = $f2 + $f1 ;
$total = $f3;
$f1 = $f2 ;
$f2 = $f3 ;
$count = $count + 1;
}
echo $total;

General mixed stuff about CakePHP, Delta Search

by on June 27th, 2014

Q1 : how to print query of find cakephp?
ans: $log = $this->getDataSource()->getLog(false, false); debug($log);

Q2: Socket transport “ssl” in PHP not enabled?
ans:
Rename php.ini-production to php.ini (in C:\xampp\php\ folder)
Edit php.ini and uncomment extension_dir=ext.
Also uncomment extension=php_openssl.dll.

Q3. how to close current tab
ans: window.open(”,’_self’).close();

 

Q4: How to remove Delta search:
I have a solution after finding zero help online, i decided to do it myself and found it was profoundly easy.

type in “about:config” in the url

accept “ill be careful i promise”

type in “new tab browser”

find the delta search bogus garbage and double click the url link.

replace it with what ever you like, google, yahoo, about:blank, after that everything should be the way it was.
Q5. how to take backup database ubuntu:
ans: mysqldump -u spendtrenz -p -h localhost –all-databases > naveen_db.sql

Q6. how to disable click of anchor tag using css:
ans: pointer-events: none; /* for disable click on anchor tag */

Ubuntu mysql connect remote server

by on July 26th, 2013

Commands For Ubuntu mysql connect remote server

For a client program to be able to connect to the MySQL server, it must use the proper connection parameters, such as the name of the host where the server is running and the user name and password of your MySQL account. Each connection parameter has a default value, but you can override them as necessary using program options specified either on the command line or in an option file (ubuntu mysql connect remote server).

The examples here use the mysql client program, but the principles apply to other clients such as mysqldump, mysqladmin, or mysqlshow.

This command invokes mysql without specifying any connection parameters explicitly:

shell> mysql

Because there are no parameter options, the default values apply:

The default host name is localhost. On Unix, this has a special meaning, as described later.

The default user name is ODBC on Windows or your Unix login name on Unix.

No password is sent if neither -p nor –password is given.

For mysql, the first nonoption argument is taken as the name of the default database. If there is no such option, mysql does not select a default database.

To specify the host name and user name explicitly, as well as a password, supply appropriate options on the command line:

Here is how to write commands for ubuntu mysql connect remote server:

shell> mysql --host=localhost --user=myname --password=mypass mydb

shell> mysql -h localhost -u myname -pmypass mydb

shell> mysql show databases
shell> mysql use database_name

For password options, the password value is optional:

If you use a -p or –password option and specify the password value, there must be no space between -p or –password= and the password following it.

If you use a -p or –password option but do not specify the password value, the client program prompts you to enter the password. The password is not displayed as you enter it. This is more secure than giving the password on the command line. Other users on your system may be able to see a password specified on the command line by executing a command such as ps auxw. See Section 6.1.2.1, “End-User Guidelines for Password Security”.

As just mentioned, including the password value on the command line can be a security risk. To avoid this problem, specify the –password or -p option without any following password value:

shell> mysql --host=localhost --user=myname --password mydb</pre>
shell> mysql -h localhost -u myname -p mydb

When the password option has no password value, the client program prints a prompt and waits for you to enter the password. (In these examples, mydb is not interpreted as a password because it is separated from the preceding password option by a space.)

Ubuntu stop and start tomcat service

by on July 26th, 2013

sudo service tomcat stop

sudo service tomcat start

CakePHP: How to call an action of another controller

by on July 24th, 2013


<?php
App::uses('AppController', 'Controller');
App::uses('EmployeesController', 'Controller');

class ReportingController extends AppController {

public function some(){

$Employees = new EmployeesController;
$Employees->constructClasses();

$Employees->areasAssigned();//areasAssigned function is in the Employees controller.

}

}

?>

Jasper soft manually installation

by on June 21st, 2013

Step 1: Download tomcat from here  and intall it.

Step 2: Download war file from war file find name  JasperReports Server WAR File Installer.

Step 3: Copy mysql_master.properties file from E:\softwares\jasperreports-server-cp-5.1.0-bin\buildomatic\sample_conf and paste into E:\softwares\jasperreports-server-cp-5.1.0-bin\buildomatic.

Step 4: Rename mysql_master.properties file to default_master.properties.

Step 5: Download mysql connector from here OR here

Step 6: Copy here E:\softwares\jasperreports-server-cp-5.1.0-bin\buildomatic\conf_source\db\mysql\jdbc.

Step 7: Run the command Like

E:\softwares\jasperreports-server-cp-5.1.0-bin\buildomatic>js-install-ce.bat

CakePHP HABTM how to save data

by on June 5th, 2013


CREATE TABLE IF NOT EXISTS `permissions` (
 `id` int(11) NOT NULL AUTO_INCREMENT,
 `name` varchar(45) NOT NULL,
 `displayName` varchar(255) NOT NULL,
 PRIMARY KEY (`id`)
)

CREATE TABLE IF NOT EXISTS `roles` (
 `id` int(11) NOT NULL AUTO_INCREMENT,
 `name` varchar(100) NOT NULL,
 `company_id` int(11) NOT NULL,
 `dashboard_type` varchar(100) NOT NULL,
 PRIMARY KEY (`id`),
 KEY `company_id` (`company_id`)
)

CREATE TABLE IF NOT EXISTS `roles_permissions` (
 `id` int(11) NOT NULL AUTO_INCREMENT,
 `role_id` int(11) NOT NULL,
 `permission_id` int(11) NOT NULL,
 PRIMARY KEY (`id`),
 KEY `fk_role_permissions_permissions1` (`permission_id`),
 KEY `fk_table1_roles1` (`role_id`)
)
Role Model:

public $hasAndBelongsToMany = array(
 'Permission' => array(
 'className' => 'Permission',
 'joinTable' => 'roles_permissions',
 'foreignKey' => 'role_id',
 'associationForeignKey' => 'permission_id',
 'unique' => 'keepExisting',
 'conditions' => '',
 'fields' => '',
 'order' => '',
 'limit' => '',
 'offset' => '',
 'finderQuery' => '',
 'deleteQuery' => '',
 'insertQuery' => ''
 )
 );

Permission model:

public $hasAndBelongsToMany = array(
 'Role' => array(
 'className' => 'Role',
 'joinTable' => 'roles_permissions',
 'foreignKey' => 'permission_id',
 'associationForeignKey' => 'role_id',
 'unique' => 'keepExisting',
 'conditions' => '',
 'fields' => '',
 'order' => '',
 'limit' => '',
 'offset' => '',
 'finderQuery' => '',
 'deleteQuery' => '',
 'insertQuery' => ''
 )
 );

RolePermission Model:

public $belongsTo = array(
 'Role' => array(
 'className' => 'Role',
 'foreignKey' => 'role_id',
 'conditions' => '',
 'fields' => '',
 'order' => ''
 ),
 'Permission' => array(
 'className' => 'Permission',
 'foreignKey' => 'permission_id',
 'conditions' => '',
 'fields' => '',
 'order' => ''
 )
 );

in Role controller:

public function add() {
 $roleData = $this->request->data;
 $roleToSave = array();
 $roleToSave['Role']['name'] = $roleData['name'];
 $roleToSave['Role']['dashboard_type'] = $roleData['dashboard_type'];
 $roleToSave['Role']['company_id'] = 1;
 $permissions = $roleData['permissions'];   //permissions (array)
 $roleToSave['Permission']['Permission'] = $permissions;
 $this->Role->create();
 $this->Role->saveAll($roleToSave);
}

Firstly your data should look like this:

array(
'Role' => array(
'name' => '3'
),
'Permission' => array(
'Permission' => array(
0 => '3'
)
)

and same for edit but one change

$this->id = $roleData['id'];

CakePHP HABTM List all related items

by on May 29th, 2013

public function getRolePermisions( $roleId ){
  $employee = $this->find('all', array(
   'conditions' => array( 'RolePermission.role_id' => $roleId )
 ));
 $list = Set::combine($employee,'{n}.Permission.id','{n}.Permission.name');
 return $list;
}
Inline
Inline