This is a useful generator for crontab command line
You can set for every minute/hour, set by time range etc.
Below are scenarios that may cause duplicates
- browser refresh upon successful form submission
- browser refresh while the page still processing/loading
- resubmit the form again (by clicking on the button more than once)
- Post-redirect-get (PRG) – on wikipedia
- One easy way is to have injected a hidden parameter with a random hash/number (e.g called token). Upon submission you’ll have to check that the token you expect (which you’ll have probably stored in the http session) is being sent together with the other POST parameters. On valid submission you’ll remove/invalidate this token. That way when a POST comes which a non recognised token then it’s most probably a duplicate or out of date request. source
- To check whether the data submitted exist in the database. This is the most tedious part to do and you need to have a unique data for this. i.e. the data must be unique in the table or create a unique data for this purpose sent together with other data.
- Add a one-time token to your forms and save it to the $_SESSION-variable. Then if it is used (form is submitted), remove it from the session (or create a new token). If the form is then sent again, the two tokens don’t match and you have a duplicate entry (you can ignore the second for example). source
I’ve been using laravel for years already. Now I need to move to Laravel and I need strong reasons why I should.
Here I compiled some
- Laravel is truly OOP
- The ORM (eloquent) in Laravel is really powerful
- Can tune the speed with cache and queue
- Artisan command that really help doing job faster – e.g. creating controllers, models, run migration (database) etc.
- Migration that acts like database version control for the development team
- RESTful resource controllers
- Many available packages developed by other programmers that can be used
- More support, community, references. e.g. laracasts.com, laravel.io
- Powerful routes
- Class autoloading?
And below are the articles you may wan to read that are also my reference to the above points.
- laravel vs CI. A difficult choice
Some useful laravel packages
- Simple API client
- model generator
Sometimes we construct an array in a loop and end up with an empty element at the end (or beginning) of the array.
It will look something like elem1,elem2,elem3,
To remove empty element from an array, can simply use array_filter function
Be careful, by removing empty it includes false, null, ” etc.
Things to explore, study, learn
- AWS – EC2, RDS, S3 – to set up a complete application platform and see how flexible and easy to manage
- how to sync database updates among programmers just what git does for source codes
- git stashes, submodules and subtrees
- update svn from production server
- push to deploy with git to production server (from gitlab)
Regular expression can be a powerful way of searching text in source code or even programming (e.g. PHP is using preg_match function)
Regexr is a tool to construct and test regular expression that we create
Use the following function
- password_hash($password, PASSWORD_BCRYPT) – more info
- boolean password_verify ( string $password , string $hash ) – more info
$password = password entered by user
$hash = string that produced by password_hash