text:
Q: Union ALL not giving the column\ names for second group I am using the tool SQLDBx. which i highly like btw. I have 5 groups of series of Select statements and then I made a UNION ALL after the first group. Now it does run correctly
and displays the output but it does not assign the second group'
s field names.
For example. I am greatly abridging
Completed the SQL's needed to mimic a IBM i display screen. There are 5 product groups making up the screen. I was hoping to have one large Command SQL having the 5 SQLs using UNION ALL. This does 'compile' as a Command. However, it does only brings in the first part fields not the second. So this field is not included in the list of fields tree for COMMAND.   PROGR2R2PST,
Is there something not correct how doing the UNION ALL? OUTPUT assigns the column name
of the first group to the second group.
HLDGR1PUN
21454
87273
so if i wanted to have one large SQL with union ALLs, it wont work. is there something other than UNION ALL I should use?
SELECT

count(*) as PROGR1PST,

(

SELECT COALESCE(SUM(OdQty#),0)

FROM ASTCCDTA.OEORH48,ASTCCDTA.TRNSTAT2,ASTDTA.OEORD1

WHERE OHCOM# = TSCOM# AND OHORD# = TSORD# AND OHCOM# = ODCOM# AND OHORD# = ODORD#

AND TSSTAT IN('AEP','BGE')

AND OHORDT IN('RTR','INT','SAM')

AND OHREQD < replace(char(current date, iso), '-', '')

AND OHHLDC = ' '

AND ODPRLC = 'ENG'

AND substr(odprt#,1,5) <> 'NOENG' AND OHORD# in(SELECT a.TSORD# FROM ASTCCDTA.TRNSTAT2 a

WHERE a.tsstat IN('AEP','BGE','EAS','REL','STP'))

) AS PROGR1PUN,

(

SELECT count(*)

FROM ASTCCDTA.OEORH48,ASTCCDTA.TRNSTAT2,ASTCCDTA.OETRA99

WHERE OHCOM# = TSCOM# AND OHORD# = TSORD#

AND (otCOM# = OHCOM# AND OTORD#= OHORD# AND ottrnc = 'AQC')

AND TSSTAT IN('AEP','BGE')

AND OHORDT IN('RTR','INT','SAM')

AND OHREQD = replace(char(current date, iso), '-', '')  AND OHHLDC = ' ' AND OHORD# in(SELECT a.TSORD# FROM ASTCCDTA.TRNSTAT2 a

WHERE a.tsstat IN('AEP','BGE','EAS','REL','STP'))

) AS PROGR1TOD,

(
etc..

UNION ALL

SELECT

count(*) as PROGR2R2PST,

(SELECT COALESCE(SUM(OdQty#),0) FROM ASTCCDTA.OEORH48,ASTCCDTA.TRNSTAT2,ASTDTA.OEORD1

  WHERE OHCOM# = TSCOM# AND OHORD# = TSORD# AND OHCOM# = ODCOM# AND OHORD# = ODORD#

  AND TSSTAT IN('AEP','BGE')

  AND OHORDT IN('CUS','CIN','SMC','COC','DON')

  AND OHREQD < replace(char(current date, iso), '-', '')

  AND OHHLDC = ' '

  AND ODPRLC = 'ENG'

  AND substr(odprt#,1,5) <> 'NOENG' AND OHORD# in(SELECT a.TSORD# FROM ASTCCDTA.TRNSTAT2 a

WHERE a.tsstat IN('AEP','BGE','EAS','REL','STP'))

) AS PROGR2PUN,

A: I don't think you can get the result you want by "nesting" the SQL statements and joining them with UNION.
This structure may work, depending upon your requirements:
 SELECT 'Name1' AS Label , COUNT(*) AS The_Count
   FROM table1
   WHERE ...
 UNION ALL
 SELECT 'PROGR2R2PST', COUNT(*)
   FROM table2
   WHERE ...
 UNION ALL
 SELECT 'Name3', COUNT(*)
   FROM table3
   WHERE ...

This will give you back one row per select:
 Label      The_Count
 --------------------
 Name1          45867
 PROGR2R2PST       22
 Name3           1234

Note that the column names come from the first select. If this format doesn't match your requirements, please be more explicit in the question or in comments and I will try to help.


text:
Q: There was no channel actively listening at wcf I have been working on a WCF service which is developed in VS 2008 and hosted in Windows Server 2008, IIS 7.0,
When I host this service in my local environment, its working fine but when i host this service in production site its not working.
In this service i am using WShttpbinding binding, and i am using the Security mode is message and clientcredential type is "Username"
 <security mode= "Message">
    <message clientCredentialType="UserName" />
</security>

In behaviour configuration i am using the
 <behavior name="name">
      <serviceMetadata  httpGetEnabled="true" httpsGetEnabled="true" httpsGetUrl="https://serviceurl/basic"/>
    <serviceDebug includeExceptionDetailInFaults="true" />
    <serviceCredentials>
    <serviceCertificate findValue="CN=WMSvc-AMAZONA-PJ1K606" />
    <userNameAuthentication userNamePasswordValidationMode="MembershipProvider" embershipProviderName="WCFSqlProvider" />
    </serviceCredentials>
    </behavior>

but when i consume the service from my client application it gives me the error
There was no channel actively listening at "//name of the machine where service hosted/servicename/$metadata" This is often caused by an incorrect address URI. Ensure
that the address to which the message is sent matches an address on which a service is listening.

A: Looks like your problem is with the metadata, according to the error message.
<serviceMetadata  httpGetEnabled="true" httpsGetEnabled="true" httpsGetUrl="//https://serviceurl/basic"/>

Try removing the // in the beginning of httpsGetUrl attribute, they might be causing you trouble.
Here are a few examples of configurations: http://msdn.microsoft.com/en-us/library/ms731317(v=vs.110).aspx

A: <system.serviceModel>
    <bindings>
      <webHttpBinding>
        <binding name="TransportSecurity">
          <security mode="Transport">
            <transport clientCredentialType="None"/>
          </security>
        </binding>
      </webHttpBinding>
    </bindings>
    <services>
      <service name="Service" behaviorConfiguration="ServiceBehaviour">
        <endpoint address="" binding="webHttpBinding" behaviorConfiguration="webMyAcc" bindingConfiguration="TransportSecurity" contract="IService"/>
        <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="ServiceBehaviour">
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior name="webMyAcc">
          <webHttp />
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
    <client />
  </system.serviceModel>

redpajama_set_name: RedPajamaStackExchange


text:
Q: iOS Simulator gets stuck in an infinite loop I am using Xcode 9.1, but the following issue happened with Xcode 9 as well.
Sometimes, after running an application in the simulator and stopping the execution from Xcode, the simulator gets stuck in a loop and opens/closes the same application rapidly and endlessly.
The fix that I know for this issue is running an application from Xcode again or quitting the simulator.
It seems like the OS of the simulator is not a key factor, it already happened with multiple different simulators.
If I try to close the application by pressing the Home button, SpringBoard throws a crash:

Here is a relevant snippet from the crash:
Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Application Specific Information:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'need the old view controller for <SBLayoutElement: 0x600001a7f3c0; identifier: [application's ID]; layoutRole: primary; layoutElementMode: default> {
    supportedLayoutRoles = primary;
    layoutAttributes = none;
    viewControllerClass = SBMainWorkspaceApplicationSceneLayoutElementViewController;
}'
terminating with uncaught exception of type NSException
abort() called
CoreSimulator 494.22.7 - Device: iPhone 6 - Runtime: iOS 11.1 (15B87) - DeviceType: iPhone 6

Application Specific Backtrace 1:
0   CoreFoundation                      0x0000000115bc61ab __exceptionPreprocess + 171
1   libobjc.A.dylib                     0x000000011525bf41 objc_exception_throw + 48
2   CoreFoundation                      0x0000000115bcb372 +[NSException raise:format:arguments:] + 98
3   Foundation                          0x0000000111085089 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 193
4   SpringBoard                         0x0000000108e5f17a SpringBoard + 2863482
5   SpringBoard                         0x00000001090980bc SpringBoard + 5193916
6   SpringBoard                         0x0000000108e5e9c9 SpringBoard + 2861513
7   SpringBoard                         0x00000001090be78d SpringBoard + 5351309
8   SpringBoard                         0x0000000108e60902 SpringBoard + 2869506
9   SpringBoard                         0x0000000108e17094 SpringBoard + 2568340
10  SpringBoard                         0x0000000108f5d197 SpringBoard + 3903895
11  SpringBoard                         0x0000000108f5d253 SpringBoard + 3904083
12  SpringBoard                         0x0000000108f5d86b SpringBoard + 3905643
13  SpringBoard                         0x0000000108f5c4a0 SpringBoard + 3900576
14  SpringBoard                         0x0000000108f5aea9 SpringBoard + 3894953
15  BaseBoard                           0x000000010e749091 __22-[BSTransaction begin]_block_invoke + 178
16  BaseBoard                           0x000000010e74f7b7 -[BSTransaction _preventTransactionCompletionForReason:ignoringAuditHistory:andExecuteBlock:] + 66
17  BaseBoard                           0x000000010e748c4b -[BSTransaction begin] + 890
18  BaseBoard                           0x000000010e749136 __22-[BSTransaction begin]_block_invoke + 343
19  BaseBoard                           0x000000010e74f7b7 -[BSTransaction _preventTransactionCompletionForReason:ignoringAuditHistory:andExecuteBlock:] + 66
20  BaseBoard                           0x000000010e748c4b -[BSTransaction begin] + 890
21  SpringBoard                         0x0000000108beea28 SpringBoard + 305704
22  SpringBoard                         0x0000000108bf1875 SpringBoard + 317557
23  SpringBoard                         0x0000000108bf1597 SpringBoard + 316823
24  SpringBoard                         0x0000000108befee4 SpringBoard + 311012
25  BaseBoard                           0x000000010e7569c8 -[BSEventQueue _processNextEvent] + 349
26  SpringBoard                         0x0000000108beeb3b SpringBoard + 305979
27  libdispatch.dylib                   0x0000000116dd8273 _dispatch_call_block_and_release + 12
28  libdispatch.dylib                   0x0000000116dd92b5 _dispatch_client_callout + 8
29  libdispatch.dylib                   0x0000000116de3496 _dispatch_main_queue_callback_4CF + 1260
30  CoreFoundation                      0x0000000115b88ee9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
31  CoreFoundation                      0x0000000115b4d592 __CFRunLoopRun + 2402
32  CoreFoundation                      0x0000000115b4c9b9 CFRunLoopRunSpecific + 409
33  GraphicsServices                    0x00000001115e89c6 GSEventRunModal + 62
34  UIKit                               0x000000010c0fb5e8 UIApplicationMain + 159
35  FrontBoard                          0x000000010e4efdfa FBSystemAppMain + 1010
36  libdyld.dylib                       0x0000000116e4dd81 start + 1
37  ???                                 0x0000000000000001 0x0 + 1

Is there a known fix for this?


text:
Q: How to print c_type byte array as set of hexadecimal values in python? I have data structure defined as follows:
class Factory_Params_Get_Command(Structure):
_pack_ = 1
_fields_ = [("SN",c_byte * 32),
            ("Voltage",c_byte),
            ("Reserved",c_byte * 30)]
# Print the fields
def __str__(self):
    return "Serial Number: %s"  % (list(self.SN))

This prints the serial number like:
[0, 32, 58, 73.....]

I would like to print the serial number as set of hexadecimal values, where each byte is represented by 2 hex numbers, and , if possible , without commas and without spaces. Something like this:
03C8A0D6.....

Would appreciate your help

A: Possibly something like:
hexstring = ''.join('%02X' % b for b in self.SN)

That applies the formatting string %02X to every byte in the array, and then concatenates everything into a single string.  For example:
>>> import ctypes
>>> sn = (ctypes.c_byte*32)(*range(1,32))
>>> hexstring = ''.join('%02X' % b for b in sn)
>>> print hexstring
0102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F00
>>>


text:
Q: Batch processing with Nvidia's TensorRT I converted the trained model to onnx format, and then created the TensorRT engine file from onnx model. I used the below snnipet code for doing this?
import pycuda.driver as cuda
import pycuda.autoinit
import numpy as np
import tensorrt as trt

# logger to capture errors, warnings, and other information during the build and inference phases
TRT_LOGGER = trt.Logger()

def build_engine(onnx_file_path):
    # initialize TensorRT engine and parse ONNX model
    builder = trt.Builder(TRT_LOGGER)
    network = builder.create_network()
    parser = trt.OnnxParser(network, TRT_LOGGER)

    # parse ONNX
    with open(onnx_file_path, 'rb') as model:
        print('Beginning ONNX file parsing')
        parser.parse(model.read())
    print('Completed parsing of ONNX file')
# allow TensorRT to use up to 1GB of GPU memory for tactic selection
builder.max_workspace_size = 1 << 30
# we have only one image in batch
builder.max_batch_size = 1
# use FP16 mode if possible
if builder.platform_has_fast_fp16:
    builder.fp16_mode = True
# generate TensorRT engine optimized for the target platform
    print('Building an engine...')
    engine = builder.build_cuda_engine(network)
    context = engine.create_execution_context()
    print("Completed creating Engine")

    return engine, context

# get sizes of input and output and allocate memory required for input data and for output data
for binding in engine:
    if engine.binding_is_input(binding):  # we expect only one input
        input_shape = engine.get_binding_shape(binding)
        input_size = trt.volume(input_shape) * engine.max_batch_size * np.dtype(np.float32).itemsize  # in bytes
        device_input = cuda.mem_alloc(input_size)
    else:  # and one output
        output_shape = engine.get_binding_shape(binding)
        # create page-locked memory buffers (i.e. won't be swapped to disk)
        host_output = cuda.pagelocked_empty(trt.volume(output_shape) * engine.max_batch_size, dtype=np.float32)
        device_output = cuda.mem_alloc(host_output.nbytes)

stream = cuda.Stream()

# preprocess input data
 host_input = np.array(preprocess_image("turkish_coffee.jpg").numpy(), dtype=np.float32, order='C')
 cuda.memcpy_htod_async(device_input, host_input, stream)

# run inference
    context.execute_async(bindings=[int(device_input), int(device_output)], stream_handle=stream.handle)
    cuda.memcpy_dtoh_async(host_output, device_output, stream)
    stream.synchronize()

# postprocess results
    output_data = torch.Tensor(host_output).reshape(engine.max_batch_size, output_shape[0])
    postprocess(output_data)

The above codes is correctly work for one batch size of image, but I want to do for multi batch size, for this one thing that need to change :
builder.max_batch_size = 1

and What are other things I have to change to work correctly for batch size more than one? In my opinion, the one things that I have to change from sync to async, right?:
stream.synchronize()

How I can to solve the problem for batch size more than one?
My system:
torch:1.2.0
torchvision:0.4.0
albumentations:0.4.5
onnx:1.4.1
opencv-python:4.2.0.34
cuda:10.0
ubuntu:18.04
tensorrt: 5.x/6.x
Other solution is to use optimization profiler in TRT 7.x , But I want to know How I can to solve this problem with 5/6 versions, Is it possible?


text:
Q: What is the probability that a coin is fair? You paly a game with your friend Alice where you bet on the outcome of a coin toss. The coin has been provided by Alice. You think there is a 50% chance that she would have provided an unfair coin. If the coin is unfair then you believe that the probability that it will turn up heads is uniform in [0, 1].
The question is that,
1: You toss the coin and it comes up head. What is the probability that the coin is fair?
2: You toss the coin for the second time and it comes up head again. Now, what is the probability that the coin is fair?
For me, I solve this problem through this way,
P(fair|data) = $\frac{P(data|fair)P(fair)}{P(data|fair)P(fair)+P(data|unfair)P(unfair)}$
Where I know that P(fair)=0.5, P(data|fair)=$p^1(1-p)^0$=$p=0.5$ (as fair means P(head)=0.5=p), P(unfair)=0.5,
So, the previous equation can be substitued as,
P(fair|data) = $\frac{0.5*0.5}{0.5*0.5+P(data|unfair)*0.5}$
My question is how to express the term of P(data|unfair)?
Thanks.

A: Part 1: if the coin is fair, it comes up $H$ with probability $\frac 12$.  If it is unfair then it comes up $H$ with probability $$\int_0^1 pdp=\frac 12$$.  Thus the two cases are symmetric and the answer is $\boxed {\frac 12}$.
Part II.  Now the probability that the unfair coin comes up $HH$ is $$\int_0^1 p^2dp=\frac 13$$  While the fair coin of course comes up $HH$ with probability $\frac 14$.  Thus we apply Bayes to get $$\frac {\frac 12 \times \frac 14}{\frac 12 \times \frac 13+\frac 12 \times \frac 14}=\boxed {\frac 37}$$

A: If it is unfair, the probablity that it will turn up heads is uniform in [0,1]:  so Integrate: $\int_0^1 p dp = 1/2$

A: For the case where you are looking at $\mathbb P(H)$ assuming that the coin is unfair with a $\theta \sim U[0, 1]$ probability of landing heads, one can use a continuous analogue to the law of total probability to get
$$
\mathbb P(H) = \int_\Omega \mathbb P(H\mid \theta)f(\theta)d\theta
$$
where $f$ is the pdf of $\theta$. In your case $\mathbb P(H \mid \theta) = \theta$, $f(\theta) = 1$ and $\Omega = [0, 1]$ so you end up with
$$
\mathbb P(H) = \int_0^1\theta d\theta
$$
Also see this: Can we prove the law of total probability for continuous distributions?


text:
Q: Shared clipboard between multiple X11 servers (Xephyr, Xpra etc.) I plan to run potentially dangerous applications (browser, etc.) on a separate X-server, but since each server has its own clipboard, it is impossible to copy the link / text from one window to another.
Most articles suggest doing this using scripts using xclip and other similar utilities.
But how to CORRECTLY create a common clipboard so as not to accidentally create a new vulnerability?

A: NOTE: Updating answer to reflect change of strategy - instead of running Xephyr on a server/container, I am running it on host/main-use environment. The reason for that is that running Xephyr on the server/container is like putting a lock on an inside door instead of the front door - bad actors would go around the inside door and access the clipboard through the X pipe remote socket directly.
Facing the same problem of clipboard vulnerability, I approached it by running a Xephyr on the host (my personal workspace), and forwarding X from the server-on-container(s) to the local Xephyr.
The Xephyr is running on display ':2' while my personal workspace windows and browser are running on the default display ':0'.  These two displays do not share a clipboard - each has it's own clipboard.  That is the only way to prevent snooping of my personal workspace clipboard on display ':0'.  Then I have hot keys set up (e.g., function keys), one to transfer the clipboard content from ':0' to ':2', and another for ':2' to ':0', so allowing complete control.
In shell script the code could look like
xsel --display :0 --clipboard -o |  xsel --display :2 --clipboard -i

although I am using javascript as shown at the bottom of this post.
Shell script to start up the X forwarding could look something like this
Xephyr <args> :2
DISPLAY=:2 ssh -X -R 44713:localhost:4713 user@container <<EOF
DISPLAY=:10 PULSE_SERVER=tcp:localhost:44713 openbox --startup firefox
EOF

although I am using a javascript program to do it.
Here is the javascript code for copying between ':0' and ":2" which is mapped to by hot keys.  You can see it pops up a transient message box to confirm it worked.
#!/usr/bin/env node
`strict`;
const child_process = require('child_process');

// TODO: write unviewable error messasges to system log

function notifySend(title, msg){
  title = title.replace(/"/g, '\\"');
  msg = msg.replace(/"/g, '\\"');
  //msg = msg.replace(/'/g, '\\'')
  try {
    child_process.execSync(`notify-send "${title}" "${msg}"`);
  } catch(e) {
    console.log(`system call "notify-send" failed with ${e.message}`);
  }
}

async function clipXfer(fromDispNum,toDispNum){
  var clipValue;
  let cmd1 = `xsel --display :${fromDispNum} --clipboard --output`;
  let cmd2 = `xsel --display :${toDispNum} --clipboard --input`;
  try {
    clipValue = child_process.execSync(cmd1, { encoding: 'utf-8' });
  } catch(e) {
    throw Error(`Display ${fromDispNum} clipboard is empty`);
  }
  await new Promise((resolve, reject)=>{
    // eslint-disable-next-line no-unused-vars
    var proc = child_process.exec(cmd2, (error, stdout, stderr) => {
      //if (stdout) console.log(stdout);
      //if (stderr) console.log(stderr);
      if (error) {
        reject(Error(`${error.message}`));
      }
      resolve();
    });
    if (!proc.stdin.write(clipValue))
      reject(Error('clipToCont(), pipe write failed'));
    proc.stdin.end();
  });
}

async function main()
{
  let argOff=2;
  if (process.argv.length-argOff<2)
    throw Error('clip-xfer requires two arguments: fromDispNum, toDispNum');
  let fromDispNum = process.argv[argOff];
  let toDispNum = process.argv[argOff+1];
  argOff+=2;
  let f = (outcome)=>{
    notifySend("clipXfer",  `${fromDispNum} => ${toDispNum} ${outcome}`);
  };
  await clipXfer(fromDispNum,toDispNum)
    .then(f('SUCCESS'))
    .catch((e)=>{f(`FAILURE, ${e.message}`); throw e;});
}

//console.log(process.argv);
//console.log(process.env);
main()
  .then(()=>{process.exitCode=0;})
  .catch((e)=>{
    console.log(e);
    process.exitCode=1;
  });

A: I use xclipsync. It works in 98%.
In 2% I'm doing this:
On dislpay :0 run copyq.
On display :1 run parcellite.
To sync clipboard i use
copyq add $(parcellite)

or to backward
copyq read | parcellite -c

It works 100%! :-)


text:
Q: Which xinput setting will reverse the direction of my mouse's scroll wheel? I am attempting to follow the advice of this question, using the xinput tool to enable natural scrolling for my mouse's scroll wheel.
I list my input devices via $ xinput list and get the following:
$ xinput list
⎡ Virtual core pointer                          id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ SynPS/2 Synaptics TouchPad                id=11   [slave  pointer  (2)]
⎜   ↳ TPPS/2 IBM TrackPoint                     id=12   [slave  pointer  (2)]
⎜   ↳ Dell Dell USB Optical Mouse               id=14   [slave  pointer  (2)]
⎣ Virtual core keyboard                         id=3    [master keyboard (2)]
    ↳ Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]
    ↳ Power Button                              id=6    [slave  keyboard (3)]
    ↳ Video Bus                                 id=7    [slave  keyboard (3)]
    ↳ Sleep Button                              id=8    [slave  keyboard (3)]
    ↳ Integrated Camera                         id=9    [slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard              id=10   [slave  keyboard (3)]
    ↳ ThinkPad Extra Buttons                    id=13   [slave  keyboard (3)]

The relevant device is the Dell Dell USB Optical Mouse id=14. I list the properties of that device via $ xinput list-props 14, and get
$ xinput list-props 14
Device 'Dell Dell USB Optical Mouse':
        Device Enabled (140):   1
        Coordinate Transformation Matrix (142): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
        Device Accel Profile (266):     0
        Device Accel Constant Deceleration (267):       1.000000
        Device Accel Adaptive Deceleration (268):       1.000000
        Device Accel Velocity Scaling (269):    10.000000
        Device Product ID (260):        16700, 12306
        Device Node (261):      "/dev/input/event12"
        Evdev Axis Inversion (306):     0, 0
        Evdev Axes Swap (308):  0
        Axis Labels (309):      "Rel X" (150), "Rel Y" (151), "Rel Vert Wheel" (775)
        Button Labels (310):    "Button Left" (143), "Button Middle" (144), "Button Right" (145), "Button Wheel Up" (146), "Button Wheel Down" (147), "Button Horiz Wheel Left" (148), "Button Horiz Wheel Right" (149)
        Evdev Scrolling Distance (311): 1, 1, 1
        Evdev Middle Button Emulation (312):    0
        Evdev Middle Button Timeout (313):      50
        Evdev Third Button Emulation (314):     0
        Evdev Third Button Emulation Timeout (315):     1000
        Evdev Third Button Emulation Button (316):      3
        Evdev Third Button Emulation Threshold (317):   20
        Evdev Wheel Emulation (318):    0
        Evdev Wheel Emulation Axes (319):       0, 0, 4, 5
        Evdev Wheel Emulation Inertia (320):    10
        Evdev Wheel Emulation Timeout (321):    200
        Evdev Wheel Emulation Button (322):     4
        Evdev Drag Lock Buttons (323):  0

Which (if any) of these can I change to reverse the scroll wheel direction?
I tried adjusting the Evdev Axis Inversion (306) property via command $ xinput set-prop 14 306 1, 1, but that is apparently for mouse movement direction, not scroll wheel direction -- I had to change that back.
Do any of these xinput settings reverse the scroll wheel direction? If not then perhaps I will need to try another method. My OS is Ubuntu 16.04.2 LTS.

A: Try to Run
$ xinput set-prop 14 311 -1 1 1

to set "Evdev Scrolling Distance" to negative values for vertical moves.


text:
Q: Error with .webp images when using Active Storage on Heroku When I use Active Storage, and when someone upload a .webp image, and when I run file.attach(io: webp_file, filename: 'file.webp') it works, and then ActiveStorage automatically run a job ActiveStorage::AnalyzeJob
But this job raises :
MiniMagick::Error (`identify -format %[orientation] /tmp/ActiveStorage-114989-20180905-4-wak8ob.webp[0]` failed with error:
identify-im6.q16: delegate failed `'dwebp' -pam '%i' -o '%o'' @ error/delegate.c/InvokeDelegate/1919.
identify-im6.q16: unable to open file `/tmp/magick-1400SWBHj-p67HrV': No such file or directory @ error/constitute.c/ReadImage/544.

Although I am on Heroku-18, and so there is a lib called "libwepb6" (https://devcenter.heroku.com/articles/stack-packages)
Do I have to create a Heroku buildpack?

A: Had the same problem. Here's the step by step:
1 - Add this to development.rb and production.rb to force rails to accept WEBP.
config.active_storage.variable_content_types = %w(
  image/png
  image/gif
  image/jpg
  image/jpeg
  image/webp
  image/vnd.adobe.photoshop
  image/vnd.microsoft.icon
)

2 - Add this buildpack to your app on heroku, making sure it's the first pack. It allows you to install ubuntu packages that are not already preinstalled.
3 - Navigate to the root of your app (where your Gemfile is) and run the commands below to create a file named AptFile, and add the webppackage to it.
touch Aptfile
echo "webp" >> Aptfile

4 - Redeploy your app.
Heroku will now install the missing webp package that imagemagick needs to handle webp images.
Edit: Step 1 is not necessary if you are on Rails 6.1 or later.

A: Edit: So S3 is being used and /tmp for manipulation.
Looking at the error it seems to delegate to dwebp fine, so I have to assume it was built correctly. If it wasn't built with webp you would get a delegate error like so
identify.im6: no decode delegate for this image format `1.sm.webp' @ error/constitute.c/ReadImage/544.

You can make sure by running heroku run "identify -list format | grep -i WebP"
The error seems to be on the /tmp/ file directory access.
How's the space situation? df -h
Note that on a Mac I get this, notice the use of the /var directory:
~/w/p ❯❯❯ identify 1.sm.webp
Decoded /var/folders/lk/z_bvyjj939d94mvkx6rz9700fbx9gg/T/magick-99980zzj1IT0Lkx7L. Dimensions: 320 x 214 . Format: lossy. Now saving...
Saved file /var/folders/lk/z_bvyjj939d94mvkx6rz9700fbx9gg/T/magick-999803WU_TvRo7xdJ
1.sm.webp PAM 320x214 320x214+0+0 8-bit TrueColor sRGB 273989B 0.000u 0:00.000

Probably this heroku employee will shed more light on this.
This article also goes into detail https://devcenter.heroku.com/articles/active-storage-on-heroku, especially this point:

While file uploads that are stored with the :local option will appear
  to work at first, the attachments will exhibit seemingly strange
  behavior and eventually disappear.

with recommendations to use cloud storage (e.g. Amazon S3).


text:
Q: CGAL linker error - Symbol not found: ___gmpq_clear I'm trying to incorporate CGAL into an existing simulation project, but am having some linker trouble.  The python simulation keiro.py uses a file called physics.cpp in a swig wrapper for speeding up common operations...I managed to get my physics.cpp file to compile, but running the Python simulation errors out with the following message:

Traceback (most recent call last):
   File "keiro.py", line 2, in
     from world import World, View
   File "/Users/marcstrauss/Desktop/keiro/world.py", line 9, in
     from fast.physics import Vec2d, Particle, World as PhysicsWorld
   File "/Users/marcstrauss/Desktop/keiro/fast/physics.py", line 7, in
     import _physics
  ImportError: dlopen(/Users/marcstrauss/Desktop/keiro/fast/physics.so, 2): Symbol not >found: __gmpq_clear
   Referenced from: /Users/marcstrauss/Desktop/keiro/fast/_physics.so
   Expected in: flat namespace
  in /Users/marcstrauss/Desktop/keiro/fast/_physics.so

I figure that error with the ___gmpq_clear symbol not being recognized in the object file means that I'm not linking to CGAL properly.  Here is my makefile:

all: physics.py _physics.so graphutils.py _graphutils.so
_physics.so: setup_physics.py physics_wrap.cxx physics.cpp
  python setup_physics.py build_ext --inplace  -I/opt/local/include/
_graphutils.so: setup_graphutils.py graphutils_wrap.cxx graphutils.cpp
  python setup_graphutils.py build_ext --inplace -I/opt/local/include/
physics.py physics_wrap.cxx: physics.i physics.h
  swig -python -c++ physics.i
graphutils.py graphutils_wrap.cxx: graphutils.i graphutils.h
  swig -python -c++ graphutils.i -I/opt/local/include/
  clean:
  rm -f physics.py
  rm -f graphutils.py
  rm -f *.cxx
  rm -f *~ *.pyc *.pyo
  rm -f *.so
  rm -rf build

Does anyone have any ideas for me as to how to fix this?  Thanks!

A: On my computer the __gmpq_clear symbol is located in the libgmp library:
nm libgmp.a | grep gmpq_clear
00000000 T __gmpq_clear

Try adding -lgmp to your linking command.


text:
Q: Error: Type 'Microsoft.VisualBasic.CompilerServices.DesignerGenerated' is not defined 1- I have created WPF application  as you can see following picture.
2- I have visited following site.
3- I have copied XAML code as you can see following picture.
4- I have pasted the XAML code into my WPF application  as you can see following picture.
5- I have runned my WPF application and following error occurs. Do you have any idea how to solve following error?

A: you copied <Page> markup and replaced expected <Window> markup
copy inner content starting from Border and insert inside Window tag in MainWindow.xaml:
<Window
   xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
   xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <Border Width="400" BorderBrush="Black">
       <!--everything else-->
    </Border>

</Window>

(if MainWindow.xaml is lost just start over with a default wpf project template)


text:
Q: Can someone explain what these if statements are saying? I'm a beginner and I have two sets of "if statements" that are applying to a form and they almost do the same thing but I want to understand why they do what they do.  When I print the errors and submit an empty form, the first if statement echos each field in the array with the words "is requred" next to each field.  As for the 2nd if statement, it simply echos "You didn't fill in all of the categories" if even one field was left empty in the form compared to the first if statement that echos the specific field that was left empty.Like if you could break down each set of coding for me step by step that would be great.  And could you possibly recommend a link where I can learn the language? Thank you!
<?php

    if(isset($_POST['registrationform'])){
        $required_fields = array('first_name', 'last_name', 'email', 'password', 'gender', 'month', 'day', 'year');
        foreach ( $required_fields as $key=>$value) {
         if (!isset($_POST[$value]) || $_POST[$value]=='') {
              $errors[$value] =$key." is required";
            }
            }
            }
            print_r($errors);
?>

<?php
if (empty($_POST) === false) {
        $required_fields = array('first_name', 'last_name', 'email', 'password', 'sex', 'birthday', 'terms_of_service');
        foreach ($_POST as $key=>$value) {
            if (empty($value) && in_array($key, $required_fields) === true) {
                $errors[] = 'You didn\'t fill in all of the categories.';
                break 1;
            }
            }
            }
            print_r($errors);
?>

A: "isset() returns true if the variable exists, even if it's empty. empty() returns true if the variables doesn't exist OR if their contents are considered to be 'empty' (empty string, 0, NULL, false, array with no elements). They're quite different, really. I believe empty($var) is equivalent to !($var)."
http://www.webhostingtalk.com/archive/index.php/t-373975.html
See this Question: What is the difference between isset and empty?
Information Regarding both functions:
http://us3.php.net/manual/en/function.empty.php
http://us3.php.net/manual/en/function.isset.php
Tutorial for learning php:
http://www.w3schools.com/php/default.asp


text:
Q: Attach Snackbar to RecyclerView I am creating a typical chat application with a RecyclerView in the middle and the messaging controls at the bottom.
I would like to show a snackbar which is bound to the RecyclerView (and therefore shown at the bottom of the Recyclerview), so that it is shown above the messaging controls and not at the very bottom of the screen.
When i set snackbarChat = Snackbar.make(findViewById(R.id.recycler_view), "", Snackbar.LENGTH_INDEFINITE); the snackbar is still shown (and covering the messaging controls) at the bottom of the screen and not as intended at the bottom of the RecyclerView.
Question: How can i bin the snackbar to the screen of the Recyclerview?
Thanks for your help!

A: From the documentation for make():

Snackbar will try and find a parent view to hold Snackbar's view from the value given to view. Snackbar will walk up the view tree trying to find a suitable parent, which is defined as a CoordinatorLayout or the window decor's content view, whichever comes first.

So, when you pass the result of findViewById(R.id.recycler_view), the make() call will look at the RecyclerView's parent, and the parent's parent, and so on... until it finds either a CoordinatorLayout or gets to the main content view.
I'm betting that you're running into the second half of that.
An easy way to fix would be to wrap your RecyclerView in a CoordinatorLayout. I can't say exactly how to do that without seeing your layout XML, but probably you just want
<android.support.design.widget.CoordinatorLayout
    android:layout_width="whatever you had on the recyclerview"
    android:layout_height="whatever you had on the recyclerview"
    ...>

    <android.support.v7.widget.RecyclerView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        .../>

</android.support.design.widget.CoordinatorLayout>


text:
Q: C# Synchronize Wait / Poll methods I have a class that exposes two methods:
 - GetObject
Gets a single object, or returns null if there are none.
 - WaitForObject
Gets a single object, or waits until their is one.
An example implementation:

    class MyClass
    {
        MyStack stack;
        public object GetObject()
        {
            return stack.Pop();
        }
        public object WaitForObject()
        {
            object returnValue;
            while (returnValue == null)
                returnValue = stack.Pop()
            return returnValue
        }
    }

With the assumption that MyStack is thread safe, how can I make MyClass thread safe? I.e.
 - GetObject should never block
 - Thread doing WaitForObject should get any new objects added to the stack instead of GetObject.
For bonus points, how can users adding objects to the stack notify any listeners that a new object is available? (eliminating the need for polling)

A: If MyStack is guaranteed to be thread safe then MyClass is also thread safe. In the two methods you are using only local variables so the methods are reentrant.
Currently users cannot add objects to the stack because the stack field is not visible outside the class. Also I don't see from your code how do listeners will subscribe to any events so that they are notified if an object is added. So you could have a method allowing to add elements to the stack and an event that will be triggered in this case.

A: I think that you can achieve everything with Monitor functionality. just a sketch
class MyClass
{
    private Stack<object> stack = new Stack<object>();
    public object GetObject()
    {
        lock(stack)
        {
            return stack.Count != 0 ? stack.Pop() : null;
        }
    }
    public object WaitForObject()
    {
        lock (stack)
        {
            if (stack.Count == 0)
            {
                // wait until PutObject is called
                Monitor.Wait(stack);
            }

            return stack.Pop();
        }
    }

    public void PutObject(object obj)
    {
        lock (stack)
        {
            stack.Push(obj);
            // notify one thread blocked by WaitForObject call
            Monitor.Pulse(obj);
        }
    }
}

A: Polling usually involves some form of sleep - the loop in your example would be a tight loop that would throttle the thead all the time.  Add a Thread.Sleep(100) call, or some other sensible value, to poll over time.
The other way to wait would be to register a callback, or have the stack expose a blocking Pop method, either way, these would be implemented in the Stack class in your example.
Bonus Answer: Your class would need to expose an event, when they add an object to the stack, it would fire this event.
class MyClass
    {
        MyStack stack;
        public object GetObject()
        {
            return stack.Pop();
        }
        public object WaitForObject()
        {
            object returnValue;
            while (returnValue == null)
                returnValue = stack.Pop()
            return returnValue
        }
        public void AddObject(object o)
        {
            stack.Push(o);
            OnObjectAdded();
        }
        public event EventHandler ObjectAdded;

        private void OnObjectAdded()
        {
            if (ObjectAdded != null)
                ObjectAdded(this, EventArgs.Empty);
        }
    }


text:
Q: How to filter different columns by different years? I have 6 columns titled Year, Growth, Trade, Investment, Population and Inflation.
I want to filter Growth, and Inflation by Year > 1994.
I want to filter Trade, Investent and Population by Year > 1993.
I want to do this in order to difference my data in order to achieve % Change.
Any help would be much appreciated?
I have tried:
    OpennesstOTrade <-  summary(ireland, Year > 1993) %>% diff(ireland$OpennesstoTrade, lag = 1, differences = 1)

A: It should work if you use two filters?
I would try something like (dplyr)
df <- df %>%
  filter(Trade > 1993 & Investent >1993 & Population > 1993)%>%
  filter(Year > 1994)


text:
Q: how to get a variable then a string without a space in python So I made this and it works, but I'm kinda picky so I want it to work 100%. This is the code
import random
input_1 = str(input("Do you want to roll a dice? Enter y for yes anything else for no. "))
if input_1 == "y":
    dicesides = int(input("How many sides do you want your dice to have? "))
    diceroll = random.randint(1, dicesides)
    print("The dice rolled a",diceroll ".")
    input_2 = str(input("Do you want to roll the dice again? Same keys. "))
    while input_2 == "y":
        print(random.randint(1, dicesides))
        input_2 = str(input("Do you want to roll the dice again? Same keys. "))
    else:
        print("Okay, goodbye now.")

else:
    print("Okay, goodbye now.")

When the code runs it tells me the number it "rolled", but it puts a space after the number.  I don't want this behavior.
After I find out how I'll change the second+ dice roll to it.
Figured it out, but thanks!

A: Check out the help page for the print function.  If it's given a list of arguments, it prints them separated by the value of the sep argument, which is a single space by default.  So:
print("This",1,"is",2,"spaced",3,"out.")
print("This",1,"is",2,"not.",sep="")

will behave differently.  You'll want to use sep="" and add your own trailing or leading spaces manually to your strings, like this:
print("You rolled a ", roll, ".", sep="")


text:
Q: How to let the code run smoothly using timers and different threads I'm trying to prevent the GUI from freezing, because of a low timer interval and too much to process in the Timer.Tick event handler.
I've been googling a while and I understood that I cannot update UI from any other thread other than the UI thread.
So, what about if you are using lots of controls under Timer1.Tick?
How can I update a Label when the data is downloaded with WebClient with a timer, you don't want to lower the interval too much and keep the UI responsive at the same time?
I receiver Cross Thread violation exceptions when I access UI elements, a ListBox1 and a RichTextBox.
What is the correct way to update the UI with a timer and/or a Thread without causing cross threat exceptions?

A: You have different ways to update UI elements from a Thread other than the UI Thread.
You can use the InvokeRequired/Invoke() pattern (meh), call the asynchronous BeginInvoke() method, Post() to the SynchronizationContext, maybe mixed with an AsyncOperation + AsyncOperationManager (solid BackGroundWorker style), use an async callback etc.
There's also the Progress<T> class and its IProgress<T> interface.
This class provides a quite simplified way to capture the SynchronizationContext where the class object is created and Post() back to the captured execution context.
The Progress<T> delegate created in the UI Thread is called in that context. We just need to pass the Progress<T> delegate and handle the notifications we receive.
You're downloading and handling a string, so your Progress<T> object will be a Progress(Of String): so, it will return a string to you.
The Timer is replaced by a Task that executes your code and also delays its actions by a Interval that you can specify, as with a Timer, here using Task.Delay([Interval]) between each action. There's a StopWatch that measures the time a download actually takes and adjusts the Delay based on the Interval specified (it's not a precision thing, anyway).

▶ In the sample code, the download Task can be started and stopped using the StartDownload() and StopDownload() methods of a helper class.
The StopDownload() method is awaitable, it executes the cancellation of the current tasks and disposes of the disposable objects used.
▶ I've replaced WebClient with HttpClient, it's still quite simple to use, it provides async methods that support a CancellationToken (though a download in progress requires some time to cancel, but it's handled here).
▶ A Button click initializes and starts the timed downloads and another one  stops it (but you can call the StopDownload() method when the Form closes, or, well, whenever you need to).
▶ The Progress<T> delegate is just a Lambda here: there's not much to do, just fill a ListBox and scroll a RichTextBox.
You can initialize the helper class object (it's named MyDownloader: of course you will pick another name, this one is ridiculous) and call its StartDownload() method, passing the Progress<T> object, the Uri and the Interval between each download.
Private downloader As MyDownloader = Nothing

Private Sub btnStartDownload_Click(sender As Object, e As EventArgs) Handles btnStartDownload.Click
    Dim progress = New Progress(Of String)(
        Sub(data)
            ' We're on the UI Thread here
            ListBox1.Items.Clear()
            ListBox1.Items.AddRange(Split(data, vbLf))
            RichTextBox1.SelectionStart = RichTextBox1.TextLength
        End Sub)

    Dim url As Uri = New Uri("https://SomeAddress.com")
    downloader = New MyDownloader()
    ' Download from url every 1 second and report back to the progress delegate
    downloader.StartDownload(progress, url, 1)

Private Async Sub btnStopDownload_Click(sender As Object, e As EventArgs) Handles btnStopDownload.Click
    Await downloader.StopDownload()
End Sub

The helper class:
Imports System.Diagnostics
Imports System.Net
Imports System.Net.Http
Imports System.Text.RegularExpressions

Public Class MyDownloader
    Implements IDisposable

    Private Shared client As New HttpClient()
    Private cts As CancellationTokenSource = Nothing
    Private interval As Integer = 0
    Private disposed As Boolean

    Public Sub StartDownload(progress As IProgress(Of String), url As Uri, intervalSeconds As Integer)

        interval = intervalSeconds * 1000
        Task.Run(Function() DownloadAsync(progress, url, cts.Token))
    End Sub

    Private Async Function DownloadAsync(progress As IProgress(Of String), url As Uri, token As CancellationToken) As Task
        token.ThrowIfCancellationRequested()

        Dim responseData As String = String.Empty
        Dim pattern As String = "<(?:[^>=]|='[^']*'|=""[^""]*""|=[^'""][^\s>]*)*>"
        Dim downloadTimeWatch As Stopwatch = New Stopwatch()
        downloadTimeWatch.Start()
        Do
            Try
                Using response = Await client.GetAsync(url, HttpCompletionOption.ResponseContentRead, token)
                    responseData = Await response.Content.ReadAsStringAsync()
                    responseData = WebUtility.HtmlDecode(Regex.Replace(responseData, pattern, ""))
                End Using
                progress.Report(responseData)

                Dim delay = interval - CInt(downloadTimeWatch.ElapsedMilliseconds)
                Await Task.Delay(If(delay <= 0, 10, delay), token)
                downloadTimeWatch.Restart()
            Catch tcEx As TaskCanceledException
                ' Don't care - catch a cancellation request
                Debug.Print(tcEx.Message)
            Catch wEx As WebException
                ' Internet connection failed? Internal server error? See what to do
                Debug.Print(wEx.Message)
            End Try
        Loop
    End Function

    Public Async Function StopDownload() As Task
        Try
            cts.Cancel()
            client?.CancelPendingRequests()
            Await Task.Delay(interval)
        Finally
            client?.Dispose()
            cts?.Dispose()
        End Try
    End Function

    Protected Overridable Sub Dispose(disposing As Boolean)
        If Not disposed AndAlso disposing Then
            client?.Dispose()
            client = Nothing
        End If
        disposed = True
    End Sub

    Public Sub Dispose() Implements IDisposable.Dispose
        Dispose(True)
    End Sub
End Class

A: Your listbox and richtextbox accesses must run on the UI thread.  The easiest way to do it is like this.
                                     Me.Invoke(Sub()
                                                   ListBox1.Items.Clear()
                                                   ListBox1.Items.AddRange(Split(clientdecode, vbLf))
                                                   RichTextBox1.SelectionStart() = RichTextBox1.TextLength
                                                   RichTextBox1.ScrollToCaret()
                                               End Sub)


text:
Q: how to fit a muted sinusoidal curve to data python? I have a data set of a muted oscillation, and want to fit it to and get out the vaules on the form Ae^-(kt)*sin(cx+phase)+d.
Any ideas how I can do that?
this is my data:
t = np.array([0.0, 0.2, 0.4, 0.6000000000000001, 0.8, 1.0, 1.2, 1.4, 1.5999999999999999, 1.7999999999999998, 1.9999999999999998, 2.1999999999999997, 2.4, 2.6, 2.8000000000000003, 3.0000000000000004, 3.2000000000000006, 3.400000000000001, 3.600000000000001, 3.800000000000001, 4.000000000000001, 4.200000000000001, 4.400000000000001, 4.600000000000001, 4.800000000000002, 5.000000000000002, 5.200000000000002, 5.400000000000002, 5.600000000000002, 5.8000000000000025, 6.000000000000003, 6.200000000000003, 6.400000000000003, 6.600000000000003, 6.800000000000003, 7.0000000000000036, 7.200000000000004, 7.400000000000004, 7.600000000000004, 7.800000000000004, 8.000000000000004, 8.200000000000003, 8.400000000000002, 8.600000000000001, 8.8, 9.0, 9.2, 9.399999999999999, 9.599999999999998, 9.799999999999997, 9.999999999999996, 10.199999999999996, 10.399999999999995, 10.599999999999994, 10.799999999999994, 10.999999999999993, 11.199999999999992, 11.399999999999991, 11.59999999999999, 11.79999999999999, 11.99999999999999, 12.199999999999989, 12.399999999999988, 12.599999999999987, 12.799999999999986, 12.999999999999986, 13.199999999999985, 13.399999999999984, 13.599999999999984, 13.799999999999983, 13.999999999999982, 14.199999999999982, 14.39999999999998, 14.59999999999998, 14.79999999999998, 14.999999999999979, 15.199999999999978, 15.399999999999977, 15.599999999999977, 15.799999999999976, 15.999999999999975, 16.199999999999974, 16.399999999999974, 16.599999999999973, 16.799999999999972, 16.99999999999997, 17.19999999999997, 17.39999999999997, 17.59999999999997, 17.79999999999997, 17.999999999999968, 18.199999999999967, 18.399999999999967, 18.599999999999966, 18.799999999999965, 18.999999999999964, 19.199999999999964, 19.399999999999963, 19.599999999999962, 19.79999999999996, 19.99999999999996, 20.19999999999996, 20.39999999999996, 20.59999999999996, 20.799999999999958, 20.999999999999957, 21.199999999999957, 21.399999999999956, 21.599999999999955, 21.799999999999955, 21.999999999999954, 22.199999999999953, 22.399999999999952, 22.59999999999995, 22.79999999999995, 22.99999999999995, 23.19999999999995, 23.39999999999995, 23.599999999999948, 23.799999999999947, 23.999999999999947, 24.199999999999946, 24.399999999999945, 24.599999999999945, 24.799999999999944, 24.999999999999943, 25.199999999999942, 25.39999999999994, 25.59999999999994, 25.79999999999994, 25.99999999999994, 26.19999999999994, 26.399999999999938, 26.599999999999937, 26.799999999999937, 26.999999999999936, 27.199999999999935, 27.399999999999935, 27.599999999999934, 27.799999999999933, 27.999999999999932, 28.199999999999932, 28.39999999999993, 28.59999999999993, 28.79999999999993, 28.99999999999993, 29.19999999999993, 29.399999999999928, 29.599999999999927, 29.799999999999926, 29.999999999999925, 30.199999999999925, 30.399999999999924, 30.599999999999923, 30.799999999999923, 30.999999999999922, 31.19999999999992, 31.39999999999992, 31.59999999999992, 31.79999999999992, 31.99999999999992, 32.19999999999992, 32.39999999999992, 32.59999999999992, 32.799999999999926, 32.99999999999993, 33.19999999999993, 33.399999999999935, 33.59999999999994, 33.79999999999994, 33.99999999999994, 34.199999999999946, 34.39999999999995, 34.59999999999995, 34.799999999999955, 34.99999999999996, 35.19999999999996, 35.39999999999996, 35.599999999999966, 35.79999999999997, 35.99999999999997, 36.199999999999974, 36.39999999999998, 36.59999999999998, 36.79999999999998, 36.999999999999986, 37.19999999999999, 37.39999999999999, 37.599999999999994, 37.8, 38.0, 38.2, 38.400000000000006, 38.60000000000001, 38.80000000000001, 39.000000000000014, 39.20000000000002, 39.40000000000002, 39.60000000000002, 39.800000000000026, 40.00000000000003, 40.20000000000003, 40.400000000000034, 40.60000000000004, 40.80000000000004, 41.00000000000004, 41.200000000000045, 41.40000000000005, 41.60000000000005, 41.800000000000054, 42.00000000000006, 42.20000000000006, 42.40000000000006, 42.600000000000065, 42.80000000000007, 43.00000000000007, 43.200000000000074, 43.40000000000008, 43.60000000000008, 43.80000000000008, 44.000000000000085, 44.20000000000009, 44.40000000000009, 44.600000000000094, 44.8000000000001, 45.0000000000001, 45.2000000000001, 45.400000000000105, 45.60000000000011, 45.80000000000011, 46.000000000000114, 46.20000000000012, 46.40000000000012, 46.60000000000012, 46.800000000000125, 47.00000000000013, 47.20000000000013, 47.400000000000134, 47.600000000000136, 47.80000000000014, 48.00000000000014, 48.200000000000145, 48.40000000000015, 48.60000000000015, 48.80000000000015, 49.000000000000156, 49.20000000000016, 49.40000000000016, 49.600000000000165, 49.80000000000017, 50.00000000000017, 50.20000000000017, 50.400000000000176, 50.60000000000018, 50.80000000000018, 51.000000000000185, 51.20000000000019, 51.40000000000019, 51.60000000000019, 51.800000000000196, 52.0000000000002, 52.2000000000002, 52.400000000000205, 52.60000000000021, 52.80000000000021, 53.00000000000021, 53.200000000000216, 53.40000000000022, 53.60000000000022, 53.800000000000225, 54.00000000000023, 54.20000000000023, 54.40000000000023, 54.600000000000236, 54.80000000000024, 55.00000000000024, 55.200000000000244, 55.40000000000025, 55.60000000000025, 55.80000000000025, 56.000000000000256, 56.20000000000026, 56.40000000000026, 56.600000000000264, 56.80000000000027, 57.00000000000027, 57.20000000000027, 57.400000000000276, 57.60000000000028, 57.80000000000028, 58.000000000000284, 58.20000000000029, 58.40000000000029, 58.60000000000029, 58.800000000000296, 59.0000000000003, 59.2000000000003, 59.400000000000304, 59.60000000000031, 59.80000000000031, 60.00000000000031, 60.200000000000315, 60.40000000000032, 60.60000000000032, 60.800000000000324, 61.00000000000033, 61.20000000000033, 61.40000000000033, 61.600000000000335, 61.80000000000034, 62.00000000000034, 62.200000000000344, 62.40000000000035, 62.60000000000035, 62.80000000000035, 63.000000000000355, 63.20000000000036, 63.40000000000036, 63.600000000000364, 63.80000000000037, 64.00000000000037, 64.20000000000037, 64.40000000000038, 64.60000000000038, 64.80000000000038, 65.00000000000038, 65.20000000000039, 65.40000000000039, 65.60000000000039, 65.8000000000004, 66.0000000000004, 66.2000000000004, 66.4000000000004, 66.6000000000004, 66.80000000000041, 67.00000000000041, 67.20000000000041, 67.40000000000042, 67.60000000000042, 67.80000000000042, 68.00000000000043, 68.20000000000043, 68.40000000000043, 68.60000000000043, 68.80000000000044, 69.00000000000044, 69.20000000000044, 69.40000000000045, 69.60000000000045, 69.80000000000045, 70.00000000000045, 70.20000000000046, 70.40000000000046, 70.60000000000046, 70.80000000000047, 71.00000000000047, 71.20000000000047, 71.40000000000047, 71.60000000000048, 71.80000000000048, 72.00000000000048, 72.20000000000049, 72.40000000000049, 72.60000000000049, 72.8000000000005, 73.0000000000005, 73.2000000000005, 73.4000000000005, 73.6000000000005, 73.80000000000051, 74.00000000000051, 74.20000000000051, 74.40000000000052, 74.60000000000052, 74.80000000000052, 75.00000000000053, 75.20000000000053, 75.40000000000053, 75.60000000000053, 75.80000000000054, 76.00000000000054, 76.20000000000054, 76.40000000000055, 76.60000000000055, 76.80000000000055, 77.00000000000055, 77.20000000000056, 77.40000000000056, 77.60000000000056, 77.80000000000057, 78.00000000000057, 78.20000000000057, 78.40000000000057, 78.60000000000058, 78.80000000000058, 79.00000000000058, 79.20000000000059, 79.40000000000059, 79.60000000000059, 79.8000000000006, 80.0000000000006, 80.2000000000006, 80.4000000000006, 80.6000000000006, 80.80000000000061, 81.00000000000061, 81.20000000000061, 81.40000000000062, 81.60000000000062, 81.80000000000062, 82.00000000000063, 82.20000000000063, 82.40000000000063, 82.60000000000063, 82.80000000000064, 83.00000000000064, 83.20000000000064, 83.40000000000065, 83.60000000000065, 83.80000000000065, 84.00000000000065, 84.20000000000066, 84.40000000000066, 84.60000000000066, 84.80000000000067, 85.00000000000067, 85.20000000000067, 85.40000000000067, 85.60000000000068, 85.80000000000068, 86.00000000000068, 86.20000000000068, 86.40000000000069, 86.60000000000069, 86.8000000000007, 87.0000000000007, 87.2000000000007, 87.4000000000007, 87.6000000000007, 87.80000000000071, 88.00000000000071, 88.20000000000071, 88.40000000000072, 88.60000000000072, 88.80000000000072, 89.00000000000072, 89.20000000000073, 89.40000000000073, 89.60000000000073, 89.80000000000074, 90.00000000000074, 90.20000000000074, 90.40000000000074, 90.60000000000075, 90.80000000000075, 91.00000000000075, 91.20000000000076, 91.40000000000076, 91.60000000000076, 91.80000000000076, 92.00000000000077, 92.20000000000077, 92.40000000000077, 92.60000000000078, 92.80000000000078, 93.00000000000078, 93.20000000000078, 93.40000000000079, 93.60000000000079, 93.8000000000008, 94.0000000000008, 94.2000000000008, 94.4000000000008, 94.6000000000008, 94.80000000000081, 95.00000000000081, 95.20000000000081, 95.40000000000082, 95.60000000000082, 95.80000000000082, 96.00000000000082, 96.20000000000083, 96.40000000000083, 96.60000000000083, 96.80000000000084, 97.00000000000084, 97.20000000000084, 97.40000000000084, 97.60000000000085, 97.80000000000085, 98.00000000000085, 98.20000000000086, 98.40000000000086, 98.60000000000086, 98.80000000000086, 99.00000000000087, 99.20000000000087, 99.40000000000087, 99.60000000000088, 99.80000000000088, 100.00000000000088, 100.20000000000088, 100.40000000000089, 100.60000000000089, 100.80000000000089, 101.0000000000009, 101.2000000000009, 101.4000000000009, 101.6000000000009, 101.8000000000009, 102.00000000000091, 102.20000000000091, 102.40000000000092, 102.60000000000092, 102.80000000000092, 103.00000000000092, 103.20000000000093, 103.40000000000093, 103.60000000000093, 103.80000000000094, 104.00000000000094, 104.20000000000094, 104.40000000000094, 104.60000000000095, 104.80000000000095, 105.00000000000095, 105.20000000000095, 105.40000000000096, 105.60000000000096, 105.80000000000096, 106.00000000000097, 106.20000000000097, 106.40000000000097, 106.60000000000097, 106.80000000000098, 107.00000000000098, 107.20000000000098, 107.40000000000099, 107.60000000000099, 107.80000000000099, 108.000000000001, 108.200000000001, 108.400000000001, 108.600000000001, 108.800000000001, 109.00000000000101, 109.20000000000101, 109.40000000000101, 109.60000000000102, 109.80000000000102, 110.00000000000102, 110.20000000000103, 110.40000000000103, 110.60000000000103, 110.80000000000103, 111.00000000000104, 111.20000000000104, 111.40000000000104, 111.60000000000105, 111.80000000000105, 112.00000000000105, 112.20000000000105, 112.40000000000106, 112.60000000000106, 112.80000000000106, 113.00000000000107, 113.20000000000107, 113.40000000000107, 113.60000000000107, 113.80000000000108, 114.00000000000108, 114.20000000000108, 114.40000000000109, 114.60000000000109, 114.80000000000109, 115.0000000000011, 115.2000000000011, 115.4000000000011, 115.6000000000011, 115.8000000000011, 116.00000000000111, 116.20000000000111, 116.40000000000111, 116.60000000000112, 116.80000000000112, 117.00000000000112, 117.20000000000113, 117.40000000000113, 117.60000000000113, 117.80000000000113, 118.00000000000114, 118.20000000000114, 118.40000000000114, 118.60000000000115, 118.80000000000115, 119.00000000000115, 119.20000000000115, 119.40000000000116, 119.60000000000116, 119.80000000000116, 120.00000000000117, 120.20000000000117, 120.40000000000117, 120.60000000000117, 120.80000000000118, 121.00000000000118, 121.20000000000118, 121.40000000000119, 121.60000000000119, 121.80000000000119, 122.0000000000012, 122.2000000000012, 122.4000000000012, 122.6000000000012, 122.8000000000012, 123.00000000000121, 123.20000000000121, 123.40000000000121, 123.60000000000122, 123.80000000000122, 124.00000000000122, 124.20000000000122, 124.40000000000123, 124.60000000000123, 124.80000000000123, 125.00000000000124, 125.20000000000124, 125.40000000000124, 125.60000000000124, 125.80000000000125, 126.00000000000125, 126.20000000000125, 126.40000000000126, 126.60000000000126, 126.80000000000126, 127.00000000000126, 127.20000000000127, 127.40000000000127, 127.60000000000127, 127.80000000000128, 128.00000000000128, 128.20000000000127, 128.40000000000126, 128.60000000000124, 128.80000000000123, 129.00000000000122, 129.2000000000012, 129.4000000000012, 129.6000000000012, 129.80000000000118, 130.00000000000117, 130.20000000000115, 130.40000000000114, 130.60000000000113, 130.80000000000112, 131.0000000000011, 131.2000000000011, 131.40000000000109, 131.60000000000107, 131.80000000000106, 132.00000000000105, 132.20000000000104, 132.40000000000103, 132.60000000000102, 132.800000000001, 133.000000000001, 133.20000000000098, 133.40000000000097, 133.60000000000096, 133.80000000000095, 134.00000000000094, 134.20000000000093, 134.40000000000092, 134.6000000000009, 134.8000000000009, 135.00000000000088, 135.20000000000087, 135.40000000000086, 135.60000000000085, 135.80000000000084, 136.00000000000082, 136.2000000000008, 136.4000000000008, 136.6000000000008, 136.80000000000078, 137.00000000000077, 137.20000000000076, 137.40000000000074, 137.60000000000073, 137.80000000000072, 138.0000000000007, 138.2000000000007, 138.4000000000007, 138.60000000000068, 138.80000000000067, 139.00000000000065, 139.20000000000064, 139.40000000000063, 139.60000000000062, 139.8000000000006, 140.0000000000006, 140.20000000000059, 140.40000000000057, 140.60000000000056, 140.80000000000055, 141.00000000000054, 141.20000000000053, 141.40000000000052, 141.6000000000005, 141.8000000000005, 142.00000000000048, 142.20000000000047, 142.40000000000046, 142.60000000000045, 142.80000000000044, 143.00000000000043, 143.20000000000041, 143.4000000000004, 143.6000000000004, 143.80000000000038, 144.00000000000037, 144.20000000000036, 144.40000000000035, 144.60000000000034, 144.80000000000032, 145.0000000000003, 145.2000000000003, 145.4000000000003, 145.60000000000028, 145.80000000000027, 146.00000000000026, 146.20000000000024, 146.40000000000023, 146.60000000000022, 146.8000000000002, 147.0000000000002, 147.2000000000002, 147.40000000000018, 147.60000000000016, 147.80000000000015, 148.00000000000014, 148.20000000000013, 148.40000000000012, 148.6000000000001, 148.8000000000001, 149.00000000000009, 149.20000000000007, 149.40000000000006, 149.60000000000005, 149.80000000000004, 150.00000000000003, 150.20000000000002, 150.4, 150.6, 150.79999999999998])

data = np.array([-17.895166829633922, -7.850310582296288, -10.400080032016035, -12.555264688814987, -14.875887137689688, -17.403405204309593, -9.384189611217494, -4.8134501496749635, -11.288830542083133, -11.008508544742426, -11.008508544742426, -24.399675324728832, -11.801622922577621, -11.553206224788369, -6.85295195569654, 7.054570807289565, 59.28761332019553, 294.39871205088207, 238.80102498356405, 107.75489263075929, 56.92080305897116, -17.532368285997904, -134.43846589745613, -223.57517841817833, -278.0, -323.0007278024234, -321.8488538118969, -307.68383188196503, -254.07407770337704, -164.82546181276848, -80.251646949563, 130.4490343719881, 212.22747473618847, 274.903109187615, 306.2431386335884, 335.63590915224904, 314.16917348199877, 200.52715789444392, 113.2666646883099, 24.431244694397265, -75.25725464168488, -162.69840080405845, -224.60328495721353, -332.20357038414545, -337.45260390066187, -320.4436208691852, -266.3334080382526, -205.55236341947034, -112.4210341145465, 73.40943322457747, 162.27300574567516, 236.84561995461172, 276.76959864616015, 310.3696452130366, 293.9325135910983, 223.85574521497438, 156.265835905348, 76.00552484782497, -15.213590764328956, -110.83594377888971, -192.69711856619517, -303.31195000905814, -331.89676302203065, -319.0296677859461, -287.8587395806828, -233.15509913496885, -164.83492736625703, -67.45875421815094, 23.37118210253948, 187.06975569513065, 248.12558991541073, 287.5854499800773, 301.7621735665348, 280.519275330671, 233.45968973666368, 111.64165400541356, 26.941656989437433, -60.88672962601561, -145.48163697929465, -213.9598000100749, -266.67772803446826, -302.39559074296324, -293.72072485656827, -250.031579603468, -183.2279637046255, -115.92170365230322, -22.882985659754695, 138.31354603174486, 208.54995794181536, 260.57782130808505, 290.0615370050757, 270.0687481537857, 259.0657981365662, 141.19416259812579, 61.17878993191425, -19.60613895279016, -96.13348896023115, -177.67314112783788, -276.2098392592062, -296.73146711774814, -290.4112285478601, -261.0060080347773, -210.10000625078135, -159.49426809691636, 11.77884104144573, 83.47153598070395, 161.51525811659826, 219.3152565554533, 256.2069341146414, 277.43465853611383, 229.30302993255054, 176.12646880507646, 99.854044458099, 25.75286627650712, -55.33147113775658, -133.13284928673488, -246.0314142584134, -274.20655072228317, -277.96721384899706, -267.72242388712834, -230.3693182025222, -190.19514517173047, -33.844274718423776, 32.17464947099916, 111.67731545217589, 172.6005242684446, 226.465931596985, 257.5014792890777, 249.70790265045184, 196.61510018729678, 140.9509112034275, 71.42868465747665, -3.238856530507519, -156.2365667235449, -217.74751499285276, -246.20945279481236, -265.9462385015448, -269.8918997876053, -245.61266363184689, -143.74368689169137, -77.51085797206201, 5.795254960368425, 74.05903898265615, 147.35560654450546, 196.51564432459804, 253.72781879643685, 234.7393301410541, 204.92715831032433, 164.40027247953253, 103.68218087567516, 33.30244895715646, -120.50576168251655, -175.75303416793895, -227.6241312514809, -254.48692929903586, -259.36293723264635, -244.44138042864415, -170.13334391702392, -104.11700534782085, -38.95520185729845, 48.821986926981026, 96.6200793406922, 159.16380375035556, 223.85574521497438, 238.6472680465049, 180.80476989303338, 122.97484526356538, 71.36950206670804, -71.41382920905983, -140.96835500656255, -193.7353370382864, -236.49886877910774, -256.5970533638722, -250.27373350660037, -191.9242088901542, -142.58083950145533, -71.95096077017377, -9.160352503958848, 72.72988321187472, 131.29750722587664, 209.90819326701785, 222.006493489381, 223.64824808370713, 200.52715789444392, 146.92004909587422, 94.81853713630267, -34.94307858463981, -111.17409917159148, -153.27133817059678, -203.9925558656421, -227.6241312514809, -248.38067251414896, -198.64064681548166, -168.8674301871315, -112.02895369616738, -36.996402884346935, 33.30244895715646, 87.82330090046821, 177.95286101764145, 208.06403772543922, 205.37483929855966, 201.85477677814174, 164.4070844472967, 124.97136527755629, 6.20470378757841, -61.78061610194868, -124.038375548918, -176.1175142743433, -204.0223328156046, -226.61248414338388, -201.36658491007188, -173.39734640631218, -131.03697461155969, -74.76954711686165, -8.864644516037515, 54.75161422746851, 157.8424551282592, 184.13902038246783, 205.87499357458614, 184.98953970317257, 167.7537943050745, 138.31354603174486, 35.44727270197609, -39.77116101406261, -89.43495612748802, -135.32520328981695, -182.2705756106045, -212.38355082157443, -211.56152397319931, -184.6322031966597, -151.8997727537884, -102.54641992000495, -46.713957331468464, 20.681328054408823, 122.76299374582322, 171.03005888927305, 185.2238284103944, 184.13902038246783, 173.9662157342159, 144.69822897586528, 54.676476682001294, 2.916580968047924, -56.42147675191427, -104.11700534782085, -156.18034691159744, -182.8796943612133, -205.56230819285952, -192.25676401452267, -160.82157351943988, -117.8565137826763, -67.56061202855062, -11.040541363164266, 85.10182174992292, 141.18721327158596, 169.95254141850978, 183.65656702420074, 168.84010790267916, 153.55317884486908, 81.33312970879797, 30.35378597859676, -25.471686542230486, -76.42193684727147, -129.14586905662975, -173.6173124699436, -192.5013761479472, -186.01941770451901, -168.59165680390356, -139.2761631837567, -96.93921341457224, -41.37210446942015, 60.6484016706886, 108.42031455083998, 135.83768484022198, 159.97777756673645, 165.1153134905528, 156.5333257134148, 99.04643726040626, 52.95437343283925, 5.346246361308999, -42.68619362690788, -96.93921341457224, -137.76150050573892, -183.63446344852935, -187.3895210976218, -169.40973120074727, -142.40562473008163, -109.21811741132365, -62.514907768992884, 37.274558079207736, 81.33312970879797, 110.09999553611283, 135.36980927558943, 152.21856808433404, 150.04137857233354, 106.5804941874992, 72.4786372026008, 29.038016628843025, -14.803536983777235, -69.30238652370338, -121.62170220114001, -173.4451601956988, -178.76958669692556, -175.18744618926576, -148.4293412609735, -124.48094317513414, -78.33482409183068, 6.259809300751613, 53.65407910654858, 89.10509051682584, 131.59887876609264, 143.14526404959065, 142.25691579612567, 111.6701832535266, 84.67072674845917, 51.003298769612684, 10.43912116304125, -40.538293690771866, -88.6010635994852, -154.39261340261908, -165.65883672534358, -174.76590107922436, -157.2397757868863, -136.41428583109257, -103.89625318068568, -17.218050123794796, 31.683253201279058, 61.17878993191425, 103.06423893681904, 131.0241014106582, 143.12445121938163, 123.22195531149146, 99.04643726040626, 66.92896701685959, 30.63057806312804, -12.35477247670849, -63.93446315807489, -137.10138045704298, -151.45238920604993, -159.94588407560786, -157.2397757868863, -140.64621700943871, -121.07255639169296, -48.90062948725222, 0.5127411368943058, 41.66534601079252, 75.13593618495565, 99.91891595737752, 128.06150976122558, 111.43479525115504, 103.06423893681904, 81.58966649561125, 40.78256551962272, 0.2593726365521434, -35.435481868952934, -110.0533349136739, -132.90479422128863, -139.2761631837567, -145.52790675464837, -140.41619150308463, -117.8565137826763, -55.80924338998125, -13.71088533498471, 18.832347858483672, 54.52618568074695, 82.65914172719022, 104.14182221115811, 107.9051838147991, 102.57539070392886, 79.99816513607038, 54.29319268705285, 18.622379690428488, -17.693595707454847, -90.78294184670403, -108.99611543567698, -127.78460679945056, -140.1678322802726, -131.5468139963291, -124.038375548918, -68.63928274013904, -38.05761487627262, -0.5803647639897918, 34.612846943785144, 67.65671714140944, 90.18907465944244, 106.37986366648511, 97.50891644266221, 94.60852794100765, 65.58356253710008, 40.78256551962272, 1.3357503816425833, -66.01694930470285, -91.03536520712612, -115.59964221831842, -121.72977084673153, -114.66989327957924, -103.47255970930473, -74.88075626688124, -47.81914381962474, -17.919358116488638, 21.534778861091127, 39.21303842451357, 100.14233321678171, 98.80836937678282, 96.38148936069956, 83.99817184490757, 70.03703640199296, 50.52062686210866, 18.886777055668063, -50.95047051781523, -79.97634438687533, -89.68700976243952, -112.75978690208046, -116.38710841886348, -111.17409917159148, -99.56274241439348, -64.44196370608745, -35.65714453278815, -4.5985876278072055, 19.55524378247901, 49.10150599458598, 74.05903898265615, 90.29814141440784, 86.1824665629349, 69.79257267310368, 62.26862306047178, 22.596726704089406, -10.14401036949323, -55.80085935901195, -75.70240287154752, -101.18098611439689, -113.80359295520498, -100.6881722973136, -92.7257770982551, -69.5490443409609, -43.174265961026435, -12.611409730389937, 9.372355913186425, 43.88424411792016, 70.29625566323239, 85.1091269823296, 72.4786372026008, 77.32331898106554, 62.03731278346845, 36.78555588047743, -13.197110758601411, -32.93500727945434, -66.58492698070586, -80.57006719172205, -96.79027600446568, -104.92983697395039, -88.34930694975333, -73.30794814944647, -60.44010194195755, -32.247475073574606, -1.8650883934234344, 21.496000961710024, 62.26862306047178, 68.23559577672995, 80.24034047543842, 63.88639995113067, 62.03731278346845, 41.901136038934055, 3.1771809510911453, -31.184389172301735, -43.174265961026435, -66.83087412702059, -82.17242981252173, -86.94420537001122, -78.4121082796321, -73.30794814944647, -65.27993564230894, -39.41667024412584, -26.78893415503103, 2.142282487990883, 46.74973385376347, 61.440152318364426, 63.37970914304128, 65.47942797619339, 57.168215418731506, 44.54445141018118, 12.037181319740398, -6.19125327580457, -40.761123355031714, -52.92111087956812, -72.43720210324045, -80.57006719172205, -80.19141754875159, -75.93362120243296, -60.684457095534526, -49.625073213591236, -35.19745589170725, -9.440156712253383, 38.37397907426157, 47.24169422133559, 57.168215418731506, 59.85606508539263, 46.74973385376347, 36.56390153683401, 17.727590366240975, -0.6279179608740151, -17.032729643116568, -38.32104067238345, -53.38931638832298, -63.79072082334767, -73.53857527391983, -76.14776329442782, -57.15163850694478, -56.42147675191427, -26.33338981136501, -11.737509469578413, 12.639721505086072, 36.56390153683401, 45.65145763173177, 52.32198508738384, 39.92952144417768, 43.46665822891623, 18.622379690428488, 2.6717138342514772, -15.285970743349822, -27.578501863889414, -37.341786648567904, -55.80085935901195, -64.44196370608745, -62.464248695596666, -63.10613055105273, -48.06029294970881, -43.80333264909257, -17.218050123794796, 1.3357503816425833, 23.06146961349782, 29.53066332840808, 39.44937943666446, 35.22533455709913, 28.41417555809585, 19.55524378247901, 8.869962262113177, -5.076122285871861, -19.048941672697993, -27.676224455500574, -52.252642916724085, -55.33147113775658, -59.08465150677057, -53.79081786462643, -48.06029294970881, -43.174265961026435, -14.369546468168778, -6.19125327580457, 6.432978607050131, 25.513399237305748, 31.683253201279058, 31.683253201279058, 31.122471181945002, 23.06146961349782, 17.727590366240975, 6.432978607050131, -8.832681316454455, -22.810048673508845, -39.16942775786049, -50.483455067084265, -48.06029294970881, -51.15903299869376, -40.538293690771866, -39.77116101406261, -36.05133605512867, -7.012462689590507, -1.9206380448015352, 6.432978607050131, 13.734340539575783, 28.159910611077294, 23.936168242508074, 18.22565616697193, 0.013861291022067235, 0.7977047856805939, -9.072430192873526, -17.177760120171342, -31.67490065929519, -34.67236274162724, -44.06004327391031, -41.09133557388395, -32.51751933858168, -37.59679144914378, -23.60454177850147, -16.340098424013036, -4.845285540579084, 4.873391118320683, 6.165340877162521, 10.43912116304125, 15.795301217548058, 16.411223633101145, 8.430164517921185, 2.4425909650383346, -7.523067597064369, -6.4223996122671, -16.380354461527418, -21.6761664312653, -31.184389172301735, -45.63492390070451, -17.46788465057716, -21.457638742779977, -27.676224455500574, -16.340098424013036, -11.841695921934388, -5.490169286532023, -5.299049467952386, 3.1771809510911453, 2.6717138342514772, -0.8419350765708487, -2.1825562136762073, -0.5803647639897918, -2.658945540290233, -15.857153121343458, -12.35477247670849, -21.70045026823982, -17.46788465057716, -23.39369554011057, -23.0288758023363, -21.457638742779977, -23.912782762092547, -17.46788465057716, -10.18401693111548, -11.288830542083133, -8.840672020681836, -3.755496909424096, -12.587347182721942, -6.4223996122671, -6.4223996122671, -5.944224656817141, -10.18401693111548, -7.754521087772673, -4.5985876278072055, -16.95216630818834, -19.266938070602237, -8.600978630396298, -18.814850797289182, -22.51835460095765, -12.35477247670849, -16.380354461527418, -13.461992696716038, -11.288830542083133, -11.737509469578413, -7.275710875616596, -11.288830542083133, -16.831333559097857, -9.072430192873526, -7.754521087772673, -9.952001151944728, -9.048452721111971, -9.952001151944728, -14.538298074707427, -13.919681953307531, -0.4297944174461463, -4.336040220193581, -11.288830542083133, -11.288830542083133, -11.521156959247378, -13.943776687279524, -15.052765218174954, -13.461992696716038, -9.072430192873526, -15.052765218174954, -11.937877684960881, -1.317691242678734, -11.288830542083133, -2.658945540290233, -13.197110758601411, -9.952001151944728, -8.329395459764896, -12.362791391580117, -9.440156712253383, -8.832681316454455, -12.611409730389937, -11.288830542083133, -4.845285540579084, -22.575066144266316, -15.285970743349822, -13.197110758601411, -18.564676844727273, -8.600978630396298, -3.9860835952615616, -16.831333559097857, -6.19125327580457, -9.072430192873526, -10.18401693111548, -13.71088533498471, -8.353355718694615, -11.040541363164266, -13.197110758601411, -12.84404429397307, -12.587347182721942, -13.943776687279524, -8.600978630396298, -6.4223996122671, -18.814850797289182, -15.285970743349822, -13.197110758601411, -13.461992696716038, -15.285970743349822, -6.4223996122671, -18.814850797289182, -14.803536983777235, -8.832681316454455, -8.353355718694615, -11.288830542083133, -9.704043795037592, -9.952001151944728, -11.040541363164266, -7.754521087772673, -11.521156959247378, -6.4223996122671, -3.755496909424096, -13.71088533498471, -20.381891839079117, -9.704043795037592, -12.106218077294557, -2.658945540290233, -6.119529027484305, -9.704043795037592, -15.285970743349822, -17.919358116488638, -13.197110758601411, -12.106218077294557, -16.1307933133254, -13.71088533498471, -12.611409730389937, -16.106645559997673, -7.523067597064369, -13.670737155632878, -11.040541363164266, -16.1307933133254, -12.362791391580117, -15.285970743349822, -16.380354461527418, -16.61387164909536, -12.587347182721942, -12.362791391580117, -12.84404429397307, -16.380354461527418, -9.952001151944728, -11.040541363164266, -9.952001151944728, -14.538298074707427, -13.197110758601411, -13.461992696716038, -9.704043795037592, -3.9860835952615616, -5.944224656817141, -11.521156959247378, -16.61387164909536, -17.177760120171342, -11.521156959247378, -7.275710875616596, -9.952001151944728, -3.9860835952615616, -8.832681316454455, -13.943776687279524])

A: When I look at the first 30 data points, I see:

so I removed the non-sine-wave part of the data. I also realized it is much easier to fit a sine wave to the first few cycles to give me some of the parameters, such as:
y = amplitude * sin(pi * (x - center) / width) + Offset

amplitude =  3.3098923173806202E+02
center =  2.1702445745645457E+02
width =  1.8508302910055434E+00
Offset = -9.6083629945476581E+00

rather than the entire data set. Now I can plug those parameters back in to the exponential decay equation as constants (or initial parameter estimates), and solve for the exponential decay using all data.


text:
Q: Why helper method for synchronizing both ends of the entity relationship locates in parent entity? In Hibernate guide and this blog, it is the parent entity (inverse side of the relationship) that has helper method for synchronizing both ends of the entity relationship.
Hibernate guide for parent entity:
@Entity(name = "Person")
public static class Person {

    @Id
    @GeneratedValue
    private Long id;

    @OneToMany(mappedBy = "person", cascade = CascadeType.ALL, orphanRemoval = true)
    private List<Phone> phones = new ArrayList<>();

    //Getters and setters are omitted for brevity

    public void addPhone(Phone phone) {
        phones.add( phone );
        phone.setPerson( this );
    }

    public void removePhone(Phone phone) {
        phones.remove( phone );
        phone.setPerson( null );
    }
}

Hibernate guide for child entity:
@Entity(name = "Phone")
public static class Phone {

    @Id
    @GeneratedValue
    private Long id;

    @NaturalId
    @Column(name = "`number`", unique = true)
    private String number;

    @ManyToOne
    private Person person;

    //Getters and setters are omitted for brevity

    @Override
    public boolean equals(Object o) {
        if ( this == o ) {
            return true;
        }
        if ( o == null || getClass() != o.getClass() ) {
            return false;
        }
        Phone phone = (Phone) o;
        return Objects.equals( number, phone.number );
    }

    @Override
    public int hashCode() {
        return Objects.hash( number );
    }
}

Why we don't need helper methods in child entity to make sure both entities are synchronized like the following?
@Entity(name = "Phone")
public static class Phone {

    @Id
    @GeneratedValue
    private Long id;

    @NaturalId
    @Column(name = "`number`", unique = true)
    private String number;

    @ManyToOne
    private Person person;

    //Getters and setters are omitted for brevity

    public void addPerson(Person person) {
        setPerson( person );
        person.getPhones().add( this );
    }

    public void removePerson(Person person) {
        setPerson( null );
        person.getPhones().remove( this );
    }
}

A: They just demonstrate the concept. It is perfectly valid to synchronise the relationship from the children entity as long as you can make sure that both of their relationship are configured property.


text:
Q: ZygoteInit$Method error in Fragment's onActivityCreated I have a fragment, and I want to load up the listview in a particular way from my sql lite database:
private ProductDbAdapter mDbHelper;
private ProductListAdapter productAdapter;
private View mView;

 @Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    // Open Database Connection
    mDbHelper = new ProductDbAdapter(getActivity());

    try {
        mDbHelper.open();
    } catch (SQLException e) {
        e.printStackTrace();
    }

    // Setup list view
    productAdapter = new ProductListAdapter(getActivity(), R.layout.product_row);
    ListView lv = (ListView) mView.findViewById(R.id.lvProducts);
    lv.setAdapter(productAdapter);

    Cursor productCursor = mDbHelper.fetchAll();
    getActivity().startManagingCursor(productCursor);

    int numProducts = productCursor.getCount();
    for(int i =0; i< numProducts; i++) {
        Product prdt = new Product();
        // The line below is where it throws an exception //
        prdt.Name = productCursor.getString(productCursor.getColumnIndexOrThrow(ProductDbAdapter.KEY_NAME));
        prdt.type = productCursor.getString(productCursor.getColumnIndexOrThrow(ProductDbAdapter.KEY_TYPE));
        String strDate = productCursor.getString(productCursor.getColumnIndexOrThrow(ProductDbAdapter.KEY_EXPDATE));

        // format into local date/time format
        SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");
        try {
            prdt.dateExpires = sdf.parse(strDate);
        } catch (ParseException e) {
            e.printStackTrace();
        }

        // Add to custom adapter
        productAdapter.add(prdt);
        productCursor.moveToNext();
    }

}
Whenever I do this, It stalls on the first reference to the SQLLite Data. It says "com.android.internal.os.ZygoteInit$MethodAndArgsCaller" is the error. I've never gotten this before and I have no clue why this line would cause it since the activity is already created and started. What can I do to fix this?


text:
Q: Does Julia have something equivalent to Ans (Matlab) or Last.value (R) Matlab and R both have variables that are automatically assigned to the  (Ans and Last.value respectively).
Is there an equivalent for Julia?
e.g.
function myBigSlowFunc()
    sleep(10)
    return(5)
end
myBigSlowFunc()
# Can I get the value that was returned without rerunning the function?

A: If you are at the repl you can use ans (just like matlab)


text:
Q: Do StackOverflow questions suffer from short attention spans? I find StackOverflow suffers from a problem of questions rolling out to the dark areas of StackOverflow too quickly because:

*

*SO doesn't support threaded discussions.

*The badge system seems to encourage people to concentrate on recent questions.

*"Fastest gun in the west" syndrome.

*No email notifications for comments or replies; people comment and move on.

*Ineffective search: no way to filter search on different criteria.

After approximately 2 days, if a question doesn't get answered, it has a very low chance to ever get answered unless a bounty is set up. These questions get placed under most people's radar.

A: The things you're listing as problems aren't problems at all.

*

*No threaded discussions because it's a Q&A site, not a discussion site. Questions that need discussion are questions that weren't worded properly or lack important information.

*Badge system encourages people to concentrate on answerable questions, and to do it quickly. What's wrong with quick answers? Low-quality quick answers will be downvoted.

*Again, questions are answered quickly, or comments are added quickly stating more information is needed. This is a good thing.

*There are notifications for comments and answers. It's the little envelope icon at the top of every page.

*Use Google if SO's search is inadequate.

A: 1) SO.com is not a discussion forum.
2) Recent questions should be the focus. We want good, fast answers.
3) FGITW is encouraged. See #2.
4) See #1.
5) Google works fine for me. Tag based searches on SO.com are pretty powerful as well.
And for the record, that is what the bounty is for, and works quite well for that.
It should also be pointed out that questions get recycled (or 'bumped') to the front page randomly forever after.
Perhaps you should think about posting some examples of the questions that should get answers but don't if you really are seeing a problem?

A: This question talks about how to pump up some interest into your older questions
How to get attention for your old unanswered questions
Basically, since it is assumed that you are still interested in a response you should be looking up answers for yourself, and editing the question with the new information that you have. That has two bonuses
Bumping: The question will be moved to the top of the "active questions"
Interest: If you have added context, or changed the phrasing, the question may come across in a way that will generate interest from people who may not have bothered before.
Make sure that you keep updating the question as you find new information, and people will return the favour.

A: The Unanswered page and the bounty system were both put in place to alleviate the problem of some questions not getting answered.  You can also bump a question to the top of the Active page simply by editing it.  I don't know if we really need even more solutions to take care of the very small percentage of questions that don't get answered.  It's just possible that no one on SO knows the answer to some questions.


text:
Q: ¿Qué es la autenticación LDAP? He de implementar la autenticación LDAP para las aplicaciones que se manejan en la compañía. Estas aplicaciones se venden a los clientes, los cuáles, han pedido poder autenticarse mediante ese protocolo.
He estado leyendo acerca de LDAP pero no logro entender la diferencia entre un logueo convencional, es decir, almacenar usuario y contraseña en una DB a hacerlo mediante LDAP, que según he leído y entiendo, es lo mismo.
Por otro lado, según entiendo, con LDAP se busca autenticar mediante usuario de red. eso quiere decir que;

*

*¿Solo quien inicie sesión en un pc con su usuario y contraseña de red, podrá autenticarse a la aplicación?

*¿Si me logueo con usuario de red, nadie más puede loguearse a la aplicación desde la sesión activa?

Realmente no entiendo muy bien el funcionamiento de LDAP. Agradecería orientación en el tema.
Gracias

A: LDAP es un protocolo que usan los servidores para comunicar y verificar la identidad un usario, nada más.  Solo es un protocol de autenticación.  Lo que se puede ver o hacer son temas de autorización, que vive afuera del mundo de LDAP.  LDAP determina quien es, no lo que se puede.
Para los usarios, la diferencia entre un logueo convencional y LDAP no les importan.  Tampoco con los programas, hay llamadas de API diferentes, pero lo que pasa entre servidores no le importa a la aplicación.  Un beneficio de LDAP es que todas las aplicaciones puede compartir credentiales y por eso el usario no necesita cuentas para cada aplicación.


text:
Q: The World Awaits You please assist, I would like to add this The World Awaits You below my logo on wordpress site. where do i add additional html on header.php, i am not familiar with php at all.

A: The best is probably to share your header.php code (it can be different for every theme..) and maybe make a picture of how it exactly should look like...
Taking the header.php from the current twentytwelve theme https://github.com/WordPress/WordPress/blob/master/wp-content/themes/twentytwelve/header.php
the easiest approach is to write your "The World Awaits You" into line 39

The World Awaits You


text:
Q: Are there anyway to reduced complexiy of following java code? I need to reduced following java method complexity according to sonar acceptable level. now ,it given this like sonar issue.

need some expert help to do this.
public List<X> Y(final DateTime treatmentDiscontinueTime,
                                                    final List< P> validPrescribedPrescriptions)
  {
    final List<x> doseWrapperList = new ArrayList<>();
    final int noOfPrescriptions = validPrescribedPrescriptions.size();

    for (int prescriptionIndex = 0; prescriptionIndex < noOfPrescriptions; prescriptionIndex++)
    {
      final BasePrescribedPrescription basePrescribedPrescription = validPrescribedPrescriptions.get(prescriptionIndex);
      final String firstDoseText = basePrescribedPrescription.getFirstText();
      final String secondDoseText = basePrescribedPrescription.getSecondText();
      final boolean accordingToSchedule = A.ACCORDING.equals(firstDoseText);
      final boolean specificPrescription = A.SP.equals(firstDoseText);
      final boolean specificVbTypePrescription = A.SPVB.equals(firstDoseText);

      List<D> doseDetails = new ArrayList<>(basePrescribedPrescription.getDoseDetails());

      final DateTime changedDosageEndDate =
        getChangedDoseEndDate(basePrescribedPrescription.getActualTerminateDate(), treatmentDiscontinueTime);
      final int noOfDosages = doseDetails.size();

      for (int doseIndex = 0; doseIndex < noOfDosages; doseIndex++)
      {
        final D doseDetail = doseDetails.get(doseIndex);

        if ((doseDetail.getStart().getStartDate() != null) && (changedDosageEndDate != null) &&
            doseDetail.getStart().getStartDate().isAfter(changedDosageEndDate))
        {
          continue;
        }

        String previewDoseText;

        if (accordingToSchedule)
        {
          previewDoseText = X
        }
        else if (specificPrescription)
        {
          previewDoseText = Y;
        }
        else if (specificVbTypePrescription)
        {
          previewDoseText = Z;
        }
        else if (noOfDosages == 2)
        {

          previewDoseText = ((doseIndex == 0) ? secondDoseText : firstDoseText);
        }
        else
        {
          previewDoseText = firstDoseText;
        }

        final boolean isUnplanned =isuNplaned()

        if (!isUnplanned)
        {
          doseStart = getStartDate();
          doseEnd = getEndDate();
        }

        doseWrapperList.add(new DoseInfoLiteDTOWrapper(previewDoseText, doseStart, doseEnd, doseDetail));

      }
    }
    return doseWrapperList;
  }

i need some expert help to resoled this sonar issue. I thing different way to extract code fragment , breakdown this method to little parts.but still couldn't find some proper way to do it.

A: It's not difficult to clear, i think:

*

*Use simple For loop

*Create more small methods to do small(clear) things for For loop

*Block if/esle: use simple statement

Hint: Study TDD to write clean code as possible


text:
Q: C# Bouncycastle Blowfish CTR decryption I'm having a bad time trying to figure out how to use the C# bouncycastle library to decrypt a blowfish CTR ciphered text.I'm not getting how to use it due to the lack of BC documentation about how to use it properly.
I searched extensively without found something similar in stack overflow, If you have some examples about how to use BC to encrypt/decrypt in Blowfish CTR mode cipher using BC C# libraries will be greatly appreciated.

A: Nevermind, after a long week I decided to use AES CBC instead Blowfish CTR using Zeroes as padding.


text:
Q: How to alias a starred group of columns in BigQuery? Consider:

*

*table users with column id,

*table features, with columns id, day, x, y, and z.

My query is:
SELECT
  users.*,
  a.* EXCEPT(id, day),
  b.* EXCEPT(id, day)
FROM
  users
  LEFT JOIN features AS a
    ON users.id = a.id
    AND a.day = DATE("2021-04-14")
  LEFT JOIN features AS b
    ON users.id = b.id
    AND b.day = DATE("2020-01-01")

And it returns the following columns:
id | x | y | z | x_1 | y_2 | z_3
--------------------------------
...

Is there any way to alias the columns with a custom suffix? Something like:
SELECT
  a.* AS *_from_a,
  b.* AS *_from_b

To obtain:
id | x_from_a | y_from_a | z_from_a | x_from_b | y_from_b | z_from_b
--------------------------------------------------------------------
...

A: Below is the option I can think of (not exactly the way you expect - but I think will meet your goal)
SELECT
  a as from_a,
  b as from_b
FROM
  mytable AS a,
  mytable AS b

will return below

A: Below is answer on updated question:
SELECT
  users.*,
  (SELECT AS STRUCT * EXCEPT(id, day) FROM UNNEST([a])) AS from_a,
  (SELECT AS STRUCT * EXCEPT(id, day) FROM UNNEST([b])) AS from_b,
FROM
  users
  LEFT JOIN features AS a
    ON users.id = a.id
    AND a.day = DATE("2021-04-14")
  LEFT JOIN features AS b
    ON users.id = b.id
    AND b.day = DATE("2020-01-01")

with output  as


text:
Q: Не корректно работает urlopen?
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
HTTPError: HTTP Error 407: Proxy Authentication Required ( The ISA Server requires authorization to fulfill the request. Access to the Web Proxy filter is denied. )

?
A: Советую почитать вот здесь: python/urllib зависает запрос через прокси.
A: Попробуйте так, как рекомендуют в документации:
import urllib

proxies = {'http': 'http://proxy.example.com:8080/'}
opener = urllib.FancyURLopener(proxies)
f = opener.open("http://www.python.org")
f.read()


text:
Q: Databricks - How to remove files , directories based on regular expression I had a lot of files in databricks and wanted to clean them. Some of the files having a prefix such as "tweets1*.
How could I delete the files using a prefix something like linux pattern. I applied the following command, and it didnt work.
dbutils.fs.rm("/tweets1*",recurse=True)

A: You can go with the classic bash.
Inside your cell type:
%sh
rm -rf path/to/your/folder/tweets1*

When I have to perform some complex operation which I already know how to do with bash I use it directly inside the cell.


text:
Q: how to make the maven to use Internal Repository instead of using central Maven repository? I have configured parent pom.xml to use the internal repository which i have created it with apache Archiva. My Pom looks like
<distributionManagement>
  <repository>
    <id>internal</id>
    <url>dav:http://x.x.x.x:9090/archiva/repository/internal</url>
  </repository>
</distributionManagement>

I am trying to execute the same from the Hudson. But when it tries to download any missing plugin it still tries to download from central repo1.maven.org. For your information i have all the plugins configured in my internal repo.

A: I use the following configuration in .m2/settings.xml to forward all request to an internal repository:
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                              http://maven.apache.org/xsd/settings-1.0.0.xsd">

  <localRepository>/home/bozhidar/.m2/repository</localRepository>
  <interactiveMode>true</interactiveMode>
  <offline>false</offline>

  <servers>
    <server>
      <id>nexus</id>
      <username>***</username>
      <password>***</password>
    </server>
  </servers>

  <mirrors>
    <mirror>
      <!--This sends everything else to /public -->
      <id>nexus</id>
      <mirrorOf>*</mirrorOf>
      <url>https://xxx/nexus/content/groups/public</url>
    </mirror>
  </mirrors>

  <profiles>
    <profile>
      <id>nexus</id>
      <!--Enable snapshots for the built in central repo to direct -->
      <!--all requests to nexus via the mirror -->
      <repositories>
        <repository>
          <id>central</id>
          <url>http://central</url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <id>central</id>
          <url>http://central</url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>
  </profiles>
  <activeProfiles>
    <!--make the profile active all the time -->
    <activeProfile>nexus</activeProfile>
  </activeProfiles>
</settings>

Btw, I've used Archiva in the past and I can recommend you to try out Sonatype Nexus or Artifactory - they are both free and both much nicer than Archiva.