qid int64 1 74.7M | question stringlengths 15 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 4 30.2k | response_k stringlengths 11 36.5k |
|---|---|---|---|---|---|
56,288,788 | I am using vuejs to get the data from table as shown in the image below ["1848"],["1796"], etc... But the data is not in array. I need the data to be in array to pass it to the php as my query will be like this
```
"SELECT * FROM bp.writer WHERE WPNo IN (?)"
```
[]... | 2019/05/24 | [
"https://Stackoverflow.com/questions/56288788",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10965657/"
] | Try with this.
```
let tableEntry = this.tableEntry.getRows();
var array = [];
for (let i = 0; i < tableEntry.length; i++) {
var obj = [tableEntry[i]._row.data["WPNo"]];
//obj["WPNo"] = tableEntry[i]._row.data["WPNo"];
array.push(obj); //saves object into array
console.log(obj)
}
//console.log... | The question above is of very low quality, there is no tabledata nothing
The answer to your question **Tabulator get data from table but in array** <http://tabulator.info/docs/4.2/components#component-row>
```
var rowData = row.getData();
```
```js
const tabledata1 = [{
id: 1,
name: "Oli ",
money: "... |
54,641,330 | <https://codepen.io/zchee/pen/ogzvZZ>
The above codepen link contains an example of scroll animation that changes the behavior and look of the navigation as you scroll down, which is done with pure vanilla JavaScript. The problem is I do not get how this script works. I have a basic knowledge in JavaScript and so far ... | 2019/02/12 | [
"https://Stackoverflow.com/questions/54641330",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9320222/"
] | So if you have a look at the function, you can see that it is an [Immediately Invoked Function Expression (IIFE)](https://developer.mozilla.org/en-US/docs/Glossary/IIFE) which just means it a function that is executed as soon as it is encountered. When the function runs, it does the following:
```
var section = docume... | Since other people already gave you the explanation, I will just try to rewrite it to be somehow more readable?
```js
{
let sectionNodes = document.getElementsByClassName("section"),
sectionTopPositions = {}
for (let node of sectionNodes) {
sectionTopPositions[node.id] = node.offsetTop
}
func... |
47,485,338 | I have been trying to use external css on my React project. I am using webpack with babel. I have configured css, js and jsx loaders on my project. As a matter of fact my project is able to compiled successfully yet I couldn't able to style applied on my html.
Here is my style-header.css file:
```
.LogoMargin {
m... | 2017/11/25 | [
"https://Stackoverflow.com/questions/47485338",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6348960/"
] | Add style loader for handling css as well.
Because you didn't provide webpack version, I cannot provide any code, but I'm sure you will figure out how to use it.
<https://github.com/webpack-contrib/style-loader> | You should add "style-loader" for your webpack configuration. You can provide it in array as the following. Also, I have an example in this repo:
<https://github.com/burakhanalkan/simple-react-materialui-app-starter/blob/master/webpack.config.js>
```
{
test: /\.css$/,
use: [
"style-loader",
"cs... |
47,485,338 | I have been trying to use external css on my React project. I am using webpack with babel. I have configured css, js and jsx loaders on my project. As a matter of fact my project is able to compiled successfully yet I couldn't able to style applied on my html.
Here is my style-header.css file:
```
.LogoMargin {
m... | 2017/11/25 | [
"https://Stackoverflow.com/questions/47485338",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6348960/"
] | Add style loader for handling css as well.
Because you didn't provide webpack version, I cannot provide any code, but I'm sure you will figure out how to use it.
<https://github.com/webpack-contrib/style-loader> | Well I was able to solve this problem as proposed by answers to use [style-loader](https://github.com/webpack-contrib/style-loader) and also I made some changes to my webpack config file which are as follow:
```
test: /\.css$/,
exclude: /node_modules/,
use: [
{ loader: "style-loader" },
{ loader: "css-loader" ,
... |
55,575,956 | In my application I have a link for logout.
`html`
```
<a onclick="myFunction()">Logout</a>
```
`js`
```
function myFunction() {
document.location.href = 'https://url/oauth/logout?redirect=https://url';
}
```
The problem I am having is, when I click logout, I immediately redirects to the `url`. It seems like... | 2019/04/08 | [
"https://Stackoverflow.com/questions/55575956",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5873972/"
] | You could fetch the logout endpoint and then reload the page if it was successful like so:
```
const myFunction = async (event) => {
event.preventDefault()
const response = await fetch('https://url/oauth/logout');
if (response.ok) {
location.replace('new-url');
// or location.reload()
}
}
``` | Instead of doing a "client side" redirect, try a "server side" redirect in whatever language you are using.
```
<?php
Logout Logic here
header("Location: /login_url");
?>
``` |
10,389,727 | I have written a client and server application that I need to use to connect a checkers game I made in C#. I have got the client and server to connect and the server can repeatedly send the client messages to update a label but when the client tries to send a message it throws the error
"A request to send or receive ... | 2012/04/30 | [
"https://Stackoverflow.com/questions/10389727",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1351964/"
] | Why not use asynchronous sockets? Here is some code:
```
// Server socket
class ControllerSocket : Socket, IDisposable
{
// MessageQueue queues messages to be processed by the controller
public Queue<MessageBase> messageQueue = null;
// This is a list of all attached clients
public List<Socket> client... | You do realise your code will never exit from here:
```
public void sendMsg(string s)
{
bool x = true;
while (true)
{
Thread.Sleep(500);
if (x == true)
{
byte[] msgBuffer = Encoding.ASCII.GetBytes(s);
sck.Send(msgBuffer);
x = false;
}
... |
10,389,727 | I have written a client and server application that I need to use to connect a checkers game I made in C#. I have got the client and server to connect and the server can repeatedly send the client messages to update a label but when the client tries to send a message it throws the error
"A request to send or receive ... | 2012/04/30 | [
"https://Stackoverflow.com/questions/10389727",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1351964/"
] | Why not use asynchronous sockets? Here is some code:
```
// Server socket
class ControllerSocket : Socket, IDisposable
{
// MessageQueue queues messages to be processed by the controller
public Queue<MessageBase> messageQueue = null;
// This is a list of all attached clients
public List<Socket> client... | Figured out a solution to my problem probably isn't the standard way to do it but it works.
This is a simple chat application which can be used to connect player vs player games online sending moves back and forth.
SERVER-
```
using System;
using System.Net.Sockets;
using System.Text;
using System.Net;
using System.T... |
861,990 | I'm using [cluetip](http://plugins.learningjquery.com/cluetip/) for tooltips in my web site, and I want to set the tooltip text based on the link url.
For example: I have a link on my page to "http:abc.com/display?content=sweeties" and I want the tooltip to read "sweeties"
Someone show me how, please? | 2009/05/14 | [
"https://Stackoverflow.com/questions/861990",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/86053/"
] | You should set the title of your link to "sweeties" and then instruct whatever tooltiping plugin to use actually the title attribute for content.
I think it could work with cluetip out of the box. | ```
var a = $("aTagsId");
var content = a.attr('href').match(/content\=([^\&]*)/)[1];
a.attr('title', content);
... setup cluetip w/ title...
``` |
861,990 | I'm using [cluetip](http://plugins.learningjquery.com/cluetip/) for tooltips in my web site, and I want to set the tooltip text based on the link url.
For example: I have a link on my page to "http:abc.com/display?content=sweeties" and I want the tooltip to read "sweeties"
Someone show me how, please? | 2009/05/14 | [
"https://Stackoverflow.com/questions/861990",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/86053/"
] | You should set the title of your link to "sweeties" and then instruct whatever tooltiping plugin to use actually the title attribute for content.
I think it could work with cluetip out of the box. | One undocumented, nice, and staight forward way to do this is using a function as the first argument in cluetip call, that returns your desired content:
```
var normalcluetipsettings = {.. ... ... ... }
$('#mydiv').cluetip(function(){return 'hello'+' '+'world';}, normalcluetipsettings)
``` |
37,138,367 | I am working on a VB.NET project that uses multiple classes and writes error messages and logging messages to a file using System.IO FileWriter. I want to change this behavior and collect the error messages and logging messages in a single List(Of String) that I can send to another application. What I'm asking for here... | 2016/05/10 | [
"https://Stackoverflow.com/questions/37138367",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3937741/"
] | I think the break is causing to stop after the first iteration on the loop. Try to remove the break and retest. it should do the trick | Are you sure shopTelNos.length is more than 1? The for loop you have made loops through all the elements in the shopTelNoss array. If there is only one element in that array, it will only display the message once. |
37,138,367 | I am working on a VB.NET project that uses multiple classes and writes error messages and logging messages to a file using System.IO FileWriter. I want to change this behavior and collect the error messages and logging messages in a single List(Of String) that I can send to another application. What I'm asking for here... | 2016/05/10 | [
"https://Stackoverflow.com/questions/37138367",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3937741/"
] | I think the break is causing to stop after the first iteration on the loop. Try to remove the break and retest. it should do the trick | First, either debug or print and check the array and its length to confirm its contents:
```
Log.i("ShopTel", "Array :" +shopTelNos);
Log.i("ShopTel", "Array size :" +shopTelNos.length);
```
Second, put a delay in between the toasts. The toasts may be overlapping. |
3,527,531 | I am just starting out in XNA and have a question about rotation. When you multiply a vector by a rotation matrix in XNA, it goes counter-clockwise. This I understand.
However, let me give you an example of what I don't get. Let's say I load a random art asset into the pipeline. I then create some variable to incremen... | 2010/08/20 | [
"https://Stackoverflow.com/questions/3527531",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/389996/"
] | The XNA SpriteBatch works in **Client Space**. Where "up" is Y-, not Y+ (as in Cartesian space, projection space, and what most people usually select for their world space). This makes the rotation appear as clockwise (not counter-clockwise as it would in Cartesian space). The actual coordinates the rotation is produci... | Since you are new to XNA, allow me to introduce a library that will greatly help you out while you learn. It is called XNA Debug Terminal and is an open source project that allows you to run arbitrary code during runtime. So you can see if your variables have the value you expect. All this happens in a terminal display... |
751,399 | *What is the difference between [paramagnetism](https://en.wikipedia.org/wiki/Paramagnetism) and [ferromagnetism](https://en.wikipedia.org/wiki/Ferromagnetism)?*
Before answering, **I want to note my difference between the rest of the similar questions on this website:** from what I think I know, ferromagnetism are th... | 2023/02/22 | [
"https://physics.stackexchange.com/questions/751399",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/354557/"
] | >
> The gamma matrices $\gamma^\mu$ appearing in the Dirac equation span the Clifford algebra ${\cal Cl}\_{1,3}$ over **real** numbers. They are generators of Clifford algebra in that sense that their products: $\gamma^\mu\gamma^\nu,\; \gamma^\mu\gamma^\nu\gamma^\sigma$ and $\gamma^0\gamma^1\gamma^2\gamma^3$ make basi... | There is an approach to Dirac theory that gives the gamma matrices an explicitly *geometric* interpretation - namely *Geometric Algebra* or *Spacetime Algebra*.
The approach builds the Real Clifford Algebra from geometric entities - vectors representing oriented 1D lengths, bivectors representing oriented 2D areas, tr... |
7,322,186 | I'm trying to parse some XML using `simpleXML` in PHP.
The problem I'm having though, is that some nodes have values like `Milk & Cheese` and I'm getting a parse error.
What's the easiest way of parsing XML using simpleXML with chars such as & and / being present?
Thanks
EDIT:
I'm using:
```
$source = 'stockdat... | 2011/09/06 | [
"https://Stackoverflow.com/questions/7322186",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/390426/"
] | **quick solution:**
```
$xml = str_replace('&','&',$xml); //$xml is the content in string format
```
**a better solution:** [ if you control the xml ]
add CDATA in the xml tags
```
<name><![CDATA[ Milk & honey]]></script>
```
and you'll need to tell SimpleXml to take care of the CDATA:
```
$sxml = simple... | You need to use [XML (and HTML) entities](http://www.w3schools.com/html/html_entities.asp). Instead of `Milk & Cheese` use `Milk & Cheese`. You can find a complete list at [W3Schools](http://www.w3schools.com/tags/ref_entities.asp). |
55,474,643 | working on a problem in python turtle where i'm required to draw designs inside a square using turtle and placing many of these squares at required co-ordinates.
My current designs use the `goto(x,y)` function however obviously when calling them at different locations the design code is still being called at the origi... | 2019/04/02 | [
"https://Stackoverflow.com/questions/55474643",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11299513/"
] | If the turtle is at position vector (x, y), and you want to move it, say, 3 right and 5 up, you just add that to the coordinates, so the turtle needs to move to `(x + 3, y + 5)`. Luckily, [`turtle.Vec2D`](https://docs.python.org/3/library/turtle.html#turtle.Vec2D) supports addition like this, and you can use `goto` on ... | In addition to @Artyer's excellent answer (+1), don't forget about `forward()`, `backward()`, `left()`, `right()` which are all *relative* position operations as opposed to the *absolute* operations `goto()` and `setheading()`. Making use of the provided relative operations may require a rethink of your graphics.
In a... |
66,541,260 | Hi guys I'm really a beginner and need your help and advises.
So I was trying to create authentication in my Login form. The user role is in the same table with username and password but I don't have better idea to achieve authentication in my Winforms.
I want to do something like this
If user role id is == 1
then pr... | 2021/03/09 | [
"https://Stackoverflow.com/questions/66541260",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7392303/"
] | use sqlDataReader
```
SqlDataReader reader = sqlCommand.ExecuteReader();
if (reader.HasRows)
{
reader.Read();
if (Convert.ToInt16(reader["TypeofUser"])==1)
else if Convert.ToInt16(reader["TypeofUser"]==2)
return true;
}
else
{
return false;
}
``` | This might help you a bit
```
try{
string query ="SELECT USERNAME,PASSWORD,TYPE from ***** WHERE.....");
conn.Open();
MysqlCommand comm = new MysqlCommand(query,Myconnection);
MysqlDataReader read = comm.ExecuteReader();
if(read.HasRows){
while(read.Read())
{
string Type = read.GetString(2);//Get Value of Type
... |
40,473 | I ran into a fun interview question, yesterday. Can anyone help me?
>
> Suppose a binary tree with six nodes is given, such that each node has
> only a left child. With how many "right rotate" operations (without any left
> rotates), we can convert this tree to a tree in which each node has only
> a right child?
... | 2015/03/16 | [
"https://cs.stackexchange.com/questions/40473",
"https://cs.stackexchange.com",
"https://cs.stackexchange.com/users/29767/"
] | An efficient change of basis doesn't change the hardness of a problem. Consider some decision problem $Q\_1$, which consists of all objects $x$ of some type that satisfy some property. Now let $f$ be an efficient (polytime) transformation whose inverse $f^{-1}$ is also efficient, and consider the decision problem $Q\_2... | Could a problem we think is NP-hard actually be solvable in polytime? Sure. We could be wrong (we suspected/guessed it was NP-hard, but our suspicion/guess was wrong). Or, it could be NP-hard *and* solvable in polytime, if P = NP.
I think the root problem is that you're confusing "a NP-hard problem" with "a problem we... |
40,473 | I ran into a fun interview question, yesterday. Can anyone help me?
>
> Suppose a binary tree with six nodes is given, such that each node has
> only a left child. With how many "right rotate" operations (without any left
> rotates), we can convert this tree to a tree in which each node has only
> a right child?
... | 2015/03/16 | [
"https://cs.stackexchange.com/questions/40473",
"https://cs.stackexchange.com",
"https://cs.stackexchange.com/users/29767/"
] | >
> The only way they could propose to solve the problem (that I can think of) ... would seem to be exponentially hard."
>
>
>
That's your core fallacy, and "that I can think of" is the answer. The complexity of the problem did not change, but the transformation made finding an efficient algorithm easier (as a too... | An efficient change of basis doesn't change the hardness of a problem. Consider some decision problem $Q\_1$, which consists of all objects $x$ of some type that satisfy some property. Now let $f$ be an efficient (polytime) transformation whose inverse $f^{-1}$ is also efficient, and consider the decision problem $Q\_2... |
40,473 | I ran into a fun interview question, yesterday. Can anyone help me?
>
> Suppose a binary tree with six nodes is given, such that each node has
> only a left child. With how many "right rotate" operations (without any left
> rotates), we can convert this tree to a tree in which each node has only
> a right child?
... | 2015/03/16 | [
"https://cs.stackexchange.com/questions/40473",
"https://cs.stackexchange.com",
"https://cs.stackexchange.com/users/29767/"
] | >
> The only way they could propose to solve the problem (that I can think of) ... would seem to be exponentially hard."
>
>
>
That's your core fallacy, and "that I can think of" is the answer. The complexity of the problem did not change, but the transformation made finding an efficient algorithm easier (as a too... | Could a problem we think is NP-hard actually be solvable in polytime? Sure. We could be wrong (we suspected/guessed it was NP-hard, but our suspicion/guess was wrong). Or, it could be NP-hard *and* solvable in polytime, if P = NP.
I think the root problem is that you're confusing "a NP-hard problem" with "a problem we... |
15,246 | As a bit of a personal project im wanting to create a very lightweight desktop environment with something like fluxbox.
As a start point im wanting to use something like a lightweight version of ubuntu - Ubuntu but without the gui and only the most limited set o f applications, and then move from there. Is there anyw... | 2010/11/28 | [
"https://askubuntu.com/questions/15246",
"https://askubuntu.com",
"https://askubuntu.com/users/2978/"
] | Ubuntu Minimal CD here: <https://help.ubuntu.com/community/Installation/MinimalCD>
See: <http://www.psychocats.net/ubuntu/minimal> (icewm)
and: <http://wiki.dennyhalim.com/ubuntu-minimal-desktop> (fluxbox) (his one line "quickstart" is good)
Ubuntu Repositories in Debian will create problems, if they will load at all... | How about [Ubuntu Server](http://www.ubuntu.com/server)? No desktop environment. There's no real difference desktop and server Ubuntu other than the default packages. The "server" packages (apache, bind etc) are optional installs in server.
If instead of Fluxbox you could go with XFCE, there's [Xubuntu](http://www.xub... |
15,246 | As a bit of a personal project im wanting to create a very lightweight desktop environment with something like fluxbox.
As a start point im wanting to use something like a lightweight version of ubuntu - Ubuntu but without the gui and only the most limited set o f applications, and then move from there. Is there anyw... | 2010/11/28 | [
"https://askubuntu.com/questions/15246",
"https://askubuntu.com",
"https://askubuntu.com/users/2978/"
] | How about [Ubuntu Server](http://www.ubuntu.com/server)? No desktop environment. There's no real difference desktop and server Ubuntu other than the default packages. The "server" packages (apache, bind etc) are optional installs in server.
If instead of Fluxbox you could go with XFCE, there's [Xubuntu](http://www.xub... | There is also Ubuntu Core for those looking for an extremely minimal Ubuntu environment, even smaller than Ubuntu Minimal. This is intended for embedded devices such as in-vehicle infotainment systems, television set-top boxes, etc. It is a very minimal kernel and userspace intended for use as a development platform. I... |
15,246 | As a bit of a personal project im wanting to create a very lightweight desktop environment with something like fluxbox.
As a start point im wanting to use something like a lightweight version of ubuntu - Ubuntu but without the gui and only the most limited set o f applications, and then move from there. Is there anyw... | 2010/11/28 | [
"https://askubuntu.com/questions/15246",
"https://askubuntu.com",
"https://askubuntu.com/users/2978/"
] | Ubuntu Minimal CD here: <https://help.ubuntu.com/community/Installation/MinimalCD>
See: <http://www.psychocats.net/ubuntu/minimal> (icewm)
and: <http://wiki.dennyhalim.com/ubuntu-minimal-desktop> (fluxbox) (his one line "quickstart" is good)
Ubuntu Repositories in Debian will create problems, if they will load at all... | There is also Ubuntu Core for those looking for an extremely minimal Ubuntu environment, even smaller than Ubuntu Minimal. This is intended for embedded devices such as in-vehicle infotainment systems, television set-top boxes, etc. It is a very minimal kernel and userspace intended for use as a development platform. I... |
50,081,649 | I am trying to make a function create a new player (`registerNewPlayer`) from a registration form. The problem I am running into is that once the player object is created, I cannot access the player information to change variables such as the player name or the gold value of the player. How do I access objects in a cla... | 2018/04/28 | [
"https://Stackoverflow.com/questions/50081649",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9614179/"
] | The fix was to place the returned object into an array of players in the init {} statement of the Players class. This allows the players to be identified by the index number of the array. | You need to assign the new player to a variable so you can access it later.
```
var playerOne = registerNewPlayer(playerName: "Bob", password: "abc")
print(playerOne.name) // Prints "Bob"
``` |
41,201,893 | Is it possible to run single [Jasmine](https://jasmine.github.io/) test `it` or suite `describe` in IntelliJ from popup menu as it possible with JUnit or TestNG fremeworks?
Now I can only execute tests by running `karma.conf.js` that will grab all specs and run them which is not exactly what I want.
Updates
-------
... | 2016/12/17 | [
"https://Stackoverflow.com/questions/41201893",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2650174/"
] | You don't need Intellij's help if you are trying to run a single unit test or a single test suite while using [Jasmine](https://jasmine.github.io). You can do that with their feature of `fit()` and `fdescribe()`. Here, prepending `it(...)` and `describe(...)` with `f` says those are **focused** tests/test suites.
Quo... | You could follow this issue in YouTrack - <https://youtrack.jetbrains.com/issue/WEB-13173>.
We have supported `--grep`[1] option for jasmine in karma already.
But there are some open discussions about problems in large projects[2]
[1] - <https://github.com/karma-runner/karma-jasmine/pull/56>
[2] - <https://github.c... |
41,201,893 | Is it possible to run single [Jasmine](https://jasmine.github.io/) test `it` or suite `describe` in IntelliJ from popup menu as it possible with JUnit or TestNG fremeworks?
Now I can only execute tests by running `karma.conf.js` that will grab all specs and run them which is not exactly what I want.
Updates
-------
... | 2016/12/17 | [
"https://Stackoverflow.com/questions/41201893",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2650174/"
] | You don't need Intellij's help if you are trying to run a single unit test or a single test suite while using [Jasmine](https://jasmine.github.io). You can do that with their feature of `fit()` and `fdescribe()`. Here, prepending `it(...)` and `describe(...)` with `f` says those are **focused** tests/test suites.
Quo... | With WebStorm 2017.1 it's possible to use RunConfiguration producer to run a single Karma test: <https://github.com/develar/ij-rc-producer> |
6,939,570 | I can't start Glassfish 3.1 on Eclipse Indigo with "Oracle Glassfish Server Tools" plugin on Windows 7. After installing the plugin, I've chosen "New" -> "Server" in the server view and clicked on GlassFish 3.1 and downloaded the installation through Eclipse.
Every time I try to start it, I've the following message:
... | 2011/08/04 | [
"https://Stackoverflow.com/questions/6939570",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/445543/"
] | I want to improve the answer from Andreas.
**Yes, This is important to check your port:**
```
netstat -a -n -o | find "8080"
```
If you are using Windows 7 make sure your proxy host is not active. Please check your host list file and open using notepad then restart your PC after comment all unnecessary host. [Here]... | Ensure that you have JDK set as JRE in your eclipse.
On Windows set it to
```
window>preferences>java>installed jres
```
On Mac set it to
```
eclipse>preferences>java>installed jres
```
These should point to the JDK location. |
6,939,570 | I can't start Glassfish 3.1 on Eclipse Indigo with "Oracle Glassfish Server Tools" plugin on Windows 7. After installing the plugin, I've chosen "New" -> "Server" in the server view and clicked on GlassFish 3.1 and downloaded the installation through Eclipse.
Every time I try to start it, I've the following message:
... | 2011/08/04 | [
"https://Stackoverflow.com/questions/6939570",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/445543/"
] | I got the "The Eclipse plugin cannot communicate with the GlassFish server, status is :CREDENTIAL\_ERROR" error too.
For me it was a Firewall problem. -- For some reason the Firewall (configured by the IT) blocks eclipse to communicate with Glassfish on port 4848, by default used as "Admin Server Port".
But port 8080... | Ensure that you have JDK set as JRE in your eclipse.
On Windows set it to
```
window>preferences>java>installed jres
```
On Mac set it to
```
eclipse>preferences>java>installed jres
```
These should point to the JDK location. |
6,939,570 | I can't start Glassfish 3.1 on Eclipse Indigo with "Oracle Glassfish Server Tools" plugin on Windows 7. After installing the plugin, I've chosen "New" -> "Server" in the server view and clicked on GlassFish 3.1 and downloaded the installation through Eclipse.
Every time I try to start it, I've the following message:
... | 2011/08/04 | [
"https://Stackoverflow.com/questions/6939570",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/445543/"
] | The reason your port swapping probably worked, is because when 8080 was the http listener it was likely that your anti-virus was scanning the port for http traffic, which causes the Credential Error.
I removed the 8080 entry from my AV settings under web scanning and the server started up fine. Only took my a week and ... | I got the "The Eclipse plugin cannot communicate with the GlassFish server, status is :CREDENTIAL\_ERROR" error too.
For me it was a Firewall problem. -- For some reason the Firewall (configured by the IT) blocks eclipse to communicate with Glassfish on port 4848, by default used as "Admin Server Port".
But port 8080... |
6,939,570 | I can't start Glassfish 3.1 on Eclipse Indigo with "Oracle Glassfish Server Tools" plugin on Windows 7. After installing the plugin, I've chosen "New" -> "Server" in the server view and clicked on GlassFish 3.1 and downloaded the installation through Eclipse.
Every time I try to start it, I've the following message:
... | 2011/08/04 | [
"https://Stackoverflow.com/questions/6939570",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/445543/"
] | I got the "**The Eclipse plugin cannot communicate with the GlassFish server,
status is :CREDENTIAL\_ERROR**" error too.
I found a **solution** to my problem by ensuring that no other process was listening at port 8080.
To find processes that listens to port 8080, bring up a command prompt and type in the followin... | The issue with another process occupying the port 80, check for other webservers or app servers running on that port, stop them and re-try |
6,939,570 | I can't start Glassfish 3.1 on Eclipse Indigo with "Oracle Glassfish Server Tools" plugin on Windows 7. After installing the plugin, I've chosen "New" -> "Server" in the server view and clicked on GlassFish 3.1 and downloaded the installation through Eclipse.
Every time I try to start it, I've the following message:
... | 2011/08/04 | [
"https://Stackoverflow.com/questions/6939570",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/445543/"
] | On Mac OS 10.6 I had many of the same problems described above:
1. First I had the CREDENTIAL\_ERROR.
2. I tried creating a new server, as suggested in answer 2. However, I accidentally added the wrong password (it should be left blank), and started getting "wrong user name or password" messages. I was not able to cha... | Try this : kill java process from task manager if it not show java process then restart your pc >> it work for me |
6,939,570 | I can't start Glassfish 3.1 on Eclipse Indigo with "Oracle Glassfish Server Tools" plugin on Windows 7. After installing the plugin, I've chosen "New" -> "Server" in the server view and clicked on GlassFish 3.1 and downloaded the installation through Eclipse.
Every time I try to start it, I've the following message:
... | 2011/08/04 | [
"https://Stackoverflow.com/questions/6939570",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/445543/"
] | The reason your port swapping probably worked, is because when 8080 was the http listener it was likely that your anti-virus was scanning the port for http traffic, which causes the Credential Error.
I removed the 8080 entry from my AV settings under web scanning and the server started up fine. Only took my a week and ... | The issue with another process occupying the port 80, check for other webservers or app servers running on that port, stop them and re-try |
6,939,570 | I can't start Glassfish 3.1 on Eclipse Indigo with "Oracle Glassfish Server Tools" plugin on Windows 7. After installing the plugin, I've chosen "New" -> "Server" in the server view and clicked on GlassFish 3.1 and downloaded the installation through Eclipse.
Every time I try to start it, I've the following message:
... | 2011/08/04 | [
"https://Stackoverflow.com/questions/6939570",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/445543/"
] | On Mac OS 10.6 I had many of the same problems described above:
1. First I had the CREDENTIAL\_ERROR.
2. I tried creating a new server, as suggested in answer 2. However, I accidentally added the wrong password (it should be left blank), and started getting "wrong user name or password" messages. I was not able to cha... | Ensure that you have JDK set as JRE in your eclipse.
On Windows set it to
```
window>preferences>java>installed jres
```
On Mac set it to
```
eclipse>preferences>java>installed jres
```
These should point to the JDK location. |
6,939,570 | I can't start Glassfish 3.1 on Eclipse Indigo with "Oracle Glassfish Server Tools" plugin on Windows 7. After installing the plugin, I've chosen "New" -> "Server" in the server view and clicked on GlassFish 3.1 and downloaded the installation through Eclipse.
Every time I try to start it, I've the following message:
... | 2011/08/04 | [
"https://Stackoverflow.com/questions/6939570",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/445543/"
] | I got the "**The Eclipse plugin cannot communicate with the GlassFish server,
status is :CREDENTIAL\_ERROR**" error too.
I found a **solution** to my problem by ensuring that no other process was listening at port 8080.
To find processes that listens to port 8080, bring up a command prompt and type in the followin... | The reason your port swapping probably worked, is because when 8080 was the http listener it was likely that your anti-virus was scanning the port for http traffic, which causes the Credential Error.
I removed the 8080 entry from my AV settings under web scanning and the server started up fine. Only took my a week and ... |
6,939,570 | I can't start Glassfish 3.1 on Eclipse Indigo with "Oracle Glassfish Server Tools" plugin on Windows 7. After installing the plugin, I've chosen "New" -> "Server" in the server view and clicked on GlassFish 3.1 and downloaded the installation through Eclipse.
Every time I try to start it, I've the following message:
... | 2011/08/04 | [
"https://Stackoverflow.com/questions/6939570",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/445543/"
] | After disabling ZoneAlarm firewall I could successfully start GlassFish on Windows. However, I then started to have many kind of unrelated and annoying problems and as Mico suggested, I switched back using Linux, which is my usual development platform, and everything went fine.
To document the process:
1. with Eclips... | Ensure that you have JDK set as JRE in your eclipse.
On Windows set it to
```
window>preferences>java>installed jres
```
On Mac set it to
```
eclipse>preferences>java>installed jres
```
These should point to the JDK location. |
6,939,570 | I can't start Glassfish 3.1 on Eclipse Indigo with "Oracle Glassfish Server Tools" plugin on Windows 7. After installing the plugin, I've chosen "New" -> "Server" in the server view and clicked on GlassFish 3.1 and downloaded the installation through Eclipse.
Every time I try to start it, I've the following message:
... | 2011/08/04 | [
"https://Stackoverflow.com/questions/6939570",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/445543/"
] | The reason your port swapping probably worked, is because when 8080 was the http listener it was likely that your anti-virus was scanning the port for http traffic, which causes the Credential Error.
I removed the 8080 entry from my AV settings under web scanning and the server started up fine. Only took my a week and ... | Try this : kill java process from task manager if it not show java process then restart your pc >> it work for me |
65,715 | A lot of websites these days (including this one) offer Facebook, Twitter, and/or Google login. Usually there's also an option to use old-style username/password credentials. I'm never sure which option to select. I use my real name on Facebook and Twitter. On some sites, I'd rather be anonymous.
Not so much Stack Exc... | 2014/07/24 | [
"https://webapps.stackexchange.com/questions/65715",
"https://webapps.stackexchange.com",
"https://webapps.stackexchange.com/users/7603/"
] | I am a developer for Cognito Forms. The form can currently only be submitted to one User/Organization name. In the future we do plan to add the ability to send notifications to specific users and email addresses. You can follow the specific progress for this on our [Idea Board](https://trello.com/c/yC2e4U5M).
One wor... | You can now create multiple email notifications and confirmations in [Cognito Forms](https://www.cognitoforms.com) and send them conditionally based on data on the form. This would allow you to send notifications to different people based on form selections or even multiple different emails for a single submission.
Y... |
2,966,428 | Show whether the function f is odd , even or other wise
Where $$f(x) = 2 , x\in ]0,\infty[ , f(x) =- 2 , x\in ]-\infty , 0]$$
I think that the function is odd because it is symmetric around the origin point , for the value 0 in the domain since -0=0 , f(0) and f(-0) can not be the additive inverse to each other ? Does... | 2018/10/22 | [
"https://math.stackexchange.com/questions/2966428",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/451403/"
] | For an odd function, $f(0)=-f(0)$ so that $f(0)=0$ is mandated.
---
Note that the even part of this function is
$$\frac{f(x)+f(-x)}2=\begin{cases}x=0\to-2,\\x\ne 0\to0\end{cases}$$
and the odd part
$$\frac{f(x)-f(-x)}2=\begin{cases}x<0\to-2,\\x=0\to0,\\x>0\to2.\end{cases}$$ | It is not odd due to the reason that $f(0) \neq - f(0)$ (By definition of an odd function $f(-x) = -f(x) $ is satisfied in every $x$ and $-x$ in the domain) . It is obviously not even either. |
71,877,440 | I was working on this algorithm to make a magic matrix (of uneven size) but i'm stuck here:
```
let constr mat =
let n = Array.length mat in
let b = ref (n-1)
and c = ref (n/2) in
for i = 1 to (n*n) do
if mat.(!b).(!c) <> 0 then b:= ((!b-1) mod n)
else b:= ((!b+1) mod n) ; c:= ((!c+... | 2022/04/14 | [
"https://Stackoverflow.com/questions/71877440",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18806866/"
] | A simple way to check if a string is int or float:
```py
def is_int(s):
try:
int(s)
return True
except ValueError:
return False
```
Then:
```py
>>> is_int('-73')
True
>>> is_int('2.3')
False
```
But note, the above `is_int()` only checks for `int`. If not, it is not necessarily a ... | The *str* module offers the `isdigit` function, returning `True` if a string represents a digit.
```
str.isdigit("5")
# True
str.isdigit("five")
# False
```
For `float` type, you could write a short function using `try-except`:
```
def check_float(string):
try:
float(string)
return True
exce... |
71,877,440 | I was working on this algorithm to make a magic matrix (of uneven size) but i'm stuck here:
```
let constr mat =
let n = Array.length mat in
let b = ref (n-1)
and c = ref (n/2) in
for i = 1 to (n*n) do
if mat.(!b).(!c) <> 0 then b:= ((!b-1) mod n)
else b:= ((!b+1) mod n) ; c:= ((!c+... | 2022/04/14 | [
"https://Stackoverflow.com/questions/71877440",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18806866/"
] | A simple way to check if a string is int or float:
```py
def is_int(s):
try:
int(s)
return True
except ValueError:
return False
```
Then:
```py
>>> is_int('-73')
True
>>> is_int('2.3')
False
```
But note, the above `is_int()` only checks for `int`. If not, it is not necessarily a ... | ```
strs = ["x", "45", "5.4", "-33", "size33", "34RR", "if"]
from re import match
strs = ["18","18.5","s","-35"]
for s in strs:
if match("^-{0,1}[0-9^]*(\.[0-9]+){0,1}$",s):
if s[0] == "-":
s = s[1:]
if s.isdigit():
print("int")
else:
print("float")
el... |
71,877,440 | I was working on this algorithm to make a magic matrix (of uneven size) but i'm stuck here:
```
let constr mat =
let n = Array.length mat in
let b = ref (n-1)
and c = ref (n/2) in
for i = 1 to (n*n) do
if mat.(!b).(!c) <> 0 then b:= ((!b-1) mod n)
else b:= ((!b+1) mod n) ; c:= ((!c+... | 2022/04/14 | [
"https://Stackoverflow.com/questions/71877440",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18806866/"
] | A simple way to check if a string is int or float:
```py
def is_int(s):
try:
int(s)
return True
except ValueError:
return False
```
Then:
```py
>>> is_int('-73')
True
>>> is_int('2.3')
False
```
But note, the above `is_int()` only checks for `int`. If not, it is not necessarily a ... | I think this does what you want, without using regexes. Notice that this handles negative numbers, which yours did not. I've removed the called to `error(i)`, since it was pointless.
```
def read():
return open('lex.txt','r').read().split()
op=['+','-','/','*','==','!=','<','>','>=','<=']
def operator(i):
if ... |
23,791,339 | When a dynamic button is clicked, I want to go to the action in the controller.
```
$(".myButton").click(function () {
var var1 = "test1"
var var2 = "test2"
var var3 = "test3";
location.href = '<%= Url.Action("Action","Controller") %>';
});
```
This is fine, but if I try and add the variables to th... | 2014/05/21 | [
"https://Stackoverflow.com/questions/23791339",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3493459/"
] | You are confusing the scopes. There is no way to pass a `client-side` javascript variable to the `server-side` execution, so you could generate a url concatening the values, for sample:
```
var var1 = "test1"
var var2 = "test2"
var var3 = "test3";
location.href = '<%= Url.Action("Action", "Controller") %>?var1=' + va... | You can use a placeholder value while generating URL then use `.replace()`
Assumig your controller as
```
public ActionResult Action(string p1, string p2, string p3)
{
}
```
*JavaScript*
```
var var1 = "test1"
var var2 = "test2"
var var3 = "test3";
var url = '<%= Url.Action("Action","Controller", new { p1 = -1, p... |
73,117,013 | I want to do a query on a MySQL database to get data from a column based on some characters from that column. For example in the name column, there are many names, I want to get data with names starting with 'AN' or 'AB'. Hope someone can help me. Thank you | 2022/07/26 | [
"https://Stackoverflow.com/questions/73117013",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19404443/"
] | You don't need to keep track of the order of the characters in the input string. You need to keep track of the index of the unique characters and return the smallest positive index.
```
class Solution:
def firstUniqChar(self, s: str) -> int:
seen = {}
for i, c in enumerate(s):
if seen.g... | The fact that you see a "weird 'u'" added before each string tells you that the grading system uses Python 2, where Unicode strings have to be prefixed as such. Knowing this, you cannot rely on dicts retaining insertion order since this behavior was not officially supported until Python 3.7. Instead, use `collections.O... |
73,117,013 | I want to do a query on a MySQL database to get data from a column based on some characters from that column. For example in the name column, there are many names, I want to get data with names starting with 'AN' or 'AB'. Hope someone can help me. Thank you | 2022/07/26 | [
"https://Stackoverflow.com/questions/73117013",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19404443/"
] | Since set() solution has been presented (which should be better in a *long long s*tring), here is alternative way to solve this one - just plain *str.index:* (since is a given string, performance should not be real concern).
```py
def firstUniqChar(self, s: str) -> int:
letters = set('abcdefghijklmnopqrstuvwxyz'... | The fact that you see a "weird 'u'" added before each string tells you that the grading system uses Python 2, where Unicode strings have to be prefixed as such. Knowing this, you cannot rely on dicts retaining insertion order since this behavior was not officially supported until Python 3.7. Instead, use `collections.O... |
73,117,013 | I want to do a query on a MySQL database to get data from a column based on some characters from that column. For example in the name column, there are many names, I want to get data with names starting with 'AN' or 'AB'. Hope someone can help me. Thank you | 2022/07/26 | [
"https://Stackoverflow.com/questions/73117013",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19404443/"
] | Since set() solution has been presented (which should be better in a *long long s*tring), here is alternative way to solve this one - just plain *str.index:* (since is a given string, performance should not be real concern).
```py
def firstUniqChar(self, s: str) -> int:
letters = set('abcdefghijklmnopqrstuvwxyz'... | You don't need to keep track of the order of the characters in the input string. You need to keep track of the index of the unique characters and return the smallest positive index.
```
class Solution:
def firstUniqChar(self, s: str) -> int:
seen = {}
for i, c in enumerate(s):
if seen.g... |
7,875,144 | I have some pages that i acces by jquery $.post like this:
```
$.post(url, {name: name}, function(data)
{
var htmldata = $(data);
if($('#ok', htmldata).val() == "1")
{
//some things carried out
}
});
```
`$('#ok', htmldata).val()` is allways `undefined` so where is the problem?
**UPDATE:** `... | 2011/10/24 | [
"https://Stackoverflow.com/questions/7875144",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/499220/"
] | Actually no need to use `$` in the following line:
```
var htmldata = $(data);
```
Use directly `var htmldata = data;` and try to check whether any ata is there in htmldata.If yes then proceed further. | Because data in htmldata is not initialized in DOM, if you want that work inject this into DOM in hidden div for example.
But better approach is return JSON from AJAX and then check for status is very easy.
Of Course you can always parse using regex :)
Example of first case (not tested) - put this into callback fun... |
7,875,144 | I have some pages that i acces by jquery $.post like this:
```
$.post(url, {name: name}, function(data)
{
var htmldata = $(data);
if($('#ok', htmldata).val() == "1")
{
//some things carried out
}
});
```
`$('#ok', htmldata).val()` is allways `undefined` so where is the problem?
**UPDATE:** `... | 2011/10/24 | [
"https://Stackoverflow.com/questions/7875144",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/499220/"
] | `$('#ok', htmldata)` will look for all **descendants** of `htmldata` that have the id of `ok`.
You need to change `$('#ok', htmldata)` to `htmldata.filter('#ok')` | Because data in htmldata is not initialized in DOM, if you want that work inject this into DOM in hidden div for example.
But better approach is return JSON from AJAX and then check for status is very easy.
Of Course you can always parse using regex :)
Example of first case (not tested) - put this into callback fun... |
7,875,144 | I have some pages that i acces by jquery $.post like this:
```
$.post(url, {name: name}, function(data)
{
var htmldata = $(data);
if($('#ok', htmldata).val() == "1")
{
//some things carried out
}
});
```
`$('#ok', htmldata).val()` is allways `undefined` so where is the problem?
**UPDATE:** `... | 2011/10/24 | [
"https://Stackoverflow.com/questions/7875144",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/499220/"
] | `$('#ok', htmldata)` will look for all **descendants** of `htmldata` that have the id of `ok`.
You need to change `$('#ok', htmldata)` to `htmldata.filter('#ok')` | Actually no need to use `$` in the following line:
```
var htmldata = $(data);
```
Use directly `var htmldata = data;` and try to check whether any ata is there in htmldata.If yes then proceed further. |
7,875,144 | I have some pages that i acces by jquery $.post like this:
```
$.post(url, {name: name}, function(data)
{
var htmldata = $(data);
if($('#ok', htmldata).val() == "1")
{
//some things carried out
}
});
```
`$('#ok', htmldata).val()` is allways `undefined` so where is the problem?
**UPDATE:** `... | 2011/10/24 | [
"https://Stackoverflow.com/questions/7875144",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/499220/"
] | Actually no need to use `$` in the following line:
```
var htmldata = $(data);
```
Use directly `var htmldata = data;` and try to check whether any ata is there in htmldata.If yes then proceed further. | You can use [`find()`](http://api.jquery.com/find/):
```
$.post(url, {name: name}, function(data)
{
var htmldata = $(data);
if(htmldata.find('#ok').val() == "1")
{
//some things carried out
}
});
``` |
7,875,144 | I have some pages that i acces by jquery $.post like this:
```
$.post(url, {name: name}, function(data)
{
var htmldata = $(data);
if($('#ok', htmldata).val() == "1")
{
//some things carried out
}
});
```
`$('#ok', htmldata).val()` is allways `undefined` so where is the problem?
**UPDATE:** `... | 2011/10/24 | [
"https://Stackoverflow.com/questions/7875144",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/499220/"
] | `$('#ok', htmldata)` will look for all **descendants** of `htmldata` that have the id of `ok`.
You need to change `$('#ok', htmldata)` to `htmldata.filter('#ok')` | You can use [`find()`](http://api.jquery.com/find/):
```
$.post(url, {name: name}, function(data)
{
var htmldata = $(data);
if(htmldata.find('#ok').val() == "1")
{
//some things carried out
}
});
``` |
22,529,453 | My sql squery seems not be not working, any idea why?
```
SELECT
PH,
Chlorine,
Temperature,
Date,
Time
FROM googlechart
Where Date BETWEEN '2014-03-19' AND '2014-03-21' order by Date, Time;
``` | 2014/03/20 | [
"https://Stackoverflow.com/questions/22529453",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3270211/"
] | Try this one:
```
SELECT
PH,
Chlorine,
Temperature,
Date,
Time
FROM googlechart
WHERE Date BETWEEN '2014-03-19' AND '2014-03-21'
ORDER BY Date, Time;
```
You have missed the WHERE. | Try like this
```
SELECT
PH,
Chlorine,
Temperature,
Date,
Time
FROM googlechart
Where Date BETWEEN cast('2014-03-19' as datetime)
AND cast('2014-03-21' as datetime) order by Date, Time;
``` |
3,939,553 | i am using the jQueryUI Position Utilities, but i don't know why it not run on $(document).ready(),
if i use firebug and execute the position(); again manually, it work fine.
**Update: I try that code only not work on IE8, it work on firefox and chrome.**
The code on :
<http://jsbin.com/owoya3/edit>
```
<!DOCTYPE ht... | 2010/10/15 | [
"https://Stackoverflow.com/questions/3939553",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/83952/"
] | Compilers can have a number of different outputs:
1. Machine code that runs directly on the computer
2. Intermediate code that is translated to machine code on the fly, and
3. Source code for an assembler
The advantage of option 2 is that it allows the output to be portable to different computers, as long as you have... | A compiler is any program that transforms a program from one representation into another representation. That target representation can be *anything*, provided that it is at least as computationally powerful as the source representation. In particular, this means that if the source representation is Turing-complete, th... |
40,314,944 | I am having an issue with a Null Pointer Exception, but I can't figure out what the issue is.
Here is my code in a doPost:
```
HttpSession session = request.getSession();
session.setAttribute("product", product);
url = "/login.jsp";
// create product list and store it in the session
String path = getServletContext()... | 2016/10/29 | [
"https://Stackoverflow.com/questions/40314944",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3462378/"
] | ```
s.replaceAll("(cast\\(\\.\\* as varchar\\))","#$1#");
```
Will do the trick.
You were getting the wrong output because the parenthesis around "**.\* as varchar**" weren't being scaped so the $1 was replacing what was inside them. | `()` have special meening, you need to escape:
```
s.replaceAll("(cast\\(.* as varchar\\))","#$1#");
``` |
61,581,576 | I'm using a simple stateless function as a react component with a react hook state.
Also I would like to keep every function in a separated place to make testing easier and to make the code more readable if the function gets a bit bigger.
So in this example the `handleChange` function should do a bit more then just se... | 2020/05/03 | [
"https://Stackoverflow.com/questions/61581576",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3142695/"
] | You can use currying for this
```
export const handleChange = setState => event => {
setState('new');
}
```
and in the component
```
export default function Message = (props) => {
const [message, setMessage] = useState('');
const reactOnChange = useCallback(handleChange(setMessage),[]);
return (
<input
... | I can see and agree that separating your logic from your component can be beneficial for testing (though sometimes testing the component itself is also valuable so this is not a hard rule by any means).
In your case, I think you're trying to draw the line a little to far away from React. What I would suggest is to sti... |
18,223,247 | I'm currently making an android app that makes POST requests to a tomcat server which makes a session for the user, though the sessions seem to not be working. I'm getting a new session with each request. Is there any way to keep this session or track the user another way? The code for querying the server is generally ... | 2013/08/14 | [
"https://Stackoverflow.com/questions/18223247",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1157136/"
] | You keep recreating your HttpClient; unless you have your own cookie store implementation that will keep cookies across instantiations or otherwise restores them, they'll keep going away.
<http://hc.apache.org/httpcomponents-client-ga/tutorial/html/statemgmt.html> | I believe tomcat uses a `JSESSIONID` to maintain sessions. This is stored as a cookie. In order to keep that same session alive, you'll need to send the cookies along with your next `HttpRequest`. |
12,402,360 | I cannot find the strings "Choose file" and "No file selected" in an upload input form widget, so I can translate them. Where are they located? Or are they embedded into php and not in symfony2 ? | 2012/09/13 | [
"https://Stackoverflow.com/questions/12402360",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1576116/"
] | These text is defined by the browser and not by PHP or Symfony. You will also notice that this widget will be displayed differently in different browsers and on different operating systems. There is no possibility to change the text displayed in this widget. There is also no possibility to change the design of the widg... | As @Florian says, these texts are output by the browser and you cannot change or style them. You may use a javascript uploader, but this may be overkill for most cases. But there is a "hack" that you can use to overlay your own styled file upload input on top of the standard file upload, it is explained [here](http://w... |
318,768 | I was asking in the other group about the translation of this Spanish sentence:
>
> ¡Ojo, te vas a perder otra vez!
>
>
>
and this is what I wrote:
>
> Look out, you're to get lost again!
>
>
>
Some people suggest adding "going" in that sentence, does that mean my version is incorrect? I tried to check usin... | 2022/07/12 | [
"https://ell.stackexchange.com/questions/318768",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/110852/"
] | It's grammatical, but it doesn't mean what you think it means.
*Be to + infinitive* means "supposed, or expected, or commanded to". It may be about intention, but it's somebody else's intention, not the person who is doing it.
*You're to ...* is usually a (rather peremptory) command. | It is somewhat difficult to figure out what you are asking.
The formation "be to verb" is perfectly proper grammatically.
>
> You're to get there by 8:30 a.m.
>
>
>
has the same meaning as
>
> You must get there by 8:30 a.m.
>
>
>
It expresses an obligation.
>
> You're going to get there by 8:30 a.m.
>
... |
39,846,281 | I have oracle function which returns sys\_refcursor.
```
create or replace function get_person_salaries(p_year in number,
p_month in number)
return sys_refcursor
```
and I want to call from ejb(java). how to do this? how can i get all the result list of sys\_... | 2016/10/04 | [
"https://Stackoverflow.com/questions/39846281",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/940441/"
] | Your problems start here:
```
public static void large(int[][] arr){
for(int i = 0 ; i<n ; i++){
```
What makes you think that the last *n* entered by the user reflects the boundaries of your arrays?
In other words: you defined your array to be of size 100 x 100; and arrays themselves know their size; so you ju... | If you want to print all the array you need to start each index with 0, in you code you start your second loop with i, and you forgot to add each entry to the sum
```
public static void large(int[][] arr){
for(int i = 0 ; i<n ; i++){
for(int j=0 ; j<i ; j++){
System.out.print(arr[i][j]);... |
35,357,100 | Just created a fresh DigitalOcean server using Debian 8.3 (Jessie) 64-bit and trying to install Resque
Doing the normal ruby install (sudo gem install) is returning
`user@server:~$ sudo gem install bundler
ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted - sendto(2) for "2001:4860:4860::8844" po... | 2016/02/12 | [
"https://Stackoverflow.com/questions/35357100",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/393134/"
] | yeah. 53 is DNS. guessing that gem cannot resolve the location from where you are pulling the gem. **What happens if you try to hit rubygems directly?**
<http://help.rubygems.org/discussions/suggestions/44-ipv6>
**Do you have an ip v4 on the machine?** | It was the firewall (ufw + iptables)
* Need to change `/etc/default/ufw` from `IPV6=no` to `IPV6=yes`
* `sudo ufw allow 53`
* `sudo ufw disable`
* `sudo ufw enable` |
6,323,467 | I have a program in C# for Windows Phone. It does some really CPU-heavy stuff with IsolatedStorage and cameras and images.
Occasionally, my app crashes. It happens about 1 in 50 times, and each time it does, I end up making some minor modification to the code. I mostly always prevent the app from exiting with try-cat... | 2011/06/12 | [
"https://Stackoverflow.com/questions/6323467",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/631193/"
] | 1. Fixing crashes by using try-catch is not really fixing them. Treat the cause, not the symptom.
2. Sending emails without the user's consent in wrong and, since it may contain personal information, might be also illegal. Since it also might cost the user to send data it also makes it commercially less viable as it in... | Unless Silverlight for WP7 supports the `SmtpClient`, there won't be a way to send mail outside of the email app.
There are a few work arounds however:
1. Create a web service to capture the data, that your wp7 can attempt to make a request to,
2. Just use the Email function and hope users hit send (you'd be surprise... |
6,323,467 | I have a program in C# for Windows Phone. It does some really CPU-heavy stuff with IsolatedStorage and cameras and images.
Occasionally, my app crashes. It happens about 1 in 50 times, and each time it does, I end up making some minor modification to the code. I mostly always prevent the app from exiting with try-cat... | 2011/06/12 | [
"https://Stackoverflow.com/questions/6323467",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/631193/"
] | Transmitting info without the user's knowledge is evil. Use reverse psychology:
 | Well, there is the WPAppManifest.xml in this file you can specify what the user needs to accept.
Here is the EMail thing: <http://www.ginktage.com/2011/04/how-to-send-email-in-windows-phone-7-using-c/>
I think this would solve your problem.
This is i think the right thing for you: <http://www.preemptive.com/produ... |
6,323,467 | I have a program in C# for Windows Phone. It does some really CPU-heavy stuff with IsolatedStorage and cameras and images.
Occasionally, my app crashes. It happens about 1 in 50 times, and each time it does, I end up making some minor modification to the code. I mostly always prevent the app from exiting with try-cat... | 2011/06/12 | [
"https://Stackoverflow.com/questions/6323467",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/631193/"
] | Transmitting info without the user's knowledge is evil. Use reverse psychology:
 | 1. Fixing crashes by using try-catch is not really fixing them. Treat the cause, not the symptom.
2. Sending emails without the user's consent in wrong and, since it may contain personal information, might be also illegal. Since it also might cost the user to send data it also makes it commercially less viable as it in... |
6,323,467 | I have a program in C# for Windows Phone. It does some really CPU-heavy stuff with IsolatedStorage and cameras and images.
Occasionally, my app crashes. It happens about 1 in 50 times, and each time it does, I end up making some minor modification to the code. I mostly always prevent the app from exiting with try-cat... | 2011/06/12 | [
"https://Stackoverflow.com/questions/6323467",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/631193/"
] | Transmitting info without the user's knowledge is evil. Use reverse psychology:
 | Unless Silverlight for WP7 supports the `SmtpClient`, there won't be a way to send mail outside of the email app.
There are a few work arounds however:
1. Create a web service to capture the data, that your wp7 can attempt to make a request to,
2. Just use the Email function and hope users hit send (you'd be surprise... |
6,323,467 | I have a program in C# for Windows Phone. It does some really CPU-heavy stuff with IsolatedStorage and cameras and images.
Occasionally, my app crashes. It happens about 1 in 50 times, and each time it does, I end up making some minor modification to the code. I mostly always prevent the app from exiting with try-cat... | 2011/06/12 | [
"https://Stackoverflow.com/questions/6323467",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/631193/"
] | Transmitting info without the user's knowledge is evil. Use reverse psychology:
 | Can you just upload the crash info with a POST request to a website? It's probably easier to do that and then let the website send an email than it is to send (random) emails in the user's name... |
6,323,467 | I have a program in C# for Windows Phone. It does some really CPU-heavy stuff with IsolatedStorage and cameras and images.
Occasionally, my app crashes. It happens about 1 in 50 times, and each time it does, I end up making some minor modification to the code. I mostly always prevent the app from exiting with try-cat... | 2011/06/12 | [
"https://Stackoverflow.com/questions/6323467",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/631193/"
] | Well, there is the WPAppManifest.xml in this file you can specify what the user needs to accept.
Here is the EMail thing: <http://www.ginktage.com/2011/04/how-to-send-email-in-windows-phone-7-using-c/>
I think this would solve your problem.
This is i think the right thing for you: <http://www.preemptive.com/produ... | As others have said, you luckily can't send emails as the user without him knowing - but you can just use a web service.
To improve this, I create the MD5 hash of the stacktrace and first check if the crash happened before and only if it hasn't happened before, I send the crash report.
But I stopped asking the users ... |
6,323,467 | I have a program in C# for Windows Phone. It does some really CPU-heavy stuff with IsolatedStorage and cameras and images.
Occasionally, my app crashes. It happens about 1 in 50 times, and each time it does, I end up making some minor modification to the code. I mostly always prevent the app from exiting with try-cat... | 2011/06/12 | [
"https://Stackoverflow.com/questions/6323467",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/631193/"
] | Transmitting info without the user's knowledge is evil. Use reverse psychology:
 | As others have said, you luckily can't send emails as the user without him knowing - but you can just use a web service.
To improve this, I create the MD5 hash of the stacktrace and first check if the crash happened before and only if it hasn't happened before, I send the crash report.
But I stopped asking the users ... |
6,323,467 | I have a program in C# for Windows Phone. It does some really CPU-heavy stuff with IsolatedStorage and cameras and images.
Occasionally, my app crashes. It happens about 1 in 50 times, and each time it does, I end up making some minor modification to the code. I mostly always prevent the app from exiting with try-cat... | 2011/06/12 | [
"https://Stackoverflow.com/questions/6323467",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/631193/"
] | Unless Silverlight for WP7 supports the `SmtpClient`, there won't be a way to send mail outside of the email app.
There are a few work arounds however:
1. Create a web service to capture the data, that your wp7 can attempt to make a request to,
2. Just use the Email function and hope users hit send (you'd be surprise... | As others have said, you luckily can't send emails as the user without him knowing - but you can just use a web service.
To improve this, I create the MD5 hash of the stacktrace and first check if the crash happened before and only if it hasn't happened before, I send the crash report.
But I stopped asking the users ... |
6,323,467 | I have a program in C# for Windows Phone. It does some really CPU-heavy stuff with IsolatedStorage and cameras and images.
Occasionally, my app crashes. It happens about 1 in 50 times, and each time it does, I end up making some minor modification to the code. I mostly always prevent the app from exiting with try-cat... | 2011/06/12 | [
"https://Stackoverflow.com/questions/6323467",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/631193/"
] | 1. Fixing crashes by using try-catch is not really fixing them. Treat the cause, not the symptom.
2. Sending emails without the user's consent in wrong and, since it may contain personal information, might be also illegal. Since it also might cost the user to send data it also makes it commercially less viable as it in... | As others have said, you luckily can't send emails as the user without him knowing - but you can just use a web service.
To improve this, I create the MD5 hash of the stacktrace and first check if the crash happened before and only if it hasn't happened before, I send the crash report.
But I stopped asking the users ... |
6,323,467 | I have a program in C# for Windows Phone. It does some really CPU-heavy stuff with IsolatedStorage and cameras and images.
Occasionally, my app crashes. It happens about 1 in 50 times, and each time it does, I end up making some minor modification to the code. I mostly always prevent the app from exiting with try-cat... | 2011/06/12 | [
"https://Stackoverflow.com/questions/6323467",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/631193/"
] | 1. Fixing crashes by using try-catch is not really fixing them. Treat the cause, not the symptom.
2. Sending emails without the user's consent in wrong and, since it may contain personal information, might be also illegal. Since it also might cost the user to send data it also makes it commercially less viable as it in... | Can you just upload the crash info with a POST request to a website? It's probably easier to do that and then let the website send an email than it is to send (random) emails in the user's name... |
4,367,744 | For reference: Starting from a point $P$, outside a circle the tangent $PA$ and the secant $PQL$ are drawn. Then join $L$ with the midpoint $M$ of $PA$.
LM intersects at F the circle.
Calculate $\angle FPA$ if $\overset{\LARGE{\frown}}{QF}=72^o$
[](htt... | 2022/01/27 | [
"https://math.stackexchange.com/questions/4367744",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/419513/"
] | Note that $\angle PLM = 36^\circ$
Also using power of point $M$, $~MA^2 = MF \cdot ML = PM^2$
$$ \implies \frac{PM}{FM} = \frac{ML}{PM}$$
and given $\angle PML$ is common,
$$\triangle PLM \sim \triangle FPM~~ \text {(by S-A-S rule)}$$
That leads to $~\angle FPM = \angle PLM = 36^\circ$ | [](https://i.stack.imgur.com/XimPJ.jpg)
In figure circle S is circumcircle of triangle APF. AQ is perpendicular on radius AS.In circle S angle APF is opposite to arc AF, the measure of arc AF is $72^o$ because it is opposite to angle QAF and we have:
... |
66,052,693 | Working with Postgres 12 / Windows 10.
Trying to copy a remote database to localhost with the following command:
`pg_dump -C -h remotehost -p 5432 -U postgres remotedb | psql -h localhost -p 5432 -U postgres localdb`
CMD requests for password 2x.
`Password for user postgres: Password:`
I input localhost first, hit... | 2021/02/04 | [
"https://Stackoverflow.com/questions/66052693",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10725420/"
] | You don't need to create the db manually.
You can do in a one-liner by using `sed` to replace `LOCALE` with `LC_COLLATE`:
Your command should look like this:
**Note! This works only if you use script (plain-text) file format for backups**
```sh
pg_dump -C -h remotehost -p 5432 -U postgres remotedb | sed 's/LOC... | After testing Abelisto's suggestion I found answers for both questions:
***Answer to question 1***
As informed by Abelisto, postgres 12 does not have `locale` option for `create database`, while postgres 13 does.
postgres 12: [postgresql.org/docs/12/sql-createdatabase.html](https://postgresql.org/docs/12/sql-created... |
66,052,693 | Working with Postgres 12 / Windows 10.
Trying to copy a remote database to localhost with the following command:
`pg_dump -C -h remotehost -p 5432 -U postgres remotedb | psql -h localhost -p 5432 -U postgres localdb`
CMD requests for password 2x.
`Password for user postgres: Password:`
I input localhost first, hit... | 2021/02/04 | [
"https://Stackoverflow.com/questions/66052693",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10725420/"
] | This was caused by me using the 13.x of `pg_restore` connecting to dbs that were 11.x (target) and 10.x (source).
So I just installed `pg_restore` 10.x.
```
brew install postgresql@10
/usr/local/opt/postgresql@10/bin/pg_restore --all-the-args-here
```
Next time I'll be more careful with the `--create` and `--clean`... | After testing Abelisto's suggestion I found answers for both questions:
***Answer to question 1***
As informed by Abelisto, postgres 12 does not have `locale` option for `create database`, while postgres 13 does.
postgres 12: [postgresql.org/docs/12/sql-createdatabase.html](https://postgresql.org/docs/12/sql-created... |
66,052,693 | Working with Postgres 12 / Windows 10.
Trying to copy a remote database to localhost with the following command:
`pg_dump -C -h remotehost -p 5432 -U postgres remotedb | psql -h localhost -p 5432 -U postgres localdb`
CMD requests for password 2x.
`Password for user postgres: Password:`
I input localhost first, hit... | 2021/02/04 | [
"https://Stackoverflow.com/questions/66052693",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10725420/"
] | You don't need to create the db manually.
You can do in a one-liner by using `sed` to replace `LOCALE` with `LC_COLLATE`:
Your command should look like this:
**Note! This works only if you use script (plain-text) file format for backups**
```sh
pg_dump -C -h remotehost -p 5432 -U postgres remotedb | sed 's/LOC... | This was caused by me using the 13.x of `pg_restore` connecting to dbs that were 11.x (target) and 10.x (source).
So I just installed `pg_restore` 10.x.
```
brew install postgresql@10
/usr/local/opt/postgresql@10/bin/pg_restore --all-the-args-here
```
Next time I'll be more careful with the `--create` and `--clean`... |
329,483 | I have a file named `foobarë`. When I try to 7zip it on Debian (stable) via Putty, I get the following:
```
server:/tmp# 7za a test.7zip foobarë
7-Zip (A) 9.04 beta Copyright (c) 1999-2009 Igor Pavlov 2009-05-30
p7zip Version 9.04 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,1 CPU)
Scanning
foobarë: WARNING: No mo... | 2011/08/29 | [
"https://superuser.com/questions/329483",
"https://superuser.com",
"https://superuser.com/users/51368/"
] | It may be that the version of 7-Zip you are using is an old version and if I remember correcly around the 9.04 area there were two versions of 7-zip, one which used the standard character set and another that was Unicode.
The current version of [7-zip](http://www.7-zip.org/) is 9.20, yours appears to be 9.04. Can you ... | The answer might also be in Putty... Putty itself (Window->Translation) wasn't set to UTF-8. I've switchted to UTF-8 now, my `foobarë` file now has a weird name, when I make it again it 7zips correctly. |
329,483 | I have a file named `foobarë`. When I try to 7zip it on Debian (stable) via Putty, I get the following:
```
server:/tmp# 7za a test.7zip foobarë
7-Zip (A) 9.04 beta Copyright (c) 1999-2009 Igor Pavlov 2009-05-30
p7zip Version 9.04 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,1 CPU)
Scanning
foobarë: WARNING: No mo... | 2011/08/29 | [
"https://superuser.com/questions/329483",
"https://superuser.com",
"https://superuser.com/users/51368/"
] | Make sure PuTTY is in UTF-8 mode. Go to *Window → Translation*, under *Remote character set* choose *UTF-8*. Go back to *Session*, select *Default Settings* and click *Save*. | It may be that the version of 7-Zip you are using is an old version and if I remember correcly around the 9.04 area there were two versions of 7-zip, one which used the standard character set and another that was Unicode.
The current version of [7-zip](http://www.7-zip.org/) is 9.20, yours appears to be 9.04. Can you ... |
329,483 | I have a file named `foobarë`. When I try to 7zip it on Debian (stable) via Putty, I get the following:
```
server:/tmp# 7za a test.7zip foobarë
7-Zip (A) 9.04 beta Copyright (c) 1999-2009 Igor Pavlov 2009-05-30
p7zip Version 9.04 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,1 CPU)
Scanning
foobarë: WARNING: No mo... | 2011/08/29 | [
"https://superuser.com/questions/329483",
"https://superuser.com",
"https://superuser.com/users/51368/"
] | Make sure PuTTY is in UTF-8 mode. Go to *Window → Translation*, under *Remote character set* choose *UTF-8*. Go back to *Session*, select *Default Settings* and click *Save*. | The answer might also be in Putty... Putty itself (Window->Translation) wasn't set to UTF-8. I've switchted to UTF-8 now, my `foobarë` file now has a weird name, when I make it again it 7zips correctly. |
64,579,830 | I have 2 data frames that are the same number of rows. They originally occurred in different orders so I sorted one to make the orders match. I am now trying to join some of the columns of each into a new DF.
The column from my sorted table I want to join to the other is just a column of ints like this:
```
1
2
0
4
... | 2020/10/28 | [
"https://Stackoverflow.com/questions/64579830",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12298510/"
] | This `url += i > 0 ? "&" + params[i] : "?" + params[i];` is just syntactic sugar (it is called the [ternary operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Conditional_Operator), which is equivalent) to:
```
if (i > 0) {
url += "&" + params[i];
} else {
url += "?" + params... | 1. Any string is > 0 but you just have a poorly written [ternary](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Conditional_Operator) that tests if the loop is iteration 0 or higher
2. use the URLSeachParams, then no need to test the & or ?
```js
const params = ["clientId = 909090", "name... |
64,579,830 | I have 2 data frames that are the same number of rows. They originally occurred in different orders so I sorted one to make the orders match. I am now trying to join some of the columns of each into a new DF.
The column from my sorted table I want to join to the other is just a column of ints like this:
```
1
2
0
4
... | 2020/10/28 | [
"https://Stackoverflow.com/questions/64579830",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12298510/"
] | This is a ternary expression:
```
i > 0 ? "&" + params[i] : "?" + params[i];
```
It will return `"&" + params[i]` when `i` is higher than `0` and `"?" + params[i]` otherwise.
In your code, you are using the `+=` operator which adds the value returned from your ternary expression to the url.
To summarize, you are n... | 1. Any string is > 0 but you just have a poorly written [ternary](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Conditional_Operator) that tests if the loop is iteration 0 or higher
2. use the URLSeachParams, then no need to test the & or ?
```js
const params = ["clientId = 909090", "name... |
64,579,830 | I have 2 data frames that are the same number of rows. They originally occurred in different orders so I sorted one to make the orders match. I am now trying to join some of the columns of each into a new DF.
The column from my sorted table I want to join to the other is just a column of ints like this:
```
1
2
0
4
... | 2020/10/28 | [
"https://Stackoverflow.com/questions/64579830",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12298510/"
] | the interpreter evaluates the code from right to left.
Thus in `url += i > 0 ? "&" + params[i] : "?" + params[i];`
it starts by evaluating the result of `i > 0 ? "&" + params[i] : "?" + params[i]`, then, it concatenates the result in `url +=...`
as other has shown, this code can be written such as:
```js
if (i > 0)... | 1. Any string is > 0 but you just have a poorly written [ternary](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Conditional_Operator) that tests if the loop is iteration 0 or higher
2. use the URLSeachParams, then no need to test the & or ?
```js
const params = ["clientId = 909090", "name... |
64,579,830 | I have 2 data frames that are the same number of rows. They originally occurred in different orders so I sorted one to make the orders match. I am now trying to join some of the columns of each into a new DF.
The column from my sorted table I want to join to the other is just a column of ints like this:
```
1
2
0
4
... | 2020/10/28 | [
"https://Stackoverflow.com/questions/64579830",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12298510/"
] | The snippet `url += i > 0` is not performing a comparison between the `url` (a string) and `0` (a number), rather it does a comparison between `i` (the loop counter) and the constant `0`; and both are numbers.
In order to understand what is happening, you first have to understand two things:
* the ternary operator `?... | 1. Any string is > 0 but you just have a poorly written [ternary](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Conditional_Operator) that tests if the loop is iteration 0 or higher
2. use the URLSeachParams, then no need to test the & or ?
```js
const params = ["clientId = 909090", "name... |
64,579,830 | I have 2 data frames that are the same number of rows. They originally occurred in different orders so I sorted one to make the orders match. I am now trying to join some of the columns of each into a new DF.
The column from my sorted table I want to join to the other is just a column of ints like this:
```
1
2
0
4
... | 2020/10/28 | [
"https://Stackoverflow.com/questions/64579830",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12298510/"
] | This `url += i > 0 ? "&" + params[i] : "?" + params[i];` is just syntactic sugar (it is called the [ternary operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Conditional_Operator), which is equivalent) to:
```
if (i > 0) {
url += "&" + params[i];
} else {
url += "?" + params... | the interpreter evaluates the code from right to left.
Thus in `url += i > 0 ? "&" + params[i] : "?" + params[i];`
it starts by evaluating the result of `i > 0 ? "&" + params[i] : "?" + params[i]`, then, it concatenates the result in `url +=...`
as other has shown, this code can be written such as:
```js
if (i > 0)... |
64,579,830 | I have 2 data frames that are the same number of rows. They originally occurred in different orders so I sorted one to make the orders match. I am now trying to join some of the columns of each into a new DF.
The column from my sorted table I want to join to the other is just a column of ints like this:
```
1
2
0
4
... | 2020/10/28 | [
"https://Stackoverflow.com/questions/64579830",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12298510/"
] | This `url += i > 0 ? "&" + params[i] : "?" + params[i];` is just syntactic sugar (it is called the [ternary operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Conditional_Operator), which is equivalent) to:
```
if (i > 0) {
url += "&" + params[i];
} else {
url += "?" + params... | The snippet `url += i > 0` is not performing a comparison between the `url` (a string) and `0` (a number), rather it does a comparison between `i` (the loop counter) and the constant `0`; and both are numbers.
In order to understand what is happening, you first have to understand two things:
* the ternary operator `?... |
64,579,830 | I have 2 data frames that are the same number of rows. They originally occurred in different orders so I sorted one to make the orders match. I am now trying to join some of the columns of each into a new DF.
The column from my sorted table I want to join to the other is just a column of ints like this:
```
1
2
0
4
... | 2020/10/28 | [
"https://Stackoverflow.com/questions/64579830",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12298510/"
] | This is a ternary expression:
```
i > 0 ? "&" + params[i] : "?" + params[i];
```
It will return `"&" + params[i]` when `i` is higher than `0` and `"?" + params[i]` otherwise.
In your code, you are using the `+=` operator which adds the value returned from your ternary expression to the url.
To summarize, you are n... | the interpreter evaluates the code from right to left.
Thus in `url += i > 0 ? "&" + params[i] : "?" + params[i];`
it starts by evaluating the result of `i > 0 ? "&" + params[i] : "?" + params[i]`, then, it concatenates the result in `url +=...`
as other has shown, this code can be written such as:
```js
if (i > 0)... |
64,579,830 | I have 2 data frames that are the same number of rows. They originally occurred in different orders so I sorted one to make the orders match. I am now trying to join some of the columns of each into a new DF.
The column from my sorted table I want to join to the other is just a column of ints like this:
```
1
2
0
4
... | 2020/10/28 | [
"https://Stackoverflow.com/questions/64579830",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12298510/"
] | This is a ternary expression:
```
i > 0 ? "&" + params[i] : "?" + params[i];
```
It will return `"&" + params[i]` when `i` is higher than `0` and `"?" + params[i]` otherwise.
In your code, you are using the `+=` operator which adds the value returned from your ternary expression to the url.
To summarize, you are n... | The snippet `url += i > 0` is not performing a comparison between the `url` (a string) and `0` (a number), rather it does a comparison between `i` (the loop counter) and the constant `0`; and both are numbers.
In order to understand what is happening, you first have to understand two things:
* the ternary operator `?... |
44,287,978 | According to the [spec section within the minitest docs](https://github.com/seattlerb/minitest#specs): the gem allows you to either use the "unit\_test" syntax of testing or the "spec style" syntax of testing.
In my rails app: I have two tests on a scope within my model (note: I am using [factory\_girl](https://rubyg... | 2017/05/31 | [
"https://Stackoverflow.com/questions/44287978",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4044009/"
] | I got the spec-style *functioning*, though the original question as to: "Why spec style syntax tests don't work out of the box with minitest in rails" is still unanswered. Hopefully someone might know and provide an answer.
What I had to do was load in the [minitest-spec-rails](https://rubygems.org/gems/minitest-spec-... | You have to `require 'minitest/spec'` to make the `describe` function available. |
74,451,129 | I am getting some -Wnarrowing conversion errors when doubles are narrowed to floats. How can I do this in a well defined way? Preferably with an option in a template I can toggle to switch behavior from throwing exceptions, to clamping to the nearest value, or to simple truncation. I was looking at the `gsl::narrow` ca... | 2022/11/15 | [
"https://Stackoverflow.com/questions/74451129",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17985913/"
] | Perhaps just add your `Left$` check to the `If`:
```
If IsNumeric(r.Value) And Left$(r.Value, 1) <> "0" Then
``` | This is the final code that I reached:
```
Sub Text2Number()
On Error GoTo EH
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Application.EnableEvents = False
Set Rng = ActiveSheet.UsedRange
Rng.Cells(1, 1).Select
For i = 1 To Rng.Rows.Count
For j = 1 To Rng.Col... |
14,360,223 | >
> **Possible Duplicate:**
>
> [Grabbing the href attribute of an A element](https://stackoverflow.com/questions/3820666/grabbing-the-href-attribute-of-an-a-element)
>
>
>
```
<td class="lbs" colspan="4">
<span>4 Pack.</span>
<span>
<span class="strike">20.5</span>
<span class="lbs">9.... | 2013/01/16 | [
"https://Stackoverflow.com/questions/14360223",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1983888/"
] | Use 4-ish - Don't use open session in view, don't have your hibernate entities bubble all the way up to the view instead have transformers translate between the hibernate entities and your domain objects or 'view beans' depending on how you want to work it.
I think of Hibernate entities as just a persistence strategy... | Mixing the Presentation layer with the Data Access layer is a design issue.
Your View should access the Model through a Controller, but by using Hibernate objects directly you're mixing layers. IMO Data Access should be another layer below the Model. Even if your entities are annotated or defined in an xml they're se... |
14,360,223 | >
> **Possible Duplicate:**
>
> [Grabbing the href attribute of an A element](https://stackoverflow.com/questions/3820666/grabbing-the-href-attribute-of-an-a-element)
>
>
>
```
<td class="lbs" colspan="4">
<span>4 Pack.</span>
<span>
<span class="strike">20.5</span>
<span class="lbs">9.... | 2013/01/16 | [
"https://Stackoverflow.com/questions/14360223",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1983888/"
] | Use 4-ish - Don't use open session in view, don't have your hibernate entities bubble all the way up to the view instead have transformers translate between the hibernate entities and your domain objects or 'view beans' depending on how you want to work it.
I think of Hibernate entities as just a persistence strategy... | **There are three ways:**
***Use eager fetch load for your attributes:*** Can be a problem if you have a big datatable.
***Use a filter called OpenSessionInView:*** this filter will keep the session open until the full load of your web page. If any hibernate object was request in this load, the session will be opened... |
14,360,223 | >
> **Possible Duplicate:**
>
> [Grabbing the href attribute of an A element](https://stackoverflow.com/questions/3820666/grabbing-the-href-attribute-of-an-a-element)
>
>
>
```
<td class="lbs" colspan="4">
<span>4 Pack.</span>
<span>
<span class="strike">20.5</span>
<span class="lbs">9.... | 2013/01/16 | [
"https://Stackoverflow.com/questions/14360223",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1983888/"
] | **There are three ways:**
***Use eager fetch load for your attributes:*** Can be a problem if you have a big datatable.
***Use a filter called OpenSessionInView:*** this filter will keep the session open until the full load of your web page. If any hibernate object was request in this load, the session will be opened... | Mixing the Presentation layer with the Data Access layer is a design issue.
Your View should access the Model through a Controller, but by using Hibernate objects directly you're mixing layers. IMO Data Access should be another layer below the Model. Even if your entities are annotated or defined in an xml they're se... |
14,859,138 | I have a perfectly working code that creates 32bpp bitmap and I need to change it so that 8bpp bitmap is created.
Here's the piece of code that creates 32bpp bitmap, draws into it, then it creates a bitmap file and store it into the vector of bytes:
```
// prepare bitmap:
BYTE* bitmap_data = NULL;
HDC hDC = GetDC(NUL... | 2013/02/13 | [
"https://Stackoverflow.com/questions/14859138",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1168156/"
] | It looks like an alignment problem. Make sure you update bfOffBits in the BITMAPFILEHEADER so that it points to the first byte of the pixel data. (If you don't change it, then it probably points to the beginning of the palette.)
In other words, `sizeof(RGBQUAD)*256` should be added here as well:
```
bf.bfOffBits = si... | You need to specify the size of the palette that you attached. Right now it's zero, so the palette is showing up as the first bunch of pixels in your image.
```
bmi.bmiHeader.biClrUsed = 256;
``` |
14,859,138 | I have a perfectly working code that creates 32bpp bitmap and I need to change it so that 8bpp bitmap is created.
Here's the piece of code that creates 32bpp bitmap, draws into it, then it creates a bitmap file and store it into the vector of bytes:
```
// prepare bitmap:
BYTE* bitmap_data = NULL;
HDC hDC = GetDC(NUL... | 2013/02/13 | [
"https://Stackoverflow.com/questions/14859138",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1168156/"
] | It looks like an alignment problem. Make sure you update bfOffBits in the BITMAPFILEHEADER so that it points to the first byte of the pixel data. (If you don't change it, then it probably points to the beginning of the palette.)
In other words, `sizeof(RGBQUAD)*256` should be added here as well:
```
bf.bfOffBits = si... | You need to generate a palette for your image.
Each pixel in a 32bit image is stored as 8-bits for Alpha, Red, Green and Blue.
Where as in a 8bit image, the value in each pixel an 8bit index into the palette.
Your for(i=0..255) { bmi.bmiColors[i].rgbRed = i; ....} code is generated an grey-scale palette.
If the whol... |
583,058 | I have two machines that one runs Ubuntu 18.04 and the other one Ubuntu 20.04. I want to use Unison to sync files between them but there are some issues. Firstly, because I sync with another machine too, I compiled from source Unison 2.48.3. Then in the Ubuntu 18.04, I installed from the Ubuntu software Unison 2.48.4 a... | 2020/04/28 | [
"https://unix.stackexchange.com/questions/583058",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/293735/"
] | You're mixing Unison versions 2.48.3 and 2.48.4. Unison is very finicky about this since the developer changes the format of the Unison archive files even between minor versions. Anyways, the versions of Unison should match between all your machines. I would skip the app store, and compile/install 2.48.3 manually on yo... | When you need to sync several computers with different operating systems, if you don't want to be compiling from source every time Unison and/or OCaml change something, there is one clean solution that *should* always work and is to install Unison as a snap. This way you have the very same Unison/OCaml version across a... |
583,058 | I have two machines that one runs Ubuntu 18.04 and the other one Ubuntu 20.04. I want to use Unison to sync files between them but there are some issues. Firstly, because I sync with another machine too, I compiled from source Unison 2.48.3. Then in the Ubuntu 18.04, I installed from the Ubuntu software Unison 2.48.4 a... | 2020/04/28 | [
"https://unix.stackexchange.com/questions/583058",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/293735/"
] | You're mixing Unison versions 2.48.3 and 2.48.4. Unison is very finicky about this since the developer changes the format of the Unison archive files even between minor versions. Anyways, the versions of Unison should match between all your machines. I would skip the app store, and compile/install 2.48.3 manually on yo... | Instead of having to modify each profile, it might be easier to use a snap alias :
```
sudo snap alias unison-jz.unison unison
```
on both client and server side. |
583,058 | I have two machines that one runs Ubuntu 18.04 and the other one Ubuntu 20.04. I want to use Unison to sync files between them but there are some issues. Firstly, because I sync with another machine too, I compiled from source Unison 2.48.3. Then in the Ubuntu 18.04, I installed from the Ubuntu software Unison 2.48.4 a... | 2020/04/28 | [
"https://unix.stackexchange.com/questions/583058",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/293735/"
] | You're mixing Unison versions 2.48.3 and 2.48.4. Unison is very finicky about this since the developer changes the format of the Unison archive files even between minor versions. Anyways, the versions of Unison should match between all your machines. I would skip the app store, and compile/install 2.48.3 manually on yo... | An easy way to solve this is by making use of apt pinning, as described by [Debian's](https://wiki.debian.org/AptConfiguration#apt_preferences_.28APT_pinning.29 "Debian wiki docs") or [Ubuntu's](https://help.ubuntu.com/community/PinningHowto "Ubuntu wiki docs") docs, to keep the unison package on the newer host to the ... |
583,058 | I have two machines that one runs Ubuntu 18.04 and the other one Ubuntu 20.04. I want to use Unison to sync files between them but there are some issues. Firstly, because I sync with another machine too, I compiled from source Unison 2.48.3. Then in the Ubuntu 18.04, I installed from the Ubuntu software Unison 2.48.4 a... | 2020/04/28 | [
"https://unix.stackexchange.com/questions/583058",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/293735/"
] | You're mixing Unison versions 2.48.3 and 2.48.4. Unison is very finicky about this since the developer changes the format of the Unison archive files even between minor versions. Anyways, the versions of Unison should match between all your machines. I would skip the app store, and compile/install 2.48.3 manually on yo... | Between 18.04 and 20.04, Ubuntu bumped the OCaml version from 4.05 to 4.08—this is the package that is available in the repos, and presumably also the version used to build Unison for the respective release.
More recent Unison versions (starting with 2.40) are available as [binary downloads](https://github.com/bcpierc... |
583,058 | I have two machines that one runs Ubuntu 18.04 and the other one Ubuntu 20.04. I want to use Unison to sync files between them but there are some issues. Firstly, because I sync with another machine too, I compiled from source Unison 2.48.3. Then in the Ubuntu 18.04, I installed from the Ubuntu software Unison 2.48.4 a... | 2020/04/28 | [
"https://unix.stackexchange.com/questions/583058",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/293735/"
] | When you need to sync several computers with different operating systems, if you don't want to be compiling from source every time Unison and/or OCaml change something, there is one clean solution that *should* always work and is to install Unison as a snap. This way you have the very same Unison/OCaml version across a... | Instead of having to modify each profile, it might be easier to use a snap alias :
```
sudo snap alias unison-jz.unison unison
```
on both client and server side. |
583,058 | I have two machines that one runs Ubuntu 18.04 and the other one Ubuntu 20.04. I want to use Unison to sync files between them but there are some issues. Firstly, because I sync with another machine too, I compiled from source Unison 2.48.3. Then in the Ubuntu 18.04, I installed from the Ubuntu software Unison 2.48.4 a... | 2020/04/28 | [
"https://unix.stackexchange.com/questions/583058",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/293735/"
] | An easy way to solve this is by making use of apt pinning, as described by [Debian's](https://wiki.debian.org/AptConfiguration#apt_preferences_.28APT_pinning.29 "Debian wiki docs") or [Ubuntu's](https://help.ubuntu.com/community/PinningHowto "Ubuntu wiki docs") docs, to keep the unison package on the newer host to the ... | Instead of having to modify each profile, it might be easier to use a snap alias :
```
sudo snap alias unison-jz.unison unison
```
on both client and server side. |
583,058 | I have two machines that one runs Ubuntu 18.04 and the other one Ubuntu 20.04. I want to use Unison to sync files between them but there are some issues. Firstly, because I sync with another machine too, I compiled from source Unison 2.48.3. Then in the Ubuntu 18.04, I installed from the Ubuntu software Unison 2.48.4 a... | 2020/04/28 | [
"https://unix.stackexchange.com/questions/583058",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/293735/"
] | Between 18.04 and 20.04, Ubuntu bumped the OCaml version from 4.05 to 4.08—this is the package that is available in the repos, and presumably also the version used to build Unison for the respective release.
More recent Unison versions (starting with 2.40) are available as [binary downloads](https://github.com/bcpierc... | Instead of having to modify each profile, it might be easier to use a snap alias :
```
sudo snap alias unison-jz.unison unison
```
on both client and server side. |
21,223,752 | I have an array of activeRecord objects (from a `model()->findAll()` call) that I pass to a CGridView.
In that grid I need a column that has a radio button for each entry which has a record attribute as it's value.
So in my controller `UserController.php` I have:
```
$users = User::model()->findAll('name=? and surnam... | 2014/01/19 | [
"https://Stackoverflow.com/questions/21223752",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2271704/"
] | I think the only thing you need is to save `eventData` and `$popupTriggerElem` outside the `keypress` context:
```
$('.popupTrigger').on('click', function(popupEventData) {
var $popupTriggerElem = $(this);
$('#tab-name').on('keypress', function(tabEventData) {
var $tabElem = $(this);
//now you ... | Another solution for this, could be to add what you need as an attribute to your event target.
The code snippet below illustrates how a "mousemove" event only is trickered, when a "mousedown" event occurs. To accomplish this, we need to store the function, so that it can later be removed.
If we were to handle this a... |
21,525,559 | I have a function which writes to two buffers. The class is threaded in so that there are multiple writers to two buffers. In other words there are multiple producers on multiple shared buffers (Imagine two input belts).
The consumer thread needs to be able to randomly select instance1 or instance 2 of the buffer obje... | 2014/02/03 | [
"https://Stackoverflow.com/questions/21525559",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3264268/"
] | What about
```
final Buffer[] twoBuffers = {bufA, bufB};
final int randRes = random * 2; // Generate 1 or 0
final Buffer buffer = twoBuffers[random]; // Now you only have one buffer
if (buffer.tryInsert) {
// Do things here
} else {
// Do other things here
}
``` | You can have an additional `Buffer` object which would be set according based on the `randRes` value.
```
Buffer bufA;
Buffer bufB;
Buffer toBeUsed; // Extra Buffer
int randRes = random % 2 // I think you need the modulo operator
if randRes = 1 {
toBeUsed = bufA; // Use BufferA
} else {
toBeUsed = bufB; // e... |
21,525,559 | I have a function which writes to two buffers. The class is threaded in so that there are multiple writers to two buffers. In other words there are multiple producers on multiple shared buffers (Imagine two input belts).
The consumer thread needs to be able to randomly select instance1 or instance 2 of the buffer obje... | 2014/02/03 | [
"https://Stackoverflow.com/questions/21525559",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3264268/"
] | What about
```
final Buffer[] twoBuffers = {bufA, bufB};
final int randRes = random * 2; // Generate 1 or 0
final Buffer buffer = twoBuffers[random]; // Now you only have one buffer
if (buffer.tryInsert) {
// Do things here
} else {
// Do other things here
}
``` | You could an array and an interface (ie Runnable):
```
Runnable[] runnables = new Runnable[] {
new Runnable() { ... },
new Runnable() { ... },
new Runnable() { ... }
};
Random random = new Random();
while (someCondition) {
int randomInt = random.nextInt(runnables.length);
runnables[randomInt].run();... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.