Win a copy of Succeeding with AI this week in the Artificial Intelligence and Machine Learning forum!

Chandra shekar M

Ranch Hand
+ Follow
since Dec 20, 2006
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Chandra shekar M



the collection employees  is large and computeAndUpdate() performs costly DB operation so wanted to parallelize this part of the code, as each record is independent and doesn't depend on each others result.

The question is what is the right syntax to invoke computeAndUpdate() in parallelStream

I need something like a forloop, which can loop over the games and find the players not playing that game. Can I do this in SQL or should I write a procedure
Hi,

 Please find the SQLfiddle link  http://sqlfiddle.com/#!9/89c76/2


How can I do this in a single query for all the games, there can be many types of games. I cant specify the games explicitly, instead, I want to write the query to fetch all the playerids who are not playing a game for each of the game some thing like this



the above query is giving only one record. I need like this

Result:
------------------------
game1 | 4,5,6  
------------------------
game2 | 4,6
------------------------
game3 | 1,2,3,5,6
------------------------
....
Hi Paul,
Thanks much for the help, however, I missed few more conditions. Please find the complete query

Hi Paul,
Thanks much for the help, however, I missed few more conditions. Please find the complete query

Yes, the second query I have doubt, the a.population > b.population. as I am using a.population, its not working.

Was looking on how we can rewrite the query

Was not knowing how to edit original post update with correct query




Thanks


Hi,
I am trying to write below query in vertica

Select *
From a
Where a.country="India" AND
A.language ="Hindi"
AND(case when (spoken = true AND exist(
select 1 from b
where b.country=a.country and
b.language=a.language
AND case when a.population >= b.populatiom)) then
True
Else
false
END)

it is not working, because we can't reference "a.population" outer query field in case expression of innerquery. I tried rewriting it wil OR caluse Vertica is not allowing it.

How can I re-write this
If two threads are locking on same object then they will block each other like on different objects they won't.



 When we shift the synchronization to method level.
 in case of 1. it will block as synchronized(this)  where this=a which is only one instance
 in 2. it will not block as this=a and this=b for two different Threads


 
Hi,

Let consider the following use case,

it blocks on only the caller threads, if two different threads are called then they won’t get blocked, it is as good as no synchronization right ?

same thing is with built in Thread safe classes of java, hence we should not rely on them, we should handle synchronization ourselves right ?
Thanks Guys, really appreciate the help.

4 years ago

Piet Souris wrote:ah well, a little bit shuffling never hurt anybody!

A more serious problem with the method is that it is wrong.
With the corrected code:

the output is

So you should take a long enough BitSet for your 'checker'.



Corrected code is


Should fix the issue
4 years ago