Skip to content

Instantly share code, notes, and snippets.

View rajucs's full-sized avatar
🎯
Focusing

Arman Hossain rajucs

🎯
Focusing
View GitHub Profile
https://join.slack.com/t/bdprogrammer/shared_invite/enQtNDA5Mjk5OTk5NzYzLTkwMGYyNmRhZTAyODMwNzc5NmNlMGQwMWNiNGZiYzQzZWRlODA1NjQ5ZjIyNGFhN2MwNDZiOGZmNjY1YzMxNDY
Whoops, looks like something went wrong.
(2/2) ErrorException
Trying to get property of non-object (View: F:\xampp56\htdocs\unitwo\resources\views\country\thailand\Mahidol-University.blade.php)
in ce9bb98e5a8b684789a925b77d5e12006e3d6ffa.php line 169
at CompilerEngine->handleViewException(object(ErrorException), 1)
in PhpEngine.php line 44
at PhpEngine->evaluatePath('F:\\xampp56\\htdocs\\unitwo\\storage\\framework\\views/ce9bb98e5a8b684789a925b77d5e12006e3d6ffa.php', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'uniinfo' => object(UniversityinfoModel), 'programfees' => object(UniversityAcademicModel)))
in CompilerEngine.php line 59
at CompilerEngine->get('F:\\xampp56\\htdocs\\unitwo\\resources\\views/country/thailand/Mahidol-University.blade.php', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'uniinfo' => object(UniversityinfoModel), 'programfees' => object(UniversityAcademicModel)))
1. Start new t1.micro EC2 instance, using new key pair. Make sure you create it in the same subnet, otherwise you will have to terminate the instance and create it again.
2. SSH to the new micro instance and copy content of ~/.ssh/authorized_keys somewhere on your computer.
3. Login to main instance with old ssh key.
4. Copy & replace the file content from point 2 to ~/.ssh/authorized_keys
5. Now you can login again only with new key. Old key will not work anymore.
@rajucs
rajucs / Associate NameCheap domain to Amazon EC2 instance
Created August 20, 2018 04:11
Associate NameCheap domain to Amazon EC2 instance
Scenario: You have registered a domain name through NameCheap and you have a running instance of Amazon EC2. Now you want to point the domain to the that EC2 instance.
Solution:
Log into NameCheap.com and Amazon Web Services (AWS).
In your NameCheap.com dashboard, go to “Domain List” and locate the domain name you want to point to AWS. Click the “manage” button.
On the next page, click “Advanced DNS” tab. Under host records section, you should see 2 entries with “@” and “www”.
Switch to AWS management console and go to your EC2 instance.
On the left menu, click “Elastic IPs”
Click “Allocate new address”.
[2018-08-20 18:31:59] local.ERROR: ErrorException: file_put_contents(/var/www/html/project/storage/framework/sessions/c2sIrTFFxvDvMoeWaFIiMYK0dTu4X02l6pN7BOtT): failed to open stream: Permission denied in /var/www/html/unitwo-phase-1/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:122
Stack trace:
#0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'file_put_conten...', '/var/www/html/u...', 122, Array)
#1 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(122): file_put_contents('/var/www/html/u...', 'a:3:{s:6:"_toke...', 2)
#2 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Session/FileSessionHandler.php(83): Illuminate\Filesystem\Filesystem->put('/var/www/html/u...', 'a:3:{s:6:"_toke...', true)
#3 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Session/Store.php(128): Illuminate\Session\FileSessionHandler->write('c2sIrTFFxvDvMoe...', 'a:3:{s:6:"_toke...')
#4 /var/www/html/project/vendor/l
if you are using centOs then use
sudo chown -R centos:centos /var/www/html
sudo chmod -R 755 /var/www/html
For Ubuntu
sudo chown -R ubuntu:ubuntu /var/www/html
sudo chmod -R 755 /var/www/html
Model::destroy($id);
model2::where('model_id/foreign_key',$id)->delete();
model3::where('model_id/foreign_key',$id)->delete();
Here Model lis related with Model 2 and Model 3.The relationship build with one to many.
If model id delete than others two relational data will be delete;
@rajucs
rajucs / How to get facebook user id
Created September 7, 2018 15:25
How to get facebook user id with js
<script>
MessengerExtensions.getUserID(function success(uids) {
// User ID was successfully obtained.
var psid = uids.psid;
}, function error(err, errorMessage) {
// Error handling code
});
</script>
@rajucs
rajucs / git error: failed to push some refs to
Created November 19, 2018 07:38
For some reason, I can't push now, whereas I could do it yesterday. Maybe I messed up with configs or something. This is what happens: When I use the git push origin master
git pull --rebase
git push
The full syntax is:
git pull --rebase origin master
git push origin master
@rajucs
rajucs / gist:dee58b22648028eb502f8be8c1423965
Created November 24, 2018 18:40
Installing Selenium Server
Setup
Download and install Java for your platform
Download selenium server’s latest version from
Place the downloaded .jar file to a folder of your choice, commonly C:\selenium
Create a batch file to run the server and add file to start up
To run server use java –jar selenium-server-standalone-2.25.0.jar
to create the batch file:
1) open notepad or any text-editor of your choice;
2) write the following in the file (supposing the .jar file is in C:\selenium folder):