text:
Q: Schrodinger's dead cat when the evidence is destroyed In the classic (and morbid) Schrodinger's Cat thought experiment, we imagine putting a cat into a box with a vial of poison which will be triggered by a quantum detectors. We set up a radioactive nucleus or an excited ion, and set up a detector to look for radiation resulting from radioactive decay or drop to the ground state. When we detect this radiation, we break a vial of cyanide, which would kill the cat. If the box is sealed away from external influence, it is commonly said that the cat is in a superposition of life or death, as a result of the uncertain time of the radiation occurring: with no-one to observe the cat, the state of its health life itself becomes uncertain in a quantum mechanical way.
Add a twist. Don't ever open the box. Explode it with a bomb instead and destroy all evidence. Did the wave function ever collapse?

A: You really ought to watch the talk by Charles Bennett at http://pirsa.org/11050052/. At first, he analyzed the Mach-Zehnder interferometer and concluded the which-way information of the photon did not exist. Then, he went on to quantum Darwinism where redundant copies of the information are stored in the environment. This multipartite entanglement with the environment leads to a classical correlation whenever not all the copies are taken into account. Some of the redundant copies of the information escape from the Earth and become inaccessible to us. For the case of your cat, the copies of the information here on Earth eventually thermalize or get carried away by thermal radiation from the Earth, or stored in a relatively permanent form here on Earth in a "hash" encoding which is one-way and inaccessible. Eventually, all the entanglement will only exist outside the Earth and be inaccessible, and by the same logic that led us to conclude the which-way information was in a superposition because we can't access it, the cat was also in a superposition. There's a nice quote by Wheeler in the talk "The past only exists in so far as it is recorded in the present". Not even God can tell what "actually" happened.
All in all, this is a very informative talk, and I think it addresses your question head on.

A: This question strikes close to the heart of The measurement problem, which is the question of what (if anything) the process of measurement represents; and is all but synonymous with the question of how one ought to interpret quantum mechanics.
As such, the answer to this question is (a) subject to debate; and (b) absent any substantial philosophical and/or technical break-throughs, entirely subjective. Nevertheless, one can consider the popular alternatives which have been suggested as conceivable answers to the problem.

*

*Marco's earlier answer exemplifies the Bayesian interpretation of quantum mechanics: that the wavefunction does not represent the state of the system, but our knowledge of the state of the system. (I am not sure whether the 'Bayesians' actually form any opinions at all about what the state of the system actually is, if the wavefunction is entirely an object of human conception; I would perhaps naïvely assume that they believe that it bears some pertinent relation to the state of the system.) In this interpretation, the cat presumably is always either alive or dead; a measurement (if one is made) only reveals which is the case.

*Opposite in some respects to the Bayesian interpretation, and identical in other respects, the Bohmian interpretation supposes that the wavefunction is not the state of the system, but is nevertheless a real quantity — a "quantum potential" — which governs by delicate means the actual evolution of the system. For Bohmians as with Bayesians, measurement only reveals the pre-existing state of the system; but the wavefunction does change (smoothly) in the presence of measurement devices (which after all are physical systems).

*The Bayesians and the Bohmians both set themselves quite clearly apart from adherents of the Many Worlds Interpretation of quantum mechanics. Like the Bohmians, Many-Worlders believe the wave-function refers to something real; unlike the Bohmians, they believe it completely specifies the state of the system. Like the Bayesians (at least according to my personal understanding), Many-Worlders suppose that the collapse of the wave-function is only apparent, and due to an updating of the information of an observer's knowledge about the state of a system; unlike Bayesians, however, this updating comes from a physical process entangling the observer with different possible marginal states of the observed system, which prior to observation could not be said to have any definite state (in the sense that "definite state" is usually used).
All three of the above interpretations are ones for which the state of the system is not considered to actually collapse; either the system is in some definite (albeit perhaps unknown) state before measurement, or all measurement outcomes are realized in different alternative worlds.
There are also interpretations of quantum mechanics in which the state of the system is considered to collapse. The oldest of these is the original Copenhagen interpretation, in which (as with the Bayesian interpretation) the wavefunction is considered a useful fiction, but which supposes that there is no state of the system between measurements; the wavefunction is literally nothing more than a book-keeping device for describing the relationships between the results of  a sequence of measurements. Somewhat less anti-realist  is the consistent histories interpretation, which fleshes out the Copenhagen interpretation (and conceivably flirts with the MWI) by saying that that while the state of the system is not well-defined per se, the past states of the system can be described in terms of all those histories which are consistent with past measurement results and is in some sense the sum of them. In both of these interpretations, the wave-function does collapse.
Separate from these are theories which do not interpret quantum mechanics, but seek instead a slight variation of it. Spontaneous collapse theories, for instance, not only describe state-collapse as a genuine way that the system may evolve, but describe it as doing so as a result of things such as significant variations in the wavefunction of mass distributions. Roughly speaking, if the wavefunction leads to a superposition of a needle pointing to one position on a dial versus a substantially different one — or to different distributions of potassium in one location of your visual cortex than another — then the wavefunction undergoes a biased random-walk process in which it eventually becomes stable at a "pointer" state consistent with a definite result of the observation; and the more distinguishable the possible states are in terms of spatial distributions of mass, the faster the walk converges.
So to answer your question: whether the wavefunction collapses under any circumstances at all depends on your interpretation of quantum mechanics, and may in fact not be an answerable question. It ultimately depends on what a measurement actually is, whether it necessarily involves consciousness (pseudoscience alert, ugh!) or is merely a mental process (Bayesians / Bohmians), a process resulting from entanglement of conscious observers with quantum systems (the Many Worlds Interpretation), an entirely physical process of state evoltion (spontaneous collapse theories), or something else.
As for the cat:

*

*For the Bohmians and Bayesians, the cat was always either dead or alive (becoming dead at least when the bomb explodes).

*The Many Worlds adherent believes that the cat was for a time in a superposition of dead and alive, becoming only certainly dead once the bomb explodes; and believes that a later observation might entangle an observer with a definite state of the cat having been dead even prior to the explosion, if there were any way to determine any difference between the cat being alive or dead prior to the explosion.

*The spontaneous collapse theorist believes that the different behaviours of the cat, between being alive or dead, would cause the collapse of the state of the cat to definitely alive or definitely dead well prior to the bomb.

*Given that they cannot observe the cat, it is not even clear whether the adherent of the Copenhagen even believes the cat exists once the experiment is engaged, unless an observation is made some time after the bomb explodes. Bohr (the original Copenhagen interpreter) liked to distinguish between "quantum" systems and "classical" ones; surely a cat (or a particle detector) is a 'classical' system, and so perhaps they think that the cat is always either alive or dead, but because the particle detector collapsed the wavefunction of the radioactive nucleus / excited ion.

*Consistent histories, like the Many Worlds Interpretation, does not posit any definite state of the system until it is measured, at which point it is revealed (if any distinguishing evidence can be found) that it was either definitely alive before the bomb, or definitely dead. If no distinguishing evidence can be found, no definite status of life before the bomb can be fixed.

Doubtless I have left out an interpretation or two from this list; but in any case, the short answer is "we don't know".

A: I have to go with the comment of Peter Shor here. There is a collapse, but it's not to the dead/alive-prior-to-bombing basis, but to the basis defined by the configuration of radioactive dust.
This immediately suggests a modification of this thought experiment making it delayed choice. Wait a long time after the cat is poisoned or not, without bombing or opening the box and taking a peek. Then, the experimenter makes an arbitrary choice, perhaps randomly, as to whether to open the box or bomb it. If he opens the box, the collapse is to the dead/alive preferred basis, or as I like to call it, preferred projectors because it is really into an orthonormal set of eigenspaces, not vectors. And I have to add, decoherence requires coarse graining, and so, it will always be preferred projectors. If he chooses to bomb it, the collapse is to some radioactive dust projectors. Here comes the interesting part. Both sets of projectors don't commute. This is a death blow strike to the many worlds interpretation. If MWI is right, which projectors did the cat split into before the experimenter made the choice? The choice of preferred projectors is always contextual.
If you are interested, read more about unhappening by the physicists Susskind and Bousso.

A: The wave function represents our knowledge of the state of the system not the state of the system itself.
What every schoolboy knows about Schrodinger's cat is often inaccurate and obtained from popular literature; poorly explained and misleading.

A: Quantum Darwinsim can answer your question. The focus is turned from the system, here the cat or the box to the environment. It is not that a copy of the information is stored in the environment. Rather, multiple redundant copies are stored in many fragments of the environment, each of which have become decoupled from each other and the system.
You want something better than a mere box. Boxes are not soundproof and multiple copies of the air vibrations of the live cat walking about and meowing and purrrrrrrrring will spread all over to the environment in all directions. Anyone can sample just a little of the soundwaves, some fragment, and learn the cat is alive. No, you have to put the cat in a deep underground bunker. Although come to think about it, if no one is in the room where the box is in, and there are no video cameras or tape recorders, the sound waves would reflect off the walls a couple of times, then get absorbed, and all the fragmented copies rethermalize. If a tree falls in a forest and no one hears it, did it make a sound?  You also want the bomb to be so good that not even the best forensic experts can figure out what went on. You need a nuclear bomb.
Quantum evolution is unitary. The information about the cat always survives in some form, but highly scrambled. The question is if information is stored in easily extractible form in multiple copies in small fragments. Multiple copies for error correction and easy access by multiple independent observers. Intersubjective agreement as the basis for objectivity. If the information is so scrambled that you need to sample a significant fraction of the environment followed by fine tuned computations to extract the information, that is not classical. It is not decohered.
Think of a black hole. Suppose you throw the box into a black hole. The evidence will leak out in the form of Hawking radiation, but Don Page had shown you need to collect half of the Hawking environmental radiation before you can even extract it in principle, but not in practice. You will not find multiple copies stored in multiple small fragments. There can be no decoherence. It is not about the cat. It is about what multiple fragments of the environment knows about the cat.

A: What a metaphysical question. Are there any empirically measurable differences between the following three cases?
the cat never collapsed
the cat collapsed into aliveness
the cat collapsed into death
By stipulation, no evidence whatsoever remains after the bomb went off. In practical terms, this means all three scenarios give exactly the same empirical predictions. Any interference between the live and dead cat states will be so suppressed by decoherent phase cancellations as to be undetectable. For All Practical Purposes, FAPP, your question is totally irrelevant. Do you really think you can have access to the wave function and its values and you can go around and poke at it to find out the answer? Now go out and do something practical and make a practical calculation.

A: It's true, decoherence will prevent us from interfering the cat with itself. But that's totally missing the point. We're not even making any pretense of interfering the cat. We're blowing up the cat, for goodness sake!
Get this straight! In the "quasiclassical" basis, off-diagonal terms are exponentially suppressed. But get this too: There are also tons of other bases where off-diagonal entries are also highly suppressed. There is nothing special about the "quasiclassical" basis in this respect. Read your Dowker and Kent.
The issue isn't whether or not interference terms are highly suppressed. They are. The issue is there are way way too many bases where this is the case. There's nothing special about "quasiclassical" bases, you know. Under the "democratic" "egalitarian" principle, any set of consistency histories satisfying the consistency conditions is "equally" valid. Picking out the "quasiclassical" basis in advance to analyze the system is like looking up the answers to a homework problem in advance, and only then writing down a solution contrived to get that answer. That's considered CHEATING!

A: There is a variant of the moveable Heisenberg cut, except that the cut lies in time, and not space or scale. Basically, you might think the collapse happened at a certain time, like during the detection by the Geiger counter, or when the cat's brain registers the cyanide, whatever, but you can always push the cut farther and farther forward in time. It shouldn't make any difference. You can always assume the collapse in the far future "retroactively" fixes the outcome at earlier times via a "delayed choice" mechanism if you wish. How far forward in time can you push the cut? Right until the Ultimate Observer's Mind and/or the end of time.
And in fact, if you are scrupulous, you have the obligation to push the cut as far forward in time as you can as there is always a tiny nonzero probability (exponentially suppressed is still nonzero) that recoherence might happen in the future.
In the OP's example, information about the cat leaks outward from the box in fragments which aren't picked up by any human or recording device or forensic analyst. Eventually, all of these information fragments leave Earth and travel outward in space until they cross the cosmological horizon, never to be accessible by the Ultimate Observer. So, if the Ultimate Observer's Mind knows nothing about the cat, it doesn't exist.
According to Copenhagenists, nothing becomes real until it reaches the Mind of the One and Only Ultimate Observer. Unless the poor mortal cat happens to be the One and Only Ultimate Observer, the cat didn't exist after it was sealed in the box. Out of sight, out of mind!

A: It helps to look at your question from the point of view of Consistent Histories. Some time back, Dowker and Kent made a startling discovery couched in mathematical terms. However, in a more handwavy manner, we are not allowed to ask about the specifics of dinosaurs roaming 65 million years ago based upon what little fossil records we have remaining.
A brief overview of Consistent Histories first; Von Neumann postulated that the wave function collapes according to some set of orthonormal projectors adding up to the identity operator. Consistent Histories tries to extend this to a history of such sets of orthonormal projectors at different times, which do not necessarily commute with each other. So, we take the time ordered product of operators to get histories.
$C_{i_1 \cdots i_N} \equiv P_{i_1,1} \cdots P_{i_N,N}$
Consistent Histories ought to be weakly consistent so that for different histories, $i \neq j$, $Tr[ C_i \rho C_j^\dagger ] \approx 0$. Basically, off-diagonal entries are exponentially suppressed compared to diagonal entries.
Let $C_{i_2,2}$ be some current present day coarse-grained history available to us, including fossil records and modern day descendents of dinosaur species, plus whatever else you might also want to add. Let $C_{i_1,1}$ be some specific dinosaur history, like whether a dinosaur roamed at some particular area at some specific day 65 million years ago. Of course, if you make the history sufficiently coarse-grained to the mere existence or nonexistence of dinosaurs 65 million years ago, barring some massive conspiracy, we get some weakly consistent histories. On the other hand, what we are interested in is some further refinement of it. Let $C_{j_1,1}$ be an alternative dinosaur history. Precisely because very few records of dinosaur history are available from our present accessible coarse-grained history, we come to the conclusion that $Tr [ C_{i_2,2}C_{i_1,1} \rho C_{j_1,1}^\dagger C_{i_2,2}^\dagger ]$ is not weakly consistent. In some hypothetical alternate universe where dinosaurs were intelligent and developed a writing system and some very advanced technology to store their writing in time capsules which can last reliably for 65 million years, and some dinosaur journalist jotted down his observations in the time capsule, then weak consistency becomes possible. Alas, dinosaurs were very dumb.
How can this be? When the founders of Consistent History, Hartle and Gell-Mann were confronted with this, they claimed they knew that all along, but they never stressed that. This is their dirty little secret of Consistent Histories, a skeleton in their closet.
Their resolution was a copout. They introduced the notion of incompatible realms. There is the present day realm which only includes present day history and no specific dinosaur history, and another dinosaur realm with only dinosaur history but no human history. Each realm in itself is weakly consistent but there can be no refinement including both realms. They are dumping the objective reality of dinosaur history down the drain.
There is also another realm combining quasiclassical present histories with crazily mixed projection bases for dinosaurs scrambled like a spaghetti, mashed up far worse than a superposition of live and dead cats. No one in their right might will take it seriously.
In general, the past does not commute with the present. Neither does the present commute with the future. The exception is when detailed records from an earlier time survive intact until the latter time. The past belongs to a distinct realm from the present.
What does this have to do with Schrödinger's cat with a bomb? Destroying the evidence makes the cat's fate the same as the dinosaurs. Incompatible realms. A cat realm including the quasiclassical coarse-grained history of the cat before the bomb exploded but not any quasiclassical coarse-grained history after that, and an outsider realm including the quasiclassical history of observers after the bomb explosion but nothing about the quasiclassical history of the cat between the time the killer contraption was set and the time the bomb went off.
Incompatible realms. That is the skeleton in the closet. Which history does the wave function collapse into? Choose your realm first.


text:
Q: Bash watch text file I'm trying to make a small script which watches the latest log file in a folder and grabs the chat from the log, which i'll then display in a tmux panel but for some reason it can't find the file while it does exist
FILENAME=server_logs/$(ls -t1 server_logs | head -n 1)
watch -n3 'grep "\] " '$FILENAME' | tail -n15'

When i run the file it gives me this grep: server_logs/server_log_09_18_12.txt : No such file or directory
But if i use  watch -n3 'grep "\] " server_logs/server_log_09_18_12.txt | tail -n15' it does work.
So my question is why can't it find the file?

A:
watch -n3 'grep "] " '$FILENAME' | tail -n15'

has two sets of ' quote signs.
You want to escape the inner ' signs.

A: I found out why it didn't work, $FILENAME had some spaces at the end which caused the file not found error, so i used this:
FILENAME="${FILENAME#"${FILENAME%%[![:space:]]*}"}"   # remove leading whitespace characters
FILENAME="${FILENAME%"${FILENAME##*[![:space:]]}"}"   # remove trailing whitespace characters

Which i found at another Stackoverflow question.
Thanks for the responses.

redpajama_set_name: RedPajamaStackExchange


text:
Q: fatal error LNK1104: cannot open file 'MSVCRT.lib' I know there's a lot of question like this one, but no one of those answers help me to solve my problem. What problem? Well,  when linking, after compiling my project I receive this:

fatal error LNK1104: cannot open file 'MSVCRT.lib'

I'm using CodeBlocks under Windows 8 64-bit. Compiling with the Visual C++ 2003 Toolkit compiler, which I have installed under C:\Program Files (x86)\Visual C++ 2003 Toolkit and using a lot functions from the Windows API, which I also have installed under C:\Program Files (x86)\Windows Kits).
Searching on the internet I found some solutions like to link this library (MSVCRT.lib) under my project settings, but I definitely don't have that file. This is a project (the one in which I'm receiving this error) that I was working on about 15 days ago, and now I want to resume its development. I compiled and linked this project a lot of times, and I never got this linker error, I don't know why now I just can't link it.
Some solutions say I need to install VS.NET so the MSVCRT.lib file will be there, but I never had that installed and I was able to compile and link my project!
Any ideas on how can I solve this without installing VS.NET (also, I don't know if this is going to work)?

A: After 2 years, I finally found the solution in my case.
In CodeBlocks, under Project > Build Options > Compiler Flags, remove Multi-threaded DLL Runtime Library [/MD] and rebuild.

A: What just did it for me, was to delete the .sdf and .suo files.

A: I just ran into this using Visual Studio 2017. After trial and error, I discovered that if I put an empty or blank value in the Linker --> Input section, it would give me the error about LNK1104: cannot open file 'MSVCRT.lib'. Eventually I figured out that I should leave this value there instead.
On the Visual Studio project, right-Clicking on the project item in the Solution explorer panel (not the Solution itself, which is the topmost item), then select Properties. From there do the following:
Linker --> Input :  %(AdditionalDependencies)
This additional information might be helpful, if you got into the situation the same way I did. I was trying to compile with external .lib files. Previously I had a value in this input section like: $(ProjectDir)lib; %(AdditionalDependencies) but this lead to other problems and eventually I moved that value into:
VC++ Directories --> Library Directories : $(ProjectDir)lib; $(LibraryPath)
Note the $(LibraryPath) value will include extra values such as inherited from parents. My folder project contained a folder called 'lib' which is why I had the first value there before the semicolon.

A: Follow this -> Integrating Microsoft Visual Toolkit 2003 with Code::Blocks IDE
From there

If the project you are compiling complains that it cannot find
  "msvcrt.lib" then download the .NET 1.1 SDK and add to the END of the
  Directories->Linker tab:
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\lib


text:
Q: Unable to extract large zip file after download from Amazon S3 A friend has zipped a large csv file (15GB) for me and put it on amazon s3.  Unfortunately, I am unable to extract the zipped csv file once downloaded.  At first,  I thought it was simply corrupted from the download.  I had the friend re-upload now 4 times.
The error that I get is: unsupported commpression method.   When I ran the 7z info command, the compression method on the file said 'Deflate', which seems to be the default.
I'm wondering if its simply a windows file size limitation.  I'm on Windows Server 2008 R2. I also attempted to use Zip2Fix utility to repair the zip but got an "out of memory error".
details boiled down:
zip file size : 15GB
inside zip : 1 csv file
os: Windows Server 2008 R2
transfered via S3
error: compression method not supported
Thanks in advance for any suggestions.

A: If your server is on a FAT32 partition (though very unlikely), the max filesize that you can expand is 4Gb. I would highly suggest that your friend re-uploads the file in <4Gb chunks as almost any part of the process could be 32bit-size limited.


text:
Q: Tensorflow freezes when trying to create a session in docker container I'm trying to deploy a web site for the demo using CNN.
To serve this purpose, I built a docker image with dependencies (in my case tensorflow, keras and any other miscellanies).
I managed to built the docker image. However It fails when I tested on some sample images. I found out that the problem is tensorflow can not create a session. I still can import tensorflow and other packages. Even I can run a code for building computation graph with tensorflow code
(Ex,
a=tf.constant(7)
b=tf.constant(10)
c = tf.add(a,b)
).

But it freezes whenever I try to create a tensorflow session (Ex, sess = tf.Session()).
Below is the code for building docker image.
def CNN_forward_example(self,image):

    a=tf.constant(7)
    b=tf.constant(10)
    c = tf.add(a,b)
    sess = tf.Session()
    print("I hope to see this message------------------------",c)

Expected result is to see the message "printed by print("I hope to see this message------------------------",c)".

A: Ran into a similar issue when I was using Docker. Can't find the link to the blog post but it basically recommends to set a global variable for the GRAPH.
GRAPH = tf.Graph()
# and then where you need it
with GRAPH.as_default():
    sess = tf.Session()

Here is a guide on how to use Graphs and Sessions. Here is a guide on TF serving with Docker.


text:
Q: What's the name given to the ratio $P^2/A$ for a closed figure in the Euclidean plane? Let $\mathscr{F}$ be the set of all plane, closed Euclidean figures having positive perimeter, and let $\sim$ be the similarity relation on $\mathscr{F}$.
Then, for any equivalence class $\widetilde{F} \in \mathscr{F}/
\sim$, the ratio $P^2/A$, where $P$ stands for the perimeter and $A$ for the area, is invariant over $\widetilde{F}$.
Does this ratio $P^2/A$ have a standard name?

1For example, when $\widetilde{F}$ is the class of all squares this ratio is $16$, and when $\widetilde{F}$ is the class of all circles, it is $4 \pi$.  The isoperimetric inequality theorem asserts that (1) the latter value is in fact a lower bound for the ratio, as $\widetilde{F}$ ranges over $\mathscr{F}/\sim$; and (2) it is not attained by any other equivalence class in $\mathscr{F}/\sim$.  On the other hand, it's not hard to see that this ratio has no upper bound.

A: The Encyclopedia of Math calls it isoperimetric ratio, and Google finds quite a few articles using that phrase for it.


text:
Q: how can I pass event through @selector in NSTimer //I need to send event trough @selector([move:event])
thanks in advance.
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
    moveTimer = [NSTimer scheduledTimerWithTimeInterval:0.05 target:self selector:@selector(move:) userInfo:nil repeats:YES];
}

//my move function
- (void)move:(UIEvent *)event {
    UITouch *touch = [[event allTouches] anyObject];
    CGPoint location = [touch locationInView:touch.view];
    if (location.x > myImageView.center.x){
        [UIView animateWithDuration:0.001 animations:^{
            myImageView.center = CGPointMake(myImageView.center.x+5, myImageView.center.y);
        }];
    }
    else if (location.x < myImageView.center.x){
        [UIView animateWithDuration:0.001 animations:^{
            myImageView.center = CGPointMake(myImageView.center.x-5, myImageView.center.y);
        }];
    }
    if (location.y < myImageView.center.y){
         [UIView animateWithDuration:0.001 animations:^{
            myImageView.center = CGPointMake(myImageView.center.x, myImageView.center.y-5);
        }];
    }
    else if (location.y > myImageView.center.y){
        [UIView animateWithDuration:0.001 animations:^{
            myImageView.center = CGPointMake(myImageView.center.x, myImageView.center.y+5);
        }];
    }
}

A: You cannot pass data through a selector. A selector is simply the name of a method, not a call to it. When used with a timer, the selector you pass should accept one argument, and that argument will be the timer which caused it. However, you can pass data to the called method using the userInfo parameter. You pass the event in that parameter, and retrieve it using the userInfo method on the timer.
moveTimer = [NSTimer scheduledTimerWithTimeInterval:0.05 target:self
                                           selector:@selector(move:)
                                           userInfo:event repeats:YES];

- (void)move:(NSTimer *)theTimer {
    UIEvent *event = [theTimer userInfo];
    ...

A: If you want to use a timer to trigger a method that takes parameters, use -scheduledTimerWithTimeInterval:invocation:repeats: with an appropriate instance of NSInvocation in place of one of the methods that take selectors.
That said, you're going to have to reconsider your approach. Individual UIEvent and UITouch objects have a lifetime at least as long as an entire touch sequence. Per the documentation for each of those classes, you shouldn't retain them or otherwise use them outside of the method where you receive them. If you need to save the information from either of those objects for later use, you should copy the information you need into your own storage.


text:
Q: Pong Game Score Keeping in Pygame Here is the code segment from my program which controls the score keeping. The problem is that it adds 1 to the score each time it touches the right wall as well as the left paddle, and it also subtracts a point whenever it touches the left wall. When all it should be doing is adding one every time it touches the right wall.
    FRAMECLOCK = pygame.time.Clock() #set frame rate
    SURFACEDISPLAY = pygame.display.set_mode((WIDTH,HEIGHT)) #Clear the surface on refresh
    pygame.display.set_caption ('Pong') #title of window

    ballX = WIDTH/2 - PLACEMENTMARKER/2 #ball position on X axis at the start
    ballY = HEIGHT/2 - PLACEMENTMARKER/2 #ball position on Y axis at the start
    playerOnePosition = (HEIGHT - PADDLESIZE) /2 #paddle one position at the start
    playerTwoPosition = (HEIGHT - PADDLESIZE) /2 #paddle two position at the start
    score = 0

    #Sets starting position movement
    ballDirX = -1 #-1 = left 1 = right
    ballDirY = -1 # -1 = up 1 = down

    paddle1 = pygame.Rect(PADDLEDISTANCE,playerOnePosition, PLACEMENTMARKER,PADDLESIZE) #paddle one drawing
    paddle2 = pygame.Rect(WIDTH - PADDLEDISTANCE - PLACEMENTMARKER, playerTwoPosition, PLACEMENTMARKER,PADDLESIZE) #paddle two drawing
    ball = pygame.Rect(ballX, ballY, PLACEMENTMARKER, PLACEMENTMARKER)#ball drawing

    Pong() #calling the game surface in main function
    paddles(paddle1) #calling paddle 1 main function
    paddles(paddle2) #calling paddle 2 in main function
    pongball(ball) #calling ball in main function

    while True: #game Loop
        for event in pygame.event.get(): #Checks to see if program is quit
            if event.type == QUIT:
                pygame.quit()
                sys.exit() #system quit

        Pong() #Otherwise it performs these functions
        paddles(paddle1)
        paddles(paddle2)
        pongball(ball)

        displayScore(str(score))

A: The checkscore function was resetting the score, not subtracting it. It is also explicitly adding one when you hit it with the paddle.
I've modified the function to only add when hitting the right wall and not subtracting upon hitting the left:
def checkscore (paddle1, ball, score, ballDirX):
    #this is where the program resets after a point is scored
    if ball.right == WIDTH - PLACEMENTMARKER:
        score += 1
        return score
    #no points scored, return score unchanged
    else: return score

just substitute this function with the current checkscore() and everything should work
I'm assuming you've copied at least a large majority of this, make sure you read through everything thoroughly and try to understand each bit.


text:
Q: Superset Bar Chart Tooltip/Hover not displaying enter image description here
I am using Superset in my application for visualization. I am facing some issues with the bar chart. It does not display the hover/tooltip value of the bar chart. It will display the tooltip value when I refresh the page.I have attached the screenshots.
please help me out with the solution
[1]: https://i.stack.imgur.com/1CzyA.png


text:
Q: Integrating two variables for $L^1$ function Suppose $f,g\in L^1(\mathbb{R})$. Is it necessarily true that $$\int_\mathbb{R}\int_\mathbb{R}|f(x-y)g(y)|dxdy=\int_\mathbb{R}|f(x)|dx\int_\mathbb{R}|g(y)|dy.$$

A: Yes, it is. The result is immediate from Fubini's theorem and the translation-invariance of Lebesgue measure, for we have
\begin{align*}
\int_{\mathbb R} \int_{\mathbb R} |f(x - y) g(y)| dx dy &=\int_{\mathbb R} |g(y)| \int_{\mathbb R} |f(x - y)| dx dy \\
&= \int_{\mathbb R} |g(y)| \int_{\mathbb R} |f(x)| dx dy \\
&= \|g\|_1 \|f\|_1
\end{align*}


text:
Q: NestedScrollView not scrolling smoothly with multiple EditText In android NestedScrollView with multiple EditText and Spinners in my layout. NestedScrollView not scrolling smoothly. Intercepting Touch Event with EditText. How i can fix this issue please help
MyLayout.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:fitsSystemWindows="true" >

<android.support.design.widget.AppBarLayout
    android:id="@+id/app_bar_layout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:fitsSystemWindows="true"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" >

    <android.support.design.widget.CollapsingToolbarLayout
        android:id="@+id/collapsing_toolbar"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_scrollFlags="scroll|exitUntilCollapsed"
        android:fitsSystemWindows="true"
        app:contentScrim="?attr/colorPrimary"
        app:expandedTitleMarginEnd="64dp"
        app:expandedTitleMarginStart="48dp" >

        <ProgressBar
            android:id="@+id/progressBar"
            style="?android:attr/progressBarStyleSmall"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center" />

        <ImageView
            android:id="@+id/image"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:layout_collapseMode="parallax"
            android:contentDescription="@null"
            android:fitsSystemWindows="true"
            android:minHeight="100dip"
            android:scaleType="centerCrop" />

        <ImageView
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            app:layout_collapseMode="pin"
            android:background="@drawable/trans_bg_black"
            android:contentDescription="@null" >
        </ImageView>

        <View
            android:layout_width="match_parent"
            android:layout_height="@dimen/action_set_background"
            android:layout_gravity="bottom"
            android:background="@drawable/scrim_bottom" />

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            app:layout_collapseMode="pin"
            app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
    </android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>

<android.support.v4.widget.NestedScrollView
    android:id="@+id/nestedScroll"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_gravity="fill_vertical"
    android:layout_marginBottom="?attr/actionBarSize"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    android:background="@color/white"
    android:fillViewport="true"
    android:scrollbars="none" >

    <!-- <FrameLayout -->
    <!-- android:id="@+id/frame_containeredit" -->
    <!-- android:layout_width="match_parent" -->
    <!-- android:layout_height="match_parent" -->
    <!-- android:background="@color/white" > -->
    <!-- </FrameLayout> -->

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:focusable="true"
        android:focusableInTouchMode="true"
        android:orientation="vertical"
        android:padding="@dimen/splash_sub_header_text_size" >

        <HorizontalScrollView
            android:id="@+id/horizontalScrollView"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" >

            <LinearLayout
                android:id="@+id/linearMoreImages"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:padding="@dimen/simple_edit_text_padding" >
            </LinearLayout>
        </HorizontalScrollView>

        <View
            style="@style/HorizontalLineWhite"
            android:layout_marginTop="8dip" />

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="15dip"
            android:baselineAligned="true"
            android:orientation="vertical" >

            <TextView
                android:id="@+id/txtRoomName"
                style="@style/SimpleTextViewMediumStyleFillParent"
                android:text="@string/room_name"
                android:textColor="@color/black" />

            <EditText
                android:id="@+id/edtRoomName"
                style="@style/SimpleEditTextStyle"
                android:layout_marginTop="3dip"
                android:padding="8dip"
                android:textColor="@color/black" />

            <TextView
                android:id="@+id/txtSqureFeetCaption"
                style="@style/SimpleTextViewMediumStyleFillParent"
                android:layout_marginTop="10dip"
                android:text="@string/square_feet"
                android:textColor="@color/black" />

            <EditText
                android:id="@+id/edtSqureFeet"
                style="@style/SimpleEditTextStyle"
                android:layout_marginTop="3dip"
                android:inputType="number"
                android:padding="8dip"
                android:textColor="@color/black" />

            <TextView
                android:id="@+id/txtRoomTypeCaption"
                style="@style/SimpleTextViewMediumStyleFillParent"
                android:layout_marginTop="10dip"
                android:text="@string/room_type"
                android:textColor="@color/black" />

            <Spinner
                android:id="@+id/spnRoomType"
                style="@style/SimpleEditTextStyle"
                android:layout_marginTop="3dip"
                android:background="@drawable/rect_white_filled"
                android:textColor="@color/black" />

            <TextView
                android:id="@+id/txtNotesCaption"
                style="@style/SimpleTextViewMediumStyleFillParent"
                android:layout_marginTop="10dip"
                android:text="@string/notes"
                android:textColor="@color/black" />

            <EditText
                android:id="@+id/edtNotes"
                style="@style/SimpleEditTextStyle"
                android:layout_marginTop="3dip"
                android:gravity="top|left"
                android:lines="2"
                android:padding="8dip"
                android:textColor="@color/black" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="20dip"
            android:baselineAligned="true"
            android:orientation="horizontal"
            android:visibility="gone" >

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginRight="5dip"
                android:layout_weight="1"
                android:orientation="vertical" >

                <TextView
                    android:id="@+id/txtTotalItemsCaption"
                    style="@style/SimpleTextViewMediumStyleFillParent"
                    android:paddingBottom="8dip"
                    android:text="@string/total_items"
                    android:textColor="@color/black" />

                <EditText
                    android:id="@+id/edtTotalItems"
                    style="@style/SimpleEditTextStyle"
                    android:background="@android:color/transparent"
                    android:enabled="false"
                    android:textColor="@color/black" />
            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="5dip"
                android:layout_weight="1"
                android:orientation="vertical" >

                <TextView
                    android:id="@+id/txtTotalItemsValueCaption"
                    style="@style/SimpleTextViewMediumStyleFillParent"
                    android:paddingBottom="8dip"
                    android:text="@string/total_items_value"
                    android:textColor="@color/black" />

                <EditText
                    android:id="@+id/edtTotalItemsValue"
                    style="@style/SimpleEditTextStyle"
                    android:background="@android:color/transparent"
                    android:enabled="false"
                    android:textColor="@color/black" />
            </LinearLayout>
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="20dip"
            android:baselineAligned="true"
            android:orientation="horizontal"
            android:visibility="gone" >

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginRight="5dip"
                android:layout_weight="1"
                android:orientation="vertical" >

                <TextView
                    android:id="@+id/txtRoomAddedonCaption"
                    style="@style/SimpleTextViewMediumStyleFillParent"
                    android:paddingBottom="8dip"
                    android:text="@string/room_added_on"
                    android:textColor="@color/black" />

                <TextView
                    android:id="@+id/txtRoomAddedon"
                    style="@style/SimpleTextViewMediumStyleFillParent"
                    android:textColor="@color/black" />
            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="5dip"
                android:layout_weight="1"
                android:orientation="vertical" >

                <TextView
                    android:id="@+id/txtLastModifiedonCaption"
                    style="@style/SimpleTextViewMediumStyleFillParent"
                    android:paddingBottom="8dip"
                    android:text="@string/last_modified_on"
                    android:textColor="@color/black" />

                <TextView
                    android:id="@+id/txtLastModifiedon"
                    style="@style/SimpleTextViewMediumStyleFillParent"
                    android:textColor="@color/black" />
            </LinearLayout>
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:orientation="horizontal" >

            <TextView
                android:id="@+id/txtSave"
                style="@style/SimpleTextViewStyle"
                android:layout_margin="10dip"
                android:background="@drawable/round_corner_purple_border_white"
                android:gravity="center"
                android:minWidth="150dip"
                android:padding="8dip"
                android:text="@string/save"
                android:textColor="@color/white" />
        </LinearLayout>
    </LinearLayout>
</android.support.v4.widget.NestedScrollView>


text:
Q: When to use position sticky with css? I've never used the position: sticky; and found this on MDN but couldn't understand that when should I use this position. Can anyone visualise this position?

A: As described in the acticle:

position: sticky is a new way to position elements and is conceptually
similar to position: fixed. The difference is that an element with
position: sticky behaves like position: relative within its parent,
until a given offset threshold is met in the viewport.

It is basically the same as position: fixed but the sticky element can't go out of the parent element. With the offset position of top you set a property of when the sticky element should scroll with the page. So for example when the top is set to 10px it will scroll with the page when top is 10px away of your window screen:
.sticky {
  position: -webkit-sticky;
  position: -moz-sticky;
  position: -ms-sticky;
  position: -o-sticky;
  top: 10px;
}

It has not been implented yet. However you can test this experimental property.
In chrome you can enable the enable-experimental-web-platform-features flag by just following this link:
about://flags/#enable-experimental-web-platform-features
Example page of the acticle

You can use a Jquery plugin to mimic this behaviour: stickyfill

A: From the verry same source you read about 'sticky'

sticky (This is an experimental API that should not be used in production code.)
The box position is calculated according to the normal flow (this is called the position in normal flow). Then the box is offset
  relative to its flow root and containing block and in all cases,
  including table elements, does not affect the position of any
  following boxes. When a box B is stickily positioned, the position of
  the following box is calculated as though B were not offset. The
  effect of 'position: sticky' on table elements is the same as for
  'position: relative'.

Mouse over that icon on the same page

Other references about usability :

*

*http://caniuse.com/#search=position (no sticky there)

*http://caniuse.com/#search=stic (no sticky there either)


text:
Q: dyn.load error linking a package with Rcpp I've made an R package with Rcpp, to use the methods of a library I programmed in c++.
I've R running on the last version:
R version 3.2.5 (2016-04-14)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04 LTS

I'm executing the following instruction to install my package:
> install.packages("mypackage", repos = NULL)

The package compiles well, I have the .o files of my source code, but in the linking phase I got the error:
* installing *source* package 'rbdd' ...
** libs
make: No se hace nada para 'all'.
installing to /home/sergio/R/x86_64-pc-linux-gnu-library/3.2/mypackage/libs
** R
** preparing package for lazy loading
** help
Warning: /home/sergio/R/mypackage/man/mypackage-package.Rd:27: All text must be in a section
Warning: /home/sergio/R/mypackage/man/mypackage-package.Rd:28: All text must be in a section
*** installing help indices
** building package indices
** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/home/sergio/R/x86_64-pc-linux-gnu-library/3.2/mypackage/libs/mypackage.so':
/home/sergio/R/x86_64-pc-linux-gnu-library/3.2/mypackage/libs/mypackage.so: undefined symbol: _ZN4cudd12defaultErrorENSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE
Error: loading failed
Ejecución interrumpida
ERROR: loading failed

mypackge.so is created in the src folder of my package.
I've got a Makevars file (in src, too) with the following content:
PKG_CPPFLAGS=-I./buddy-2.5/src -I./cudd-3.0.0/cudd -I./cudd-3.0.0/mtr -I./cudd-3.0.0/cplusplus -I./cudd-3.0.0/dddmp -I./cudd-3.0.0/util -I./cudd-3.0.0 -isystem /usr/include/c++/v1 -std=c++11
PKG_LIBS=-lc++ -L/lib

and my NAMESPACE file has the lines:
useDynLib(mypackage)
exportPattern("^[[:alpha:]]+")
importFrom(Rcpp, evalCpp)

Someone knows how to solve this problem?

A: I am a little concerned about
PKG_LIBS=-lc++ -L/lib

Did you really mean /lib? If it is your library, a more common place would be /usr/local/lib which is also search by default.
But, and that is a BIG but, you also need to understand what you need to do for ldconfig for the proper setup of libfoo.so, libfoo.so.$MAJOR and so on. I taught myself that many moons ago from a Linux HOWTO.
If and when that is setup right, you can link it to R via Rcpp. Otherwise maybe stick with system libraries, or package-local static libraries.  That approach will also make your package more portable.

A: The problem was I am consumming external libs, and I must compile it and execute ldconfig before compile my R library.


text:
Q: Visualizing pcAlgo object in ggdag? There's documentation here (https://www.rdocumentation.org/packages/pcalg/versions/2.7-3/topics/pc) on how to run the pc algorithm for binary data.
library(pcalg)
##################################################
## Using discrete data
##################################################
## Load data
data(gmD)
V <- colnames(gmD$x)
## define sufficient statistics
suffStat <- list(dm = gmD$x, nlev = c(3,2,3,4,2), adaptDF = FALSE)
## estimate CPDAG
pc.D <- pc(suffStat,
           ## independence test: G^2 statistic
           indepTest = disCItest, alpha = 0.01, labels = V, verbose = TRUE)
if (require(Rgraphviz)) {
  ## show estimated CPDAG
  par(mfrow = c(1,2))
  plot(pc.D, main = "Estimated CPDAG")
  plot(gmD$g, main = "True DAG")
}

I'm wondering if there's anyway I can use the pc.D object to visualize this in ggdag (https://cran.r-project.org/web/packages/ggdag/vignettes/intro-to-ggdag.html).
Is there a way?


text:
Q: How to split a section in a list? Okay so I have a list called names and there are other words in the list but this is the result of names[0]
Chen,David,M,334791530,,11Z,,16770712,,,,,,00015956753,
Chen,Peter,M,321564726,,11B,,19979810,,,,,,00012446698,
Chung,Rowan,M,32355988,,11T,,17890708,,,,,,00012127821,
Chung,Kyle,M,387638355,,10U,,19970317,,,,,,00015604870,
Fan,Mark,M,34217543,,10U,,19707713,,,,,,00015799079,

How do I split names[0] so that it comes out with just the last name, first name, and gender?
Here's the rest of my code:
file = open('CASS.txt', 'r')
f = file.readlines()
file.close()
for line in f:
    if line.find('ICS3M105')>=0:
        names = line.split()
        for name in names[0]:
            if name in range(0,1):
                print(names)

A: for line in f:
  names = line.split()
  print names[0].split(',')[0:3]

A: with open('CASS.txt', 'r') as f:
    for line in f:
        name_last, name_first, gender = line.split(',')[0:3]

Or using the csv module which will may be more reliable for upcoming tasks
import csv
with open('CASS.txt', 'r') as f:
    for row in csv.reader(f):
        name_last, name_first, gender = row[0:3]

A: >>> s = """Chen,David,M,334791530,,11Z,,16770712,,,,,,00015956753,
           Chen,Peter,M,321564726,,11B,,19979810,,,,,,00012446698,
           Chung,Rowan,M,32355988,,11T,,17890708,,,,,,00012127821,
           Chung,Kyle,M,387638355,,10U,,19970317,,,,,,00015604870,
           Fan,Mark,M,34217543,,10U,,19707713,,,,,,00015799079,"""

You can use a list comprehension to split on commas, then use slicing to index element [0] to [2] (inclusive) of the split operation.
>>> [i.split(',')[:3] for i in s.split('\n')]
[['Chen', 'David', 'M'],
 ['Chen', 'Peter', 'M'],
 ['Chung', 'Rowan', 'M'],
 ['Chung', 'Kyle', 'M'],
 ['Fan', 'Mark', 'M']]


text:
Q: How do I access an azure app service without public access through a virtual network? I've created an app service that is closed to public access with VNet integration enabled.
I've connected it to the virtual network and connected to the VPN for that network.
When I try to open the site on my browser I get the following:

What step did I miss?

A: I tried to reproduce the same in my environment and got the results like below:
I have created a virtual network, virtual network gateway, and created web app service connected to vpn like below:

Make sure to configure a private endpoint in web app like below:
In your web app -> networking -> private endpoint.

Add private endpoint integrated with private DNS zone.

In your private endpoint under settings -> DNS configuration you can check private endpoint connection like below:

Now, when I try to test my web app I got the same Error 403 as it considered a pubic network.

When I connected with my VPN client to the Azure network got results successfully like below:

Reference:
How to Use Azure Private Endpoints to Restrict Public Access to WebApps (varonis.com) by Neeraj kumar


text:
Q: React native losing performance while running So I'm working on a react native app, and whenever I start the app it is running just fine with about 60fps. But for some reason whenever the app just runs for a while, both the UI and the JS thread start dropping frames considerably until maybe about 6 to 7 fps. If I say running, I mean literally just having it open while not giving any inputs or controlling it in any way. I have run it through the android studio profiler and from what I could tell, its all looking pretty normal, I dont see any big spikes or drops in cpu load nor memory or energy consumption. The drop in performance also happens when using the app as intended.
I noticed this behaviour both on my galaxy a52s as well as in emulators (and I think a galaxy note as well, forgot the specific phone model). For compatibility reasons its running on RN 0.59.9.
Does anyone have any ideas as to what this could be?
Edit:
There are some processes that are periodically running, but the only thing thats really running continously is a map from react-native-maps. I just tested the performance while having it not rendered, and it seems like the problems with the performance come from that. Thanks for the help still.


text:
Q: Selenium Netbeans Project to runnable jar I'm developing tests using junit, maven and Selenium inside Netbeans IDE. I don't have any main class inside the src folder. I can run the tests easily from the IDE, but I'm trying to pack all of them into one jar file (so I can later use with linux cron and schedule daily tests). I've searched around the web but so far my search hasn't been successful. Can anyone point me in some enlightment path please?

A: Add a class in your project that contains the main function and accepts test class names as parameter.
class RunTest
{
    public static void main(String args[])
    {
        // Run the tests contained in the classes named in the args.
        org.junit.runner.JUnitCore.main(args);
    }
}

Now create the jar using maven including all the dependancies in pom.xml. you will be able to run tests through jar by passing test class names
for more information read this


text:
Q: Where to post free-time job offers? I'm part of a small browser game where all team members including developers are free time "workers" without getting money. We are in need of a 3D graphic developer for several months now but didn't have any luck with postings in (german) graphics forums or with flyers at some universities. Therefore I thought of posting a "job announcement" in the Stack Exchange network.
It is at this point that I am unsure as to how to proceed. Where is a good place to search for people like students or pupils (and of course other people who want to help for fun) in the network? And is there such a place at all?
My first thought was Careers, but I noticed that it's a place for real paid jobs and the prices are to expensive for a small free-time game like we are. Another thought was Graphic Design, but I didn't want to risk posting there because it seems to be the Stack Overflow of graphic design. Same for Game Development (aside from the fact that game development aims more for game mechanisms in my opinion than programming or graphics).
Is there a place to post such job announcements in the Stack Exchange network or is Stack Exchange only suitable for 'real' questions?

A: You could get some attention by the SE community promotion ads, that is for open source projects that get free attention for their contribution to the community.
I think though, that you need a neat open source project to get there, but it might be worth a try.
For what the SE sites concerns: there is no site suitable for this.

A: Stack Exchange is a lot of things, but I fear a competitor to Craigslist it is not.
In other words, yes, it is "only suitable for 'real' questions." Your thinking that Graphic Design is the "Stack Overflow of graphic design" is pretty well-founded, since most of the principles of Stack Overflow do follow across the entire network, and with pretty good reason.
Careers is an awesome choice, but I recognized that you've already thought about that and ruled it out for price reasons. Beyond that, I fear there just won't be any good choice.
You might try asking on some per-site metas about their rules for chat, but realistically I doubt that most will allow anything there, either. A post like you're talking about could be considered somewhat spammy, so it's unlikely to be well-received.
In general with stuff like this, think of how the site would feel if everyone started doing it.


text:
Q: Possible for pandas dataframe to be rendered in a new window? We all love using pandas and how the dataframe shows us a snippet of the data. However within the ipython notebook, sometimes it is difficult to view all the data especially if it contains too many columns.
Was just wondering if there is an option to view the dataframe in a new window like Matplotlib when it renders its graph.

A: You can create a temporary file containing HTML of the whole table, and then use the webbrowser module to open in. It would probably be best to simply create a function for displaying data frames in a new window:
import webbrowser
import pandas as pd
from tempfile import NamedTemporaryFile

def df_window(df):
    with NamedTemporaryFile(delete=False, suffix='.html') as f:
        df.to_html(f)
    webbrowser.open(f.name)

df = pd.DataFrame({'a': [10, 10, 10, 11], 'b': [8, 8 ,8, 9]})
df_window(df)

Edit: In my answer here I show how to display a table in a new window with pagination, search, sort and other cool stuff using JQuery+DataTables.


text:
Q: How can I execute all commands in crontab subsequently? Consider a complicated crontab of +100 lines where a lot of scripts are run subsequently to poll & process messages from different clients.
Upon reboot of the server, I trigger some scripts of the most important clients to run immediately (copy / paste).
However, a one-liner to process all crontab-entries would greatly help.
All scripts reside in /opt/, so all lines look like:
m h  dom mon dow     /opt/XXXXXX/YYYYY/ZZZZZ.sh >/dev/null 2>&1

In m, h & dow "/" & "-" are also sometimes used, f.e. :
*/3 5-21 * * 1-5     /opt/XXXXXX/YYYYY/ZZZZZ.sh >/dev/null 2>&1
*/5 0-1,5-23 * * *   /opt/XXXXXX/YYYYY/ZZZZZ.sh >/dev/null 2>&1
25 2 * * 7           /opt/XXXXXX/YYYYY/ZZZZZ.sh >/dev/null 2>&1

crontab -l | grep -v "#" | wc -l
129

T.I.A.
Jord

A: Perhaps you are looking for the run-parts command,
which takes a directory as parameter and will run every executable or script
in this directory.
For example :
run-parts /etc/cron.daily

A: You already have the makings of an answer in your question.
If you modify your crontab line to:
crontab -l | grep -v "#" | grep -o '/opt/.*$' > cron.tmp

then cron.tmp will contain all the commands you need to run. You can run it as is with . ./cron.tmp, or you can make it executable and run it direct with chmod +x cron.tmp && ./cron.tmp.
If you want to avoid a temporary file, you can use:
crontab -l | grep -v "#" | grep -o '/opt/.*$' | while read l; do eval $l; done

You need to use eval so that the redirections in the commands will be acted on.
Note that you could combine the two grep runs into a single sed substitution:
crontab -l | sed -n 's=^[^#]*\(/opt/.*$\)=\1=p' | while read l; do echo eval $l; done

A:
However, a one-liner to process all crontab-entries would greatly help.

Make a script that does this, then call it from cron's @reboot:
#!/bin/bash
for script in /opt/XXXXXX/YYYYY/*.sh; do
 $script
 done

If you have to recurse directories:
#!/bin/bash
find /opt/XXXXXX/ -name '*.sh' -type f -exec '{}' \;

Only have certain scripts you want to run, but a bunch of them?
Do this for each such script:
ln -s /opt/XXXXXX/YYYYY/whatever.sh /opt/run-at-reboot/

Then call this from cron's @reboot:
#!/bin/bash
for script in /opt/run-at-reboot/*.sh; do
 $script
 done


text:
Q: Display Children and Parent Records in Visualforce Page I have a simple VF page displaying parent records just fine, but I cannot get the syntax perfect to display related child records. There are only 2 child records per parent records.

<apex:includeScript value="{!$Resource.UtilJS}" />
<apex:form >
<apex:pageBlock >
   <apex:pageMessages />
<apex:pageBlock >

     //  Note: All modifications made on the page will be lost if
     //  Return button is clicked without clicking the Save button first.

   </apex:pageBlock>
   <apex:pageBlockButtons >
      <apex:commandButton value="Save" action="{!save}"/>
      <apex:commandButton value="Return" action="{!cancel}"/>
  </apex:pageBlockButtons>
  <apex:pageBlockTable value="{!selected}" var="a" id="table">
      <apex:column headerValue="Name">
         <apex:inputField value="{!a.name}"/>
      </apex:column>
      <apex:column headerValue="Hierarchy">
        <apex:inputField value="{!a.Type__c}"/>
     </apex:column>
     <apex:column headerValue="Status">
        <apex:inputField value="{!a.Status__c}"/>
     </apex:column>
 </apex:pageBlockTable>

A: The syntax for accessing the child records (assuming they've been queried in as a sub-select from your main records) is fairly simple.
Let's assume your parent object is called Custom_Obj__c, the child records are called Child_Obj__c, and the relationship between them is called children__r. In this case, your controller should query in the main records with something like
[SELECT Id, Name, (SELECT Id, name, other_field__c from children__r) FROM Custom_Obj__c];

Then on the VF side, you'd want to use a repeat (or another table) to loop over {!a.children__r}. Each row of this iteration will be one of the Child_Obj__c records.
<apex:pageBlockTable value="{!selected}" var="a" id="table">
  <apex:column headerValue="Name">
     <apex:inputField value="{!a.name}"/>
       <apex:repeat value="{!a.children__r}" var="child" >

<apex:inputField value="{!child.name}" />
       </apex:repeat>
  </apex:column>
  <apex:column headerValue="Hierarchy">
    <apex:inputField value="{!a.Type__c}"/>
       <apex:repeat value="{!a.children__r}" var="child" >

<apex:inputField value="{!child.some_other_field__c}" />
       </apex:repeat>
 </apex:column>
 <apex:column headerValue="Status">
    <apex:inputField value="{!a.Status__c}"/>
 </apex:column>


text:
Q: How to use MediaPlayer in Android In my application I want use MediaPlayer in Recyclerview and I have 2 viewType of viewholder adapter.
I write below codes, but after run application and click on play button show me force close error!
ViewHolder codes:
class WhiteViewHolder internal constructor(
    whiteBinding: ItemChatWhiteBinding, private val context: Context, private val mediaPlayer: MediaPlayer
) : RecyclerView.ViewHolder(whiteBinding.root), SeekBar.OnSeekBarChangeListener {

    private val binding: ItemChatWhiteBinding = whiteBinding

    private var myHolder: WhiteViewHolder? = null
    private val seekBarUpdater by lazy { SeekBarUpdater() }
    private var currentPlayingPosition = -1

    @SuppressLint("SetTextI18n")
    fun bindData(item: ResponseChatList.Data.Result) {
        binding.apply {
            //Media
            myHolder = this@WhiteViewHolder
            if (bindingAdapterPosition == currentPlayingPosition) {
                updatePlayingView()
            } else {
                updateNonPlayingView()
            }
            //Files
            if (item.chatFile != null) {
                fileVisibilityMode(item.chatFile.type!!)
                whiteFileLay.isVisible = true
                when (item.chatFile.type) {
                    VOICE -> {
                        whiteVoiceBtn.setOnClickListener {
                            if (bindingAdapterPosition == currentPlayingPosition) {
                                if (mediaPlayer != null) {
                                    if (mediaPlayer!!.isPlaying) {
                                        mediaPlayer!!.pause()
                                    } else {
                                        mediaPlayer!!.start()
                                    }
                                }
                            } else {
                                currentPlayingPosition = bindingAdapterPosition
                                if (mediaPlayer != null) {
                                    if (myHolder != null) {
                                        updateNonPlayingView()
                                    }
                                    mediaPlayer!!.release()
                                }
                                myHolder = this@WhiteViewHolder
                                playSound(fileUrl(item.chatFile.id!!))
                            }
                            if (mediaPlayer != null) {
                                updatePlayingView()
                            }
                        }
                    }
                }
            } else {
                whiteFileLay.isVisible = false
            }
        }
    }

    private fun fileUrl(id: Int): String {
        return "${BASE_URL}core/shared/files/$id/downloads?token=${userToken.replace("Bearer ", "")}"
    }

    //Voice
    private fun playSound(url: String) {
        //mediaPlayer = MediaPlayer()
        mediaPlayer.setDataSource(url)
        mediaPlayer.prepare()
        mediaPlayer.setOnCompletionListener { releaseMediaPlayer() }
        mediaPlayer.start()
    }

    private fun releaseMediaPlayer() {
        if (myHolder != null) {
            updateNonPlayingView()
        }
        mediaPlayer?.release()
        //mediaPlayer = null
        currentPlayingPosition = -1
    }

    override fun onProgressChanged(p0: SeekBar?, p1: Int, p2: Boolean) {
        if (p2)
            mediaPlayer?.seekTo(p1)
    }

    override fun onStartTrackingTouch(p0: SeekBar?) {}

    override fun onStopTrackingTouch(p0: SeekBar?) {}

    inner class SeekBarUpdater : Runnable {
        override fun run() {
            if (myHolder != null && mediaPlayer != null) {
                binding.whiteVoiceProgress.progress = mediaPlayer!!.currentPosition
                binding.whiteVoiceProgress.postDelayed(this, 100)
            }
        }
    }

    private fun updateNonPlayingView() {
        binding.whiteVoiceProgress.removeCallbacks(seekBarUpdater)
        binding.whiteVoiceProgress.isEnabled = false
        binding.whiteVoiceProgress.progress = 0
        binding.whiteVoiceBtn.setImageResource(R.drawable.ic_play)
    }

    private fun updatePlayingView() {
        binding.whiteVoiceProgress.max = mediaPlayer!!.duration
        binding.whiteVoiceProgress.progress = mediaPlayer!!.currentPosition
        binding.whiteVoiceProgress.isEnabled = true
        if (mediaPlayer!!.isPlaying) {
            binding.whiteVoiceProgress.postDelayed(seekBarUpdater, 100)
            binding.whiteVoiceBtn.setImageResource(R.drawable.ic_pause)
        } else {
            binding.whiteVoiceBtn.removeCallbacks(seekBarUpdater)
            binding.whiteVoiceBtn.setImageResource(R.drawable.ic_play)
        }
    }
}

Error logs:

java.lang.IllegalStateException
    at android.media.MediaPlayer.nativeSetDataSource(Native Method)
    at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1260)
    at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1247)
    at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1212)
    at com.myapp.holders.WhiteViewHolder.playSound(WhiteViewHolder.kt:173)
    at com.myapp.holders.WhiteViewHolder.bindData$lambda-3$lambda-2(WhiteViewHolder.kt:127)
    at com.myapp.holders.WhiteViewHolder.$r8$lambda$8dQ74w1DCqyApwY7CuInHCptTG8(Unknown

Source:0)
at com.myapp.holders.WhiteViewHolder$$ExternalSyntheticLambda1.onClick(Unknown
Source:4)

Show me error for this line: mediaPlayer.setDataSource(url)
Adapter codes:
class ChatAdapterNew constructor(
    private val context: Context, val items: MutableList<Result>
) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {

    //Types
    private val viewTypeBlue = 1
    private val viewTypeWhite = 2
    private lateinit var mediaPlayer: MediaPlayer

    init {
        mediaPlayer = MediaPlayer()
    }

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
        return if (viewType == viewTypeBlue) {
            BlueViewHolder(
                ItemChatBlueBinding.inflate(LayoutInflater.from(parent.context), parent, false),
                context, mediaPlayer
            )
        } else {
            WhiteViewHolder(
                ItemChatWhiteBinding.inflate(LayoutInflater.from(parent.context), parent, false),
                context,mediaPlayer
            )
        }
    }

    override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
        if (getItemViewType(position) == viewTypeBlue) {
            (holder as BlueViewHolder).bindData(items[position])
        } else {
            (holder as WhiteViewHolder).bindData(items[position])
        }
    }

    override fun getItemCount() = items.size

    override fun getItemViewType(position: Int): Int {
        return if (items[position].toUserId?.id == PHYSICIAN_DATA?.id) {
            viewTypeBlue
        } else {
            viewTypeWhite
        }
    }

    override fun getItemId(position: Int) = position.toLong()
}

How can I fix this problem?


text:
Q: Devise with Omniauth for facebook authentication I am running ruby 1.9.2p18, Devise (1.3.4), Rails (3.0.4) and Omniauth (0.2.6).
Currently I have my webpage doing authentication with Devise, and it works fine.
I am trying to also add facebook authentication to it. I followed the instruction from https://github.com/plataformatec/devise/wiki/OmniAuth%3a-Overview .
When I do localhost:3000 I get
LoadError (no such file to load -- omniauth/core):
  app/models/user.rb:3:in `<class:User>'
  app/models/user.rb:1:in `<top (required)>'
  config/routes.rb:6:in `block in <top (required)>'
  config/routes.rb:1:in `<top (required)>'

and if refresh the page again sometimes I get
ActionController::RoutingError (No route matches "/")

I looked and under .rvm/gems/ruby-1.9.2-p180/gems/omniauth-0.2.6 I have the directory oa-core/ but not core/ .
I would really appreciate the help, I have no idea how to debug this one!

A: 2 errors are different.
1. Error:
LoadError (no such file to load -- omniauth/core)

You need to add omniauth to your Gemfile and run 'bundle install'. If you've problem with it this Railscast might help:
Railscasts Omniauth 1
Also see 2 Devise videos on Railscasts.
2. Error:
ActionController::RoutingError (No route matches "/")

It says you haven't configured your app to have a main root. The main root is which matches "/".
- First choose which page you would like as landing page you or homepage. If you haven't created one then do it.
- Next you can find all named routes from shell by "rake routes".
- Then open config/routes.rb file and add main root by:
root :to => 'welcome#index'

substitute "welcome#index" with "your_chosen_controllers_name#chosen_method"
Don't add a named route created by Devise because it will end up with infinite loop ("stack level too deep" error).
Note that Devise wiki recommend no to use Devise if you've no prior experience with Rails. In this case I highly recommend to checkout Rails3.1 new has_secure_password? method.
HTH


text:
Q: Why can't Windows services have a GUI? I was using this feature in earlier Windows release like XP and NT. I was able to run a GUI from a Windows service. But it is not possible in the later versions.
What is the reason behind the removal of this feature? Why can't Windows services have a GUI?

A: Mainly security reasons.
As I understand it, when a windows service creates GUI controls such as a MessageBox, they were normally only seen in the session that the services runs in ie Session 0 which also used to be the first user logged on locally or by someone logging on using mstsc /admin. Hence this user would see these controls and could interact with the service.
But for security reasons, Session 0 is now reserved and the first user to log on will be given a new session and hence not see the GUI Controls.
Since this breaks quite a lot of services, for compatibility, there is a process (see this MSDN blog)  that attempts to detect if any messages are being displayed and popups with a warning 'A program running on this computer is trying to display a message' and allows you to view or ignore the message.
Microsoft have a WhitePaper on this subject which you can download from here
I would also suspect that another minor reason is because the feature was misused/misunderstood and led to bad designs. For example, I used to have an old server with a third-party service that displayed some notifications/errors using a message box rather than writing to the event log. But I never logged on locally and rarely logged in in admin mode and hence I would not see the messages.

A: Interactive services used to be possible, but the service model is that of a process that runs independently of any user. They are designed to be run unattended and therefore shouldn't need a GUI.
Interactive services haven't been available since Windows Vista so should no longer be used.
If you need to interact with the service the page I've linked to recommends creating a separate GUI application that communicates with the service through interprocess communication (IPC) of some sort - e.g. named pipes.

A: Because services are supposed to run in the background without interacting with the user; they may in fact run while no user is logged in.

A: Yes it was possible and it worked. When you logged in you got the interface of the application. It was very useful for older applications which don't have a service available but still need to run on the server. Though it was not the most stable solution. It became running as the user which could click it away or logout. That was not very nice.
Now everybody develops native services and adds an application or log to manage the service. That's a good design pattern and is now being used most of the time.
So see it more as legacy that it was possible.

A: The services are meant for un attended operations , mainly in the background.The name service itself means act as a server for some client applications or other services which consumes this service.
So MS might want now to stick to the basics and want to draw some clear distinction between services and Apps.So apps keeps the uses busy and let services serve their purpose silently.
While nail cutter is there why go for kitchen knife to cut nils?


text:
Q: Error: Status Update failed while sharing from facebook I am using below code :-
 FacebookSdk.sdkInitialize(getApplicationContext());
 callbackManager = CallbackManager.Factory.create();
        shareDialog = new ShareDialog(this);

    if (ShareDialog.canShow(ShareLinkContent.class)) {
        ShareLinkContent linkContent = new ShareLinkContent.Builder()
                .setContentTitle("Hello Facebook")
                .setContentDescription(
                        "The 'Hello Facebook' sample  showcases simple Facebook integration")
                .setContentUrl(Uri.parse("http://www.google.com"))
                .build();

        shareDialog.show(linkContent, ShareDialog.Mode.AUTOMATIC);
    }

compile 'com.facebook.android:facebook-android-sdk:4.9.0'
Any kind of help will be appreciated.

A: Had similar issue, make sure that com.facebook.sdk.ApplicationName from manifest matches Display Name from facebook dev app settings.
<meta-data android:name="com.facebook.sdk.ApplicationName"android:value="Display Name" />


text:
Q: IE6 duplication P tag content? Im testing a website of mine in IE6 and for some strange reason ie6 duplicates the content within one of my tags and pastes it at the bottom of the window as seen in the image.
I've tried adding overflow:hidden, defining height and widths to the P tag with no luck, has anybody seen a bug like this before?

A: There's a duplicate characters bug in IE6 that seems to fit what you're describing.
Check these two places:
http://www.impressivewebs.com/ie6-ghost-text-bug-with-multiple-solutions/
and
http://www.virtuosimedia.com/dev/css/ultimate-ie6-cheatsheet-how-to-fix-25-internet-explorer-6-bugs#duplicate-characters-bug
(On the second one, look for the heading 'Duplicate Characters Bug')
<!-- comments seem to break IE6! -->

A: That's the "IE6 Duplicate Characters Bug".
See: http://www.positioniseverything.net/explorer/dup-characters.html
Simple <!-- comments --> are making IE6 insane.


text:
Q: Ubuntu: Unable to change limit for number of open files for root (all users), what could be the reason? I Have an Ubuntu 16.04 server.
When I run as root, ulimit -n I get 1024.
When I run it as my user I get 65535.
But I want to make sure that all users, including root has the open files limit set to 65535.
The problem is that I've done everything I know to change it and still, for root it shows 1024.
Here are the things I've done:
root@sensu:/etc/security/limits.d# cat 90-nofiles.conf
* soft     nproc          65535
* hard     nproc          65535
* soft     nofile         65535
* hard     nofile         65535

root@sensu:/etc/security# grep nofile limits.conf
#        - nofile - max number of open files
*   soft     nofile         65535
*   hard     nofile         65535

root@sensu:/etc/security# grep file-max  /etc/sysctl.conf
fs.file-max = 65536

Ofcourse I ran sysctl -p.
The problematic process is redis:
root@sensu:/proc# grep "open files" /proc/1487/limits
Max open files            4096                 4096                 files

Looking at the redis init file:
root@sensu:/proc# grep ulimit /etc/init.d/redis-server
    ulimit -n 100001

As you see in the examples, there's no reason for this limit to be 1024 and still... it is 1024.
What could be the reason? Where is that setting that I'm missing?

A: I found the answer in this stackoverflow post.
It seems like adding:
* soft     nofile         65535
* hard     nofile         65535

Is enough when editing the limit for non-root users.
But in order to change the limits for root user as well, it must be added explicitly:
root soft     nofile         65535
root hard     nofile         65535

Now it works as intended:
root@sensu:~# ulimit -n
65535


text:
Q: How can I fix this error:System.ArgumentOutOfRangeException: 'Index was out of range.' I am trying to write a shape detection algorithm using Blobcounter with Aforge.Actually I want to get number of all pixels on the edges of the objects with this code but I could not be successfull about writing clearly and I am getting an error:
System.ArgumentOutOfRangeException: 'Index was out of range. It must not be a negative value and must be smaller than the size of the collection.
How can I fix that?
This is the code that I wrote:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Drawing;
using System.Drawing.Imaging;
using AForge.Imaging;
using System.Runtime.InteropServices;
using AForge.Math.Geometry;
using AForge;
using AForge.Imaging.Filters;
using System.Windows.Forms;

namespace blobdnm
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog sfd = new OpenFileDialog();
            sfd.Filter = "Image Files|*.bmp|All Files|*.*";
            sfd.InitialDirectory = ".";
            if (sfd.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            pictureBox1.ImageLocation = sfd.FileName;
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Bitmap bmp = new Bitmap(pictureBox1.Image);
            BitmapData BmpData1 = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);

            bmp.UnlockBits(BmpData1);

            Grayscale gfilter = new Grayscale(0.2125, 0.7154, 0.0721);

            Invert ifilter = new Invert();
            BradleyLocalThresholding thfilter = new BradleyLocalThresholding();
            bmp = gfilter.Apply(bmp);
            thfilter.ApplyInPlace(bmp);
            ifilter.ApplyInPlace(bmp);

            BitmapData BmpData2 = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);

            BlobCounterBase blobCounter = new BlobCounter();
            blobCounter.FilterBlobs = true;
            blobCounter.MinWidth = 1;
            blobCounter.MinHeight = 1;
            blobCounter.MaxWidth = 8;
            blobCounter.MaxHeight = 8;

            ColorFiltering colorFilter = new ColorFiltering();

            colorFilter.Red = new IntRange(0, 64);
            colorFilter.Green = new IntRange(0, 64);
            colorFilter.Blue = new IntRange(0, 64);
            colorFilter.FillOutsideRange = false;

            colorFilter.ApplyInPlace(BmpData2);

            blobCounter.ProcessImage(BmpData2);
            bmp.UnlockBits(BmpData2);
            Blob[] blobs = blobCounter.GetObjectsInformation();
            SimpleShapeChecker shapeChecker = new SimpleShapeChecker();
            Bitmap bmp3 = new Bitmap(bmp.Width, bmp.Height);
            Graphics g = Graphics.FromImage(bmp3);
            Pen redPen = new Pen(Color.Red, 2);
            Pen brownPen = new Pen(Color.Brown, 2);
            Pen greenPen = new Pen(Color.Green, 2);
            Pen bluePen = new Pen(Color.Blue, 2);
             for (int i = 0; i < blobs.Length; i++)
             {
                 List<IntPoint> edgePoints = blobCounter.GetBlobsEdgePoints(blobs[i]);

                 {
                     List<IntPoint> corners;

                     if (shapeChecker.IsConvexPolygon(edgePoints, out corners))
                     {

                         PolygonSubType subType = shapeChecker.CheckPolygonSubType(corners);

                         Pen pen;

                         if (subType == PolygonSubType.Unknown)
                         {
                             pen = (corners.Count == 4) ? redPen : bluePen;
                         }
                         else
                         {
                             pen = (corners.Count == 4) ? brownPen : greenPen;
                         }

                         g.DrawPolygon(pen, ToPointsArray(corners));
                     }
                 }
             }

             redPen.Dispose();
             greenPen.Dispose();
             bluePen.Dispose();
             brownPen.Dispose();
             g.Dispose();

             Clipboard.SetDataObject(bmp3);
             pictureBox1.Image = bmp3;
         }

         private System.Drawing.Point[] ToPointsArray(List<IntPoint> points)
         {
             System.Drawing.Point[] array = new System.Drawing.Point[points.Count];

             for (int i = 0, n = points.Count; i < n; i++)
             {
                 array[i] = new System.Drawing.Point(points[i].X, points[i].Y);
             }
             return array;
        }
    }
}

This is the part that I am getting an error.
 if (shapeChecker.IsConvexPolygon(edgePoints, out corners))//This is the part of the code that I am getting an error
                     {

                         PolygonSubType subType = shapeChecker.CheckPolygonSubType(corners);

                         Pen pen;

                         if (subType == PolygonSubType.Unknown)
                         {
                             pen = (corners.Count == 4) ? redPen : bluePen;
                         }
                         else
                         {
                             pen = (corners.Count == 4) ? brownPen : greenPen;
                         }

                         g.DrawPolygon(pen, ToPointsArray(corners));
                     }
                 }
             }


text:
Q: Can we model compressor without outlet boundary condition? I am modelling a compressor with input taken from the source ( p = 1 atm, T =25 C). I want the compressor to calculate the outlet pressure( given that pressure ratio rp = 6); The code attached here. Can anyone help me?
model Compressor332 "Generic volumetric compressor model"
 /****************************************** FLUID ******************************************/
replaceable package Medium =
      Modelica.Media.Air.DryAirNasa                                                                    constrainedby
    Modelica.Media.Interfaces.PartialMedium "Medium model" annotation (choicesAllMatching = true);
 /*Ports */
  ThermoCycle.Interfaces.Fluid.FlangeA InFlow(redeclare package Medium = Medium)
    annotation (Placement(transformation(extent={{-78,68},{-58,88}}),
        iconTransformation(extent={{-78,68},{-58,88}})));
  ThermoCycle.Interfaces.Fluid.FlangeB OutFlow(redeclare package Medium =
        Medium) annotation (Placement(transformation(extent={{76,-50},{96,-30}}),
        iconTransformation(extent={{76,-50},{96,-30}})));
/****************************************** SELECT TYPE OF EXPANDER ******************************************/
parameter Real epsilon_s=0.7 "Isentropic Efficiency"
    annotation (Dialog(enable=(ExpType == ExpTypes.UD)));
                                                                                annotation (Dialog(tab="Initialization"));

  /****************************************** VARIABLES ******************************************/
  Medium.ThermodynamicState vaporIn
    "Thermodynamic state of the fluid at the inlet";
  Medium.ThermodynamicState vaporOut
    "Thermodynamic state of the fluid at the outlet - isentropic";
  Modelica.Units.SI.Power W_dot;
  parameter Modelica.Units.SI.MassFlowRate M_dot = 0.01;
  Medium.SpecificEntropy s_su;
  Medium.SpecificEnthalpy h_su;
  Medium.SpecificEnthalpy h_ex;
  Medium.AbsolutePressure p_su;
  parameter Medium.AbsolutePressure p_ex = 20e5;
  Medium.SpecificEnthalpy h_ex_s;
  parameter Real rp = 6;
equation
  /* Fluid Properties */
  vaporIn = Medium.setState_ph(p_su,h_su);
  s_su = Medium.specificEntropy(vaporIn);
  vaporOut = Medium.setState_ps(p_ex,s_su);
  h_ex_s = Medium.specificEnthalpy(vaporOut);
  /*equations */

  h_ex = h_su + (h_ex_s - h_su)/epsilon_s;
  W_dot = M_dot*(h_ex - h_su) "Consumed Power";

   //BOUNDARY CONDITIONS //
   /* Enthalpies */
  h_su = if noEvent(InFlow.m_flow <= 0) then h_ex else inStream(InFlow.h_outflow);
  OutFlow.h_outflow = if noEvent(-M_dot <= 0) then h_ex else inStream(
    OutFlow.h_outflow);

   /*Mass flows */

   OutFlow.m_flow = -M_dot;
   /*pressures */
  //flange.p = vapor_su.p;
  InFlow.p = p_su;
  OutFlow.p = p_ex;
  p_ex /p_su = rp;

  annotation (Diagram(coordinateSystem(preserveAspectRatio=true,  extent={{-100,
            -100},{100,100}}), graphics), Icon(coordinateSystem(
          preserveAspectRatio=false,extent={{-120,-120},{120,120}}), graphics={
          Text(
          extent={{-62,-56},{80,-84}},
          lineColor={0,0,0},
          fillPattern=FillPattern.Solid,
          fillColor={0,0,0},
          textString="Compressor"),
                              Polygon(
          points={{-60,80},{-60,-60},{80,-40},{80,40},{-60,80}},
          lineColor={0,0,255},
          smooth=Smooth.None,
          fillColor={0,0,255},
          fillPattern=FillPattern.Solid)}),Documentation(info="

The Compressor model represents the expansion of a fluid in a volumetric machine. It is a lumped model based on performance curves. It is characterized by two flow connector for the fluid inlet and outlet and by a mechanical connector for the connection with the generator.

The assumptions for this model are:

No dynamics ( it is considered negligible when compared to the one characterizing the heat exchanger).

No thermal energy losses to the environment

Isentropic efficiency based on empirical performance curve

Filling factor based on empirical performance curve

Modelling options

In this model, the user has the choice of providing constant isentropic and volumetric efficiencies, or providing performance curves for these two variables.

"));
end Compressor332;

This is for multi-stage compression. When I translated the model, I am getting the following error mentioned in the figure.
I already given the mass flow rate for the compressor but still, it is not considering.
1.Is modeling possible without outlet boundary condition using fluid library components.
2. Is it possible to have outlet mass flow rate from the data I have give.
3. Are equations solving order can be changed?
(Here from mass flow rate, the equations are getting solved like reverse. I want the model solved from top to bottom, is there any possibility to manupulate the equations order?)

A: In your compressor model you mix model equations with boundary conditions  which is not good practice unless the model should be a "stand-alone" simulation. Since it also has fluid connectors, I assume that the latter is not the case.
In your situation you must remove the parameter keyword from both M_flow and rp since these should be given by the context in which the compressor is used — for example by connecting it to two pressure boundaries (thus providing rp) or connecting it to one pressure boundary and one flow source.
Removing the two parameter keywords, your compressor model is short of two equations. I reckon those two missing equations are given by the (missing) 'compressor map', relating pressure difference (or ratio) with flow rate and rotational speed.


text:
Q: ToolBar above BottomSheetDialog How to show a ToolBar above a BottomSheetDialog ? When the dialog is shown, the screen gets a dark tint so the ToolBar seems to be below the dialog and not clickable. How can I my ToolBar (or any other view) "above the dialog" ? Or maybe there is a way to put the dialog below the ToolBar ?
Here is hat I have :

And this is what I want (ToolBar above / dialog below) :

A: BottomSheetDialog specifically dismisses if the user clicks outside of it, hence the overlay of the rest of your Activity. If you'd prefer to keep it open and allow other parts of your UI to be active (rather than move your Toolbar shaped view into the BottomSheetDialog), you should just attach a BottomSheetBehavior to a View in your hierarchy.


text:
Q: Encrypt Documents In MongoDB My use case is I do not want the admin to see the documents in clear text.
I tried to use mongoose encryption, but it does not work. The fields do not get encrypted. Plus, I have existing clear text documents, so auto converting them would be handy instead of starting over.
Any suggestions what plugin or lib you use?


text:
Q: Inject data from one type object to another I have two different classes lets say:
public class Customer {
    public String Name;
    public String Surname;
}

And
public class CustomerExtended {
    public String Name;
    public String Surname;
    public int number;
}

Now lets say I have an array of Customers and I want to inject it into array of CustomerExtended. So the name and surname data would transfer.
I know I can do it like this:
for (int i; i<CustomerArray.length; i++)
{
    CustomerExtended temp = new CustomerExtended();
    temp.Name = CustomerArray[i].Name;
    temp.Surname = CustomerArray[i].Surname;
    CustomerExtendedArray.add(temp);
}

But what I am asking is if there is simpler way since the structure is the same except the added field. I know there is a way in c# so I tought there should be a way in JAVA I just cannot find it. :/ Anyone knows the way and could show me an example?
Edit:
The above is just a quick example. Why I need this is because I have an Android application with a class that I use almost everywhere and I need to make an update for some special scenario. In this scenario I first have to populate a listview with local data and wait for data from a webservice that is same type but with 2 additional fields. Because of that I need to extend my local type and inject current data into it. So that after I can get data from webservice the types will match and I can just update the listview.
That why I am looking for the fastest and simplest way to move data.

A: You can use the library Apache Commons BeanUtils. In the class BeanUtils there is the following method (quoted from https://commons.apache.org/proper/commons-beanutils/apidocs/org/apache/commons/beanutils/BeanUtils.html):

static void   copyProperties(Object dest, Object orig)
Copy property values from the origin bean to the destination bean for all cases where the property names are the same.

This works on beans, so you should add getters and setters.

A: You could do it using inheritance:
public class Customer {
    public String Name;
    public String Surname;
}

public class CustomerExtended extends Customer {
    public int number;
}

And then create and populate a list of Customers
List<Customer> customerArray = new ArrayList<>();
Customer c = new Customer();
CustomerExtended d = new CustomerExtended();
customerArray.add(c);
customerArray.add(d);

You could then work with this list:
for(Customer customer:customerArray){
    if(customer instanceof Customer){
        Customer e = (Customer)customer;
        //Do your work here...
    }

    if(customer instanceof CustomerExtended){
        CustomerExtended f = (CustomerExtended)customer;
        //Access number:
        System.out.println(f.number);
    }
}

Note that you shouldn't let your field Name and Surname start with a capital letter and be public!

A: You can do that but you need to add Gson library for that. Your two classes are as follows in which i have add constructor to add few items:
public class Customer{
        public String Name;
        public String Surname;

        public Customer(String Name, String Surname){
            this.Name = Name;
            this.Surname = Surname;
        }
    }

    public class CustomerExtended{
        public String Name;
        public String Surname;
        public int number;
    }

Now you can convert the array of customer to customerExtended like as follows:
  //Adding data to array:
    Customer[] customers = new Customer[3];
            for(int i=0 ; i < customers.length ; i++){
                customers[i] = new Customer("Name"+i, "Surname"+i);
            }

//Here you can convert Customer object to CustomerExtended object
    try{
         JsonElement jsonElement = new Gson().toJsonTree(customers);
         CustomerExtended[] array = new Gson().fromJson(jsonElement, CustomerExtended[].class);
         Log.d("test", array.toString());
       }catch(Exception e){
         e.printStackTrace();
       }

Note: This can be done from AnyJson String to any json object which can be fetched from webservice contains some or all fields

A: I don't know the details of your scenario. But I see 2 options:

*

*CustomerExtended to extend the Customer class (inherit it) and to add only the - http://www.javacoffeebreak.com/java104/java104.html
And you can have also a Constructor of CustomerExtended that to receive as a parameter Customer.
Also consider making the fields protected (not public) and to have getters and setters for them

*Another common approach for the cases when they need to be totally separated (which I don't think is your case) is to have an utility class that to convert the Customer into CustomerExtended

Kind Regards
P.S. I would also suggest you to check this one - https://source.android.com/source/code-style.html