qid int64 1 74.7M | question stringlengths 0 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 2 48.3k | response_k stringlengths 2 40.5k |
|---|---|---|---|---|---|
45,062,106 | So i have two different queries as follows:
```
Query1
CPT Resource 1 2 3 4 5
2017-06-12 RM1 5.00 5.00 4.00 4.00 2.00
2017-06-12 RM2 3.00 6.00 4.00 7.00 4.00
2017-06-12 RM3 3.00 4.00 6.00 8.00 6.00
2017-06-13 RM1 3.00 7.00 ... | 2017/07/12 | [
"https://Stackoverflow.com/questions/45062106",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8249331/"
] | Just join for the key field and use `ABS()` to return a positive result.
```
SELECT Q1.CPT,
Q1.Resource,
ABS(Q1.[1] * Q2.[1]) as [1],
ABS(Q1.[2] * Q2.[2]) as [2],
ABS(Q1.[3] * Q2.[3]) as [3],
ABS(Q1.[4] * Q2.[4]) as [4],
ABS(Q1.[5] * Q2.[5]) as [5]
FROM Query1 Q1
JOIN Query2 ... | ```
SELECT a.CPT
, a.Resource
, ABS(a.Col1 * b.Col1) AS 'Col1'
, ABS(a.Col2 * b.Col2) AS 'Col2'
, ABS(a.Col3 * b.Col3) AS 'Col3'
, ABS(a.Col4 * b.Col4) AS 'Col4'
, ABS(a.Col5 * b.Col5) AS 'Col5'
FROM Query1 AS a
INNER JOIN Query2 AS b ON (a.CPT = b.CPT AND a.Resource = b.Resource)
``` |
45,062,106 | So i have two different queries as follows:
```
Query1
CPT Resource 1 2 3 4 5
2017-06-12 RM1 5.00 5.00 4.00 4.00 2.00
2017-06-12 RM2 3.00 6.00 4.00 7.00 4.00
2017-06-12 RM3 3.00 4.00 6.00 8.00 6.00
2017-06-13 RM1 3.00 7.00 ... | 2017/07/12 | [
"https://Stackoverflow.com/questions/45062106",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8249331/"
] | Just join for the key field and use `ABS()` to return a positive result.
```
SELECT Q1.CPT,
Q1.Resource,
ABS(Q1.[1] * Q2.[1]) as [1],
ABS(Q1.[2] * Q2.[2]) as [2],
ABS(Q1.[3] * Q2.[3]) as [3],
ABS(Q1.[4] * Q2.[4]) as [4],
ABS(Q1.[5] * Q2.[5]) as [5]
FROM Query1 Q1
JOIN Query2 ... | ```
select Query1.CPT
, Query1.Resource
, Query1.1 * Query2.1 as 1
, Query1.2 * Query2.2 as 2
, Query1.3 * Query2.3 as 3
, Query1.4 * Query2.4 as 4
, Query1.5 * Query2.5 as 5
from Query1
Join Query2 on Query1.Resource= Query2.Resource
```
Try like this, I do not have sql server right n... |
31,903,819 | I am using in memory H2 database for my tests. My application is Spring Boot and I am having trouble when running a CTE (Recursive query) from the application.
From the H2 console the query works like a charm but not when it's called from the application (it returns no records, although they are there, I can see from ... | 2015/08/09 | [
"https://Stackoverflow.com/questions/31903819",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1474815/"
] | H2 only support recursive CTE without named parameter. | I would advice 3 actions.
1- Look at the H2 trace if any error.
2- Turn a sql logger on to inspect the query generated by your code and inspect carefully the values used for both parameters.
3- I would suggest to make this CTE a prepared statement and use it the standard jdbc way. |
194,571 | What is the meaning of ''one block into'' in the below sentences? Which grammar rule ?
**You own a house one block into the ward.** | 2019/01/29 | [
"https://ell.stackexchange.com/questions/194571",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/88975/"
] | In the context of housing, a ***block*** is either a single (multi-storey) building containing multiple apartments / offices / etc., or a (usually rectangular) area between two pairs of intersecting roads, mostly or completely filled with buildings (houses / offices / shops / etc.).
And a ***ward*** usually refers to ... | I believe it means *on the fringe of a district.* The word *ward* means *an administrative division of a city*. I believe it means that the person doesn't live in the center of the ward but somewhere at the margins. |
11,558,710 | Hi guys i have to pass the checked value from checkbox and selected value from DropDown,
my view looks like this
```
Project:DropDown
-----------------------------
EmployeeNames
--------------------------
checkbox,AnilKumar
checkBox,Ghouse
this... | 2012/07/19 | [
"https://Stackoverflow.com/questions/11558710",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1206468/"
] | use `android:gravity` like this:
```
TextView
android:id="@+id/gateNameText"
android:layout_width="0dip"
android:layout_height="match_parent"
android:gravity="center_vertical|center"
android:layout_weight=".7"
android:textSize="15dp" />
``` | you want to use:
```
android:gravity="center_vertical|center"
``` |
11,558,710 | Hi guys i have to pass the checked value from checkbox and selected value from DropDown,
my view looks like this
```
Project:DropDown
-----------------------------
EmployeeNames
--------------------------
checkbox,AnilKumar
checkBox,Ghouse
this... | 2012/07/19 | [
"https://Stackoverflow.com/questions/11558710",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1206468/"
] | use `android:gravity` like this:
```
TextView
android:id="@+id/gateNameText"
android:layout_width="0dip"
android:layout_height="match_parent"
android:gravity="center_vertical|center"
android:layout_weight=".7"
android:textSize="15dp" />
``` | Try this list\_item.xml::
```
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="40dp" >
<ImageView
android:id="@+id/gateTypeImage"
android:layout_width="wrap_content"
... |
11,558,710 | Hi guys i have to pass the checked value from checkbox and selected value from DropDown,
my view looks like this
```
Project:DropDown
-----------------------------
EmployeeNames
--------------------------
checkbox,AnilKumar
checkBox,Ghouse
this... | 2012/07/19 | [
"https://Stackoverflow.com/questions/11558710",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1206468/"
] | you want to use:
```
android:gravity="center_vertical|center"
``` | Try this list\_item.xml::
```
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="40dp" >
<ImageView
android:id="@+id/gateTypeImage"
android:layout_width="wrap_content"
... |
19,306,342 | My PHP code is this:
```
$userdetails = mysqli_query($con, "SELECT *FROM aircraft_status");
#$row = mysql_fetch_row($userdetails) ;
while($rows=mysqli_fetch_array($userdetails)){
$status[]= array($rows['Aircraft']=>$rows['Status']);
}
#Output the JSON data
echo json_encode($status);
```
and gives this:
```
[{"A... | 2013/10/10 | [
"https://Stackoverflow.com/questions/19306342",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2840648/"
] | ```
echo json_encode($status, JSON_FORCE_OBJECT);
```
Demo: <http://codepad.viper-7.com/lrYKv6>
or
```
echo json_encode((Object) $status);
```
Demo; <http://codepad.viper-7.com/RPtchU> | You get an JSONArray, Not Object, you could create an Object holding an array, or parsing the array.
Refering to [this](https://stackoverflow.com/questions/5650171/parsing-json-array-within-json-object) post |
19,306,342 | My PHP code is this:
```
$userdetails = mysqli_query($con, "SELECT *FROM aircraft_status");
#$row = mysql_fetch_row($userdetails) ;
while($rows=mysqli_fetch_array($userdetails)){
$status[]= array($rows['Aircraft']=>$rows['Status']);
}
#Output the JSON data
echo json_encode($status);
```
and gives this:
```
[{"A... | 2013/10/10 | [
"https://Stackoverflow.com/questions/19306342",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2840648/"
] | ```
echo json_encode($status, JSON_FORCE_OBJECT);
```
Demo: <http://codepad.viper-7.com/lrYKv6>
or
```
echo json_encode((Object) $status);
```
Demo; <http://codepad.viper-7.com/RPtchU> | Solution #1 (Java)
------------------
How about a helper method like this:
```
private int getProp(String name, JSONArray arr) throws Exception {
for (int i = 0; i < arr.length(); ++i) {
JSONObject obj = arr.getJSONObject(i);
if (obj.has(name))
return obj.getInt(name);
}
throw ... |
19,306,342 | My PHP code is this:
```
$userdetails = mysqli_query($con, "SELECT *FROM aircraft_status");
#$row = mysql_fetch_row($userdetails) ;
while($rows=mysqli_fetch_array($userdetails)){
$status[]= array($rows['Aircraft']=>$rows['Status']);
}
#Output the JSON data
echo json_encode($status);
```
and gives this:
```
[{"A... | 2013/10/10 | [
"https://Stackoverflow.com/questions/19306342",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2840648/"
] | Instead of using JSonobject, use JSONArray
```
JSONArray array = new JSONArray(sourceString);
```
Later loop through the array and do the business logic.
<http://www.json.org/javadoc/org/json/JSONArray.html> | You get an JSONArray, Not Object, you could create an Object holding an array, or parsing the array.
Refering to [this](https://stackoverflow.com/questions/5650171/parsing-json-array-within-json-object) post |
19,306,342 | My PHP code is this:
```
$userdetails = mysqli_query($con, "SELECT *FROM aircraft_status");
#$row = mysql_fetch_row($userdetails) ;
while($rows=mysqli_fetch_array($userdetails)){
$status[]= array($rows['Aircraft']=>$rows['Status']);
}
#Output the JSON data
echo json_encode($status);
```
and gives this:
```
[{"A... | 2013/10/10 | [
"https://Stackoverflow.com/questions/19306342",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2840648/"
] | Instead of using JSonobject, use JSONArray
```
JSONArray array = new JSONArray(sourceString);
```
Later loop through the array and do the business logic.
<http://www.json.org/javadoc/org/json/JSONArray.html> | Solution #1 (Java)
------------------
How about a helper method like this:
```
private int getProp(String name, JSONArray arr) throws Exception {
for (int i = 0; i < arr.length(); ++i) {
JSONObject obj = arr.getJSONObject(i);
if (obj.has(name))
return obj.getInt(name);
}
throw ... |
19,306,342 | My PHP code is this:
```
$userdetails = mysqli_query($con, "SELECT *FROM aircraft_status");
#$row = mysql_fetch_row($userdetails) ;
while($rows=mysqli_fetch_array($userdetails)){
$status[]= array($rows['Aircraft']=>$rows['Status']);
}
#Output the JSON data
echo json_encode($status);
```
and gives this:
```
[{"A... | 2013/10/10 | [
"https://Stackoverflow.com/questions/19306342",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2840648/"
] | Maybe with this kind of json structure?
```
$status[$rows['Aircraft']]= $rows['Status'];
``` | You get an JSONArray, Not Object, you could create an Object holding an array, or parsing the array.
Refering to [this](https://stackoverflow.com/questions/5650171/parsing-json-array-within-json-object) post |
19,306,342 | My PHP code is this:
```
$userdetails = mysqli_query($con, "SELECT *FROM aircraft_status");
#$row = mysql_fetch_row($userdetails) ;
while($rows=mysqli_fetch_array($userdetails)){
$status[]= array($rows['Aircraft']=>$rows['Status']);
}
#Output the JSON data
echo json_encode($status);
```
and gives this:
```
[{"A... | 2013/10/10 | [
"https://Stackoverflow.com/questions/19306342",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2840648/"
] | Maybe with this kind of json structure?
```
$status[$rows['Aircraft']]= $rows['Status'];
``` | Solution #1 (Java)
------------------
How about a helper method like this:
```
private int getProp(String name, JSONArray arr) throws Exception {
for (int i = 0; i < arr.length(); ++i) {
JSONObject obj = arr.getJSONObject(i);
if (obj.has(name))
return obj.getInt(name);
}
throw ... |
27,005,824 | I would like to construct a match spec to select the first element from a tuple when a match is found on the second element, or the second element when the first element matches. Rather than calling ets:match twice, can this be done in one match specification? | 2014/11/18 | [
"https://Stackoverflow.com/questions/27005824",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/450706/"
] | Yes.
In [documentation](http://www.erlang.org/doc/man/ets.html#select-2) there is example of `is_integer(X), is_integer(Y), X + Y < 4711`, or `[{is_integer, '$1'}, {is_integer, '$2'}, {'<', {'+', '$1', '$2'}, 4711}]`.
If you are using `fun2ms` just write funciton with two clauses.
```
fun({X, Y}) when in_integer(X)... | ```
-export([main/0]).
-include_lib("stdlib/include/ms_transform.hrl").
main() ->
ets:new(test, [named_table, set]),
ets:insert(test, {1, a, 3}),
ets:insert(test, {b, 2, false}),
ets:insert(test, {3, 3, true}),
ets:insert(test, {4, 4, "oops"}),
io:format("~p~n", [ets:fun2ms(fun({1, Y, _Z}) -> Y... |
328,965 | I understand that Hamiltonian has to be hermitian. For a two level system, why does the general form of an Hamiltonian of a qubit have all real entries :
$$
\hat{H} = \frac{1}{2}\left( \begin{array}{cc} \epsilon & \delta \\ \delta & -\epsilon \end{array} \right)
$$
where $\epsilon$ as the offset between the potential e... | 2017/04/25 | [
"https://physics.stackexchange.com/questions/328965",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/75725/"
] | Perfectly incompressible bodies are actually prohibited by stability of thermodynamic equilibrium (entropy maximization). Section 21 of Landau & Lifshitz Vol 5: *Statistical Physics* has a nice discussion and derivation of the general thermodynamic inequality $C\_V > 0$.
So the equation of state $T = T(V)$ is patholog... | This is what I think: A true thermodynamic variable must be a function of two others. Therefore $T=T(V)$ is not a thermodynamic variable. However we have encountered such a pathology before: for ideal gas we have $U=U(T)$. In your very first equation you are piling both of these pathologies together to get $\delta Q=dU... |
18,545,018 | I have two Textviews in a RelativeLayout like this:
```
<RelativeLayout>
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
(*) android:layout_above="@+id/message"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="tr... | 2013/08/31 | [
"https://Stackoverflow.com/questions/18545018",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2693419/"
] | First of all you have to remove **"+"** from
This
`android:layout_above="@+id/message"`
To
```
android:layout_above="@id/message"
```
And use TextView's scrolling method rather than scrollview
```
<TextView
android:scrollbars="vertical" // Add this to your TextView in .xml file
android:maxLines="ANY_INTEGER... | Give id to your ScrollView and align relative to the ScrollView
```
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
(*) android:layout_above="@+id/scroll"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true" />
<S... |
18,545,018 | I have two Textviews in a RelativeLayout like this:
```
<RelativeLayout>
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
(*) android:layout_above="@+id/message"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="tr... | 2013/08/31 | [
"https://Stackoverflow.com/questions/18545018",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2693419/"
] | It is giving this error because your TextView's parent is not relative layout,it's ScrollView. Instead give an id to your ScrollView and then use:
```
android:layout_above="ScrollView id here"
``` | Give id to your ScrollView and align relative to the ScrollView
```
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
(*) android:layout_above="@+id/scroll"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true" />
<S... |
18,545,018 | I have two Textviews in a RelativeLayout like this:
```
<RelativeLayout>
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
(*) android:layout_above="@+id/message"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="tr... | 2013/08/31 | [
"https://Stackoverflow.com/questions/18545018",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2693419/"
] | First of all you have to remove **"+"** from
This
`android:layout_above="@+id/message"`
To
```
android:layout_above="@id/message"
```
And use TextView's scrolling method rather than scrollview
```
<TextView
android:scrollbars="vertical" // Add this to your TextView in .xml file
android:maxLines="ANY_INTEGER... | Move your TextView id to the ScrollView so that `above` refers to a sibling.
```
<RelativeLayout> <TextView android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content" (*)
android:layout_above="@+id/message"
android:layout_alignParentLeft="true"
android:layout_alignParentR... |
18,545,018 | I have two Textviews in a RelativeLayout like this:
```
<RelativeLayout>
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
(*) android:layout_above="@+id/message"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="tr... | 2013/08/31 | [
"https://Stackoverflow.com/questions/18545018",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2693419/"
] | It is giving this error because your TextView's parent is not relative layout,it's ScrollView. Instead give an id to your ScrollView and then use:
```
android:layout_above="ScrollView id here"
``` | Move your TextView id to the ScrollView so that `above` refers to a sibling.
```
<RelativeLayout> <TextView android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content" (*)
android:layout_above="@+id/message"
android:layout_alignParentLeft="true"
android:layout_alignParentR... |
18,545,018 | I have two Textviews in a RelativeLayout like this:
```
<RelativeLayout>
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
(*) android:layout_above="@+id/message"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="tr... | 2013/08/31 | [
"https://Stackoverflow.com/questions/18545018",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2693419/"
] | First of all you have to remove **"+"** from
This
`android:layout_above="@+id/message"`
To
```
android:layout_above="@id/message"
```
And use TextView's scrolling method rather than scrollview
```
<TextView
android:scrollbars="vertical" // Add this to your TextView in .xml file
android:maxLines="ANY_INTEGER... | **Do not use scrollview to make your TextView Scrollable. Rather use scrolling movement method like this way.**
```
TextView message = (TextView) findViewById(R.id.message);
message.setMovementMethod(new ScrollingMovementMethod());
``` |
18,545,018 | I have two Textviews in a RelativeLayout like this:
```
<RelativeLayout>
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
(*) android:layout_above="@+id/message"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="tr... | 2013/08/31 | [
"https://Stackoverflow.com/questions/18545018",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2693419/"
] | It is giving this error because your TextView's parent is not relative layout,it's ScrollView. Instead give an id to your ScrollView and then use:
```
android:layout_above="ScrollView id here"
``` | **Do not use scrollview to make your TextView Scrollable. Rather use scrolling movement method like this way.**
```
TextView message = (TextView) findViewById(R.id.message);
message.setMovementMethod(new ScrollingMovementMethod());
``` |
18,545,018 | I have two Textviews in a RelativeLayout like this:
```
<RelativeLayout>
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
(*) android:layout_above="@+id/message"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="tr... | 2013/08/31 | [
"https://Stackoverflow.com/questions/18545018",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2693419/"
] | First of all you have to remove **"+"** from
This
`android:layout_above="@+id/message"`
To
```
android:layout_above="@id/message"
```
And use TextView's scrolling method rather than scrollview
```
<TextView
android:scrollbars="vertical" // Add this to your TextView in .xml file
android:maxLines="ANY_INTEGER... | It is giving this error because your TextView's parent is not relative layout,it's ScrollView. Instead give an id to your ScrollView and then use:
```
android:layout_above="ScrollView id here"
``` |
63,515,655 | I was solving the basic problem of finding the number of distinct integers in a given array.
My idea was to declare an `std::unordered_set`, insert all given integers into the set, then output the size of the set. Here's my code implementing this strategy:
```
#include <iostream>
#include <fstream>
#include <cmath>
#... | 2020/08/21 | [
"https://Stackoverflow.com/questions/63515655",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14023031/"
] | The input file you've provided consists of successive integers congruent to `1` modulo `107897`. So what is most likely happening is that, at some point when the load factor crosses a threshold, the particular library implementation you're using resizes the table, using a table with `107897` entries, so that a key with... | Your program works absolutely fine. There is nothing wrong with the hash algorithm, collisions, or anything of the like.
The thottling you are seeing is from the console i/o when you attempt to paste 200000 numbers into the window. That's why it chokes. Redirect from file and it works fine and returns the result almos... |
57,380,963 | I am using Spring Webflux, and I need to return the ID of user upon successful save.
Repository is returning the Mono
```
Mono<User> savedUserMono = repository.save(user);
```
But from controller, I need to return the user ID which is in object returned from save() call.
I have tried using doOn\*, and subscribe(),... | 2019/08/06 | [
"https://Stackoverflow.com/questions/57380963",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1037492/"
] | Any time you feel the need to *transform* or *map* what's in your `Mono` to something else, then you use the `map()` method, passing a lambda that will do the transformation like so:
```
Mono<Integer> userId = savedUserMono.map(user -> user.getId());
```
(assuming, of course, that your user has a `getId()` method, a... | what you do is
```
Mono<String> id = user.map(user -> {
return user.getId();
});
```
and then you return the `Mono<String>` to the client, if your id is a string |
18,454,052 | I'm wondering if I will miss any data if I replace a trigger while my oracle database is in use. I created a toy example and it seems like I won't, but one of my coworkers claims otherwise.
```
create table test_trigger (id number);
create table test_trigger_h (id number);
create sequence test_trigger_seq;
--/
create... | 2013/08/26 | [
"https://Stackoverflow.com/questions/18454052",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/558585/"
] | `create or replace` is locking the table. So all the inserts will wait until it completes. Don't worry about missed inserts. | I think you might be going about testing this in the wrong way. Your insert statements won't take any time at all and so the replacement of the trigger can fit in through the gaps between inserts. As least this is what I infer due to the below.
If you change your test to ensure you have a long running SQL statement, e... |
18,454,052 | I'm wondering if I will miss any data if I replace a trigger while my oracle database is in use. I created a toy example and it seems like I won't, but one of my coworkers claims otherwise.
```
create table test_trigger (id number);
create table test_trigger_h (id number);
create sequence test_trigger_seq;
--/
create... | 2013/08/26 | [
"https://Stackoverflow.com/questions/18454052",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/558585/"
] | `create or replace` is locking the table. So all the inserts will wait until it completes. Don't worry about missed inserts. | Following URL answers that **trigger can be modified while application is running**. its will a "library cache" lock and NOT a "data" lock. Oracle handles it internally without you worrying abt it.
Check out question raised by Ben- [Can a trigger be locked; how would one determine that it is?](https://stackoverflow.co... |
33,625,063 | I haven't long time in touch with C language. I have some questions related to chinese words and strncpy.
```
char* testString = "你好嗎?"
sizeof(testString) => it prints out 4.
strlen(testString) => it prints out 10.
```
When i want to copy to another char array, i have some issue.
char msgArray[7]; /\* This is just... | 2015/11/10 | [
"https://Stackoverflow.com/questions/33625063",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3733534/"
] | Pointers are not arrays. `testString` is a pointer and therefore, `sizeof(testString)` will give the size of pointer instead of the string it points to.
`strlen` works differently and only for null terminated `char` arrays and string literals. It gives the length of the string preceding the null character. | normally you can use wchar\_t to represent UTF characters (non-English characters), and each character may need 2 or 4 bytes. And if you really want to count number of characters in a quick way, use uint32\_t(unsigned int) instead of char/wchar\_t because UTF32 is guarantee each character (including non-English charact... |
33,625,063 | I haven't long time in touch with C language. I have some questions related to chinese words and strncpy.
```
char* testString = "你好嗎?"
sizeof(testString) => it prints out 4.
strlen(testString) => it prints out 10.
```
When i want to copy to another char array, i have some issue.
char msgArray[7]; /\* This is just... | 2015/11/10 | [
"https://Stackoverflow.com/questions/33625063",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3733534/"
] | Pointers are not arrays. `testString` is a pointer and therefore, `sizeof(testString)` will give the size of pointer instead of the string it points to.
`strlen` works differently and only for null terminated `char` arrays and string literals. It gives the length of the string preceding the null character. | I am not pro, but you may try somthing like this:
```
char* testString = "你好嗎?\0"; //null-terminating char at the end
int arr_len = 0;
while(testString[arr_len])
arr_len++;
```
As result, it returns 10, whih is number of array field, so if you multiply it by the size of single byte, you will get actual length of the... |
33,625,063 | I haven't long time in touch with C language. I have some questions related to chinese words and strncpy.
```
char* testString = "你好嗎?"
sizeof(testString) => it prints out 4.
strlen(testString) => it prints out 10.
```
When i want to copy to another char array, i have some issue.
char msgArray[7]; /\* This is just... | 2015/11/10 | [
"https://Stackoverflow.com/questions/33625063",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3733534/"
] | Pointers are not arrays. `testString` is a pointer and therefore, `sizeof(testString)` will give the size of pointer instead of the string it points to.
`strlen` works differently and only for null terminated `char` arrays and string literals. It gives the length of the string preceding the null character. | The behaviour of `char* testString = "你好嗎?"` depends on the compiler. One option would be to investigate what your compiler is doing by outputting individual characters via `%d` . It might be generating a UTF-8 literal.
In the C11 standard you may write one of the following:
```
char const *testString = u8"你好嗎?"; /... |
33,625,063 | I haven't long time in touch with C language. I have some questions related to chinese words and strncpy.
```
char* testString = "你好嗎?"
sizeof(testString) => it prints out 4.
strlen(testString) => it prints out 10.
```
When i want to copy to another char array, i have some issue.
char msgArray[7]; /\* This is just... | 2015/11/10 | [
"https://Stackoverflow.com/questions/33625063",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3733534/"
] | normally you can use wchar\_t to represent UTF characters (non-English characters), and each character may need 2 or 4 bytes. And if you really want to count number of characters in a quick way, use uint32\_t(unsigned int) instead of char/wchar\_t because UTF32 is guarantee each character (including non-English charact... | I am not pro, but you may try somthing like this:
```
char* testString = "你好嗎?\0"; //null-terminating char at the end
int arr_len = 0;
while(testString[arr_len])
arr_len++;
```
As result, it returns 10, whih is number of array field, so if you multiply it by the size of single byte, you will get actual length of the... |
33,625,063 | I haven't long time in touch with C language. I have some questions related to chinese words and strncpy.
```
char* testString = "你好嗎?"
sizeof(testString) => it prints out 4.
strlen(testString) => it prints out 10.
```
When i want to copy to another char array, i have some issue.
char msgArray[7]; /\* This is just... | 2015/11/10 | [
"https://Stackoverflow.com/questions/33625063",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3733534/"
] | The behaviour of `char* testString = "你好嗎?"` depends on the compiler. One option would be to investigate what your compiler is doing by outputting individual characters via `%d` . It might be generating a UTF-8 literal.
In the C11 standard you may write one of the following:
```
char const *testString = u8"你好嗎?"; /... | normally you can use wchar\_t to represent UTF characters (non-English characters), and each character may need 2 or 4 bytes. And if you really want to count number of characters in a quick way, use uint32\_t(unsigned int) instead of char/wchar\_t because UTF32 is guarantee each character (including non-English charact... |
33,625,063 | I haven't long time in touch with C language. I have some questions related to chinese words and strncpy.
```
char* testString = "你好嗎?"
sizeof(testString) => it prints out 4.
strlen(testString) => it prints out 10.
```
When i want to copy to another char array, i have some issue.
char msgArray[7]; /\* This is just... | 2015/11/10 | [
"https://Stackoverflow.com/questions/33625063",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3733534/"
] | The behaviour of `char* testString = "你好嗎?"` depends on the compiler. One option would be to investigate what your compiler is doing by outputting individual characters via `%d` . It might be generating a UTF-8 literal.
In the C11 standard you may write one of the following:
```
char const *testString = u8"你好嗎?"; /... | I am not pro, but you may try somthing like this:
```
char* testString = "你好嗎?\0"; //null-terminating char at the end
int arr_len = 0;
while(testString[arr_len])
arr_len++;
```
As result, it returns 10, whih is number of array field, so if you multiply it by the size of single byte, you will get actual length of the... |
45,007,249 | In my code:(works well on tf1.0)
```
from tensorflow.contrib.rnn.python.ops import core_rnn
from tensorflow.contrib.rnn.python.ops import core_rnn_cell
from tensorflow.contrib.rnn.python.ops import core_rnn_cell_impl
```
report error with tf1.2:
from tensorflow.contrib.rnn.python.ops import core\_rnn
ImportError... | 2017/07/10 | [
"https://Stackoverflow.com/questions/45007249",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4344990/"
] | Here you go with the solution <https://jsfiddle.net/w0nefkfo/>
```js
$('button').prop('disabled', true);
setTimeout(function(){
$('button').prop('disabled', false);
}, 2000);
```
```html
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<button type="submit" value="submit">... | First disable the button like `$('button').attr("disabled", "disabled");` and use `setTimeout` and assign timeout value.
```js
$('button').attr("disabled", "disabled");
//or you can use #btn ref: $('#btn').attr("disabled", "disabled");
setTimeout(function()
{
$('button').removeAttr('disabled');
}, 3000);//3... |
45,007,249 | In my code:(works well on tf1.0)
```
from tensorflow.contrib.rnn.python.ops import core_rnn
from tensorflow.contrib.rnn.python.ops import core_rnn_cell
from tensorflow.contrib.rnn.python.ops import core_rnn_cell_impl
```
report error with tf1.2:
from tensorflow.contrib.rnn.python.ops import core\_rnn
ImportError... | 2017/07/10 | [
"https://Stackoverflow.com/questions/45007249",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4344990/"
] | Here you go with the solution <https://jsfiddle.net/w0nefkfo/>
```js
$('button').prop('disabled', true);
setTimeout(function(){
$('button').prop('disabled', false);
}, 2000);
```
```html
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<button type="submit" value="submit">... | ```
$('button').prop('disabled', true);
setTimeout(function () {
$('button').prop('disabled', false);
}, 3000);
``` |
45,007,249 | In my code:(works well on tf1.0)
```
from tensorflow.contrib.rnn.python.ops import core_rnn
from tensorflow.contrib.rnn.python.ops import core_rnn_cell
from tensorflow.contrib.rnn.python.ops import core_rnn_cell_impl
```
report error with tf1.2:
from tensorflow.contrib.rnn.python.ops import core\_rnn
ImportError... | 2017/07/10 | [
"https://Stackoverflow.com/questions/45007249",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4344990/"
] | `setTimeout` is not a method of a jQuery element. Change your code as follows:
```
$('button').prop('disabled', true);
setTimeout(function() {
$('button').prop('disabled', false)
}, 3000);
``` | First disable the button like `$('button').attr("disabled", "disabled");` and use `setTimeout` and assign timeout value.
```js
$('button').attr("disabled", "disabled");
//or you can use #btn ref: $('#btn').attr("disabled", "disabled");
setTimeout(function()
{
$('button').removeAttr('disabled');
}, 3000);//3... |
45,007,249 | In my code:(works well on tf1.0)
```
from tensorflow.contrib.rnn.python.ops import core_rnn
from tensorflow.contrib.rnn.python.ops import core_rnn_cell
from tensorflow.contrib.rnn.python.ops import core_rnn_cell_impl
```
report error with tf1.2:
from tensorflow.contrib.rnn.python.ops import core\_rnn
ImportError... | 2017/07/10 | [
"https://Stackoverflow.com/questions/45007249",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4344990/"
] | `setTimeout` is not a method of a jQuery element. Change your code as follows:
```
$('button').prop('disabled', true);
setTimeout(function() {
$('button').prop('disabled', false)
}, 3000);
``` | ```
$('button').prop('disabled', true);
setTimeout(function () {
$('button').prop('disabled', false);
}, 3000);
``` |
31,355,287 | I'm a learner of C++ and I'm currently making my assignment and I can't seem to update my value.
It's a must to use define for the balance:
```
#define balance 5000.00
```
In the end of the statement I can't seem to able to update my balance:
```
printf("Deposit Successful!\nYou have deposited the followin... | 2015/07/11 | [
"https://Stackoverflow.com/questions/31355287",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5105438/"
] | `#define`s are directives to the so called preprocessor. This is transforming the source code of your programm by textual substitution before it is actually compiled.
When you write something like:
```
#define value 42;
printf("%d", value);
```
then the compiler effectively sees
```
printf("%d", 42);
```
This ha... | You need to understand how it works and what is preprocessor in C/C++ languages. Preprocessor used BEFORE you program first run. It used during converting your program (text) to machine code. What you want is outside of preprocessor/compiler duty - it is part of your program itself.
So if you want something to be chan... |
31,355,287 | I'm a learner of C++ and I'm currently making my assignment and I can't seem to update my value.
It's a must to use define for the balance:
```
#define balance 5000.00
```
In the end of the statement I can't seem to able to update my balance:
```
printf("Deposit Successful!\nYou have deposited the followin... | 2015/07/11 | [
"https://Stackoverflow.com/questions/31355287",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5105438/"
] | `#define`s are directives to the so called preprocessor. This is transforming the source code of your programm by textual substitution before it is actually compiled.
When you write something like:
```
#define value 42;
printf("%d", value);
```
then the compiler effectively sees
```
printf("%d", 42);
```
This ha... | Its class rep, Veron
You should use a variable instead of defining a constant for storing the amount of balance. Since the value must be updated once a transaction has been done.
According to what assignment stated, the initial value of balance is always constant and start with same value, which won't be modified any... |
57,377,905 | I have a deep network using Keras and I need to apply cropping on the output of one layer and then send to the next layer. for this aim, I write the following code as a lambda layer:
```
def cropping_fillzero(img, rate=0.6): # Q = percentage
residual_shape = img.get_shape().as_list()
h, w = residual_shape[1:3]... | 2019/08/06 | [
"https://Stackoverflow.com/questions/57377905",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11013499/"
] | Use `pd.Grouper` along with `Country` and `City` as your `groupby` keys. I chose `60S` as the frequency, but change this as needed.
---
```
keys = ['Country', 'City', pd.Grouper(key='Datetime', freq='60S')]
df.groupby(keys, sort=False).agg(Unit=('Unit', 'first'), count=('count', 'sum'))
```
```
... | [user3483203's answer](https://stackoverflow.com/a/57378004/2538939) works if you consider a group means "failures within the same minute", i.e. failures at `9:00:01` and `9:00:59` are in the same group but `10:00:00` is not.
If your definition is "falls within 60 seconds of the *previous* failure", use a different a... |
51,917,574 | I am new on using a Kinect sensor, I have Kinect XBOX 360 and I need to use it to get a real moving body 3D positions. I need to use it with c++ and openCV. I could not find anything helpful on the web. So, please if anyone can give me some advice or if there any code for opening Kinect XBOX 360 with c++ to start with ... | 2018/08/19 | [
"https://Stackoverflow.com/questions/51917574",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10245929/"
] | 3 days ago, Our team had met this question. We spent a lot of time for that.
Problem reason should be in AWS ecs-agent(we have 2 envrionment, one ecs-agent's version is 1.21 and another one is 1.24)
Yesterday, We solved this problem: Using AWS console to update ecs-agent to the latest version: 1.34 and restart the ec... | Firstly, it's a good idea to avoid using domain names within your Nginx config, especially when defining upstream servers. It's confusing if nothing else.
Are all your values for `example.com` the same? If so you have an upstream block which defines an upstream server cluster with the name `example.com`, then you have... |
51,917,574 | I am new on using a Kinect sensor, I have Kinect XBOX 360 and I need to use it to get a real moving body 3D positions. I need to use it with c++ and openCV. I could not find anything helpful on the web. So, please if anyone can give me some advice or if there any code for opening Kinect XBOX 360 with c++ to start with ... | 2018/08/19 | [
"https://Stackoverflow.com/questions/51917574",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10245929/"
] | 3 days ago, Our team had met this question. We spent a lot of time for that.
Problem reason should be in AWS ecs-agent(we have 2 envrionment, one ecs-agent's version is 1.21 and another one is 1.24)
Yesterday, We solved this problem: Using AWS console to update ecs-agent to the latest version: 1.34 and restart the ec... | I have got this problem but in my case the Key reasons are - :
1. I did not register the `virtual_host` in `etc/hosts` -> that's one
thing
2. The IP I am giving for another container must be in the same
network of Nginx for proxy to that
3. Make sure the IP of a container to which you are proxy is
working properly if ... |
18,820,233 | I'm working on a CMS back-end with Codeigniter. Maybe it's not clear to state my question with word. So I use some simple html code to express my question:
There is a html page called `A.html`. The code in `A.html` is following:
```
<html>
<head>
/*something*/
</head>
<!-- menu area -->
<div class... | 2013/09/16 | [
"https://Stackoverflow.com/questions/18820233",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/669647/"
] | If you want all links to load content into `#content`, you can use this:
```
$(document).on('click', 'a', function(){
$('#content').load(this.href);
});
```
But this won't work for external links.
If all your pages have the structure you described for A.html, you can add another div around `#content` (say, `#con... | You would do something like this with jQuery to load the page content with ajax when the user clicks on a navigation link. (You would need to add links into your menu first)
```
$('.nav-header>a').click(function(){
$('#content').load($(this).attr('href'));
});
``` |
131,444 | We received a note from the security review team highlighting a CRUD/FLS vulnerability in our package and in the note it says there is a "Instances of SELECT vulnerability found across the application".
An example provided is shown below in a "with sharing" class:
>
> myAttachments = [SELECT name, id, parentid, Crea... | 2016/07/14 | [
"https://salesforce.stackexchange.com/questions/131444",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/11790/"
] | I contacted Salesforce's Support team and they provided [this article](https://support.microsoft.com/en-us/kb/2994633) as a temporary fix.
They also mentioned:
>
> "Our R&D team has investigated this matter and logged a New Issue for it to be repaired. Unfortunately, I cannot provide a timeline as to when this rep... | Is KB3115322 (Security Update for Excel 2010) installed? If so, uninstalling this update worked for us. I notified Salesforce about the problem so that either Salesforce or Microsoft fixes the issue, since the update is flagged as critical by Microsoft.
It's KB3115262 related to Excel 2013.
It's KB3115272 related to E... |
131,444 | We received a note from the security review team highlighting a CRUD/FLS vulnerability in our package and in the note it says there is a "Instances of SELECT vulnerability found across the application".
An example provided is shown below in a "with sharing" class:
>
> myAttachments = [SELECT name, id, parentid, Crea... | 2016/07/14 | [
"https://salesforce.stackexchange.com/questions/131444",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/11790/"
] | We experienced the same issue and found a workaround that works for us. Right click the excel file you downloaded, click on properties. On that screen hit the "unblock" button and then hit apply. You should be able to open the file now.
 | Is KB3115322 (Security Update for Excel 2010) installed? If so, uninstalling this update worked for us. I notified Salesforce about the problem so that either Salesforce or Microsoft fixes the issue, since the update is flagged as critical by Microsoft.
It's KB3115262 related to Excel 2013.
It's KB3115272 related to E... |
6,877,117 | I'm writing a small GUI program. Everything works except that I want to recognize mouse double-clicks. However, I can't recognize mouse clicks (as such) at all, though I can click buttons and select code from a list.
The following code is adapted from Ingo Maier's "The scala.swing package":
```
import scala.swing._
i... | 2011/07/29 | [
"https://Stackoverflow.com/questions/6877117",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/303624/"
] | Maybe that way?
```
object App extends SimpleSwingApplication {
lazy val ui = new Panel {
listenTo(mouse.clicks)
reactions += {
case e: MouseClicked =>
println("Mouse clicked at " + e.point)
}
}
def top = new MainFrame {
contents = ui
}
}
```
BTW, `SimpleGUIApplication` is depre... | The [MouseClicked](http://www.scala-lang.org/api/current/scala/swing/event/MouseClicked.html#clicks%3aInt) event has an attribute `clicks`, which should be `2` if it was a double-click. Have a look at [java.awt.event.MouseEvent](http://download.oracle.com/javase/6/docs/api/java/awt/event/MouseEvent.html) for the origin... |
29,044,357 | I have a `main activity A` -> `call activity B` -> `call activity C` -> `call activity D`.
Activity is called by `startActivity(intent).`
`Activity D` have a "Close" button.
How to I notify to `Activity A` when hit "close" button on `Activity D`?
Any help is appreciated. | 2015/03/14 | [
"https://Stackoverflow.com/questions/29044357",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1773083/"
] | Try this:
Use SharedPreference to store the status of button in Activity D.
In activity A under onResume() get the status of button from the SharedPreference. | ```
//* start the activity with enum defined int activity D to identify your activity
startActivityForResult(intent, DActivity.D_REQUEST_CODE);
//in your D activity define this
private static final int D_REQUEST_CODE = 1;
//* when the button is clicked to close in your D activity, call this in the button... |
29,044,357 | I have a `main activity A` -> `call activity B` -> `call activity C` -> `call activity D`.
Activity is called by `startActivity(intent).`
`Activity D` have a "Close" button.
How to I notify to `Activity A` when hit "close" button on `Activity D`?
Any help is appreciated. | 2015/03/14 | [
"https://Stackoverflow.com/questions/29044357",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1773083/"
] | Try this:
Use SharedPreference to store the status of button in Activity D.
In activity A under onResume() get the status of button from the SharedPreference. | ```
findViewById(R.id.button_close).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(this, Activity_A.class).setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK));
}
});
```
This will work if... |
29,044,357 | I have a `main activity A` -> `call activity B` -> `call activity C` -> `call activity D`.
Activity is called by `startActivity(intent).`
`Activity D` have a "Close" button.
How to I notify to `Activity A` when hit "close" button on `Activity D`?
Any help is appreciated. | 2015/03/14 | [
"https://Stackoverflow.com/questions/29044357",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1773083/"
] | ```
//* start the activity with enum defined int activity D to identify your activity
startActivityForResult(intent, DActivity.D_REQUEST_CODE);
//in your D activity define this
private static final int D_REQUEST_CODE = 1;
//* when the button is clicked to close in your D activity, call this in the button... | ```
findViewById(R.id.button_close).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(this, Activity_A.class).setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK));
}
});
```
This will work if... |
18,706,544 | I'm currently using the latest release of bootstrap 3.0.0
The issue is simple. In the jumbotron container I use how do i center align the text with the logo
I've been playing for hours, with col-md-\* and with little luck.
In bootstrap 2.3.2 I achieved the effect of centering everything in hero by using `.text-cent... | 2013/09/09 | [
"https://Stackoverflow.com/questions/18706544",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1408559/"
] | Here is another answer, that can center some content inside the actual div:
```
<head>
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet">
<style>
.centerfy img{
margin: 0 auto;
}
.centerfy{
... | why not offset the grid?
like this:
```
<div class="jumbotron">
<div class="container">
<div class="row well well-lg">
<div class="col-md-6 col-md-offset-3">
<h1 class="">Home of the</h1>
<div class="">
<img src="http://www.harrogatepoker.... |
18,706,544 | I'm currently using the latest release of bootstrap 3.0.0
The issue is simple. In the jumbotron container I use how do i center align the text with the logo
I've been playing for hours, with col-md-\* and with little luck.
In bootstrap 2.3.2 I achieved the effect of centering everything in hero by using `.text-cent... | 2013/09/09 | [
"https://Stackoverflow.com/questions/18706544",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1408559/"
] | why not offset the grid?
like this:
```
<div class="jumbotron">
<div class="container">
<div class="row well well-lg">
<div class="col-md-6 col-md-offset-3">
<h1 class="">Home of the</h1>
<div class="">
<img src="http://www.harrogatepoker.... | As of Bootstrap 3.3.6, my experience of centering text and logos within a Jumbotron comes simply by adding .text-center to your .container class element, along with .img-responsive and .center-block to your image element. I find no need to modify CSS classes or offset bootstrap regions.
Check out [my demo](http://www... |
18,706,544 | I'm currently using the latest release of bootstrap 3.0.0
The issue is simple. In the jumbotron container I use how do i center align the text with the logo
I've been playing for hours, with col-md-\* and with little luck.
In bootstrap 2.3.2 I achieved the effect of centering everything in hero by using `.text-cent... | 2013/09/09 | [
"https://Stackoverflow.com/questions/18706544",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1408559/"
] | Here is another answer, that can center some content inside the actual div:
```
<head>
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet">
<style>
.centerfy img{
margin: 0 auto;
}
.centerfy{
... | As of Bootstrap 3.3.6, my experience of centering text and logos within a Jumbotron comes simply by adding .text-center to your .container class element, along with .img-responsive and .center-block to your image element. I find no need to modify CSS classes or offset bootstrap regions.
Check out [my demo](http://www... |
33,248,694 | I am using pure javascript (no jquery or any other framework) for animations.
Which one's more optimized? Creating classes for transition like:
CSS class:
```
.all-div-has-this-class { transition: all 1s; }
.class1 { left: 0; }
.class2 { left: 30px; }
```
Javscript:
```
testdiv.className += " class... | 2015/10/20 | [
"https://Stackoverflow.com/questions/33248694",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3141303/"
] | Hoisting moves function declarations and variable declarations to the top, but doesn't move assignments.
Therefore, you first code becomes
```
var a;
function f() {
console.log(a.v);
}
f();
a = {v: 10};
```
So when `f` is called, `a` is still `undefined`.
However, the second code becomes
```
var a, f;
a = {v: 1... | It's due to the order. When you call the function in the first version, then the json isn't defined. So it tries to get property of undefined object.
So it is necessary to call the function after declaring the object. |
3,638,312 | When I use JTAG to load my C code to evaluation board, it loads successfully. However, when I executed my code from main(), I immediately got "CPU is not halted" error, followed by "No APB-AP found" error.
I was able to load and executed the USB-related code before I got this error.
I googled for it and use JTAG com... | 2010/09/03 | [
"https://Stackoverflow.com/questions/3638312",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/310567/"
] | One possibility: **watchdog**
If your hardware has a watchdog, then you must ensure that it does not reset the CPU when the JTAG wants to halt it. If the watchdog resets the CPU you would typically get a "CPU not halted" type of error you described.
If the CPU has an internal watchdog circuit, on some CPUs it is auto... | are you re-using the jtag lines as gpio lines and clobbering the jtags ability to communicate with the chip? I bricked a stellaris board that way. |
3,638,312 | When I use JTAG to load my C code to evaluation board, it loads successfully. However, when I executed my code from main(), I immediately got "CPU is not halted" error, followed by "No APB-AP found" error.
I was able to load and executed the USB-related code before I got this error.
I googled for it and use JTAG com... | 2010/09/03 | [
"https://Stackoverflow.com/questions/3638312",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/310567/"
] | One possibility: **watchdog**
If your hardware has a watchdog, then you must ensure that it does not reset the CPU when the JTAG wants to halt it. If the watchdog resets the CPU you would typically get a "CPU not halted" type of error you described.
If the CPU has an internal watchdog circuit, on some CPUs it is auto... | Make sure you have this line in code:
WatchdogStallEnable(WATCHDOG0\_BASE); // stop the watchdog when CPU stopped |
69,263,443 | I have extracted an email and save it to a text file that is not properly formatted. How to remove unwanted line spacing and paragraph spacing?
The file looks like this:
```
Hi Kim,
Hope you are fine.
Your Code is:
42483423
... | 2021/09/21 | [
"https://Stackoverflow.com/questions/69263443",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14364775/"
] | You can use `re.sub`:
```
import re
re.sub('\s\s+', '\n', s)
``` | If you have the entire text in a single string (`s`), you could do something like this:
```
formatted = "\n".join(filter(None, (x.strip() for x in s.split("\n"))))
```
That:
* splits the string into separate lines
* strips any leading and trailing whitespace
* filters out empty strings
* rejoins into a multi-line s... |
69,263,443 | I have extracted an email and save it to a text file that is not properly formatted. How to remove unwanted line spacing and paragraph spacing?
The file looks like this:
```
Hi Kim,
Hope you are fine.
Your Code is:
42483423
... | 2021/09/21 | [
"https://Stackoverflow.com/questions/69263443",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14364775/"
] | You can use `re.sub`:
```
import re
re.sub('\s\s+', '\n', s)
``` | We can read the input file line by line and ignore the rows which do not have anything but spaces and newlines. Finally, we output the filtered lines with a new line at the end.
```
with open("output_file.txt", "w") as fw:
with open("email.txt") as fr:
for row in fr:
r_s = row.strip()
... |
69,263,443 | I have extracted an email and save it to a text file that is not properly formatted. How to remove unwanted line spacing and paragraph spacing?
The file looks like this:
```
Hi Kim,
Hope you are fine.
Your Code is:
42483423
... | 2021/09/21 | [
"https://Stackoverflow.com/questions/69263443",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14364775/"
] | We can read the input file line by line and ignore the rows which do not have anything but spaces and newlines. Finally, we output the filtered lines with a new line at the end.
```
with open("output_file.txt", "w") as fw:
with open("email.txt") as fr:
for row in fr:
r_s = row.strip()
... | If you have the entire text in a single string (`s`), you could do something like this:
```
formatted = "\n".join(filter(None, (x.strip() for x in s.split("\n"))))
```
That:
* splits the string into separate lines
* strips any leading and trailing whitespace
* filters out empty strings
* rejoins into a multi-line s... |
514,828 | So my understanding of one scenario that ZFS addresses is where a RAID5 drive fails, and then during a rebuild it encountered some corrupt blocks of data and thus cannot restore that data. From Googling around I don't see this failure scenario demonstrated; either articles on a disk failure, or articles on healing data... | 2013/06/11 | [
"https://serverfault.com/questions/514828",
"https://serverfault.com",
"https://serverfault.com/users/15810/"
] | Mostly you get things right.
1. You can feel safe if only one drive fails out of raidz1 pool. If there is some corruption on one more drive some data would be lost forever.
2. You can feel safe if two out of 4 drives fail in raidz2 pool. If there is... and so on.
3. You can be mostly sure about that but for no reason.... | In general, focus on ZFS mirrors versus the parity RAID options. More flexible, more predictable failure scenarios and better expansion options.
If you're paranoid, triple mirrors are an option. But again, RAID is not a backup... You have some great snapshot and replication options in ZFS. Make use of them to augment... |
24,322,973 | I want to test database performance and understand how database throughput (in terms of transactions per second) depends on disk properties like IO latency and variation, write queue length, etc. Ideally, I need a simulator that can be mounted as a disk volume and has a RAM disk inside wrapped into a controller that al... | 2014/06/20 | [
"https://Stackoverflow.com/questions/24322973",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1128016/"
] | You declare globals inside function scope.
Try to declare them at class scope:
```
class Someclass{
function topFunction()
{
function makeMeGlobal($var)
{
global $a, $b;
$this->a = "a".$var;
$this->b = "b".$var;
}
makeMeGlobal(1); ... | you are creating the global variables inside the function, try creating them in the class scope rather than the function. that should work. |
69,152,970 | I am trying to generate CSV files from a set of records from Excel.
Column A is the file name and the rest of the columns are the data to write to the the file.
As of now, I am using `WriteLine`, but it doesn't work as expected:
[](https://i.sta... | 2021/09/12 | [
"https://Stackoverflow.com/questions/69152970",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13611682/"
] | ```
@echo off
for /F "skip=1" %%a in ('dir /B /S D:\TargetFolder\Settings.txt 2^>NUL') do (
del /Q /S D:\TargetFolder\Settings.txt >NUL
goto break
)
:break
```
The `for /F` loop process file names from `dir /S` command, but the first one is skipped (because `"skip=1"`switch), that is to say, if there are *more... | This batch file could be used for the task:
```
@echo off
setlocal EnableExtensions DisableDelayedExpansion
set "SettingsFile="
for /F "delims=" %%I in ('dir "D:\TargetFolder\Settings.txt" /A-D-L /B /S 2^>nul') do if not defined SettingsFile (set "SettingsFile=1") else (del "D:\TargetFolder\Settings.txt" /A /F /Q /S >... |
69,152,970 | I am trying to generate CSV files from a set of records from Excel.
Column A is the file name and the rest of the columns are the data to write to the the file.
As of now, I am using `WriteLine`, but it doesn't work as expected:
[](https://i.sta... | 2021/09/12 | [
"https://Stackoverflow.com/questions/69152970",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13611682/"
] | ```
@echo off
for /F "skip=1" %%a in ('dir /B /S D:\TargetFolder\Settings.txt 2^>NUL') do (
del /Q /S D:\TargetFolder\Settings.txt >NUL
goto break
)
:break
```
The `for /F` loop process file names from `dir /S` command, but the first one is skipped (because `"skip=1"`switch), that is to say, if there are *more... | This is not difficult if you can use the PowerShell already on your Windows system. If the count of files found is greater than zero, then each one is deleted. Otherwise, nothing happens. When you are confident that the correct files will be deleted, remove the `-WhatIf` from the `Remove-Item` command.
```
@powershell... |
10,992,077 | I have this fiddle and i would like to make it count the number of boxes that are selected.
Now it shows the numbers of the boxes.
Any idea how to do it??
```
$(function() {
$(".selectable").selectable({
filter: "td.cs",
stop: function(){
var result = $("#select-result").empty();
var r... | 2012/06/12 | [
"https://Stackoverflow.com/questions/10992077",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1421432/"
] | Just try this withih `stop()`:
```
$(".ui-selected").length
```
**[DEMO](http://jsfiddle.net/dw6Hf/46/)**
### NOTE
To get all selected div you need to place above code like following:
```
alert($(".ui-selected").length); // here to place
if ($(".ui-selected").length > 4) {
$(".ui-selected", this).each(fu... | ```
...
stop: function(){
console.log('you selected %d cells', $('.ui-selected').length);
...
``` |
52,772,908 | [](https://i.stack.imgur.com/PfIiJ.gif)
How do I develop the above gif image using Unity3D? | 2018/10/12 | [
"https://Stackoverflow.com/questions/52772908",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6008065/"
] | why don't you just use CSS to do the job?
```css
.uppercase{
text-transform: uppercase;
}
```
```html
<input class="uppercase" type="text" placeholder="type here">
``` | I know this is reeeeally late, but...
You could hook on to the (change) event instead of the (input) event. Your case changes won't execute until after the user leaves the field, but it will prevent the cursor from jumping.
You case changes will still execute if the user submits the form by pressing Enter while in th... |
52,772,908 | [](https://i.stack.imgur.com/PfIiJ.gif)
How do I develop the above gif image using Unity3D? | 2018/10/12 | [
"https://Stackoverflow.com/questions/52772908",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6008065/"
] | You can try this:
```
const yourControl = this.form.get('yourControlName');
yourControl.valueChanges.subscribe(() => {
yourControl.patchValue(yourControl.value.toUpperCase(), {emitEvent: false});
});
``` | I know this is reeeeally late, but...
You could hook on to the (change) event instead of the (input) event. Your case changes won't execute until after the user leaves the field, but it will prevent the cursor from jumping.
You case changes will still execute if the user submits the form by pressing Enter while in th... |
32,216,118 | I have a nested class structure where when I instantiate the top level class it instantiates a bunch of objects of other classes as attributes, and those instantiate a few other classes as their own attributes.
As I develop my code I want to override a class definition in a new module (this would be a good way for me... | 2015/08/26 | [
"https://Stackoverflow.com/questions/32216118",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5266259/"
] | Make the Card class an optional parameter to the Deck instance initializer that defaults to your initial Card class, and override it by passing a second parameter of your second Card class when you initialize a deck of your new cards.
**EDIT** Made names more Pythonic and made index a tuple as suggested by cyphase .
... | Patrick's answer is the recommended way. However, answering to your specific question, it is actually possible.
```
import module_1
class Card(object):
def __init__(self, suit, number):
self.suit = suit
self.number = number
self.index = [suit, number]
if __name__ == '__main__':
# Keep... |
32,216,118 | I have a nested class structure where when I instantiate the top level class it instantiates a bunch of objects of other classes as attributes, and those instantiate a few other classes as their own attributes.
As I develop my code I want to override a class definition in a new module (this would be a good way for me... | 2015/08/26 | [
"https://Stackoverflow.com/questions/32216118",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5266259/"
] | Make the Card class an optional parameter to the Deck instance initializer that defaults to your initial Card class, and override it by passing a second parameter of your second Card class when you initialize a deck of your new cards.
**EDIT** Made names more Pythonic and made index a tuple as suggested by cyphase .
... | To make collections of interrelated classes customizable, I would not hard-code a class choice in the code of the class. Instead, I would make use of class-variables to allow for the selection of an alternate class.
```
# module 1
class Card(object):
def __init__(self, suit, number):
self.suit = suit
... |
32,216,118 | I have a nested class structure where when I instantiate the top level class it instantiates a bunch of objects of other classes as attributes, and those instantiate a few other classes as their own attributes.
As I develop my code I want to override a class definition in a new module (this would be a good way for me... | 2015/08/26 | [
"https://Stackoverflow.com/questions/32216118",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5266259/"
] | Patrick's answer is the recommended way. However, answering to your specific question, it is actually possible.
```
import module_1
class Card(object):
def __init__(self, suit, number):
self.suit = suit
self.number = number
self.index = [suit, number]
if __name__ == '__main__':
# Keep... | To make collections of interrelated classes customizable, I would not hard-code a class choice in the code of the class. Instead, I would make use of class-variables to allow for the selection of an alternate class.
```
# module 1
class Card(object):
def __init__(self, suit, number):
self.suit = suit
... |
3,515,059 | I have some objects on the screen and would like to rotate only one of them. I tried using the glRotatef(...) function but turns out glRotatef(...) rotates all my objects (rotates the camera, maybe?).
How can I rotate only one?
I use openGL ES 1.1 | 2010/08/18 | [
"https://Stackoverflow.com/questions/3515059",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/110028/"
] | You need the rotation to be in effect only when the geometry you're interested in is being drawn.
```
... draw stuff ...
glPushMatrix();
glRotatef(angle, 0, 1, 0);
... draw rotated stuff ...
glPopMatrix();
... draw more stuff ...
``` | [Tutorial #4 from NeHe](http://nehe.gamedev.net/tutorial/rotation/14001/) shows how to do that precisely.
Also, you might want to take a look at this:
[OpenGL Rotation](https://stackoverflow.com/questions/23918/opengl-rotation) |
2,957,996 | Im stuck, Im setting a variable when someone clicks, then testing with if to see if the variable exists and doing something else. Its a simple script which Im probably overthinking, would love someone's thoughts.
```
$('.view-alternatives-btn').live('click', function() {
//$("#nc-alternate-wines").scrollTo();
//... | 2010/06/02 | [
"https://Stackoverflow.com/questions/2957996",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28454/"
] | You're *always* setting it to `null` when the button is clicked, so you'll never reach the `else if`...
You might instead use a global variable, or [`$.data()`](http://api.jquery.com/jQuery.data/) | you're declaring `showBtn` as a local variable, so it only exists until the end of your click handler. you need a global variable if you want set it to 1 the first click and be able to check for 1 on the second click. |
2,957,996 | Im stuck, Im setting a variable when someone clicks, then testing with if to see if the variable exists and doing something else. Its a simple script which Im probably overthinking, would love someone's thoughts.
```
$('.view-alternatives-btn').live('click', function() {
//$("#nc-alternate-wines").scrollTo();
//... | 2010/06/02 | [
"https://Stackoverflow.com/questions/2957996",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28454/"
] | You're *always* setting it to `null` when the button is clicked, so you'll never reach the `else if`...
You might instead use a global variable, or [`$.data()`](http://api.jquery.com/jQuery.data/) | First issue is that the variable `showBtn` is `local` to the function, so it gets re-defined each time you execute the script..
Secondly you set its value right before checking it .. so it will always be set to `null`..
since you bind it with the `live` method which implies dynamic elements, i would use the [`.data... |
2,957,996 | Im stuck, Im setting a variable when someone clicks, then testing with if to see if the variable exists and doing something else. Its a simple script which Im probably overthinking, would love someone's thoughts.
```
$('.view-alternatives-btn').live('click', function() {
//$("#nc-alternate-wines").scrollTo();
//... | 2010/06/02 | [
"https://Stackoverflow.com/questions/2957996",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28454/"
] | You're *always* setting it to `null` when the button is clicked, so you'll never reach the `else if`...
You might instead use a global variable, or [`$.data()`](http://api.jquery.com/jQuery.data/) | Awesome, thanks for the help everyone!
I got it working!
```
var showBtn = 1;
$('.view-alternatives-btn').live('click', function() {
//$("#nc-alternate-wines").scrollTo();
//$('.nc-remove').toggle();
if (showBtn == 1) {
$('.view-alternatives-btn img').attr("src","../images/wsj_hide_alternat... |
2,957,996 | Im stuck, Im setting a variable when someone clicks, then testing with if to see if the variable exists and doing something else. Its a simple script which Im probably overthinking, would love someone's thoughts.
```
$('.view-alternatives-btn').live('click', function() {
//$("#nc-alternate-wines").scrollTo();
//... | 2010/06/02 | [
"https://Stackoverflow.com/questions/2957996",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28454/"
] | `showBtn` is a local variable, so its value is not persisted across `click` events.
Move `var showBtn = null;` outside the `click` handler.
However, the best way to do this is to call jQuery's [`toggle` method](http://api.jquery.com/toggle). (Except that `toggle` cannot be used with `live`) | you're declaring `showBtn` as a local variable, so it only exists until the end of your click handler. you need a global variable if you want set it to 1 the first click and be able to check for 1 on the second click. |
2,957,996 | Im stuck, Im setting a variable when someone clicks, then testing with if to see if the variable exists and doing something else. Its a simple script which Im probably overthinking, would love someone's thoughts.
```
$('.view-alternatives-btn').live('click', function() {
//$("#nc-alternate-wines").scrollTo();
//... | 2010/06/02 | [
"https://Stackoverflow.com/questions/2957996",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28454/"
] | `showBtn` is a local variable, so its value is not persisted across `click` events.
Move `var showBtn = null;` outside the `click` handler.
However, the best way to do this is to call jQuery's [`toggle` method](http://api.jquery.com/toggle). (Except that `toggle` cannot be used with `live`) | First issue is that the variable `showBtn` is `local` to the function, so it gets re-defined each time you execute the script..
Secondly you set its value right before checking it .. so it will always be set to `null`..
since you bind it with the `live` method which implies dynamic elements, i would use the [`.data... |
2,957,996 | Im stuck, Im setting a variable when someone clicks, then testing with if to see if the variable exists and doing something else. Its a simple script which Im probably overthinking, would love someone's thoughts.
```
$('.view-alternatives-btn').live('click', function() {
//$("#nc-alternate-wines").scrollTo();
//... | 2010/06/02 | [
"https://Stackoverflow.com/questions/2957996",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28454/"
] | `showBtn` is a local variable, so its value is not persisted across `click` events.
Move `var showBtn = null;` outside the `click` handler.
However, the best way to do this is to call jQuery's [`toggle` method](http://api.jquery.com/toggle). (Except that `toggle` cannot be used with `live`) | Awesome, thanks for the help everyone!
I got it working!
```
var showBtn = 1;
$('.view-alternatives-btn').live('click', function() {
//$("#nc-alternate-wines").scrollTo();
//$('.nc-remove').toggle();
if (showBtn == 1) {
$('.view-alternatives-btn img').attr("src","../images/wsj_hide_alternat... |
2,957,996 | Im stuck, Im setting a variable when someone clicks, then testing with if to see if the variable exists and doing something else. Its a simple script which Im probably overthinking, would love someone's thoughts.
```
$('.view-alternatives-btn').live('click', function() {
//$("#nc-alternate-wines").scrollTo();
//... | 2010/06/02 | [
"https://Stackoverflow.com/questions/2957996",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28454/"
] | The variable will never exist when you click, because it is initialized inside the function, then lost when the function ends.
If you want to store it between clicks, create it outside the click handler.
```
var showBtn = null;
$('.view-alternatives-btn').live('click', function() {
//$("#nc-alternate-wines... | you're declaring `showBtn` as a local variable, so it only exists until the end of your click handler. you need a global variable if you want set it to 1 the first click and be able to check for 1 on the second click. |
2,957,996 | Im stuck, Im setting a variable when someone clicks, then testing with if to see if the variable exists and doing something else. Its a simple script which Im probably overthinking, would love someone's thoughts.
```
$('.view-alternatives-btn').live('click', function() {
//$("#nc-alternate-wines").scrollTo();
//... | 2010/06/02 | [
"https://Stackoverflow.com/questions/2957996",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28454/"
] | The variable will never exist when you click, because it is initialized inside the function, then lost when the function ends.
If you want to store it between clicks, create it outside the click handler.
```
var showBtn = null;
$('.view-alternatives-btn').live('click', function() {
//$("#nc-alternate-wines... | First issue is that the variable `showBtn` is `local` to the function, so it gets re-defined each time you execute the script..
Secondly you set its value right before checking it .. so it will always be set to `null`..
since you bind it with the `live` method which implies dynamic elements, i would use the [`.data... |
2,957,996 | Im stuck, Im setting a variable when someone clicks, then testing with if to see if the variable exists and doing something else. Its a simple script which Im probably overthinking, would love someone's thoughts.
```
$('.view-alternatives-btn').live('click', function() {
//$("#nc-alternate-wines").scrollTo();
//... | 2010/06/02 | [
"https://Stackoverflow.com/questions/2957996",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28454/"
] | The variable will never exist when you click, because it is initialized inside the function, then lost when the function ends.
If you want to store it between clicks, create it outside the click handler.
```
var showBtn = null;
$('.view-alternatives-btn').live('click', function() {
//$("#nc-alternate-wines... | Awesome, thanks for the help everyone!
I got it working!
```
var showBtn = 1;
$('.view-alternatives-btn').live('click', function() {
//$("#nc-alternate-wines").scrollTo();
//$('.nc-remove').toggle();
if (showBtn == 1) {
$('.view-alternatives-btn img').attr("src","../images/wsj_hide_alternat... |
9,597,122 | I have established a basic hadoop master slave cluster setup and able to run mapreduce programs (including python) on the cluster.
Now I am trying to run a python code which accesses a C binary and so I am using the subprocess module. I am able to use the hadoop streaming for a normal python code but when I include t... | 2012/03/07 | [
"https://Stackoverflow.com/questions/9597122",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1253987/"
] | Used simple id and hash token like Amazon for now... | Your site can absolutely be an OAuth server (to clients) and an OAuth consumer (of other APIs) at the same time, the same way that a hairdresser can also be the customer of another hairdresser. |
10,945,303 | I've started to learn PHP. `$_POST` variable is working in some of files, that I'm even able to post the data obtained through `$_POST` to database.
Strangely, `$_POST` is not working in few files. I mean its inconsistent.
Below is the html:
```
<html>
<title></title>
<head>
</head>
<body>
<form method="POST" actio... | 2012/06/08 | [
"https://Stackoverflow.com/questions/10945303",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/840352/"
] | $\_POST should not have any consistency issues. It could be many things:
**Possible Code Errors**
1. You misspelled a key name
2. Ensure that you actually set the values
3. Perhaps you are passing some variables via the URL www.example.com?var=x (GET) and then trying to reference `$_POST['var']` instead of `$_GET['va... | you have to check the name of field in HTML file ,which you are going to post.so,may be there is a problem in your field name in HTML file.look it carefully. |
68,336,882 | I have a Java servlet app running on Ubuntu 20.04.2 in Tomcat9 apache. The servlets are required to run using https transport. I am using a self signed certificate to enable https/TLS on Tomcat9.
The servlet attempts to upload a file using a form that includes an html input tag with type file.
On my local area networ... | 2021/07/11 | [
"https://Stackoverflow.com/questions/68336882",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10234883/"
] | This looks like a simple typo, you define
```
...
const productsDom = document.querySelector('.products-center')
...
```
but use
```
...
productsDOM.innerHTML = result;
...
```
in your function. Case sensitivity matters, so you get an error saying that `productsDOM` doesn't exist - it doesn't, `productsDom` exist... | The problem in your code was that you made a typo here
```
const productsDom = document.querySelector('.products-center')
// other code
productsDOM.innerHtml = result;
```
Like you see the decalaration of variable is in camel case but when You use this variable you write it with upper case on the end.
I have wrote... |
7,042,626 | I need to validate a number entered by a user in a textbox using JavaScript. The user should not be able to enter 0 as the first digit like 09, 08 etc, wherein he should be allowed to enter 90 , 9.07 etc..
Please help me.. I tried to use the below function but it disallows zero completely:
```
function AllowNonZer... | 2011/08/12 | [
"https://Stackoverflow.com/questions/7042626",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/622096/"
] | Use `charAt()` to control the placement of X at Y:
```
function checkFirst(str){
if(str.charAt(0) == "0"){
alert("Please enter a valid number other than '0'");
}
}
``` | Ty this:
```
Texbox1.Attributes.Add("onkeydown", "return AllowNonZeroIntegers(event)");
function AllowNonZeroIntegers(e) {
var val = e.keyCode;
var target = event.target ? event.target : event.srcElement;
if(target.value.length == 0 && val == 48) {
return false;
}
else if ((val >= 48 && va... |
1,003,105 | I'm trying to host a static website on Azure storage with a custom domain and HTTPS.
I have created a storage account, uploaded my files, and enabled static site hosting. The site works nicely from the `<foo>.web.core.windows.net` domain provided by Azure.
I have created a CDN endpoint for the site with the origin ho... | 2020/02/14 | [
"https://serverfault.com/questions/1003105",
"https://serverfault.com",
"https://serverfault.com/users/374091/"
] | You could automate certificates for the apex using Let's Encrypt, making the cert part a little more easy to handle.
Other than that, you basically need to host a 301 redirect somewhere that talks both HTTP and HTTPS to get this to work, no shortcut I'm afraid, especially if you're going to be using HSTS. There are s... | Edit: Sorry, I didn't read the question properly. I also wanted to avoid the overhead of managing a certificate but I didn't find a way out. You can actually buy SSL certs in Azure, which is actually provisioned by GoDaddy. I wonder if that can auto-renew.
I ended up buying a super cheap 4 years certificate from ssls.... |
1,003,105 | I'm trying to host a static website on Azure storage with a custom domain and HTTPS.
I have created a storage account, uploaded my files, and enabled static site hosting. The site works nicely from the `<foo>.web.core.windows.net` domain provided by Azure.
I have created a CDN endpoint for the site with the origin ho... | 2020/02/14 | [
"https://serverfault.com/questions/1003105",
"https://serverfault.com",
"https://serverfault.com/users/374091/"
] | You could automate certificates for the apex using Let's Encrypt, making the cert part a little more easy to handle.
Other than that, you basically need to host a 301 redirect somewhere that talks both HTTP and HTTPS to get this to work, no shortcut I'm afraid, especially if you're going to be using HSTS. There are s... | No you can't receive HTTPS requests unless you have the appropriate SSL certificate.
The redirect happens afterwards. |
59,956,586 | We have just upgraded a .NET 4.6 project to .NET 4.8 and this function
```
Private Function MeasureTextSize(ByVal text As String, ByVal fontFamily As FontFamily, ByVal fontStyle As FontStyle, ByVal fontWeight As FontWeight, ByVal fontStretch As FontStretch, ByVal fontSize As Double) As Size
Dim ft As New Formatte... | 2020/01/28 | [
"https://Stackoverflow.com/questions/59956586",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1956080/"
] | You have three options basically:
* Create a visual and use the `GetDpi` method to get a value for the `pixelsPerDip` parameter:
```
VisualTreeHelper.GetDpi(new Button()).PixelsPerDip
```
* Define a static value yourself, e.g. `1.25`.
* Ignore the warning and use the obsolete overload. | The warning message is telling you that the overload of `New FormattedText()` that you are using is obsolete, but there exists another overload of the same constructor which is not obsolete and you should use.
So, the solution you are looking for is to replace this:
```
New FormattedText( ... )
```
with this:
```
... |
36,386,362 | I'm about a couple weeks into learning Python.
With the guidance of user:' Lost' here on Stackoverflow I was able to figure out how to build a simple decoder program. He suggested a code and I changed a few things but what was important for me was that I understood what was happening. I understand 97% of this code exc... | 2016/04/03 | [
"https://Stackoverflow.com/questions/36386362",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3564925/"
] | You need to use a smaller fixed length buffer when reading from the socket, and then append the received data to a dynamically growing buffer (like a `std::string`, or a file) on each loop iteration. `recv()` tells you how many bytes were actually received, do not access more than that many bytes when accessing the buf... | recv return value is total size of receved data.
so you can know total data size, if your buffer is smaller than total data size there is 2 solutions. I guess...
1. allocate buffer on the heap. using like new, allcoc etc.
2. store received data to data structure(like circular queue, queue) while tatal data size is zero... |
47,629,259 | I'm looking for a way to fit all views with the right zoom which in my app's instance is one annotation and userlocation and the whole polyline which signifies the route connecting the annotation and the userlocation.
I have this code below which I call every time the map loads the mapview:
```
func mapViewDidFinishL... | 2017/12/04 | [
"https://Stackoverflow.com/questions/47629259",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5328686/"
] | This method will give you the bounds on the polyline no matter how short or long it is. You need an array of locations somewhere in your VC being locationList: [CLLocation] in this example.
```
func setCenterAndBounds() -> (center: CLLocationCoordinate2D, bounds: MGLCoordinateBounds)? {
let latitudes = locationLis... | If you know the zoom level use [Truf's centroid](http://turfjs.org/Docs#centroid) feature to grab the centroid of the polygon, then apply it to MGL [map.flyTo](https://www.mapbox.com/mapbox-gl-js/api/#map#flyto) like this:
```
var centroid = turf.centroid(myCoolFeatureGeometry);
map.flyTo({
center: cent... |
47,629,259 | I'm looking for a way to fit all views with the right zoom which in my app's instance is one annotation and userlocation and the whole polyline which signifies the route connecting the annotation and the userlocation.
I have this code below which I call every time the map loads the mapview:
```
func mapViewDidFinishL... | 2017/12/04 | [
"https://Stackoverflow.com/questions/47629259",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5328686/"
] | I have found this mapView methods which allow me to show all annotations.
```
let cameraOption = mapView.mapboxMap.camera(for: [CLLocationCoordinate2d], padding: UIEdegInsects.zero, bearing: nil, pitch: nil)
mapView.mapboxMap.setCamera(to: cameraOption)
```
Hope this will help someone and save a lot of time :). | If you know the zoom level use [Truf's centroid](http://turfjs.org/Docs#centroid) feature to grab the centroid of the polygon, then apply it to MGL [map.flyTo](https://www.mapbox.com/mapbox-gl-js/api/#map#flyto) like this:
```
var centroid = turf.centroid(myCoolFeatureGeometry);
map.flyTo({
center: cent... |
66,569,955 | I have the following data in a table:
```
GROUP1|FIELD
Z_12TXT|111
Z_2TXT|222
Z_31TBT|333
Z_4TXT|444
Z_52TNT|555
Z_6TNT|666
```
And I engineer in a field that removes the leading numbers after the '\_'
```
GROUP1|GROUP_ALIAS|FIELD
Z_12TXT|Z_TXT|111
Z_2TXT|Z_TXT|222
Z_31TBT|Z_TBT|333 <- to be removed
Z_4TXT|Z_TXT|44... | 2021/03/10 | [
"https://Stackoverflow.com/questions/66569955",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9682236/"
] | Here is one way, using analytic `count`. If you are not familiar with the `with` clause, read up on it - it's a very neat way to make your code readable. The way I declare column names in the `with` clause works since Oracle 11.2; if your version is older than that, the code needs to be re-written just slightly.
I als... | With Oracle you can use REGEXP\_REPLACE and analytic functions:
```
select Group1, group_alias, field
from (select group1, REGEXP_REPLACE(group1,'_\d+','_') group_alias, field,
count(*) over (PARTITION BY REGEXP_REPLACE(group1,'_\d+','_')) as count from test) a
where count > 1
```
[db-fiddle](https://d... |
55,228,206 | I followed threejs documentation in vuejs project to import image using :
```
texture.load( "./clouds" )
```
This code is not working, I have to import image using require :
```
texture.load( require( "./clouds.png" ) )
```
Now I want to use functions for sucess or error, so thank's to the internet i found that
... | 2019/03/18 | [
"https://Stackoverflow.com/questions/55228206",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10380588/"
] | Your problem is not related to VueJS /ThreeJs (again ^^), you should learn how to use `this` inside a callback, here is a E6 fix :
```
texture.load( require( "./clouds.png" ), t => this.onSuccess(t), e => this.onProgress(e), e => this.onError(e) )
```
<https://developer.mozilla.org/en-US/docs/Web/JavaScript/Referenc... | You can put your images in the "public" folder.
And then you can load your texture by
```
texture.load( "/clouds.png" )
``` |
70,558,800 | I want to change the content of a List with a class funcion.
The class takes an item from the list as a parameter. Now I want to change this item in the list.
How do I do that? I was only able to change the parameter in the instance but not the original list.
```
list = ["just", "an", "list"]
class Test():
def __... | 2022/01/02 | [
"https://Stackoverflow.com/questions/70558800",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17816849/"
] | `list[1]` is an expression that evaluates to `"an"` before `Test` is ever called. You have to pass the list and the index to modify separately, and let `blupp` make the assignment.
```
class Test:
def __init__(self, bla, x):
self.bla = bla
self.x = x
def blupp(self):
self.bla[self.x] =... | From what I understand, you are asking to change `"an"` to `"a"` in the list `["just", "an", "list"]` by calling a method called `blupp`. To achieve this we need to redefine `list[1]`
```
# Define The List
list = ["just", "an", "list"]
class Test:
def __init__(self, bla):
self.bla = bla
def blupp(se... |
11,521,178 | I have an EditText view which I am using to display information to the user. I am able to append a String and it works correctly with the following method:
```
public void PrintToUser(String text){
MAIN_DISPLAY.append("\n"+text);
}
```
The application is an RPG game which has battles, when the u... | 2012/07/17 | [
"https://Stackoverflow.com/questions/11521178",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2474385/"
] | My suggestion would be to use the method:
```
myTextView.setText(Hmtl.fromHtml(myString));
```
Where the myString could be of the format:
```
String myString = "Hello <font color=\'#ff0000\'>World</font>";
``` | Try to change
```
SpannableText.setSpan(new ForegroundColorSpan(Color.RED), CurrentText.length(), SpannableText.length(), 0);
```
on
```
SpannableText.setSpan(new ForegroundColorSpan(Color.RED), 0, SpannableText.length(), 0);
``` |
11,521,178 | I have an EditText view which I am using to display information to the user. I am able to append a String and it works correctly with the following method:
```
public void PrintToUser(String text){
MAIN_DISPLAY.append("\n"+text);
}
```
The application is an RPG game which has battles, when the u... | 2012/07/17 | [
"https://Stackoverflow.com/questions/11521178",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2474385/"
] | The following modifications to `PrintToUser()` should work..
```
public void PrintToUser(String text, int Colour){
...
...
Editable CurrentText = MAIN_DISPLAY.getText();
int oldLength = CurrentText.length();
CurrentText.append("\n" + text);
switch(Colour){
case 1:
CurrentText... | Try to change
```
SpannableText.setSpan(new ForegroundColorSpan(Color.RED), CurrentText.length(), SpannableText.length(), 0);
```
on
```
SpannableText.setSpan(new ForegroundColorSpan(Color.RED), 0, SpannableText.length(), 0);
``` |
7,863,936 | I'm using a BYTE variable in assembler to hold partial statements before they're copied to a permanent location. I'm trying to figure out how I could clear that after each new entry. I tried moving an empty variable into it, but that only replaced the first character space of the variable. Any help would be much apprec... | 2011/10/23 | [
"https://Stackoverflow.com/questions/7863936",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/974953/"
] | Use XOR instead of MOV. It's faster.
```
XOR r1, r1
``` | For a variable (assuming your var is stored in the memory):
```
mov var1, 0
```
For an array (as far as I got, that's what you are talking about?):
```
xor al, al
lea edi, var1
mov ecx, <var1_array_size>
cld
rep stosb
``` |
55,376,694 | So basically, i have a component "ShowTaskStatus" that will show how many tasks are open, how many closed and the total. This result i get by POSTing to my query server endpoint.
In my dashboard, ShowTaskStatus can be rendered multiple times and the results will be visible per row in a table. There can be up to 50 dif... | 2019/03/27 | [
"https://Stackoverflow.com/questions/55376694",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9460865/"
] | You need to move the code inside a method. one of the solutions could be as follows
```
package application;
public class Mathprocess {
public static void main(String[] args){
int numberOne = 15;
int numberTwo = 5;
int answerNumbers;
int ansSubtract = 0;
int ansDivide = 0... | Acording to definition
**class:**
a class describes the contents of the objects that belong to it: it describes an aggregate of data fields (called instance variables), and defines the operations (called methods).
a class contains 2 things instance variables and methods so if you want to put any thing other than that ... |
55,376,694 | So basically, i have a component "ShowTaskStatus" that will show how many tasks are open, how many closed and the total. This result i get by POSTing to my query server endpoint.
In my dashboard, ShowTaskStatus can be rendered multiple times and the results will be visible per row in a table. There can be up to 50 dif... | 2019/03/27 | [
"https://Stackoverflow.com/questions/55376694",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9460865/"
] | You need to move the code inside a method. one of the solutions could be as follows
```
package application;
public class Mathprocess {
public static void main(String[] args){
int numberOne = 15;
int numberTwo = 5;
int answerNumbers;
int ansSubtract = 0;
int ansDivide = 0... | You need to do the code inside a function like `package application;
```
public class Mathprocess {
int numberOne = 15;
int numberTwo = 5;
int answerNumbers;
int ansSubtract = 0;
int ansDivide = 0;
int ansMultiply = 0;
int ansAddition = 0;
public static void main(String[] args)
{
... |
55,376,694 | So basically, i have a component "ShowTaskStatus" that will show how many tasks are open, how many closed and the total. This result i get by POSTing to my query server endpoint.
In my dashboard, ShowTaskStatus can be rendered multiple times and the results will be visible per row in a table. There can be up to 50 dif... | 2019/03/27 | [
"https://Stackoverflow.com/questions/55376694",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9460865/"
] | Your problem is that in java every operation should be processed inside a method. Try something like this:
```
public void actions() { //declaring a method
ansAddition = numberOne + numberTwo;
String questionOne = numberOne + " + " + numberTwo + " = ";
ansMultiply = numberOne * numberTwo;
String quest... | Acording to definition
**class:**
a class describes the contents of the objects that belong to it: it describes an aggregate of data fields (called instance variables), and defines the operations (called methods).
a class contains 2 things instance variables and methods so if you want to put any thing other than that ... |
55,376,694 | So basically, i have a component "ShowTaskStatus" that will show how many tasks are open, how many closed and the total. This result i get by POSTing to my query server endpoint.
In my dashboard, ShowTaskStatus can be rendered multiple times and the results will be visible per row in a table. There can be up to 50 dif... | 2019/03/27 | [
"https://Stackoverflow.com/questions/55376694",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9460865/"
] | Your problem is that in java every operation should be processed inside a method. Try something like this:
```
public void actions() { //declaring a method
ansAddition = numberOne + numberTwo;
String questionOne = numberOne + " + " + numberTwo + " = ";
ansMultiply = numberOne * numberTwo;
String quest... | You need to do the code inside a function like `package application;
```
public class Mathprocess {
int numberOne = 15;
int numberTwo = 5;
int answerNumbers;
int ansSubtract = 0;
int ansDivide = 0;
int ansMultiply = 0;
int ansAddition = 0;
public static void main(String[] args)
{
... |
4,307,536 | I am building a string to detect whether filename makes sense or if they are completely random with PHP. I'm using regular expressions.
A valid filename = `sample-image-25.jpg`
A random filename = `46347sdga467234626.jpg`
I want to check if the filename makes sense or not, if not, I want to alert the user to fix the... | 2010/11/29 | [
"https://Stackoverflow.com/questions/4307536",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/148718/"
] | I'm not really sure that's possible because I'm not sure it's possible to define "random" in a way the computer will understand sufficiently well.
"umiarkowany" looks random, but it's a perfectly valid word I pulled off the Polish Wikipedia page for South Korea.
My advice is to think more deeply about why this design... | You need way to much work on that. You should make an huge array of most-used-word (like a dictionary) and check if most of the work inside the file (maybe separated by `-` or `_`) are there and it will have huge bugs.
Basically you will need of
* `explode()`
* `implode()`
* `array_search()` or `in_array()`
Take the... |
36,401,911 | **TL;DR**
When I'm importing my existing Cordova project in Visual Studio and run the application in my browser (through Ripple) I'll get the following error:
`PushPlugin.register - We seem to be missing some stuff :(`
**Full explanation:**
First of all apologies for the long post, I wanted to include as much i... | 2016/04/04 | [
"https://Stackoverflow.com/questions/36401911",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2664414/"
] | Just add a button at the top that deletes the selected rows. It looks like your using a `QTreeWidget`
```
def __init__(...)
...
self.deleteButton.clicked.connect(self.deleteRows)
def deleteRows(self):
items = self.tree.selectedItems()
for item in items:
# Code to delete items in database
s... | @Randomator, why not explain as if you're explaining to a beginner. Even I do not also understand what you're suggesting.
The guy wrote his codes, make corrections in his code so he can easily run the file |
37,481,473 | I'm setting the routes and I would like to pass a parameter to the delete method.
I've tried this which doesn't work:
```
namespace :admin do
resources :item do
get 'create_asset'
delete 'destroy_asset/:asset_id'
end
resources :asset
end
```
I've done that, but it doesn't look like the p... | 2016/05/27 | [
"https://Stackoverflow.com/questions/37481473",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1498118/"
] | I have log4net in my project from before I added identity server, it just works for me, I did not have to change anything that I had done.
so in my case I had got the nuget package created the table and updated my web.config to use log4net before I added identity server.
if you want a sample of my setup I can add it la... | I stumbled with this yesterday. The documentation I believe is not totally correct. The important thing to know is that identityserver code will detect a certain set of 3rd party logging libraries. Log4Net is one they recognize. So if you configure your app to use log4Net, then identityserver will detect this and start... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.