How to manage race condition for a certain period of time? [on hold]

A single user may request for going to vacation or mission by a web application over REST and then AMQP . The vacation/mission request times should not overlap(the overlapping requests should be rejected).

In What ways I can avoid the overlap and manage the race condidion?

How to reject the request if it overlaps an earlier request?

Create a row based on a condition (column value)

I have a table that contains the following data;

EmpNo | GivenName | PreferredName  --------------------------------- 1     | Paris     | Paris 2     | Ashley    | Ash 

I am trying to get an output where, if the GivenName and PreferredName values are same, then the row should be returned as it is, but if they are different then the row should be returned twice (if possible, the row returned twice should have a NULL in PreferredName in the first occurence and GivenName a NULL in the second). Something like this:

EmpNo | GivenName | PreferredName  --------------------------------- 1     | Paris     | Paris 2     | Ashley    | NULL 2     | NULL      | Ash 

I have no idea where to begin. I tried using CASE statement and FULL OUTER JOIN to no avail. I have as well tried using the code below, and it is giving me the answer for the first part of my question:

SELECT [EmpNo]       ,[GivenName]       ,[PreferredName] FROM [Emp] E WHERE [GivenName]= [PreferredName] UNION ALL SELECT [EmpNo]       ,[GivenName]       ,[PreferredName] FROM [Emp]  

NINTEX Workflow Looping and stepping out of Loop after a condition is met SharePoint 2016

I’m currently building a Nintex workflow for a SharePoint task list that sends a notification in between specific date ranges ie. If the due date of a task is greater than 4 months a reminder notification is sent monthly. If the due date is less than 4 months but greater than 1 month another notification is sent every 2 weeks, and if the due date is less than a month but greater than a week a notification is sent out weekly.

After each notification there is a pause to wait for work to be completed.

All of that is set up in a series of loops. My problem is finding a way out of the loop.

What I need to figure out is how get the workflow to check while in the loop if work is completed if work is completed. Stepping out of the loop if work is completed, sending a notification that work has concluded.

Inside of Nintex I’m not sure which action will monitor the item and once the task changes to complete, end the loop and send a notification that the task has been completed.

Any help would be great.

Thank you!

Can the spell make whole be used to remove the timeworn condition from technological items?

I am about to start running the Iron Gods adventure path, so I have been reading up on technology in Pathfinder. Upon reading about timeworn items, my immediate response was, why wouldn’t the technomancers of the Technic League just make whole such items rather than having a prestige class ability to make them function as if they weren’t timeworn? Why jury rig an item rather than magically fixing it completely?

I understand the game balance, meta-reason for saying no, this doesn’t work, but I want to be prepared to be able to give more than just GM fiat (which always leaves a bad taste in players’ mouths) for why their good (and in my mind, obvious) idea won’t work. So if there is any official ruling, errata, etc. out there that will back up prohibiting a magical quick fix, I would appreciate it being shared. Otherwise, I will be forced to either admit the Technic League are complete idiots and allow the players to fix every timeworn item they find with a simple 2nd-level spell, or not let it happen because I say so. (I don’t see my players being happy with that reason any more than children are when their parents use it.)

Does the frightened condition provide supernatural knowledge of the location of the source of fear?

The effects of being Frightened are as follows:

  • A frightened creature has disadvantage on ability checks and attack rolls while the source of its fear is within line of sight.

  • The creature can’t willingly move closer to the source of its fear.

Does this give a Frightened creature any extra knowledge of the location of that source?

More specifically:

A player is Frightened of a dragon, and has run into a location with two exits and no vision of the dragon. The dragon has since moved and Hidden from them, and could potentially be lurking close to either of the two exits.

The player tries to run towards the exit that, unknown to them, the dragon is lurking near. What happens?

  1. The player is not “willingly” moving closer to the dragon, they are unknowingly doing so. They can keep moving closer to the dragon up until they become aware of the dragon’s location.

  2. Moving towards the dragon (even unknowingly) would be “willingly” moving closer to the dragon (here “unwilling” would be “dragged by someone else’s magic” or similar). Therefore, they find themselves unable to move in that direction, and may well be able to deduce it is because the dragon’s location is in that direction.

  3. Something else.

Negative match in step condition

modify step condition=!inurl:something

This wont work :( It doesnt work in more steps like submit success etc.

There is too much of this stuff and what just happens is me posting a lot, where the engine should behave differently but it is not. I know there wont be much people (expect advanced users) gaining advtanage of these updates and this is starting to be painfull for both of us. Can you please tell me your point of view at this and any ideas for the future? I love this tool, it is amazing but the script engine needs some love. 

What i think could be a great way is something that would allow us use external scripts to tell SER what just happend and what is the next step. I am not sure but the first thing that comes to my mind is the ability to outsource any step / data extraction / to external API or command line tool that will response back with what SER needs to know.

Writing a simple API in Golang (compiles to exe) or Python is really easy.
Writing a proxy where SER sends request, then modyfing the html for the SER to see clear messages may be a way to go also. But in the end we want to use the amazing script engine, beacuse the idea behind is too good to throw it away.

Creating custom extensions could be great also… but protections and inter-process communication may not be that simple, i dont know, i dont have much experience in that field. Maybe if we could create our own .ini commands; a simple file, ex:


Then if the command line answers with 1 = submit was success, 0 = submit was failed.
This does not seems like ideal solution, but its just an idea, maybe we can think of something better, i can think, i can bring better ideas, but it all depends on @Sven

What i know, is; the tool is powerfull and freqently updated, the support is amazing and helpfull, being a part of this is a great feeling and motivates to move forward.

Maybe i didnt figure a way thats already there? I would love to discuss and hear opinions. 

Atualizar valor de campo no MySql usando o PHP if condition

Tenho uma tabela no MySql de nome “Cadastro” onde a mesma possui os seguintes campos:

  • id – Tipo: Auto Increment – Primary Key
  • dataCadastro – Tipo: Date
  • statusFK – Valores 1 (Ativado) e 2 (Desativado) —> No caso este campo esta relacionado a uma tabela chamada “status” ou seja, é um Foreing Key dentro da tabela “cadastro”)

No caso eu criei uma página index.php com uma tabela em HTML com esses três campos e gostaria que quando o campo “dataCadastro” for menor que a data atual, o campo statusFK fosse atualizado automaticamente para o valor 2 (desativado).

Entretanto, estou utilizando o seguinte código abaixo porém o mesmo esta atualizando todos os valores do campo “statusFK” para 2 (desativado) o que no caso seria somente o campo com data inferior a data de hoje:

if ( date('Y-m-d',strtotime($  row['dataCadastro'])) < date('Y-m-d')){  $  connection->query("UPDATE Cadastro SET statusFK = '2'");  }  

Abaixo é o código de conexão ao banco de dados onde a tabela Cadastro esta localizada:

<?php  $  username = 'root'; $  password = ''; $  connection = new PDO( 'mysql:host=localhost;dbname=mysystem;charset=utf8;', $  username, $  password );  ?>  

Como poderia alterar o meu código acima para tal? Obrigado.

Prepare query fails to return results when LIKE condition contains more than one non-wildcard character

I’m attempting to search a table of users using prepared statements. When the search string contains more than one character or seemingly random characters no results are returned (ie o and nn fail but n succeeds). The data in the database should return at least one result on the test queries I’ve used yet it returns none. I’m not certain that it’s related to the character length but every search query I’ve tried that had more than a single character would fail to return results when it should have at least one result.

I’ve attempted many forms of the query with no luck. I’ve adjusted collation on the table and the fields to add case insensitivity. I’ve searched for similar posts but could not find one. I’ve gone over MySQL prepare and like documentation as well. I initially started with using a PHP PDO connection with a much more complicated query but have narrowed it down to a simple SELECT and isolated it to the MySQL prepare.

*All of these queries were executed in MySQL Workbench

PREPARE stm FROM "SELECT firstName, lastName, displayName FROM `users` WHERE ? LIKE CONCAT('%',?,'%') ORDER BY ? asc"; SET @searchCol = 'firstName'; set @searchQuery = 'o'; set @orderBy = 'lastName'; EXECUTE stm USING @searchCol, @searchQuery, @orderBy; deallocate prepare stm; 

Expected: Trevor, Bloom, Trev Bloom
Recieved: nothing
*I randomly stumbled upon this case. I’m not sure why a single n will work yet a single o won’t.

PREPARE stm FROM "SELECT firstName, lastName, displayName FROM `users` WHERE ? LIKE CONCAT('%',?,'%') ORDER BY ? asc"; SET @searchCol = 'firstName'; set @searchQuery = 'nn'; set @orderBy = 'lastName'; EXECUTE stm USING @searchCol, @searchQuery, @orderBy; deallocate prepare stm; 

Expected: Anna, Hogan, Anna Hogan
Recieved: nothing

PREPARE stm FROM "SELECT firstName, lastName, displayName FROM `users` WHERE ? LIKE CONCAT('%',?,'%') ORDER BY ? asc"; SET @searchCol = 'firstName'; set @searchQuery = 'n'; set @orderBy = 'lastName'; EXECUTE stm USING @searchCol, @searchQuery, @orderBy; deallocate prepare stm; 

Expected: Multiple results which match %n%
Recieved: expected results

I have also attempted removing CONCAT('%',?,'%'), replacing it with ?, and changing @searchQuery to be set to %<query>% but the results are the same as above.

No error messages or abnormal logs are generated from what I can tell.

Charset/Collation are set to utf8 and utf_general_ci for the users table as well as applicable columns.

Below are the results of SHOW VARIABLES LIKE "%version%"

‘innodb_version’, ‘5.7.26’
‘protocol_version’, ’10’
‘slave_type_conversions’, ”
‘tls_version’, ‘TLSv1,TLSv1.1’
‘version’, ‘5.7.26-0ubuntu0.16.04.1-log’
‘version_comment’, ‘(Ubuntu)’
‘version_compile_machine’, ‘x86_64’
‘version_compile_os’, ‘Linux’

PostgreSQL data query from two tables based on a condition in python takes too long time?

I’m writing a python script and do database query to get the ids of employees who are in one table but are not in another. I’m using psycopg2 module for python 2 and PostgreSQL as database. After querying from one table based on a condition, I do another query on another table to get the difference between these tables using the result of previous query. The problem is the full procedure takes a long time. I want to know is there any other method or technique which can make the entire procedure faster? Below is the code I used for doing my feature:

def find_difference_assignment_pls_count(self):         counter = 0         emp_ids = []         self.test_cursor.execute("""Select id,emp_id from test_test where flag=true and emp_id is not null and ver_id in(select id from test_phases where state='test')""")         matching_records = self.test_cursor.fetchall()          for match_record in matching_records:             self.test_cursor.execute("""Select id from test_table where test_emp_id=%s and state='test_state'""",(match_record['emp_id'],))             result = self.test_cursor.fetchall()              if result:                 continue             else:                 emp_ids.append(match_record['emp_id'])                 counter +=1          print "Employees of test_test not in test_table: ", counter         return emp_ids 

I run these queries on two tables which at least have more than 500000 records. Therefore the performance is really slow.