Sunday, March 13, 2016

Dojo define() Vs require()

This is the simplest explanation that I come across that explained the differences between dojo define() and require(){

http://g00glen00b.be/dojo-require-vs-define/

Tuesday, March 1, 2016

NodeJS for Beginners

I come across the following site where it was explained in simple about node, node custom modules, making database connection from a node module, etc. A must read...

http://code.tutsplus.com/tutorials/nodejs-for-beginners--net-26314

Monday, February 29, 2016

NodeJS and PhoneGap

Phonegap is a client-side solution only with JavaScript/CSS/HTML running on the browser-app of the phone. The JavaScript Phonegap API talks to the native phone interface and browser interface which gives you options to work natively and as a normal web page would with enhanced permissions. Node.js would only serve you as a data connection for JSON or whatever else you would need to pull/push with a network call.

Reference: http://stackoverflow.com/questions/14513029/phonegap-with-node-js

Wednesday, February 3, 2016

CSS: Elements do not expand to contain floated children by default

Elements do not expand to contain floated children by default.

There are a number of workarounds, such as floating the parent, using a clearfix or adding overflow: hidden to the parent.

Saturday, January 30, 2016

Fetch multiple rows using PHP, MySQL

<?php    

      $dbc = mysqli_connect("localhost""my_user""my_password""my_database")  or die ("Error connecting to the mysql server. ");

      $query = "select * from my_table";

      $result = mysqli_query($dbc, $query)or die ("Could not connect to mysql server. ");
             
        $myArray = array();
    
        while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
             $myArray[] = $row;
        }

        $result->free(); 
    
        mysqli_close($dbc);

        //TEST TO SEE THE RESULT OF THE ARRAY 
        echo '<pre>';
             print_r($myArray);
        echo '</pre>';


?>

Sunday, November 22, 2015

A simple PHP insert code

<?php
if ($_SERVER["REQUEST_METHOD"] == 'POST'){

$firstname = $_POST["firstname"];

$dbc = mysqli_connect('localhost','root','','mydatabase') or die ("connection Error");

$query = "insert into my_table(firstname) values('$firstname')";

$myArray = array();

if (mysqli_query($dbc, $query)){
$myArray["msg"] = "happened";
}else {
$myArray["msg"] = "notHappened". mysqli_error($dbc);
}
mysqli_close($dbc);

echo json_encode($myArray);
}

?>


Note: Use your own database name in place of mydatabase and table name where my_table is specified.

Saturday, October 31, 2015

GIT Work Flow



















  • Create an account in GitHub. Login to GitHub and create a new repository, say "TestRepo".
  • On your local computer, download Git.exe following the instructions at https://git-scm.com/downloads
  • On your local computer, create a folder, say "TestRepo".
  • Go to command prompt, change directory to TestRepo and C:\TestRepo>git init
  • This above command creates a ".git" folder in TestRepo folder.
  • Now create couple of files, test1.txt, test2.txt, in TestRepo folder.
  • C:\TestRepo>git add . (Note: after git add, a period is there, don't forget that)
  • The above command moves the files test1.txt, test2.txt to staging area.
  • C:\TestRepo>git commit -m "committing test1, test2 files"
  • The above command moves the files test1.txt, test2.txt to local repository.
  • C:\TestRepo>git remote add origin <https clone URL from github>
  • The above command connects to the github when you provide the correct username and password.
  • C:\TestRepo>git push origin master
  • The above command pushes your files from your local repository to github remote repository
  • C:\TestRepo>git pull origin master
  • The above command pulls the files from github remote repository to your local repository.
  • Happy programming!!