Wednesday, December 16, 2015

Edit an incorrect commit message in Git

Edit an incorrect commit message in Git

Amending the commit message

git commit --amend
 
Will open your editor, allowing you to change the commit message of the most recent commit. Additionally, you can set the commit message directly in the command line with:

git commit --amend -m "New commit message"

 

Make sure you don't have any working copy changes staged before doing this or they will get committed too. (Unstaged changes will not get committed.)

Changing the message of a commit that you've already pushed to your remote branch

If you've already pushed your commit up to your remote branch, then you'll need to force push the commit with

git push <remote> <branch> --force
# Or
git push <remote> <branch> -f
 
Warning: force-pushing will overwrite the remote branch with the state of your local one. If there are commits on the remote branch that you don't have in your local branch, you will lose those commits.
Warning: be cautious about amending commits that you have already shared with other people. Amending commits essentially rewrites them to have different SHA IDs, which poses a problem if other people have copies of the old commit that you've rewritten. Anyone who has a copy of the old commit will need to re-synchronize their work with your newly re-written commit, which can sometimes be difficult, so make sure you coordinate with others when attempting to rewrite shared commit history, or just avoid rewriting shared commits altogether.

Documentation

Read more....

Wednesday, October 28, 2015

website is the lightbox effect

One of the most popular ways you can showcase photos on your website is the lightbox effect.
Well, we wanted to simplify the process, so we've written a little tool that makes adding the Fancybox lightbox script to your page a snap.  Thanks to cdnjs, you don't even have to worry about adding any files to your site.



 
Read more....

Monday, October 26, 2015

How to check if string has at least one letter, number and special character in php

Lowercase character, Uppercase character, Digit, Symbol
^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*(_|[^\w])).+$

A short explanation:

^ // the start of the string
(?=.*[a-z]) // use positive look ahead to see if at least one lower case letter exists
(?=.*[A-Z]) // use positive look ahead to see if at least one upper case letter exists
(?=.*\d) // use positive look ahead to see if at least one digit exists
(?=.*[_\W]) // use positive look ahead to see if at least one underscore or non-word character exists
.+ // gobble up the entire string
$ // the end of the string

Here is more explain of this type of password security in regex

Minimum 8 characters at least 1 Alphabet and 1 Number:
"^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{8,}$"
Minimum 8 characters at least 1 Alphabet, 1 Number and 1 Special Character:
"^(?=.*[A-Za-z])(?=.*\d)(?=.*[$@$!%*#?&])[A-Za-z\d$@$!%*#?&]{8,}$"
Minimum 8 characters at least 1 Uppercase Alphabet, 1 Lowercase Alphabet and 1 Number:
"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{8,}$"
Minimum 8 characters at least 1 Uppercase Alphabet, 1 Lowercase Alphabet, 1 Number and 1 Special Character:
"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[$@$!%*?&])[A-Za-z\d$@$!%*?&]{8,}"
Minimum 8 and Maximum 10 characters at least 1 Uppercase Alphabet, 1 Lowercase Alphabet, 1 Number and 1 Special Character:
"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[$@$!%*?&])[A-Za-z\d$@$!%*?&]{8,10}"
 
 
I hope this will help you  
Read more....

Monday, October 19, 2015

Get country by mobile no

Here I am going to tell you how can you get country by mobile no
sometime you have the mobile no with country code


    mobile
   971525478965
   919844005522
   45712345678
 
I am going to through each number in the database and find the country code from
the mobile number display the country code and the country using php.

 
 
 
 If you  like then share 
Read more....

Thursday, October 8, 2015

Get selected value in dropdown list using JavaScript?

Get selected value in dropdown list using JavaScript?

<select id="ViewBy">
  <option value="1">Subjet1</option>
  <option value="2" selected="selected">Subject2</option>
  <option value="3">Subject3</option>
</select>



Running this code:

var e = document.getElementById("ViewBy");
var strUser = e.options[e.selectedIndex].value;

Would make strUser be 2.
If what you actually want is Subject2, then do this:

var e = document.getElementById("ViewBy");
var strUser = e.options[e.selectedIndex].text;

Which would make strUser be Subject2


--------------------------------------------------------------------------------------------

jQuery:

$("#elementId :selected").text() //the text content of the selected option
$("#elementId").val()            //the value of the selected option

------------------------------------------------------------------------------------------------
AngularJS

// html

<select ng-model="selectItem" ng-options="item as item.text for item in items">
</select>
<p>Text: {{selectItem.text}}</p>
<p>Value: {{selectItem.value}}</p>

// javascript
$scope.items = [{
  value: 'item_1_id',
  text: 'Item 1'
}, {
  value: 'item_2_id',
  text: 'Item 2'
}];
Read more....

Sunday, September 20, 2015

Interactive Graph Analysis and Visualization

Best Graph Library :)
  • SocialCompare has an extensive list of libraries, and the "Node / edge graph" line will filter for graph visualization ones.
  • DataVisualization.ch has evaluated many libraries, including node/graph ones. Unfortunately there's no direct link so you'll have to filter for "graph":
    Selection DataVisualization.ch
Here's a list of similar projects (some have been already mentioned here):

Pure JavaScript Libraries

  • vis.js supports many types of network/edge graphs, plus timelines and 2D/3D charts. Auto-layout, auto-clustering, springy physics engine, mobile-friendly, keyboard navigation, hierarchical layout, animation etc. MIT licensed and developed by a Dutch firm specializing in research on self-organizing networks.
  • Cytoscape.js - interactive graph analysis and visualization with mobile support, following jQuery conventions. Funded via NIH grants and developed by by @maxkfranz (see his answer below) with help from several universities and other organizations.
  • The JavaScript InfoVis Toolkit - Jit, an interactive, multi-purpose graph drawing and layout framework. See for example the Hyperbolic Tree. Built by Twitter dataviz architect Nicolas Garcia Belmonte and bought by Sencha in 2010.
  • D3.js Powerful multi-purpose JS visualization library, the successor of Protovis. See the force-directed graph example, and other graph examples in the gallery.
  • Plotly's JS visualization library uses D3.js with JS, Python, R, and MATLAB bindings. See a nexworkx example in IPython here, human interaction example here, and JS Embed API.
  • sigma.js Lightweight but powerful library for drawing graphs
  • jsPlumb jQuery plug-in for creating interactive connected graphs
  • Springy - a force-directed graph layout algorithm
  • Processing.js Javascript port of the Processing library by John Resig
  • JS Graph It - drag'n'drop boxes connected by straight lines. Minimal auto-layout of the lines.
  • RaphaelJS's Graffle - interactive graph example of a generic multi-purpose vector drawing library. RaphaelJS can't layout nodes automatically; you'll need another library for that.
  • JointJS Core - David Durman's MPL-licensed open source diagramming library. It can be used to create either static diagrams or fully interactive diagramming tools and application builders. Works in browsers supporting SVG. Layout algorithms not-included in the core package
  • HighCharts - Highcharts is a charting library written in pure JavaScript. it is based on SVG, but unlike many others, it also supports older browsers who use VML to render vector graphic. It is licenced under CC BY-NC 3.0

Commercial libraries

Abandoned libraries

  • Cytoscape Web Embeddable JS Network viewer (no new features planned; succeeded by Cytoscape.js)
  • Canviz JS renderer for Graphviz graphs. Abandoned in Sep 2013.
  • arbor.js Sophisticated graphing with nice physics and eye-candy. Abandoned in May 2012. Several semi-maintained forks exist.
  • jssvggraph "The simplest possible force directed graph layout algorithm implemented as a Javascript library that uses SVG objects". Abandoned in 2012.
  • jsdot Client side graph drawing application. Abandoned in 2011.
  • Protovis Graphical Toolkit for Visualization (JavaScript). Replaced by d3.
  • Moo Wheel Interactive JS representation for connections and relations (2008)
  • JSViz 2007-era graph visualization script
  • dagre Graph layout for JavaScript

Non-Javascript Libraries

  • Graphviz Sophisticated graph visualization language
  • Flare Beautiful and powerful Flash based graph drawing
  • NodeBox Python Graph Visualization
Read more....

Thursday, September 10, 2015

How to Getting start with regular expressions


Regular expressions are a very useful tool for developers. They allow to find, identify or replace text, words or any kind of characters. In this article, I have compiled 15+ extremely useful regular expressions that any web developer should have in his toolkit.

Getting started with regular expressions
For many beginners, regular expressions seems to be hard to learn and use. In fact, they’re far less hard than you may think. Before we dive deep inside regexp with useful and reusable codes, let’s quickly see the basics:
Regular expressions syntax
Regular Expression
Will match…
foo
The string “foo”
^foo
“foo” at the start of a string
foo$
“foo” at the end of a string
^foo$
“foo” when it is alone on a string
[abc]
a, b, or c
[a-z]
Any lowercase letter
[^A-Z]
Any character that is not a uppercase letter
(gif|jpg)
Matches either “gif” or “jpeg”
[a-z]+
One or more lowercase letters
[0-9.-]
Аny number, dot, or minus sign
^[a-zA-Z0-9_]{1,}$
Any word of at least one letter, number or _
([wx])([yz])
wy, wz, xy, or xz
[^A-Za-z0-9]
Any symbol (not a number or a letter)
([A-Z]{3}|[0-9]{4})
Matches three letters or four numbers

PHP regular expression functions
Function
Description
preg_match()
The preg_match() function searches string for pattern, returning true if pattern exists, and false otherwise.
preg_match_all()
The preg_match_all() function matches all occurrences of pattern in string.
preg_replace()
The preg_replace() function operates just like ereg_replace(), except that regular expressions can be used in the pattern and replacement input parameters.
preg_split()
The preg_split() function operates exactly like split(), except that regular expressions are accepted as input parameters for pattern.
preg_grep()
The preg_grep() function searches all elements of input_array, returning all elements matching the regexp pattern.
preg_ quote()
Quote regular expression characters

Validate domain name
Verify if a string is a valid domain name.


Read more....
Related Posts Plugin for WordPress, Blogger...