aws s3 cp ./www s3://YOUR_BUCKET_NAME –recursive –acl public-read
Tag: Web Development
Best resources to learn Laravel
Best resources to learn Angular2+
Best Payment Methods / APIs to integrate with applications
Fix SQL Error: GROUP BY incompatible with sql_mode=only_full_group_by
MySQL 5.7.5+ changed the GROUP BY behavior. So in this and future versions GROUP BY would not work in same way as it used to be before.
So to make GROUP BY feature working like before follow these details:
Note: First of all to follow these steps you must need to have root access to your server.
If you want to disable error sql_mode=only_full_group_by permanently then do those steps:
-
sudo nano /etc/mysql/my.cnf
- Add this to the end of the file
[mysqld] sql_mode = "STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
- sudo service mysql restart to restart MySQL
This will disable ONLY_FULL_GROUP_BY for ALL users
PHP: How to fix Image rotation issue in img tag because of EXIF
Photos captured by some smartphones especially iPhones are automatically rotated when we use it in <img> tag which is mostly not acceptable as we don’t need such unwanted rotation. This happens because of EXIF Data stored in that image. But we can easily fix it using PHP by following these steps:
function autorotate($src) { // check if extension exists or not if(extension_loaded('imagick')) { try { $image= new Imagick($src); switch ($image->getImageOrientation()) { case Imagick::ORIENTATION_TOPLEFT: break; case Imagick::ORIENTATION_TOPRIGHT: $image->flopImage(); break; case Imagick::ORIENTATION_BOTTOMRIGHT: $image->rotateImage("#000", 180); break; case Imagick::ORIENTATION_BOTTOMLEFT: $image->flopImage(); $image->rotateImage("#000", 180); break; case Imagick::ORIENTATION_LEFTTOP: $image->flopImage(); $image->rotateImage("#000", -90); break; case Imagick::ORIENTATION_RIGHTTOP: $image->rotateImage("#000", 90); break; case Imagick::ORIENTATION_RIGHTBOTTOM: $image->flopImage(); $image->rotateImage("#000", 90); break; case Imagick::ORIENTATION_LEFTBOTTOM: $image->rotateImage("#000", -90); break; default: // Invalid orientation break; } $image->setImageOrientation(Imagick::ORIENTATION_TOPLEFT); $image->stripImage(); // if you want to get rid of all EXIF data $image->writeImage(); $image->clear(); $image->destroy(); return $image; } catch(Exception $e) { return 'Exception caught: ', $e->getMessage(), "\n"; } } else { return "Imagick extension is not installed."; } } // now run autorotate() function with source of file as parameter autorotate('my_img.jpg');
Or you can also fix it with just one line if you have root access to your linux server. Just run following shell command:
convert image.jpg -auto-orient output.jpg
PHP: Array Version of htmlspecialchars() function
htmlspecialchars() function should be used for security reason to echo values from any variable.
But htmlspecialchars() doe’s not work for arrays so following function would help to escape html characters from array values:
Understanding prototypes in javascript
- http://yehudakatz.com/2011/08/12/understanding-prototypes-in-javascript/
- https://www.pluralsight.com/blog/software-development/understanding-javascript-prototypes
- https://javascriptweblog.wordpress.com/2010/06/07/understanding-javascript-prototypes/
Best Websites to Learn Programming in Free
- https://frontendmasters.com/
- https://www.class-central.com
- http://www.udacity.com
- http://www.freecodeamp.com
- https://codecademy.com
- https://mva.microsoft.com/
- https://github.com/open-source-society/computer-science
- https://www.khanacademy.org
- https://www.safaribooksonline.com/ ( One Month Free Trial )
- http://edx.org
- http://coursera.org
- http://udemy.com
- https://www.skillshare.com/
- https://thenewboston.com/videos.php
- https://angularfirebase.com/
- http://w3schools.com
- https://www.airpair.com/
- https://egghead.io
- http://tutsplus.com
- https://www.pluralsight.com/browse/software-development ( 10 Days Free Trial )
- https://hackr.io
- https://academy.fossbytes.com/
- https://www.codeschool.com
- http://www.learnvern.com/
- http://www.lynda.com (10 Days Free Trial)
- https://www.datacamp.com
- https://alison.com/
- http://programming-motherfucker.com/become.html
- https://itpro.tv/PAID
- https://www.cbtnuggets.com
- https://linuxacademy.comAWS (Amazon Web Services)
- https://www.youtube.com/watch?v=BDBvHOaaKHo&list=PLv2a_5pNAko0Mijc6mnv04xeOut443Wnk
- https://linuxacademy.com/ (AWS and other cloud solutions )
- https://coursehunters.net/
- https://scrimba.com/
How to get phpmyadmin / Mysql root password through terminal?
Required steps to perform this:
You should have root access to terminal.
Server: Ubuntu 14
LAMP should be installed.
Run this command: cat /etc/motd.tail