How to properly compare two Integers in Java?

How to properly compare two Integers in Java?

I know that if you compare a boxed primitive Integer with a constant such as:Integer a = 4;if (a < 5)a will automatically be unboxed and the comparison will work.However, what happens when you are comparing two boxed Integers and want to co

Java: splitting a comma-separated string but ignoring commas in quotes

Java: splitting a comma-separated string but ignoring commas in quotes

I have a string vaguely like this:foo,bar,c;qual="baz,blurb",d;junk="quux,syzygy"that I want to split by commas -- but I need to ignore commas in quotes. How can I do this? Seems like a regexp approach fails; I suppose I can manually scan a

How can I use external JARs in an Android project?

How can I use external JARs in an Android project?

I have created an Android project and added an external JAR (hessian-4.0.1.jar) to my project. I then added the JAR to the build path and checked it off in Order and Export.Order and Export is ignored it seems, and all classes from the exte

Why is my Spring @Autowired field null?

Why is my Spring @Autowired field null?

Note: This is intended to be a canonical answer for a common problem.I have a Spring @Service class (MileageFeeCalculator) that has an @Autowired field (rateService), but the field is null when I try to use it. The logs show that both the M

ant and java 8 - “major version 52 is newer than 51, the highest major version supported by this com

ant and java 8 - “major version 52 is newer than 51, the highest major version supported by this com

I am trying to upgrade my ant project from java 7 to java 8.(the project deployed in "Eclipse Kepler" with "Java™ 8 support to Eclipse Kepler SR2")For that i downloaded ant 1.9.4 ( according this post http://wiki.eclipse.org/Ant/Java8) , an

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

Why does the ld linker allow multiple class definitions with the same methods?

Why does the ld linker allow multiple class definitions with the same methods?

Consider this file, first.cpp, containing a class definition and use:#include struct Foo{ Foo(){ std::cout and another, second.cpp, containing a conflicting class definition:#include struct Foo{ Foo(); ~Foo();};Foo::~Foo(){ std::co

Why are generic and non-generic structs treated differently when building expression that lifts oper

Why are generic and non-generic structs treated differently when building expression that lifts oper

This looks like a bug in lifting to null of operands on generic structs.Consider the following dummy struct, that overrides operator==:struct MyStruct{ private readonly int _value; public MyStruct(int val) { this._value = val; } pu

maven: (use -source 5 or higher to enable static import declarations)

maven: (use -source 5 or higher to enable static import declarations)

How can I use source 5?I triedmvn -source 5 testbut it didn't work :-)When I compile the file by javac, everything works. 1:You need to configure the maven-compiler-plugin: ... org.apache.maven.plugins maven-co

How to show DatePickerDialog on Button click? [closed]

How to show DatePickerDialog on Button click? [closed]

I'm developing an app that requires user to select date(dd/mm/yyyy).I want to show a dialog box with DatePicker on button click.once date is selected it must show in EditText.I'm using Android Studio 2.2, project with min sdk is 23.Kindly h

How to mutate struct field in method

How to mutate struct field in method

How I can mutate struct field from method?I want do thatstruct Point { x: int, y: int,}impl Point { fn up(&self) { self.y += 1; }}fn main() { let p = Point { x: 0, y: 0 }; p.up();}But this code throw compile error:/

Enabling/installing GD extension? --without-gd

Enabling/installing GD extension? --without-gd

How does one enable (or perhaps I need to install) GD when my phpinfo() output in "Configure Command" says; --without-gd ?I also have nothing in my phpinfo() output "Core" that lists "gd"PHP Version 5.2.4 on AWS. 1:if you are on a Debian

Controller 'ngModel', required by directive '…', can't be found

Controller 'ngModel', required by directive '…', can't be found

What's going on here?Here is my directive:app.directive('submitRequired', function (objSvc) { return { require: 'ngModel', link: function (scope, elm, attrs, ctrl) { // do something } };});Here is an exam

Converting c++ string to int

Converting c++ string to int

I have the following data in a c++ stringJohn Doe 01.01.1970I need to extract the date and time from it into int variables. I tried it like this:int last_space = text_string.find_last_of(' ');int day = int(text_string.substr(last_space + 1,

gmail integration in ios application

gmail integration in ios application

I am working on an ios Application, recently I have got a new requirement for it i.e. to provide user a option to sign in with gmail . when user hit the sign in button then i want to open gmail login screen and after user enter his credenti

(OpenGL 3.1 - 4.2) Dynamic Uniform Arrays?

(OpenGL 3.1 - 4.2) Dynamic Uniform Arrays?

Lets say I have 2 species such as humans and ponies. They have different skeletal systems so the uniform bone array will have to be different for each species. Do I have to implement two separate shader programs able to render each bone arr

Persist Entity Framework query cache

Persist Entity Framework query cache

I have an ASP.NET MVC 5 web-application and use EF 6.1 to access my DB.I have some rather complex LINQ queries which take up to 10s to compile, but then execute in a few milliseconds. EF does cache this queries fine and the second time the

tcmalloc: how can I get my malloc calls overridden when compiling statically?

tcmalloc: how can I get my malloc calls overridden when compiling statically?

When I use LD_PRELOAD=/usr/local/lib/libtcmalloc.so, all my calls to malloc become tcmalloc calls. However, when I link statically against libtcmalloc, I find that straight malloc is getting called unless I still use the LD_PRELOAD setting

Set Java Compliance Level in CXF wsdl2java

Set Java Compliance Level in CXF wsdl2java

I’m brand new to CXF and am trying to create a client from WSDL. I have used Metro and Axis in the past. I downloaded apache-cxf-2.3.3 and used wsdl2java to generate the client stubs. I use Maven and set it up my pom with this: 2.3.3

Multiple definition of a global variable [duplicate]

Multiple definition of a global variable [duplicate]

Possible Duplicate: constant variables not working in header In my header file which I use to create a shared object, I have the following:#ifndef LIB_HECA_DEF_H_#define LIB_HECA_DEF_H_struct dsm_config { int auto_unmap; int enable_

Creating custom Field Lookups in Django

Creating custom Field Lookups in Django

How do you create custom field lookups in Django? When filtering querysets, django provides a set of lookups that you can use: __contains, __iexact, __in, and so forth. I want to be able to provide a new lookup for my manager, so for insta

How to lazily evaluate an arbitrary variable with Chef

How to lazily evaluate an arbitrary variable with Chef

I'm writing a Chef recipe to install our application code and execute it. The recipe needs to be particular about the directory this code ends up in (for running templates, setting log forwarding etc.). Thus the directory itself pops up in

How can I display the output of a Opscode Chef bash command in my console?

How can I display the output of a Opscode Chef bash command in my console?

I use Vagrant to spawn a standard "precise32" box and provision it with Chef so I can test my Node.js code on Linux when I work on a Windows machine. This works fine.I also have this bash command so it auto installs my npm modules:bash "ins

Same source, multiple targets with different resources (Visual Studio .Net 2008)

Same source, multiple targets with different resources (Visual Studio .Net 2008)

A set of software products differ only by their resource strings, binary resources, and by the strings / graphics / product keys used by their Visual Studio Setup projects. What is the best way to create, organize, and maintain them?i.e. Al

Youtube data API : Get access to media stream and play (JAVA)

Youtube data API : Get access to media stream and play (JAVA)

I want to access a youtube video and play using my own media player. I am able to get the video properties (title, url etc..) using the youtube data API. Can I get access to the stream of the video and use my own Media Player (like the Andr