About Me

My photo
Drum & Bass Producer, Software Developer, Love my Cats

How to fix : Gradle error: could not execute build using gradle distribution

if you're trying to build your project in eclipse or android studio and get this error:

Gradle error: could not execute build using gradle distribution

Or something similar, then you should:
1. Close your IDE.
2. Open a terminal.
3. Run this: mv ~/.gradle/ ~/old.gradle(which is basically renaming the hidden folder .gradle in your home directory to old.gradle folder - to keep a backup)4. Build your project in your IDE.5. Now a new .gradle hidden folder will be created and you're ready to go!\


hope this little tip helps you with solving the issue of getting
Gradle error: could not execute build using gradle distribution

AWS CLI using pip - installation fails and yields error : OSError: [Errno 1] Operation not permitted: '/tmp/pip-nIfswi-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info'

if your'e trying to install the aws cli using pip with the amazon website command:

pip install awscli

and you get this error:

OSError: [Errno 1] Operation not permitted: '/tmp/pip-nIfswi-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info'

then you should run this instead:

sudo pip install --ignore-installed awscli


hope this command helps you installing aws cli on your mac without any isseus

good luck!

iOS 10 Swift 3 How to limit input in a UITextField to Digits only (or any other set of characters) - Swift 3 Digits-only text field

If you want to create a UITextField that allows only inputting specific characters, simply set your viewcontroller as the text field's delegate and implement this delegate method:

func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
        if string.characters.count > 0, !"1234567890".contains(string) {
            return false
        }
// the rest of your logic goes here...

}

notice that here I'm allowing only any of these chars: "1234567890"
but your can change the string to any character set you want, for example "abcdefgh"(...) etc

notice the negative logic here: if this string is NOT contained in the character set you provided - then return false; else - do the rest of your logic..

[edit:] also, notice the first if:  string.characters.count > 0 which does not prevent deleting characters from the textfield (without this if-condition, you'll prevent your user from backspacing)

Also, it is best practice, of course, to choose the appropriate keyboard type in Interface Builder - based on what you want your user to input:
help your user

How to fix this message in iOS 10 development: [App] if we're in the real pre-commit handler we can't actually add any new fences due to CA restriction

This message started popping up in my console a lot, here's how to fix it:

1. click the run-scheme you're debugging
2. click "Edit Scheme..."
3. in the "Run (debug)" tab - pick "Arguments"
4. click + in the "Environment Variables" to add an argument
5. enter "OS_ACTIVITY_MODE" as the name
6. enter "disabled" as the value
7. click close, clean project and run again!

this is how to solve this message on xcode in ios 10

[App] if we're in the real pre-commit handler we can't actually add any new fences due to CA restriction

let me know if it was helpful in the buttons below!

simple elegant way to get user agent in iOS swift 3 using a webview and a tiny bit of javascript

Here's a simple and elegant way to add a user-agent header to your headers dictionary in whatever networking framework you're using, if it doesn't provide the user-agent header out-of-the-box:

"User-Agent" : UIWebView().stringByEvaluatingJavaScript(from: "navigator.userAgent")!


we just init a webview, run a javascript that returns the user-agent from within the webview as a string, and use the value wherever you want (in the headers, eg)

have fun getting device user agent in swift!