Data dodania Pytanie
2017-03-18 18:03 Regex to replace ' (single quote once) but not '' (single quote twice) with '||''' »
In below line if we have single quote (') then we have to replace it with '||''' but if we have single quote twice ('') then it should be as it is. I...
(2) odpowiedzi
2017-03-18 08:03 A realistic example where using BigDecimal for currency is strictly better than using double »
We know that using double for currency is error-prone and not recommended. However, I'm yet to see a realistic example, where BigDecimal works while d...
(2) odpowiedzi
2017-03-18 02:03 Displaying toast before app closes in java »
I have created a simple dice game in Android. When the user hits an "end game" button, I want to display a toast that says "thanks for playing" and th...
(2) odpowiedzi
2017-03-18 00:03 Thread locality »
I have this statement, which came from Goetz's Java Concurrency In Practice: Runtime overhead of threads due to context switching includes saving ...
(2) odpowiedzi
2017-03-17 17:03 Best way to map JAXB to a database table »
I have an inbound xml which I am mapping to JAXB objects using the xjc tool (to build the pojos) I am wondering what the best approach is to map the...
(5) odpowiedzi
2017-03-17 16:03 SparkContext setLocalProperties »
As continuation of this question, could you please tell me what properties I can change from SparkContext.setLocalProperties? Could I change cores, RA...
(2) odpowiedzi
2017-03-17 13:03 Cannot locate my mistake in an algorithm involving Pythagorean triples and sets »
I'm trying to find the answer to "Given that L is the length of the wire, for how many values of L ≤ 1,500,000 can exactly one integer sided right a...
(0) odpowiedzi
2017-03-17 13:03 Save bulk of rows at one time using Angular js ,Spring,hibernate »
Code snippet which i have posted is working fine and values are saving into DB. But what actually i need is to save the list of rows at a time for one...
(1) odpowiedzi
2017-03-17 12:03 Java UI on top of Ruby script »
I've been searching for answer without any luck for the below problem: I have a quite lengthy ruby script which if you run in terminal(MAC) requires...
(0) odpowiedzi
2017-03-17 10:03 Calling Service From Broadcastreceiver not working as expected »
I want my service to run at a time specified from alarm manager. But in my case its running on the time i have specified and also if i open the app af...
(1) odpowiedzi
2017-03-17 07:03 What are new features in Java 9 (specially Collection and Streams)? »
I know Java 9 is not yet released. But we still have Java 9 EA release, I am just curious to know some more features people on this platform explored ...
(3) odpowiedzi
2017-03-17 07:03 JDBC - ORA-00984: column not allowed here »
import java.util.*; import java.sql.*; public class Jdbc { public static void main(String j[]) { Scanner sc = new Scanner(System.in); ...
(1) odpowiedzi
2017-03-16 19:03 Scala Count Variable »
I've been looking for a way to use a count to iterate through my List but I haven't found a way, I tried to use var count = 0 to no avail. Here is my...
(2) odpowiedzi
2017-03-16 18:03 Simple data stream: Go being super slow compared to Java »
As a Java dev, I'm currently looking at Go because I think it's an interesting language. To start with it, I decided to take a simple Java project I ...
(3) odpowiedzi
2017-03-16 17:03 namedParameterJdbcTemplate batchUpdate vs INSERT INTO SELECT »
I'm performing an experiment where I want to see what approach to inserting multiple records into a PostgreSQL database is going to give me the best s...
(0) odpowiedzi
2017-03-16 15:03 toString Method ArrayList simple recursion »
I am trying to print the contents of a list recursively and this is what I should be getting [6, 8] but I am getting [8, 8 6, 6] But it's printing...
(3) odpowiedzi
2017-03-16 12:03 Multiple SQL Statements in Java (with ?allowMultiQueries=true) »
I have a question. I work with a lot of SQL Queries and try to work out the best and fastest solution to handle a lot of queries (about 10'000 SQL-que...
(1) odpowiedzi
2017-03-16 10:03 Predicate vs if statement »
I have see in some project that people use predicate instead of pure if statements, illustrate with simple example below, what is pros and cons for th...
(3) odpowiedzi
2017-03-16 04:03 Strange behavior with string interning in Java »
There is code as following: String s = new String("1"); s.intern(); String s2 = "1"; System.out.println(s == s2); String s3 = new String("1")+ne...
(4) odpowiedzi
2017-03-16 00:03 java - curry an existing static function »
To take full advantage of function composition in Java I'd like to curry some existing static functions that I commonly use. A perfect candidate for ...
(3) odpowiedzi
2017-03-15 21:03 How to include gems in java implementation using jRuby? »
I have written a demo program to run ruby code in java(basically scala, but it's quite similar) using jRuby. Here is what I am doing: package com.fl...
(0) odpowiedzi
2017-03-15 19:03 JUnit testing - Hw can I set up my DB connect to avoid tests failing due to maximum DB connection reached »
I am doing some DAO testing in Java, and I have defined a class that sets the connection to the testing DB like this import io.dropwizard.testing.Res...
(1) odpowiedzi
2017-03-15 14:03 Java 8 lambda: iterate over stream objects and use previous/next object(s) in stream »
I am practising some entry-level java 8 lambda functionality. Given a list of messages, each containing a message offset, where all offsets must form...
(5) odpowiedzi
2017-03-15 14:03 Trying to write a Java wrapper which will start or stop logstash »
I have written a java wrapper which I am using to run logstash. I want, if my parent thread dies all the ruby threads should get killed. Currently, Ex...
(0) odpowiedzi
2017-03-15 12:03 How to hide Kotlin's lateinit var backing field from Java? »
In Kotlin, suppose, I have class: class MyKotlinClass { lateinit var field: String } According to docs: Late-Initialized properties are als...
(3) odpowiedzi
2017-03-15 03:03 Java Class Requirements »
In the following problem, 1. Which of the following is true regarding Java classes? a) All classes must have 1 parent but may have any numb...
(1) odpowiedzi
2017-03-14 20:03 Inline comments for if/else on the same line with the opening brace? »
Which of the below variants is better/best, and why? NOTE: the comments below are intended to document the result of the if/else operation (e.g. "cat...
(0) odpowiedzi
2017-03-14 16:03 How do you share Java functions without giving others source code? »
When programming in C++ we have header files and source files. When our company sells our product (which is just a library of useful functions essenti...
(1) odpowiedzi
2017-03-14 16:03 Brownfield | Stetho | ":com.facebook.stetho:stetho-okhttp:1.2.0' depends on one or more Android Libraries but is a jar" »
I'm integrating React Native into an Android project and I'm running into this gradle issue. ":com.facebook.stetho:stetho-okhttp:1.2.0' depends on...
(1) odpowiedzi
2017-03-14 15:03 How to do a groupingBy of groupingBy in java8 with a List attribute inside object »
I have class Activity { int id; ActivityType activityType; } class ActivityType { int id; } class Tournament { int id; List<Ac...
(3) odpowiedzi
2017-03-14 13:03 newInstance vs new in jdk-9/jdk-8 and jmh »
I've seen a lot of threads here that compare and try to answer which is faster: newInstance or new operator. Looking at the source code, it would see...
(2) odpowiedzi
2017-03-14 12:03 Is there a way to force Google Speech api to return only words as response? »
I am using Googles this api :- https://www.google.com/speech-api/v2/recognize?output=json&lang="+ language_code+"&key="My key" for spe...
(1) odpowiedzi
2017-03-14 10:03 Volatile keyword in java under the hood »
I have had a little argument with my teacher about the volatile keyword in java. Is it right to say that when a variable is declared as a volatile: ...
(4) odpowiedzi
2017-03-14 06:03 Need help writing a dynamic method that gives user a different prompt when the method is called with a different parameter every time »
Im trying to write a method that works around user choices (ex. queryChoicesMethod). There are 4 choices that the user can pick, and at the end of it ...
(1) odpowiedzi
2017-03-14 02:03 Cloudfoundry : How to combine two runtimes »
Is there a way in cloundfoundry to combine two runtime environments? I am deploying a NodeJS app to IBM Bluemix. Now, i also want to be able to execut...
(2) odpowiedzi