text:
Q: Akka Http Performance tuning I am performing Load testing on Akka-http framework(version: 10.0), I am using wrk tool.
wrk command:
wrk -t6 -c10000 -d 60s --timeout 10s --latency http://localhost:8080/hello
first run without any blocking call,
object WebServer {

  implicit val system = ActorSystem("my-system")
  implicit val materializer = ActorMaterializer()
  implicit val executionContext = system.dispatcher
  def main(args: Array[String]) {

    val bindingFuture = Http().bindAndHandle(router.route, "localhost", 8080)

    println(
      s"Server online at http://localhost:8080/\nPress RETURN to stop...")
    StdIn.readLine() // let it run until user presses return
    bindingFuture
      .flatMap(_.unbind()) // trigger unbinding from the port
      .onComplete(_ => system.terminate()) // and shutdown when done
  }
}

object router {
  implicit val executionContext = WebServer.executionContext

  val route =
    path("hello") {
      get {
        complete {
        "Ok"
        }
      }
    }
}

output of wrk:
    Running 1m test @ http://localhost:8080/hello
  6 threads and 10000 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     4.22ms   16.41ms   2.08s    98.30%
    Req/Sec     9.86k     6.31k   25.79k    62.56%
  Latency Distribution
     50%    3.14ms
     75%    3.50ms
     90%    4.19ms
     99%   31.08ms
  3477084 requests in 1.00m, 477.50MB read
  Socket errors: connect 9751, read 344, write 0, timeout 0
Requests/sec:  57860.04
Transfer/sec:      7.95MB

Now if i add a future call in the route and run the test again.
val route =
    path("hello") {
      get {
        complete {
          Future { // Blocking code
            Thread.sleep(100)
            "OK"
          }
        }
      }
    }

Output, of wrk:
Running 1m test @ http://localhost:8080/hello
  6 threads and 10000 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   527.07ms  491.20ms  10.00s    88.19%
    Req/Sec    49.75     39.55   257.00     69.77%
  Latency Distribution
     50%  379.28ms
     75%  632.98ms
     90%    1.08s
     99%    2.07s
  13744 requests in 1.00m, 1.89MB read
  Socket errors: connect 9751, read 385, write 38, timeout 98
Requests/sec:    228.88
Transfer/sec:     32.19KB

As you can see with future call only 13744 requests are being served.
After following Akka documentation, I added a separate dispatcher thread pool for the route which creates max, of 200 threads.
implicit val executionContext = WebServer.system.dispatchers.lookup("my-blocking-dispatcher")
// config of dispatcher
my-blocking-dispatcher {
  type = Dispatcher
  executor = "thread-pool-executor"
  thread-pool-executor {
    // or in Akka 2.4.2+
    fixed-pool-size = 200
  }
  throughput = 1
}

After the above change, the performance improved a bit
Running 1m test @ http://localhost:8080/hello
  6 threads and 10000 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   127.03ms   21.10ms 504.28ms   84.30%
    Req/Sec   320.89    175.58   646.00     60.01%
  Latency Distribution
     50%  122.85ms
     75%  135.16ms
     90%  147.21ms
     99%  190.03ms
  114378 requests in 1.00m, 15.71MB read
  Socket errors: connect 9751, read 284, write 0, timeout 0
Requests/sec:   1903.01
Transfer/sec:    267.61KB

In the  my-blocking-dispatcher config if I increase the pool size above 200 the performance is same.
Now, what other parameters or config should I use to increase the performance while using future call.So that app gives the maximum throughput.

A: Some disclaimers first: I haven't worked with wrk tool before, so I might get something wrong. Here are assumptions I've made for this answer:

*

*Connections count is independent from threads count, i.e. if I specify -t4 -c10000 it keeps 10000 connections, not 4 * 10000.

*For every connection the behavior is as follows: it sends the request, receives the response completely, and immediately sends the next one, etc., until the time runs out.

Also I've run the server on the same machine as wrk, and my machine seems to be weaker than yours (I have only dual-core CPU), so I've reduced wrk's thread counts to 2, and connection count to 1000, to get decent results.
The Akka Http version I've used is the 10.0.1, and wrk version is 4.0.2.
Now to the answer. Let's look at the blocking code you have:
Future { // Blocking code
  Thread.sleep(100)
  "OK"
}

This means, every request will take at least 100 milliseconds. If you have 200 threads, and 1000 connections, the timeline will be as follows:
Msg: 0       200      400      600      800     1000     1200      2000
     |--------|--------|--------|--------|--------|--------|---..---|---...
Ms:  0       100      200      300      400      500      600      1000

Where Msg is amount of processed messages, Ms is elapsed time in milliseconds.
This gives us 2000 messages processed per second, or ~60000 messages per 30 seconds, which mostly agrees to the test figures:
wrk -t2 -c1000 -d 30s --timeout 10s --latency http://localhost:8080/hello
Running 30s test @ http://localhost:8080/hello
  2 threads and 1000 connections
  Thread Stats   Avg     Stdev     Max   +/- Stdev
    Latency   412.30ms   126.87ms 631.78ms   82.89%
    Req/Sec     0.95k    204.41     1.40k    75.73%
  Latency Distribution
     50%  455.18ms
     75%  512.93ms
     90%  517.72ms
     99%  528.19ms
here: --> 56104 requests in 30.09s <--, 7.70MB read
  Socket errors: connect 0, read 1349, write 14, timeout 0
Requests/sec:   1864.76
Transfer/sec:    262.23KB

It is also obvious that this number (2000 messages per second) is strictly bound by the threads count. E.g. if we would have 300 threads, we'd process 300 messages every 100 ms, so we'd have 3000 messages per second, if our system can handle so many threads. Let's see how we'll fare if we provide 1 thread per connection, i.e. 1000 threads in pool:
wrk -t2 -c1000 -d 30s --timeout 10s --latency http://localhost:8080/hello
Running 30s test @ http://localhost:8080/hello
  2 threads and 1000 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   107.08ms   16.86ms 582.44ms   97.24%
    Req/Sec     3.80k     1.22k    5.05k    79.28%
  Latency Distribution
     50%  104.77ms
     75%  106.74ms
     90%  110.01ms
     99%  155.24ms
  223751 requests in 30.08s, 30.73MB read
  Socket errors: connect 0, read 1149, write 1, timeout 0
Requests/sec:   7439.64
Transfer/sec:      1.02MB

As you can see, now one request takes almost exactly 100ms on average, i.e. the same amount we put into Thread.sleep. It seems we can't get much faster than this! Now we're pretty much in standard situation of one thread per request, which worked pretty well for many years until the asynchronous IO let servers scale up much higher.
For the sake of comparison, here's the fully non-blocking test results on my machine with default fork-join thread pool:
complete {
  Future {
    "OK"
  }
}

====>

wrk -t2 -c1000 -d 30s --timeout 10s --latency http://localhost:8080/hello
Running 30s test @ http://localhost:8080/hello
  2 threads and 1000 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    15.50ms   14.35ms 468.11ms   93.43%
    Req/Sec    22.00k     5.99k   34.67k    72.95%
  Latency Distribution
     50%   13.16ms
     75%   18.77ms
     90%   25.72ms
     99%   66.65ms
  1289402 requests in 30.02s, 177.07MB read
  Socket errors: connect 0, read 1103, write 42, timeout 0
Requests/sec:  42946.15
Transfer/sec:      5.90MB

To summarize, if you use blocking operations, you need one thread per request to achieve the best throughput, so configure your thread pool accordingly. There are natural limits for how many threads your system can handle, and you might need to tune your OS for maximum threads count. For best throughput, avoid blocking operations.
Also don't confuse asynchronous operations with non-blocking ones. Your code with Future and Thread.sleep is a perfect example of asynchronous, but blocking operation. Lots of popular software operates in this mode (some legacy HTTP clients, Cassandra drivers, AWS Java SDKs, etc.). To fully reap the benefits of non-blocking HTTP server, you need to be non-blocking all the way down, not just asynchronous. It might not be always possible, but it's something to strive for.

A: I get x3 performance on my localhost with this config:
akka {
  actor {
    default-dispatcher {
      fork-join-executor {
        parallelism-min = 1
        parallelism-max = 64
        parallelism-factor = 1
      }
      throughput = 64
    }
  }

  http {
    host-connection-pool {
      max-connections = 10000
      max-open-requests = 4096
    }

    server {
      pipelining-limit = 1024
      max-connections = 4096
      backlog = 1024
    }
  }
}

Maybe other values for these params will make even better (write to me pls if yes).
Akka Http version 10.1.12.


text:
Q: How to make iterations using v-for directive on nested array (array in array) I am new to Vue and I came upon a situation that I would like to have some advice on.
In my js file I have some arrays that contain some data that I would like to insert in a table:
const d1=[{col1:"aaa1",col2:"bbb1",col3:"ccc1",col4:"ddd1",col5:"eee1"},
          {col1:"aaa2",col2:"bbb2",col3:"ccc2",col4:"ddd2",col5:"eee2"}]
const d2=[{col1:"fff1",col2:"ggg1",col3:"hhh1",col4:"iii1",col5:"jjj1"},
          {col1:"aaa2",col2:"bbb2",col3:"ccc2",col4:"ddd2",col5:"eee2"}]

then I saved the two arrays in another variable called availableData
const availableData=[d1,d2];

my vue instance as follows:
new Vue({
  el: '#c1',
  data: {
    availableData,
  }
});

In my HTML I am trying to add a for loop(v-for) in my row div so the row can display each of data in my availableData variable, but I am having some problems trying to pass d1 to the first row and d2 to the second,

// ...some code

            {{data.col1}}

            {{data.col2}}

            {{data.col3}}

            {{data.col4}}

            {{data.col5}}

Of course, the v-for statement is not correct since I am trying to iterate through the availableData array, if I were to write
v-for="data in availableData[i]"

then is there a way to pass a varaible like i to achieve iteration, or is this method not a plausible way to conduct?

A: You have several solutions to do what you want.
Solution # 1 :
You can alter the availableData to display all data like you want. You have just to flat you array like this :  const availableData=[...d1, ...d2];
With such a code your availableData variable will have :
const availableData = [{col1:"aaa1",col2:"bbb1",col3:"ccc1",col4:"ddd1",col5:"eee1"},
          {col1:"aaa2",col2:"bbb2",col3:"ccc2",col4:"ddd2",col5:"eee2"},
          {col1:"fff1",col2:"ggg1",col3:"hhh1",col4:"iii1",col5:"jjj1"},
          {col1:"aaa2",col2:"bbb2",col3:"ccc2",col4:"ddd2",col5:"eee2"}]

Solution # 2
You can make a double iteration in your template :

            {{row.col1}}

            {{row.col2}}

            {{row.col3}}

            {{row.col4}}

            {{row.col5}}

redpajama_set_name: RedPajamaStackExchange


text:
Q: MySQL select times of day independent of date Let's say I have the below records what i want to do is select the records based on their time of day independent of month, year or day.
In short " select all records between 12:00 and 14:00" and it should return me A and D. How can I do that?
A 2012-10-24 12:00:00
B 2012-13-25 03:00:00
C 2012-12-25 20:00:00
D 2012-16-26 14:00:00

A: Try this :
SELECT *
FROM table
WHERE HOUR(date) BETWEEN 12 AND 14

read more about this function here(w3 resource)
If you want based on hour and minute, then you need TIME() function.
syntax : WHERE TIME(datetime) >= '18:00:00'


text:
Q: How to switch the radio station with javascript I am new to programming and trying to make this work.  I want to offer the user the option of selection the radio station they want to listen to...this is what i have come up with, but dont work, any help is appreciated:
<script language="javascript" type="text/javascript">
    // You can place JavaScript like this
    document.getElementById("radiostations").selectedIndex = 0;
    document.getElementById("radiostations").onchange = resetStation;
    function resetStation(){
            objPlayer = document.getElementById("mediaPlayer");
            // obj.Settings.volume = 75
            newStation = document.getElementById("radiostations");
            objPlayer.URL=newStation.options[newStation.selectedIndex].value;          // playback this file
            objPlayer.controls.play();                                                  // play what ever file is loaded

    }

</script>

<form name="mediaPlay">
    <select name="radiostations" size="1">
        <option selected  value="http://listen.radionomy.com/smoothmusicradio">Smooth Music</option>
        <option value="http://www.urbanhotradio.com/hiphop/music/stream.asx">Hip-Hop</option>
        <option value="http://www.orsradio.com/asx/rnbclassic.asx">R&B Soul</option>
    </select>
    <noscript>
        <input type="button" value="Play Now!"
        onClick="location=document.mediaPlay.radiostations.options
        [document.mediaPlay.radiostations.selectedIndex].value">
    </noscript>
</form>

<OBJECT ID="MediaPlayer" WIDTH="100%" HEIGHT="100" CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"
    STANDBY="Loading Windows Media Player components..." TYPE="application/x-oleobject">
    <PARAM NAME="FileName" VALUE=newStation.options[newStation.selectedIndex].value>
    <PARAM name="ShowControls" VALUE="true">
    <param name="ShowStatusBar" value="true">
    <PARAM name="ShowDisplay" VALUE="false">
    <PARAM name="autostart" VALUE="false">
    <EMBED TYPE="application/x-mplayer2" SRC=newStation.options[newStation.selectedIndex].value NAME="MediaPlayer"
        WIDTH="100%" HEIGHT="100" ShowControls="1" ShowStatusBar="1" ShowDisplay="0" autostart="0">
    </EMBED>
</OBJECT>

A: I'm not sure if these are the only issues, but there are two obvious problems with your JS:

*

*You are using document.getElementById("radiostations") to reference your select element but the element doesn't have an id attribute - you need to add id="radiostations" to the markup:
<select id="radiostations" name="radiostations" size="1">

*Your script block is before the form so the select hasn't yet been parsed by the browser when the JS runs - so it won't be able to access the select element (even after you fix the id problem). You can fix this by either moving the script block to the bottom of the body (or at least somewhere after the select element) and/or by putting the code in an onload handler.
(Also I notice inside your <noscript> block you have a button that tries to use JavaScript - that's not going to work...)


text:
Q: Facebook for Android SSL: Trust anchor for certification path not found My app is having trouble connecting to Facebook in Android.  I can connect properly on iOS, but under certain circumstances on Android, I see this error in Logcat:
javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.

The strange thing is that problem seems to be dependent on the workstation that builds the APK. If I build an APK in Unity on workstation A, Facebook will work properly.  However, if I try to perform the build on workstation B, the app won't be able to connect to Facebook and will display the error above. Both workstations can create working builds for iOS that connect to FB without issue.
I have verified that both of these workstations have the same Unity settings.  This includes:

*

*Inspector Facebook Settings

*

*FB.Init() parameters

*Android Build Facebook Settings

*Facebook SDK version

*Player Settings

*

*Android Bundle Identifier

I have also verified that the keyhashes appearing in the Logcat output have been added to the Android section of my Facebook App Settings page (one for each of the workstations).
I have also compared the AndroidManifest.xml in a "good" APK to the AndroidManifest.xml from a "bad" APK.  They appear to be identical, along with the rest of the APK contents (more or less).
I am wondering if anyone can offer an explanation as to what else could be causing this discrepancy.
Thanks


text:
Q: Basic Calculator isn't working with my functions so I've coded a simple calculator in Python 3.7, but it doesn't work with my functions. The variable "output" is grayed out, but I don't know why.

n1 = 0
n2 = 0
op = 0
res = 0
output = 0

# DEFINING FUNCTIONS

def askAndStore(aasText,var2save):
    print(aasText)
    var2save = input()

def calculate(num1,num2,op,output):
    if op == "add":
        output = float(num1) + float(num2)
    elif op == "sub":
        output = float(num1) - float(num2)
    elif op == "mul":
        output = float(num1) * float(num2)
    elif op == "div":
        output = float(num1) / float(num2)
    else:
        print("Error: Unknown operation")

# PROGRAM MAIN

askAndStore("What is the first number?", n1)
askAndStore("What is the second number?", n2)
askAndStore("What is the operation?", op)
calculate(n1, n2, op, res)
print(res)

My output is:

What is the first number?
10
What is the second number?
5
What is the operation?
add
Error: Unknown operation
0

Process finished with exit code 0

It always shows "Error: Unknown operation", eventhough I entered "add" as operation.
Any ideas why it doesn't work?

A: n1 = float(input("What is the first number? "))
n2 = float(input("What is the second number? "))
op = str(input("What is the operation? "))

# DEFINING FUNCTIONS

def calculate(num1, num2, opr):
    if opr == "add":
        output = num1 + num2
    elif opr == "sub":
        output = num1 - num2
    elif opr == "mul":
        output = num1 * num2
    elif opr == "div":
        output = num1 / num2
    else:
        print("Error: Unknown operation")
    return output

print(calculate(n1, n2, op))

A: var2save is local to the askAndStore function. To access it from outside the function, you must return it. With minor modifications:
def calculate(num1,num2,op):
    if op == "add":
        output = float(num1) + float(num2)
    elif op == "sub":
        output = float(num1) - float(num2)
    elif op == "mul":
        output = float(num1) * float(num2)
    elif op == "div":
        output = float(num1) / float(num2)
    else:
        raise ValueError("Unknown operation " + op)
    return output

n1 = input("What is the first number?")
n2 = input("What is the second number?")
op = input("What is the operation?")
output = calculate(n1, n2, op)
print(output)

A: Im guessing you was a C program? or something like this, in python you can not reassign values that past to a function like this, when you passing argument into function, its just the pointer to this PyObject, and you can not change this pointer address, only it's values (reassign the variable will never work for this)
as you can see you can use the return statement for those cases
def calculate(num1,num2,op):
    output = None
    if op == "add":
        output = float(num1) + float(num2)
    elif op == "sub":
        output = float(num1) - float(num2)
    elif op == "mul":
        output = float(num1) * float(num2)
    elif op == "div":
        output = float(num1) / float(num2)
    else:
        print("Error: Unknown operation")
    return output

# PROGRAM MAIN

n1 = input("What is the first number?")
n2 = input("What is the second number?")
op = input("What is the operation?")
res = calculate(n1, n2, op)
print(res)

Take a look that complicated object does work as this, like list
def f(l):
    l.append(1)
l = []
f(l)
print(l) # [1]

but you can not reassign pointer as this:
def f(l):
    l = [1]
l = []
f(l)
print(l) # []


text:
Q: React.js how to call method on child component through refs? I have a CustomerForm component like so:
@CustomerForm = React.createClass
  getInitialState: ->
    name: ''
    street: ''
    location: ''
    addendum: ''

  render: ->
    React.DOM.form
      className: 'ui form'
      React.DOM.div
        className: 'field'
        React.DOM.label null, 'Name'
        React.DOM.input
          type: 'text'
          name: 'name'
          value: @state.name
          onChange: @handleChange
      React.DOM.div
        className: 'field'
        React.DOM.label null, 'Address'
        React.DOM.div
          className: 'three fields'
          React.DOM.div
            className: 'field'
            React.DOM.input
              type: 'text'
              name: 'street'
              placeholder: 'Street'
              value: @state.street
              onChange: @handleChange
          React.DOM.div
            className: 'field'
            React.DOM.input
              type: 'text'
              name: 'location'
              placeholder: 'Location'
              value: @state.location
              onChange: @handleChange
          React.DOM.div
            className: 'field'
            React.DOM.input
              type: 'text'
              name: 'addendum'
              placeholder: 'Addendum'
              value: @state.street
              onChange: @handleChange

  handleChange: (e) ->
    @setState "#{e.target.name}": e.target.value

  valid: ->
    @state.name && @state.street && @state.location

As you can see it exposes a method called valid(). I also have a CustomerModal component which is a semantic-ui modal dialog that renders the form:
@CustomerModal = React.createClass
  render: ->
    React.DOM.div
      className: 'ui active modal'
      React.DOM.i className: 'close icon'
      React.DOM.div className: 'header', 'Customer'
      React.DOM.div
        className: 'content'
        React.createElement(CustomerForm, ref: 'form')
      React.DOM.div className: 'actions',
        React.DOM.button
          type: 'submit'
          disabled: !@refs.form.valid()
          'Submit'

As given by the semantic-ui's modal markup I'd like to have the submit button on the CustomerModal component. In addition I would like that submit button to be disabled as long as the form is not valid, hence calling valid() on the CustomerForm component, because the component itself should determine if it's valid or not.
However, when I try to use the @refs object in the above way, I always get the error TypeError: this.refs.form is undefined
I am quite new to Ract.js and this is part of my learning experience with it in a small Rails project, using CoffeeScript.

A: You shouldn't need to use  React's refs to access direct descendants.
You can maintain direct references in scope.
Aside, you might benefit from something like
{form, div, label, input} = React.DOM

You wouldn't use refs the way you have anyway.  Always you can get the component with findDOMNode over the ref as an identifier.  Then with that reference you could call a component function.
Notice the React.findDOMNode line
https://facebook.github.io/react/docs/more-about-refs.html#completing-the-example
ae final prognosis:
I think it's like in the docs where they say "if you find yourself wondering how to make crazy Calder mobiles geometry with refs, maybe it's time to rethink your data structure."  Of course they say "state", and then you are off to learn Immutables and Flux.  And if you get really advanced you can sometimes drop React completely and just use Flux, with WebGL.  My opinion.
https://github.com/Terebinth/Vickers is my latest complete React codebase.


text:
Q: Unable to view Model with OBJLoader React Three Fiber I'm trying to render an .obj file into my react project using the OBJLoader and useLoader() hook from React Three Fiber, but I'm unable to do so. My file path is correct and I'm wrapping the Model in Suspense tags, so why is this occurring?

import React, { Suspense } from "react";
import * as THREE from "three";
import { Canvas, useLoader } from "@react-three/fiber";
import { OrbitControls } from "@react-three/drei";
import { OBJLoader } from "three/examples/jsm/loaders/OBJLoader";

function Model() {
    const model = useLoader(
        OBJLoader,
        "../assets/Model.obj"
    );

    return <primitive object={model} scale={0.4} />;
}

function App() {
    return (
        <div className="App">
            <Canvas>
                <OrbitControls
                    enablePan={true}
                    enableZoom={true}
                    enableRotate={true}
                    addEventListener={undefined}
                    hasEventListener={undefined}
                    removeEventListener={undefined}
                    dispatchEvent={undefined}
                />
                <Lights />
                <Suspense fallback={null}>
                    <Model />
                </Suspense>
            </Canvas>
        </div>
    );
}

export default App;

A: You have to put your 3D files inside the public folder.
Then your path will be   "./Model.obj"
Also you can make make folders inside public folder and put 3D models inside them.
ex- "./folder1/Model.obj"  like this


text:
Q: careers.stackoverflow.com can't find my answers Trying to fill out my profile at careers.stackoverflow.com but I am unable to "Link to 5 Stack Exchange answers" as requested.

Sorry but the Stack Exchange Network is having trouble finding your answers. Please try again later.

"NetworkError: 404 NotFound - https://careers.stackoverflow.com/stack/answers/314396?_=1447346729229"

Is something broken here or am I missing something in the form?

A: Yup, there was a path bug introduced as part of the on-going work on integrating the job board into Stack Overflow. I've fixed it up and pushed to production.
Thanks for the report!

A: Because they've just made a typo in the link, /stack should be replaced with /cv/stack.
The correct link is:
https://careers.stackoverflow.com/cv/stack/answers/314396?_=1447346729229
As the script is having trouble with the link, it hides the answer chooser, which you were going to manually make appear:
t ? ($(".answers").text(Careers._s("Sorry but the Stack Exchange Network is having trouble finding your answers. Please try again later.")), $(".open-chooser").hide()) : .....

So if the link is replaced with the working one, the answer chooser will appear.

A: Using the web inspector I was able to find a hidden <div> with the class answer-chooser near the Top Answers section.  Unchecking the style rule display: none reveals a section which is indeed capable of selecting different sites and retrieving my answers.  Sadly, upon page refresh my added answers still don't appear - though they are now missing from my available selections so I guess they are saved somewhere and will someday be visible.
Assuming this is a bug but maybe it's a challenge test to see how savvy you are at hacking the stack exchange careers forms.


text:
Q: Error: Tensorflow Op is not supported: AddN I've retrained a Mobilenet V1 model using my own dataset. Right now, I'm trying to get my model to load into this example project:
https://github.com/shivangidas/image-classifier
It keeps throwing the following error
 Error: Tensorflow Op is not supported: AddN

I don't understand what this means or why this error is being shown. I also can't seem to find anything about it online.
This is the code I'm using:
const MODEL_URL =
  "https://localhost/path/to/model";
const WEIGHTS_URL =
  "https://localhost/path/to/weights_manifest";
let model;
let IMAGENET_CLASSES = [];
let offset = tf.scalar(128);
async function loadModelAndClasses() {
  $.getJSON(
   "https://localhost/path/to/labels.json",
    function(data) {
      $.each(data, function(key, val) {
        IMAGENET_CLASSES.push(val);
      });
    }
  );
  model = await tf.loadFrozenModel(MODEL_URL, WEIGHTS_URL);
  //console.log("After model is loaded: " + tf.memory().numTensors);
  $(".loadingDiv").hide();
  $("#inputImage").attr("disabled", false);
}
loadModelAndClasses();
function readURL(input) {
  if (input.files && input.files[0]) {
    var reader = new FileReader();

reader.onload = function(e) {
  $("#imageSrc")
    .attr("src", e.target.result)
    .width(224)
    .height(224);
};

reader.readAsDataURL(input.files[0]);
//console.log("After image is loaded: " + tf.memory().numTensors);

reader.onloadend = async function() {
  console.log("Before predictions: " + tf.memory().numTensors);

  let imageData = document.getElementById("imageSrc");

  //console.log("After offset: " + tf.memory().numTensors);
  let pixels1 = tf.fromPixels(imageData);
  let pixel2 = pixels1.resizeNearestNeighbor([224, 224]);
  let pixel3 = pixel2.toFloat();
  console.log("After pixels are formed: " + tf.memory().numTensors);

  let pixels = pixel3.sub(offset);
  let pixels4 = pixels.div(offset);
  let pixels5 = pixels4.expandDims();
  console.log("After pre-processing: " + tf.memory().numTensors);

  const output = await model.predict(pixels5);
  console.log("After output: " + tf.memory().numTensors);
  const predictions = Array.from(output.dataSync())
    .map(function(p, i) {
      return {
        probabilty: p,
        classname: IMAGENET_CLASSES[i]
      };
    })
    .sort((a, b) => b.probabilty - a.probabilty)
    .slice(0, 10);

  //console.log(predictions);
  var html = "";
  for (let i = 0; i < 10; i++) {
    html += "<li>" + predictions[i].classname + "</li>";
  }
  $(".predictionList").html(html);
  console.log("After predictions: " + tf.memory().numTensors);

  pixels.dispose();
  pixels1.dispose();
  pixel2.dispose();
  pixel3.dispose();
  pixels4.dispose();
  pixels5.dispose();
  output.dispose();
  console.log("After dispose: " + tf.memory().numTensors);
     };
    }
   }

A: The addN operation is supported by the converter according to this list. It looks like you are using a rather old version of Tensorflow.js. I noticed the function loadFrozenModel which has been renamed to loadGraphModel since version 1.0 (released in March 2019).
Converting addN is supported since version 0.5.6 (see this commit). If your Tensorflow.js version is older than 0.5.6 you can simply upgrade to a more recent version and it should work.


text:
Q: ¿Como actualizar contenido en aplicación android? Estoy desarrollando una galería en android con las librerias "Volley" y "Glide" que obtiene imágenes de un .json el problema es que si agrego una nueva imagen el usuario tiene que cerrar completamente la app para que se vuelvan a descargar los datos y eso no es bueno, como se resolvería este problema? pensaba en un "Swipe Down" pero espero encontrar otras soluciones, espero su consejo, gracias!.

A: La opción más común es usar un SwipeRefreshLayout en el cual implementarias la recarga de nuevos datos y la actualización de estos datos en el Adapter.

Aquí hay un excelente tutorial de nuestros amigos de "Hermosa Programación".


text:
Q: PGSQL - How do I Add 5 hours to DATE in WHERE Clause? I either need to add 5 hours or convert from GMT to EST. The return is currently showing everything from 7p and later yesterday...
WHERE
incident.initial_symptom = 'Chrome Upgrade' AND
DATE(incident.install_completed) = CURRENT_DATE;

A: Instead of manually adding interval to get wanted time zone, use at time zone, eg:
t=# select now(), now() at time zone 'est';
             now              |         timezone
------------------------------+---------------------------
 2017-04-07 07:07:39.17234+00 | 2017-04-07 02:07:39.17234
(1 row)

Depending on your timezone, exactly same statement adding interval to your date gives different result, eg at DST shift hour:
t=# set timezone TO 'WET';
SET
t=# select '2017-03-26 00:00:00'::timestamptz + '1 hour'::interval;
        ?column?
------------------------
 2017-03-26 02:00:00+01
(1 row)

t=# set timezone TO 'EET';
SET
t=# select '2017-03-26 00:00:00'::timestamptz + '1 hour'::interval;
        ?column?
------------------------
 2017-03-26 01:00:00+02
(1 row)


text:
Q: How to pass data with CURL on one line Hello I want to use the API approach to show the jenkins build status with curl as stated here: https://developer.atlassian.com/server/bitbucket/how-tos/updating-build-status-for-commits/
Assembled that:
curl -u username:'password' -H "Content-Type: application/json" -X POST https://tools.my.repo.com/bitbucket/rest/build-status/1.0/commits/620d293ed88412e45c58aae537b8765be2e8d148 -d @build0.json`

Where my build json contains:
{
        "state": "SUCCESSFUL",
        "key": "8",
        "name": "feature/branch",
        "url": "https://my.jenkins.placeholder/job/Plugintest/",
        "description": "Changes by Umbert Eco"
}

I need to have that in one line...Is it possible?

A: Yes!! Try framing the curl in this way
curl -u username:password -H "Content-Type: application/json" -X POST https://tools.my.repo.com/bitbucket/rest/build-status/1.0/commits/620d293ed88412e45c58aae537b8765be2e8d148 -d '{\"state\": \"SUCCESSFUL\",\"key\": \"8\",\"name\": \"feature/branch\",\"url\": \"https://my.jenkins.placeholder/job/Plugintest\",\"description\": \"Changes by Umbert Eco\"}'


text:
Q: Batch loop doesn't loop Totally new to scripting, but this should work.
Instead I get a single txt file when it should produce up to 10.
thanks in advance!
@echo off
setlocal enabledelayedexpansion
goto :main
:main

setlocal
set /a current=0
set /a total=10

:loop
if !current! lss !total! (
echo stuffstuffstuffstuff.!current! > supercrap.txt
set /a current=!current!1+

goto :loop
)
endlocal
goto :eof

A: Here's a couple of quick examples to assist you:
@Echo Off
SetLocal EnableExtensions
Set /A current=0,total=10
:Loop
If %current% Lss %total% (
    Echo stuffstuffstuffstuff.%current%
    Set /A current+=1
    GoTo loop
)>>"supercrap.txt"
Pause
EndLocal
GoTo :EOF

@Echo Off
SetLocal EnableExtensions
(For /L %%G In (0,1,9) Do Echo stuffstuffstuffstuff.%%G)>"supercrap.txt"
Pause
EndLocal
GoTo :EOF

Please note: delayed expansion is not necessary, so has been omitted.


text:
Q: $.delay() and setTimeout() issue in javascript/jQuery. Which will win? This is a small javascript/jQuery program where the user starts with a portfolio of 20K and, when one inputs an amount and clicks on 'buy', the program then evaluates if you have enough money to do so. If you don't, then a message appears saying that you have insufficient funds. I want that message to stay on the screen for at least 5 seconds and, ideally, fadeout slowly afterwards. I've tried both the $.delay() method with jQuery and the setTimeout() method and both don't work. Any idea why?
JavaScript/jQuery:

Some other code that works:
JS :
$("#buttonBuy").click(function() {
      amount= document.getElementById('investment').value

      if (/*you have enough money*/){
            //do something
     }
     else
     {

        //1st option (setTimeOut): it doesnt respect the delay for some reason,only shows up for about 1 sec
        document.getElementById('insufficientFunds').innerHTML= "Insufficient funds! ";

        setTimeout(function(){
            document.getElementById('insufficientFunds').innerHTML= "";
        }, 5000);
    }
});

//2nd option (delay method) : I get error--> Failed to execute 'query SelectorAll on element: *;x is not valid selector

   $(function () {
           $('#insufficientFunds').fadeIn('slow', function () {
              $(this).delay(5000).fadeOut('slow');
           });
    });
};

HTML :
<form>
    <input  type="text" id="investment"

    <button id="buttonBuy" >Buy</button>
</form>

Portfolio Value :

//1st option

//second option

 insufficient funds!

A: I can't repeat your error, but this code seems to be working.
$("#buttonBuy").click(function () {
    amount = document.getElementById('investment').value

    if (true) {

        $(function () {
            $('#insufficientFunds').fadeIn('slow', function () {
                $(this).delay(5000).fadeOut('slow');
            });
        });
    };
});

JSFiddle


text:
Q: Bash - Adding value to specific positions in file I need to add the value A 1 to position 10-12 for all lines beginning with 10 regardless of the length of the line. If there are values present in pos 10-12, then they should be overwritten by the value A 1.
I tried the following:
sed -i 's/.\{9\}/&A 1/' FILE

But, this gives me two issues.

*

*The value "A 1" is added to all lines, not only for lines starting with 10.

*The value does not get printed to the line if the length of the line is <12 positions.

Input file:
01SAGHSUIGAUGB
02AWRHGAWRUIGH
10H
02DFHAliffh
10shaofgvasuioghsfag
02GAQTHEGHQ
10FGHOHGFRT
90AIRLGBA

Output file:
01SAGHSUIGAUGB
02AWRHGAWRUIGH
10H      A 1
02DFHAliffh
10shaofgvA 1ioghsfag
02GAQTHEGHQ
10FGHOHGFA 1
90AIRLGBA

A: This is hard to do with sed since it requires some counting. You can use Perl:
perl -lpe 'if(/^10/){ $_ = sprintf("%-12s",$_); s/(.{9}).../$1A 1/;};' input

And a bash script version:
while read line; do
    echo "$(printf "%-12s" "$line" | sed 's/^\(10.\{7\}\).../\1A 1/')"
done < input

Gives:
01SAGHSUIGAUGB
02AWRHGAWRUIGH
10H      A 1
02DFHAliffh
10shaofgvA 1ioghsfag
02GAQTHEGHQ
10FGHOHGFA 1
90AIRLGBA

A: sed -i 's/\(10.\{0,8\}\)\.\{0,2\}\(.*\)/\1A 1\2/' FILE nearly works, the only problem being that if the line is less than 10 characters it doesn't pad it.
Result:
$ sed 's/\(10.\{0,8\}\)\.\{0,3\}\(.*\)/\1A 1\2/' test.txt
01SAGHSUIGAUGB
02AWRHGAWRUIGH
10H    A 1
02DFHAliffh
10shaofgvaA 1suioghsfag
02GAQTHEGHQ
10FGHOHGFRA 1T
90AIRLGBA

The .{0,8} could also be written .{,8}, matches any sequqnce of characters from 0-8 characters in length, and the brackets are to group the matched patterns, which can then be referenced in the subtitution by the \1 and the \2. If you had more groups you'd reference them with \3 \4 and so on.
As others have pointed out you can pad the lines first to make sure you get the A 1 on the correct column, but then you'll need to use something other than sed

A: Use your own solution, with 2 minor modifications.

*

*First, add 10 spaces to every line so there is no issue with short lines

*Only apply your edits to lines starting with "10"

sed -e 's/$/xxxxxxxxxx/' -e '/^10/s/.\{9\}/&A 1/' test.txt

The x's represent spaces above

A: This will work fine:
awk '/^10/{$0=$0 "          ";q=substr($0,1,9);r=substr($0,13); $0=q "A 1" r} {sub(/ *$/,x);print}' t
01SAGHSUIGAUGB
02AWRHGAWRUIGH
10H      A 1
02DFHAliffh
10shaofgvA 1ioghsfag
02GAQTHEGHQ
10FGHOHGFA 1
90AIRLGBA

A: sed '/^10/ {
   s/^\(.\{9\}\).../\1A 1/
   t
   s/$/        /
   s/^\(.\{9\}\).*/\1A 1/
   }' YourFile

change if start with 10, try to change by A 1 if string is bigger than 12 char, if failed, add enough  space to reach 9 char and add A 1

A: This might work for you (GNU sed):
sed -r '/^10/{:a;s/^.{,11}$/& /;ta;s/^(.{9}).../\1A 1/}' file

Pad line with spaces if necessary and then replace characters 10-12  with A 1.


text:
Q: How can I insert index for filtered data using apache Pig? I want to use Pig script to give index like 1, 2, ... to a filtered dataset/records, I'm loading in the table in a set format, so I can't add index/id when I load in. I've tried Rank function but it's not working under my corporates environment, and I can't use UDF. The current code is like this, and I want to insert index to filterTable.
table1 = LOAD 'tmp' using TransactionLoader(...);
filterTable = FOREACH table1 {
       rec = FILTER records BY (record MATCHES '.*\t2\t.*');
       GENERATE rec;
};

Any help is greatly appreciated, thanks!

A: If you can't write an UDF,Rank is the only option final = rank filterTable;


text:
Q: Stencil's Puppeteer sometimes does not renders text or fonts I'm trying to use Stencil e2e screenshot tests which have Puppeteer v10 under the hood.
I'm facing the problem with texts and fonts. Sometimes they are hidden and sometimes they appear as they should.

I'm using the following code for my tests:
const componentStatesTemplate = `
  <div style="display: flex; flex-direction: column;">
    <nl-button>Button</nl-button>
    <nl-button is-disabled>Button</nl-button>
    <nl-button is-full-width>button</nl-button>
    <nl-button><nl-icon-heart></nl-icon-heart></nl-button>
    <nl-button><nl-icon-heart></nl-icon-heart>Button</nl-button>
    <nl-button variant="secondary">Button</nl-button>
    <nl-button variant="secondary"><nl-icon-heart></nl-icon-heart></nl-button>
    <nl-button variant="secondary"><nl-icon-heart></nl-icon-heart>Button</nl-button>
  </div>
`;

describe("button component", () => {
  it("is rendered", async () => {
   const page = await newE2EPage();
   await page.setContent(html);

   await page.addStyleTag({
    content: `
      @font-face {
        font-family: "Source Sans 3";
        src: url("${getAssetPath("../assets/fonts/SourceSans3-VariableFont_wght.ttf")}");
        font-weight: 100 900;
      }

      body {
        -webkit-font-smoothing: antialiased;
      }
    `,
  });
    const results = await page.compareScreenshot();

    expect(results).toMatchScreenshot({allowableMismatchedPixels: E2EConstants.DEFAULT_allowableMismatchedPixels});
    expect(results).toMatchScreenshot({allowableMismatchedRatio: E2EConstants.DEFAULT_allowableMismatchedRatio});
  });
});

Environment:

*

*I'm running tests in docker, using alpine linux with Chromium installed as described in Puppeteer docs.

*I'm also applying --font-render-hinting=none flag as described in many articles on the subject.

*Using waitForOptions.waitUntil set to networkidle0 or domcontentloaded did not help as well.

However, the text in my components is not shown stable. Sometimes tests run as supposed and sometimes the components are rendered as if text was hidden.
How do I make them stable?

A: Adding await page.evaluateHandle("document.fonts.ready"); helped, now fonts load properly.
Example:
const page = await newE2EPage();
   await page.setContent(html);

   await page.addStyleTag({
    content: `
      @font-face {
        font-family: "Source Sans 3";
        src: url("${getAssetPath("../assets/fonts/SourceSans3-VariableFont_wght.ttf")}");
        font-weight: 100 900;
      }

      body {
        -webkit-font-smoothing: antialiased;
      }
    `,
  });

    // Inserting the wait before comparing elements
    await page.evaluateHandle("document.fonts.ready");

    const results = await page.compareScreenshot();


text:
Q: Moving/nudge text down but not and the image Hello Gurus: I am trying something but just don't get the theory...I have one main Div and inside of it are: paragraph text and one image (both of these are nested inside their own Divs) (hopeful I did this correctly!)
For easy visualization.... they are both at the top of the html page and the Image is styled as float: right; the text can be styled but that's where I am hung-up.
----- I want to move the TEXT ONLY from its position; downward from the top of the page like 50px-----
When I styled the text with padding or margin, it takes everything; text and the image, and moves everything down Together....HOW can I leave the image where it is currently, and just move the text downward leaving white space at the top above the text and not the image?
Is this a positioning style? Or am I thinking about this all wrong? Thank you kindly for your help!!

A: html:

some text

css:
.wrapper div p {
    position: absolute //can also be relative, depending on your needs
    top: 50px
}
.img-right {
    float: right
}

position can be relative or absolute depending on how you need your page styled.
See also:
http://www.w3schools.com/cssref/pr_class_position.asp


text:
Q: PHP League Commonmark $environment error in Laravel cached view After upgrading a Laravel project to PHP8 I'm getting this error pretty often:
Passing an $environment into the "League\CommonMark\CommonMarkConverter" constructor is deprecated in 1.6 and will not be supported in 2.0; use MarkdownConverter instead

The stack trace shows it's triggered by this line in a cached view file:
<?php echo e(Illuminate\Mail\Markdown::parse($slot)); ?>

I have deleted all cached views multiple times (I thought that there were maybe some old cached ones in there) but that didn't solve it.
Not sure if this should be an error that's reported as it might be the case that this is fixed in the Laravel framework, but before upgrading to PHP8 I never had this error so I think it's related to that.

A: Banged my head on this one quite a bit too. I kept making changes to the markdown files, but they never showed up - almost like Laravel was pointing to the wrong place.  And it was...
I was working on an upgraded Laravel application (I.E. I started with 5.x and have upgraded over time), and thus there are two potential issues.
First, in ip/config/mail.php: you may have to actually create the markdown path.  If you published the mailables prior to markdown, the entire markdown mail settings are missing.  You can pull them from the git repo, or from here for convenience:
'markdown' => [
    'theme' => 'default',
    'paths' => [
        resource_path('views/vendor/mail'),
    ],
],

Second potential (though less likely in your case) issue if you published these mail files earlier, the Laravel layouts file in the HTML directory has the or operator, which will choke.  Change these three operators to ??.
Maybe this will help you, depending on where you started :)

A: The error you're receiving was supposed to be a silenced deprecation error added in version 1.6.0 of league/commonmark. Unfortunately there was a bug which caused it to be a "user notice" instead of a deprecation notice.  Upgrading league/commonmark to 1.6.2 where this was fixed might solve the issue.
If you still receive the error after upgrading (and ensuring that PHP's opcache has been cleared), it's highly likely that Laravel or something else in your code is catching and reporting this silenced error - that's a good thing, as we want people to know this functionality is deprecated and will be removed, but it shouldn't be spamming your logs, so double-check any settings in Laravel or PHP related to error logging, error levels, and logging.
Source: I'm the maintainer of league/commonmark.

A: Eventually it turned out that I set my PHP version to 8 on Laravel Forge, but not on Laravel Envoyer that I use for deployments... Hope this helps someone who has the same setup!

A: I also encounter this error. I fix it by downgrading the league/commonmark, see deprecation noticed
composer require league/commonmark 1.6.7

php artisan view:cache

After publishing mailable templates php artisan vendor:publish --tag=laravel-mail


text:
Q: Querying Exchange Web Service gives Bad Request (400) with WildFly and Apache CXF I have a problem while querying the Microsoft Exchange Server WebServices to get Items in certain folders. In this order, I can make a request to the method expandDL and to the method findFolders. These work fine. But when I then make a request to findItems with all the found folders, I get 400 Bad Request with no error message.
I think this question is related to Querying Exchange Web Services fails with 400 Bad Request
I am using a WildFly 10 and Java 1.8. Apache CXF is used as framework for the webservice calls. The Exchange Server is of version 2013.
There are two observations that make this issue kind of mysterious, at least for me:

*

*When I make a findItem request, it has about eleven FolderIdTypes. The result is always a 400 Bad Request. I can remove some folders from the request and eventually when there are only four folders in the findItem request, everything works fine. It also doesn't matter which folder I remove as long as there are only four or less! See my soap request:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Header>
        <ns2:ExchangeImpersonation xmlns="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:ns2="http://schemas.microsoft.com/exchange/services/2006/types">
            <ns2:ConnectingSID>
                <ns2:PrimarySmtpAddress>tobeimpersonated@example.com</ns2:PrimarySmtpAddress>
            </ns2:ConnectingSID>
        </ns2:ExchangeImpersonation>
        <ns2:RequestServerVersion xmlns="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:ns2="http://schemas.microsoft.com/exchange/services/2006/types" Version="Exchange2007_SP1"/>
    </soap:Header>
    <soap:Body>
        <FindItem xmlns="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:ns2="http://schemas.microsoft.com/exchange/services/2006/types" Traversal="Shallow">
            <ItemShape>
                <ns2:BaseShape>IdOnly</ns2:BaseShape>
                <ns2:IncludeMimeContent>false</ns2:IncludeMimeContent>
                <ns2:BodyType>Best</ns2:BodyType>
                <ns2:AdditionalProperties>
                    <ns2:FieldURI FieldURI="message:InternetMessageId"/>
                    <ns2:FieldURI FieldURI="item:Subject"/>
                    <ns2:ExtendedFieldURI PropertyTag="0x300B" PropertyType="Binary"/>
                    <ns2:ExtendedFieldURI PropertyTag="0x3704" PropertyType="String"/>
                </ns2:AdditionalProperties>
            </ItemShape>
            <IndexedPageItemView BasePoint="Beginning" MaxEntriesReturned="20" Offset="0"/>
            <Restriction>
                <ns2:And>
                    <ns2:Or>
                        <ns2:IsEqualTo>
                            <ns2:FieldURI FieldURI="item:ItemClass"/>
                            <ns2:FieldURIOrConstant>
                                <ns2:Constant Value="IPM.Note"/>
                            </ns2:FieldURIOrConstant>
                        </ns2:IsEqualTo>
                        <ns2:IsEqualTo>
                            <ns2:FieldURI FieldURI="item:ItemClass"/>
                            <ns2:FieldURIOrConstant>
                                <ns2:Constant Value="IPM.Note.SMIME.MultipartSigned"/>
                            </ns2:FieldURIOrConstant>
                        </ns2:IsEqualTo>
                        <ns2:IsEqualTo>
                            <ns2:FieldURI FieldURI="item:ItemClass"/>
                            <ns2:FieldURIOrConstant>
                                <ns2:Constant Value="IPM.Note.SMIME"/>
                            </ns2:FieldURIOrConstant>
                        </ns2:IsEqualTo>
                    </ns2:Or>
                    <ns2:IsEqualTo>
                        <ns2:FieldURI FieldURI="item:IsDraft"/>
                        <ns2:FieldURIOrConstant>
                            <ns2:Constant Value="false"/>
                        </ns2:FieldURIOrConstant>
                    </ns2:IsEqualTo>
                    <ns2:Not>
                        <ns2:Exists>
                            <ns2:ExtendedFieldURI PropertyName="propertyName" PropertySetId="24040483-cda4-4521-bb4e-a83fac4d19a4" PropertyType="Integer"/>
                        </ns2:Exists>
                    </ns2:Not>
                    <ns2:Or>
                        <ns2:And>
                            <ns2:IsGreaterThan>
                                <ns2:FieldURI FieldURI="item:DateTimeReceived"/>
                                <ns2:FieldURIOrConstant>
                                    <ns2:Constant Value="2014-02-06T12:40:53Z"/>
                                </ns2:FieldURIOrConstant>
                            </ns2:IsGreaterThan>
                            <ns2:IsLessThanOrEqualTo>
                                <ns2:FieldURI FieldURI="item:DateTimeReceived"/>
                                <ns2:FieldURIOrConstant>
                                    <ns2:Constant Value="2016-04-29T08:32:42Z"/>
                                </ns2:FieldURIOrConstant>
                            </ns2:IsLessThanOrEqualTo>
                        </ns2:And>
                        <ns2:And>
                            <ns2:IsGreaterThan>
                                <ns2:FieldURI FieldURI="item:DateTimeSent"/>
                                <ns2:FieldURIOrConstant>
                                    <ns2:Constant Value="2014-02-06T12:40:53Z"/>
                                </ns2:FieldURIOrConstant>
                            </ns2:IsGreaterThan>
                            <ns2:IsLessThanOrEqualTo>
                                <ns2:FieldURI FieldURI="item:DateTimeSent"/>
                                <ns2:FieldURIOrConstant>
                                    <ns2:Constant Value="2016-04-29T08:32:42Z"/>
                                </ns2:FieldURIOrConstant>
                            </ns2:IsLessThanOrEqualTo>
                        </ns2:And>
                    </ns2:Or>
                </ns2:And>
            </Restriction>
            <SortOrder>
                <ns2:FieldOrder Order="Ascending">
                    <ns2:FieldURI FieldURI="item:DateTimeReceived"/>
                </ns2:FieldOrder>
            </SortOrder>
            <ParentFolderIds>
                <ns2:FolderId ChangeKey="AQAAABYAAAB8br3Xlm6jQ6ESWiFFNbMfAAEtfGtC" Id="AQMkADUwYWRiMTQzLTA2ZWMtNDEyZi05ZjgyLWUyNWYwNzVjZjViNQAuAAADsJ39BzCTikK07SQtfYnJhwEA0zVBfp4xUk+7Vyc3iZW0FAA05RFXoQAAAA=="/>
                <ns2:FolderId ChangeKey="AQAAABYAAAB8br3Xlm6jQ6ESWiFFNbMfAAEtfH8N" Id="AQMkADUwYWRiMTQzLTA2ZWMtNDEyZi05ZjgyLWUyNWYwNzVjZjViNQAuAAADsJ39BzCTikK07SQtfYnJhwEA0zVBfp4xUk+7Vyc3iZW0FAA05RFXoAAAAA=="/>
                <ns2:FolderId ChangeKey="AQAAABQAAAAJFy1A7LXdQ4Jg/JYq7dhuAAFIBg==" Id="AQMkADUwYWRiMTQzLTA2ZWMtNDEyZi05ZjgyLWUyNWYwNzVjZjViNQAuAAADsJ39BzCTikK07SQtfYnJhwEA0zVBfp4xUk+7Vyc3iZW0FAA05RDn6AAAAA=="/>
                <ns2:FolderId ChangeKey="AgAAABYAAADTNUF+njFST7tXJzeJlbQUADTuxhMy" Id="AQMkADUwYWRiMTQzLTA2ZWMtNDEyZi05ZjgyLWUyNWYwNzVjZjViNQAuAAADsJ39BzCTikK07SQtfYnJhwEA0zVBfp4xUk+7Vyc3iZW0FAA05RDnvgAAAA=="/>
                <ns2:FolderId ChangeKey="AwAAABYAAAB8br3Xlm6jQ6ESWiFFNbMfAAEtfLe1" Id="AQMkADUwYWRiMTQzLTA2ZWMtNDEyZi05ZjgyLWUyNWYwNzVjZjViNQAuAAADsJ39BzCTikK07SQtfYnJhwEAfG6915Zuo0OhElohRTWzHwAAAgmBAAAA"/>
                <ns2:FolderId ChangeKey="AQAAABYAAAB8br3Xlm6jQ6ESWiFFNbMfAAEtfLIm" Id="AQMkADUwYWRiMTQzLTA2ZWMtNDEyZi05ZjgyLWUyNWYwNzVjZjViNQAuAAADsJ39BzCTikK07SQtfYnJhwEA0zVBfp4xUk+7Vyc3iZW0FAA05RFXngAAAA=="/>
                <ns2:FolderId ChangeKey="AQAAABYAAAB8br3Xlm6jQ6ESWiFFNbMfAAEtfH79" Id="AQMkADUwYWRiMTQzLTA2ZWMtNDEyZi05ZjgyLWUyNWYwNzVjZjViNQAuAAADsJ39BzCTikK07SQtfYnJhwEAfG6915Zuo0OhElohRTWzHwABJMQcGAAAAA=="/>
                <ns2:FolderId ChangeKey="AQAAABQAAAAJFy1A7LXdQ4Jg/JYq7dhuAAFIBA==" Id="AQMkADUwYWRiMTQzLTA2ZWMtNDEyZi05ZjgyLWUyNWYwNzVjZjViNQAuAAADsJ39BzCTikK07SQtfYnJhwEA0zVBfp4xUk+7Vyc3iZW0FAA07GTIvwAAAA=="/>
                <ns2:FolderId ChangeKey="AwAAABYAAAB8br3Xlm6jQ6ESWiFFNbMfAACg9DeI" Id="AQMkADUwYWRiMTQzLTA2ZWMtNDEyZi05ZjgyLWUyNWYwNzVjZjViNQAuAAADsJ39BzCTikK07SQtfYnJhwEACthrv1y0RUyxtNEACu0ptAA066kAAwAAAA=="/>
                <ns2:FolderId ChangeKey="AQAAABYAAAB8br3Xlm6jQ6ESWiFFNbMfAAEdND9a" Id="AQMkADUwYWRiMTQzLTA2ZWMtNDEyZi05ZjgyLWUyNWYwNzVjZjViNQAuAAADsJ39BzCTikK07SQtfYnJhwEA0zVBfp4xUk+7Vyc3iZW0FAA05RDn0wAAAA=="/>
                <ns2:FolderId ChangeKey="AQAAABQAAADao4wXVcs7RIo7U7kl8KntAAIkAQ==" Id="AQMkADUwYWRiMTQzLTA2ZWMtNDEyZi05ZjgyLWUyNWYwNzVjZjViNQAuAAADsJ39BzCTikK07SQtfYnJhwEACthrv1y0RUyxtNEACu0ptABAzY4ADQAAAA=="/>
            </ParentFolderIds>
        </FindItem>
    </soap:Body>
</soap:Envelope>

Of course, I have also some restrictions like dates within it.
My Inbound message from the exchange server looks like that:
ID: 4
Response-Code: 400
Encoding: ISO-8859-1
Content-Type:
Headers: {
 Cache-Control=[private],
 Content-Length=[0],
 Date=[Fri, 29 Apr 2016 08:32:44 GMT],
 request-id=[8a3d7697-3f2b-458a-904d-703d5e2f0664],
 Server=[Microsoft-IIS/8.5],
 Set-Cookie=[X-BackEndCookie=S-1-5-21-436374069-789336058-1060284298-3660=u56Lnp2ejJqBz53Nzs+ayJ3SnJ2bnNLLzMfJ0p6bzMvSx57Iyc2ensfHxsibgYHNz87J0s/K0s3Gq8/HxczNxcvK; expires=Sun, 29-May-2016 08:32:45 GMT; path=/EWS; HttpOnly, exchangecookie=5096a0de261c45019aa1523ce05cd77c; expires=Sat, 29-Apr-2017 08:32:42 GMT; path=/; HttpOnly, ClientId=MASOZZCUPEOBNCBZRFNOMQ; expires=Sat, 29-Apr-2017 08:32:42 GMT; path=/; HttpOnly],
 X-AspNet-Version=[4.0.30319], X-BEServer=[SABCEXH04],
 X-CalculatedBETarget=[sabcexh04.company.local],
 X-DiagInfo=[SABCEXH04],
 X-FEServer=[SABCEXH04],
 X-Powered-By=[ASP.NET]
}

*I can use the EWSEditor from Microsoft and post exactly the same SOAP request to the same Exchange Server. And surprisingly I get a successful response just the way I want.
If anyone can please point me in a direction how to solve this issue, that would be much appreciated.

A: Ok, I finally found my problem. In Apache CXF I had to set chunking disabled:
import org.apache.cxf.endpoint.Client;
import org.apache.cxf.frontend.ClientProxy;
...
Client client = ClientProxy.getClient(port);
HTTPConduit conduit = (HTTPConduit) client.getConduit();
HTTPClientPolicy policy = conduit.getClient();
if(policy == null) {
   policy = new HTTPClientPolicy();
}
policy.setAllowChunking(false);


text:
Q: ggeffects::ggpredict() doesn't return population level prediction intervals for nlme::lme() I'm trying to get population level prediction intervals (PI) from ggeffects:ggpredict() using type = "re" from an nlme:lme() model. ggpredict is not returning the expected data for the lme() model, while the equivalent lmer() model works fine. My data are autocorrelated repeated measures, so I need lme() with correlation = corAR1().
I'm not sure if this is an error, or if I'm just trying to do something for which the tools I'm using aren't designed?
library(lme4)
library(nlme)
library(ggeffects)

Data <- data.frame(
  Subject = factor(c(3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
                     4, 4, 4, 4, 4, 4, 4, 4, 4,
                     5, 5, 5, 5, 5, 5, 5, 5, 5,
                     6, 6, 6, 6, 6, 6, 6, 6,
                     7, 7, 7, 7, 7, 7, 7, 7,
                     8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
                     9, 9, 9, 9, 9, 9, 9, 9,
                     13, 13, 13, 13, 13, 13, 13, 13,
                     14, 14, 14, 14, 14, 14, 14, 14, 14,
                     19, 19, 19, 19, 19, 19, 19)),
  x = c(20.0, 28.5, 38.0, 47.5, 57.0, 66.5, 76.0, 85.5, 95.0, 100.0,
           21.0, 31.5, 42.0, 53.0, 63.0, 73.5, 84.0, 95.0, 100.0,
           20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0,
           22.0, 33.0, 44.0, 56.0, 67.0, 78.0, 89.0, 100.0,
           21.5, 32.0, 43.0, 54.0, 65.0, 76.0, 86.5, 100.0,
           20.0, 29.0, 38.5, 48.5, 58.0, 67.5, 77.0, 87.0, 96.5, 100.0,
           23.0, 33.0, 44.0, 56.0, 67.0, 78.0, 89.0, 100.0,
           23.5, 34.5, 46.5, 57.5, 69.5, 80.5, 92.5, 100.0,
           20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0,
           25.0, 37.5, 50.0, 62.5, 75.0, 87.5, 100.0)/100,
  y = c(1.10, 1.00, 1.25, 1.60, 1.40, 1.20, 2.50, 4.60, 6.80, 10.40,
          0.90, 1.00, 0.75, 0.90, 1.10, 1.70, 4.35, 9.95, 11.45,
          1.20, 0.70, 1.30, 1.40, 0.70, 1.25, 2.30, 4.30, 8.20,
          1.55, 1.15, 0.95, 1.10, 1.90, 3.25, 7.20, 14.30,
          1.85, 2.00, 1.70, 2.00, 2.35, 3.30, 7.30, 12.10,
          2.20, 1.95, 1.15, 1.55, 1.65, 3.00, 4.45, 9.05, 13.75, 15.85,
          1.55, 1.20, 1.35, 1.60, 1.65, 4.70, 6.45, 10.80,
          1.00, 0.90, 1.00, 1.10, 1.60, 3.60, 8.05, 12.30,
          0.85, 1.00, 1.05, 1.00, 1.35, 2.00, 3.65, 6.75, 13.10,
          2.25, 2.35, 2.40, 2.80, 4.90, 8.15, 13.50)
)

Model.lme4 <- lmer(
  y ~ x + (1 | Subject),
  data = Data
)

# first running lme() without autocorrelation
Model.nlme <- lme(
  fixed = y ~ x,
  random = ~ 1 | Subject,
  data = Data,
)

# Expected data return fine from the lmer() model:
ggpredict(
  Model.lme4,
  terms = c("x [all]"),
  type = "re",
)
# Predicted values of y
#
#    x | Predicted |         95% CI
# ---------------------------------
# 0.20 |     -1.09 | [-5.93,  3.74]
# 0.28 |     -0.08 | [-4.89,  4.73]
# 0.38 |      0.99 | [-3.80,  5.78]
# 0.47 |      2.06 | [-2.71,  6.84]
# 0.58 |      3.38 | [-1.39,  8.14]
# 0.67 |      4.51 | [-0.26,  9.28]
# 0.77 |      5.70 | [ 0.92, 10.48]
# 1.00 |      8.44 | [ 3.61, 13.27]
#
# Adjusted for:
# * Subject = 0 (population-level)
#
# Intervals are prediction intervals.

# When run on the lme() model, predicted values & PIs are missing:
ggpredict(
  Model.nlme,
  terms = c("x [all]"),
  type = "re",
)
# Predicted values of y
#
#    x
# ----
# 0.20
# 0.28
# 0.38
# 0.47
# 0.58
# 0.67
# 0.77
# 1.00
#
# Adjusted for:
# * Subject = 0 (population-level)
#
# Intervals are prediction intervals.

If I use correlation = corAR1() it produces the same results as above.
The same thing also happens if I explicitly call terms = c("x [all]", "Subject [0]")
When I add the intended autocorrelation structure, I get prediction & PI values, but only for the first level of the Subject factor:
Model.nlme <- lme(
  fixed = y ~ x,
  random = ~ 1 | Subject,
  correlation = corAR1(form = ~ x | Subject),
  data = Data,
)

ggpredict(
  Model.nlme,
  terms = c("x [all]"),
  type = "re",
)
# Predicted values of y
#
#    x | Predicted |         95% CI
# ---------------------------------
# 0.20 |      1.64 | [-1.44,  4.71]
# 0.28 |      2.82 | [-0.23,  5.87]
# 0.38 |      4.07 | [ 1.03,  7.12]
# 0.47 |      5.33 | [ 2.29,  8.36]
# 0.58 |      6.86 | [ 3.82,  9.90]
# 0.67 |      8.18 | [ 5.13, 11.24]
# 0.77 |      9.58 | [ 6.50, 12.66]
# 1.00 |     12.78 | [ 9.61, 15.95]
#
# Adjusted for:
# * Subject = 3
#
# Intervals are prediction intervals.

Am I making an error somewhere? Or is there a better way to get the PIs that I want? Thanks!

A: Unfortunately, I think you might be stuck.
The underlying problem is that broom.mixed::tidy doesn't return the standard deviations of BLUPs:
library(broom.mixed)
tidy(Model.lme4, effects = "ran_vals") ## includes SDs
tidy(Model.nlme, effects = "ran_vals") ## doesn't

However, this isn't really broom.mixed's fault. The problem is that at present the nlme package doesn't offer any option to return the standard deviations of the BLUPs (see e.g. this r-sig-mixed-models@r-project.org thread, which discusses the issue but peters out without providing a solution).
In order to fix this, as best I can tell, you (or someone) would have to dig into the guts of nlme and figure out how to construct the SDs for the BLUPs. If I were doing it I would start with Bates et al 2015 equations 56-59 and see whether it's possible to extract the corresponding components from an lme fit. In particular see section 2.2 of Pinheiro and Bates 2000 for the notation and framework used in nlme: eq 2.22, p. 71, gives the expression for the BLUPs, hopefully one could match that up with the lme code and derive the corresponding expression for the SDs ...
alternatively: you can fit an AR1 model in glmmTMB, which should be tidy-able/ggpredict-able. Code is shown below; I think these are equivalent models, but the example data you've given above doesn't support fitting an AR1 model [we get a singular fit], so I can't be sure.
## define a per-subject observation-number variable (factor)
## alt. tidyverse: Data |> group_by(Subject) |> mutate(obs = seq(n())) |>
##                  mutate(across(obs, factor))
Data2 <- (Data
    |> split(Data$Subject)
    |> lapply(FUN = \(x) transform(x, obs = seq(x)))
    |> do.call(what = rbind)
    |> transform(obs = factor(obs))
)
Model.nlme.acf <- update(Model.nlme,
                         data = Data2,
                         correlation = corAR1(form = ~obs))
library(glmmTMB)
Model.glmmTMB <-  glmmTMB(y ~ x + (1|Subject) + ar1(0 + obs|Subject),
                          data = Data2)


text:
Q: What type of syntax i need follow weather angular V2 or angular V4? I am new to ionic and angular. I have installed cordova and ionic using command  npm install -g cordova ionic.
I have checked in package.json it's showing below
"@angular/common": "4.1.2",
"@angular/compiler": "4.1.2",
"@angular/compiler-cli": "4.1.2",
"@angular/core": "4.1.2",
"@angular/forms": "4.1.2",
"@angular/http": "4.1.2",
"@angular/platform-browser": "4.1.2",
"@angular/platform-browser-dynamic": "4.1.2",
"@ionic-native/core": "3.10.2",
"@ionic-native/splash-screen": "3.10.2",
"@ionic-native/status-bar": "3.10.2",
"@ionic/storage": "2.0.1",
"ionic-angular": "3.3.0",
"ionicons": "3.0.0",
"rxjs": "5.1.1",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.11"

Kindly inform to me weather i will use angular 2 syntax or angular 4?
and also guide me how to install ionic with angular 2.

A: If you installed from the package.json file and it says "@angular/common": "4.1.2", ... Then you just installed Angular version 4.1.2.
You can confirm which version you are using at runtime using one of the options discussed here: how to find my angular version in my project?
Regarding installing ionic ... there must be some documentation that provides that information.


text:
Q: Angular multiple *ngFor and their relationships I was working to generate a pivot table using two jsons array. so i need to generate column dynamically also inject/find the key dynamically. so my first json array's key depends on second array. i hope you'll get clear understanding if you see my below code snippets. i can do it using external function but i need simple way.

    {{x.MCC}}
    {{x.LAC}}
    {{x.CID}}
     {{x.col}}	 //col as key for x

A: use square brackets to access the property. x[col]
 {{x[col]}}	 //col as key will inject for x


text:
Q: Ceph No cluster conf found in /etc/ceph with fsid I read the official documentation about a quick ceph deploy and I get always the same error in the section where we activate OSDs:
ceph-deploy osd activate node2:/var/local/osd0 node3:/var/local/osd1

This command do not work and always shows the same log:
[2016-01-29 14:19:54,024][ceph_deploy.conf][DEBUG ] found configuration file at: /home/admin/.cephdeploy.conf
[2016-01-29 14:19:54,032][ceph_deploy.cli][INFO  ] Invoked (1.5.30): /usr/bin/ceph-deploy osd activate node2:/var/local/osd0 node3:/var/local/osd1
[2016-01-29 14:19:54,033][ceph_deploy.cli][INFO  ] ceph-deploy options:
[2016-01-29 14:19:54,033][ceph_deploy.cli][INFO  ]  username                      : None
[2016-01-29 14:19:54,034][ceph_deploy.cli][INFO  ]  verbose                       : False
[2016-01-29 14:19:54,035][ceph_deploy.cli][INFO  ]  overwrite_conf                : False
[2016-01-29 14:19:54,036][ceph_deploy.cli][INFO  ]  subcommand                    : activate
[2016-01-29 14:19:54,037][ceph_deploy.cli][INFO  ]  quiet                         : False
[2016-01-29 14:19:54,038][ceph_deploy.cli][INFO  ]  cd_conf                       : <ceph_deploy.conf.cephdeploy.Conf instance at 0x7f866bc90368>
[2016-01-29 14:19:54,040][ceph_deploy.cli][INFO  ]  cluster                       : ceph
[2016-01-29 14:19:54,041][ceph_deploy.cli][INFO  ]  func                          : <function osd at 0x7f866bee75f0>
[2016-01-29 14:19:54,042][ceph_deploy.cli][INFO  ]  ceph_conf                     : None
[2016-01-29 14:19:54,043][ceph_deploy.cli][INFO  ]  default_release               : False
[2016-01-29 14:19:54,044][ceph_deploy.cli][INFO  ]  disk                          : [('node2', '/var/local/osd0', None), ('node3', '/var/local/osd1', None)]
[2016-01-29 14:19:54,058][ceph_deploy.osd][DEBUG ] Activating cluster ceph disks node2:/var/local/osd0: node3:/var/local/osd1:
[2016-01-29 14:19:56,498][node2][DEBUG ] connection detected need for sudo
[2016-01-29 14:19:58,497][node2][DEBUG ] connected to host: node2
[2016-01-29 14:19:58,516][node2][DEBUG ] detect platform information from remote host
[2016-01-29 14:19:58,601][node2][DEBUG ] detect machine type
[2016-01-29 14:19:58,609][node2][DEBUG ] find the location of an executable
[2016-01-29 14:19:58,613][ceph_deploy.osd][INFO  ] Distro info: debian 8.3 jessie
[2016-01-29 14:19:58,615][ceph_deploy.osd][DEBUG ] activating host node2 disk /var/local/osd0
[2016-01-29 14:19:58,617][ceph_deploy.osd][DEBUG ] will use init type: systemd
[2016-01-29 14:19:58,622][node2][INFO  ] Running command: sudo ceph-disk -v activate --mark-init systemd --mount /var/local/osd0
[2016-01-29 14:19:58,816][node2][WARNING] DEBUG:ceph-disk:Cluster uuid is eacfd426-58a3-44e8-a6f0-636a6b23e89e
[2016-01-29 14:19:58,818][node2][WARNING] INFO:ceph-disk:Running command: /usr/bin/ceph-osd --cluster=ceph --show-config-value=fsid
[2016-01-29 14:19:59,401][node2][WARNING] Traceback (most recent call last):
[2016-01-29 14:19:59,403][node2][WARNING]   File "/usr/sbin/ceph-disk", line 3576, in <module>
[2016-01-29 14:19:59,405][node2][WARNING]     main(sys.argv[1:])
[2016-01-29 14:19:59,406][node2][WARNING]   File "/usr/sbin/ceph-disk", line 3530, in main
[2016-01-29 14:19:59,407][node2][WARNING]     args.func(args)
[2016-01-29 14:19:59,409][node2][WARNING]   File "/usr/sbin/ceph-disk", line 2432, in main_activate
[2016-01-29 14:19:59,410][node2][WARNING]     init=args.mark_init,
[2016-01-29 14:19:59,412][node2][WARNING]   File "/usr/sbin/ceph-disk", line 2258, in activate_dir
[2016-01-29 14:19:59,413][node2][WARNING]     (osd_id, cluster) = activate(path, activate_key_template, init)
[2016-01-29 14:19:59,415][node2][WARNING]   File "/usr/sbin/ceph-disk", line 2331, in activate
[2016-01-29 14:19:59,416][node2][WARNING]     raise Error('No cluster conf found in ' + SYSCONFDIR + ' with fsid %s' % ceph_fsid)
[2016-01-29 14:19:59,418][node2][WARNING] __main__.Error: Error: No cluster conf found in /etc/ceph with fsid eacfd426-58a3-44e8-a6f0-636a6b23e89e
[2016-01-29 14:19:59,443][node2][ERROR ] RuntimeError: command returned non-zero exit status: 1
[2016-01-29 14:19:59,445][ceph_deploy][ERROR ] RuntimeError: Failed to execute command: ceph-disk -v activate --mark-init systemd --mount /var/local/osd0

I am working in Debian 8.3. I have done all those points till the OSDs active. I mounted 10GB ext4 partitions on node2 /var/local/osd0 and on node3 /var/local/osd1.
After an OSDs prepare command there appeared some files but an OSDs active command still don't work.
Can somebody help me?

A: It happened because I had same disk IDs on all nodes. After I had changed ids with fdisk my cluster became work.


text:
Q: What do these compilation errors in Xcode mean? Sorry I cannot be more descriptive, basically what happened is I went to open Xcode today (I'm a fairly new user) and was unable to test my build as I had these errors which I do not understand.  I don't understand why all of a sudden I'm getting these.  I can post full source if that would help anyone debug this.

my ViewController.h
#import <UIKit/UIKit.h>
@interface local405ViewController : UIViewController {
    NSTime *timer;
}

@property (weak,nonatomic) IBOutlet UIWebView *webView;
@property (weak,nonatomic) IBOutlet UIActivityIndicatorView *activityIndicator;
- (IBAction)homeButton:(id)sender;
- (IBAction)payDuesButton:(id)sender;

A: If that's your entire ViewController.h file, it looks like you're missing an @end directive to signify the end of the @interface block. (In fact, I hope that the real file is "local405ViewController.h".)


text:
Q: testing rails' nested attributes with rspec I'm pretty new to testing and rails and tried to figure it out myself but without any luck.
I have the following models
class Picture < ActiveRecord::Base
  belongs_to :product
  has_attached_file :image
end

class Product < ActiveRecord::Base
  has_many :pictures, :dependent => :destroy
  accepts_nested_attributes_for :pictures, :reject_if => lambda { |p| p[:image].blank? }, :allow_destroy => true
end

and a controller which is pretty standard, I guess…
def create
  @product = Product.new(params[:product])
  if @product.save
    redirect_to products_path, :notice => "blah."
  else
    render :action => "new"
  end
end

how would I go about and test this? i tried something like this but I can't get it to work:
describe ProductsController do
  it "adds given pictures to the product" do
    product = Factory.build(:product)
    product.pictures.build(Factory.attributes_for(:picture))
    post :create, :product => product.attributes
    Product.where(:name => product[:name]).first.pictures.count.should == 1 # or something
  end
end

It probably has something to do with the way the attributes are passed to the create action but how can I get this to work? Im using rails 3.1.rc5 but i doubt that that hast anything to do with why its not working…
or would you not test this at all since it is basic rails functionality and most likely well tested to begin with?

A: Try:
post :create, :product => Factory.attributes_for(:product, :pictures => [ Factory.build(:picture) ])

A: As you say you don't really need to test this, necessarily, because it will be covered by the basic rails functionality, and stuff like this should be thoroughly covered by your integration tests.
However if you DO want to test this the best way is tail your development logs and see what is being posted to the action, copy and paste that into your test and then modify it to suite your needs.
Using attributes or the factory_girl attributes isn't going to cut it unfortunately.


text:
Q: Print the first character of JSON object from rest api - angular 2 I have an Angular2 form that submits on click of Submit Button. One of the fields is a "Type" field that is a drop down selection from an API loaded values. the Type Api looks like below -
Type API:
[
  {
    "DTypeId": "100",
    "DTypeDesc": "AB ASSISTANCE IN",
    "DCategoryCd": "BUSINESS"
  },
  {
    "DTypeId": "790",
    "DTypeDesc": "GH MANAGEMENT CONTRIB",
    "DCategoryCd": "EVITES"
  },
  {
    "DTypeId": "309",
    "DTypeDesc": "ZT TECHNOLOGY FINANCE",
    "DCategoryCd": "ZETANGLE"
  },
{
    "DTypeId": "901",
    "DTypeDesc": "IU MANAGEMENT IN",
    "DCategoryCd": "BUSINESS"
  },
  {
    "DTypeId": "445",
    "DTypeDesc": "OP ASSISTANCE CONTRIB",
    "DCategoryCd": "EVITES"
  },
  {
    "DTypeId": "789",
    "DTypeDesc": "ZT TECHNOLOGY FINANCE",
    "DCategoryCd": "ZETANGLE"
  }

]

*

*I am trying to display the drop down field on the HTML as below-
( {{DCategory-DTypeDesc}}
basically, append the first letter of the object DCategoryCd from TYPE API to the DTypeDesc object
 <select #typeRef="ngModel" class="form-control"
  name="typeCode" [(ngModel)]="editFormModel.typeCode"
  required>
  <option *ngFor="let tytype of getTypesTyps"
  [ngValue]="tytype.DTypeId">{{tytype.DCategoryCd}}-
  {{tytype.DTypeDesc}}</option>
  </select>

the above code results as below -
 BUSINESS-AB ASSISTANCE IN

 EVITES-GH MANAGEMENT CONTRIB

 ZETANGLE-ZT TECHNOLOGY FINANCE

 BUSINESS-IU MANAGEMENT IN

 EVITES-OP ASSISTANCE CONTRIB

 ZETANGLE-ZT TECHNOLOGY FINANCE

but, I'm trying to achieve it as below -
     B-AB ASSISTANCE IN

     E-GH MANAGEMENT CONTRIB

     Z-ZT TECHNOLOGY FINANCE

     B-IU MANAGEMENT IN

     E-OP ASSISTANCE CONTRIB

     Z-ZT TECHNOLOGY FINANCE

*Second part is this form once submitted routes to a home page that has an edit button on each row of the table. On click of this edit button, comes to the edit form (similar form as add new form with above Type field as one of them). This Type field now has to pre-populate the value from home page table. I was able to achieve it for all other fields except this type field due to the appending thing going on.

Is this possible? Thank you, so much in advance. I am kind of stuck at this forever now. So any directions are greatly appreciated.

A: you can just change the following in the option
  <option *ngFor="let t of value"
  [ngValue]="t.DTypeId">{{t.DCategoryCd[0]}}- // add this
  {{t.DTypeDesc}}</option>

working link

A: Solution:  {{t.DCategoryCd[0]}}-{{t.DTypeDesc}} as suggested by @Rahul Singh and also,
{{t.DTypeId.substr(0,1)}} by @Eliseo.
Either one worked for me!


text:
Q: Polyfill for DOM element delete? I need to create the polyfill for DOM element delete. Can not understand, what is I making wrong. The deleteElements() method must delete the current element.

1

2

3

A: There are several problems there:

*

*You're defining a property with a getter and setter, then using that property as as function, but the getter doesn't return a function. You almost certainly don't want to use a getter and setter.

*As I said in my comment, delete has nothing to do with removing elements from the DOM. delete removes a property from an object. It has nothing to do with removing an element from the DOM.
If you want to remove the first child of an element without using the native remove, you'd do this:
this.removeChild(this.firstChild);

(There's also no need for return at the end of a function unless you're returning a value.)
If you want define a new method on Element.prototype, you'd do it like this:
Object.defineProperty(Element.prototype, "deleteElements", {
    value: function() {
        // ...code here...
    },
    writable: true,    // These are the values for the
    enumerable: true,  // `remove` property on `Element.prototype`
    configurable: true // on browsers that property support it
});


text:
Q: Cannot start httpd on CentOS I cannot restart apache on CentOS. The results are below. I cannot locate a meaningful error to fix the issue.
Running service httpd start
Results in

Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.

Then running systemctl status httpd.service
Results in
httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Sun 2017-06-11 08:29:11 EDT; 15min ago
     Docs: man:httpd(8)
           man:apachectl(8)
  Process: 640 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
  Process: 638 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=killed, signal=SEGV)
 Main PID: 638 (code=killed, signal=SEGV)

Jun 11 08:29:11 server systemd[1]: Starting The Apache HTTP Server...
Jun 11 08:29:11 server systemd[1]: httpd.service: main process exited, code=killed, status=11/SEGV
Jun 11 08:29:11 server kill[640]: kill: cannot find process ""
Jun 11 08:29:11 server systemd[1]: httpd.service: control process exited, code=exited status=1
Jun 11 08:29:11 server systemd[1]: Failed to start The Apache HTTP Server.
Jun 11 08:29:11 server systemd[1]: Unit httpd.service entered failed state.
Jun 11 08:29:11 server systemd[1]: httpd.service failed.

And journalctl -xe
Results in
Jun 11 08:45:10 server systemd[1]: Starting The Apache HTTP Server...
-- Subject: Unit httpd.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit httpd.service has begun starting up.
Jun 11 08:45:10 server systemd[1]: httpd.service: main process exited, code=killed, status=11/SEGV
Jun 11 08:45:10 server kill[691]: kill: cannot find process ""
Jun 11 08:45:10 server systemd[1]: httpd.service: control process exited, code=exited status=1
Jun 11 08:45:10 server systemd[1]: Failed to start The Apache HTTP Server.
-- Subject: Unit httpd.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit httpd.service has failed.
--
-- The result is failed.
Jun 11 08:45:10 server systemd[1]: Unit httpd.service entered failed state.
Jun 11 08:45:10 server systemd[1]: httpd.service failed.

And from  /etc/httpd/logs/error_log
[Sun Jun 11 08:49:33.214825 2017] [suexec:notice] [pid 761] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Sun Jun 11 08:49:33.237392 2017] [auth_digest:notice] [pid 761] AH01757: generating secret for digest authentication ...
[Sun Jun 11 08:49:33.238036 2017] [lbmethod_heartbeat:notice] [pid 761] AH02282: No slotmem from mod_heartmonitor
PHP Fatal error:  PHP Startup: apc_shm_create: shmget(0, 67108864, 914) failed: Invalid argument. It is possible that the chosen SHM segment size is higher than the operation system allows. Linux has usually a default limit of 32MB per segment. in Unknown on line 0
PHP Fatal error:  PHP Startup: apc_shm_attach: shmat failed: in Unknown on line 0


text:
Q: mysql reinstallation still getting problems ubuntu Renaming removed key_buffer and myisam-recover options (if present)
mysql_upgrade: Got error: 1045: Access denied for user 'root'@'localhost' (using password: NO) while connecting to the MySQL server
Upgrade process encountered error and will not continue.
mysql_upgrade failed with exit status 11
dpkg: error processing package mysql-server-5.7 (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-server-5.7; however:
  Package mysql-server-5.7 is not configured yet.

dpkg: error processing package mysql-server (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                Processing triggers for libc-bin (2.23-0ubuntu10) ...
Processing triggers for systemd (229-4ubuntu21.4) ...
Processing triggers for ureadahead (0.100.0-19) ...
Errors were encountered while processing:
 mysql-server-5.7
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

I am getting the above erros when I try to install mysql. I tried these steps to install:

*

*sudo apt-get remove --purge mysql*

*sudo apt-get purge mysql*

*sudo apt-get autoremove

*sudo apt-get autoclean

*sudo apt-get remove dbconfig-mysql

*sudo apt-get dist-upgrade

*sudo apt-get install mysql-server

These step are from here
Is there any step I missed ?

A: As I see there, you have dependency problems. But, this is the first time you install mysql in that terminal?
After appears that error, introduce in your terminal:
- sudo apt install -f


text:
Q: Jmap error "More than one non-option argument" I'm trying to convert JVM core dump to HPROF format with following command
jmap -dump:format=b,file=dump.hprof $(which java) core.dump.9
and getting the following error
Error: More than one non-option argument
Cannot connect to core dump or remote debug server. Use jhsdb jmap instead

What am I doing wrong and are there other tools to convert it? JDK is OpenJDK 11.0.4.

A: Since JDK 9 jmap works only with a live JVM through the Dynamic Attach mechanism.
The 'forced' mode jmap -F was replaced with a separate utility jhsdb.
Use the following command to produce a heap dump from a core file:
jhsdb jmap --binaryheap --dumpfile dump.hprof --exe /usr/local/openjdk-11/bin/java --core core.dump.9


text:
Q: Regex for match numbers , hypen and special characters I have to validate below with the given condition
com.android.123foo

following conditions should be applied

*

*Numbers shouldn't be allowed after the last dot (ex. "com.android.123foo")
NOTE: Numbers can be allowed middle or end of the string (ex. com.android.foo123 or com.adnroid.fo0123news)

*special characters and hyphen should not be allowed over the entire string (ex com.android.123foo)
Kindly help.

A: Depending on which dot you are asking about the answer will change, but perhaps you are after something like this:
for after first dot
"com.iphones22tore.123foo".match /^.*\.[a-zA-Z.]*$/
=> nil
"com.iphonestore.foo".match /^.*\.[a-zA-Z.]*$/
=> #<MatchData "com.iphonestore.foo">

If you mean after the final dot then change the regex to:
.match /^.*\..*\.[a-zA-Z.]*$/

instead of creating a regex for a blacklist after the dot for what isnt allowed, this just simply defines what IS allowed after the dot.


text:
Q: how to refer to the iterator_traits::reference of the iterator class? i have tried to write the iterator class inside the custom container class i made and i defined the traits inside the class which made writing this line
reference operator*() const {return value->item;}

then after some research on the web i found a better way to do that which is define the iterator_traits inside the std namespace for the iterator class and then write my iterator class outside the container class which made the code more readable but the previous made error that i fixed by writing the template
T& operator*() const {return value->item;}

so i wonder if there is a way i still can use the first line of code
template <typename T>
class CustomIterator{
    using node = node<T>;
    node *value;
public:

    T& operator*() const {return value->item;}
    T& operator[] (size_t index) const { return *(index + *this); }

};

namespace std {
    template<typename T>
    class iterator_traits<CustomIterator<T> >
    {
    public:
        using difference_type = std::ptrdiff_t;
        using size_type = std::size_t;
        using value_type = T;
        using pointer = T*;
        using reference = T&;
        using iterator_category = std::random_access_iterator_tag;
    };
}


text:
Q: Have puppet conditionally execute multiple commands I have a working puppet configuration to help installing mysql instances on a machine.  My environment is setup such that there are multiple instances running on the same machine (with different configs/ports/etc).
The basic setup I have in a manifest looks like
File{
    owner => $owner,
    group => $group,
    before => Exec["mysql_install_db-${name}"],
}

exec{"mysql_install_db-${name}":
    creates => "/var/lib/mysql/${name}/mysql",
    command => "/usr/local/percona/mysql-${version}/usr/bin/mysql_install_db --user=mysql --datadir=/var/lib/mysql/${name} --basedir=/usr/local/percona/mysql-${version}/usr",
    logoutput => true,
}

This works perfectly fine, however now I'd like to modify this install process to run some subsequent commands to bootstrap the fresh install with some internal stored procedures and do some other 'prep work' we do for a new install.
The commands would be basically like
mysql -u user < /path/to/bootstrap1.sql
mysql -u user < /path/to/bootstrap2.sql
mysql -u user < /path/to/bootstrap3.sql

I only want these run once, after the mysql_install_db command but somewhat under the same "creates" guard.
I found some references to just passing an array to the command argument but that reference was in the form of a bug report of it not always working consistently.
What's the preferred method to accomplish something like this, and ensure the commands get executed in a deterministic order and only after mysql_install_db was run?

A: There are several ways to run exec only once, and only after "mysql_install_db-${name}" :

*

*Just change the command line to add all the other commands (cmd1 && cmd2 && cmd3 ...).

*Use the unless or onlyif parameters, so as to check if your stored procedure or whatsoever already exists before running the command. This might be complex, so another method is to have the command create a file ("command && touch /root/blah-${name}") and use the creates parameter.

*Set refreshonly, and subscribe to the previous exec.

While all these solutions will work, you will not be respecting Puppet's spirit of describing the final state of your system. For database, user and grant settings you can use the puppetlabs-mysql module, that will let you describe them in a natural way. Stored resources are another matter, that might be packaged more logically with the application deployment process (as they must be kept in sync with the application). If this is not possible, then you can make your SQL scripts idempotent, using conditionals.


text:
Q: Why is my glBindBufferRange offset alignment incorrect? I'm having difficulty understanding how glBindBufferRange offset / alignment works in the Nvidia example project gl_commandlist_basic. I've read that the offset needs to be a multiple of GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT which is 256 and/or that offset and alignment is very important with glBindBuffer range.. I have an example UBO that works with mat4/vec4 and a non-working example with mat4/mat3/vec4. The UBO doesn't add up to be a multiple of 256 in either case. I'm try to send vec4(0.f, 1.f, 0.f, 1.f).
If mat4 = 64 bytes, mat3 = 36 bytes, vec4 = 16 bytes then the working example has 64+16=80 bytes, which isn't a multiple of 256. The non-working example has 64+36+16 = 116 bytes.
NV uses an inline called uboAligned which is defined as
inline size_t uboAligned(size_t size) { return ((size + 255) / 256) * 256; }

Removing this from the working/non made no difference either way.
I assume I need to add some "padding" to the UBO in the form of a float/vec2/vec3/vec4, etc. How do I determine the correct amount of padding I need if I want to use the mat4/mat3/vec4 UBO?
/* APPLICATION */
typedef struct
{
    glm::mat4 MM;
    // glm::mat3 NM;
    glm::vec4 Cs;
} myData0;

Gluint objectUBO;
glCreateBuffers(1, &objectUBO);
glNamedBufferData(objectUBO, uboAligned(sizeof(abjObjectData) * 2), 0, GL_STATIC_DRAW); //

for (unsigned int i = 0; i < allObj.size(); ++i)
{
    myData0 myDataTemp;
    myDataTemp.Cs = glm::vec4(0.f, 1.f, 0.f, 1.f);
    glNamedBufferSubData(objectUBO, sizeof(abjObjectData) * i, sizeof(abjObjectData), &objDataInit);
}

//hot loop
for (unsigned int i = 0; i < allObj.size(); ++i)
{
    glBindBufferRange(GL_UNIFORM_BUFFER, 1, objectUBO, uboAligned(sizeof(abjObjectData)) * i, sizeof(abjObjectData));
    //draw
}

/* HW */
out vec4 Ci;

struct ObjectData
{
    mat4 MM;
    // mat3 NM;
    vec4 Cs;
};

layout (std140, binding = 1) uniform objectBuffer { ObjectData object; };

void main()
{
    Ci = object.Cs;
}

A: Simple typo with glNamedBufferData. Changing from
glNamedBufferData(objectUBO, uboAligned(sizeof(abjObjectData) * 2), 0, GL_STATIC_DRAW);

to
glNamedBufferData(objectUBO, uboAligned(sizeof(abjObjectData)) * 2, 0, GL_STATIC_DRAW);

fixes the offset / alignment problems.

A: OpenGL uses a particular alignment. Assuming you are using std140 layout, for example, this is a structure defined in Cpp :
struct PointLight
{
    glm::vec3 position;
    int padding; //this is needed for alignement
    glm::vec3 color; // because a vec3 has to be aligned
    float intensity; //no need for alignment because a float can be read directly without alignement
};

That you can pass to a uniform of a struct like this in shader :
uniform light
{
    vec3 Position;
    vec3 Color;
    float Intensity;
} PointLight;

I would test something like :
struct ObjectData
{
    mat4 MM;
    mat3 NM;
    vec3 padding; //I think you have to add 3 floats of padding
    vec4 Cs;
};

But I couldn't find more infos on it, I don't remember where I found it on the first place.
You have different type of memory layout tho, you can check them, std140 define memory layout in the specs here and I advise you to use this layout. If you don't, shared layout will be used and you have to query the layout. You can use OpenGL to query the layout to know what padding you should add BlockLayoutQuery
Concerning glBindBufferRange, I've never heard about the 256bits alignement. Here is an example of how I use it :
const int pointLightCount = SomeNumber;
int pointLightBufferSize = sizeof(PointLight) * pointLightCount + sizeof(int) * 4;

glBindBuffer(GL_SHADER_STORAGE_BUFFER, ssbo[0]);
glBufferData(GL_SHADER_STORAGE_BUFFER, pointLightBufferSize, 0, GL_DYNAMIC_COPY);
void * lightBuffer = glMapBuffer(GL_SHADER_STORAGE_BUFFER, GL_WRITE_ONLY);
((int*) lightBuffer)[0] = pointLightCount;
 for (int i = 0; i < pointLightCount; ++i) {
        PointLight p = { something };
        ((PointLight*) ((int*) lightBuffer + 4))[i] = p;
    }
    glUnmapBuffer(GL_SHADER_STORAGE_BUFFER);
    glBindBufferRange(GL_SHADER_STORAGE_BUFFER, 0, ssbo[0], 0, pointLightBufferSize); //Bind all the buffer


text:
Q: print each ip address with number of GET /PUT /POST /DELETe request in perl I have a apache log which looks like below.
192.168.10.20 - - [18/Jul/2017:08:41:37 +0000] "PUT /search/tag/list HTTP/1.0"
10.30.24.3 - - [18/Jul/2017:08:45:15 +0000] "POST /search/tag/list HTTP/1.0"
192.168.10.20 - - [18/Jul/2017:09:04:09 +0000] "GET /apps/cart.jsp?appID=4651 HTTP/1.0"
192.168.10.20 - - [18/Jul/2017:09:04:09 +0000] "GET /apps/cart.jsp?appID=4651 HTTP/1.0"
10.30.24.3 - - [18/Jul/2017:08:45:15 +0000] "POST /search/tag/list HTTP/1.0"

It consists of same ip address multiple times with different reqeust types.
Can any give a solution in perl to extract all the ip address,group them and no of POST/GET/DELETE request for each ip address.
Output format should be like
192.168.10.20: GET=23,POST=13,PUT=23,DELETE=11
43.56.76.4: GET=4,POST=3,PUT=1,DELETE=3
Till now I have done this, extracted ip and request type and logged into another file and then counted of each occurance:
my $file = "apache_log.log";
my $file2 = "apache_log1.log";
my %hrec;
open (FH, "$file");
open(DATA, ">$file2");
my $str;
while (my $line = <FH>) {
chomp $line;
if  ( $line =~ /^(\d{1,}\.\d{1,}\.\d{1,}\.\d{1,})\s+\-\s+\-\s+\[\d{1,}\/\w+\/\d{1,}\:\d{1,}\:\d{1,}\:\d{1,}\s+\+0000\]\s+\"(PUT|GET|POST|DELETE)/)   {
print DATA "$1: $2\n";
}
close(DATA);
close(FH);
open(DATA, "$file2") or die "Couldn't open file $file2, $!";
while ( my $str = <DATA>) {
my @requests = split ('\n',$str);
foreach my $req(@requests) {
$hrec{$req}++;
 }
 }
close(DATA);
foreach my $fam ( sort keys %hrec) {
print "$fam =". ($hrec{$fam})."\n";
}

--
But my output is coming like below
192.168.10.20: GET=23
192.168.10.20: POST=16
43.56.76.4: GET=4
43.56.76.4: POST=3
and so on.``

A: open(FileHandle, "<$ARGV[0]");
%hash = ();
while(<FileHandle>)
{
    chomp($_);
    if($_ =~ /^(\d{1,}\.\d{1,}\.\d{1,}.\d{1,})/) { $ip = $1; }
    if($_ =~ /GET/) { $hash{$ip}{"GET"}++; }
    if($_ =~ /POST/) { $hash{$ip}{"POST"}++; }
    if($_ =~ /PUT/) { $hash{$ip}{"PUT"}++; }
    if($_ =~ /DELETE/) { $hash{$ip}{"DELETE"}++; }
}
foreach $k (keys %hash)
{
    print "$k: GET=$hash{$k}{'GET'},POST=$hash{$k}{'POST'},PUT=$hash{$k}{'PUT'},DELETE=$hash{$k}{'DELETE'}\n";
}


text:
Q: MySQL/PHP  not displaying submitted value I am working on a school assignment and I have run into some issues. I have PHP code for a form that, when selected, sends the selected result to a MySQL database and then loops through and displays the results. The only problem is that, instead of showing the selected <option>, it shows all four of the options.
Here is my code:
<?php
include_once (connection.php);

if (($_SERVER["REQUEST_METHOD"] == "POST") && (isset($_POST['card_catalog_form']))) {

    $card_name = mysqli_real_escape_string($conn, $_POST['card_name']);
    $card_label = mysqli_real_escape_string($conn, $_POST['card_label']);

    $insert_card_genre_query = sprintf("INSERT into card_catalog (card_name, card_label) VALUES ('%s', '%s')",
        $card_name,
        $card_label);
    $insert_card_genre = mysqli_query($conn, $insert_card_genre_query) or die (mysqli_error($conn));

    $last_record = mysqli_insert_id($conn);
}

$card_genre_query = "SELECT card_genre.genre_id, card_label from `card_genre` order by card_label asc";
$card_genre = mysqli_query($conn, $card_genre_query) or die(mysqli_error($conn));

$get_card_genre_query = "SELECT card_catalog.id, card_catalog.card_name, card_catalog.card_label, card_genre.genre_id from card_catalog right join card_genre on card_catalog.card_label = card_genre.card_label";
$get_card_genre = mysqli_query($conn, $get_card_genre_query) or die(mysqli_error($conn));

?>
<!DOCTYPE html>

    <meta charset="UTF-8">
    <title>The Marketplace By The Mana Club</title>
    <link rel="stylesheet" type="text/css" href="stylesheets/tmp.css">

    <?php include(templatestuff/top_of_tmp.php); ?>

Products:

Product 1: "Jack-In-The-Mox"

Product Description: "Roll a six-sided die for Jack-in-the-Mox. On a 1, sacrifice Jack-in-the-Mox and lose 5 life. Otherwise, Jack-in-the-Mox has one of the following effects. Treat this ability as a mana source..."

What Card Are You Looking For?

            <form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" method="post" enctype="multipart/form-data">
              <fieldset>

What's The Card Name? <input type="text" name="card_name">

Card Type:

                  <select name="card_genre">
                      <?php while ($row_card_genre = mysqli_fetch_assoc($card_genre)) { ?>
                      <option value="<?php echo $row_card_genre['genre_id'];?>"><?php echo $row_card_genre['card_label'];?></option>
                      <?php } ?>
                  </select>

<input type="submit">

                <input type="hidden" name="card_catalog_form">
              </fieldset>
            </form>

            <?php
                if ($last_record) {
                    echo "
You just created form query #" . $last_record ."
";
                }
            ?>

You are submitting your form at
                <?php
                    date_default_timezone_set('America/New_York');
                    echo date('g:i a \o\n l, F j, Y');

                ?>

        <?php
        $query = "SELECT card_catalog.card_name, card_catalog.card_label, card_genre.genre_id FROM card_catalog, card_genre";

        $result = mysqli_query($conn, $query) or die(mysqli_error($conn));

        while($row = mysqli_fetch_array($result)){
            echo $row['card_name']. " - ". $row['genre_id'];
            echo "
";
        }
        ?>

    <?php include('templatestuff/bottom_of_tmp.php'); ?>

`

(If you want to see the website that contains the problem, you can go here)
Any help, or constructive criticism, would be greatly appreciated.
Thanks

A: This might point you in the right direction:
if (isset($_POST['card_genre'])) {
    $query = "SELECT card_catalog.card_name, card_catalog.card_label, card_genre.genre_id FROM card_catalog, card_genre WHERE card_genre.genre_id = ?";
    $stmt   = mysqli_prepare($conn, $query);
    $stmt->bind_param('s', $_POST['card_genre']);
    $stmt->execute();
    $result = $stmt->get_result();

    while ($row = $result->fetch_assoc()) {
        echo $row['card_name']." - ".$row['genre_id'];
        echo "
";
    }
} else {
    $query = "SELECT card_catalog.card_name, card_catalog.card_label, card_genre.genre_id FROM card_catalog, card_genre";
    $result = mysqli_query($conn, $query) or die(mysqli_error($conn));

    while ($row = mysqli_fetch_array($result)) {
        echo $row['card_name']." - ".$row['genre_id'];
        echo "
";
    }
}