text:
Q: prevent login Form from submission (AJAX) when credentials dont match (return false not working) This is my form:
 <form name="loginform" method="POST" action="login" onsubmit="return validateLogin()">
<div>  User Name  :<input class="input" name="username" type="text" /> </div>
<div> Password  :<input class="input" name="password" type="password" /> </div>
<div> id="yaha" style="color:red;font:bold 16px garamond"</div>
<input style="font-weight:bold;" type="submit" value="Login" />

javascript code is as shown:
function validateLogin()
{
var x1=document.forms["loginform"];
if(//validations)
      {
       return false;
      }
 else
{    goajax(x1.username.value,x1.password.value);}
 }//validate login ends...

var requ = null;

function goajax( u,  p)
{
requ=new XMLHttpRequest();
//code for posting ajax data
requ.onreadystatechange=display;

}
function display()
{
if(requ.readyState == 4)
{
    if(requ.status == 200)
    {
    var message = requ.responseText;
    alert("message==="+message);
    var x;
    if(message.trim() == "ok")
        {
        var x1=document.forms["loginform"];
        return true;
        }
        else if(message.trim() == "no")
        {
        document.getElementById('yaha').innerHTML="Invalid Username or Password!!!";
        x1.password.value="";
        return false;
        }
        else if(message.trim() == "nv")
        {
        document.getElementById('yaha').innerHTML="Account not Activated";
        return false;
        }
    }
}

}
My question is: I am getting the responses from the server as desired but in case of undesired responses, the form is getting submitted even after "return false;" (see function display())
Please scroll down to function display() i don't want the form to be submitted when message is "no" or "nv". basically "return false" is not working

A: Another way is to cancel the default event (in this case the submit)
Like this:
function validateLogin(e)
{
var x1=document.forms["loginform"];
if(//validations)
      {
       e.preventDefault();
       return false;
      }

A: See: jQuery preventDefault();
Try posting with jQuery (If you are using it in the website)

A: I've been doing a lot of this in my current project using jQuery this way:
$('#form').submit(function () {
call_function_to_validate_and_submit();
return false;
});
Whenever I have a javascript error (syntax or other) the form gets submitted (like in a normal html form with no ajax) even if validation fails. My point is that you might have a syntax error somewhere in there.


text:
Q: Obtain all rows, and only show one I connect to database and all is correct, I do the select and all is correct. But the problem comes when I tried to obtain all the rows. I tried with all mysql_fetch... (array, assoc...)
$registros = mysql_query("SELECT * FROM  22bf654e4dfa688d0ec6add2f6f7bf76", $con);
$reg = mysql_fetch_array($registros);

if( ($reg)
{
    echo $reg;

}

A: Keep in mind mysql_ library is deprecated and you should be using PDO or MySQLi.
Using PDO your code would look like this:
<?php
// Your database info
$db_host = '';
$db_user = '';
$db_pass = '';
$db_name = '';

$con = new PDO("mysql:host={$db_host};dbname={$db_name}", $db_user, $db_pass);
$con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

$sql = "SELECT * FROM  22bf654e4dfa688d0ec6add2f6f7bf76";
$result = $con->prepare($sql);
$result->execute();

$reg = $result->fetchALL(PDO::FETCH_ASSOC);
$con = NULL;
print_r($reg);
// To show just one row you can use:
print_r($reg[0]);
// So let's say you have a field called "name", then u could use:
echo $reg[0]['name'];

You need to iterate over the results, this will store all the data into an array $reg:
<?php
// your database info here
$db_host = '';
$db_user = '';
$db_pass = '';
$db_name = '';

$conn = mysql_connect($db_host, $db_user, $db_pass);
if (!$conn)
{
    die("Unable to connect to DB: " . mysql_error());
}

if (!mysql_select_db($db_name))
{
    die("Unable to select {$db_name}: " . mysql_error());
}

$sql = "SELECT * FROM  22bf654e4dfa688d0ec6add2f6f7bf76";
$registros = mysql_query($sql);
if (!$registros)
{
    die("Error: " . mysql_error());
}
$reg = array();
while ($row = mysql_fetch_assoc($registros))
{
    $reg[] = $row;
}

print_r($reg);
// To show just one row you can use:
print_r($reg[0]);
// So let's say you have a field called "name", then u could use:
echo $reg[0]['name'];

A: You should be using mysqli instead of mysql, but that's a whole other answer.
while($row = mysql_fetch_array($result)) {
    echo $row['column-name-here'];
}

That will loop through ALL results from your query.  If you only have 1 result, it will only show 1.  If you only WANT 1 result, then specify in your query to which you want like
SELECT * FROM table WHERE something = something;

A: $reg is an array of all rows; you want to use foreach to iterate through it and then print_r instead of echo on each iteration because that will be an array of columns for that row
If you only want the first row,
print_r($reg[0])
But better yet use a where clause in your query or a limit statement for better performance. Don't return more data than you need.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Performing arithmetic/comparisons on values of different keys during a for loop iteration I have a dictionary with hundreds of keys. How can I run a for loop and perform comparisons/arithmetic operations on different keys/value pairs?
Here's a small example of the dictionary:
dict = {
        "001": {
            "d": "7179.6201",
            "f": "7183.6201",
        },
        "002": {
            "d": "7112.0200",
            "f": "7166.0000",
        },
        "003": {
            "d": "7255.0000",
            "f": "7128.5400",
        },
        "004": (
            "d": "7250.0000",
            "f": "7128.2000"
        }
    }

The for loop should cycle through every key/value pair and perform two operations. (1) If the "d" value for "001" (or any key) is greater than the "d" value for "002" (or any key+1), then return the key ("001", for this particular iteration) and its corresponding "d" value. (2) If that "d" value is greater than the following "d" value, then subtract both numbers (convert from string to number) and return the difference.
Desired result for running the code on this particular dictionary:
"001": "7179.6201", diff: "67.6001"
"003": "7255.0000", diff: "5.0000"

I understand how to call out those key/value pairs, but I don't even know how to begin comparing values of different keys especially when I cannot explicitly reference the key itself. I'd like to provide code for what I've done, but I don't even know where to start for something like this.
Thanks!

A: If your keys follow that sequence, you can get next key from current key
for key in data:
    next_key = "{:03d}".format(int(key) + 1)
    try:
        current_d, next_d = data[key]['d'], data[next_key]['d']
    except KeyError:
        print('End of data')
    else:
        d_diff = float(current_d) - float(next_d)
        if d_diff > 0:
            print('{}: {}, diff: {}'.format(key, current_d, d_diff))

A: from collections import OrderedDict

dict1 = {"001": {"d": "7179.6201", "f": "7183.6201"}, "002": {"d": "7112.0200", "f": "7166.0000"},
     "003": {"d": "7255.0000", "f": "7128.5400"}, "004": {"d": "7250.0000","f": "7128.2000"}}

dict1 = OrderedDict(dict1)
for index in range(len(dict1) - 1):
    if float(list(dict1.items())[index][1]['d']) > float(list(dict1.items())[index + 1][1]['d']):
        print(list(dict1.items())[index][0] + ':' + list(dict1.items())[index][1]['d'] + "    diff:" + \
          str(float(list(dict1.items())[index][1]['d']) - float(list(dict1.items())[index+1][1]['d'])))
    else:
        pass

Explanation:
First make sure dictionary have an sequence order using collections.OrderedDict()
from collections import OrderedDict
dict1 = OrderedDict(dict1)

Using for loop iterate until last element:
for index in range(len(dict1) - 1):

compare the "d" value of current index and next index using if statement:
if float(list(dict1.items())[index][1]['d']) > float(list(dict1.items())[index + 1][1]['d']):

If it is true, print the format which you required and also adding the difference too.
print(list(dict1.items())[index][0] + ':' + list(dict1.items())[index][1]['d'] + "    diff:" + \
      str(float(list(dict1.items())[index][1]['d']) - float(list(dict1.items())[index+1][1]['d'])))

Note: This is tested in my machine with python == 3.6 and got the output which is your desired output!!


text:
Q: Order count per ID and calculate time between orders in BigQuery I am working with customer purchase data and am trying to write a query in Google BigQuery that sorts all purchases by date and adds a purchase/order count per customer (order_count). Also, I would like to calculate a time-delay (in days) between the orders of one customer (purchase_latency). My query currently looks like this:
    select
email,
first_name,
last_name,
order_number,
purchase_date,
order_price,
d.code,
from my_order_data
left join
unnest(discount_codes) as d

The result including "order_count" and "purchase_latency" should look like the following:
email   | order_number | purchase_date               | order_price | order_count | purchase_latency
a@a.com | 34874        | 2020-01-02 16:20:12 UTC     | 20,-        | 1           | 0            |
a@a.com | 43598        | 2020-01-18 12:00:00 UTC     | 30,-        | 2           | 16           |
a@a.com | 47520        | 2020-01-30 08:05:00 UTC     | 15,-        | 3           | 12           |
b@b.com | 23598        | 2019-03-25 22:10:00 UTC     | 22,-        | 1           | 0            |
b@b.com | 25459        | 2019-03-31 17:35:00 UTC     | 55,-        | 2           | 6            |

How would I add the numbering for "order_count" as well as the calculation for "purchase_latency"?
Thank you very much!

A: You can use window functions:

*

*to enumerate the orders of each customer by increasing purchase date, you can use row_number()

*lag() retrieves the date of the "previous" purchase, and you can compute the difference with the current date with date_diff():
So:
select
    email,
    first_name,
    last_name,
    order_number,
    purchase_date,
    order_price,
    row_number() over(partition by email order by purchase_date) order_count,
    date_diff(
        date(purchase_date),
        coalesce(date(lag(purchase_date) over(partition by email order by purchase_date)), date(purchase_date)),
        day
    ) purchase_latency
from my_order_data od
left join unnest(od.discount_codes) as dc

Note: I would highly recommend prefixing all the column names in the query with the (alias of the) table they belong to; this makes the query unambiguous, and much easier to follow.


text:
Q: Did the designers of Monkey Island 2 ever explain the ending? Some pretty big spoilers for Monkey Island 2 lie ahead.

 At the end of Monkey Island 2, LeChuck and Guybrush end up in a universe where they are small children at a funfare, and LeChuck is Guybrush's bullying older brother.  If you wait until after the end credits, you will see Elaine Marley standing at the top of the hole Guybrush fell into and saying "I hope LeChuck hasn't put some terrible evil curse on Guybrush".

 The game is pretty equivocal about whether or not the whole thing is meant to be a child's imagination run wild.  For example, the lift up from the underground tunnels in MI2 shouldn't in any consistent geography lead to the back alley from Melee Island in Monkey 1, since Dinky Island is an entirely different island.

Possibly this can all be explained by the onset of Guybrush's hallucinations being gradual, but the explanation offered in Curse of Monkey Island is not entirely consistent.
Have any of the people involved with the creation of Monkey Island 2 indicated what the hell was going on here, at least in their minds?

A: No, not in any uncertain terms. Ron Gilbert could work in espionage as his secret-keeping skills are first rate. I'm sure you must realize that explaining the ending to Monkey Island 2 is a question with as many answers as people who have played the game to the end.
The "canon" (at least as far as all subsequent Monkey Island games are concerned) ending of Monkey Island 2 explained in Monkey Island 3 states that

it was a hallucination.

but the designers of MI3 had no insight into the original intentions of the end of MI2 as Ron Gilbert was not a part of that project and his original intentions were not shared. Because of this, many players have picked at the inconsistencies in the MI3 explanation as you do and consider the explanation provided in MI3 not to be canon to Ron Gilbert's original vision which he seems intent to never reveal.
Ron Gilbert never explained what the Secret of Monkey Island is either. From the many interviews and ambiguous answers, it is rather clear that Ron Gilbert likes his secrets and may have no intention of ever clearing up any of this conundrum. He mentioned that he considered giving it to his lawyer to be read upon his death, but that this may lead to his untimely demise by a crazed fan desperate to know the secret.

Is any of it real? Is it the fantasy of a boy in an amusement park? What is the secret of Monkey Island?

We may never know. The wikipedia article has some good references and insight, citing several interviews with Ron Gilbert. Apparently Ron Gilbert intended a trilogy so the ending of MI2 may not have been meant to have the finality it almost implies if you take Guybrush's experiences at the end literally.
One stronger theory linked from the wikipedia article suggests that

when LeChuck first curses Guybrush after he falls down the hole, he does transport him to a parallel universe of hell and Guybrush's understanding of the world is shattered.

but it could even be as simple as something like

 when falling down the hole or upon the landing, Guybrush hit his head and everything after that was a concussion-induced hallucination.

Any explanation that dismisses Guybrush's experiences at the end as being a hallucination is likely not going to please fans and so that's probably why it's for the better that it stays a secret. The best part of the ending in my opinion is that it is somewhat open-ended and allows players' imaginations to run wild and question the reality within the Monkey Island fiction. It's sort of surreal to be considering the "reality" within a fiction.
Personally, I feel that the scene with Elaine after the end makes it pretty clear what's what, but that's just my personal opinion. Either way, the game is a masterpiece.
I'm not sure if Ron Gilbert was making a joke, but on his blog, it read, "When @grumpygamer gets 1,000,000 followers, I'll make another Monkey Island." If that's true and someone's motivated enough to find out the truth of the Monkey Island mysteries, then it would seem some advertising of his twitter feed would be in order. FYI, Twitter has about 360,000,000+ registered users, of whom about 140,000,000 or so are believed to be active so you don't even need 1% of all twitter users to follow him - easy, right?

A: At the end of the game, Guybrush had, in quick succession: eaten a bunch of likely poisonous voddoo supplies, been in a massive explosion, hit his head on a rock after said explosion (concussion at the very least), hung from a rope for 3 days waiting to be rescued (severe dehydration / hunger / sleep deprivation), and then dropped down a deep hole (probably another concussion). It would be a miracle if he wasn't hallucinating badly at that point, voodoo curse or no voodoo curse.
Actually, it's probably more likely that the whole thing is a dying delirium as he lies on the bottom of that hole with all his bones broken and bleeding out, hallucinating that it's LeChuck who's causing the spasms of excruciating pain...


text:
Q: Debugging next/node via vscode launch.json source maps not loaded Trying to setup launch.json to debug node/next code through vscode (not the browser). Source maps are getting generated fine and the frontend runs through the debugger, but all the frontend breakpoints are greyed out and don't work.
client/tsconfig.json:
{
  "compilerOptions": {
    "target": "es5",
    "lib": ["dom", "dom.iterable", "esnext"],
    "allowJs": true,
    "skipLibCheck": true,
    "strict": false,
    "forceConsistentCasingInFileNames": true,
    "noEmit": false,
    "esModuleInterop": true,
    "module": "esnext",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "jsx": "preserve",
    "baseUrl": ".",
    "sourceMap": true,
    "paths": {
      "@constants/*": ["../constants/*"],
      "@components/*": ["./components/*"]
    },
    "outDir": "../dist"
  },
  "exclude": ["node_modules"],
  "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"]
}

And my launch.json:
"configurations": [
    {
      "name": "Node: Frontend",
      "type": "pwa-node",
      "request": "launch",
      "runtimeExecutable": "yarn",
      "runtimeArgs": ["start:dev:fe"],
      "console": "integratedTerminal",
      "skipFiles": ["<node_internals>/**", "node_modules/**"],
      "restart": true,
      "sourceMaps": true,
      "preLaunchTask": "tsc: build - client/tsconfig.json",
      "env": {
        "NODE_OPTIONS": "--inspect=9229"
      },
    },

where "start:dev:fe": "PORT=3000 ts-node server/_next.dev".
I verified the source maps for the client are present in dist/client/* and tried playing around with the launch outFiles and resolveSourceMapLocations keys. Ex:
      "outFiles": [
        "${workspaceFolder}/dist/**/*.js",
        "${workspaceFolder}/dist/**/*.jsx",
      ],

Debugging the server side works fine without any additional source mapping or tsconfig edits so I'm not sure what makes the frontend have issues. Perhaps because next is run in client/.next but the command invokes it from server/_next.dev? Looking for some thoughts here because I've been stuck on this for a while and other threads haven't helped yet.
(also I tried attaching instead of launching to debug without any success)


text:
Q: Numbered/bulleted list don't show correctly when no text is added I've been confused whenever I create an numbered/bulleted list, since in the preview (and the final result) it shows as nested until I start to write something in the next element. Although this is a cosmetic change, it might confuse new users until they discover that there are some glitches in the markdown.
 - List item
 -

This shows in the preview as:

The same happens with numbered lists:
 1. List item
 2.

There is a space after the dot/dash in both scenarios, witch creates non-standard response by some of markdown syntax. In both cases after you add some text to the list it render correctly.
I reckon this is a cosmetic problem rather than a serious bug, but there isn't cosmetic tags.

A: Odd as it might seem, this is very much by design, I think. A Markdown list item needs content to be recognized as such. Without content, it's just an odd/unspecified continuation of the previous line.
Even more: most Markdown implementations handle it like this. You can see for yourself on the Babelmark Markdown Testbed.
(Note that it's not just the preview; the preview matches the actual rendering just fine. Also, changing the Stack Exchange implementation to make it easier, will break rendering when using other engines, for those who're using the data dumps.)


text:
Q: Group by date and count specific values I'm trying to create a report where there is only one row for each date, and then a separate counter for each color that the customers has chosen.
The input data consists of two columns, one for date, and one for color. like this:
2014-04-11  BLUE

2014-04-11  GREEN

2014-04-11  BLUE

2014-04-10  RED

2014-04-10  GREEN

2014-04-09  RED

2014-04-09  RED

This is what i would like the report to look like:
| DATE | BLUE | GREEN | RED |

| 2014-04-11 | 2 | 1 | 0 |

| 2014-04-10 | 0 | 1 | 1 |

| 2014-04-09 | 0 | 0 | 2 |

I guess I need to group it by date, but the problem is that I cannot "sum" or "count" only BLUE colors etc. Is this even possible? If so, can someone please help me?

A: Please try:
select
    "date",
    SUM(case when color='BLUE' then 1 else 0 end) as BLUE,
    SUM(case when color='GREEN' then 1 else 0 end) as GREEN,
    SUM(case when color='RED' then 1 else 0 end) as RED
from
    YourTable
Group by "date"

A: SELECT "DATE",
        SUM(CASE WHEN color='GREEN' THEN 1 ELSE 0 END) as GREEN
        SUM(CASE WHEN color='RED' THEN 1 ELSE 0 END) as RED
        SUM(CASE WHEN color='BLUE' THEN 1 ELSE 0 END) as BLUE
FROM tableName
GROUP BY "DATE"

You need to escape column named DATE with double qouotes as it is a keyword in Oracle


text:
Q: Unable to select a field generated by link_to_add_fields with capybara I have the following element in my view  template: <%= link_to_add_fields "Add event", f, :events %>
This opens up a set of fields, which themselves are generated by simple_fields_for. These fields correctly display in the browser running off my local server, so that is not the problem.
However, I can't figure out how to get capybara to fill_in those fields. capybara does not raise an error in clicking the Add event button from link_to_add_fields, but raises the error when I try to fill in the form, saying that it is Unable to find field. Any guesses?

A: I think you should use id inside your link_to_add_fields and access that id in your capybara fill_in.
<%= link_to_add_fields "Add event", f, :events, :id => 'something' %>
and use id
fill_in "something", with: 'example'


text:
Q: Is it possible kubernetes sends a request to all pods behind a Service/ReplicaSet? I would like kubernetes when i'm sending a request to a Service which response is 204 would be send to all the pods in the ReplicaSet and not only one.
For example GET to http://srvaxivln090:30000/hotel/start This will start a service to start consume messages from a jms-queue.
I have a 3 ReplicaSet and when sending the request only one POD starts to consume the messages from the queue (the one taht receives the request)
How can i configure kubernetes that for certain requests/rules the request will be send to all the pods ?
Thank you

A: This was asked for as a feature and then denied.
However, kubectl get endpoints <your-service> provides a list of IPs that you can use to route to each of the pods.  You can build a little something that does this (you probably want -o json) and mirrors the requests across each of them.


text:
Q: PDO Prepared Statement Function I am using PDO prepared statements, while working on my current project i decided to just create several function for each action that i would need. Below is the example for fetch
function db_fetchAll($sql, $param) {
    global $db;

    $stmt = $db->prepare($sql);

    if (empty($param)) {
        $stmt->execute();
    } else {
        $stmt->execute($param);
    }

    $count = $stmt->rowCount();

    if ($count == 0) {
        $result = "";
    } elseif ($count == 1) {
        $result[] = $stmt->fetch();
    } elseif ($count > 1) {
        $result = $stmt->fetchAll();
    }

    return $result;
}

Example
$database = db_fetchAll("SELECT * FROM database_table WHERE id=:id", array(':id' => $id));

It only condenses lines query's from 3 lines to 1, but with the amount of information required for each page it was worth condensing.
I am going back through the project for one final pass through and i just wanted a second opinion on the security of this. If there is anything that i should add, etc. All user_input is passed through this function
function user_input($input) {
    $input = trim($input);
    $output = strip_tags($input);

    return $output;
}

and all output uses htmlspecialchars.
So the question in a nutshell is:
Is this safe?
Is there anything else that i could do to prevent any other form of injection etc?
I completely understand how prepared statements work, i am just being thorough, version 1 of this site was a nightmare, tons of injections, gaining access to admin accounts, etc.

A: +1 for such an intention. A quite embarrassing number, but only one out of thousand users asking questions regarding PDO here ever think of such a natural thing like a helper function.
Just a few notes.

*

*First of all, there is an essential flaw with your code which is trying to detect the result type automatically. I tried it myself and I can assure you it's just a source of disaster. The less magic in your code the more hair you keep on your head. So, instead of such unreliable magic, just make different functions to return different result sets.

*Second, you have to make default value for the parameters? to be able to run query without placeholders.

*Third, some code is just superfluous. There is no need to check $param variable.

Finally, your function should be looking like
function db_fetchAll($sql, $param = array()) {
    global $db;

    $stmt = $db->prepare($sql);
    $stmt->execute($param);
    return $stmt->fetchAll();
}

and always return the array of rows as the name suggests
As of the other functions with different result sets, it seems that PDO, if very slightly tweaked, can offer exactly the same convenience without any helper function at all. You may take a look at the PDO wrapper I made to ease the pain of transition from old mysql ext
Your code will remain almost the same
$data = DB::query("SELECT * FROM database_table")->fetchAll();

yet it will let you to use all the poser of PDO different resultset methods:
$row = DB::prepare("SELECT * FROM table WHERE id=?")->execute([$id])->fetch();

or even
$sql  = "SELECT name FROM table WHERE id=?";
$name = DB::prepare($sql)->execute([$id])->fetchColumn();

and so on


text:
Q: Modify JSON from Mysql & PHP to compatible with Rickshaw Graph I would like to show last data from MySQL using Rickshaw via PHP
It's required to look like this :
[
    {
        "data": [ { "x": 1350995278, "y": 26.12 },
                  { "x": 1350995276, "y": 26.19 },
                  { "x": 1350995273, "y": 26.12 },
                  { "x": 1350995271, "y": 26.19 },
                  { "x": 1350995268, "y": 26.19 } ]
    }
]

but my PHP with json_encode function returns it a bit differently.  How should i fix it ?
PHP CODE:
    while($row = mysql_fetch_assoc($select)) {
        $r[] = $row;
        $items[] = array('x' => $row['unixtime'], 'y' => $row['sensor']);
    }
    print json_encode($items);

PHP OUTPUT:
[{"x":"1350996886","y":"26.06"},
 {"x":"1350996884","y":"26.06"},
 {"x":"1350996881","y":"26.06"},
 {"x":"1350996879","y":"26.06"},
 {"x":"1350996876","y":"26.06"},
 {"x":"1350996874","y":"26.06"},
 {"x":"1350996871","y":"26.06"},
 {"x":"1350996869","y":"26.06"},
 {"x":"1350996866","y":"26.06"},
 {"x":"1350996864","y":"26.06"}]

I don't need "" after x: and Y: I am new to PHP and don't know how to figure out, please advice.

A: Cast the values to numbers if you don't want them to be quoted:
$items[] = array('x' => (float) $row['unixtime'], 'y' => (float) $row['sensor']);


text:
Q: Not receiving messages on Steam? When you message someone on Steam, there usually is a tag at the bottom of the window when the last message was received. What does it mean if that doesn't show up? I've messaged a friend who is online, but that tag doesn't appear. What does that mean?

A: "Last message received" actually refers to the time that your friend last sent you a message, and has nothing to do with them receiving your message.


text:
Q: Regarding map display in Uber iOS SDK How can I display nearby Uber cabs while booking a ride using UBER iOS SDK widget?
Also, is it possible to display the live location tracking using UBER sdk?
please help...


text:
Q: Where to invoke a jar file (ATM)after a json generated in reports in cucumber framework? Scenario:
Automation Framework :
Cucumber framework using MAVEN
Scenario-->test executed-->now a json file is generated in cucumber reports--->Now this json file path needs to be provided to the jar file to run (ITS FUNCTION IS--raise tickets in JIRA).
Issue: When i put jar file execution in the @after method--->then it gives error because the json is not yet generated.
NOTE: It seems that json in the cucumber report will be generated only after all the execution and BUILD SUCCESS.
THAT'S why when i am passing the json path in the after method it is not taking.
Please suggest where to invoke this jar which is dependent on the json report generated.

A: @akhouri: If you are using Jenkins for operating your project, then you can use Post-build Actions with plugin: https://wiki.jenkins.io/display/JENKINS/PostBuildScript+Plugin to run your jar file.


text:
Q: minDate is not being set? I have this jQuery UI datepicker which I've used before. For some reason it will not work on this project. It prints the date correctly and I simply do not see why it wont work.
I've managed to get it to somehow react on the change, but if I set the date to after the 11th it won't let me change anything in the second datepicker. If I pick a date before the 11th it does not set an minDate (or not for what I can see)
I can console log it and it returns the correct format.
Tried my old code from an older project. It does not work here, but on the other project it does?
I've tried using 'destroy' on the datepicker.
I've tried setting it as an option.
I've tried setting the mindate from a function outside the onSelect.
// Check for changes in dates
jQuery('.project--create-datestart, .project--create-dateend').datepicker({
    language: 'da',
    dateFormat: 'dd-mm-yyyy',
    onSelect: function(formattedDate, date, inst)
{
    jQuery('.project--create-dateend').datepicker("destroy");
    jQuery('.project--create-dateend').datepicker({ minDate: new Date(formattedDate)})

    jQuery('.project--create-button').attr('disabled', false);
    jQuery('.project--create-button').addClass('success');

    needToConfirm = true;
}
})

I need to get the first datepicker to set the minDate on the second datepicker.

A: $(".project--create-datestart").datepicker({
    dateFormat: 'dd-mm-yyyy',
    changeMonth: true,
    minDate: new Date(),
    maxDate: '+2y',
    language: 'da',
    onSelect: function(date){

        var selectedDate = new Date(date);
        var msecsInADay = 86400000;
        var endDate = new Date(selectedDate.getTime() + msecsInADay);

       //Set Minimum Date of project--create-dateend After Selected Date of project--create-datestart
        $(".project--create-dateend").datepicker( "option", "minDate", endDate );
        $(".project--create-dateend").datepicker( "option", "maxDate", '+2y' );

    }
});

$(".project--create-dateend").datepicker({
    dateFormat: 'dd-mm-yyyy',
    changeMonth: true
});

A: you can try these code may be help for you.

            From :*

<input title="From Date" placeholder="dd/mm/yyyy" class="form-control fromDate" oninput="this.className = ''" name="fromDate" id="fromDate">

        To :*

<input title="To Date" placeholder="dd/mm/yyyy" class="form-control toDate" oninput="this.className = ''" name="toDate" id="toDate">

A: try setStartDate instead of minDate


text:
Q: Received Facebook error response of type CurlException When I publish an action (as described here https://developers.facebook.com/docs/opengraph/tutorial/#publish), sometimes I'm receiving a cURL error from Facebook:
com.restfb.exception.FacebookGraphException: Received Facebook error response of type CurlException: cURL Error [#22, CURLE_HTTP_NOT_FOUND]: Transfer failed

I'm using the com.restfb lib in Java. Most of the time, this works perfectly.
Any idea?
MAY 3 UPDATE
Ok, I've probably found a solution. Each times I receive a 'CURLE_HTTP_NOT_FOUND', my 'og:image' content was an url sending '404 not found' HTTP error. This is a bug.
I will fix it, and be back soon ;)


text:
Q: Why RTMP streaming protocal's url path different from each other? Recently I'm doing some work on RTMP streaming, that is using Flowplayer to integrate with Edgecast Streaming service and CloudFront Streaming service.
The basic concept is easy to follow, but the format of different providers really waste me a lot of time to figure out.
For example, in order to make edgecast happy, according to the documentation, you need to specify filename in the format of mp4:filename.mp4, flv:filename (without .flv extension) and mp3:filename (without .mp3 extension).
But for CloudFront, it's a different story that mp4:filename.mp4, filename (no flv:prefix, and no .flv extension) and mp3:filename (without .mp3 extension).
This format makes people even more frustrating when today I try to use Edgecast's loadToEdge function, the format the accept is filename.mp4 (without mp4: prefix), filename.flv (without flv: prefix) and mp3:filename.mp3.
As you can see, basically there is no logic there and you have to guess and try all different combinations to make it finally working.
I just would like to know if anyone has idea about why different providers implement their streaming in all customized way? Or is it Adobe's fault doesn't have a unified form or it's just up to service providers to use whatever they like.
Thank you!

A: It's all about implementation.  The URL format, including extensions, has nothing to do with
As an analogy, your question is like asking "Why do some websites have different URLs than others?"  Example of two different yet viable ways of serving up an image:

*

*http://server.com/question/87/why/65.png

*http://server.com/image/question?number=87&image=65.

It's all about how the coders at EdgeCast, Amazon, et al wanted to implement their CDN.  I'm sure there was some logic to it, well thought out or not.  And probably some need to deal with legacy systems, clients and URLs.
It has nothing to do with FMS itself.  Just like the above analogy's URLs have nothing to do with the web server they are served from.


text:
Q: SQL - using the same table in the outer query and in the sub query I'm trying to understand the logic of the simple following query:
select *
from table1 as t1 cross join table2 as t2
where t2.source_code = (
    select Max(t3.source_code)
    from table2 t3
    where t3.source_code in (t1.code_value)
    )

I've read about sub queries, also iv'e been searching for a related question as mine, i haven't found a clear answer.
My question is how can i know the complexity of this query (how many times the sub-query runs).
I'm not quite sure how the sub query works here as i use a table from the outer query inside the sub query.

A: This (Terrible, Horrible, No Good, Very Bad) query is equivalent to:
select * from table1 as t1 join table2 as t2 on t1.code_value = t2.source_code;

If the relation between tables is 1:1 or 1:N then the theoretical complexity is O(n).
The actual complexity is database/data structures/statistics dependent.


text:
Q: Connotation of boob job I suppose everyone has at least heard of the slangy terms handjob & blowjob, both relating to sexual activities. However, the other day I was watching the TV show Friends and I heard the term boob job referring to getting breast implants. I wondered if the same would apply to a woman who'd like to get implants on her buttocks, perhaps buttjob, or something along those lines—— but all I could find was more sexual insinuations about that term as well. Don't get me wrong, I don't have my mind in the gutter here, but why is it that the term boob job seems to have no sexual insinuation if it's formed the same way as the other three? I understand that handjob & blowjob wouldn't convey the idea of getting implants in one's body, but at least buttjob or assjob could work the same way boob job does.

A: There are many job phrases, especially in slang, and while there are blowjobs and handjobs and rim jobs, most jobs do not have sexual connotations. They simply follow one of the various conventional definitions of job as a task, a piece of work, an occupation, or a crime. Referring to such things as jobs is informal; in formal registers, I would only use job in its basic sense of an occupation or duty, or when part of an idiomatic set phrase like odd job or joe job.
There are mcjobs and day jobs for the under-employed and the under-discovered, lube jobs and salvage jobs for pre- and post-crashed cars, and hatchet jobs and snow jobs for your enemies. If you pull a job on a bank you've done a bank job, which might make you a nut job or a whack job, especially if it isn't an inside job you thought up at your desk job.
Its use to refer to cosmetic surgery is so common that the American Heritage Dictionary includes it as a definition:

An operation done to improve one's appearance, or the result of such an operation. Often used in combination: a face job.

While I don't think face job is common, the nose job (for cosmetic rhinoplasty) certainly is. The Online Etymology Dictionary traces it to 1963, but Google Books finds it in a 1947 English textbook

In addition to nose jobs, there are eye jobs and, as you note, boob jobs, but not every type of cosmetic surgery is best known as a job: there are various lifts, tucks, and implants, for example, for more specific work. It is common to hear breast implants instead of a boob job, being somewhat more formal but not as clinical as breast augmentation, and being more descriptive of the procedure, as technically speaking, breast reduction and breast shaping could also be argued to be "boob jobs." And rather than a butt job, you're more likely to hear of butt implants as one method of buttock augmentation.


text:
Q: How to perform basic server-sided operations using JavaScript? I'm an old-fashioned JavaScript freelance coder that likes to code EXCLUSIVELY in the original Notepad app on Windows.
I use older techniques:
EXAMPLE: Before AJAX came around, I would replace existing content on a webpage like this:

<title>EXAMPLE</title>

Hello

...and I like to keep things SIMPLE.

Now, here's my inquiry:
For CLIENT->SERVER and SERVER->CLIENT basic communication in JavaScript:
How to send this data from the webpage to the server:
var x = 1;

And then, the server could make a comparison/calculation like this:
if(x==1){
    alert("The number is ONE");
}

Then, the server could return that result to the webpage, which is:
alert("The number is ONE"); //This is true

^: Then, the webpage user will see the alert message popup.

...BUT, here's the catch!!  I want to STORE that value of x, which is "1", into a text file on the server in order to keep a record of that variable.

In layman's terms, I want to:

*

*Send a variable from a webpage to the server

*Server will check data and perform an operation

*Server will also save that variable data in a separate text file on server

*Server will send the response back to the webpage

What is the SIMPLEST way that I could perform these basic actions using JavaScript?  If possible, I'd like to write it ALL in Notepad.  I'm not fond of using such apps like Dreamweaver, Notepad++, etc.
I am willing to learn JSON, JQuery, and AJAX, as it may be needed for such.
Thanks in advance, and thank you for you time! :)

A: In general, you have to send the data via POST ajax as a parameter to the server. At the server you can read those POST parameters and write them to a file, database or whatever. In repsonse to that, you can handle the response how you want it.
Serverside there is a good PHP framework, which i use: http://www.slimframework.com/


text:
Q: Unable to pass a value from one class to another in android I am facing an issue: a value is not getting transferred from one class to another.
The value is picked inside a class, but when retrieving it in another class I am getting null.
Below is the class where the value is set.
public class stockmanager extends Activity{

    String getentry=null;
    Database d=new Database(this);
    StockTable st=new StockTable();

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.stockmanager);

    final Button AddStock=(Button) findViewById(R.id.button1);
        final EditText entry=(EditText) findViewById(R.id.editText1);
        final Button BroDetail=(Button) findViewById(R.id.button2);

        AddStock.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
                getentry=entry.getText().toString();
                d.db.insert(st.tablename, null,st.insert());

            }
        });
                }
}

In this class I am using the value getentry but I am getting null.
public class StockTable {

final String tablename="StockTable";
private String column1="Stock_ID";
private String column2="StockName";

stockmanager sm=new stockmanager();

final String stocktable = "CREATE TABLE " + tablename +
            " (" + column1+ " INTEGER PRIMARY KEY , " + column2 + " TEXT) ";

public ContentValues insert(){

    ContentValues cvi=new ContentValues();
    for(int i=0;i<=sm.getentry.length();i++)
    {
        cvi.put(column1, 1);
        cvi.put(column2,sm.getentry);
                    }

    return cvi;
}

public void delete(){

}

Please help me to solve this problem

A: You have
public class stockmanager extends Activity{

And you are instantiating a activity class
stockmanager sm=new stockmanager().
You should not instantiate a activity class. It is wrong. Instead you can pass the value to the method itself or to the constructor of other class.
You can do as
StockTable st=new StockTable();
st.insert(your params);

Then in StockTable have a insert method that takes params
public ContentValues insert(params){

A: I don't know what you want to do. But constructor new stockmanager() in StockTable will not fire onCreate() method.
You need to pass your Activity to StockTable class like:
public StockTable(stockmanager yourActivity)
{
 this.st = yourActivity;
}


text:
Q: Should I store string values in variables or as hidden input value Is there a difference, in terms of efficiency, whether to store string values in variables or as a content of hidden input elements? Those values could be large and could be modified frequently.

A: Unless you have a reason to store values in input elements, it's much better to use variables, in terms of both speed and memory consumption.

A: You must have a good reason to store a value in an input field. Its may take time to query the DOM to retrieve an input value. So storing a value in a variable will be easier to retrieve and modify.


text:
Q: PlusOneButton on Android how to know if user has clicked? In my Android app I am giving the possibility to tap on a Google +1 button.
This works fine with the following code from the developpers source material (https://developers.google.com/+/mobile/android/recommend):
mPlusClient = new PlusClient.Builder(this, this, this)
    .clearScopes()
    .build();

mPlusOneButton = (PlusOneButton) findViewById(R.id.plus_one_button);

Now I would like to detect when the user taps on this button, so I tried this:
mPlusOneButton.setOnClickListener(new OnClickListener() {
    public void onClick(View v) {
        Toast.makeText(this, "Thanks for your +1", Toast.LENGTH_LONG).show();
    }
});

But it doesn't do anything, it doesn't display the toast message.
As an alternative, I was thinking of having the player tap twice on the button : first being a regular Button object that would make the plus one button visible, second being the plusone button. but it is an awckward user experience
How can I detect user's tap on this button?

A: Don't use setOnPlusOneClickListener (or any listener) with SDK 13 (and perhaps future versions), it induces a bug (infinite rotation of the progress indicator in the +1 button when you click on it).

A: Use ActivityForResult to trigger the user choice.
mPlusOneButton.setOnPlusOneClickListener(new PlusOneButton.OnPlusOneClickListener() {
                @Override
                public void onPlusOneClick(Intent intent) {
                    startActivityForResult(intent, 0);
                }
            });

Check the result code
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (resultCode == -1) {
      // OK or SHARE

    } else {
      //UNDO

    }

}

A: Plus one button provides a listener function to detect button click. Here is the code.
    mPlusOneButton.setOnPlusOneClickListener(new PlusOneButton.OnPlusOneClickListener() {
        @Override
        public void onPlusOneClick(Intent intent) {
            Log.w(tag,"plus one click");

        }
    });


text:
Q: Symfony2 bundles: am I using them right? I have an application which is developed in Symfony2. Now the structure for it is as follows:

*

*FrontBundle - includes everything related to the application's view and UI.

*PersistanceBundle - includes everything related to the persistence layer of the application.

*DomainBundle - includes everything related to the entities of the application and the services.

Is this structure ok? Or bundles are used like forum feature - ForumBundle - which includes every layer (controllers, services, domain logic and persistence) related to the forum.

A: Like Elnur said, use one AppBundle is a good practice.
A single bundle implements the MVC pattern himself so i think it's not a good idea to use bundles to separate your layers.
I think the best way to use bundles is to think "open source". If the feature you are developping is enough generic to be released for everyone, or to be reused in a future project, place this feature in a bundle.
This way will force you to build the feature without any business rule which belong in your AppBundle.
Bundles are bricks

A: There are different ways to organise application structure for your projects. But if you want to distribute your bundles and follow symfony best practices, then bundles are more features than separation of UI. More about bundles read in documentation.
I have two projects with the following structures, both valid I think:

*

*making a bundle for each feature: BlogBundle, StoreBundle and so on,
and AppBundle that contains general stuff. No Backend/Frontend
separation. It's SaaS where backend is frontend in most cases.

*One bundle for frontend, one for backend. They share only entities
and domain specific stuff. The application has two different ends.

A: There are no hard and fast rules on how to structure your app using bundles, but here's what I came to after developing on Symfony2 for close to a year.
Use one app specific bundle. At first, I started with multiple bundles like CommonBundle, UserBundle, MainBundle, BlogBundle, ContactBundle, etc. That proved to be not so convenient in the end, so I switched to just one app specific bundle — AppBundle.
You can organize your code neatly using subnamespaces. For example, the backend controllers would go to the AppBundle\Controller\Backend subnamespace.
Note that I'm talking about one app specific bundle — that stuff that's unique to the concrete app and won't make sense to reuse elsewhere. You can still develop separate bundles for reusable stuff and put them into the vendors infrastructure.
Keep non Symfony specific stuff out of bundles. There is no need to have a bundle for the model and the Service Layer classes in a bundle if they are not Symfony2 specific. See this question and my answer for further details.


text:
Q: Converting Google Cloud Vision OCR X and Y Co-ordinates to bbox Co-ordinates Google Cloud Vision OCR has the following Output for a bounding box Object.
vertices {
  x: 786
  y: 967
}

Desired Output Format for Bounding Box
I want to go ahead and convert these co-ordinates to bounding box co-ordinates to write them in my hOCR format.
Which includes the following format for writing those in the file.
  <span class='ocr_line' title="bbox 348 797 1482 838; baseline -0.009 -6">

Questions?

*

*So how can I convert these x and y co-ordinates to these bbox (Bounding Box Co-ordinates).

*What are these x and y co-ordinates is it (x_min, y_max) or (x_max, y_min). In general I want to also know what do these x and y represent?
Working on Image
I am working on the following image as my test.

A: As informed by @Christoph Rackwitz in the coments, this value is just a point. Each letter will be  indicated by a set of 4 of this points, creating a bbox, like the following:
{
          "description": "وأما",
          "boundingPoly": {
            "vertices": [
              {
                "x": 1088,
                "y": 230
              },
              {
                "x": 1145,
                "y": 230
              },
              {
                "x": 1145,
                "y": 289
              },
              {
                "x": 1088,
                "y": 289
              }
            ]
          }
        },

And the entire Page will be on the first object, as following:
        {
          "locale": "ar",
          "description": "وأما ثانيا : فلأنه يخرج منه من زنی مثلا ثم جب ذكرة فإنه\nلا يتأتی\nمنه غير الندم على ما مضی ، وأما العزم على عدم\nقال : إن الندم\nيكفي في حد التوبة ، وليس كما قال ؛ لانه لو ندم ولم يقلع\nوعزم على العود لم يكن تائبا اتفاقا ، قال : وقال بعض المحق قين :\nاختيار ترك ذنب سبق حقيقة. أو تقديرا لأجل ال له قال :\nالعود فلا يتصور منه ، قال : وبهذا اغتر من\nهي\nوهذا أسد العبارات وأجمعها لأن التائب لا يكون تار کا\nل لذنب الذي فرغ لأنه غير متمكن من عينه لا تركا ولا فعلا ،\nمثله حقيقة ، وكذا من لم يقع منه ذنب\nمتمكن\nوإنما هو\nمن\nإنما يصح منه اتقاء ما يمكن أن يقع لا ترك مثل ما وقع فيكون\nمتقيا لا تائبا ، قال : والباعث على هذا تنبيه إلهي لمن أراد\nمهلك يفوث على\nلأنه\nسم\nسعادته لقبح الذنب وضر ره ؛\nالإنسان سعادة الدنيا والآخرة ويحجبة عن معرفة ال له. تعالي في\nالدنيا ، وعن تقريبه في الآخرة\nقال : ومن تفقد نفسه وجدها مشحونة بهذا السم فإذا وفق\nانبعث منه خوف هجوم الهلاك عليه ، فيبادر بطلب ما يدفع\n",
          "boundingPoly": {
            "vertices": [
              {
                "x": 122,
                "y": 223
              },
              {
                "x": 1197,
                "y": 223
              },
              {
                "x": 1197,
                "y": 1688
              },
              {
                "x": 122,
                "y": 1688
              }
            ]
          }
        },

*

*You can process the json with the 4 points to generate the object you need.

*Check this page, where you can Try the API. I have used the image url of the upload on stack overflow as the image source (i.e "imageUri": "https://i.stack.imgur.com/9MXec.jpg")


text: Q: Install Ubuntu on HP Split 13 x2 I apologize if this is the wrong place to be asking. I usually use a Ventoy bootable drive for my Linux needs. I've recently been using an HP Split 13 x2 laptop (If you need the model no. let me know) and wanted to triple-boot it with Windows 10, Ubuntu 22.10, and either Android x86 or Windows 7 (I haven't decided yet). I have my USB drive set up and have tried multiple bootable USB software, but I cannot boot from USB. My USB drive is a Samsung bar plus 64 GB (MUF-64be4/am), and I've tried both Ventoy and Rufus as etching software.  When I press f9, or f10, or shift, when restarting, neither the windows recovery nor bios will boot from the USB. Any help, thanks!


text: Q: Working with GRASS gis in pyQGIS I am looking for a way to loop through GRASS gis v.net.distance in QGIS. I want to iterate over all the 3 layers which has multiple features at the same time, and print the shortest distance for each of the layers in a CSV format. Can anybody please refer me to some resources or links with examples of how to do it in PYTHON? is it possible to do it with PYQGIS at all?


text:
Q: Setting alarms at boot of device I have some set 2 different weekly repeating notification alarms at the boot of device with the following code
public class MyRebootReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        if ("android.intent.action.BOOT_COMPLETED".equals(intent.getAction())) {
            Calendar calendar = Calendar.getInstance();
            calendar.setTimeZone(TimeZone.getTimeZone("UTC"));
            calendar.setTimeInMillis(firstMonday(calendar.getTimeInMillis() / 1000) * 1000);
            setAlarm(context,calendar,5);
            calendar = Calendar.getInstance();
            calendar.setTimeZone(TimeZone.getTimeZone("UTC"));
            calendar.setTimeInMillis(firstSutuday(calendar.getTimeInMillis() / 1000) * 1000);
            setAlarm(context,calendar,7);
        }
    }
protected void setAlarm(Context context, Calendar setalarmon, int id ) {
    Intent i = new Intent(context, AlarmClass.class);
    i.putExtra("KEY", id);
    PendingIntent pi = PendingIntent.getService(context, id, i, PendingIntent.FLAG_UPDATE_CURRENT);
    AlarmManager am = (AlarmManager) context.getSystemService(context.ALARM_SERVICE);
    am.setRepeating(AlarmManager.RTC_WAKEUP, setalarmon.getTimeInMillis(), 1000 * 60 * 60 * 24 * 7, pi);

}

The receiving class is AlarmClass which is
public class AlarmClass extends BroadcastReceiver{
    @TargetApi(Build.VERSION_CODES.HONEYCOMB)
    @Override
    public void onReceive(Context context, Intent arg1){
        int key = arg1.getIntExtra("KEY",-1);

        NotificationManager notificationManager
                = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
        Notification.Builder builder = new Notification.Builder(context);
        Intent intent = new Intent(context, MainActivity.class);
        PendingIntent pendingIntent  = PendingIntent.getActivity(context, 0, intent, 0);
        Uri uri= RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
        long[] v = {500,1000};
        builder
            .setSmallIcon(R.drawable.ic_launcher)
            .setContentTitle("Test")
            .setContentText("This is a test ")
            .setContentInfo(" ")
            .setTicker(" Test ");
            .setSound(uri)
            .setVibrate(v)
            .setDefaults(Notification.DEFAULT_LIGHTS)
            .setContentIntent(pendingIntent)
            .setAutoCancel(true);
        Notification notification = builder.build();
        notificationManager.notify(key, notification);
    }

}

So I am expecting one alarm every Suturday at 23:00 and every Monday at 11:00 local times but I didn't get any notification for Suturday's alarm although as i can see in my phone when I used the adb shell dumpsys alarm command that the alarm notifications exits at the correct time and Sutudays alarm was set for next week
Any idea why I didn't get the alarm?

A: In setAlarm() use PendingIntent.getBroadcast() instead of PendingIntent.getService().


text:
Q: Breaking multiple values in an attribute into multiple lines? Let me explain by example:

    ...

As you can see, the prefix attribute in the html tag has multiple definitions. How do I break them into multiple lines? (Considering that a line break is equivalent a space when minified back into a single line... it's kinda tough.)
Is this considered normal?

EDIT: Facebook does it like this: https://developers.facebook.com/docs/payments/product/

A: The attribute values are different. Each whitespace character is stored in the DOM. Whether the difference matters depends on the definition of the attribute. Many attributes, such as class, are defined as taking a set of whitespace-separated tokens as value, and for them, the amount and type of whitespace characters between tokens, or before the first token and after the last token, does not matter.
The prefix attribute is not present in HTML specifications or drafts. The relevant specification is RDFa Core 1.1, which defines the prefix attribute as
"a white space separated list of prefix-name IRI pairs" and contains examples like

So for the prefix attribute, formatting as in the question is acceptable. (Whether it is "normal" in a sense other than "conforming" is a matter of opinion.)

A: I don't think it's all that "normal". In general, like the comments to your question suggest, it's technically possible but you're opening your page up to (unnecessary) potential parsing errors.
Look to the HTML WG's example regarding using newlines in the title attribute as a concrete example of this.
Furthermore, I was unable to find/remember a single case where I'd seen this used on purpose, with the exception of SVG (but that's not technically HTML).
However, if you run this sample through the W3C's validator, it'll pass with no errors or warnings in regards to multi-line attributes:
<!DOCTYPE html>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Hello</title>

Hello World!

Generally, it's better to be safe than sorry. Since I couldn't find any examples to the contrary in this case, I'd venture to say that other developers would agree (Do by all means correct me if I'm wrong).


text:
Q: Show that an operator is weakly compact If $(X,\Omega,\mu)$ is a finite measure space, $k\in L^\infty(X\times X, \Omega\times \Omega,\mu \times \mu)$ , and $K:L^1(\mu)\to L^1(\mu)$ is defined by $$(Kf)(x)=\int k(x,y) f(y) d\mu(y)$$
 show that $K$ is weakly compact and $K^2$ is compact.
My attempt: suppose $\{f_n\}$ is a bounded sequence in $L^1(\mu)$, then the sequence $\{(Kf_n,g)\}$ is a bounded sequence in ${\Bbb C}$, where $g\in L^\infty(\mu)$. Thus there is a subsequence $\{f_{n_i}\}$ such that the sequence $\{(Kf_{n_i},g)\}$ converges. so $K$ is weakly compact.
To show that $K^2$ is compact, I show that the sequence $\{K^2f_n\}$ is cauchy.(where $\{Kf_n\}$ is my subsequence in before part)
we have
$$||K^2f_n - K^2f_m||_1\leq \int \int |k(x,y)(Kf_n(y) - Kf_m(y))|d\mu(y)d\mu(x) $$
$k_x(y):=k(x,y)\in L^\infty(\mu)$, so using before part, for $\epsilon>0$, there is $n_0$ such that for $n,m>n_0$, $\int |k(x,y)(Kf_n(y) - Kf_m(y))|d\mu(y)< \epsilon/\mu(X)$. therefore
$$\int \int |k(x,y)(Kf_n(y) - Kf_m(y))|d\mu(y)d\mu(x) < \epsilon $$
which shows $K^2$ is compact.
Please check my attempt. Thanks for your help.

A: In the first part, you showed that if $\{ f_{n} \}$ is a bounded sequence in $L^{1}_{\mu}$, then $\langle Kf_{n} | g \rangle$ has a convergent subsequence for a $g \in L^{\infty}_{\mu}$, where $\langle\cdot|\cdot\rangle$ denotes the duality pairing. You forgot that the subsequence $\langle Kf_{n} | k_{x}\rangle$ may be different for each $x$ in the second part, and ignored the issue of a.e. with respect to $x$. So you asserted the existence of a subsequence that works for all such $x$. You compounded the problem by assuming that for the common subsequence which you have not shown to exist, that
$$
            |\langle Kf_{n_{j}}|k_{x}\rangle-\langle Kf_{n_{k}}| k_{x}\rangle|\rightarrow 0 \;\;\;\mbox{ as }\; k,j\rightarrow \infty
$$
somehow implied uniformity of convergence with respect to $x$ of
$$
            \langle \;|Kf_{n_{j}}-Kf_{n_{k}}|\;|\; |k_{x}|\; \rangle|\rightarrow 0 \;\;\;\mbox{ as }\; k,j\rightarrow \infty.
$$

A: Firstly,we claim that $K(Ball(L^1(\mu)))$ is weakly closed.
Suppose a net $\{f_j\}_{j\in J}\subset Ball(L^1(\mu))$ and $K(f_j)\rightarrow g$ in $L^1(\mu)$. We need to prove there is a $h\in Ball(L^1(\mu)),s.t, g=K(h).\forall \phi\in L^{\infty}(\mu)$, using Fubini theorem,
$$\int_{X}(K(f_j)-g)\bar{\phi}dm=\int_{X}f_j(x)\int_{X}k(x,y)\bar{\phi}(y)dm(y)dm(x)-\int_{X}g(y)\bar{\phi}(y)dm(y)  ~~~~~~~~(1)$$
It is easy to check that $\int_{X}k(x,y)\bar{\phi}(y)dm(y)\in C(X)$ and $L^1(\mu)\subset {C(X)}^{*}$.
By Alaoglu's theorem, $Ball(L^{1}(\mu))\subset Ball(C(X)^{*})$ which is compact in weak* topology.It follows that there exist a subnet $\{f_i\}_{i\in I}\subset \{f_j\}_{j\in J}$ and $\nu\in Ball(M(X)),s.t. f_i\rightarrow \nu$ in weak* topology of $C(X)^{*}$. Thus,
$$\int_{X}f_i\int_{X}k(x,y)\bar\phi d\mu d\mu\rightarrow\int_{X}\bar\phi\int_{X}k(x,y)d\nu d\nu~~~~~~~~~~~~~~~~~(2)$$
Since $\phi$ is arbitrary, combining (1)(2), we get
$$g=\int_{X}k(x,y)d\nu$$
Since $\nu\in Ball(M(X))$, using Radon's theorem, $\exists h\in Ball(L^{1}(\mu))$,s.t. $$g=\int_{X}k(x,y)hd\mu=K(h)$$
Secondly, using the same trick as above, one can easily prove $K(Ball(L^{1}(\mu)))$ is weakly compact.


text:
Q: how to share button add on react.js page enter image description here
How to put a share button on the react.js page.Clicking on the share button will come on Facebook Gmail Another social site icone.

A: Use reactjs-popup npm library.
Example :-
import React from 'react';
import Popup from 'reactjs-popup';

const PopupExample = () => (
  <Popup trigger={<button>Share</button>} position="right center">

Popup content here !!

    <button>Facebook</button>
    <button>Gmail</button>
  </Popup>
);

Demo:- https://react-popup.elazizi.com/#demo


text:
Q: XMLHttpRequest return from a function before response is back I have a function as the code below, I am trying to send a file through XMLHttpRequest to the server and then store it in DB and retrieve the id of the file in DB and make an object of ids.
The problem is that the function exits a lot before I got the response back from the server to store it in the object therefore the object doesn't store those values.
I know that I need make the XHR asynchronous but it doesn't change the result, I have also tried timeout or using a different platform like Ajax but still, it didn't work.
async function getFileObj() {
    var FileObject = {}
    for (let key1 in PObj) {
        FileObject[key1] = {}
        for (let key2 in PObj[key1]) {
            FileObject[key1][key2] = {}
            for (let key3 in PObj[key1][key2]) {
                const formData = new FormData();
                formData.append('myFile.png', filesObjDB[key1][key2][key3]);

                var xhr = new XMLHttpRequest();
                xhr.open("POST", 'url', true);
                xhr.onreadystatechange = async function() {
                    if (this.readyState === XMLHttpRequest.DONE && this.status === 200)
                        var id = await xhr.response.text();
                        FileObject[key1][key2][key3] = parseInt(id)
                }
                xhr.responseType = 'blob';
                xhr.send(formData);
            }
        }
    }
    return FileObject;
}

Help would be very appreciated!

A: You are not awaiting the request. To make the existing code wait for the result, you'd need to wrap the outdated callback-based code in a promise and await that (and also I don't think getting the response text of an XHR works as you showed, I changed it now):
// This is just to demonstrate what was immediately wrong
// with the existing code - it's not the best solution! See below.

FileObject[key1][key2][key3] = await new Promise((resolve, reject) => {
  var xhr = new XMLHttpRequest();
  xhr.open("POST", url, true);
  xhr.onreadystatechange = function() {
    if (this.readyState === XMLHttpRequest.DONE && this.status === 200) {
      var id = xhr.responseText;
      resolve(parseInt(id));
    }
  };
  xhr.send(formData);
});

Note there is no error handling yet, if the request fails everything will just hang.
But at that point, it doesn't actually make sense to use XHR in the first place! It's a lot more straightforward to use fetch, which has a promise API out of the box:
const response = await fetch(url, { method: 'POST', body: formData })
FileObject[key1][key2][key3] = parseInt(await response.text())


text:
Q: C# Base or Template Class? Ok so I am making a game using XNA, I would like all of the enemies to extend from one base class called "baseEnemy.cs". For example, I would like a zombie to have a class called "zombie.cs" but make it entend the "baseEnemy.cs".
I think I remember being told its would be laid out like:
class zombie : baseEnemy
{

}

But I am assuming the use of get{} and set{} would help me to change values of current variables in zombies.cs that exist as part of baseEnemy.cs... If that makes sense? I don't understand the usage of get{} and set{} but I have seen it in other languages (such as the code for minecraft) which I would assume are similar in their working.
So, say I have a float for the speed of the enemy... I don't want all the enemies to move at the same speed (zombie's should have a low speed, etc). How could I get the speed from the baseEnemy.cs and set it as the speed in zombie.cs.
Or would I be better just making the variables public in baseEnemy.cs?
Sorry if the above doesn't make much sense, I am not too experienced with XNA or terminology used and therefore I probably sound like I am going round in circles :S

A: You are looking for so called abstract methods or abstract properties.
abstract class Enemy
{
    public abstract float GetSpeed();
}

class Zombie : Enemy
{
    public override float GetSpeed()
    {
        return 10;
    }
}

Note the abstract keyword preceding the class name and the method name. The child class has to implement all abstract members, if it is not abstract itself. When an abstract member is implemented the override keyword must be used.
The get set syntax you are describing is called a property. It is a special C# construct that organizes the getter and/or setter of a field and puts them in a single block. The same example as above using properties:
abstract class Enemy
{
    public abstract float Speed { get; }
}

class Zombie : Enemy
{
    public override float Speed
    {
        get { return 10; }
    }
}


text:
Q: How to shape TFRecordDataset to meet Model API? I am building a model based on this code for noise suppression. My problem with the vanilla implementation is that it loads all data at once, which is not the best idea when the training data gets really large; my input file, denoted in the linked code as training.h5, is over 30 GB.
I decided to instead go with tf.data interface that should allow me to work with large data sets; my problem here is that I don't know how to properly shape TFRecordDataset so that it meets what's required by the Model API.
If you check model.fit(x_train, [y_train, vad_train], it essentially requires the following:

*

*x_train, shape [nb_sequences, window, 42]

*y_train, shape [nb_sequences, window, 22]

*vad_train, shape [nb_sequences, window, 1]
window one typically fixes (in the code: 2000), so the only variable nb_sequences that stems from how large is your data set. However, with tf.data, we don't supply x and y, but only x (see Model API docs).
Saving tfrecord to file
In an effort to make the code reproducible, I created the input file with the following code:
writer = tf.io.TFRecordWriter(path='example.tfrecord')
for record in data:
    feature = {}
    feature['X'] = tf.train.Feature(float_list=tf.train.FloatList(value=record[:42]))
    feature['y'] = tf.train.Feature(float_list=tf.train.FloatList(value=record[42:64]))
    feature['vad'] = tf.train.Feature(float_list=tf.train.FloatList(value=[record[64]]))
    example = tf.train.Example(features=tf.train.Features(feature=feature))
    serialized = example.SerializeToString()
    writer.write(serialized)
writer.close()

data is our training data with shape [10000, 65]. My example.tfrecord is available here. It's 3 MB, in reality it would be 30 GB+.
You might notice that in the linked code, numpy array has shape [x, 87], while mine is [x, 65]. That's OK - the remainder is not used anywhere.
Loading the dataset with tf.data.TFRecordDataset
I would like to use tf.data to load "on demand" the data with some prefetching, there's no need to keep it all in memory. My attempt:
import datetime
import numpy as np
import h5py
import tensorflow as tf
from tensorflow.keras.models import Model
from tensorflow.keras.layers import Input
from tensorflow.keras.layers import Dense
from tensorflow.keras.layers import GRU
from tensorflow.keras import regularizers
from tensorflow.keras.constraints import Constraint
from tensorflow.keras.callbacks import ModelCheckpoint
from tensorflow.keras import backend as K
from tensorflow.keras.layers import concatenate

def load_dataset(path):
    def _parse_function(example_proto):
        keys_to_features = {
            'X': tf.io.FixedLenFeature([42], tf.float32),
            'y': tf.io.FixedLenFeature([22], tf.float32),
            'vad': tf.io.FixedLenFeature([1], tf.float32)
        }
        features = tf.io.parse_single_example(example_proto, keys_to_features)
        return (features['X'], (features['y'], features['vad']))

    dataset = tf.data.TFRecordDataset(path).map(_parse_function)
    return dataset

def my_crossentropy(y_true, y_pred):
    return K.mean(2 * K.abs(y_true - 0.5) * K.binary_crossentropy(y_pred, y_true), axis=-1)

def mymask(y_true):
    return K.minimum(y_true + 1., 1.)

def msse(y_true, y_pred):
    return K.mean(mymask(y_true) * K.square(K.sqrt(y_pred) - K.sqrt(y_true)), axis=-1)

def mycost(y_true, y_pred):
    return K.mean(mymask(y_true) * (10 * K.square(K.square(K.sqrt(y_pred) - K.sqrt(y_true))) + K.square(
        K.sqrt(y_pred) - K.sqrt(y_true)) + 0.01 * K.binary_crossentropy(y_pred, y_true)), axis=-1)

def my_accuracy(y_true, y_pred):
    return K.mean(2 * K.abs(y_true - 0.5) * K.equal(y_true, K.round(y_pred)), axis=-1)

class WeightClip(Constraint):
    '''Clips the weights incident to each hidden unit to be inside a range
    '''

    def __init__(self, c=2.0):
        self.c = c

    def __call__(self, p):
        return K.clip(p, -self.c, self.c)

    def get_config(self):
        return {'name': self.__class__.__name__,
                'c': self.c}

def build_model():
    reg = 0.000001
    constraint = WeightClip(0.499)
    main_input = Input(shape=(None, 42), name='main_input')
    tmp = Dense(24, activation='tanh', name='input_dense', kernel_constraint=constraint, bias_constraint=constraint)(
        main_input)
    vad_gru = GRU(24, activation='tanh', recurrent_activation='sigmoid', return_sequences=True, name='vad_gru',
                  kernel_regularizer=regularizers.l2(reg), recurrent_regularizer=regularizers.l2(reg),
                  kernel_constraint=constraint, recurrent_constraint=constraint, bias_constraint=constraint)(tmp)
    vad_output = Dense(1, activation='sigmoid', name='vad_output', kernel_constraint=constraint,
                       bias_constraint=constraint)(vad_gru)
    noise_input = concatenate([tmp, vad_gru, main_input])
    noise_gru = GRU(48, activation='relu', recurrent_activation='sigmoid', return_sequences=True, name='noise_gru',
                    kernel_regularizer=regularizers.l2(reg), recurrent_regularizer=regularizers.l2(reg),
                    kernel_constraint=constraint, recurrent_constraint=constraint, bias_constraint=constraint)(noise_input)
    denoise_input = concatenate([vad_gru, noise_gru, main_input])

    denoise_gru = GRU(96, activation='tanh', recurrent_activation='sigmoid', return_sequences=True, name='denoise_gru',
                      kernel_regularizer=regularizers.l2(reg), recurrent_regularizer=regularizers.l2(reg),
                      kernel_constraint=constraint, recurrent_constraint=constraint, bias_constraint=constraint)(
        denoise_input)

    denoise_output = Dense(22, activation='sigmoid', name='denoise_output', kernel_constraint=constraint,
                           bias_constraint=constraint)(denoise_gru)

    model = Model(inputs=main_input, outputs=[denoise_output, vad_output])

    model.compile(loss=[mycost, my_crossentropy],
                  metrics=[msse],
                  optimizer='adam', loss_weights=[10, 0.5])
    return model

model = build_model()
dataset = load_dataset('example.tfrecord')

My dataset has now the following shape:
<MapDataset shapes: ((42,), ((22,), (1,))), types: (tf.float32, (tf.float32, tf.float32))>

which I thought is what Model API expects (spoiler: it doesn't).
model.fit(dataset.batch(10))

gives following error:
ValueError: Error when checking input: expected main_input to have 3 dimensions, but got array with shape (None, 42)

Makes sense, I don't have the window here. At the same time it seems like it's not getting correct shape expected by Model(inputs=main_input, outputs=[denoise_output, vad_output]).
How to modify load_dataset so that it matches what's expected by the Model API for the tf.data?

A: Given that your model has 1 input and 2 outputs, your tf.data.Dataset should have two entries:
1) Input array of shape (window, 42)
2) Tuple of two arrays each of shape (window, 22) and (window, 1)
EDIT: Updated answer - you already return two element tuple
I just noticed that your dataset has these two entries (similar to those described above) and the only thing that differs is the shape.
The only operations you need to perfom is to batch your data twice:
First - to restore the window parameter.
Second - to pass a batch to a model.
window_size = 1
batch_size = 10
dataset = load_dataset('example.tfrecord')
model.fit(dataset.batch(window_size).batch(batch_size)

And that should work.
Below is an old answer, where I wrongfully assumed your dataset shape:
Old Answer, where I assumed you are returning three element tuple:
Assuming that you are starting from three element tuple of shapes (42,), (22,) and (1,), this can be achieved in the same batching operations, enriched with a custom_reshape function to return two-element tuple:
window_size = 1
batch_size = 10
dataset = load_dataset('example.tfrecord')
dataset = dataset.batch(window_size).batch(batch_size)

# Change output format
def custom_reshape(x, y, vad):
    return x, (y, vad)

dataset = dataset.map(custom_reshape)

In short, given this dataset shape, you could just call:
model.fit(dataset.batch(window_size).batch(10).map(custom_reshape)
and it should work too.
Best of luck. And sorry again for the fuss.


text:
Q: What is the use of ibdata1 file in mysql I have application which has the backend db as Mysql(InnoDb engine), and currently  my client wants to decrease the size of the ibdata file to some fixed size. I found the three below solutions.
Solution 1:
 innodb_file_per_table
Solution 2:
innodb_data_file_path=ibdata1:50M;ibdata2:50M:autoextend
Solution 3:
innodb_data_file_path=ibdata1:10M:autoextend:max:50M
And I really dont have knowledge about the ibadata1 file, can anybody help me on this and I want to know whether is it safe to fix the ibdata size(solution 3) and what does the ibdata exactly for?

A: You really should take a thorough look at the documentation when dealing with a DBMS of this complexity.
http://dev.mysql.com/doc/refman/5.1/en/innodb-configuration.html states:

Two important disk-based resources managed by the InnoDB storage engine are its tablespace data files and its log files. If you specify no InnoDB configuration options, MySQL creates an auto-extending 10MB data file named ibdata1 and two 5MB log files named ib_logfile0 and ib_logfile1 in the MySQL data directory.

Basically, the ibdata1 file contains the table data of your InnoDB tables. Specifying more than a single file would make sense in cases where you are using a different storage subsystem to store the second file for performance reasons or if you ran out of space for ibdata1 on its original partition and would want to have a simple add-on storage with a different storage file. Fixing the file size obviously has the effect of limiting the total amount of data which can be stored in InnoDB tables.
The ibdata1 file is probably auto-growing in your case, so it will inflate as more data is put into InnoDB tables. After records are deleted from InnoDB tables, the file will contain pages marked as "free" which could be used for future data, but the file itself is unshrinkable. If you have deleted larger amounts of data and need to shrink ibdata1, the only supported way goes through backing up the tables using mysqldump and re-initializing your database - see this StackOverflow answer for details.


text:
Q: Ruby on Rails: Using a private repo (Yarn package) and deploying with Chef Server My rails app is deployed via Chef, and I'm having trouble cloning a private repo of a Yarn package into my project upon deployment. Linking to the private repo works just fine locally. The repo is hosted at my company's internal GitHub URL (github.mycompany.com). The app also uses a private repo for a gem, and that retrieval works just fine. The issue comes about when Chef tries to run rails:assets:precompile on the production server:
       Error executing action `run` on resource 'ruby_execute[rake assets:precompile]'
       ================================================================================

       Mixlib::ShellOut::ShellCommandFailed
       ------------------------------------
       Expected process to exit with [0], but received '1'
       ---- Begin output of ["/opt/ruby_build/builds/system/bin/ruby", "/opt/ruby_build/builds/system/bin/bundle", "exec", "/opt/ruby_build/builds/system/bin/ruby", "/var/www/app_name/releases/latest/vendor/bundle/ruby/2.5.0/bin/rake", "assets:precompile"] ----
       STDOUT: yarn install v1.21.1
       [1/4] Resolving packages...
       [2/4] Fetching packages...
       info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
       STDERR: error Command failed.
       Exit code: 128
       Command: git
       Arguments: ls-remote --tags --heads git@<repo_location>.git
       Directory: /var/www/app_name/releases/latest
       Output:
       Load key "/home/ubuntu/.ssh/id_rsa": Permission denied

       Permission denied (publickey).

       fatal: Could not read from remote repository.

       Please make sure you have the correct access rights
       and the repository exists.

This is my first time using Yarn. I have read some issues on the Yarn repo about cloning private repos, but I think this situation is a bit different. This setup also works fine for all our other Rails apps that don't use any private yarn repos.
1) Why would the permission be denied to my SSH key? It's created from a deploy_key in a data bag, and like I said before works just fine for installing a private gem repo (we have a Chef GitHub user, which is added as a collaborator on both the gem and yarn repos).
2) Is there a way to completely package this repo inside my project, precompile assets locally, then force our production server to serve the precompiled assets from the /public folder? This doesn't feel right to me but it might be an acceptable workaround for now.


text:
Q: Protecting Site media player and content I have a site that has grown enormously over the past couple years. The site is hitting around 10M+ visitors a month, with over 100 million monthly request. The primary focus of the site is streaming audio, and some video content.
Currently, I write a cookie when the player is launched, there is a 15 second count down page while my current specials are displayed. When the audio player loads it checks to insure the cookie exist, then loads the player and deletes the cookie. All of which was fine a 1 year or so ago, but now, when the player loads, I guess anyone could view the pages source which contains 2 frames, 1 for text content, and one for the audio player then simply embed that in their own site.
What would be the best way to protect the audio player page?  The page that loads the player is static and always the same, so would it be best practice to check if the players iframe was referred by that specific page / domain before loading? Can anyone see possible problems with this solution?
Sorry for the long request, just wanted to be detailed, so I could get a well informed answer.

A: Is the audio player frame a PHP page? You could add some code to check the referrer of the page. Just validate the $_SERVER['HTTP_REFERER'] variable against your domain.
http://php.net/manual/en/reserved.variables.server.php


text:
Q: Throw exception at class level In my class, I have a method that utilises the awt.Robot class, and I instantiate Robot() every time I run this method. I think this is slowing my processing down significantly though because in cases where the method is run 10000 times in a loop, I'm instantiating Robot() 10000 times instead of just once. If I can declare it as a global, that would solve my problems. I attempted:
Robot robot = new Robot();

Just under my class, but I need to throw the exception to use that line. Unfortuately I don't know how to do this without a try/catch block which I can't do outside of a method.
How can I get around this and initialize robot as a global?

A: You could put the instantiation in a static block
 static Robot robot;
 static {
    try {
       robot = new Robot();
    catch()
    {}
    }

A: Can you do this?
So long as you only have one of these classes, see singleton pattern. There will only be one Robot, making all calls to "yourRobotUsingMethod" use only one Robot.
By initializing your robot class in your class constructor, you can try/catch the initialization as the class is instatiated.
class YourClass {

    private Robot robot;

    public YourClass() {

        try {
            robot = new Robot();
        }
        catch(Exception e) {
            //Catch your exception here
        }
    }

    public void yourRobotUsingMethod() {
        //Use your robot here
        //You might want to check if robot is not null here too.
    }
}

I'm sorry if I've messed the keywords up, I've gotten used to C++'s block access levels. But you should get the idea


text:
Q: works on eclipe but not in local tomcat server Hello i've tried to upload a file, save it to disk and read it in eclipse works but not in tomcat local server in port 8080.
I get this error from cmd catalina.bat:
I put the war in webapps and run catalina.bat run is it correct?.............................................................................................................................................................
    @PostMapping("/post")
    @PreAuthorize("hasRole('ROLE_USER') or hasRole('ROLE_ADMIN')")
    public Hud uploadMultipartFile(@RequestParam("file") MultipartFile file) {
        File newfile = new File("C:/Ficheros/" + file.getOriginalFilename());
        try {
        file.transferTo(newfile);

            UserDetails userDetails = (UserDetails) SecurityContextHolder.getContext().getAuthentication()
                    .getPrincipal();
    String username = userDetails.getUsername();

            if (newfile.isFile()) {
                if(!file.getName().equals("winamax_positioning_file.dat")) {
                    BufferedReader reader = new BufferedReader(new FileReader(newfile.getAbsolutePath()));
                    String line =reader.readLine();
                    reader.close();

Hibernate: select asientosta0_.id_mano as id_mano1_0_, asientosta0_.nombre_mesa
as nombre_m2_0_, asientosta0_.p1_nombre as p3_0_, asientosta0_.p2_nombre as p4_0
_, asientosta0_.p3_nombre as p5_0_, asientosta0_.p4_nombre as p6_0_, asientosta0
_.p5_nombre as p7_0_, asientosta0_.p6_nombre as p8_0_ from asientos_stars asient
osta0_ where asientosta0_.id_mano=(select fechastars1_.id_mano from fechas_stars
 fechastars1_ where fechastars1_.fecha=(select max(fechastars2_.fecha) from fech
as_stars fechastars2_ where fechastars2_.username=?))
java.lang.NullPointerException
    at com.grokonez.jwtauthentication.controller.PokerRestAPIS.uploadMultipartFile(PokerRestAPIS.java:71)
    at com.grokonez.jwtauthentication.controller.PokerRestAPIS$$FastClassBySpringCGLIB$$3b704029.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:769)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:747)
    at org.springframework.security.access.intercept.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:69)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:747)
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:689)
    at com.grokonez.jwtauthentication.controller.PokerRestAPIS$$EnhancerBySpringCGLIB$$57da29c8.uploadMultipartFile(<generated>)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190)
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138)
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:106)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:888)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:793)
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:652)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:733)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:113)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:320)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:126)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:90)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:118)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:158)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at com.grokonez.jwtauthentication.security.jwt.JwtAuthTokenFilter.doFilterInternal(JwtAuthTokenFilter.java:51)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:116)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:92)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:92)
    at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:77)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:215)
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178)
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358)
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.boot.web.servlet.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:128)
    at org.springframework.boot.web.servlet.support.ErrorPageFilter.access$000(ErrorPageFilter.java:66)
    at org.springframework.boot.web.servlet.support.ErrorPageFilter$1.doFilterInternal(ErrorPageFilter.java:103)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
    at org.springframework.boot.web.servlet.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:121)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:201)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:544)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:698)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:364)
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:616)
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:831)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1629)
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:748)


text:
Q: How to show multiple views fetching data I need to display extra information on a specific entry when clicked, but retain on screen the other entries.
In these graphics, the gray represents "default" information about an entry, and red represents the "extended" information about an entry.
The "extended" information needs to fetch data before showing, so I can't use v-if or active class.
www.example.com/

www.example.com/1

www.example.com/3

I tried with multiple named views, but doesn't do what expected, and seems like they are not meant to do stuff like this.
These is my simple code right now. I'm not sure where to go from here. Is router-link` an option?
const Entry = {
    template: '
Entry ID {{ $route.params.id }}
'
};

const router = new VueRouter({
    routes: [
        {
            path: '/:id',
            component: Entry
        }
    ]
});

A: You can create a parent component Entries that will be responsible for listing Entry components, and pass props to Entry indicating if it should fetch data. With vue-cli it would llook like this:
Entries.vue
<template>
    <entry
        v-for="entry of entries"
        :fetchData="(entry.id === $route.params.id)"
        :entry="entry"
    ></entry>
</template>

Entry.vue
<template>

{{ entry }}

</template>

VueRouter should render Entries instead of Entry. If you wouldd like to fetch multiple Entry components, think about using $route.query instead of $route.params.id.


text:
Q: Phemex API - Query closed by symbol I have a question regarding the Phemex API, in particular when trying to retrieve my trade history (wanna built an automated journal of my performance). I feel like in some places the documentation is really poor and sometimes hard to understand as there is no real explanation of variables that are required to send the GET request to the API server.
Can someone explain to me what the Offset and limit is? Here is a link to the official documentation: https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#query-closed-orders-by-symbol.
When I sent a request with 0 for both values I get the following exception.

Phemex.phemexexception.exceptions.PhemexAPIException: HTTP(code=200),
API(errorcode=10002): OM_ORDER_NOT_FOUND


text:
Q: Swap image src? I want to swap an image, form_arrow_down.jpg to form_arrow_up.jpg, when I click on an element, like this:
$(".c756:eq(0)").click(function(){
    $("#wrapper_datorpaket").slideToggle("fast");
    $("/images/18.296a9c501318fd486d1800013126/form_arrow_down.jpg").attr("src","/images/18.296a9c501318fd486d1800013126/form_arrow_up.jpg");
});

But I'm not sure I have done right at the line where the images swap, because it's not working!?
Adding some of the markup:

Datorpaket

text

A: This does not work:
$("/images/18.296a9c501318fd486d1800013126/form_arrow_down.jpg")

Try:
$('img[src=/images/18.296a9c501318fd486d1800013126/form_arrow_down.jpg]')

A: Your code is not working since your selector is incorrect (pointing to an actual image):
$("/images/18.296a9c501318fd486d1800013126/form_arrow_down.jpg").attr("src","/images/18.296a9c501318fd486d1800013126/form_arrow_up.jpg");
You should reference the image element and change the attribute (As an example, if your element has the id: wrapper_datorpaket_image ) :
$("#wrapper_datorpaket_image").attr("src","/images/18.296a9c501318fd486d1800013126/form_arrow_up.jpg");
EDIT
This should work for you:
$('.c756 img').attr("src","/images/18.296a9c501318fd486d1800013126/form_arrow_up.jpg");

A: not sure about your code but much better way to achieve similar functionality is to use css to apply both images to your required element using different css class and then user jquery toggleClass to toggle between there two class when your click event occurs.