Skip to main content

Posts

Showing posts from June, 2017

The Gradle Nightmare in Android Studio

The Gradle Nightmare in Android Studio
 This is a relatively common message in Android Studio if you dare to touch Gradle:

11:13 PM    Gradle sync failed: Minimum supported Gradle version is 3.3. Current version is 2.2. If using the gradle wrapper, try editing the distributionUrl in C:\Users\Acer Aspire\AndroidStudioProjects\MyApplication\gradle\wrapper\gradle-wrapper.properties to gradle-3.3-all.zip
                    Consult IDE log for more details (Help | Show Log)

 I have installed Gradle in c:\gradle and configured Android Studio File->Settings->Build, Excution ..->Gradle to point to this installation. 

If you try to rebuild the project, you still get:

Error:Could not find com.android.tools.build:gradle:3.5.0.
Searched in the following locations:
    file:/C:/Program Files/Android/Android Studio2/gradle/m2repository/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.pom
    file:/C:/Program Files/Android/Android Studio2/gradle/m2repository/com/android/tools/build/gradle/3.5.0/gr…

How to Prevent Excessing Use of Wifi Connections by Windows Update (Windows 10)

How to Prevent Excessive Use of Wifi Connections by Windows UpdateGlasswire is a mostly-free bandwidth monitor for Windows PCs. It probably does a few other things too. One of the nasty things Windows will do it start updating the operating system just when you are watching a live show online with very limited data bundles. All of a sudden, Windows decides out of it's great WISDOM, that when you are almost out of bundles in the middle of this crucial show is the best time to start downloading massive updates.

Bad thoughts flash through your mind but you manage to get hold of yourself. Who do you blame anyway? Some anonymous software engineer in Redmond, WA??

The thing is, you need to sort out this mess. There is an easy way of preventing Windows from misusing your bundles via a Wifi link: Set the Wifi link to be metered.  How?

The sequence is illustrated below. It goes like this:
Press the Windows key to get the Start menu (assuming Windows 10)Click the gear icon to get the Settings m…

How to Rotate Your Web Page Background at Radom

How to Rotate Your Web Page Background at Random
Problem: I want my web page background image to change every time the page is loaded by picking an image at random.

The images in this solution are all prepared in advance. They are all named live#.jpg where "#" is a number between 1 and whatever the number of images you have.  Hence they are named:

live1.jpglive2.jpglive3.jpg........The naming system simplifies the script that will be used to load the images.
The approach adopted is a three-step algorithm: Create an array of the file names for these image files in a certain folder. In my case, the folder is called "slides".Count the number of files. There are possibilities of counting sub-directories and . and .. if not careful. In this solution, we ensure no subdirectories are in the target folder and do a little arithmetic to eliminate the .. and .. folders.Generate a random number based on the number of files in the target folder and append this number to the base nam…