Friday, 11 January 2019

PHP: PHP Code optimization techniques

If a method can be static, declare it static.  Speed improvement is by a factor of 4 1. echo is better than print echo( 'CHECKMATE: PLAY with PROBLEMS' ); // is better than print( 'CHECKMATE: PLAY with PROBLEMS' ); 2. Use echo' s multiple parameters instead of string concatenation echo 'PLAY', 'WITH', 'PROBLEMS'; // is better than echo 'PLAY' . 'WITH' . 'PROBLEMS'; 3. Surrounding your string by ' instead of " will make things interpret a little faster since PHP looks  for variables inside "..." but not inside...

Tuesday, 8 January 2019

PHP: Xajax and PHP: JavaScript without the pain Automatic for the people

Hands on When it comes to Web 2.0, PHP’s seen it all before. Birthed before the last great internet boom, PHP has matured and is now one of a triumvirate of languages synonymous with today’s craze for building web sites and online services with Linux and MySQL. While it shares LAMP honors with Perl and Python, though, PHP has become the most commonly used server-side platforms for Ajax and, of all the Ajax frameworks for PHP, Xajax is the most commonly used. If you are not familiar with JavaScript, which forms the basis of Ajax, but still...

Monday, 7 January 2019

GIT: Dry Run Before Adding to Git Repository

When something goes wrong it is important to test things before you do them so you can avoid things going wrong! One way to do that in Git is to use the --dry-run flag with git-add. Let’s say I have a bunch of changes and I just want to check what will happen when I run git-add to stage them for commit. Unstaging a staged change isn’t a big deal but I like to avoid problems (and fixing them!) if I can. git add . --dry-run Using this command I’m adding all changed files (the . means everything)...

GIT: How to Create Git Aliases

An alias, otherwise known as a shortcut, allows to place a simple command in front of a longer or less memorable command. For example, we could type: git commit -m "some change" Or we could type even less and do: git c -m "some change" We’re only saving a few letters but considering how many times you commit in a day or week, it’s a bit easier on your fingers. Less tapping of the keyboard and more working on the fun code. To create a Git alias, we need to open up our .gitconfig file and edit it. Because we want to have...

GIT: Understanding Git Log

Git logs allow you to review and read a history of everything that happens to a repository. The history is built using git-log, a simple tool with a ton of options for displaying commit history. What’s in Log? A Git log is a running record of commits. A full log has the following pieces: A commit hash (SHA1 40 character checksum of the commits contents). Because it is generated based on the commit contents it is unique. Commit Author metadata: The name and email address of the author of the commit. Commit Date metadata: A date timestamp...

Wednesday, 2 January 2019

PHP: Important Points to PHP

If a method can be static, declare it static. Speed improvement is by a factor of 4 echo is better than print echo( 'CHECKMATE: PLAY with PROBLEMS' ); // is better than print( 'CHECKMATE: PLAY with PROBLEMS' ); Use echo’s multiple parameters instead of string concatenation echo 'PLAY', 'WITH', 'PROBLEMS'; // is better than echo 'PLAY' . 'WITH' . 'PROBLEMS'; Surrounding your string by ‘ instead of “ will...