Skip to main content

Posts

Showing posts from 2016

Drupal clean url virtual host

# Place any notes or comments you have here # It will make any customisation easier to understand in the weeks to come # domain: domain1.com # public: /home/demo/public_html/domain1.com/ <VirtualHost *:80>   # Admin email, Server Name (domain name) and any aliases   ServerAdmin navin@cheapflysky.com   ServerName  cheapflysky.com   ServerAlias www.cheapflysky.com   # Index file and Document Root (where the public files are located)   DirectoryIndex index.php   DocumentRoot /var/www/html/cheapflysky.com   <Directory /var/www/html/cheapflysky.com/>    Options Indexes FollowSymLinks MultiViews    AllowOverride All    Order allow,deny    allow from all </Directory>   # Custom log file locations   LogLevel warn   ErrorLog /var/log/apache2/error-cheapflysky.com.log   CustomLog /var/log/apache2/access-cheapflysky.com.log combined </VirtualHost>

How to install SSL on any domain which is commercialy bought

1. get ssl from ssls.com which is comodo 2. go to my certificates. 3. generate CRS on https://www.thesslstore.in/ssltools/csr-generator.php#results 4. save both certificate request and private key code in a file 5. validate domain with email or file upload. 6. after some time certificate will become active. 7. download files and upload them to a save folder on server. 8. upload privatekey file you saved in same folder. and change 000-default.conf file or any virualhost file <VirtualHost *:80>         # The ServerName directive sets the request scheme, hostname and port that         # the server uses to identify itself. This is used when creating         # redirection URLs. In the context of virtual hosts, the ServerName         # specifies what hostname must appear in the request's Host: header to         # match this virtual host. For the default virtual host (this file) this         # value is not decisive as it is used as a last resort host regardless.  

Install node on ubuntu

//Download cd ~/Downloads wget https://nodejs.org/dist/v4.4.5/node-v4.4.5-linux-x64.tar.xz //Install cd /usr/local tar --strip-components 1 -xJf ~/Downloads/node-v4.4.5-linux-x64.tar.xz //Verify node -v npm version

How to change mysql root password through ssh on linode

How to change mysql root password through ssh on linode /etc/init.d/mysql stop mysqld_safe --skip-grant-tables & mysql -u root mysql> use mysql; mysql> update user set password=PASSWORD("newrootpassword") where User='root'; mysql> flush privileges; mysql> quit /etc/init.d/mysql stop /etc/init.d/mysql start if have error that there is no password then mysql > use mysql ; mysql > show tables ; mysql> describe user; update user set authentication_string=password('1111') where user='root';

Javascript Search in Object Array Like SQL By Object Key

var keywords = [     {"keyword": "Sample 1", "item": {"title":"Sample Title", "url": "/sample"}},     {"keyword": "Foo 1", "item": {"title":"Foo Title", "url": "/sample"}} ]; $("#query").on('keyup', function() {     var search = this.value.toLowerCase();     var result = $.grep(keywords, function(el) {         return el.keyword.toLowerCase().indexOf(search) > -1;     });         log(result) }); function log(rows) {     var str = '';     $.each(rows, function(i, row) {         str += JSON.stringify(row) + '<br>';     });     $('#log').html(str); }

Hide a column of table with jquery

<table> <thead> <td><input type = "checkbox" checked = "checked" /></td> <td><input type = "checkbox" checked = "checked" /></td> <td><input type = "checkbox" checked = "checked" /></td> <td><input type = "checkbox" checked = "checked" /></td> <td><input type = "checkbox" checked = "checked" /></td> </thead> <tbody> <tr> <td> column 1 </td> <td> column 2 </td> <td> column 3 </td> <td> column 4 </td> <td> column 5 </td> </tr> </tbody> </table> $(document).on('change', 'table thead input', function() { var checked = $(this).is(":checked"

Search within associative array

Search within associative array this is value -- pc..5 Parent this is column -- $data['user_name'] Array ( [0] => Array ( [id] => 12 [user_name] => Tintin-PC..1 Parent [port] => 744 [ip] => 122.162.235.239 [source] => India [type] => 1 [version] => 1 ) [4] => Array ( [id] => 25 [user_name] => pc..5 Parent [port] => 264 [ip] => 115.249.8.245 [source] => India [type] => 1 [version] => 5 ) array_search('pc..5 Parent', array_map(function($data) {return $data['user_name'];}, $arrayofparents));

How To Set Up vsftpd on Ubuntu

How To Set Up vsftpd on Ubuntu Step One—Install vsftpd You can quickly install vsftpd on your virtual private server in the command line: sudo apt-get install vsftpd Once the file finishes downloading, the VSFTP will be on your droplet. Generally speaking, it is already configured with a reasonable amount of security. However, it does provide access on your VPS to anonymous users. Step Two—Configure vsftpd Once vsftpd is installed, you can adjust the configuration. Open up the configuration file: sudo nano /etc/vsftpd.conf The biggest change you need to make is to switch the Anonymous_enable from YES to NO: anonymous_enable=NO Prior to this change, vsftpd allowed anonymous, unidentified users to access the server's files. This is useful if you are seeking to distribute information widely, but may be considered a serious security issue in most other cases. After that, uncomment the local_enable option, changing it to yes and, additionally, allow the user to w

How to upload file in MEAN Stack

How to upload file in MEAN Stack Do these steps 1. npm install ng-file-upload 2. include ng-file-upload.min.js in your angular index .html 3. Use this example to copy form to your angular page from where u want to upload file. -- http://jsfiddle.net/0m29o9k7/ or http://jsfiddle.net/danialfarid/2vq88rfs/136/ Copy this code outside of any form which is already there: 4. Change this url from example code to where you want to upload files -- url: 'https://angular-file-upload-cors-srv.appspot.com/upload', 6. In your server.js or app.js which ever you are using as (node server.js) to start app add these lines     var crypto = require('crypto');         var mime = require('mime');         var multer  = require('multer');                     var storage = multer.diskStorage({           destination: function (req, file, cb) {             cb(null, 'app/app-content/images/')           },           filename: function (req, file, cb) {

Make page reload in angular if the dom is having problem with jquery javascript ot require js anything in dom is not working.

Make page reload in angular if the dom is having problem with jquery javascript ot require js anything in dom is not working. myApp.controller('mainController', ['$scope', '$rootScope', '$location', '$log', '$route', '$cookieStore', '$interval', function($scope,$rootScope,$location,$log,$route,$cookieStore,$interval){       $rootScope.hideit = false;               var startTime = new Date();       var firstR = new Date($cookieStore.get('firstreload'));       var diff = startTime - firstR;       var finalDiffToCheck = diff/1000;       if($cookieStore.get('firstreload') === undefined){         $log.info("case page has not been loaded at all");       }       if(finalDiffToCheck > 4){         $log.info("case page has to be reloaded");         window.location.reload();       }             //$log.info("first reload : "+$cookieStore.get('firstreload'));

How to install sass for desiger scss.

How to install sass for desiger scss. 1. Google ruby 2. http://rubyinstaller.org/ 3. then open cmd 4. gem install sass 5. then run command c:\sass Then cd where your css will be then create a file .scss Then run command c:\path\sass --watch C:\wamp\www\sasstut\style.scss:C:\wamp\www\sasstut\style.css Then write your sass in scss file and enjoy sass

How to remove file from git?

How to remove file from git? Use  git rm : git rm file1.txt git commit -m "remove file1.txt" But if you want to remove the file only from the Git repository and not remove it from the filesystem, use: git rm --cached file1.txt

Get element and child or sibling with javascript without jquery

Get element and child or sibling with javascript without jquery   <script type="text/javascript">        function myFunction(ele,condition) {             var x = ele;             var a;             for (a = 0; a < x.length; a++){                 if(x[a].nodeName == condition){                   return x[a];                 }             }                return false;        }         function changeArrow(ele){                 var nextchildele = ele.childNodes;         var parentele = ele.parentElement;         var nextele = parentele.nextSibling;         console.log(nextchildele);         var i = 1;         var eleNow;         while (nextele) {           console.log(i + '. ' + nextele.nodeName);           if(nextele.nodeName == 'DIV'){             eleNow = nextele;             if(hasClass(eleNow, 'in') === true){                                 var res = myFunction(nextchildele,'H4');                 va

Create a .bat file in windows to run a looping command sometimes needed for php to execute a script without apache memory limit and execution time is not implemented here

Create a .bat file in windows to run a looping command sometimes needed for php to execute a script without apache memory limit and execution time is not implemented here @echo off setlocal enableextensions enabledelayedexpansion set /a "x = 0" :while1     if %x% leq 5 (         echo %x%         php c:\wamp\www\deamon.php         timeout 1         set /a "x = x + 0"         goto :while1     ) endlocal

How to make wamp server online

How to make wamp server online http://www.simonewebdesign.it/how-to-put-online-your-wampserver/ 6 down vote accepted It should have been a simple case of left clicking the WAMPManager menu and clicking  Put online . What that would have done is changed this section of  httpd.conf  from this: If using Apache 2.2.x # onlineoffline tag - don't remove Order Deny,Allow Deny from all Allow from 127.0.0.1 ::1 localhost To this: # onlineoffline tag - don't remove Order Allow,Deny Allow from all If using Apache 2.4.x # onlineoffline tag - don't remove Require local To this: # onlineoffline tag - don't remove Require all granted And strictly thats all you should have needed to do! But as you have done some manual messing with httpd.conf here are some things you need to check. I am assuming you wanted to change the port to 8080 rather than thinking you had to for some reason. If you didnt want to change port number

how to setup git in windows machine

how to setup git in windows machine #install github for windows - https://git-for-windows.github.io/ #create folder #select folder right click and git bash here in cmd line use or create a new repository on the command line echo "# test" >> README.md git init git add README.md git commit -m "first commit" git remote add origin https://github.com/spectrumted/test.git git push -u origin master …or push an existing repository from the command line git remote add origin https://github.com/spectrumted/test.git git push -u origin master ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ to add git on webserver download putty give cpanel domain as host port 22 then ok enter username password then at the root cpanel From your home directory( cd ~/ ), get the rpm: $ wget http://pkgs.repoforge.org/git/git-1.7.9.6-1.el5.rf.i386.rpm Install & Configure Git Unpack git using rpm2cpio and cpio:  

error when Fatal error: Maximum execution time of 300 seconds exceeded in C:\xampp\phpMyAdmin\libraries\dbi\DBIMysqli.class.php

error when Fatal error: Maximum execution time of 300 seconds exceeded in C:\xampp\phpMyAdmin\libraries\dbi\DBIMysqli.class.php max_upload_size max_input_time memory_limit in php.ini should be increased There's a configuration variable within the phpMyAdmin directory that you can find in  libraries\config.default.php  called  $cfg['ExecTimeLimit']  that you can set to whatever maximum execution time you need. $cfg['ExecTimeLimit']

Important notes for pyrocms. pyrocms is a cms built on codeigniter

Important notes for pyrocms and codeigniter pyrocms is a cms built on codeigniter PYROCMS NOTES //is_logged_in() TO CHECK USER LOGGED IN OR NOT //$this->current_user->group out put current user group //$this->permissions); //$this->module SHARE RESOURCES BETWEEN MODELS $this->load->model('navigation/navigation_m'); /&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&/ /****************************************************************************/ //ACCESSING MODEL FROM ANOTHER MODULE $this->load->model('mailchimp/mailchimp_m'); $ModelMailChimp = new Mailchimp_m(); echo $ModelMailChimp->thisIsWorki

Html Parsing code example

Meaning of parsing is to get required information out from html and save it in database like email address. Html Parsing code example Click here to download sample code for parsing a html file  parsing sample code

preg expression regular expression details and introduction

preg expression regular expression details and introduction Useful regex examples Reference: http://www.catswhocode.com/blog/15-php-regular-expressions-for-web-developers REGULAR EXPRESSIONS SYNTAX Regular Expression Will match… foo The string “foo” ^foo “foo” at the start of a string foo$ “foo” at the end of a string ^foo$ “foo” when it is alone on a string [abc] a, b, or c [a-z] Any lowercase letter [^A-Z] Any character that is not a uppercase letter (gif|jpg) Matches either “gif” or “jpg” [a-z]+ One or more lowercase letters [0-9.-] Аny number, dot, or minus sign ^[a-zA-Z0-9_]{1,}$ Any word of at least one letter, number or _ ([wx])([yz]) wy, wz, xy, or xz [^A-Za-z0-9] Any symbol (not a number or a letter) ([A-Z]{3}|[0-9]{4}) Matches three letters or four numbers PHP REGULAR EXPRESSION FUNCTIONS Function Description preg_match() The preg_match() function searches string for pattern, returning true if pattern exists, and false otherwise. preg_match_