menu

Sunday, 12 November 2017

Validating field with tooltip validation

When using FormValidation with some server-side frameworks such as CakePHPSymfonyRailsSpring, etc, there is a relationship between the model name and the attributename of input.
For example, assuming that a user is modeled by classUser withfirstNamelastName usernameemails[] properties.


git set up command

=========== Use GIT command ==========

>> sudo mkdir foldername
>> cd foldername/
>> git init
>> git remote add origin https://github.com/abc/project.git 


>> git fetch   
[ User : git-user-name , Pwd : git-pwd ]
>> git pull origin HEAD:Branch      [ User , Pwd ]
>> git add file_name.php
>> git commit -m "comment for add file"
>> git push origin HEAD:Branch     [ User , Pwd ]


>> git remote set-url origin https://git-user-name@github.com/abc/project.git    (For Setting Github User)

=============Add sql file in Xamp in ubuntu ===========

/opt/lampp/bin/php start
/opt/lampp/bin/mysql start

/opt/lampp/bin/mysql -h localhost -u root -p

use DatabseName; 
source /home/atul/Downloads/xyz.sql
==============Edit for file permission in wordpress ===============
find /path/to/your/wordpress/install/ a
find /path/to/your/wordpress/install/ -type f -exec chmod 644 {} \;
================== Add IP on host =================

sudo gedit /etc/hostname /etc/hosts
cd /etc
sudo gedit host

====================

Wednesday, 16 November 2016

basic commad of svn

find . -type d -name .svn -print0 | xargs -0 rm -rf          /* remove the svn folder from project */

svn co http://192.168.4.10/project_path     /* svn checkout */

svn ci -m 'commit'            /* commit the project */

svn up            /* update fron svn  */

svn st            /* check file in the project project which are not committed */

svn add *       /* add new file */

svn ci -m 'commit'            /* commit the project */

svn ci -m 'ciommit' folder_name/filename.php /* commit folder and file */

vim filename.php               /* for open file in online server */

i                        /* inset for online */

:wq!                   /* save and exit from file */
:q!          /* without save exit */

svn mkdir folder_name    /* Create folder name */

chmod -R 777 folder_name/       /* change folder permision */

mysql -u username -p database_name < file_name.sql    /* import database in mysql */

Tuesday, 11 August 2015

how to remove index.php from url in magento

1) Log-in to your Magento administration area then go to 'System > Configuration > Web'.
2) Navigate to the 'Unsecure' and 'Secure' tabs. Make sure the 'Unsecured' and 'Secure' - 'Base Url' options have your domain name within it, and do not leave the forward slash off at the end of the URL. Example: http://www.yourdomain.co.uk/
3) While still on the 'Web' page, navigate to 'Search Engine Optimisation' tab and select 'YES' underneath the 'Use Web Server Rewrites' option.
4) Navigate to the 'Secure' tab again (if not already on it) and select 'Yes' on the 'Use Secure URLs in Frontend' option.
5) NoW go to the root of your Magento website folder and use this code for your .htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
Save the .htaccess and replace the original file. (PLEASE MAKE SURE TO BACKUP YOUR ORIGINAL .htaccess FILE BEFORE MESSING WITH IT!!!)
6) Now go to 'System > Cache Management'     refresh


logout  and enjoy.

Sunday, 9 August 2015

how to save div content as image using jquery

html2canvas

This script allows you to take "screenshots" of webpages or parts of it, directly on the users browser. The screenshot is based on the DOM and as such may not be 100% accurate to the real representation as it does not make an actual screenshot, but builds the screenshot based on the information available on the page.
Learn more »

Saturday, 8 August 2015

how to create categogories in magento or emport and export from database.

Category Creation in magento
Whenever you created category in magento then the created category info will be insert into following tables in magento
1. catalog_category_entity
2. catalog_category_entity_datetime
3. catalog_category_entity_decimal
4. catalog_category_entity_int
5. catalog_category_entity_text
6. catalog_category_entity_varchar
7. catalog_category_flat

remember if you want import category in magento so you simply these these table data export from another database and import whenever you want that its .


Saturday, 1 August 2015

How to integrate stripe payment gateway in php


Stripe Checkout New
No need to design payment forms from scratch. Stripe Checkout offers a beautiful, customizable payment flow that works great across desktop and mobile. When you use Checkout, you’re always up-to-date, with no extra code required.
Explore Checkout

Total control with Stripe.js

Stripe.js securely transmits card details from browsers to Stripe. Use it to control every pixel of the experience and let Stripe take care of the pesky processing and compliance.
This is very simple coding for integrate stripe payment in php. please look the copy the code and paste in your working file.           READ MORE

<?php   require 'stripe/lib/Stripe.php';
if ($_POST) {
 // Stripe::setApiKey("pk_test_RLTidE9AhJ0DENd5pLCieMpm");
  $error = '';
  $success = '';
  try {
    if (!isset($_POST['stripeToken']))
      throw new Exception("The Stripe Token was not generated correctly");
    Stripe_Charge::create(array("amount" => 10,
                                "currency" => "usd",
                               "card" => $_POST['stripeToken']));
    $success = 'Your payment was successful.'.$_POST['stripeToken'];
  }
  catch (Exception $e) {
    $error = $e->getMessage();
  }
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
  <title>Stripe Getting Started Form</title>

  <!-- The required Stripe lib -->
  <script type="text/javascript" src="https://js.stripe.com/v2/"></script>

  <!-- jQuery is used only for this example; it isn't required to use Stripe -->
  <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>

  <script type="text/javascript">
    // This identifies your website in the createToken call below
    Stripe.setPublishableKey('pk_test_RLTidE9AhJ0DENd5pLCieMpm');
    var stripeResponseHandler = function(status, response) {
      var $form = $('#payment-form');
      if (response.error) {
        // Show the errors on the form
        $form.find('.payment-errors').text(response.error.message);
        $form.find('button').prop('disabled', false);
      } else {
        // token contains id, last4, and card type
        var token = response.id;
        // Insert the token into the form so it gets submitted to the server
        $form.append($('<input type="hidden" name="stripeToken" />').val(token));
        // and re-submit
        $form.get(0).submit();
      }
    };
    jQuery(function($) {
      $('#payment-form').submit(function(e) {
        var $form = $(this);
        // Disable the submit button to prevent repeated clicks
        $form.find('button').prop('disabled', true);
        Stripe.card.createToken($form, stripeResponseHandler);
        // Prevent the form from submitting with the default action
        return false;
      });
    });
  </script>
</head>
<body>
  <h1>Charge $10 with Stripe</h1>
<span class="payment-errors"><?= $error ?></span>
        <span class="payment-success"><?= $success ?></span>

<form action="" method="POST" id="payment-form">
  <script
    src="https://checkout.stripe.com/checkout.js" class="stripe-button"
    data-key="pk_test_RLTidE9AhJ0DENd5pLCieMpm"
    data-amount="50"
    data-name="online Pay with stripe"
    data-description="Your Card items payment"
    data-image="https://stripe.com/img/documentation/checkout/marketplace.png"
    data-currency="USD">
  </script>
</form>
</body>
</html>