Friday, July 3, 2015

what big data & why big data

Standard


Data:,Everyone has talking about  data  today than years ago, past year (before come large ware house).people they doesn't have about any idea  how can use people behaviors in to business decision & How can you make money with it? While the first step is to reveal the wants and needs hidden inside the data, the more important step is to convert those wants and needs into profitable services through algorithms .
 from past year peoples are try to communicate they are needed s using computer & smart platform so reason that , business had to convert to virtual environment from physical environment. in close example BBC said they have to  cut more than 1,000 jobs in 2015 frist quart .they said increasing number of people do not watch live television, most people are use social network & web site to get information.  so do not need to pay the licence fee.
Big data

 is high-volume, high-velocity and high-variety information assets that demand cost-effective, innovative forms of information processing for enhanced insight and decision making .

how big data architecture 




please watch this video i hope you can  get Understand the trends that have led to the Big Data opportunity.



 MapReduce






Email templat engine_laravel 5

Standard


this is the way end mail with Email Template Engine .save templates in database and replace some fields and send mail frist confige your laravel email config file mail.php

return [

 'driver' => env('MAIL_DRIVER', 'smtp'),
 'host' => env('MAIL_HOST', 'smtp.gmail.com'),
 'port' => env('MAIL_PORT', 587),
 'from' => ['address' => 'youremail@gmail.com', 'name' => 'name'],
 'encryption' => 'tls',
 'username' => env('MAIL_USERNAME'),
 'password' => env('MAIL_PASSWORD'),
 'sendmail' => '/usr/sbin/sendmail -bs',
 'pretend' => false,

];
.env file
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=MyUsername@gmail.com
MAIL_PASSWORD=MyPassword

create data base & create email tempalte migration php artisan make:migration create_users_table upload migration file
class CreateEmailtemplateTable extends Migration {

 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
        Schema::create('emailtemplate', function(Blueprint $table)
        {
            $table->increments('id');
            $table->string('name');
            $table->string('variables',255);
            $table->string('subject', 255);
            $table->longText('description');
            $table->timestamp('created_at');
            $table->enum('status', array('1', '0'));
        });
 }

 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
  //
 }

}

OR you can upload sql file which on have in file in app\Http\Controllers.php add fuloowing function to accesss email sendig system throughout of you application IN CONTROLL.PHP
namespace App\Http\Controllers;

use Illuminate\Foundation\Bus\DispatchesCommands;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Mail;
use DB;
use Exception;

abstract class Controller extends BaseController {

 use DispatchesCommands, ValidatesRequests;



    public function sendemail($emil_template='',$mailsubject='',$email_variable='')
    {

//get data record using tempalte name

        $gettemplate=  $this->mailtemplate($emil_template);

//      deploy deta stringobject array
        $all_detail = [] ;
        foreach ($gettemplate[0] as $kay=>$tempalte_detail)
        {
            $all_detail[]=$tempalte_detail;
        }

//        get template description in to variable by channa
                  $description=$all_detail[4];

  //   send $description $description to VariableReplaceArray by channa
       $variable_replace_message= $this->VariableReplaceArray($email_variable,$description);

//     if controller subject is    get subject of email from default template
        if(empty($mailsubject))
            {
               $mailsubject=$all_detail[3];
            }

//get reciver name & email
        $receiver_name=$email_variable['{to_fname}'].' '.$email_variable['{to_lname}'];
        $receiver_email=$email_variable['{to_email}'];
//        echo '
'.print_r($receiver_email,1).'
'; // die(); Mail::send('email_tempate.user_template', ['mail_content' => $variable_replace_message], function($sendmail)use ($mailsubject,$receiver_name,$receiver_email) { $sendmail->to($receiver_email, $receiver_name); $sendmail->cc('noreply@gmail.com'); $sendmail->subject($mailsubject); }); return ; } // get email template from data table public function mailtemplate($getname) { // get email template $gettemplate = DB::table('emailtemplate')->where('name',$getname)->get(); //trigger exception in a "try" block for email template try { if(empty($gettemplate)) { //If the exception is thrown, this text will not be shown echo 'this title not available in email template table '; } } //catch exception catch(Exception $e) { echo 'Message: ' .$e->getMessage(); } return $gettemplate; } //VariableReplaceArray by channa public function VariableReplaceArray($email_variable,$description) { $getvariableArray=array_keys($email_variable); $replacevariableArray=array_values($email_variable); $variable_repalsement= str_replace($getvariableArray,$replacevariableArray,$description); return $variable_repalsement; } }
this is add your controller fuction which you create for send email
public function index()
 {

        $emil_template='user registration tempalate'; // template name  which need to send
        $mailsubject=""; //if user template default email subject kaeep this empty
        $message= 'this is the way end mail with Email Template Engine .save templates in database and replace some fields and send mail
        frist confige your laravel email config file mail.php';
//
        $email_variable=array(
            '{to_fname}'=>'channa',// receiver frist name
            '{to_lname}'=>'bandaara',//receiver last name
            '{to_email}'=>'channasmcs@gmail.com', //receiver email
            '{link}'=>'https://www.channasmcs.blogspot.com',// link if you send
            '{message}'=>$message, // message
        );
//        get this on sendemail function
        self::sendemail($emil_template,$mailsubject,$email_variable);


 }
$email_variable mean i define commen variable for repalce sender & reciever detail this method will easy becouse when we create template body like this (see sql file)
hello {to_fname} {to_lname} 



you have message


{message}



click this link {link}



thnank you
create folder resources\views email_template & create template layout file i make user.php this bring email body

  
    
HELLO GUYS channa make your work easy please comment see my blog for more
{!! $mail_content !!}
mail ot put

i hope this will help for advance develiopment 


get sample project from GIT-HUB

thank you

Wednesday, June 24, 2015

laravel 5 ajax POST

Standard

hi guys here is basic AJAX POST on laravel 5 i hope this will help for your advance project

 thank you


Route::group(['prefix' => 'ajax'], function() {

    Route::get('/ajax', 'AjaxController@ajax');
    Route::post('/ajaxpost', 'AjaxController@ajaxpost');

});
 
<pre class="java" name="code">
             <input id="name" name="name" type="text" value="hello channa" />
             <input id="__token" name="__token" type="hidden" value="uAVNLARzB2zKp2hJElHXNRGSGLJ0gwqibXyqRXci" />

             <input class="submit" id="submit" type="submit" />

           
<div id="loadingmessage" style="display: none;">
<img src="loading.gif" />                                                                            
  </div>
<div id="my_div">
</div>
<script>

        $('#submit').click(function(){
        $('#loadingmessage').show();  // show the loading message.
        $.ajax({
            type: "POST",
            url: "http://localhost/bitbuckt/public/staff/ajaxpost",
            dataType: "html",
            data: { "_token" : "uAVNLARzB2zKp2hJElHXNRGSGLJ0gwqibXyqRXci" },
            success: function( response) {
              $('#my_div').html(response);
              $('#loadingmessage').hide(); // hide the loading message
     
            }
          });

        });

        </script>

</pre>
create view form under resources -&gt; view -&gt; ajax -&gt;ajax.blade.php
i passed _token key with data

create response action on AjaxController
 

    public  function ajaxpost()
    {

        print_r('data response ');
    } public  function ajax()
    {
        return view('staff.ajax');
    }

 

Thursday, March 5, 2015

print div contain using JS

Standard




 


text area for print

Wednesday, March 4, 2015

calculate the difference between two dates using PHP?

Standard
You can use strtotime() to convert two dates to unix time and then calculate the number of seconds between them. From this it's rather easy to calculate different time periods


            $date1 = "2015-03-08";
            $date2 = date("Y-m-d");

            $diff = abs(strtotime($date2) - strtotime($date1));

            $years = floor($diff / (365*60*60*24));
            $months = floor(($diff - $years * 365*60*60*24) / (30*60*60*24));
            $days = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24));
            printf("%d years, %d months, %d days\n", $years, $months, $days);
            printf(" %d months, %d days Days Ago\n", $months, $days);
            printf("%d Days Ago\n",  $days);

Tuesday, February 24, 2015

mouseover popup box YII griview

Standard
YII Drid cell with a javascript/css content box that pops up upon mouseover.





<! --- Style ------- >


<! ---- Java script ----->



add this on YII drid view

array( 'header'=>' User', 'value' => ' " ".CHtml::link($data->user->username,array("user/admin/view/id/".$data->UserId))."
Email : ".$data->user->email."
Telephone : ".$data->user->Telephone."
" ', 'name'=>'UserId', 'filter'=>FALSE, 'type'=>'raw', ),


 

Wednesday, February 18, 2015

add custom ajax YII

Standard
This article will help you to understand the power of jQuery (library of JavaScript functions) with simple this on view page
     
Click me
Change me
on controller
public function actionajax()
	{
       echo'hello is me !';
	}

Tuesday, February 10, 2015

Get a Facebook API Access Token That Never Expires

Standard
I’ve been working on a few scripts that performed some minor data collection using the Facebook Graph API as a data source. Ideally, I wanted this script to be able to run several times a day automatically, however Facebook grants access tokens that expire after 1-2 hours. Since I’m the only one that is going to run this script, I only needed access to my Facebook data and I didn’t want to have to re-authenticate every few hours. Luckily, Facebook provides a permission parameter to get a “long-lived” access token from Oauth called offline_access!

https://graph.facebook.com/oauth/access_token?
client_id=_APP_ID_&
client_secret=_APP_SECRET_&
grant_type=fb_exchange_token
&fb_exchange_token=_ACCESS_TOKEN_ON_STEP_4_


Thursday, February 5, 2015

Tuesday, January 27, 2015

change the color of scrollbars

Standard


add this in your style .css  to change the color of the scrollbars on my pages in Internet Explorer and Firefox

::-webkit-scrollbar {
width: 12px;
height: 4px;
background: rgba(111, 78, 78, 0.35);
}
::-webkit-scrollbar-thumb {
background-color: rgba(145, 36, 66, 0.99);
-webkit-border-radius: 1ex;
}

Wednesday, January 21, 2015

Add Ajax in Grid view YII

Standard


Here is simple example to how create  Ajax link on YII CGridview


array(
        'name'='Attribute name',
        'header'='Attribute title',
        'value'='CHtml::ajaxLink(
            "link",
             array("url/action"),
              array(
              "update"="#Ajaxvenu",
                 "type"="POST",
                     "data" =; array(
                     "POST[atttribute]" = $data->atttributename,

                       ),                              
                   ),

 )',

// view this