This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Remove the directory and its content (all files and subdirectories). | |
| * @param string $dir the directory name | |
| */ | |
| function rmrf($dir) { | |
| foreach (glob($dir) as $file) { | |
| if (is_dir($file)) { | |
| rmrf("$file/*"); | |
| rmdir($file); | |
| } else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Datatable Refresh | |
| $('.dataTables').DataTable().ajax.reload(); | |
| // or | |
| $('#example-select').on('change', function(){ | |
| $('#example').DataTable().ajax.reload(); | |
| }); | |
| //Destroy the old datatable | |
| $('.dataTables').dataTable().fnDestroy(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| What is sequence? | |
| To generate sequential integers/numbers in database. | |
| all sequences are maintain in system table called user_sequences; | |
| desc user_sequences; | |
| To check all sequences in the table as follows: | |
| select sequence_name from user_sequences; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Datatable | |
| ++++++++++++Datatable JS+++++++++++ | |
| $('#dataTable').DataTable( | |
| { | |
| "processing": true, // Show processing | |
| "serverSide": true, // Server side processing | |
| "ajax":{ | |
| url : '<?= route("dataProcessing")?>', | |
| type : "POST", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Simple Application | |
| <div id="myReactApp1"></div> | |
| <div id="myReactApp2"></div> | |
| <div id="myReactApp3"></div> | |
| <script type="text/babel"> | |
| class Man extends React.Component { | |
| render() { | |
| return <h1>{"Name: "+this.props.name+", Age: "+this.props.age}</h1> | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| The top 3 JavaScript templating engines: | |
| https://www.npmjs.com/package/underscore | |
| https://www.npmjs.com/package/handlebars | |
| https://www.npmjs.com/package/ejs | |
| //v.01 | |
| //var express = require('express'); | |
| //var app = express(); | |
| var app = require('express')(); //server creation |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Runtime vs Compile time: | |
| -> In computer programming, event-driven programming is a programming paradigm in which the flow of the program is determined by events such as user actions (mouse clicks, key presses), sensor outputs, or messages from other programs/threads. | |
| -> The source code must be compiled into machine code in order to become and executable program. This compilation process is referred to as compile time.(think of a compiler as a translator) A compiled program can be opened and run by a user. When an application is running, it is called runtime | |
| -> In computer science, asynchronous I/O, or "Non-sequential I/O" is a form of input/output processing that permits other processing to continue before the transmission has finished. Input and output (I/O) operations on a computer can be extremely slow compared to the processing of data. | |
| What is a CGI Script? | |
| A CGI script is any program that runs on a web server. | |
| //There is no window object like browser console. We can use like this as global. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -> A multidimensional array is an array containing one or more arrays. A two-dimensional array is an array of arrays (a three-dimensional array is an array of arrays of arrays). | |
| //Array Functions: | |
| array_pop() ->pops an element off end of the array. | |
| array_push() ->pushes an element into the end of the array. | |
| array_shift() ->pops an element off the beginning of the array. | |
| array_unshift() ->pushes an element into the beginning of the array. | |
| array_key_exists($key, $array2) | |
| array_diff(array1,array2,array3...); | |
| array_intersect($array1, $array2); | |
| array_search("red",$a); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Refresh particular element with jQuery | |
| 1. $("#printablediv").load(location.href + " #printablediv"); // Add space between URL and selector. | |
| Or | |
| $("#MainForm").load(location.href+" #MainForm", function() { | |
| $(".select2").select2(); | |
| }); | |
| 2. $('#showDetaildModalBody').load("<?php echo base_url('setup/OrganizationSetup/create')?>"); | |
| 3. $("#find_gen_sdl").trigger("click"); | |
| 4. Another Ajax Request inside Success Method | |
| 5. location.reload(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //JSON is a light-weight, language independent, data interchange format. | |
| -> JSON Encode and Decode | |
| -> JSON Encode: | |
| ->PHP json_encode() function is used for encoding JSON in PHP. Objects in PHP can be converted into JSON by using the PHP function json_encode(). | |
| i.e, | |
| $myObj->name = "John"; | |
| $myObj->age = 30; | |
| $myObj->city = "New York"; | |
| $myJSON = json_encode($myObj); | |
| echo $myJSON; |