Sublime Text 2
For the last couple of months I have been using Sublime Text 2 as my text editor and there is no way back to Netbeans I'm afraid, and here's why :
- it's written in Python so it's much faster than Netbeans or any other IDE written in Java
- it's leightweight (20 MB)
- it's cross-platform
- can be easily extended using plugins
- has multiple color schemes and themes that support antialiasing fonts
There is one downside that Xdebug doesn't work as good as it does on Netbeans.
There are online video tutorials that can get you started Perfect Workflow in Sublime Text , Up and Running with Sublime Text 2 or videos from Stuart Herbert from his youtube channel.
Goodbye ExtJs/Sensha , Hello KendoUi
I loved ExtJs (new Sensha) for a long time , but now seeing what KendoUI can do I think I will stick with it.
Maybe Introduction To Kendo UI from http://pluralsight.com can convince you too.
Git Cheat Sheet
I have been working with Git for few months and even if at the start was kind of difficult to grasp it after switching from SVN.
Here is a list of most used commands :
Configuring
Cloning the repository
> git clone git://url
> git config --global user.name “Firstname Lastname”
> git config --global user.email “user@email.com”
> git config --global color.ui true
> git config --global alias.st "status" - define an alias to git status : > git st
List the configuration
> git config --list - list all the configuration
Setup a project in the root directory
> git init
Look inside the git file
> tree .git
Add all files to repository
> git add .
Commit files to the repository
> git commit -m “First import”
Commit all changes that have done to the project ( ask for a message)
> git commit -a
Add a single file to the commit (is qued up for commit)
> git add {filename} - add the file
> git rm {filename} - delete the file
> git mv {first_file} {second_file} - rename
See prev change ( DIFF between changes)
git diff {filename} - see the difference between changes
get information about the tracked files , changed or new files
> git status
See log
> git log
> git log --until=2012-06-14
> git log --since=2012-05-12
> git log --author=”James”
> git log --grep=”Init”
> git log --online
HEAD - last state of the repository , what was last checked out
git show {sha} - show the commit information
git diff {sha} - show a diff from a previous commit
git diff {sha1}..{sha2} show a diff between 2 commits
git diff {sha1}..{sha2} {filename} - show a diff between 2 commits on a file
git diff --stat --summary
git log --graph --oneline --decorate --all
Branches
- master is the main branch ( ~ trunk in the svn)
Branch listing
> git branch
Create a new branch
> git branch human => (create the “human” branch )
To switch to the human branch we need to log out from the master branch
> git checkout human ( swich to the human branch )
If I want to get the master changes in the human branch
> git rebase master
Merge human to master
First you want to see the changes
1) git checkout master
2) git diff master .. new_feature - compare 2 branches
3) git merge new_feature - merge the branch with the name new_feature ( I am in the master branch)
To check if the branch is merged you can do a diff between branches git diff master..new_feature
If we want to go back before the merge
4) git reset --hard ORIG_HEAD
If we have conflicts on merge make changes and then commit
> git branch --merged - show which branches are merged
> git branch -m {old_branch_name} {new_branch_name}- rename the branch
> git branch -d {branch_name} - delete a branch
> git push origin :{branch_name} - delete a remote branch
> git push origin --delete {branch_name} - also deletes a remote branch
Repositories
When you work on the public server you need to push the commit to live server.
> git push
Donwload the last changes
> git pull
Git Architecture:
2-tree architecture - repository & working copy (svn use)
3-tree architecture - repository , stagging index & working copy (git use)
working copy -> git add file.txt -> staging index -> git commit file.txt -> repository
Undone changes
- undo changes to the working directory
git checkout {filename} or
git checkout -- {filename}
- unde changes to the staging directory
git reset HEAD {filename}
- change the commit message or add new change to a file that is already on staging directory
git commit --amend -m “Change the files already staged”
- changes to the older commits
git checkout {hash} -- {filename}
- revert a commit
git revert {hash}
- rever multiple commits ( move the HEAD pointer)
git reset
-- soft (move the pointer but doesn’t change the staging index or working directory)
-- mixed (default) = move the head pointer to the specified commit and change the staging index but doesn’t change the working directory
-- hard - move the HEAD , change the staging index and working directory
git clean -f - remove the untracked files
Stashing
- store changes temporary , only visible for you
git stash save “config changes” - save the files to stash
git stash list - show the stash lists with the name of the changes
git stash show stash@{0}- show the file changes in specified stash (to see more add -p option)
git stash pop {stash_item} - get and remove changes from stash , if a stash item is not specified get the last one
git stash apply {stash_item} - get the changes from the stash
git stash drop stash@{0} - delete a stash item
git stash clear - remove all stash items
Ignoring files
/proect_dir/.gitignore - add all the files and directories that will be ignored by git.
Sample file:
# comment
test.txt - ignore file test.txt
*.tmp - ignore all the files that have the extension .tmp
*.gz
log/*.log
assets/photoshop/
assets/video
!assets/video/tour_*.mp4
If you want to ignore specific files you need to alter .gitignore_global file located in the user directory
If you want to track an empty directory , create a empty file .gitkeep in that specific directory
Using the Last.fm API on http://phpmaster.com
I wrote another article for PhpMaster.com about LastFM API .Check it out!
Lynda.com PHP 5.4 New Features review
Another great title from Lynda.com on the Php server side programming :
PHP 5.4 New Features .
What can you learn from this title :
- How to install Php 5.4 on Windows , Unix & Mac OS X
- Built-in web server
- Improvements on array handling
- New features like JsonSerializable ,closures , http_response_code
- Access class members on instantion
- Traits
An Introduction to Redis in PHP using Predis on Phpmaster.com
I wrote an article for PhpMaster.com on using Redis .Check it out!
Quick comparison between Symfony 1.4 and Zend Framework 1.1
Quick comparison between Symfony 1.4 and Zend Framework based on my personal experience.
MVC structure
Both framework are using the MVC pattern but they have a different structure of the code organization
Symfony : Project > Applications (Frontend/Backend) > Modules > Actions (controllers) > Views
Zend Framework : Application > Modules > Controllers > Views
Command Line
Symfony is using heavily CLI to generate code and default structure on the other site ZF is using something similar , Zend Tool but it's not that powerful as the SF one.
Code organization
Zend Framework is a loosely-coupled architecture allows developers to use components individually like ( Zend_Search_Lucene ) on the other side Symfony is a full stack framework that standardize the development of a web app.
Database (Model)
Symfony is using Doctrine/Propel ORM as the Model and ZF is using Data Mapper classes to interact with the database, but as well can be extended to use Doctrine as well.
Testing enviroments
ZF as well as SF is using environments , most common configuration are local , dev , test and production. You can do a lot of changes from this perspective since you can log and debug easily and use different approaches to test the live site and see debug information only from a certain IP address.
The configuration files :
Symfony is using YML standard for configuration files and uses a hierarchy and same configuration can be found in many files, this means that's override. There is also an inheritance of the environments settings that you can again override whenever you like. Zend framework on the other side uses by default .ini files but you can change that to use xml or php files.
Unit testing
From the unit testing perpective Zend framework is using PHPUnit the de facto standard on unit testing on Php oppose to Symfony who is version 1.4 is using Lime. You can still use PHPUnit with Symfony 1.4 but you need to install a couple of plug-ins.
Scaffolding
Symfony is using scaffolding & admin generator to do CRUD operation on a database table structure , Zend Framework doesn't have that build in but can be extend to do something similar.
Extending the framework
Symfony can be easily extended using plugin and libraries , even use Zend framework stand alone components , on Zend Framework you can extend current component or you can as well use external libraries.
Community
Both framework have huge communities around them starting with forums, email lists and irc chats channels. Also they have dedicated conferences : For Zend Framework you have ZendCon and Symfony has Live Symfony .
Company behind it
The company the Zend Frameword is Zend who is a PHP company all the way from IDE, code protection & obfuscation with Zend Guard, Zend Server , certifications, training and more recently the cloud computing solutions. All this play nicely with each other but in order to have them you need to pay.
On the other end Symfony is a Sensiolabs release started by Fabien Potencier. Sensiolabs offers trainings, organize conferences and offer support on Symfony projects.
On 28th July 2011 Symfony2 was officially launch which take the framework to a next level embracing Php 5.3 namespaces , decoupling of modules which some of them are going to power Drupal 8, choose PhpUnit as a standardized testing framework, new templeting system (Twig) , MongoDB support and Doctrine2 for working with databases.
On the other hand Zend Framework 2 is still in beta3, so from my point of view are a step behind Symfony.
Airbus vs Boeing
Don't know why for me it's the first thing I got on my mind when I compare these 2 frameworks. The French have launched A380 in late 2007 and USA rival Boeing 747-8 was launched in mid 2011 and its the French who win here.
Conclusion
This comparison is a subjective one each framework it's great if the right coder is using it and since everyone is different will be different conclusions.As for me I am going with Symfony ...even with Symfony 1.4
PHP & MongoDB Web Development: Beginner’s Guide
MVC Frameworks for Building PHP Web Applications from Lynda.com
A great objective overview of the 4 most used and popular frameworks Zend Framework, Symfony, Codeigniter and CakePhp.
Drew Falkman goes and show each framework features, what patterns it uses and implements a single join email list application which uses all MVC concepts.
For a php developer it's a must watch tutorial so when you start a new project you can see which framework to use.
The artist
Impressive! This is the best movie I have seen this year so far and it's most likely and I think I should won a Oscar.
Almost no dialog , black and white , filmed in 36 days but the emotions that you get in the end are just .
It's the opposite of what Avatar is : expensive , long time to make and famous cast.
Go see The Artist at cinema!
Mark : 9/10

