Pages

Monday, 9 December 2013

GIT Part 2

Getting started 

Let’s get started with GIT. We will start with installing. You can download it from here
Git-1.8.4-preview20130916.exe
We will be using windows. We will not use any third party softwares here, as it slows down the process. 
We will use Git Bash. So go to start and open Git Bash.
In this window type 
ssh-keygen
This command will generate a key. Out of the files that are created in the default folder location, open
the file named “id_rsa.pub”. This file contains the public key.
Now login to your github.com account (assuming that you already have a github account. If not it just takes 2 minutes. Go on and register for your free account on github.com) 
Go to properties >> SSH Key >> Add SSH Key that was created in the previous step (the one which we
created in id_rsa.pub)
Part 3 COMING SOON...

Wednesday, 16 October 2013

GIT Part 1

Linus Torvalds
Linus Torvalds

How did GIT come into existence?

Linus Torvalds, the creator of Linux, wanted to make an OS that was open source. He used to worK on UNIX. So, based on unix he started to develop his own operating system. Later on he also added in his team, the people all over the globe who were intrested in the development of Linux. Every on used VCS. But Linus Torvalds did not like the time it took just to commit a single line of code. So he decided to develop his own versioning system, which will complete the operations within approximatly 3 seconds. This is how GIT came into existance. GIT is free for public access. But if you want to make the repository private, you have to use their paid service.


What is Git?

Git is a Distributed Version Control Systems (DVCSs). In a DVCS (such as Git, Mercurial, Bazaar or Darcs), clients don’t just check out the latest snapshot of the files: they fully mirror the repository. Thus if any server dies, and these systems were collaborating via it, any of the client repositories can be copied back up to the server to restore it. Every checkout is really a full backup of all the data. Furthermore, many of these systems deal pretty well with having several remote repositories they can work with, so you can collaborate with different groups of people in different ways simultaneously within the same project. This allows you to set up several types of workflows that aren’t possible in centralized systems, such as hierarchical models. 
 

Features

Git is easy to use. It’s incredibly fast, it’s very efficient with large projects, and it has an incredible branching system for non-linear development.





Tuesday, 27 August 2013

Hyperlinks not working with jQuery mobile... Why?


Mobile jQuery processes each and every link and considers it as an ajax by default which will loads in the same page and not refresh the entire page. Links that point to other domains or that have rel="external", data-ajax="false" or target attributes will not be loaded with Ajax. Instead, these links will cause a full page refresh with no animated transition. Both attributes (rel="external" and data-ajax="false") have the same effect, but a different semantic meaning: rel="external" should be used when linking to another site or domain and data-ajax="false" is useful for simply opting a page within your own domain from being loaded via Ajax. Because of the security restrictions, the framework always opts links to external domains out of the Ajax behavior.

Let’s have a look at an example. I have many links on the page already and let’s say we have to popup using mobile jQuery. Adding rel="external" to each link is not possible as there are around thousand of links on my page. So using jQuery we can use the following code:

$(document).ready(function(){
    $("a").each(function(){
          $(this).attr("rel","external");
    });
}); 

The above code will apply rel attribute to all the links on the page. But if we want to 
implement a simple popup using the following code:
 
 <a href="#popupBasic" data-rel="popup">Open Popup</a>
 <div data-role="popup" id="popupBasic">
      <p>This is a completely basic popup, no options set.</p>
</div>
 
we will get issues as the “rel” attribute will also be applied to the link for popups too. 
So we can add a condition as shown below to avoid adding rel attribute to popup links:
 
$(document).ready(function(){
    $("a").each(function(){
        if($(this).attr("data-rel")!="popup") {
            $(this).attr("rel","external");
        }
    });
});

For more information click here
 
                                           

Sunday, 25 August 2013

INSERT … SELECT

INSERT [LOW_PRIORITY | HIGH_PRIORITY] [IGNORE]
       [INTO] tbl_name [(col_name,...)]
       SELECT ...
       [ ON DUPLICATE KEY UPDATE col_name=expr, ... ]
With INSERT ... SELECT, you can insert many rows into a table from one or many tables. This is a method to insert data very fast.

Example:
INSERT INTO employee (dept_id,emp_name)
       SELECT d.d_id as dept_id, p.name as emp_name
       FROM department as d 
       JOIN people as p 
       ON d.category_id = p.category_id
       WHERE p.category_id < 20;

In the above example we have fetched the department ids and the names from the select query and inserted into the employee table.

Saturday, 24 August 2013

INSERT

The INSERT ... VALUES and INSERT ... SET forms of the statements are used to insert rows which have values that are explicitly specified.

INSERT [IGNORE]
       [INTO] tbl_name [(col_name,...)]
       {VALUES | VALUE} ({expr | DEFAULT},...),(...),...
       [ ON DUPLICATE KEY UPDATE col_name=expr
       [, col_name=expr] ... ]

OR
INSERT [IGNORE]
       [INTO] tbl_name
       SET col_name={expr | DEFAULT}, ...
       [ ON DUPLICATE KEY UPDATE col_name=expr
       [, col_name=expr] ... ]

The INSERT ...SELECT form inserts rows selected from another table or tables.

INSERT [IGNORE]    
       [INTO] tbl_name [(col_name,...)]
       SELECT ...
       [ ON DUPLICATE KEY UPDATE  col_name=expr
       [, col_name=expr] ... ]

You can use REPLACE instead of INSERT to overwrite old rows.
The following statement
will create a row with the fields with its default values:
INSERT INTO tbl_name () VALUES();

If you want to insert a value[dependent on the previous
column] into a  column, then you can use
expressions.
INSERT INTO tbl_name (col1,col2) VALUES(20,col1*5); 
This will create a row with a value 20 in col1 and 100 (i.e. 20*5) in col2. 
NOTE: You cannot use the columns in the expressions before they have been assigned values.
SO THE FOLLOWING STATEMENT BECOMES ILLEAGAL:
INSERT INTO tbl_name (col1,col2) VALUES(col2*5,20);