Standard Android Button with a different color

Standard Android Button with a different color

I'd like to change the color of a standard Android button slightly in order to better match a client's branding.The best way I've found to do this so far is to change the Button's drawable to the following drawable located in res/drawable/r

How do getters and setters work?

How do getters and setters work?

I'm from the php world. Could you explain what getters and setters are and could give you some examples? 1:Tutorial is not really required for this. Read up on encapsulationprivate String myField; //"private" means access to this is rest

How to download and save a file from Internet using Java?

How to download and save a file from Internet using Java?

There is an online file (such as http://www.example.com/information.asp) I need to grab and save to a directory. I know there are several methods for grabbing and reading online files (URLs) line-by-line, but is there a way to just download

'innerText' works in IE, but not in Firefox

'innerText' works in IE, but not in Firefox

I have some JavaScript code that works in IE containing the following:myElement.innerText = "foo";However, it seems that the 'innerText' property does not work in Firefox. Is there some Firefox equivalent? Or is there a more generic, cros

Random shuffling of an array

Random shuffling of an array

I need to randomly shuffle the following Array:int[] solutionArray = {1, 2, 3, 4, 5, 6, 6, 5, 4, 3, 2, 1};Is there any function to do that? 1:Using Collections to shuffle an array of primitive types is a bit of an overkill...It is simple

How to remove/delete a large file from commit history in Git repository?

How to remove/delete a large file from commit history in Git repository?

Occasionally I dropped a DVD-rip into a website project, then carelessly git commit -a -m ..., and, zap, the repo was bloated by 2.2 gigs. Next time I made some edits, deleted the video file, and committed everything, but the compressed fil

Aren't promises just callbacks?

Aren't promises just callbacks?

I've been developing JavaScript for a few years and I don't understand the fuss about promises at all.It seems like all I do is change:api(function(result){ api2(function(result2){ api3(function(result3){ // do work

What is a StackOverflowError?

What is a StackOverflowError?

What is a StackOverflowError, what causes it, and how should I deal with them? 1:Parameters and local variables are allocated on the stack (with reference types the object lives on the heap and a variable references that object). The sta

Saving Android Activity state using Save Instance State

Saving Android Activity state using Save Instance State

I've been working on Android SDK platform, and it is a little unclear how to save an application's state. So given this minor re-tooling of the 'Hello, Android' example:package com.android.hello;import android.app.Activity;import android.os

Providing white space in a Swing GUI

Providing white space in a Swing GUI

A GUI with no white space appears 'crowded'. How can I provide white space without resorting to explicitly setting the position or size of components?­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­

Implementing the command pattern

Implementing the command pattern

I am in the design process of an application, and I would like to use the command pattern for undo/redo purposes. I did some research into the command pattern but the only thing I don't get is: Should a command have the undo and redo method

Error inflating class android.webkit.WebView happens sporadically in production

Error inflating class android.webkit.WebView happens sporadically in production

my application is on Google Play and it runs fine on most of devices (thousands of users). But in rare cases (fraction of percent of daily active users) I get Error inflating class android.webkit.WebView when I inflate layout for my fragmen

What are the differences between typedef and using?

What are the differences between typedef and using?

What are the differences between usingtypedef Some::Nested::Namespace::TypeName TypeName;orusing Some::Nested::Namespace::TypeName;to provide the shorthand TypeName in the local scope? 1:typedef gives an alias name for the type. typed

Why am I getting Unexpected token '\\u0000' when using npm install -g package

Why am I getting Unexpected token '\\u0000' when using npm install -g package

This is probably a Windows specific issue but I haven't found any information when googling this issue. I had been using ionic framework which relies on Cordova (or Phonegap). However, the problem is not specific to any of these packages.

opengl glutmainloop()

opengl glutmainloop()

i just started off using OpenGL and it seems it is not easy to understand the working of the glutMainLoop() what really happens there? Does it stay there doing nothing till any of the function calls responds? 1:It calls your display call

How to use enums in Qt signals and slots

How to use enums in Qt signals and slots

I have some trouble with using enum types in signals. Basicly I have two classes, a state machine and a thread handling the state machine. When the state is changed I want to send a signal with the new state. I also want to represent the st

Run multiple web apps in one spring boot container

Run multiple web apps in one spring boot container

I would like to be able to have multiple web apps sharing a domain project and running under different contextPaths.By setting server.contextPath=/webshop in a spring boot app I dont need to prefix all the RequestMappings.I would like the w

Why am I getting error message “URI is not Registered”?

Why am I getting error message “URI is not Registered”?

I just installed Android Studio and everything ran fine but then I opened AS for a second time after my computer had turned off and I am getting the following error:"URI is not Registered"On the following lines of code:This is just the mani

How can I check if I'm on the last element when iterating using foreach syntax [duplicate]

How can I check if I'm on the last element when iterating using foreach syntax [duplicate]

This question already has an answer here: Printing lists with commas C++ 23 answers For example:for( auto &iter: item_vector ) { if(not_on_the_last

SIGSEGV SEGV_ACCERR Crash Reports - What to do?

SIGSEGV SEGV_ACCERR Crash Reports - What to do?

I've just released an app on the AppStore with Crittercism crash reporting and I've been getting quite a few crash reports pertaining to a SIGSEGV error. Crittercism gives me a StackTrace and a few handy details about usage statistics, etc.

Configuring Gradle with Kotlin

Configuring Gradle with Kotlin

I am trying to use kotlin with gradle, but I am unable to succesfully create a project with Intellij Idea 15.I've create simple project with two modules hello-java and hello-kotlin. hello-java is plain java project and it is compiling and r

Getting warning in C for 'atoi' function

Getting warning in C for 'atoi' function

I'm currently coding for a challenge question in a book I'm reading. My code executes perfectly with the correct output, but i"m getting a warning in my code and I'm just wondering why.I'm getting a warning on the line that reads:int countd

public static final variable in an imported java class

public static final variable in an imported java class

I happen to come across a Java code at my work place. Here's the scenario: There are 2 classes - ClassA and ClassB.ClassA has nothing except 4 public static final string values inside it. Its purpose is to use those values like ClassA.varia

How to run single Java file from a project in Eclipse?

How to run single Java file from a project in Eclipse?

I want to run one Java file from a project in Eclipse. There is code to insert into database in that Java file, I want to check from that single file whether its working or not. Is there any way to run a single Java file from a project?

IntelliJ Idea sbt managed source file

IntelliJ Idea sbt managed source file

I am using sbt-buildinfo plugin that generates Scala source from my build definitions, allowing me to reference project name, version, etc. from my Scala code.It does this by generating a file BuiltInfo.scala with the following contents:pac