text:
Q: Designing a language with Checked Exceptions I'm well aware of the whole argument over whether or not checked exceptions are a good idea and I fall on the side that they are...but that is not the point of this question. I'm in the process of designing a fairly simple compiled OOP language and I've decided to use checked exceptions basically as a way of returning errors without going down the C route of returning error codes.
I'm looking for some insight as to how I could improve on the Java model of checked exceptions to eliminate most of their bad aspects, perhaps a syntactic change or changing the actual functionality slightly. One of the main criticisms against checked exceptions is that lazy programmers are likely to swallow them and so errors would not appear.
Perhaps it could be optional to catch exceptions and therefore if one is not caught the program would crash? Or maybe there could be specific notation to denote that an exception is not being handled (like the C++ virtual function '= 0' notation)? Or I could even cause the program to crash if the exception handler is empty (though this might surprise programmers new to the language)?
How about the try...catch syntax, do you think there could be a more concise way of expressing that an exception is being caught? The language will use a garbage collector, much like Java, so is there any need for the finally clause? Finally, what other disadvantages are there to checked exceptions and what potential solutions (if any) exist?

A: I think you should read Neil Gafters post regarding the improved exception handling in jdk7 and an interview with Anders Hjelsberg about exception handling in C# (vs. Java)

A: I think you should consider using a tri-state monad like Lift's Box type to handle Errors. Then you won't need to use Exceptions at all.
http://github.com/dpp/liftweb/blob/master/framework/lift-base/lift-common/src/main/scala/net/liftweb/common/Box.scala

A: Checked Exceptions are just a small instance of a more general drive towards what Erik Meijer calls type honesty. I.e. procedures, methods, functions should not lie with their types. If you see a type signature, you should be able to trust its type.
This is not true for Java today (especially if you imagine a Java-- without Checked Exceptions).
If you have a type signature like this in Java:
Foo bar(Baz)

it says "I take a Baz as input and produce a Foo as output". But that's a lie.
Actually, bar takes either a Baz or null as input. It also takes the entire global state, class state and instance state as input, as well as the entire universe, really (via e.g. file I/O, network I/O, database I/O and so forth). And it does not produce a Baz as output either: it produces either a Foo or null or an Exception or Bottom (i.e. nothing at all). Plus its output also includes the entire global state, the entire class state, the entire instance state and really also the entire state of the universe.
bar's actual type is:
(IO<Foo | null | Exception> | Bottom) bar(IO<Baz | null>)

or something like that.
This needs to be fixed, and Checked Exceptions are a (very small) part of that. I personally think that the other parts are more important and the Java designers should have concentrated on fixing those rather than exceptions (especially since exceptions are just side-effects, anyway and so you actually pretty much automatically fix exceptions for free when you fix side-effects).
Anyway, this is why I believe that the general idea behind Checked Exceptions is a Good Thing™, even if the specific implementation in Java might be a bit cumbersome.
How to fix Checked Exceptions depends a lot on what exactly you think is actually wrong with them.
Some people believe that the problem with Checked Exceptions is that when you change the internal implementation of your method to use a different helper method than it did before, which throws a different set of exceptions than the old one, you need to either explicitly handle those exceptions or declare them, thus breaking all your clients. Now, if that is what you think is wrong with Checked Exceptions, then there is only way to fix them: don't have them in the first place. Changing the exceptions you throw is a breaking change in your API contract, and breaking changes in your API contract should break client code. (Or more precisely: you shouldn't make breaking changes to your API contract, in order to not break client code.)
I believe that the main problem with Checked Exceptions as implemented by Java is that they break one of the main features of exceptions: non-local error handling. An error happens way over here, and is handled way over there, and these two are the only ones that need to know about it. If a different kind of error can happen over here, then the only place that needs to know about that new error and the only place that needs to change is the error handler over there.
With Checked Exceptions as implemented in Java, every piece of code in between also needs to change.
One proposal to fix this problem, are Anchored Exception Declarations. (Improved in Modular Anchored Exception Declarations.)
The idea of Anchored Exception Declarations is basically to use delegation for the exception declarations the same way that you use delegation in the method body, which is after all what creates the problem in the first place.
Say you have some file reader method which delegates to another method:
String fileReader(String filename) {
  return this.fileHelper.read(filename);
}

Now you go into the JavaDoc for FileHelper#read and cut&paste the exception list into your method:
String fileReader(String filename) throws IOException, CustomFileReaderEx

Now the author of FileHelper#read decides that he uses a different implementation strategy. Now he makes sure that the actual file read never can fail, by first ensuring that the file exists, can be opened, and is of the right format. So, naturally, the set of exceptions changes. It is no longer possible to get an IOException or a CustomFileReaderEx. Instead you can get a InvalidFilenameEx or CorruptDataEx. So, you cut&paste again:
String fileReader(String filename) throws InvalidFilenameEx, CorruptDataEx

Not only did you have to make that change, but everybody else who calls fileReader (and everybody who calls them and everybody who calls them and ...) as well. That's crazy! The reason why you delegated the call to the fileHelper in the first place was so that you need not concern yourself with those details.
So, the idea of Anchored Exception Declarations is to use this delegation for the Exception Declarations themselves. Instead of saying which precise exceptions you throw, you just blame someone else. "He did it!":
String fileReader(String filename) throws like this.fileHelper.read

And your clients just say:
Foo whatever() throws like fileReader

That way, when FileHelper changes its exceptions, then the only code that needs to change is the very top-level exception handling code, just like I described above for the unchecked case.
There are restrictions, of course. For example, in order to not break encapsulation, you can only use identifiers in your throws like clause which are accessible to all your clients. If, in this case, fileHelper is a private field, you cannot use it. You would need some other way. For example, if the FileHelper class is public (or if it is package private and all your clients live in the same package), you could instead say
String fileReader(String filename) throws like FileHelper.read

There are other restrictions listed in the paper as well. (One of those is lifted in the Modular Anchored Exception Declarations paper.)
Anyway, this is one way to ameliorate some of the problems with Checked Exceptions. However, Checked Exceptions have been around for almost 40 years now, and we still haven't figured them out, so it's obviously a hard problem.

A:
I'm well aware of the whole argument over whether or not checked exceptions are a good idea and I fall on the side that they are...

FWIW, I agree -- by and large, they're a Good Thing(tm). The bad habits of programmers around the use of a feature do not necessarily mean a feature is bad. In most cases, I think programmers don't understand that they can take a pass on the exception and buck it up the chain.

Perhaps it could be optional to catch exceptions and therefore if one is not caught the program would crash?

Java has that feature (RuntimeException and its subclasses are unchecked exceptions).

Or maybe there could be specific notation to denote that an exception is not being handled...

Java has that; the throws clause in the method declaration.

How about the try...catch syntax, do you think there could be a more concise way of expressing that an exception is being caught?

Granted it can feel a bit clunky, but the goal is to factor exceptional conditions out of the mainline logic.
However, I do have a couple of suggestions for try..catch:
catch..from
This is something I've wanted in Java and related languages for a long time (really need to write this up properly and submit a JSR): catch...from.
Here's an example:
FileOutputStream    output;
Socket              socket;
InputStream         input;
byte[]              buffer;
int                 count;

// Not shown: Opening the input and output, allocating the buffer,
// getting the socket's input stream

try
{
    while (/* ... */)
    {
        count = input.read(buffer, 0, buffer.length);
        output.write(buffer, 0, count);

        // ...
    }
}
catch (IOException ioe from input)
{
    // Handle the error reading the socket
}
catch (IOException ioe from output)
{
    // Handle the error writing to the file
}

As you can see, the goal here is to separate the unrelated error handling for socket read errors and file write errors. Very basic idea, but there are a lot of subtleties involved. For instance, exceptions thrown by other objects being used under-the-covers by the socket or file output stream instance need to be handled as though thrown by that instance (not that hard, just need to be sure instance information is in the stack trace).
This is something one can do with existing mechanisms and strict coding guidelines, but it's very difficult.
Multiple catch expressions in a single block
A'la the planned JDK7 enhancements.
Retry
Very, very much harder to provide than the above and also much easier for people to work around, so the value's a lot lower. But: Provide a "retry" semantic:
try
{
    // ...stuff here...

    if (condition)
    {
        foo.doSomething();
    }

    // ...stuff here...
}
catch (SomeException se)
{
    if (foo.takeRemedialAction() == Remedy.SUCCESS)
    {
        retry;
    }

    // ...handle exception normally...
}

Here, doSomething can fail in an exceptional way, but in a way that takeRemedialAction may be able to correct. This continues the theme of keeping the exceptional conditions out of the main line of logic. Naturally, retry takes execution back to the operation that failed, which may be deep in doSomething or some submethod it's called. You see what I mean about challenging.
This one is much easier for teams to do with existing mechanisms: Just make subroutine that's doSomething plus takeRemedialAction on exception, and put that call in the main line logic instead. So, this one's low on the list, but hey...

A: I don't see another way to bound a block of code possible of errors. I think that the try .. catch block is consistent. Ruby, as a improvement, has a keyword that allows to repeat the block of code that was fail, it's a good improvement, i think

A: The exception-handling mechanism of the programming language CLU is fully checked and is designed for rock-solid reliability.  Since almost all modern exception mechanisms are more permissive versions of CLU's original model, it is well worth careful study.  If you have access to a good library the paper by Liskov and Snyder is well worth reading.
Regarding syntax, there is a superb paper by Nick Benton and Andrew Kennedy that explains the weaknesses of standard syntax and proposes a compelling new variation.  It should be required reading for anyone doing design in this area.

A: IMHO, checked exceptions might be a good thing, but a bigger issue is that most exception hierarchies are extremely broken.  The problem is that there's nothing inherent in an exception which indicates whether it indicates a problem beyond "the function call didn't work".  For example, if one calls a LoadDocument method and some type of exception gets thrown, there's no nice way of telling whether the correct thing to do is report that the file couldn't be loaded, but everything else is fine, or whether it would be better to shut down the program in an orderly fashion, or for that matter whether doing anything other than an abrupt quit would risk trashing the file system.  Checked exceptions could be nice if they carried an implication that the state of everything was just fine except to the extent implied by the fact that the method didn't work.  Unfortunately, no system I've seen has a useful hierarchy of exceptions to distinguish that.  Since exceptions are organized by what went wrong, rather than by the implications regarding system state, there's no good way to know what exceptions should be caught and wrapped, and what exceptions should bubble up.
Actually, what might be best in many cases would be a means of having multiple exceptions thrown at once, with a bundle of exceptions propagating up the stack until all have been caught.  I wonder if any system accommodate such a thing?


text:
Q: How do I check (assert) if an Ember Promise is settled? I have an Ember Promise returned as the result of a service method I am testing.  I'm using Ember 2.16 and qunit.
let promise = service.myFunctionBeingTested();
promise.then((resolveParam) => {
    assert.equal(resolveParam, EXPECTED_VAL);
}).catch(() => {
    assert.notOk("Promise rejected");
}

// Code here is supposed to trigger resolution of promise...

// Code here to make sure the promise is resolved and assert is run

What can I use (after the promise should be resolved) to make sure the promise is resolved and assert.equal(resolveParam, EXPECTED_VAL); is run?
It seems like it should be easy to check that the promise is settled, but Ember's documentation on rsvp promises is either too difficult to navigate or absent  I could use assert.expect(/* COUNT */) but then future users will have to update this number every time new assertions are added which I want to avoid.

A: At the beginning of your test, use assert.expect(1) to tell the test you are expecting exactly 1 assert. Then you should be good. If the promise fails, your notOk will be called and the test will fail. If the promise resolves, the test will pass.
If this is not an acceptance test, you may need to:
import wait from 'ember-test-helpers/wait'

then return the wait call from your test to make sure the test waits for your promise before checking if it got the right number of assertions:
 return wait()

UPDATE
The other way you can do this without assert.expect is to declare a variable before like:
let successCalled = false

Then in the success block
promise.then((resolveParam) => {
    successCalled = true
})

Then after, do:
return wait().then(() => {
     assert.ok(successCalled)
})

Although, assert.expect exists for this purpose so I recommend using it.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Why was Kylo unable to use simple Force telekinesis? In the climax of The Force Awakens, Kylo Ren is sees a weapon

 (Luke's old lightsaber)

lying a few feet away in the snow. He reaches out to telekinetically pull it to him, as we've seen Force users do plenty of times in the past. This time, the weapon merely wriggles a bit, before

 flying off towards Rey instead.

Kylo has shown to be rather proficient in using the Force up to that point. Why would he suddenly be unable to do something so simple?

 Do lightsabers retain some kind of loyalty, or is there any indication that its history with Luke would have messed with Kylo?

A: The novelization indicates that it was an issue of greater ability with the Force. Ren was able to, and the lightsaber would have gone to him, had Rey not had a stronger Force Pull.
From the novelization:

Switching off his own weapon, Ren extended an arm toward the device lying in the snow. It twitched and then began to vibrate as the Force called to it. Stretching out his hand farther, straining, Ren beckoned powerfully— and the lightsaber rose, to come bulleting toward his outstretched fingers.
And past them.
Taken aback, he whirled— to see the weapon land in the hand of a girl standing by a tree. Rey appeared equally shocked that her reach for the device had exceeded his. She gazed down at the weapon now resting in her grip.

A: Under normal circumstances, he would have been able to use the Force to telekenetically take the lightsaber. The problem was that someone else was also trying to do the exact same thing he was. He was fighting for control over the saber with another Force user, and he lost.
As you mention in your last sentence, there's a hint running throughout the movie that the lightsaber "belongs" to someone specific:

 Namely, it calls out to Rey from it's chest in the cantina.

However, I don't think we've seen any indication before this that these weapons have any particular "knowledge" or "loyalty" to their owners; we've seen Force users steal them from each other and use them, and even the one in question has had multiple owners.
More that likely, it's just an indication that Kylo's control over the Force isn't as good as he thinks. The lightsaber's tentative movement is very reminiscent of how one behaves in Empire Strikes Back when Luke is trying to pull his from the snow.
Throughout the movie, Kylo shows hints that he's not very polished in his use of the Force: even his lightsaber is very rough. We also see him lose his temper a lot.
By contrast,

 Rey

is starting to accept who they are, and genuinely believes they deserve to have the lightsaber. Even if the object itself has no loyalty to an owner, the intentions of the people involved have a real effect on their use of the Force.
This was simply a case of Kylo having a battle of wills over the lightsaber with someone who was "more deserving" of it, and losing.

A: I watched the movie and my explanation was/is:
Kylo was taken by surprise. When the weapon was short before his hand, he thought that he didn't have to "pull" any more, to get it and kind of stopped. He didn't notice Rey. She still "pulled".
I came to this explanation because I assumed that Kylo would have won if he noticed her. The force is strong in Rey. But she wasn't experienced in moving things by using the force at all.


text:
Q: Binary data over serial terminal My only way of communication with my embedded device is a serial port. By default, embedded Linux uses this port as a terminal. How do I disable this terminal and use the serial link to transfer binary data? I heard of commands like rx and tx but i cannot find them.
I think I can just read() from and write() stuff to /dev/tty but I want to make sure no error messages or whatever mess with my data stream.

A: Can't you just set the terminal to raw?
Have a look at this tutorial.

A: To disable the Linux console you have to change the Linux command line create by the bootloader from :
console=/dev/ttyS?
to :
console=null

A: You can use an application like xmodem to transfer file over any terminal. Is the serial port you speak off a terminal, or is it also the kernel console.
If you're kernel is not noisy, then you can use your current connection to make xmodem like transfer. On the host side, you can use kermit, which is nice AND scriptable.
If you want to make your serial port raw, and you have file descriptor ttyfd opened,
here is one way to do it :
struct termios tty, orig_tty;

...

if(tcgetattr(ttyfd, &tty) < 0)
{
    // error checking
}
// backup tty, make it raw and apply changes
orig_tty = tty;
cfmakeraw(&tty);
if(tcsetattr(ttyfd, TCSAFLUSH, &tty) < 0)
{
    // error checking
}

...
//end of program or error path :
tcsetattr(ttyfd, TCSAFLUSH, &orig_tty)

Don't forget to restore the setting at the end of your program if you still want a good behaved terminal.

A: You can run on the terminal a command that will transfer the data through an application-level protocol.  The rx and tx commands you refer to implement the XMODEM file transfer protocol.  It could be a solution, if the binary data you want to transfer consists of files, the throughput demands are low, and you don't mind the administrative overhead of running the commands.  Alternatively,  you may want to multiplex the serial port for handling both data transfer and the terminal.  Disable the serial terminal driver command (getty), and run the PPP protocoll over the serial line to establish an IP connection to your device.  You can then login to the device through ssh or telnet and transfer your data through an IP socket.

A: As the other notes have implied, there are several things to check, collected here:

*

*Make sure the linux kernel isn't using the serial port.  Make sure there is either no console= option on the bootload command in your grub file.  It usually isn't there by default.

*Make sure there is no getty running on the serial port.  Look in /etc/inittab for an entry for /dev/ttyS0 (serial port A) and comment it out if it is there.

*Make sure the /dev/ttyS0 is readable and writable by your process.  You might create a specific user under which the control program is run, and which owns the /dev/ttyS0, then chmod 700 /dev/ttyS0.  This will help make sure some other user/program doesn't also try using the serial port.

*Use open() on ttyS0 to get an fd, then use the tcsetattr family of routines to set the line speed and discipline.

Terminal programs probably won't be useful to you unless you can run the same program on the embedded device to manage the other end of the connection.

A: Yes, all of your serial ports are in /dev/ttyxx.  Note that /dev/tty is a shortcut that stands for your current terminal, not a specific serial port.  Often, these are owned by root, and require you to either have privileges or be in the adm group to access the device directly from your application.
You may want to chown the device so you can access it.  I'm not sure what the consequence of changing device ownership are; IIRC, it's easy to do and works nicely.  The alternative is to use setuid to elevate your program to a privileged state.
There's a program named getty that lets users login from a serial port.  Your inittab will start getty on serial ports so people can login.
You want to disable getty.  In some cases, there's a port manager that helps do this.
In some cases, you can change your inittab to use mgetty, which is a smarter and easier to control version of getty.


text:
Q: UITableViewCell content shifting after selection I have a tableview where each cell has an image to the left of a label and detail label like so:

It renders just like that as it is supposed to when the tableview first loads, but if I click the cell to navigate to a different view then return to the table view the image shifts to cover part of the label like this:

The change happens about a second after the tableview appears and it only happens to the cell that was previously selected. Does anyone have any idea what is causing this?

A: I faced same issue. I was set my custom UIImageView's name as imageView and Now I changed it's name as mImageView and fixed.
Maybe you should rename your imageView @IBOutlet name.

Incorrect using - Not working properly

@IBOutlet var imageView: UIImageView!

Correct Using

@IBOutlet var mImageView: UIImageView!

Very strange issue

A: This may not be the best answer, but it's what worked for me. Eventually I just deleted all of the subviews in the cell and readding them. It now works fine without having to mess with constraints. I'm not sure what the cause of the problem was.


text:
Q: loop condition return value in pl/sql I am creating a procedure in pl.sql and I want the return is true and false with the condition if the colums end_date is less then today and return false if then today then return true on each record. This is my procedure code
    create or replace procedure GET_REGIS_LIMIT(V_CURSOR out SYS_REFCURSOR) is
PR_END_DATE DATE;
begin
  BEGIN
  FOR myDATE in(SELECT END_DATE INTO PR_END_DATE FROM REGISTER_LIMIT T WHERE T.STATUS='U')
  LOOP
    PR_END_DATE:=myDATE.END_DATE;
    OPEN V_CURSOR FOR
    SELECT T.*, (SELECT CASE WHEN PR_END_DATE > SYSDATE THEN 'TRUE' ELSE 'FALSE' END  FROM DUAL END) RESULTS
    FROM REGISTER_LIMIT T WHERE T.STATUS='U';
  END LOOP;
EXCEPTION
   WHEN NO_DATA_FOUND THEN  -- catches all 'no data found' errors
      OPEN V_CURSOR FOR
    SELECT 'EMPTY' RESULTS FROM DUAL  ;
     end;

end GET_REGIS_LIMIT;

The column i mark should return true but all of them are return false or it depends on the last row

A: You don't need a loop. Just open a ref cursor which returns the result set you need.
create or replace procedure get_regis_limit(v_cursor out sys_refcursor) is
begin
  open v_cursor for
    select t.*
           , case when end_date > sysdate then 'TRUE' else 'FALSE' end  as results
    from register_limit t
    where t.status='u';
end get_regis_limit;```


text:
Q: When do we use "be careful about"? Most of the time we use be careful 'with'/ 'of'. but i realized there are times people use be careful about. What is the grammar rule behind this?

A: The reality here is that this is more about style than any hard rule. I would argue that 'about' as a preposition after 'be careful', whilst not incorrect, is certainly unusual. Most definitely it should be used when the subjective noun implies a place.
I would also contend that "about" implies a more general or ordinary subject. Whereas 'of' and 'with' are more specific.

General usage: "Be careful about town, there are thieves on every corner."
Specific usage: "Be careful of thieves, they are everywhere in town."
Specific usage: "Be careful with your money, thieves are everywhere in town."

https://www.englishforums.com/English/WhenPrepositionsAboutOn/lvqxw/post.htm


text:
Q: Netty file upload support via HTTP PUT method I am able to upload files via HTTP POST method using sample HttpUploadServerHandler provided in Netty repository, but I would like to upload files via HTTP PUT instead. Is there a way to do this with Netty? There is a HttpPostRequestDecoder, but nothing equivalent for PUT as far as I can tell.

A: The HttpPostRequestDecoder handles POST,PUT and PATCH.
See [1].
[1] https://github.com/netty/netty/blob/master/codec-http/src/main/java/io/netty/handler/codec/http/HttpPostRequestDecoder.java#L166


text:
Q: Reverse plugging in answers to questions How do I solve such questions without reverse plugging in the answers into the question itself?
First, I will exclude all answers which are not multiple of fives, based on the statement "five times the age..."
Second, I will take the oldest child age + 2 and check if it is twice of the middle child age.
How do I represent these word problems in algebraic equations?
Mary has three children. The oldest child is five times the age of her youngest, and in two years will be twice as old as the middle child.
Which of the following ages could the oldest child be?

*

*10

*12

*15

*18

A: Your multiples of $5$ are $10$ and $15$. In two years you get $12$ and $17$.
Well, $12$ is twice $6$ which is the middle child age but $17$ is an odd number and it is not twice anybody's age.
Thus the answer is $10$.


text:
Q: Extract values from raster I am trying to extract data from a raster from a layer of random points.
The input data are the raster where I have to extract the values and a shapefile of polygons. With this shapefile, I get a random sampling of points that are inside the polygons. This is done with the SF package and I get a layer sfc_POINTS.
Then, I try to extract the values of my raster with these points using the raster package.
I get this error:
Error in (function (classes, fdef, mtable)  :
unable to find an inherited method for function 'extract' for signature '"RasterLayer", "sfc_POINT"'
Here is the code:
# Clean environment
rm(list = ls())

#Import packages
library(sf)
library(raster)

#Import data
shp = st_read("PATH_TO_MY_SHP")
rst = raster("PATH_TO_MY_RASTER")

#Random sampling
Rdmsamp = st_sample(shp,  1000, "random")
Rdmsamp_values = raster::extract(rst, shp)

If someone can help me please.
PS: Is it possible to integrate also a distance condition in the sample points setup (e.g. a distance to the edges of the polygons or a minimum distance between the points ?)
Thanks

A: First with terra (the replacement for raster):
library(terra)
fv <- system.file("ex/lux.shp", package="terra")
v <- vect(fv)
fr <- system.file("ex/elev.tif", package="terra")
r <- rast(fr)

pts <- spatSample(v, 100, "random")
e <- extract(r, pts)

Now with sampling in sf
library(sf)
shp <- st_as_sf(v)
rsamp = st_sample(shp, 100, "random")
rsp <- vect(rsamp)
vals <- extract(r, rsp)

Or use that sample with raster
library(raster)
rr <- raster(fr)
sfsamp <- st_as_sf(rsamp)
vv <- extract(rr, sfsamp)

A: I am here to answer my own question with the elements that I was given in the previous answer.
The code used in the previous answer works well. A problem persisted on the extraction of the values for which I obtained only NaN values. This problem simply came from the CRS used for each layer, so you have to think about reprojecting your different layers to the same CRS.
Hopefully this clarification will help some people in the future.


text:
Q: postgresql libpq inserting empty row for no reason I'm using the libpq library in C for accessing my Postgresql database. The application inserts a piece of data fed from a queue. When there is a lot of data and it's inserting very quickly it randomly inserts and empty row into the table. Before I even perform the insert I check to make sure that the length of the text being inserted is greater then one. Is there a reason why this is randomly happening? It dosen't happen when there is less data.
*I'd like to note, that this does not happen on Mysql, only Postgresql

A: See Milen A. Radev's comment. It should have been an answer. You should not allow empty rows.
Surely at least one column can have a constraint that would cause the insert to fail. Then your app can print/log the error with enough diagnostics for you to figure out what's going on, and under what conditions.
Without retrofitting the above, determine if all data from your queue was inserted properly, or if some rows are missing. I.e., see if some rows are being translated into empty inserts. If you see that some data is causing this you can find what the problem data has in common.
Are you using prepared, parameterized inserts, or are you building a SQL insert statement string each time and executing that? If you're building SQL strings to execute then you must make sure you are quoting character/binary string columns properly with the routines provided by libpq. Or switch to the other method of preparing the insert and passing the data as parameters where it can be properly quoted by libpq itself. This may also improve performance.


text:
Q: What is the easiest way to complete "Kill x number of enemies" missions in Helldivers? The missions I'm specifically talking about are the ones that spawn you in a tiny circular map where the sole objective is to defeat X number of enemies, not the standard missions where that can sometimes be a secondary objective.
These missions are always the hardest for me as I seem to run out of ammo in my Exosuit by the time I need to call in the evac shuttle and the maps are so small that my turrets are always in a position where they hit me.
FYI I'm level 11 and play with one other person just so have you have a general idea as to what I've unlocked thus far and my options as far as co-op mechanics.

A: If you mean the arena missions, where you just need to kill a certain number of enemies, they are actually very easy if you got the right set of stratagems. I assume higher difficulties in my answer; easy to medium difficulties might allow some other strategies that won't work on Helldive and above (12+).
EXO spam
Each of you takes 4 EXOs. The EXOs you take need to be fully upgraded, or you will run out of ammo quickly.

*

*EXO-44 "Walker" (the one with a minigun and 8 rockets) is rather viable against Bugs and Illuminates (granted that you can reliably hit the centre of enemy units), but its anti-tank potential is rather limited, so it doesn't work that well against Cyborgs. You also need to unlock it, which is not always possible. There is not a lot of ammo in its minigun, so make your shots count.

*EXO-48 "Obsidian" (the one with two 20-mm cannons) is just awesome against Illuminates -- you have a lot of ammo, there are no enemies with permanent tank armour that you cannot breach, its damage and rate of fire are very high, etc. You cut through Illuminates like a knife through butter. Any difficulty is very easy with 8 fully graded EXO-48s. However, when it comes to Bugs, you are in trouble once you encounter Behemoths. You are in lesser trouble when you see Impalers and Tanks, but it is still a trouble.  And when it comes to Cyborgs, you are in a huge trouble, since there are really a lot of units that just flat ignore anything but anti-tank weapons. Overall, you need some additional anti-tank support when you go against Bugs, and a lot of anti-tank "support" when it comes to Cyborgs.

*EXO-51 "Lumberer" (the one with an anti-tank gun and flamethrower) has some problems. You cannot refill ammo, and it is very limited, much more than it's with other EXOs, so you will run out of ammo rather quickly if you don't conserve it. Most of the time, you cannot afford to waste main cannon ammo on non-heavy units. The other problem is that you will damage yourself if a heavy unit comes too close -- and all EXOs are very, very slow, so you will need your friend to shoot the enemy from another direction. However, this EXO performs rather well against Cyborgs, the race that basically spams heavy units, especially on high difficulties.

If going for EXO spam, it might be a good idea to take one REP-80, a repair tool, but if you are careful enough, you won't need it, as you will run out of ammo before your EXO is significantly damaged.
Tank spam
TD-110 "Bastion", if fully upgraded, has a pretty large magazine, and, what is more important, is issued with a machine gun. It is very fun to use if you can coordinate well. The main benefit is that most units cannot even harm you at all.
Some tips on using it:

*

*Use machine gun (alt-fire/aim button, right mouse button on PC by default) to kill light- and medium-armoured units. Always aim for the centre.

*Turning is quicker if you do it around one point, without going forwards or backwards.

*Before firing the main gun, "prefire" with a short MG burst to see where the bullets go. The gun shell will hit exactly there. This helps you to avoid missing the target and hence wasting ammo, and, what is even more dangerous, harming yourself by firing at someone too close to you.

*Again, be very careful, don't fire it when you are too close to an enemy!

*When possible, don't waste MG ammo (not to mention the main gun shells!) on units that you can just run over. As a bonus, it is more fun than using your MG!

*Communicate about what are you doing, though. From my experience, it is better when the one at the driving position is in charge and tells when to fire.

*Always move! Even though your tank is almost indestructible, almost doesn't mean completely. Some enemies can still kill you very quickly. Especially beware the Illuminate Obelisks that can summon walls. If this wall hits you, you are one-shot-killed.

*If someone needs to leave the tank for a moment, it is better for the gunner to do it.

*Don't go backwards as the driver when the gunner is going to leave the tank, and don't leave it as a gunner before telling that you gonna do it. Don't exit the tank as a driver after going forwards before it is fully stopped. If you do any of those two things, you are likely to be smashed by it.

*It is a very good idea to bring a REP-80 repair tool with you, as tanks tend to get damaged before they use all the ammo. If you don't have it, don't hesitate to leave a tank that has lost half its health.

*A Displacement Field perk pairs very well with a tank, allowing you to exit it at the last moment when it starts to burn.

Things to consider:

*

*Just as with Obsidian and Lumberer EXOs, it is a DLC thingie, so if you don't have DLCs, bad for you. On the other hand, there is no need to unlock it, and for 6 upgrade points, you can get a very potent killer machine.

*If your tank is destroyed while both of you are inside, the mission is lost. If you are one by one, you might have time to dial a Reinforce Statagem.

*You cannot summon stratagems from a tank, but you can when on foot and from an EXO.

Mine spam
Air-dropped anti-personnel mines can damage tanks when upgraded to Antitank mines (3d level), and you have 10 uses of them. Any unit stepping on them, including Bug Tanks and Cyborg IFVs, is instantly killed, if not by the first mine, then by another one, you can actually easily make a field of them. The best perk to take is Stratagem Priority, lowering already not so big KD of 45 sec to 27 sec. Just find a tight corner and surround everything with mines! Be careful, though:

*

*Don't roam around with the stratagem dialled in your hands. If you are knocked out, you will summon mines on yourself, possibly killing you and your friend(s). Only dial them where it's safe to drop them.

*Watch where you drop your Reinforce stratagem. Don't drop your friend(s) on a minefield.

*It is not a bad idea to have a "plan B" for enemies that somehow pass around the mines.

*This strategy pairs perfectly with LIFT-850  Jump Pack -- you cover the map with mines, you jump around, enemies go bang-bang on the mines. However, you might need Resupply stratagem in this case, as your jetpack will run out of fuel. You will need to jump a lot more on such missions.

*To save up some mines, you might want to shoot weak enemies passing on them. This way you will save the mines for heavy enemies.

AT-47 Anti-Tank Emplacement
The Anti-Tank Emplacement is the same 90-mm anti-tank gun, but stationary, and:

*

*Is very resilient.

*Has a lot of ammo.

*Only needs one person to fire it.

As of the "Dive Harder" update, they can harm themselves, though.
The best perk to use with AT-47 is Stratagem Priority. It is really a good idea to bring a REP-80 rep kit: otherwise, the turret gets destroyed before you have a chance to expend all of the ammo.
You should place your turrets so that they are relatively close to one another, but not close enough to damage one another by shooting enemies at point-blank range. Each player should have their own sector to cover.
This pairs very well with Static Field Conductors, which slow enemies down. It is better to make corridors for enemies to cross, so that you don't have that much space to cover.
Tesla spam
A/AC-6 Tesla Tower, when upgraded, fires 3 bolts per attack, being very effective at clearing out hordes of enemies. As far as I know, it is not anti-tank, though, so it is only viable against Illuminates and on very low difficulties, which I don't focus on in this guide. Be careful when placing them:

*

*Use Stratagem Priority to summon them more often.

*Leave no space between turret ranges.

*However, don't let the turrets be in the range of one another -- they cannot distinguish friends from foes. This is about you too: don't ever get in their range, at least not when stood up.

*Choose tight corners, so you can cover everything around you with them.

*REP-80 is very helpful, as enemies actually damage them.

*If you fight someone who also has tank units, it is definitely not a bad idea to bring anti-tank weapons. Or choose another strategy to use.

*Don't summon your fallen friends in the Tesla range, just to fall again...

The biggest problem is that it is a DLC item, you need to buy it. No need to unlock, though.
Minigun turret spam against Illuminates
Because why not? They can penetrate anything against that race. Their RoF and DPS are very high. You can heal the turret with REP80, go prone, and just watch the mayhem.
Since you get the turrets from the start, no need to unlock or buy them.
You can also set the turret up far away, so even if it hits you a bit while aiming at some enemy, it is really just a bit.
Normal setup against a given race
Those were all "cheap" solutions, your primary weapon wasn't listed most of the time because of no need in it. But you can also learn to play this game well enough, take normal equips against your enemy race, and just play it normally. For example, use Recoilless Rifle against Cyborgs, take Resupply stratagem, run around, kill enemies etc. This is harder, but might be more fun.
Good luck!

A: You can bring multiple exosuit if you want.
But I think if you can t pass this type of objectives, you may either be too dependent of the exosuit, not playing on the right difficulty, or not having enought player in your squad.
As I don t have the time to start the game and see what was unlocked lvl11, I can't expand my answer much more, but I think you are trying to go on mission too difficult for two lvl11, and so are dependent of the exosuit for completing them.
As for strategy, for this type of objective, I usually wait to have completed every other objective, call the evac, put turret at the evac point, then go and trip every alarm I can to bring a maximum of enem to crash on my turret and my shotgun.
Depending of completion, the automatic alarm at the evac point may be sufficient so I don t have to bother searching for the enemy.
EDIT:
For the missions where it is the only objectives, going in at 4 player is almost a requirement, with one equipped with the heal canon (don t remember the exact name, green laser) at max level to be able to heal the three exoarmor at the same time.
The three others go in with only exoarmor equipped, switching when neccesary, the healer call any turret, ammunition drop, or airborne raid neccessary.
Some such level have buggy area where you can camp to evade a large part of the enemy, or catch a breath, but you should not rely on them too much.


text:
Q: Group by columns and summarize a column into a list I have a dataframe like this:
sample_df<-data.frame(
   client=c('John', 'John','Mary','Mary'),
   date=c('2016-07-13','2016-07-13','2016-07-13','2016-07-13'),
   cluster=c('A','B','A','A'))

#sample data frame
   client date         cluster
1  John   2016-07-13    A
2  John   2016-07-13    B
3  Mary   2016-07-13    A
4  Mary   2016-07-13    A

I would like to transform it into different format, which will be like:
#ideal data frame
   client date         cluster
1  John   2016-07-13    c('A,'B')
2  Mary   2016-07-13    A

For the 'cluster' column, it will be a list if some client is belong to different cluster on the same date.
I thought I can do it with dplyr package with commend as below
library(dplyr)
ideal_df<-sample %>%
    group_by(client, date) %>%
    summarize( #some anonymous function)

However, I don't know how to write the anonymous function in this situation. Is there a way to transform the data into the ideal format?

A: We can use toString to concat the unique elements in 'cluster' together after grouping by 'client'
r1 <- sample_df %>%
         group_by(client, date) %>%
         summarise(cluster = toString(unique(cluster)))

Or another option would be to create a list column
r2 <- sample_df %>%
         group_by(client, date) %>%
         summarise(cluster = list(unique(cluster)))

which we can unnest
library(tidyr)
r2 %>%
    ungroup %>%
     unnest()


text:
Q: Derivation with respect to cumulative distribution function I am trying to understand the how Baye, Kovenock and Vries 2008 calculate the
derivative of E(w).
F is a symmetric mixed-strategy equilibria with density f(x) on some subset (m,u) of the support of F (so that there are no mass points in this interval).
I am purely interested in the step by step derivation from $E(w)$ to $\frac{dE(w)}{d(w)}$, which I can not understand.
$w \exists(m,u)$
$W(x_i,x_j)=v-\beta x_i - \delta x_j$
$L(x_i,x_j)=-\gamma-\alpha x_i - \theta x_j $
$E(w)=\int_{0}^{w}W(w,x)dF(x) + \int_{w}^{\infty}L(w,x)dF(x)$
$\frac{dE(w)}{dw}=[v+\gamma + (\alpha+\theta-\beta-\delta)w]f(w)-\alpha+(\alpha-\beta)F(w)=0$

A: $\int_{0}^{w}W\left(w,x\right)dF\left(x\right)=\left(v-\beta w\right)\int_{0}^{w}dF\left(x\right)-\delta\int_{0}^{w}xdF\left(x\right)=\left(v-\beta w\right)F\left(w\right)-\delta\int_{0}^{w}xdF\left(x\right)$
Taking the derivative w.r.t. $w$ gives:
$-\beta F\left(w\right)+\left(v-\beta w\right)f\left(w\right)-\delta wf\left(w\right)=-\beta F\left(w\right)+\left(v-\beta w-\delta w\right)f\left(w\right)$
$\int_{w}^{\infty}L\left(w,x\right)dF\left(x\right)=\left(-\gamma-\alpha w\right)\int_{w}^{\infty}dF\left(x\right)-\theta\int_{w}^{\infty}xdF\left(x\right)=\left(-\gamma-\alpha w\right)\left(1-F\left(w\right)\right)-\theta\int_{w}^{\infty}xdF\left(x\right)$
Taking the derivative w.r.t. $w$ gives:
$\left(-\alpha\right)\left(1-F\left(w\right)\right)+\left(\gamma+\alpha w\right)f\left(w\right)+\theta wf\left(w\right)=\alpha F\left(w\right)-\alpha+\left(\gamma+\alpha w+\theta w\right)f\left(w\right)$
Then addition gives the formula you mention.


text:
Q: Где взять все коды клавиш относительно символов раскладки разных стран мира? Мне важно знать к какой клавише, а именно с каким символом на ней тот или иной код относится.
Например: код:81 это английская Q, русская Й, сербская Љ.
Если я правильно понял как это работает.
У меня это не будет привязано к раскладке системы, я хочу знать заранее, например создав кучку словарей или типо того, умнее не придумал.
Все таблицы что я видел включают только английский, есть ли какая-нибудь общая база или сводная таблица я не знаю.
Не охота самому подбирать каждый символ на каждом языке.


text:
Q: How to merge multiple output from single table using talend? I have Employee table in database which is having gender column. so I want to Filter Employee data based on number of gender with three column to excel like:

I'm getting this output using below talend schemaStructure 1:

So I want to optimized above structure and trying in this way but I have been stuck with other scenario. Here I'm getting Employee data with gender wise but in three different file so Is there any way so that I can achieve same excel result from one SQL input file and after mapping can be get in a single output excel file?
Structure 2 :

NOTE: I don't want to use same input table many time. I want to get same output using single table and single output excel file. so please suggest me any component which one is useful for me.
Thanks in advance!!!


text:
Q: Standard terminology for the relation between $A$ and $B$ if $B= Q^t A P$? Let $A,B$ be two rectangular $m\times n$ matrices related by
$$B= Q^t A P$$
with $P$ an $n\times n$ and $Q$ an $m\times m $ matrix.
Is there a standard terminolgy for this relation? If instead of the transposed $Q^t$ one takes the inverse $Q^{-1}$ above, they are just called "equivalent" according to
http://en.wikipedia.org/wiki/Matrix_equivalence
I know that when $m=n$ (Edit 1: and P=Q) one uses "congruent" (transposed case)  and "similar" (inverse case).
Edit 2: $P$ and $Q$ are assumed both to be invertible (sorry for forgetting to write it). As Marc van Leeuwen pointed out, there is no point in distinguishing among the cases $Q$, $Q^t$ and $Q^{-1}$ since $Q$ is arbitrary ( and invertible). It only makes sense when interpreting $Q$ as coordinate change matrix and $A$ as a linear operator (   -> $Q^{-1}$) or bilinear form   (-> $Q^t$) (see explanations of Paul Garrett).
Thanks to everybody who contributed to clarify my confused question.

A: If both $P$ and $Q$ are invertible, then this is just that $A$ and $B$ have the same rank. That notion of "equivalence" is dubious, as are several archaic bits of terminology about matrices, dating back to times when coordinate-independent understanding of linear algebra did not exist.
There are reasons for considering relations $B=Q^\top A Q$ and $B=Q^{-1} A Q$. The case with inverse is change-of-coordinates/basis for a linear map $A$, where the $Q$ is the change-of-coordinates/basis map. The case with transpose is change-of-coordinates/basis for a _quadratic_form_ $A$, with $Q$ again the change-of-coordinates/basis map.
The cases $B=Q^\top AP$ and $B=Q^{-1} A P$ are change of coordinates of, respectively, a bilinear map $A:V\times W\rightarrow \hbox{scalars}$, and a linear map $T:V\rightarrow W$ given by $A$, where in both cases one changes coordinates in possibly-unrelated fashions on both vectorspaces.
Edit: that is, (letting the other shoe drop), these are change-of-coordinates/basis expressions for four specific things: linear maps of a space to itself, quadratic forms on a space, bilinear maps on two spaces, and maps from one space to another. That is, doing such things to matrices is not mere conformity to some inexplicable set of rules, but, in fact, is doing an obvious thing. Understanding which is appropriate is much aided by understanding what the point is.


text:
Q: ajax error in calling a method in asp.net via post and having a lengthy argument size Good morning, the problem is that I am calling a web method ( ASP.NET VB.NET ) via ajax ( jquery ) and jquery makes the call to the web method returns an internal server error , the parameter that receives a html that will be processed on the server, when I send some little string like " Hello World" works great , but if I send the html does not work , this is the jquery code:
 $.ajax({
                type: "POST",
                url: "url.aspx/webmethod",
                dataType: "json",
                data: '{param1: "' + @param1 + '"}',
                contentType: "application/json; charset=utf-8",
                beforeSend: function () {

                },
                success: function (response, status, xhr) {

                    alert("Success")
                },
                error: function (error, status, ethrow) {
                    alert("Error")
                },
                complete: function () {

                }

            })

length of html data: 75825
VB.NET CODE:
<WebMethod()> _
    Public Shared Function webmethod(ByVal param As String) As String

    return param
    End Function

When I pass the html never comes to vb.net


text:
Q: How to color text in Skype? I have stumbled upon a weird feature in Skype - colored text:

How do I achieve this? Are there available any special tags?

A: Found out on my own. You can use the standard HTML tag 'FONT' with the 'color' attribute, like this:
any text

And to post it you have to hold Ctrl + Shift and click with the mouse the Send button. I've checked and there are available additional 'FONT' attribute 'size' and 4 more tags: 'U' [underline], 'I' [italic], 'B' [bold] and 'BLINK' [obvious]. The image on the screenshot above is made programmatically, on img4skype.com. Source.
UPD: Doesn't work since 5.8.0.154. Though, if you send the code from an older version, it will render properly in the new ones as well.

A: An app called skype colors.exe, which you can find on the web, might seem shady but should work. You open it then type in Skype chat and choose the color you want on the bottom of the message bar.


text:
Q: Fix issue on Perl script I have a script to read the log file and search all 41 step if it shows status "--BuildSuccessful--",  the log file will move from folder current to successful. It worked but recently, sometimes it was not working correctly. I don't understand what are going on, the log file still on folder current. Please take your time to help me improve my code.
Here log file template:
Build Number::  21.9004.5200.0  BUILT TYPE::     Nightly build
===========================================================
Progress                Time                Build Step
BuildStarted CosmoRR        Tue Apr 11 20:05:38 2017        0
CheckChanges            Tue Apr 11 20:05:38 2017            0
PreBuildToolsSLN        Tue Apr 11 20:14:07 2017        0
ReportDevEnvErrs        Tue Apr 11 20:14:12 2017        0
CheckDevenvErrs     Tue Apr 11 20:14:12 2017        0
ReplaceUCBVersionNumber Tue Apr 11 20:14:27 2017    1
BuildVPresent           Tue Apr 11 20:14:27 2017            2
BuildFlashAndFlex       Tue Apr 11 20:14:35 2017        3
BuildFlexTop            Tue Apr 11 20:15:00 2017            4
ObfuscatePHP            Tue Apr 11 20:15:07 2017            5
ReplaceSTVersionNumber      Tue Apr 11 20:15:11 2017        6
RunGetEnums         Tue Apr 11 20:15:11 2017            7
ReplaceClientVersionNum Tue Apr 11 20:15:11 2017    8
BuildAllSLN         Tue Apr 11 20:15:11 2017            9
ReportDevEnvErrs        Tue Apr 11 20:35:32 2017        9
CheckDevenvErrs     Tue Apr 11 20:35:32 2017        9
ReportDevEnvErrs        Tue Apr 11 20:35:32 2017        9
CheckDevenvErrs     Tue Apr 11 20:35:32 2017        9
ReportDevEnvErrs        Tue Apr 11 20:35:32 2017        9
CheckDevenvErrs     Tue Apr 11 20:35:32 2017        9
ReportDevEnvErrs        Tue Apr 11 20:35:32 2017        9
CheckDevenvErrs     Tue Apr 11 20:35:32 2017        9
BuildSolution           Tue Apr 11 20:35:32 2017            10
ReportDevEnvErrs        Tue Apr 11 20:43:20 2017        10
CheckDevenvErrs     Tue Apr 11 20:43:20 2017        10
BuildPresenterInstaller Tue Apr 11 20:43:20 2017    11
BuildMsiInstaller       Tue Apr 11 20:43:20 2017        11
CheckSignCodeErrors     Tue Apr 11 20:43:23 2017        11
BuildAcceleratorInstaller   Tue Apr 11 20:43:23 2017    11
BuildMsiInstaller       Tue Apr 11 20:43:23 2017        11
CheckSignCodeErrors     Tue Apr 11 20:43:24 2017        11
CheckSignCodeErrors     Tue Apr 11 20:44:24 2017        11
CheckSignCodeErrors     Tue Apr 11 20:44:24 2017        11
GetPhoneInstaller       Tue Apr 11 20:44:24 2017        12
GetManhattanClientExo       Tue Apr 11 20:44:28 2017        13
GetManhattanClientEndo      Tue Apr 11 20:44:29 2017        14
GetManhattanClient      Tue Apr 11 20:44:29 2017        15
GetShoreTelPlayer       Tue Apr 11 20:44:34 2017        16
GetConnectforMSFT       Tue Apr 11 20:44:35 2017        17
GetCCClient         Tue Apr 11 20:44:37 2017            18
SpawnLinuxBuild     Tue Apr 11 20:44:38 2017        19
BuildSwitches           Tue Apr 11 20:44:39 2017            20
BuildFilesys            Tue Apr 11 21:07:07 2017            20
ReportDevEnvErrs        Tue Apr 11 21:07:13 2017        20
CheckDevenvErrs     Tue Apr 11 21:07:13 2017        20
BuildCASTestingTools        Tue Apr 11 21:07:17 2017        21
ReportDevEnvErrs        Tue Apr 11 21:07:33 2017        21
CheckDevenvErrs     Tue Apr 11 21:07:33 2017        21
BuildPHR            Tue Apr 11 21:07:33 2017            22
BuildRuby           Tue Apr 11 21:07:36 2017            23
BuildRubyDirector2      Tue Apr 11 21:07:52 2017        24
CreateTAPISDK           Tue Apr 11 21:13:30 2017            25
SignTDIMedia            Tue Apr 11 21:13:31 2017            26
BuildAPPFolder          Tue Apr 11 21:13:32 2017            27
BuildRubywin            Tue Apr 11 21:13:40 2017            28
BuildRubymingw          Tue Apr 11 21:18:06 2017            29
BuildNginx          Tue Apr 11 21:22:05 2017            30
BuildNginx          Tue Apr 11 21:22:06 2017            31
GetSalesforcePlugin     Tue Apr 11 21:22:19 2017        32
RunPrep4Install     Tue Apr 11 21:22:23 2017        33
RunPrep4Install_iteration_1 Tue Apr 11 21:27:23 2017    33
RunPrep4Install_iteration_2 Tue Apr 11 21:32:23 2017    33
RunPrep4Install_iteration_3 Tue Apr 11 21:37:23 2017    33
RunPrep4Install_iteration_4 Tue Apr 11 21:42:23 2017    33
RunPrep4Install_iteration_5 Tue Apr 11 21:47:23 2017    33
CheckSignCodeErrors     Tue Apr 11 21:47:48 2017        33
Client_3rdParty_DiagMonitoring_Installer    Tue Apr 11 21:47:48 2017    34
Build3rdPartyInstaller      Tue Apr 11 21:47:48 2017        34
BuildMsiInstaller       Tue Apr 11 21:47:48 2017        34
BuildDiagMonitoringInstaller    Tue Apr 11 21:47:50 2017    34
BuildMsiInstaller       Tue Apr 11 21:47:50 2017        34
BuildDMuiInstaller      Tue Apr 11 21:47:51 2017        34
BuildMsiInstaller       Tue Apr 11 21:47:51 2017        34
CheckSignCodeErrors     Tue Apr 11 21:49:54 2017        34
CheckSignCodeErrors     Tue Apr 11 21:49:54 2017        34
BuildRemoteServer       Tue Apr 11 21:49:54 2017        35
BuildMsiInstaller       Tue Apr 11 21:49:54 2017        35
CheckSignCodeErrors     Tue Apr 11 22:01:25 2017        35
BuildRemoteServerDC     Tue Apr 11 22:01:25 2017        36
BuildMsiInstaller       Tue Apr 11 22:01:25 2017        36
CheckSignCodeErrors     Tue Apr 11 22:08:12 2017        36
Server_LinuxDVX_Switch_Platform_DC_Installer    Tue Apr 11 22:08:12 2017    37
BuildDataCenterServerInstaller  Tue Apr 11 22:08:12 2017    37
BuildMsiInstaller       Tue Apr 11 22:08:12 2017        37
BuildLinuxDVSInstaller      Tue Apr 11 22:08:14 2017        37
BuildMsiInstaller       Tue Apr 11 22:08:14 2017        37
BuildSwitchInstaller        Tue Apr 11 22:08:14 2017        37
BuildMsiInstaller       Tue Apr 11 22:08:14 2017        37
BuildPlatformInstaller      Tue Apr 11 22:13:15 2017        37
BuildMsiInstaller       Tue Apr 11 22:13:15 2017        37
BuildServerInstaller        Tue Apr 11 22:13:15 2017        37
BuildMsiInstaller       Tue Apr 11 22:13:15 2017        37
CheckSignCodeErrors     Tue Apr 11 22:59:44 2017        37
CheckSignCodeErrors     Tue Apr 11 22:59:46 2017        37
CheckSignCodeErrors     Tue Apr 11 22:59:46 2017        37
CheckSignCodeErrors     Tue Apr 11 22:59:47 2017        37
CheckSignCodeErrors     Tue Apr 11 22:59:47 2017        37
RunpostInstall          Tue Apr 11 22:59:47 2017            38
ReportVersions          Tue Apr 11 23:00:03 2017            39
BuildAllSims            Tue Apr 11 23:00:04 2017            40
ReportSIMDevEnvErrors       Tue Apr 11 23:02:41 2017        40
CheckDevenvErrs     Tue Apr 11 23:02:41 2017        40
BuildAllSimsVS2010      Tue Apr 11 23:03:44 2017        41
ReportSIMDevEnvErrors       Tue Apr 11 23:03:57 2017        41
CheckDevenvErrs     Tue Apr 11 23:03:57 2017        41
===========================================================
--BuildSuccessful--
Successful          Tue Apr 11 23:05:55 2017            41

And my script:
opendir DIR1, "C:\\BuildStatus\\Current\\" or die "cannot open dir $dir: $!";
my @files=  grep ! /^\.+$/, readdir DIR1;
foreach my $files (@files)
{
    $searchsucs = "--BuildSuccessful--";
    $oldLoc2 = "C:\\BuildStatus\\Current\\".$files;
    $newLocS2 = "C:\\BuildStatus\\History\\Successful\\".$files;
    $newLocF2 = "C:\\BuildStatus\\History\\Failed\\".$files;
    open(E_FILE,"C:\\BuildStatus\\Current\\".$files);
    @valf2 = <E_FILE>;
    my $newLoc2 = "";
    foreach $searchf2 (@valf2)
    {
        if ($searchf2=~/$searchsucs/)
            { print "matched";
                $num1 =$num1 + 1;
            }else
            { print "not matched";
                $num1 = $num1 + 0;
            }
    }
    close E_FILE;
    print "moving build status file......\n";
    if($num1 == 1) {
      fmove($oldLoc2, $newLocS2) or warn "$file Warning: Not able to move build status files \n ";
      system(qq(E:\\depot\\builds\\PassedBuilds.bat));
    } else {
      fmove($oldLoc2, $newLocF2) or warn "$file Warning: Not able to move build status files \n ";
    }
}
closedir DIR1;

A: I can't see what is causing the problems that you are describing ("the log file still on folder current") but I can certainly help with the other part of your question ("help me improve my code"). I'd write this code something like this:
# Lexical variable for directory handle
# Single-quoted string
# Reverse slash direction to improve readability
opendir my $dir_h, 'C:/BuildStatus/Current/'
  or die "cannot open dir $dir: $!";

my @files =  grep ! /^\.+$/, readdir $dir_h;

# This doesn't change. Move it out of the loop.
my $searchsucs = '--BuildSuccessful--';

# Rename $files to $file to improve readability
foreach my $files (@files) {
  # Lexical variables (with "my")
  # Use variable interpolation instead of string concatenation
  # Reverse slash durection for readability
  # Don't define variables until you need them
  my $oldLoc2  = "C:/BuildStatus/Current/$file";

  # Lexical variable for file-handle
  # Three args in open() call
  # Use $oldLoc2 variable
  # Check return value from open()
  open(my $fh, '<', $oldLoc2)
    or die "Cannot open $file: $!";

  # Use a $found variable
  my $found;

  # Remove unused $newLoc2 variable
  # Remove unnecessary @valf2 variable
  # Process input file a line at a time (use while, not foreach)
  # Use Perl's default variable $_ for clarity
  while (<$fh>) {
    if (/$searchsucs/) {
      print "matched";
      $found = 1;
      # Skip rest of loop
      last;
    } else {
      # This will be a bit noisy!
      print "not matched"
    }
  }

  # Lexical filehandle means no need to explicitly close file

  print "moving build status file......\n";

  # Simpler logic check
  if ($found) {
    my $newLocS2 = "C:/BuildStatus/History/Successful/$file";
    fmove($oldLoc2, $newLocS2)
      or warn "$file Warning: Not able to move build status files \n ";
    system(qq(E:\\depot\\builds\\PassedBuilds.bat));
  } else {
    my $newLocF2 = "C:/BuildStatus/History/Failed/$file";
    fmove($oldLoc2, $newLocF2)
      or warn "$file Warning: Not able to move build status files \n ";
  }
}

Does that help at all?


text:
Q: Is there any reason that the STL does not provide functions to return an iterator via index? Is there a reason that the STL does not provide functions to return an iterator into a container via an index?
For example, let's say I wanted to insert an element into a std::list but at the nth position. It appears that I have to retrieve an iterator via something like begin() and add n to that iterator. I'm thinking it would be easier if I could just get an iterator at the nth position with something like, std::list::get_nth_iterator(n).
I suspect I have misunderstood the principles of the STL. Can anyone help explain?
Thanks
BeeBand

A: std::list is a linked list. So it does not support random access. To get to the nth position in the list, you have to start at the beginning and move through all the nodes until you arrive at n. This is pretty expensive (O(n)), and thus it's bad to have a method that does not suggest this expense. get_nth_iterator(n) implies getting the iterator that points to the nth node is cheap.
std::vector of course supports this directly with the [] operator, because the datastructure supports random access and so this is very inexpensive for it.

A: std::list isn't random-access container, so there is no reason for accessing n-th element. if you need this, consider using std::vector instead..

A: You can use advance() from the <iterator> header:

list<foo>::iterator iter = advance(someFooList.begin(), n);

list<foo>::iterator iter = someFooList.begin();

std::advance( iter, n);

If the iterator supports random access (like vector) it'll work quite efficiently, if it only supports increasing (or decreasing) the iterator, like list, it'll work but only as well as can be.

A: Generally, anything that might be costly is made a bit clumsy, so you won't do it by accident. Using your example, with a container that provides random access iterators it would be simply container.begin()+n, but for an std::list (which provides a forward iterator) you'd need to use list.begin() followed by advance().
If you want to get the Nth iterator, chances are that you just shouldn't be using std::list in the first place. Then again, if you started that sentence at "chances", it would remain nearly as true...


text: Q: What are the methods for predicting an ordinal variable? I am trying to predict age group for each individuals.  I have a large data with 63 variables and about 50.000 observations. But I dont know what each variable mean, I have only values. To predict, I used randomForest and got about 63% accuracy. So, what methods I should use to predict an ordinal variable?


text:
Q: Application shortcut reappears on restart I have an application that I have built a .msi installer for throgh Microsoft Visual Studio 2010. I recently made some updates, including changing the version number and rebuilt the installer with these updates. The installer includes shortcuts on both the desktop and in the Start menu. Running the installer appears to work fine, and both of these shortcuts work. After restarting my computer I've found that the shortcuts are changed to have a Target type of Application (Installs on first use) and the Start In: field is changed to a location that doesn't exist. Once this happens, every time you use that shortcut it tries to install the application again and fails.
I have also changed the name of the shortcut that the installer creates. This appears to work, and the shortcut still works after a restart. After the restart, though, the shortcut with the old name that doesn't work also appears on the desktop and in the Start menu.
Does anyone have any ideas what I may have set up wrong, or what I need to change to get the shortcuts to be have properly?

A: I appear to have this issue resolved ... even though I'm not sure if I understand what caused it or what solved it. In the end, I created a new Solution file and built the project from that new solution. I don't understand why that would make a difference, and comparing the new and old solution files they changes don't appear to be significant. After doing this, though, the installer build from this solution appears to be working correctly.
I should also note that I deleted the deployment project and created a new one. Doing this did not appear to have an affect on the issue, but the new deployment project was included with the new solution.


text:
Q: Как отследить прикосновения обьектов к друг другу? Меня мучает очень интересный вопрос, а именно: как отследить прикосновения обьектов к друг другу? Допустим игрок столкнулся с врагом и умер. Как сделать?
Напишите код, пожалуйста.

A: Из вашего вопроса совершенно неясно, как написать код.
Однако есть простой принцип: все объекты в игре представляются как окружности определённого радиуса с центрами (x ; y).
Каждый цикл работы программы вы можете делать подобную проверку: если расстояние между объектами меньше либо равно сумме их радиусов, то объекты столкнулись/соприкоснулись
Расстояние ищется по теореме Пифагора.


text:
Q: PHP: Declare the type of an argument as Class (like Java) We can specify the type of an argument in java as Class or Class<?> or Class<SomeClass> or Class<? extends SomeClass>. Also, we know PHP has added type declaration capability (were also known as type hints in PHP 5). So is a way to declare the type of an argument of a function as Class (like Java) in PHP?
For example (in PHP):
function f(Class<string> $clazz) { ... }  // ???

A: As you said, this is referred to as type hinting in PHP.
Example from the PHP docs:
<?php
// An example class
class MyClass
{
    /**
     * A test function
     *
     * First parameter must be an object of type OtherClass
     */
    public function test(OtherClass $otherclass) {
        echo $otherclass->var;
    }

    /**
     * Another test function
     *
     * First parameter must be an array
     */
    public function test_array(array $input_array) {
        print_r($input_array);
    }

    /**
     * First parameter must be iterator
     */
    public function test_interface(Traversable $iterator) {
        echo get_class($iterator);
    }

    /**
     * First parameter must be callable
     */
    public function test_callable(callable $callback, $data) {
        call_user_func($callback, $data);
    }
}

// Another example class
class OtherClass {
    public $var = 'Hello World';
}
?>

The part that really matters in your question is this function, where OtherClass is specifying that the argument must be an instance of OtherClass, otherwise, PHP will throw an error.
<?php
    /**
     * A test function
     *
     * First parameter must be an object of type OtherClass
     */
    public function test(OtherClass $otherclass) {
        echo $otherclass->var;
    }
?>


text:
Q: How to turn off JSLint indentation warnings? I find that JSLint produces lots of warnings of the form:
Expected 'foo' to have an indentation at X instead at Y.

The JSLint options documentation describes an indent option that recognizes a numerical value representing the amount of space for each level of indentation. This option allows me to say things like use 2 spaces per level of indentation. I just write something like this at the top of my JavaScript file:
/*jslint indent: 2 */

OK, great. Now JSLint knows how much to indent for each level of indentation, but JSLint seems to be hardcoded to decide what level of indentation each line should have.
Suppose I want to indent my code differently than the way JSLint prescribes. Can I do this with some JSLint option? If not, can I at least turn off the indentation warnings? I tried:
/*jslint indent: false */

but that did not cause indentation warnings to be elided; it caused a JSLint error.

A: What a difference that morning coffee makes:
/*jslint white: true */

A: If you don't want to disable JSLint, you can remove the double indentations (e.g. when defining multiple var's in a javascript file) by adjusting this setting:
Options > Editor > Formatting > Language: Javascript > Continuation Indentation - set to 4.
Now you can use ctrl shift f to format code, and JSLint doesn't freak out...


text:
Q: How to Make WebView Work In iPhone/iPad Retina I am having a bit of trouble with my webview code. it is completely working with iPhone and iPad non-retina version but can't get it to work with retina.
I have provided my code below... What seems to be the problem here?
self.webView.delegate=self;
self.webView.scalesPageToFit = YES;
NSString *urlAddress = @"https://www.google.com/";

//Create a URL object.
NSURL *url = [NSURL URLWithString:urlAddress];

//URL Request Object
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];

//Load the request in the UIWebView.
[webView1 loadRequest:requestObj];
[self.view addSubview:webView];

I'm an amateur programmer so please forgive me. I already did my google search but failed at finding the answer so here i am :)
edit: sorry guys for the incomplete info. it is not in xib or storyboard. also, the specific problem im having is when in retina, the webview opens and closes immediately, and then crashes the app. don't mind the crash as i understand why it happened. im just concerned about it not working on retina display even though it's completely fine with non-retina.
my original code is webView.delegate=self; and not self.webView.delegate=self;... i just changed it because i did some random testing. :/

A: It's strange that your code is working in any device because there is a mistake in your UIWebview instance. it should be like this take a look at addsubview line what you're doing.
self.webView.delegate=self;
self.webView.scalesPageToFit = YES;
NSString *urlAddress = @"https://www.google.com/";

//Create a URL object.
NSURL *url = [NSURL URLWithString:urlAddress];

//URL Request Object
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];

//Load the request in the UIWebView.
[self.webView loadRequest:requestObj];
[self.view addSubview:self.webView];


text:
Q: Why the child routes won't show in IONIC/Angular? I want to create a single navbar for a multiple pages website using IONIC/Angular.
The problem here is that the content written in order.page.html, which is a children of navbar.page, won't show up, even if I want to print something from order.page.ts, nothing is printed.
This code below should be enough to detect where is the problem.
navbar-routing.module.ts
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { NavbarPage } from './navbar.page';

const routes: Routes = [
  {
    path: '',
    component: NavbarPage,
    children: [
      {
        path: 'order',
        loadChildren: () => import('../order/order.module').then( m => m.OrderPageModule)
      },
      {
        path: '',
        redirectTo: 'order',
        pathMatch: 'full'
      },
    ]
  },
];

@NgModule({
  imports: [RouterModule.forChild(routes)],
})
export class NavbarPageRoutingModule {}

app-routing.module.ts
import { NgModule } from '@angular/core';
import { PreloadAllModules, RouterModule, Routes } from '@angular/router';

const routes: Routes = [
  {
    path: '',
    loadChildren: () => import('./navbar/navbar.module').then( m => m.NavbarPageModule)
  },
];

@NgModule({
  imports: [
    RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules })
  ],
  exports: [RouterModule]
})
export class AppRoutingModule { }

A: I forgot to add router-outlet in the html part that's why


text:
Q: How to call for "Label Detection" and "Safe Search Detection" at a time on Google Cloud Vision API I would like to ask you the the following thing about Vision API.
The following picture indicates that I can take on "Free with Label Detection, or $1.50", if I will use "Label Detection".
But, I didn't find out how to use both of them at the same time in a tutorial on "Label Detection" and "Safe Search Detection" both.

*

*Can I use both of services at a time in Python?

*If so, how can I call for them?

I will really appreciate that if you tell me.

A: In case you want to send both types at the same time, you can use the annotate_image() method; in this way, you can specify all the features that need to be included in the same request. Based on this, I recommend you to take a look on this documentation (Doc1, Doc2) to get detailed information about this property usage, as well as this tutorial, that contains a curl command example where is shown the process required to send multiple features within the same call that you can use as an alternative workaround.
import io
import os

from google.cloud import vision

client = vision.ImageAnnotatorClient()

response = client.annotate_image({
  'image': {'source': {'image_uri': '<IMAGE_URI>'}},
  'features': [{'type': vision.enums.Feature.Type.SAFE_SEARCH_DETECTION},
               {'type': vision.enums.Feature.Type.LABEL_DETECTION}]
})

print(response)

Additionally, I think that this pricing information refers that you can use the Safe Search Detection feature for free if you use it with Label Detection; however, the Label Detection requests will be billed with the corresponding charges that are displayed at the Prices document.


text:
Q: Windows Debugger Road-Map It seems there are dozens of debugger and debugging tools that Microsoft produces, which creates a maze of choices and questions concerning which tool to apply, and when.  For example, there is windbg - and the debugger built into Visual Studio.  Both can access minidumps.  Why would I choose one over the other?
Dr. Watson was the default post-mortem crash analysis tool of the past.  It has now been replaced with "Problem Reports & Solutions".  Which is in turn replaced with IIS Exception Monitor on servers?  And perhaps all of this is built on top of "Microsoft CDB Debugger," or perhaps that is a another duplicate tool?  ADPlus, yet another one, is built on CDB Debugger.  The maze seems to go on endlessly.
Can someone provide a link to a taxonomy or roadmap of all these tools, with comments of which are being deprecated (Dr. Watson?) and what "tool direction" debug students should absorb?  I'm sure there are a number of tools and base libraries I've not mentioned here.  it would be nice to know the dependencies between them too (such as ADPlus using the CDB Debugger).
I've found this link to be helpful, since it answers some of the questions I'm asking - though the material is dated.  Any other resources that give a similarly simple compare / contrast run-down?

A: There is no difference between CDB and NTSD, other than how they spawn new windows.  Choosing when to use Visual Studio over the command line debuggers is sometimes a matter of personal choice, but sometimes the command line is a better tool for the job.  Once you get good at using the command line debuggers, you can get things done much more quickly.  I suspect there are a few scenarios that remain where you can only debug a specific problem with the command line debugger, but I can't think of any off hand.  The third debugger you've missed is kd, which is the kernal debugger.  If you want to debug kernal mode stuff (i.e. your device drivers you've written) it's really your only choice.
CDB, NTSD and KD are all part of the debugging tools for Windows, itself part of the DDK.  Visual Studio does not depend on the other debugging package and vice-versa.
Watson and the like are not debuggers.  They merely observe and report.  I suspect the best advice there is use whichever one is appropriate to your problem.  I mean, there are lots of tools for all sorts of different MS technologies.  E.g. Orca for MSI databases.  All of these products are unrelated, often released and maintained by different divisions, etc.  As a result, I doubt you'll find a chart showing their relationships since they are so diverse.


text:
Q: Insert row base on specific text and its occurrence I am using a VBA code to insert rows below based on a specific text and its occurrence .
I am using the following code to do so
Sub try()
Dim c As Range
  For Each c In Range("A1:A100")
    If c.Value Like "*COLLECTION*" Then
       c.Offset(1, 0).EntireRow.Insert
    End If
  Next c
End Sub

*

*I want to have the text BALANCE below the COLLECTION cell instead of blank row.

*I want to insert the BALANCE row below the last COLLECTION entry, for example if there are two collections rows serially then I want to add the BALANCE row after the 2nd collection row. but with the above VBA code I am getting blank rows below to the each collection row.
My Collection and balance rows are in the column A
Before macro Image kindly check

After macro I want like this Image kindly check

A: That's typically the kind of cases you want to start from the last cell, because inserting a row will mess up all counters from what is below.
In other words, the elegant for each is not really a good idea. Too unpredictable. An ugly, old simple For Step -1 is the way to go. Something like :
Sub Macro1()
    For l = 100 To 1 Step -1
        If Trim(Cells(l, 1)) = "COLLECTION" And Trim(Cells(l + 1, 1)) = "DEMAND" Then
            Rows(CStr(l + 1) & ":" & CStr(l + 1)).Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
            Cells(l + 1, 1) = "BALANCE"
        End If
    Next l
End Sub

Just tried on EXCEL 2013, seems to work as you want. There may be more elegant solutions, though.
EDIT : the idea is the following one :
_Begin by the last line(in fact, the last line cannot work, so one optimization could be to start from the prevo=ious one), and go to the first one
_If the line testes is "COLLECTION", and the next one is "DEMAND", then you need to insert a "BALANCE" line in between. It's done in 2 times, first insert an empty line, then add "BALANCE" in the newly created line.

A: I would do this using a loop from row 1 till last filled row in column A. Then having a boolean marker which is true while the cell value in current cell is like "*COLLECTION*" but false while not. So if the current cell is not like "*COLLECTION*" but the marker is true then the last cell above the current cell was like "*COLLECTION*". Then insert a new row with  "BALANCE" if that cell is not already "BALANCE".
Sub try()
 Dim c As Range
 Dim lRow As Long
 lRow = 1
 Dim lRowLast As Long
 Dim bFound As Boolean
 With ActiveSheet
  lRowLast = .Cells(.Rows.Count, 1).End(xlUp).Row
  Do
   Set c = .Range("A" & lRow)
   If c.Value Like "*COLLECTION*" Then
    bFound = True
   ElseIf bFound Then
    bFound = False
    If c.Value <> "BALANCE" Then
     c.EntireRow.Insert
     lRowLast = lRowLast + 1
     c.Offset(-1, 0).Value = "BALANCE"
     c.Offset(-1, 0).Font.Color = RGB(0, 0, 0)
    End If
   End If
   lRow = lRow + 1
  Loop While lRow <= lRowLast + 1
 End With
End Sub


text:
Q: Is there any way to call PCL method from Android? I want to navigate from one page to another on info-window click and i have a custom renderer for map. Could anyone suggest me how to navigate to other view from custom renderer. Thanks in advance :)

A: You really want to keep the Android project and PCL decoupled, so I would use a MessagingService to send a message from the Android project which will then be received by the PCL.
YourCustomRenderer:
MessagingService.Current.SendMessage("NavigateMessage", new NavigationParamsModel
{
    TargetPage = "DetailsPage",
    Id = 12,
    SomethingElse = "blahblah"
});

PCL:
MessagingService.Current.Subscribe<NavigationParamsModel>("NavigateMessage", async (arg1, arg2) =>
{
    // Just an example of how this would be done using Prism.Navigation.
    // Pure Xamarin.Forms navigation is obviously different.
    _navigationService.NavigateAsync(arg2.TargetPage);
});


text:
Q: javascript array inside object inside array I want an array of objects, and each object has a string, an array of strings and an integer...
Isn't this right?
var ques = [
    {
        "q": "quest1",
        "a": ["ans1", "ans2", "ans3", "ans4"],
        "c": 1
    },
    {
        "q": "quest4",
        "a": ["ans1", "ans2", "ans3"],
        "c": 3
    },
    {
        "q": "quest7",
        "a": ["ans1", "ans2"],
        "c": 2
    }
];

A: Yes, that is a valid array of objects.


text:
Q: About Shor's error correcting algorithm
*

*In this paper, http://arxiv.org/abs/1301.4504 in equation 4.1 in what sense are the two states a "9-qubit state"? I did not understand this counting.

*Can someone explain what are the different $X_i$ and $Z_i$ in 4.2? How is say $X_1$ Pauli matrix different from $X_8$ and so on?

*And what is the non-trivial thing that happened in equation 4.2? (aren't the two kets on the LHS and the RHS the same?)

It would be great to hear of any other general insights/explanation people might have about this section 4.

A: $X_i,Y_i,Z_i$ are three Pauli matrices acting on the $i$-th qubit where $i=1,2,3,4,5,6,7,8,9$ labels the qubit. In equation 4.1, the state is a superposition of tensor product of three states similar to $|000\rangle$. The latter is a state of three qubits, so if one takes the third power, it is a state of $3\times 3 = 9$ qubits.
$X_1$ differs from $X_8$ by the fact that it only nontrivially acts on the first qubit, the first 0 or 1 from the left, while it acts as the identity operator on the eighth qubit. For $X_8$, the action on the two qubits is reversed.
The equation 4.2 doesn't have an LHS or a RHS.


text:
Q: Смещать метку и центр карты при клике на внешнюю ссылку Всем привет!
Есть общая карта с несколькими метками. И есть список с описанием разных объектов и у каждого кнопка "посмотреть на карте".
разметка примерно следующая:

        посмотреть на карте

        посмотреть на карте

        посмотреть на карте

карту подключаю так:
ymaps.ready(init);

function init() {

        myMap = new ymaps.Map('map', {
            center: [55.753559, 37.609218]
            zoom: 10
        });

myMap.geoObjects
    .add(new ymaps.Placemark([55.753559, 37.609218], {
        iconCaption: "Москва",
    }))
    .add(new ymaps.Placemark([59.938531, 30.313497], {
        iconCaption: "Санкт-Петербург",
    }))
    .add(new ymaps.Placemark([56.829748, 60.617435], {
        iconCaption: "Екатеринбург",
    }));
}

Нужно чтобы при нажатии этой кнопки у какого-то конкретного объекта на карте оставалась только одна метка (с координатами этого объекта) или же центр смещался на центр координат выбранного адреса. Как такое реализовать?
Очень похожий пример тут https://tech.yandex.ru/maps/jsbox/2.1/object_list
Но мне нужны не объекты, а только одна метка, и само меню должно добавляться в уже существующие блоки


text:
Q: Genshin Impact full screen problem in tablet mode on Laptop I play in tablet mode on my laptop,  so the weakest flip I do while opening the game has to look like

I used to reinstall the game and it works, but that takes too much time.

A: I don't know if it's taking the mobile game build or the PC game build.
Do you have a launcher? (A screen that opens up before the game to do updates and has a big Launch yellow button)
If it's the PC game build I would look for, in the settings, the screen settings (resolution) and make sure it's something like 1920x1080. My guess is that as soon as the tablet flips in portrait mode, it forces a resolution for portrait (that will show the most of the game possible in a supported resolution) but when it goes back to landscape it doesn't do that check.

A: *

*Go into the Paimon menu

*Click settings (should be a bottom icon on the left sidebar)

*Go to graphics

*Depending on what you want either set the screen size to that OR, if it's already on the size you want, just switch it to a smaller one and then back to the one you want (this is what I have to do, it kinda resets it)


text:
Q: VueJS input with v-model accepts only one character I have this Vue 1 application with a table that has an input for every cell.
The problematic part in particular has 3 fields on a row:

*

*dx

*sx

*diff

I want that when dx and sx are filled, diff becomes the difference between the two.
To achieve this I set up a watcher for each dx and sx fields that calculates the difference when both corresponding inputs are filled.
'athlete.inputs[testData.edf.abdother.dx.id].comment': function(){
      this.calcDiff('abdother.dx.id')
},

'athlete.inputs[testData.edf.abdother.sx.id].comment': function(){
      this.calcDiff('abdother.sx.id')
},

...

 calcDiff: function(input){
      console.log('calculating diff', this.athlete);
      input = input.split('.')
      var dx = this.athlete.inputs[this.testData.edf[input[0]]['dx'][input[2]]].comment
      var sx = this.athlete.inputs[this.testData.edf[input[0]]['sx'][input[2]]].comment
      console.log({dx, sx})
      if (!dx || !sx)
        return;

      this.athlete.inputs[this.testData.edf[input[0]]['diff'][input[2]]].comment = dx >= sx ? dx - sx : sx - dx
    },

After setting all up I tried changing some values:

*

*If I enter one character everything works fine

*If I enter a second (or more) characters, suddenly the value of the property becomes null

As you can see from the picture, if I enter 1 it logs the correct value, but if I enter a second value it becomes null. If I delete all the characters but one then it starts working again.
Setting one character in both inputs works as expected, it calculates the difference and places it in the right place.
More characters immediately unsets the variable and empties the field as soon as you unfocus it.
Any ideas?

A: The problem is most likely that String.split() uses regular expressions in JavaScript. Because . is the wildcard in regex, your input.split('.') is splitting on every character. Try adding a backslash before the .


text:
Q: Google maps api containsLocation always returning false I have drawn a polygon with google maps and tried to include a location that is in the polygon but the containsLocation function always returns false. Not sure if the points on the polygon have to start and end at the exact same location, or if there's an issue with my code.
The location for my containsLocation lat lng is in the shape.

var rightShoulderFront = new google.maps.Polygon({
  paths: outerCoords
});
const map = new google.maps.Map(document.getElementById("mapSect"), {
  center: { lat:3.528319665937775,lng:101.7580347776062 },
  zoom: 5,
});

var outerCoords =[
  {lat:3.528319665937775,lng:101.7580347776062},
  {lat:3.003044444012029,lng:101.4085838669952},
  {lat:2.9951223092598767,lng:101.82611927913445},
  {lat:3.5216453,lng:101.7636108}
]

      geocoder.geocode({address: selectedFullAddress,},function(results,status)
      {
        lat = results[0].geometry.location.lat();
        lng = results[0].geometry.location.lng();

        var curPosition     = new google.maps.LatLng(lat,lng);
        var isWithinPolygon = google.maps.geometry.poly.containsLocation(curPosition, rightShoulderFront)
      });

A: Perhaps the following will help. I rearranged things a little and made a some minor mods but essentially the same. In the original you were calling outerCoords as  avalue before it had been declared so I'd imagine there were errors in the console.
<!doctype html>

        <meta charset='utf-8' />
        <title>Google Maps: </title>

A: You have issues with the posted code:

*

*A javascript error: InvalidValueError: not an Array on this line: var rightShoulderFront = new google.maps.Polygon({paths: outerCoords}); because outerCoords is not yet defined, and null/undefined is not an Array.

*A javascript error: Uncaught (in promise) ReferenceError: geocoder is not defined on this line: geocoder.geocode({address: selectedFullAddress,},function(results,status), because geocoder is not defined in your code.

*A javascript error: Uncaught (in promise) ReferenceError: selectedFullAddress is not defined, because selectedFullAddress is not defined in your code.

proof of concept fiddle

code snippet:

function initMap() {
  var infowindow = new google.maps.InfoWindow();
  var outerCoords = [{
      lat: 3.528319665937775,
      lng: 101.7580347776062
    },
    {
      lat: 3.003044444012029,
      lng: 101.4085838669952
    },
    {
      lat: 2.9951223092598767,
      lng: 101.82611927913445
    },
    {
      lat: 3.5216453,
      lng: 101.7636108
    }
  ]
  const map = new google.maps.Map(document.getElementById("mapSect"));
  var rightShoulderFront = new google.maps.Polygon({
    paths: outerCoords,
    map: map
  });
  var bounds = new google.maps.LatLngBounds();
  for (var i = 0; i < outerCoords.length; i++) {
    bounds.extend(outerCoords[i]);
  }
  map.fitBounds(bounds);

  var geocoder = new google.maps.Geocoder();
  var selectedFullAddress = "Kuala Lumpur"
  geocoder.geocode({
    address: selectedFullAddress,
  }, function(results, status) {
    lat = results[0].geometry.location.lat();
    lng = results[0].geometry.location.lng();
    var marker = new google.maps.Marker({
      position: results[0].geometry.location,
      map: map
    })
    var curPosition = new google.maps.LatLng(lat, lng);
    var isWithinPolygon = google.maps.geometry.poly.containsLocation(curPosition, rightShoulderFront);
    if (isWithinPolygon) {
      infowindow.setContent("isWithinPolygon:" + curPosition.toUrlValue(6));
      infowindow.open(map, marker);
    }
  });
}
/* Always set the map height explicitly to define the size of the div
       * element that contains the map. */

#mapSect {
  height: 100%;
}

/* Optional: Makes the sample page fill the window. */

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
}
<!DOCTYPE html>

  <title>Simple Map</title>


text:
Q: How to extend the output of a window function with missing dates I have a table looking like this:
    > DESC sensordata;
+-----------+--------------+------+-----+---------+----------------+
| Field     | Type         | Null | Key | Default | Extra          |
+-----------+--------------+------+-----+---------+----------------+
| id        | int(11)      | NO   | PRI | NULL    | auto_increment |
| device_id | int(11)      | YES  |     | NULL    |                |
| timestamp | datetime     | YES  | MUL | NULL    |                |
| ...                                                              |
+-----------+--------------+------+-----+---------+----------------+

(I know calling the datetime field timestamp was not great as it is a keyword)
Minimal reproducable example:
CREATE TABLE `sensordata` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `device_id` int(11) DEFAULT NULL,
  `timestamp` datetime DEFAULT NULL,
  PRIMARY KEY (`id`)
);

INSERT INTO `sensordata` VALUES
  (1,1,'2020-01-01 13:10:00'),
  (2,1,'2020-01-02 13:20:00'),
  (3,1,'2020-01-04 13:40:00'),
  (4,2,'2020-01-01 13:10:00'),
  (5,2,'2020-01-02 13:10:00'),
  (6,2,'2020-01-04 13:10:00'),
  (7,2,'2020-01-04 13:10:00'),
  (8,2,'2020-01-04 13:10:00'),
  (9,2,'2020-01-04 13:10:00'),
  (10,2,'2020-01-05 13:10:00');

I want to get the increasing count of rows in this table, grouped by device_id and timestamp. So far I got this query:
SELECT DISTINCT(DATE(timestamp)) as time,
       CAST(device_id as CHAR) as device,
       count(id) OVER (PARTITION BY device ORDER BY time) AS sum
   FROM sensordata

It nearly gives me what I want:
+------------+--------+-----+
| time       | device | sum |
+------------+--------+-----+
| 2020-01-01 | 1      |   1 |
| 2020-01-02 | 1      |   2 |
| 2020-01-04 | 1      |   3 |
| 2020-01-01 | 2      |   1 |
| 2020-01-02 | 2      |   2 |
| 2020-01-04 | 2      |   6 |
| 2020-01-05 | 2      |   7 |
+------------+--------+-----+

As you see the sum increases correctly with the time. But I need to also include the dates on which the sum doesn't change, so the table should look like this:
+------------+--------+-----+
| time       | device | sum |
+------------+--------+-----+
| 2020-01-01 | 1      |   1 |
| 2020-01-02 | 1      |   2 |
| 2020-01-03 | 1      |   2 |
| 2020-01-04 | 1      |   3 |
| 2020-01-05 | 1      |   3 |
| 2020-01-01 | 2      |   1 |
| 2020-01-02 | 2      |   2 |
| 2020-01-03 | 2      |   2 |
| 2020-01-04 | 2      |   6 |
| 2020-01-05 | 2      |   7 |
+------------+--------+-----+

How to include the missing dates with the correct sums in this context? Is this feasible with the used window function?
edit: added a reproducible example
edit2: extended example with more rows per day and device

A: WITH RECURSIVE cte1 AS
( SELECT DATE(MIN(`timestamp`)) ts
  FROM sensordata
UNION ALL
  SELECT ts + INTERVAL 1 DAY
  FROM cte1
  WHERE ts < ( SELECT DATE(MAX(`timestamp`)) ts
               FROM sensordata ) ),
cte2 AS ( SELECT DISTINCT device_id
          FROM sensordata )
SELECT DISTINCT
       cte1.ts,
       cte2.device_id,
       COUNT(sensordata.id) OVER ( PARTITION BY cte2.device_id
                                   ORDER BY cte1.ts ) `sum`
FROM cte1
CROSS JOIN cte2
LEFT JOIN sensordata ON cte1.ts = DATE(sensordata.`timestamp`)
                    AND cte2.device_id = sensordata.device_id;

fiddle


text:
Q: How to add and Remove Rows from rdlc Report In my Project I am using RDLC reporting,
I have Number of Rows of tools in it, which values fill by my combo box,
Every time i am passing 2 or 3 rows value, other values is Null,
So, I am looking for Code, by which i can Add or Remove Rows dynamically from RDLC Report.
Note: Its vb.net Desktop application

A: There are different solutions to your problem.
If your Table is connected to a Dataset you can populate it only with Non-Null values.
If you don't use DataSet and your Table has 3 fixed rows, you can use Hidden property to hide TableRow with Null values.


text:
Q: Which approach for integrating Python code into a mainly Scala application did you use a second time because it was successful? I have a mainly Scala application and I am interested in approaches to integrating Python code into this application in a way that is proven by you personally to be successful.
In this context

*

*integrating means allowing Scala code to call Python code, somehow, and use the results or access the exception

*successful means the approach was used more than once because it allows the two languages to work together to deliver business value and the approach was used a second time by the same team

Hopefully this question admits factual answers rather than discussion because I am asking for factual observations. However if this is too subjective then as you close this could you please suggest one of,

*

*How I can ask this question in a non-subjective way OR

*Point me to a site where I can ask this type of question.

Thanks.

A: Capture results via a variable and capture exceptions via STDERR as follows:
in Scala:
import sys.process._
def callPython(): Unit = {
    val result = "python /fullpath/mypythonprogram.py" ! ProcessLogger(stdout append _, stderr append _)
    println(result)
    println("stdout: " + stdout)
    println("stderr: " + stderr)
}

and in Python:
try:
    throws()
    return 0
except Exception as err:
    sys.stderr.write(f'Exception: {err}')
    return 1

For further review see the package process here.
Also visit ProcessBuilder here and ProcessLogger here

A: There is not going to be a single answer to this because each case is different and all approaches has been used successfully by different teams.
In general there are three approaches:

*

*If both languages has the same runtime, you can compile both languages to that runtime and use a foreign function interface. In this scenario, you use Jython and Scala, which both runs on JVM. This is generally the fastest and least overhead, but you'll have to deal with some impedance in the way each language treats objects in their language, and you don't have any isolation so poorly written code in either language can crash the other. Additionally, it can be cumbersome to scale this to multiple machines.

*You can spawn subprocesses when processing each request in the main app. The main process communicate with the subprocess by streaming data using stdin and stdout, and possibly other pipes or any other OS specific IPC. This is generally best if the subprocesses are a filter type of program that can be used in a pipeline. There's going to be some overhead in creating subprocesses for each main request, but if you're doing this on a Unix-based system like Linux, creating new process is really fast as the system is optimized for it.

*You can create an use inter process communication and communicate with a microservice using a message passing API. Example of this is to run a microservice running an HTTP application server or communicating with domain sockets. With this approach, you have some overhead due to rendering, copying the messages, and parsing the messages, so it's best used when the messages are coarse-grained rather than making lots of small calls. You will need to design an explicit API, but this approach is usually simpler in the long run and can be made more robust since crashes are separate and won't affect the other processes. This approach is also much more easy to scale as having an explicit API makes it more straight forward if you ever need to run the processes on different machines.