There are often times where you need to display No internet connection
message to your users inside your Ionic Framework Android and iOS application.
Add Network information cordova plugin
Inorder to check internet connection, you need to have network information
cordova plugin.
cordova plugin add org.apache.cordova.network-information
Check for internet connection inside Platform ready
Now, you have to check the internet connection inside platform ready as follows
angular.module('myApp', ['ionic'])
.run(function($ionicPlatform, $ionicPopup) {
$ionicPlatform.ready(function() {
// Check for network connection
if(window.Connection) {
if(navigator.connection.type == Connection.NONE) {
$ionicPopup.confirm({
title: 'No Internet Connection',
content: 'Sorry, no Internet connectivity detected. Please reconnect and try again.'
})
.then(function(result) {
if(!result) {
ionic.Platform.exitApp();
}
});
}
}
});
})
Have a nice day.
If you are a Github user, then you might familiar with Pull Requests. Github
has an options
to delete a branch after merging of pull request.
After a Pull Request has been merged, you’ll see a button to delete the lingering branch:
Above action will delete the branch only in the remote. Then there is a question:
how do I clean up my local branches? I found an answer as follows
Lets say my test branch name feature-collaboration
1. List branches in local machine
The command git branch -a
shows the test branch feature-collaboration
is present on local and also present on remote
2. Prune/Cleanup the local references to remote branch
The command git remote prune origin --dry-run
lists branches that can be
deleted/pruned on your local. An option --dry-run
is needed.
Now go ahead and actually prune/cleanup the local references by running the command
git remote prune origin
. Note that you don't need an option --dry-run
.
Again, run the command git branch -a
will show the local status of branches.
Now you can notice that remotes/origin/feature-collaboration
has been removed,
but not the local branch feature-collaboration
.
3. Delete local branch
If wanted, we can clean-up the local branch feature-collaboration
as well
That's it. Have a nice day.
S3 becomes de-facto standard for publishing files in the internet.
When you work with the team, you might want to restrict an access of single S3 bucket to
specific users. You can do it in IAM as follows
- Create Group
- Create User. Then use Manage Password to add a password for your user.
- Add User to the created Group
- Create and Attach Permission Policy for the group.
Step 1, 2 and 3 are straight forward. But creating and attaching permission
policy needs some attention.
In Group tab, go to created group.
Then click the Permissions tab and Click the Attach Policy button.
You’ll be taken to Set Permissions page where you can Manage User Permissions.
Here you can select a Select Policy Template option, then find the Amazon S3 Full Access
and click Select button.
You will be prompted with Policy Name and Policy Document. You can
change the policy name as you wish. In the Policy Document section, paste the following content
{
"Statement": [
{
"Effect": "Allow",
"Action": "s3:ListAllMyBuckets",
"Resource": "arn:aws:s3:::*"
},
{
"Effect": "Allow",
"Action": "s3:*",
"Resource": [
"arn:aws:s3:::mys3bucket",
"arn:aws:s3:::mys3bucket/*"
]
}
]
}
You are done. Have a nice day.