Is it possible to insert into two tables at the same time?

In one statement: No. In one transaction: Yes BEGIN TRANSACTION DECLARE @DataID int; INSERT INTO DataTable (Column1 …) VALUES (….); SELECT @DataID = scope_identity(); INSERT INTO LinkTable VALUES (@ObjectID, @DataID); COMMIT The good news is that the above code is also guaranteed to be atomic, and can be sent to the server from a client … Read more

PRE-2016 Valgrind: Still Reachable Leak detected by Valgrind

There is more than one way to define “memory leak”. In particular, there are two primary definitions of “memory leak” that are in common usage among programmers. The first commonly used definition of “memory leak” is, “Memory was allocated and was not subsequently freed before the program terminated.” However, many programmers (rightly) argue that certain … Read more

How to remove leading and trailing rendered as white spaces from a given HTML string? [closed]

See the String method trim() – https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String/Trim var myString = ‘ bunch of <br> string data with<p>trailing</p> and leading space ‘; myString = myString.trim(); // or myString = String.trim(myString); Edit As noted in other comments, it is possible to use the regex approach. The trim method is effectively just an alias for a regex: if(!String.prototype.trim) … Read more

Delete all documents from index without deleting index

I believe if you combine the delete by query with a match all it should do what you are looking for, something like this (using your example): curl -XDELETE ‘http://localhost:9200/twitter/tweet/_query’ -d ‘{ “query” : { “match_all” : {} } }’ Or you could just delete the type: curl -XDELETE http://localhost:9200/twitter/tweet Note: XDELETE is deprecated for … Read more

tech