Posts

Showing posts from August, 2017

Custom prompt, alert boxes using jquery

below code use full to make custom javascript alert, prompt, dialog boxes resources are [code language="html"] <link rel="stylesheet" href="http://netdna.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css"> <link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css"> <link href="css/jquery-confirm.css" rel="stylesheet" type="text/css"> <script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> <script src="js/jquery-confirm.js"></script> [/code] working code: [code language="html"] <div class="row"> <h2>Basic</h2> <div class="btn-group" role="group"> <button type="button" class="btn btn-primary demo-1">Confirm</button> <script> $(...

Simple steps for installtion of laravel for biggeners

1. Goto server directory(www for wamp,htdocs for xampp,etc) 2. Run "git clone git@github.com:laravel/laravel.git" (git shows an internal or external error for windows users),do below ->goto this url in browser "https://github.com/laravel/laravel" ->click "clone or download" ->then click download zip ->extract that zip into server directory to a folder (in my case "rest" is the project name) 3. Now move to the project directory(rest) using "cd rest" 4. Now, run "composer install" (make sure you have installed composer in your pc,if u don't have first instll composer) 5. Rename .env.example file to .env use this command "rename .env.example .env" 6. Now, php artisan key:generate 7. open http://localhost/{project name}/public in my case(http://localhost/rest/public/) that's it basic installation of laravel completed. Now we will discuss about using database: it is better to use migration for creating...

Constants creation in laravel 5.4

global constant defining in laravel 5 in config/ folder create a file constants.php there you can add any constats as [code language="php"]<?php return [ 'APP_URL' => 'xxx.xxx.x.x:8545', ]; ?>[/code] to call those simpley [code]{{ config('constants.APP_KEY') }}[/code]

jQuery datatable inline editing with example

To enable editing in the datatable this is the easiest way first, add this function to get editable data field, This will helps to toggle between editable and normal displaying in datatable [code language="php"] function editableValues($val,$id,$col,$tab,$data=""){ if(is_array($data)){ $str= "<div class='vedit' style='width: 100%;' title='double click to edit' id=".$id.">".$val."</div>"; $str.="<select style='display: none;' type='text' class='hedit' id='".$col."' name='".$tab."'>"; foreach ($data as $key => $value) { $s=""; if($val==$value) $s="selected"; $str.="<option value='".$key."' $s>".$value."</option>"; } $str.="</select>"; retu...

An Army Helicopter problem

An Army Helicopter The host government has promised that in addition to the security guards in each match, there will be a platoon of elite commandos that will be deployed for extra protection in each stadium for each match. In order to move quickly between cities and stadiums there will be a dedicated army helicopter on permanent stand by. The army helicopter has to land in city (rectangular area) which contains several towers (mobile communication towers). For the safe landing of the helicopter, the landing space must not contain any tower in the landing space. A helicopter needs a square shaped landing area which has the side length greater than or equal to the helicopter length. Given a description of the tower positions of the city, you have to tell the largest helicopter that can land in the city. Input Format: You will be given a function which contains a string array of N length, each string contains symbols (either 'x' or 'o'). x represents a tower and 'o...

How to handle multiple ids at a time in jquery

To handle 2 or more id fields with jquery for below code,use just comma(,) separator in the jquery [source language="html"] <div id="id"/> <div id="id1"/> <div id="id2"/> [/source] as [source language="javascript"] $(document).ready(function(){ $("#id,#id1,#id2").click(function(){ //Your logic here ... }); }); [/source] this is a simplest way. Thanks...