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 |
|---|---|---|---|---|---|
40,411,071 | The top third of my page, including a graphic and headline, shows up just fine in Firefox and Explorer, but does not appear in Chrome when accessed from my server. It does appear in Chrome when viewing the page as a file.
The graphic is defined in the CSS file as:
```css
/** adbox **/
#adbox {
background: #020a... | 2016/11/03 | [
"https://Stackoverflow.com/questions/40411071",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6411804/"
] | When you change the `left`/`top` property values on an element, it needs to have a position or else nothing happens, so ..
..give the `.animated` rule `position: relative;` and it will work fine.
Updated codepen: <http://codepen.io/anon/pen/gLOrwy>
*Side note, always put prefixed properties before non-prefixed in yo... | In addition to other answers, if you want to have the same `animation-timing-function` for all the browser, you should give the same for all in `.animated` CSS block.
They both should be either:
```
.animated {
animation: around 4s linear infinite;
-webkit-animation: around 4s linear infinite;
}
```
or
```... |
40,411,071 | The top third of my page, including a graphic and headline, shows up just fine in Firefox and Explorer, but does not appear in Chrome when accessed from my server. It does appear in Chrome when viewing the page as a file.
The graphic is defined in the CSS file as:
```css
/** adbox **/
#adbox {
background: #020a... | 2016/11/03 | [
"https://Stackoverflow.com/questions/40411071",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6411804/"
] | Just add to your paragraph. It's because it's not declared in relative that it doesn't move. (neither on firefox)
```
position: relative;
``` | In addition to other answers, if you want to have the same `animation-timing-function` for all the browser, you should give the same for all in `.animated` CSS block.
They both should be either:
```
.animated {
animation: around 4s linear infinite;
-webkit-animation: around 4s linear infinite;
}
```
or
```... |
47,413,175 | ```
"cassandra": {
"host": "1.1.1.1",
"portNo": "9042",
"keyspace": "good"
},
"postgres": {
"host": "2.2.2.2",
"portNo": "5432",
"database": "dude",
"username": "root",
"password": "something"
}
```
This is a part of the json file. I need to edit the hosts part with two different IPs u... | 2017/11/21 | [
"https://Stackoverflow.com/questions/47413175",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6011137/"
] | For proper json (your data above surrounded by `{}`) using `jq`:
```
$ jq '.|.cassandra.host="foo"' file.json
{
"cassandra": {
"host": "foo",
"portNo": "9042",
"keyspace": "good"
},
"postgres": {
"host": "2.2.2.2",
"portNo": "5432",
"database": "dude",
"username": "root",
"passwor... | You can use Json python package
```
import json
my_bytes_value = response.content
my_json = my_bytes_value.decode('utf8')
jsonResponse = json.loads(my_json)
resultCount = jsonResponse["cassandra"]
``` |
50,152,170 | I've got a matrix like this:
```
df = pd.DataFrame({'a':[7, 0, 3], 'b':[0, 4, 2], 'c':[3, 2, 9]})
df.index = list(df)
df
a b c
a 7 0 3
b 0 4 2
c 3 2 9
```
And I'd like to get something like this:
```
C1 C2 V
0 a a 7
1 a b 0
2 a c 3
3 b a 0
4 b b 4
5 b c... | 2018/05/03 | [
"https://Stackoverflow.com/questions/50152170",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7751504/"
] | ```
In [90]: df = df.stack().reset_index()
In [91]: df.columns = ['C1', 'C2', 'v']
In [92]: df
Out[92]:
C1 C2 v
0 a a 7
1 a b 0
2 a c 3
3 b a 0
4 b b 4
5 b c 2
6 c a 3
7 c b 2
8 c c 9
``` | You can use [`stack`](https://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.stack.html):
```
df.stack()
a a 7
b 0
c 3
b a 0
b 4
c 2
c a 3
b 2
c 9
dtype: int64
```
The `pd.set_option('display.multi_sparse', False)` will desparsen the series, showing t... |
50,152,170 | I've got a matrix like this:
```
df = pd.DataFrame({'a':[7, 0, 3], 'b':[0, 4, 2], 'c':[3, 2, 9]})
df.index = list(df)
df
a b c
a 7 0 3
b 0 4 2
c 3 2 9
```
And I'd like to get something like this:
```
C1 C2 V
0 a a 7
1 a b 0
2 a c 3
3 b a 0
4 b b 4
5 b c... | 2018/05/03 | [
"https://Stackoverflow.com/questions/50152170",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7751504/"
] | You can use [`stack`](https://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.stack.html):
```
df.stack()
a a 7
b 0
c 3
b a 0
b 4
c 2
c a 3
b 2
c 9
dtype: int64
```
The `pd.set_option('display.multi_sparse', False)` will desparsen the series, showing t... | To complete the answer and get the same output, I've added the following code:
```
vv = df.stack().reset_index()
vv.columns = ['C1', 'C2', 'V']
``` |
50,152,170 | I've got a matrix like this:
```
df = pd.DataFrame({'a':[7, 0, 3], 'b':[0, 4, 2], 'c':[3, 2, 9]})
df.index = list(df)
df
a b c
a 7 0 3
b 0 4 2
c 3 2 9
```
And I'd like to get something like this:
```
C1 C2 V
0 a a 7
1 a b 0
2 a c 3
3 b a 0
4 b b 4
5 b c... | 2018/05/03 | [
"https://Stackoverflow.com/questions/50152170",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7751504/"
] | ```
In [90]: df = df.stack().reset_index()
In [91]: df.columns = ['C1', 'C2', 'v']
In [92]: df
Out[92]:
C1 C2 v
0 a a 7
1 a b 0
2 a c 3
3 b a 0
4 b b 4
5 b c 2
6 c a 3
7 c b 2
8 c c 9
``` | YOu can use the stack() method followed by resetting the index and renaming the columns.
```
df = pd.DataFrame({'a':[7, 0, 3], 'b':[0, 4, 2], 'c':[3, 2, 9]})
df.index = list(df)
result = df.stack().reset_index().rename(columns={'level_0':'C1', 'level_1':'C2',0:'V'})
print(result)
C1 C2 V
0 a a 7
1 a b 0
2 ... |
50,152,170 | I've got a matrix like this:
```
df = pd.DataFrame({'a':[7, 0, 3], 'b':[0, 4, 2], 'c':[3, 2, 9]})
df.index = list(df)
df
a b c
a 7 0 3
b 0 4 2
c 3 2 9
```
And I'd like to get something like this:
```
C1 C2 V
0 a a 7
1 a b 0
2 a c 3
3 b a 0
4 b b 4
5 b c... | 2018/05/03 | [
"https://Stackoverflow.com/questions/50152170",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7751504/"
] | ```
In [90]: df = df.stack().reset_index()
In [91]: df.columns = ['C1', 'C2', 'v']
In [92]: df
Out[92]:
C1 C2 v
0 a a 7
1 a b 0
2 a c 3
3 b a 0
4 b b 4
5 b c 2
6 c a 3
7 c b 2
8 c c 9
``` | Use:
```
df = (df.rename_axis('C2')
.reset_index()
.melt('C2', var_name='C1', value_name='V')
.reindex(columns=['C1','C2','V']))
print (df)
C1 C2 V
0 a a 7
1 a b 0
2 a c 3
3 b a 0
4 b b 4
5 b c 2
6 c a 3
7 c b 2
8 c c 9
``` |
50,152,170 | I've got a matrix like this:
```
df = pd.DataFrame({'a':[7, 0, 3], 'b':[0, 4, 2], 'c':[3, 2, 9]})
df.index = list(df)
df
a b c
a 7 0 3
b 0 4 2
c 3 2 9
```
And I'd like to get something like this:
```
C1 C2 V
0 a a 7
1 a b 0
2 a c 3
3 b a 0
4 b b 4
5 b c... | 2018/05/03 | [
"https://Stackoverflow.com/questions/50152170",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7751504/"
] | ```
In [90]: df = df.stack().reset_index()
In [91]: df.columns = ['C1', 'C2', 'v']
In [92]: df
Out[92]:
C1 C2 v
0 a a 7
1 a b 0
2 a c 3
3 b a 0
4 b b 4
5 b c 2
6 c a 3
7 c b 2
8 c c 9
``` | To complete the answer and get the same output, I've added the following code:
```
vv = df.stack().reset_index()
vv.columns = ['C1', 'C2', 'V']
``` |
50,152,170 | I've got a matrix like this:
```
df = pd.DataFrame({'a':[7, 0, 3], 'b':[0, 4, 2], 'c':[3, 2, 9]})
df.index = list(df)
df
a b c
a 7 0 3
b 0 4 2
c 3 2 9
```
And I'd like to get something like this:
```
C1 C2 V
0 a a 7
1 a b 0
2 a c 3
3 b a 0
4 b b 4
5 b c... | 2018/05/03 | [
"https://Stackoverflow.com/questions/50152170",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7751504/"
] | YOu can use the stack() method followed by resetting the index and renaming the columns.
```
df = pd.DataFrame({'a':[7, 0, 3], 'b':[0, 4, 2], 'c':[3, 2, 9]})
df.index = list(df)
result = df.stack().reset_index().rename(columns={'level_0':'C1', 'level_1':'C2',0:'V'})
print(result)
C1 C2 V
0 a a 7
1 a b 0
2 ... | To complete the answer and get the same output, I've added the following code:
```
vv = df.stack().reset_index()
vv.columns = ['C1', 'C2', 'V']
``` |
50,152,170 | I've got a matrix like this:
```
df = pd.DataFrame({'a':[7, 0, 3], 'b':[0, 4, 2], 'c':[3, 2, 9]})
df.index = list(df)
df
a b c
a 7 0 3
b 0 4 2
c 3 2 9
```
And I'd like to get something like this:
```
C1 C2 V
0 a a 7
1 a b 0
2 a c 3
3 b a 0
4 b b 4
5 b c... | 2018/05/03 | [
"https://Stackoverflow.com/questions/50152170",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7751504/"
] | Use:
```
df = (df.rename_axis('C2')
.reset_index()
.melt('C2', var_name='C1', value_name='V')
.reindex(columns=['C1','C2','V']))
print (df)
C1 C2 V
0 a a 7
1 a b 0
2 a c 3
3 b a 0
4 b b 4
5 b c 2
6 c a 3
7 c b 2
8 c c 9
``` | To complete the answer and get the same output, I've added the following code:
```
vv = df.stack().reset_index()
vv.columns = ['C1', 'C2', 'V']
``` |
17,314,923 | When I try to compare my database project to an existing database it displays the following error:
>
> **The write operation failed. You must first acquire write access from DataSchemaModelController. E:\SRC SF\LIBRIDB\TePuna.scmp**
>
>
>
Sql Server Version is 2012 Dev Edition
This happened after I reinstalled v... | 2013/06/26 | [
"https://Stackoverflow.com/questions/17314923",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1974023/"
] | That's the signature of strtol():
```
long int strtol(const char *nptr, char **endptr, int base);
```
If `endptr` is not NULL, `strtol()` stores the address of the first invalid character in `*endptr`.
So you can simply compare `*endptr` to `nptr` afterwards and if it differs, `strtol()` has parsed the characters be... | Use the second parameter of strtol : it's a `char **`. It will be filled with the first invalid char: [take a look at this manpage](http://msdn.microsoft.com/en-us/library/w4z2wdyc%28v=vs.80%29.aspx).
Example:
```
#include <stdlib.h>
int main()
{
char *ptr = 0;
const char *str = "1234abcd";
printf(... |
37,534,939 | I am working on an application that we will be using to maintain our database dictionary (description of each column in each table) and would like to build a "Refresh" function that can go to the database and get the updated column list/names.
What I'm having issues with is when a column is renamed/moved, I would like... | 2016/05/30 | [
"https://Stackoverflow.com/questions/37534939",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4371837/"
] | Why don't you store the description in the column's description property. Then when the column is updated the developer would be responsible for updating this.
I wrote a web font-end to this over 10 years ago.... I could send you the code if you want? Looked like:
[ and would like to build a "Refresh" function that can go to the database and get the updated column list/names.
What I'm having issues with is when a column is renamed/moved, I would like... | 2016/05/30 | [
"https://Stackoverflow.com/questions/37534939",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4371837/"
] | Why don't you store the description in the column's description property. Then when the column is updated the developer would be responsible for updating this.
I wrote a web font-end to this over 10 years ago.... I could send you the code if you want? Looked like:
[ AS OBJECT_NAME
,c.NAME AS COLUMN_NAME
,t.NAME AS DATA_TYPE
,c.max_length AS MAX_LENGTH
FROM sys.all_columns c
INNER JOIN sys.types t ON t.system_type_id... |
4,909,517 | How do I detect what object or ID or the user right-clicked on? I'm using the onContextMenu to trigger a function but I don't know how to detect the target. | 2011/02/05 | [
"https://Stackoverflow.com/questions/4909517",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/388473/"
] | ```
<html>
<head>
<script type="text/javascript">
if (document.addEventListener) {
document.addEventListener('contextmenu', function(e) {
alert(e.target.nodeName); //or e.target.getAttribute('id')
e.preventDefault();
}, false);
} else {
document.attachEvent('onco... | Your handler should accept an event object as its parameter; the srcElement property of the event will be the object that triggered the event. |
4,909,517 | How do I detect what object or ID or the user right-clicked on? I'm using the onContextMenu to trigger a function but I don't know how to detect the target. | 2011/02/05 | [
"https://Stackoverflow.com/questions/4909517",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/388473/"
] | ```
<html>
<head>
<script type="text/javascript">
if (document.addEventListener) {
document.addEventListener('contextmenu', function(e) {
alert(e.target.nodeName); //or e.target.getAttribute('id')
e.preventDefault();
}, false);
} else {
document.attachEvent('onco... | As **Patrick** mentioned, you are receiving an event object as parameter to your onContentMenu callback function, where you can find the element triggered the event. I am using this code for cross-browser compatibility.
```
var oE = event.srcElement || event.originalTarget;
```
Note: originalTarget is Mozilla specif... |
9,647,553 | I wrote this simple class
```
class FibSequence
include Enumerable
def initialize(num)
@sequence = fib(num)
end
def fib(n)
vals = [1, 1]
return [1] if n == 1
return vals if n == 2
(n-2).times do
vals.push(vals[-1] + vals[-2])
end
... | 2012/03/10 | [
"https://Stackoverflow.com/questions/9647553",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/298022/"
] | Ruby's [`reject`](http://ruby-doc.org/core-1.9.3/Enumerable.html#method-i-reject) method does return the result as new array. You thus have to write
```
f = f.reject { |s| s.odd? }
```
. | `reject` doesn't modify the original array, but returns a modified copy. In your code the second statement returns an array with the odd entries removed, but you are discarding it, and then calling `.each` on the original unmodified array. You would need to act on the modified array returned by `reject`:
```
f = FibSe... |
22,735,898 | I try to connect MySql.And can use the PostMan get data from 192.168.56.1:8080/BookBankService/rest/api/getall and when I use chorme in genymotion browse 192.168.56.1:8080/ can see the tomcat page. But when I test my code the result return null. And when I use debugger I can see the postRequest url is 192.168.56.1t:808... | 2014/03/29 | [
"https://Stackoverflow.com/questions/22735898",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3396562/"
] | Android Http request must be executed in AsyncTask or Handler.
If none, then you'll try to get the result before the execute returned a value.
Take a look at a class i created.
[Java : a WebService asking embeded in a AsyncTask](https://stackoverflow.com/questions/22694400/java-a-webservice-asking-embeded-in-a-asynct... | where do you are testing your code?
If you're testing it in an emulator you have to replace "localhost" with "10.0.0.2" that is the IP address of the host machine.
For further info please read here: <http://developer.android.com/guide/faq/commontasks.html> - section "Referring to localhost from the emulated environment... |
27,727,385 | I am uploading multiple images via the code below (it works), but I can't insert these images' urls into my database. I tried a few thing but can't make it work. My code is inn't completed yet, so I didn't add controls (filetype, filesize, etc) yet.
index.php
```
<form action="upload.php" method="post" enctype="multi... | 2015/01/01 | [
"https://Stackoverflow.com/questions/27727385",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3210431/"
] | You need to index the `$_FILES` arrays. Also, you don't need to bind a parameter for the `NULL` value, use a `NULL` literal in the SQL (or you can just leave the value out entirely if this is the default in the schema).
```
upload_image = $sqli->prepare("INSERT INTO images(image_value, type, size) VALUES (NULL,?,?)");... | Make sure that your database column "image\_value" is a BLOB data type. Then try this code instead:
```
$null = NULL;
$upload_image = $sqli->prepare("INSERT INTO images(image_value, type, size) VALUES (?,?,?)");
$upload_image->bind_param("bss", $null, $_FILES['images']['type'], $_FILES['images']['size']);
$upload_imag... |
42,842,988 | I am aware of the memory alignment in structure but I am stumped at this implementation I came across in a project I am working on.
```
struct default {
uint8_t variable[((sizeof(struct dummyStructure) + 3) /4)*4] // Align on 32 bit boundary
}
```
It is more like a black box testing for me at the moment becaus... | 2017/03/16 | [
"https://Stackoverflow.com/questions/42842988",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1319819/"
] | ```
select id
,status
from (select status
,id
,@prev_status := @status
,@status := status
,@rn := case when @prev_status = status
then @rn +... | Use variables to enumerate the values and then some simple logic:
```
select id, status
from (select t.*,
(@rn := if(@s = status, @rn + 1,
if(@s := status, 1, 1)
)
) as rn
from t cross join
(select @rn := 0, @s := '') params
... |
40,577,809 | Is there any way to prevent the conversion from TINYINT(1) to boolean? Or perhaps convert it to int instead?
My TINYINT(1) column can have data such as 0, 1, 2, 3. But it is being converted to False, True, True, True respectively.
Here is the code that I currently use:
```
using (Cmd = new MySqlCommand())
{
Cmd.... | 2016/11/13 | [
"https://Stackoverflow.com/questions/40577809",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2279976/"
] | `TINYINT` is basically 1 `byte` in SQL Server, and its .Net equivalent is `byte`.
You can do this in multiple ways, have a look.
```
int x = (int)(byte) reader["column"];
int x = (byte) reader["column"];
int x = reader.GetByte(column);
```
Refere [SQL Server Data Type Mappings](https://msdn.microsoft.com/en-us/libr... | Though your posted code nowhere shows the actual conversion from `TINYINT(1)` to `boolean` as you mentioned but you can try casting it to `byte` like
```
(byte)rdr["columnwithtinyintdatatype"];
``` |
1,591,018 | I encounter many times with code where std::vector::clear() of class member of type std::vector is called in constructor and destructor.
I don't see why it's required:
1. **constructor** - the class member of type std::vector is empty by default, so no need to call clear().
2. **destructor** - the class member of ty... | 2009/10/19 | [
"https://Stackoverflow.com/questions/1591018",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/135960/"
] | Nope, you're right. Unless there is some additional business in the constructor (or constructor of the base classes) that require that, but the chances are very low...
**Later edit**
In case of destructor, one of the most common mistakes I saw is that some people assume that clear method will also call delete for vec... | Despite what what said so far, there's at least one scenario when an explicit call to `clear` in the destructor might be necessary.
Imagine the situation when the object being destroyed has several member subobjects, which require some specific order of destruction, i.e. the subobjects somehow depend on each other, a... |
1,591,018 | I encounter many times with code where std::vector::clear() of class member of type std::vector is called in constructor and destructor.
I don't see why it's required:
1. **constructor** - the class member of type std::vector is empty by default, so no need to call clear().
2. **destructor** - the class member of ty... | 2009/10/19 | [
"https://Stackoverflow.com/questions/1591018",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/135960/"
] | No, you're not missing anything. I suspect this is (harmless) voodoo programming, sort of like setting a pointer to null after freeing it, or randomly calling repaint/revalidate in GUI code. The programmer remembers that it helped with some sort of bug in the past and now adds it unnecessarily "just in case". Who knows... | Despite what what said so far, there's at least one scenario when an explicit call to `clear` in the destructor might be necessary.
Imagine the situation when the object being destroyed has several member subobjects, which require some specific order of destruction, i.e. the subobjects somehow depend on each other, a... |
1,591,018 | I encounter many times with code where std::vector::clear() of class member of type std::vector is called in constructor and destructor.
I don't see why it's required:
1. **constructor** - the class member of type std::vector is empty by default, so no need to call clear().
2. **destructor** - the class member of ty... | 2009/10/19 | [
"https://Stackoverflow.com/questions/1591018",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/135960/"
] | Nope, you're right. Unless there is some additional business in the constructor (or constructor of the base classes) that require that, but the chances are very low...
**Later edit**
In case of destructor, one of the most common mistakes I saw is that some people assume that clear method will also call delete for vec... | The only case I can think of where it would be useful is where the order of destruction matters and the destructor wants to ensure that the objects in the vector are destroyed before something else.
Of course, it is better to structure code to not require that; however, it is a conceivable reason. |
1,591,018 | I encounter many times with code where std::vector::clear() of class member of type std::vector is called in constructor and destructor.
I don't see why it's required:
1. **constructor** - the class member of type std::vector is empty by default, so no need to call clear().
2. **destructor** - the class member of ty... | 2009/10/19 | [
"https://Stackoverflow.com/questions/1591018",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/135960/"
] | Nope, you're right. Unless there is some additional business in the constructor (or constructor of the base classes) that require that, but the chances are very low...
**Later edit**
In case of destructor, one of the most common mistakes I saw is that some people assume that clear method will also call delete for vec... | **Of course one has to call clear() or resize(0) or the equivalent say (std::\_Destroy\_range(...) in the destructor before deallocating.**
Deallocation is done via allocator::deallocate **which does NOT run any destructors**. It just frees the memory.
clear() is equivalent to resize(0) which runs destructors on the ... |
1,591,018 | I encounter many times with code where std::vector::clear() of class member of type std::vector is called in constructor and destructor.
I don't see why it's required:
1. **constructor** - the class member of type std::vector is empty by default, so no need to call clear().
2. **destructor** - the class member of ty... | 2009/10/19 | [
"https://Stackoverflow.com/questions/1591018",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/135960/"
] | No, you're not missing anything. I suspect this is (harmless) voodoo programming, sort of like setting a pointer to null after freeing it, or randomly calling repaint/revalidate in GUI code. The programmer remembers that it helped with some sort of bug in the past and now adds it unnecessarily "just in case". Who knows... | 1. It's **COMPLETELY** unnessecary to clear the contents of an stl container in a constructor
2. It's unnessecary to clear the contents of an stl container in a destructor **UNLESS** the container contains a pointer. If the pointer has been created using **new**, it still needs to be **deleted** first. After that it st... |
1,591,018 | I encounter many times with code where std::vector::clear() of class member of type std::vector is called in constructor and destructor.
I don't see why it's required:
1. **constructor** - the class member of type std::vector is empty by default, so no need to call clear().
2. **destructor** - the class member of ty... | 2009/10/19 | [
"https://Stackoverflow.com/questions/1591018",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/135960/"
] | No, you're not missing anything. I suspect this is (harmless) voodoo programming, sort of like setting a pointer to null after freeing it, or randomly calling repaint/revalidate in GUI code. The programmer remembers that it helped with some sort of bug in the past and now adds it unnecessarily "just in case". Who knows... | **Of course one has to call clear() or resize(0) or the equivalent say (std::\_Destroy\_range(...) in the destructor before deallocating.**
Deallocation is done via allocator::deallocate **which does NOT run any destructors**. It just frees the memory.
clear() is equivalent to resize(0) which runs destructors on the ... |
1,591,018 | I encounter many times with code where std::vector::clear() of class member of type std::vector is called in constructor and destructor.
I don't see why it's required:
1. **constructor** - the class member of type std::vector is empty by default, so no need to call clear().
2. **destructor** - the class member of ty... | 2009/10/19 | [
"https://Stackoverflow.com/questions/1591018",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/135960/"
] | From the sound of things, the people who wrote that code were the ones who missed something. The only time it would make sense to call clear() in a ctor or dtor would be in the middle of some other code. For example, a ctor might read in some data, process it, then read in more data. In such a case, it's probably faste... | 1. It's **COMPLETELY** unnessecary to clear the contents of an stl container in a constructor
2. It's unnessecary to clear the contents of an stl container in a destructor **UNLESS** the container contains a pointer. If the pointer has been created using **new**, it still needs to be **deleted** first. After that it st... |
1,591,018 | I encounter many times with code where std::vector::clear() of class member of type std::vector is called in constructor and destructor.
I don't see why it's required:
1. **constructor** - the class member of type std::vector is empty by default, so no need to call clear().
2. **destructor** - the class member of ty... | 2009/10/19 | [
"https://Stackoverflow.com/questions/1591018",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/135960/"
] | From the sound of things, the people who wrote that code were the ones who missed something. The only time it would make sense to call clear() in a ctor or dtor would be in the middle of some other code. For example, a ctor might read in some data, process it, then read in more data. In such a case, it's probably faste... | **Of course one has to call clear() or resize(0) or the equivalent say (std::\_Destroy\_range(...) in the destructor before deallocating.**
Deallocation is done via allocator::deallocate **which does NOT run any destructors**. It just frees the memory.
clear() is equivalent to resize(0) which runs destructors on the ... |
1,591,018 | I encounter many times with code where std::vector::clear() of class member of type std::vector is called in constructor and destructor.
I don't see why it's required:
1. **constructor** - the class member of type std::vector is empty by default, so no need to call clear().
2. **destructor** - the class member of ty... | 2009/10/19 | [
"https://Stackoverflow.com/questions/1591018",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/135960/"
] | From the sound of things, the people who wrote that code were the ones who missed something. The only time it would make sense to call clear() in a ctor or dtor would be in the middle of some other code. For example, a ctor might read in some data, process it, then read in more data. In such a case, it's probably faste... | Nope, you're right. Unless there is some additional business in the constructor (or constructor of the base classes) that require that, but the chances are very low...
**Later edit**
In case of destructor, one of the most common mistakes I saw is that some people assume that clear method will also call delete for vec... |
1,591,018 | I encounter many times with code where std::vector::clear() of class member of type std::vector is called in constructor and destructor.
I don't see why it's required:
1. **constructor** - the class member of type std::vector is empty by default, so no need to call clear().
2. **destructor** - the class member of ty... | 2009/10/19 | [
"https://Stackoverflow.com/questions/1591018",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/135960/"
] | 1. It's **COMPLETELY** unnessecary to clear the contents of an stl container in a constructor
2. It's unnessecary to clear the contents of an stl container in a destructor **UNLESS** the container contains a pointer. If the pointer has been created using **new**, it still needs to be **deleted** first. After that it st... | **Of course one has to call clear() or resize(0) or the equivalent say (std::\_Destroy\_range(...) in the destructor before deallocating.**
Deallocation is done via allocator::deallocate **which does NOT run any destructors**. It just frees the memory.
clear() is equivalent to resize(0) which runs destructors on the ... |
4,316,535 | In my spring mvc 3.0 project I have a directory full of .jsp files (~150) which I want to put under spring's control.
Until now they where invoked by web.xml directly, without going thru the spring servlet.
From now, I want to put them all under spring's control to enjoy spring's goodies and make my project more uni... | 2010/11/30 | [
"https://Stackoverflow.com/questions/4316535",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/63051/"
] | In the case of a single JSP page you can use `<mvc:view-controller>`.
When you have many pages, you can write a catch-all controller like this:
```
@RequestMapping("/folder/{name}.jsp")
public ModelAndView catchAll(@PathVariable String viewName) {
return new ModelAndView("legacy/" + viewName);
}
```
However, it... | JSPs must not include any code that requires dependency injection. So don't do it.
If you really must, you can use
```
<%!
public void init() {
ApplicationContextUtils.getRequiredWebApplicationContext(
getServletContext()).getAutowireCapableBeanFactory()
.autowireBean(this);
... |
19,593 | Magnetic core, the primary form of computer memory from the mid-fifties to the early seventies or thereabouts, had the slightly awkward property that reading it erased it, so every time the CPU performed a read, it had to spend an extra few microseconds writing back the word it just read.
It just occurred to me that y... | 2021/04/13 | [
"https://retrocomputing.stackexchange.com/questions/19593",
"https://retrocomputing.stackexchange.com",
"https://retrocomputing.stackexchange.com/users/4274/"
] | Yes. Sort of.
The KDF9 had an accumulator stack (the 'nesting store' or nest) which was mostly made of fast (1µs read, 1.5µs write) core - the top 3 elements were in fast registers, with 16 words of core underneath.
Arithmetic was done on the top elements of the nest, popping off operands and pushing the result in th... | >
> Did any computers of that era, provide such a variant instruction?
>
>
>
Kind of, the /360 (1964) implemented a Test and Set (TS) instruction for process synchronisation. A byte addressed was read, tested for zero/not zero (\*1) and written back with all bits set (X'FF'). This write back was done not by the CP... |
473,854 | How can you convert wav files with MPeg layer 3 (MPeg3) audio format to PCM? | 2009/01/23 | [
"https://Stackoverflow.com/questions/473854",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | You could use [FFMPEG](http://ffmpeg.org) called from the command-line, like so:
```
ffmpeg -i source.wav -f wav -acodec pcm dest.wav
```
**NOTE**: Untested
Also, Windows binaries are available (I had some from another place as well) [here](http://ffdshow.faireal.net/mirror/ffmpeg/). | [LibMAD](http://www.underbit.com/products/mad/) could be what you are looking for. |
473,854 | How can you convert wav files with MPeg layer 3 (MPeg3) audio format to PCM? | 2009/01/23 | [
"https://Stackoverflow.com/questions/473854",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | You could use [FFMPEG](http://ffmpeg.org) called from the command-line, like so:
```
ffmpeg -i source.wav -f wav -acodec pcm dest.wav
```
**NOTE**: Untested
Also, Windows binaries are available (I had some from another place as well) [here](http://ffdshow.faireal.net/mirror/ffmpeg/). | If finding a windows binary of ffmpeg is too much work you can install [foobar2k](http://www.foobar2000.org/) and do it from there |
473,854 | How can you convert wav files with MPeg layer 3 (MPeg3) audio format to PCM? | 2009/01/23 | [
"https://Stackoverflow.com/questions/473854",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | [LibMAD](http://www.underbit.com/products/mad/) could be what you are looking for. | If finding a windows binary of ffmpeg is too much work you can install [foobar2k](http://www.foobar2000.org/) and do it from there |
17,953,057 | Consider the following query...
```
SELECT
*
,CAST(
(CurrentSampleDateTime - PreviousSampleDateTime) AS FLOAT
) * 24.0 * 60.0 AS DeltaMinutes
FROM
(
SELECT
C.SampleDateTime AS CurrentSampleDateTime
,C.Location
,C.CurrentValue
,(
SELEC... | 2013/07/30 | [
"https://Stackoverflow.com/questions/17953057",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1246051/"
] | OK - so I've done some more research and I have most of the answers now.
First of all, a correction. Addresses are not obtained via `PD` with DHCP. That is how DHCP servers obtain a network prefix to use for the DHCP clients they host. There is another DHCP server which deals with handing out these prefixes. Thus, `PD... | There is a third method to get an IPv6 address, manual configuration. |
31,074,172 | In short, Im trying to add two points on an elliptic curve y^2 = x^3 + ax + b over a finite field Fp. I already have a working implementation over R, but do not know how to alter the general formulas Ive found in order for them to sustain addition over Fp.
When P does not equal Q, and Z is the sum of P and Q:
```
... | 2015/06/26 | [
"https://Stackoverflow.com/questions/31074172",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4480166/"
] | There are a couple of issues here. First is that you have the wrong formulas: those are the formulas for the *negation* of the sum, or equivalently the third point of the curve that lies on the line through P and Q. Compare with the formula you linked to on Wikipedia, and you'll see that what you have for `Z.y` is the ... | You can check for reference pure python implementation of secp256k1, secp256r1 and ed25519 available at <https://github.com/user8547/fast-ecc-python>. |
62,761,167 | This is my Python code:
```
choice = (input("Are you signed up? (y/n) "))
print(choice)
while True:
if choice != "y" or choice != "n":
choice = (input("Are you signed up? (y/n) "))
print(choice)
else:
break
```
I want the program to keep asking the user for input until they input "y... | 2020/07/06 | [
"https://Stackoverflow.com/questions/62761167",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8648306/"
] | Looping through `$entries = array( $item_code, $item_name, $qty, $cost);` is not correct. You will have to loop through post data array of each item in invoice.
```
$query = "INSERT INTO `invoiceitems` (`client_id`, `item_date`, `item_code`, `item_name`, `qty`, `cost`, `added_user`) VALUES ";
$insert_rows = array();
/... | I would need to see more of the code on the html side but my first thought is that the name is of each entry is being duplicated with no iterration. For example. If it adds a new tag with name="name" and the next one you add it also gives it name="name" where it should be adding a iteration like name= "name1" . After t... |
36,741,164 | I write in C on arduino uno. The idea is to display pyramid from topographic view so variables that I have is the 'seedP' - middle value, the size of pyramid 'sizeP' - the amount of layers and how many letters are in a row - 'layer'.
The pyramid with those values in the code seedP = 6, sizeP = 3 would look like:
```
... | 2016/04/20 | [
"https://Stackoverflow.com/questions/36741164",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6229649/"
] | Nice puzzle, here is my suggestion:
```
#include <stdio.h>
#include <stdlib.h>
/* get the depth relative to the pyramids center, which is at origo */
int depth(int x, int y)
{
x = abs(x);
y = abs(y);
return x > y ? x : y;
}
/* walk from (-(size - 1), size - 1) along the x and y axis, and print
* the ce... | Since you are dealing with a serial output I suggest the implementation of a "frame buffer" object.
The pyramid (a square within the previous square) is written to the "frame buffer".
And finally, the "frame buffer" could be serialized to the serial port or to the text terminal.
Check out my suggestion:
```
#includ... |
68,731,933 | I have 90 rasters that I need to clip and ressample to match my template raster. Is there a way for me to "automize this"? (i.e., only have to run the process once, so that I can, for instance, leave it running overnight)
I know that the answer is probably a "loop", but I'm not sure how to do it because each original ... | 2021/08/10 | [
"https://Stackoverflow.com/questions/68731933",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15177164/"
] | Variations of this question have been asked a number of times. Here is one [example](https://stackoverflow.com/questions/53198261/multiple-input-filenames-as-output-filenames-in-r)
The general approach can be to get a vector with all your filenames, typically with `list.files`, and use that to make a vector of output ... | You can use `lapply`. You would need a vector of file names, maybe with
```
fn_list <- list.files("PATH", pattern="asc$")
```
Your workhorse function could look like
```
one_file <- function(fn, template, rastergrande) {
mau <- raster(fn)
intermedio <- crop(mau, rastergrande)
novoraster <- resample(interme... |
68,731,933 | I have 90 rasters that I need to clip and ressample to match my template raster. Is there a way for me to "automize this"? (i.e., only have to run the process once, so that I can, for instance, leave it running overnight)
I know that the answer is probably a "loop", but I'm not sure how to do it because each original ... | 2021/08/10 | [
"https://Stackoverflow.com/questions/68731933",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15177164/"
] | Variations of this question have been asked a number of times. Here is one [example](https://stackoverflow.com/questions/53198261/multiple-input-filenames-as-output-filenames-in-r)
The general approach can be to get a vector with all your filenames, typically with `list.files`, and use that to make a vector of output ... | Here you can work with a for loop or apply (lapply and mapply)
```
file_names <- list.files("PATH/", pattern = ".tif")
r_list <- lapply(file_names,raster)
rastergrande <- raster("PATH")
template <- raster("PATH")
intermedio <- list()
novoraster <- list()
```
Creating a vector with rasters names
```
rasternames <-... |
55,363,303 | I avoided using the UGC API on my recent migration to v2 of the LinkedIn API because this page of the docs (dated 2/4/2019, <https://learn.microsoft.com/en-us/linkedin/marketing/integrations/community-management/shares/ugc-post-api>) suggests that the UGC is an "upcoming" API, only available for uploading videos, but n... | 2019/03/26 | [
"https://Stackoverflow.com/questions/55363303",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3239059/"
] | I would do it this way:
**XSLT 1.0**
```
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/input">
<div class="output">
<xsl:apply-templates/>
</... | Your problem came from this template:
```
<xsl:template match="*[not(self::listable) and following-sibling::*[1][self::listable]]">
<xsl:call-template name="identity" />
<xsl:variable name="vFolUL"
select="key('kFollowingUL',generate-id())"/>
<xsl:if test="$vFolUL">
<ul>
... |
173,353 | My passport will expire soon and to get a new one I must go back to my home country, which I plan to do in few months. I have a valid Visa until 2023.
I would like to travel within the US before going back to my home country, but my only US ID would be the expired passport (I don't have a US driving license).
Wil... | 2022/04/28 | [
"https://travel.stackexchange.com/questions/173353",
"https://travel.stackexchange.com",
"https://travel.stackexchange.com/users/127964/"
] | >
> My passport will expire soon and to get a new one I must go back to my home country, which I plan to do in few months. I have a valid Visa until 2023.
> I would like to travel within the US before going back to my home country
>
>
>
Are you sure of this? Most countries issue passports to their citizens at cons... | One option is that the emergency travel document that your country's consulate can issue you would probably suffice as ID for airport security checkpoints. However, the emergency travel document probably has short validity, and the consulate would probably not issue it unless you are traveling to your country very soon... |
462,566 | I have some questions about logging, more specifically about setting it up and making sure it works.
The project I'm doing will use [Wicket](http://wicket.apache.org/), [Spring](http://www.springsource.org/) and [Hibernate](http://www.hibernate.org/). I know that Wicket and Hibernate uses Simple Logging Facade for Jav... | 2009/01/20 | [
"https://Stackoverflow.com/questions/462566",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Well SLF4J is just a facade, like commons logging, which means they still need something else to work. They permit library authors to not force users into having multiple logging library and configuration. Log4j and logback are regular logging libs.
See [here](https://stackoverflow.com/questions/354837/whats-up-with-l... | Here is how to redirect everything to SLF4J:
* remove `commons-logging.jar` from your classpath. If you are using Maven and have trouble getting rid of commons-logging, see [this](http://day-to-day-stuff.blogspot.com/2007/07/no-more-commons-logging.html).
* put `jcl-over-slf4j.jar` in your classpath (it comes in the S... |
60,443,780 | I have a function that does 2 things. I want to wait for the first line and then execute the second line. The first line is a simple assignment. How can I do this using async-await without making the first assignment a function. The following code gives me an error in line 2.
```
async eg(){
await a = b;
c.foc... | 2020/02/28 | [
"https://Stackoverflow.com/questions/60443780",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5619967/"
] | ```
eg() {
this.a = this.b;
setTimeout(() => {
this.$refs["c"].focus();
}, 1);
}
```
[Code Sandbox](https://codesandbox.io/s/vuejs-focus-ybbqf) | As user Al-un mentioned using `this.$nextTick();` solved it beautifully. |
38,161,259 | I have dumped a couple of variables I need to store in a json object as shown here-
```
def write_json():
variable = {}
variable['p_id'] = p_id
variable['s_id'] = s_id
variable['t_id'] = t_id
variable['b_start'] = b_start
variable['b_end'] = b_end
variable['wsp_after'] = wsp_after
varia... | 2016/07/02 | [
"https://Stackoverflow.com/questions/38161259",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4741431/"
] | Try the following code:
```
public static void animate(RecyclerView.ViewHolder holder, boolean direction) {
AnimatorSet animatorSet=new AnimatorSet();
ObjectAnimator animator_Y=ObjectAnimator.ofFloat(holder.itemView,"translationY",direction ? 100 : -100,0);
animator_Y.setDuration(1000);
ObjectAnimato... | use this its work for me :
```
public void slideAnimation(RecyclerView.ViewHolder holder, boolean animate) {
ObjectAnimator animatorY = ObjectAnimator.ofFloat(holder.itemView, "translationY", animate ? 40 : -40, 1f);
ObjectAnimator animatorX = ObjectAnimator.ofFloat(holder.itemView, "translationX", animate ? 4... |
38,161,259 | I have dumped a couple of variables I need to store in a json object as shown here-
```
def write_json():
variable = {}
variable['p_id'] = p_id
variable['s_id'] = s_id
variable['t_id'] = t_id
variable['b_start'] = b_start
variable['b_end'] = b_end
variable['wsp_after'] = wsp_after
varia... | 2016/07/02 | [
"https://Stackoverflow.com/questions/38161259",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4741431/"
] | Try the following code:
```
public static void animate(RecyclerView.ViewHolder holder, boolean direction) {
AnimatorSet animatorSet=new AnimatorSet();
ObjectAnimator animator_Y=ObjectAnimator.ofFloat(holder.itemView,"translationY",direction ? 100 : -100,0);
animator_Y.setDuration(1000);
ObjectAnimato... | try by maintaining reference of your row layout parent root xml tag into holder and use that instead of using holder.itemview. |
38,161,259 | I have dumped a couple of variables I need to store in a json object as shown here-
```
def write_json():
variable = {}
variable['p_id'] = p_id
variable['s_id'] = s_id
variable['t_id'] = t_id
variable['b_start'] = b_start
variable['b_end'] = b_end
variable['wsp_after'] = wsp_after
varia... | 2016/07/02 | [
"https://Stackoverflow.com/questions/38161259",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4741431/"
] | Try the following code:
```
public static void animate(RecyclerView.ViewHolder holder, boolean direction) {
AnimatorSet animatorSet=new AnimatorSet();
ObjectAnimator animator_Y=ObjectAnimator.ofFloat(holder.itemView,"translationY",direction ? 100 : -100,0);
animator_Y.setDuration(1000);
ObjectAnimato... | Sorry guys, I have not enabled the animations in my device.Make Window animation scale,Transition animation scale,Animator duration scale to 1x inside the developer options. |
4,237,247 | Are there any sites except google that provide a library that one can link directly to in your css file?
Like google-webfonts @font-face so that they're hosting, and no local files for you.
```
{
font-family: 'Yanone Kaffeesatz';
font-style: normal;
font-weight: 400;
src: url('http://themes.googleuser... | 2010/11/21 | [
"https://Stackoverflow.com/questions/4237247",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/268946/"
] | There is Typekit ( <http://typekit.com/> ), but it isn't free. | I use this one
<http://www.fontsquirrel.com/fontface> |
4,237,247 | Are there any sites except google that provide a library that one can link directly to in your css file?
Like google-webfonts @font-face so that they're hosting, and no local files for you.
```
{
font-family: 'Yanone Kaffeesatz';
font-style: normal;
font-weight: 400;
src: url('http://themes.googleuser... | 2010/11/21 | [
"https://Stackoverflow.com/questions/4237247",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/268946/"
] | There is Typekit ( <http://typekit.com/> ), but it isn't free. | There's actually a fairly large number of services like Typekit, just less well-know. However, like Typekit, almost all of them are paid services that require a monthly charge to use.
Smashing Magazine recently published a list of these services, which you can see here: [**Review of Popular Web Font Embedding Service... |
4,237,247 | Are there any sites except google that provide a library that one can link directly to in your css file?
Like google-webfonts @font-face so that they're hosting, and no local files for you.
```
{
font-family: 'Yanone Kaffeesatz';
font-style: normal;
font-weight: 400;
src: url('http://themes.googleuser... | 2010/11/21 | [
"https://Stackoverflow.com/questions/4237247",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/268946/"
] | There is Typekit ( <http://typekit.com/> ), but it isn't free. | If you're after Japanese fonts, M+ fonts allow hot-linking and have instructions on how to do so on their site:
<http://mplus-fonts.sourceforge.jp/webfonts/index-en.html>
The license is open & free:
>
> Unlimited permission is granted to
> use, copy, and distribute it, with or
> without modification, either
> c... |
4,237,247 | Are there any sites except google that provide a library that one can link directly to in your css file?
Like google-webfonts @font-face so that they're hosting, and no local files for you.
```
{
font-family: 'Yanone Kaffeesatz';
font-style: normal;
font-weight: 400;
src: url('http://themes.googleuser... | 2010/11/21 | [
"https://Stackoverflow.com/questions/4237247",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/268946/"
] | There is Typekit ( <http://typekit.com/> ), but it isn't free. | How about [google web font](https://www.google.com/fonts)?
[Here's](https://developers.google.com/fonts/docs/getting_started?hl=en) the tutorial on how to apply it.
And here's an example of it.
```html
<html>
<head>
<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Tangerine... |
4,237,247 | Are there any sites except google that provide a library that one can link directly to in your css file?
Like google-webfonts @font-face so that they're hosting, and no local files for you.
```
{
font-family: 'Yanone Kaffeesatz';
font-style: normal;
font-weight: 400;
src: url('http://themes.googleuser... | 2010/11/21 | [
"https://Stackoverflow.com/questions/4237247",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/268946/"
] | If you're after Japanese fonts, M+ fonts allow hot-linking and have instructions on how to do so on their site:
<http://mplus-fonts.sourceforge.jp/webfonts/index-en.html>
The license is open & free:
>
> Unlimited permission is granted to
> use, copy, and distribute it, with or
> without modification, either
> c... | I use this one
<http://www.fontsquirrel.com/fontface> |
4,237,247 | Are there any sites except google that provide a library that one can link directly to in your css file?
Like google-webfonts @font-face so that they're hosting, and no local files for you.
```
{
font-family: 'Yanone Kaffeesatz';
font-style: normal;
font-weight: 400;
src: url('http://themes.googleuser... | 2010/11/21 | [
"https://Stackoverflow.com/questions/4237247",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/268946/"
] | If you're after Japanese fonts, M+ fonts allow hot-linking and have instructions on how to do so on their site:
<http://mplus-fonts.sourceforge.jp/webfonts/index-en.html>
The license is open & free:
>
> Unlimited permission is granted to
> use, copy, and distribute it, with or
> without modification, either
> c... | There's actually a fairly large number of services like Typekit, just less well-know. However, like Typekit, almost all of them are paid services that require a monthly charge to use.
Smashing Magazine recently published a list of these services, which you can see here: [**Review of Popular Web Font Embedding Service... |
4,237,247 | Are there any sites except google that provide a library that one can link directly to in your css file?
Like google-webfonts @font-face so that they're hosting, and no local files for you.
```
{
font-family: 'Yanone Kaffeesatz';
font-style: normal;
font-weight: 400;
src: url('http://themes.googleuser... | 2010/11/21 | [
"https://Stackoverflow.com/questions/4237247",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/268946/"
] | If you're after Japanese fonts, M+ fonts allow hot-linking and have instructions on how to do so on their site:
<http://mplus-fonts.sourceforge.jp/webfonts/index-en.html>
The license is open & free:
>
> Unlimited permission is granted to
> use, copy, and distribute it, with or
> without modification, either
> c... | How about [google web font](https://www.google.com/fonts)?
[Here's](https://developers.google.com/fonts/docs/getting_started?hl=en) the tutorial on how to apply it.
And here's an example of it.
```html
<html>
<head>
<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Tangerine... |
10,743,756 | I have a template PDF that has a section that will be laid out like a table. The data will come from a query. So this table will be dynamic, number of rows unknown.
How do I accomplish this using ColdFusion? Is it a combination of creating a template using LiveCycle and creating this section so it is dynamic and then ... | 2012/05/24 | [
"https://Stackoverflow.com/questions/10743756",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/164484/"
] | I found the solution. It was in this forum:
<http://www.experts-exchange.com/Software/Server_Software/Web_Servers/ColdFusion/Q_26528588.html>
At bottom of thread was this:
2 key points
1. in cf you need to set overwritedata=”yes” in cfpdfform
2. the pdf needs to be a dynamic pdf.
hope this helps others. I don't ha... | Did you just want to create a PDF File? If so you also have to call in the style sheet after the cfdocument
```
<cfdocument
format="pdf"
filename = "pdf_file_path\#pdf_controlNum#_#pdf_ReportDate#.pdf"
overwrite = "yes"
marginBottom = ".2"
marginLeft = ".4"
marginRight = ".4"
marginTop = ".2">
<style type="text/css... |
35,901,247 | A few days ago, i was asked about this program's output:
```
public static void main(String[] args) {
// \u0022 is the Unicode escape for double quote (")
System.out.println("a\u0022.length() + \u0022b".length());
}
```
My first thought was this program should print the `a\u0022.length() + \u0022b` length, w... | 2016/03/09 | [
"https://Stackoverflow.com/questions/35901247",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1393484/"
] | >
> Why Unicode escapes doesn't behave as normal escape sequences?
>
>
>
Basically, they're processed at a different point in reading the input - in lexing rather than parsing, if I've got my terminology right. They're not escape sequences in character literals or string literals, they're escape sequences for the ... | Before the compiler actually translates the source to bytecode, the lexical translation phase will turn the statement:
```
System.out.println("a\u0022.length() + \u0022b".length());
```
into:
```
System.out.println("a".length() + "b".length());
```
Hence the result is 2.
Also see [this section about lexical tran... |
35,901,247 | A few days ago, i was asked about this program's output:
```
public static void main(String[] args) {
// \u0022 is the Unicode escape for double quote (")
System.out.println("a\u0022.length() + \u0022b".length());
}
```
My first thought was this program should print the `a\u0022.length() + \u0022b` length, w... | 2016/03/09 | [
"https://Stackoverflow.com/questions/35901247",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1393484/"
] | Before the compiler actually translates the source to bytecode, the lexical translation phase will turn the statement:
```
System.out.println("a\u0022.length() + \u0022b".length());
```
into:
```
System.out.println("a".length() + "b".length());
```
Hence the result is 2.
Also see [this section about lexical tran... | It is just funny that the following works (taken from the reference)
```
System.out.println("a\".length() + \"b".length());
```
but the following produces a compile error
```
System.out.println("a\\\u0022.length() + \\\u0022b".length());
```
On the second one, the compiler should reduce the `\` and the `"`, put t... |
35,901,247 | A few days ago, i was asked about this program's output:
```
public static void main(String[] args) {
// \u0022 is the Unicode escape for double quote (")
System.out.println("a\u0022.length() + \u0022b".length());
}
```
My first thought was this program should print the `a\u0022.length() + \u0022b` length, w... | 2016/03/09 | [
"https://Stackoverflow.com/questions/35901247",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1393484/"
] | >
> Why Unicode escapes doesn't behave as normal escape sequences?
>
>
>
Basically, they're processed at a different point in reading the input - in lexing rather than parsing, if I've got my terminology right. They're not escape sequences in character literals or string literals, they're escape sequences for the ... | It is just funny that the following works (taken from the reference)
```
System.out.println("a\".length() + \"b".length());
```
but the following produces a compile error
```
System.out.println("a\\\u0022.length() + \\\u0022b".length());
```
On the second one, the compiler should reduce the `\` and the `"`, put t... |
59,620,633 | I'm trying to understand the Gradient descent algorithm for linear regression.
The question is why we multiply by x(1) at the end of theta1 and don't do that at the end of theta0?
Thanks a lot!
[](https://i.stack.imgur.com/gie8S.png) | 2020/01/07 | [
"https://Stackoverflow.com/questions/59620633",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8497908/"
] | On quick review, there are few challenges I'm seeing.
The first is that the `ctripnumber` ("Load ID") is different between between the initial driver (`342135`) and any subsequent drivers (`34215S`). A quick fix there might be to update your `group by` and `outer join` statements to normalize the `ctripnumber` by e.g.... | I think that your logic can be simplified by using window function and filtering instead of aggregation. Consider:
```
select *
from (
select
t.*,
row_number() over(partition by LoadId order by DeliveryDate desc) rn,
sum(revenue) over(partition by LoadId) sum_revenue
from tripnumber t
)... |
59,620,633 | I'm trying to understand the Gradient descent algorithm for linear regression.
The question is why we multiply by x(1) at the end of theta1 and don't do that at the end of theta0?
Thanks a lot!
[](https://i.stack.imgur.com/gie8S.png) | 2020/01/07 | [
"https://Stackoverflow.com/questions/59620633",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8497908/"
] | On quick review, there are few challenges I'm seeing.
The first is that the `ctripnumber` ("Load ID") is different between between the initial driver (`342135`) and any subsequent drivers (`34215S`). A quick fix there might be to update your `group by` and `outer join` statements to normalize the `ctripnumber` by e.g.... | I would recommend using a CTE (Common Table Expression) for this. The CTE will give the first result set, then the query below it filters it down again to the rows you want.
Since you did not provide a sample script, this code is untested:
```
;with BaseQuery as
(
select
tn.ctripnumber as 'Load ID',
... |
20,071,713 | I've been trying to achieve this for hours and I'm not quite getting it to work, so here it goes nothing:
I have this site:[Site HomePage](http://i.stack.imgur.com/sH5g3.jpg)
composed by this HTML elements:
```
<div id="headerwrap">
<div id="header">
</div>
</div>
<div id="navigationwrap... | 2013/11/19 | [
"https://Stackoverflow.com/questions/20071713",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2957016/"
] | Oh fun, an excuse to have a play with **[CSS Media Queries](http://css-tricks.com/css-media-queries/)**!
**DEMO: <http://jsfiddle.net/Vn2QY/1/>**
CSS
---
```
#midcontentwrap {
min-width: 500px;
}
#leftwrap, #midwrap, #rightwrap {
float: left;
min-height: 400px;
}
#leftwrap, #rightwrap {
min-width: ... | >
> To solve this problem....use `%` value for all `div id` width
>
>
> |
20,071,713 | I've been trying to achieve this for hours and I'm not quite getting it to work, so here it goes nothing:
I have this site:[Site HomePage](http://i.stack.imgur.com/sH5g3.jpg)
composed by this HTML elements:
```
<div id="headerwrap">
<div id="header">
</div>
</div>
<div id="navigationwrap... | 2013/11/19 | [
"https://Stackoverflow.com/questions/20071713",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2957016/"
] | [Try this DEMO](http://jsfiddle.net/Godinall/qMZMT/1/)
I'm guessing your want to get a fluid/responsive design. This should work for you.
Use `float:left and min-width` | >
> To solve this problem....use `%` value for all `div id` width
>
>
> |
20,071,713 | I've been trying to achieve this for hours and I'm not quite getting it to work, so here it goes nothing:
I have this site:[Site HomePage](http://i.stack.imgur.com/sH5g3.jpg)
composed by this HTML elements:
```
<div id="headerwrap">
<div id="header">
</div>
</div>
<div id="navigationwrap... | 2013/11/19 | [
"https://Stackoverflow.com/questions/20071713",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2957016/"
] | Yep, you're going to want to use media queries. Here's a [JSFiddle](http://jsfiddle.net/UeZZf/1/) of it in action.
Resize the display iFrame of the Fiddle back and forth past 500px width to view the results. I spruced up your HTML a little, too, to make it more modern (sorry):
HTML:
```
<section class='contentWrap'>... | >
> To solve this problem....use `%` value for all `div id` width
>
>
> |
20,071,713 | I've been trying to achieve this for hours and I'm not quite getting it to work, so here it goes nothing:
I have this site:[Site HomePage](http://i.stack.imgur.com/sH5g3.jpg)
composed by this HTML elements:
```
<div id="headerwrap">
<div id="header">
</div>
</div>
<div id="navigationwrap... | 2013/11/19 | [
"https://Stackoverflow.com/questions/20071713",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2957016/"
] | Yep, you're going to want to use media queries. Here's a [JSFiddle](http://jsfiddle.net/UeZZf/1/) of it in action.
Resize the display iFrame of the Fiddle back and forth past 500px width to view the results. I spruced up your HTML a little, too, to make it more modern (sorry):
HTML:
```
<section class='contentWrap'>... | Oh fun, an excuse to have a play with **[CSS Media Queries](http://css-tricks.com/css-media-queries/)**!
**DEMO: <http://jsfiddle.net/Vn2QY/1/>**
CSS
---
```
#midcontentwrap {
min-width: 500px;
}
#leftwrap, #midwrap, #rightwrap {
float: left;
min-height: 400px;
}
#leftwrap, #rightwrap {
min-width: ... |
20,071,713 | I've been trying to achieve this for hours and I'm not quite getting it to work, so here it goes nothing:
I have this site:[Site HomePage](http://i.stack.imgur.com/sH5g3.jpg)
composed by this HTML elements:
```
<div id="headerwrap">
<div id="header">
</div>
</div>
<div id="navigationwrap... | 2013/11/19 | [
"https://Stackoverflow.com/questions/20071713",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2957016/"
] | Yep, you're going to want to use media queries. Here's a [JSFiddle](http://jsfiddle.net/UeZZf/1/) of it in action.
Resize the display iFrame of the Fiddle back and forth past 500px width to view the results. I spruced up your HTML a little, too, to make it more modern (sorry):
HTML:
```
<section class='contentWrap'>... | [Try this DEMO](http://jsfiddle.net/Godinall/qMZMT/1/)
I'm guessing your want to get a fluid/responsive design. This should work for you.
Use `float:left and min-width` |
59,558,530 | Per documentation [Initialize the SDK](https://firebase.google.com/docs/admin/setup?authuser=4#initialize-sdk) I will need to generate `New Private Key` and feed that to the init process at the service.
```
var admin = require("firebase-admin");
var serviceAccount = require("New Private Key.json");
admin.initialize... | 2020/01/02 | [
"https://Stackoverflow.com/questions/59558530",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/456157/"
] | By implementing the Firebase Authentication you can achieve what you want to do:
First you will need to setup [Firebase Authentication](https://firebase.google.com/docs/auth) in your project and service.
1. Enable in the Cloud IAM API for your project.
2. Authorize the Cloud Run credentials to sign tokens. (This can ... | Tested instance and it seems running from Cloud Run env SDK was able pull `admin.credential.applicationDefault()`! Amazing how it was simplified! Rolling all my apps to Cloud Run!!! Having experience with Azure/AWS, GCP by far too friendly! Kuddos to GCP! |
9,487 | In the various listings I can find online, this move is described as "spear hand". But as I've seen it taught, it also involves moving the left hand downward with the palm facing the ground before the right hand "spears" over the top of it.
This is, of course, different than I've seen spearhand taught during drills, w... | 2019/10/21 | [
"https://martialarts.stackexchange.com/questions/9487",
"https://martialarts.stackexchange.com",
"https://martialarts.stackexchange.com/users/10157/"
] | It's important to realize where these forms came from and what the original purpose was. ITF Taekwondo forms are known affectionately as the "blender" forms, because they take fragments of shotokan karate kata consisting of 1 to 3 moves and rearrange them into the various hyung of ITF Taekwondo. The origin of Taekwondo... | I, too, was taught the strange stab into the belly, which could then be used to rip out the spleen, kidney, or whatever else you might find in the gut. And for a long time, I never thought to ask what if the guy is wearing a leather jacket. And so, for years, we practiced the spearheand - always in the air, never again... |
9,487 | In the various listings I can find online, this move is described as "spear hand". But as I've seen it taught, it also involves moving the left hand downward with the palm facing the ground before the right hand "spears" over the top of it.
This is, of course, different than I've seen spearhand taught during drills, w... | 2019/10/21 | [
"https://martialarts.stackexchange.com/questions/9487",
"https://martialarts.stackexchange.com",
"https://martialarts.stackexchange.com/users/10157/"
] | It's important to realize where these forms came from and what the original purpose was. ITF Taekwondo forms are known affectionately as the "blender" forms, because they take fragments of shotokan karate kata consisting of 1 to 3 moves and rearrange them into the various hyung of ITF Taekwondo. The origin of Taekwondo... | There is a much simpler answer to this question.
The left hand is trapping: pulling down his guard, or redirecting his arm. The right hand is indeed striking with the fingertips, but to the throat or eyes, where it will do some damage.
The solar plexus target comes from Funakoshi's *Karate do Kyohan*. There are seve... |
9,487 | In the various listings I can find online, this move is described as "spear hand". But as I've seen it taught, it also involves moving the left hand downward with the palm facing the ground before the right hand "spears" over the top of it.
This is, of course, different than I've seen spearhand taught during drills, w... | 2019/10/21 | [
"https://martialarts.stackexchange.com/questions/9487",
"https://martialarts.stackexchange.com",
"https://martialarts.stackexchange.com/users/10157/"
] | I, too, was taught the strange stab into the belly, which could then be used to rip out the spleen, kidney, or whatever else you might find in the gut. And for a long time, I never thought to ask what if the guy is wearing a leather jacket. And so, for years, we practiced the spearheand - always in the air, never again... | There is a much simpler answer to this question.
The left hand is trapping: pulling down his guard, or redirecting his arm. The right hand is indeed striking with the fingertips, but to the throat or eyes, where it will do some damage.
The solar plexus target comes from Funakoshi's *Karate do Kyohan*. There are seve... |
15,686,052 | I've got about 300 `path` elements in an SVG, all with different outlines. I am trying to work out if there's a way to make them inherit their `stroke` and `stroke-width` properties from one central place, so that I can change that stroke in one place (using JavaScript) and all the paths will automatically inherit the ... | 2013/03/28 | [
"https://Stackoverflow.com/questions/15686052",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/414825/"
] | `<use>` doesn't have a d attribute, you can't use it as a pseudo path as you are doing. There's some examples of how to use `<use>` [here](http://www.w3.org/Graphics/SVG/IG/resources/svgprimer.html#use)
As you your main problem though, that's exactly what CSS was invented for. Just create the paths normally as `<path>... | Just to give a quick and dirty example in addition to Robert Longsons reply: Something like this will do the job:
```
<svg xmlns="http://www.w3.org/2000/svg" onclick="
document.getElementById('dynamicStyle')
.textContent='line{stroke:green;stroke-width:10}'">
<style type="text/css" id="dynamicStyle">
li... |
11,663,184 | [Demo](http://tinkerbin.com/JeCiz2uq)
Basically, I'm trying to setup something that looks like this:

However, my code for some reason isn't working. Fist of all, in teh tinkerbin, my arrow image isn't even showing. It works fine on my computer thou... | 2012/07/26 | [
"https://Stackoverflow.com/questions/11663184",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1447908/"
] | 1st of all your arrow was isn't showing because you were using `margin-left:140px;` in `#arrow_center`
See my [**Fiddle**](http://jsfiddle.net/vFZF2/1/)
Just with 1 `<div>` **[Fiddle](http://jsfiddle.net/vFZF2/4/)** | ```
#answers {
width:220px;
height:50px;
background-color:#DDDDDD;
border-top:1px solid black;
border-bottom:1px solid black;
margin-top:20px;
}
#arrowcenter {
width:75px;
height:31px;
background-image:url('http://fortmovies.com/brazil/arrow.png');
background-position:0 50%;
background-repeat:no-repeat;
height:100%;
f... |
11,663,184 | [Demo](http://tinkerbin.com/JeCiz2uq)
Basically, I'm trying to setup something that looks like this:

However, my code for some reason isn't working. Fist of all, in teh tinkerbin, my arrow image isn't even showing. It works fine on my computer thou... | 2012/07/26 | [
"https://Stackoverflow.com/questions/11663184",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1447908/"
] | Just remove `margin-left:-140px;` and add `float:left;` to `#arrowcenter`
**[Working Demo](http://tinkerbin.com/cxAJaKCQ)** | ```
Little bit changes that i made in just in your css as follow, and it is working...
#answers {
width:220px;
height:50px;
background-color:#DDDDDD;
border-top:1px solid black;
border-bottom:1px solid black;
margin-top:20px;
}
#arrowcenter {
width:120px;
height:31px; float:left;
background-image:url('http://for... |
11,663,184 | [Demo](http://tinkerbin.com/JeCiz2uq)
Basically, I'm trying to setup something that looks like this:

However, my code for some reason isn't working. Fist of all, in teh tinkerbin, my arrow image isn't even showing. It works fine on my computer thou... | 2012/07/26 | [
"https://Stackoverflow.com/questions/11663184",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1447908/"
] | Just remove `margin-left:-140px;` and add `float:left;` to `#arrowcenter`
**[Working Demo](http://tinkerbin.com/cxAJaKCQ)** | ***[Working Demo](http://tinkerbin.com/xBzHqAyi)***
OR
Use this CSS
```
#answers
{
width: 220px;
height: 50px;
background-color: #DDDDDD;
border-top: 1px solid black;
border-bottom: 1px solid black;
margin-top: 20px;
}
#arrowcenter
{
width: ... |
11,663,184 | [Demo](http://tinkerbin.com/JeCiz2uq)
Basically, I'm trying to setup something that looks like this:

However, my code for some reason isn't working. Fist of all, in teh tinkerbin, my arrow image isn't even showing. It works fine on my computer thou... | 2012/07/26 | [
"https://Stackoverflow.com/questions/11663184",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1447908/"
] | Just remove `margin-left:-140px;` and add `float:left;` to `#arrowcenter`
**[Working Demo](http://tinkerbin.com/cxAJaKCQ)** | What's the purpose of `margin-left:-140px;` it moves `#arrowcenter` off-screen remove it and you'll be fine.
Also set both divs to `display:inline-block` and vertical align appropriately
```css
#arrowcenter {
...
display:inline-block;
vertical-align:middle;
}
#answerstext {
...
display:inline-b... |
11,663,184 | [Demo](http://tinkerbin.com/JeCiz2uq)
Basically, I'm trying to setup something that looks like this:

However, my code for some reason isn't working. Fist of all, in teh tinkerbin, my arrow image isn't even showing. It works fine on my computer thou... | 2012/07/26 | [
"https://Stackoverflow.com/questions/11663184",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1447908/"
] | This answer is inspired by Mr. Alien's [**answer**](https://stackoverflow.com/a/11663333/1195891) of using less markup (`id` optional).
Reference: [**jsFiddle**](http://jsfiddle.net/EDXS6/)
HTML:
```
<span>Masculino</span>
```
CSS:
```
span {
background-image:url('http://fortmovies.com/brazil/arrow.png'); /*... | ```
#answers {
width:220px;
height:50px;
background-color:#DDDDDD;
border-top:1px solid black;
border-bottom:1px solid black;
margin-top:20px;
}
#arrowcenter {
width:75px;
height:31px;
background-image:url('http://fortmovies.com/brazil/arrow.png');
background-position:0 50%;
background-repeat:no-repeat;
height:100%;
f... |
11,663,184 | [Demo](http://tinkerbin.com/JeCiz2uq)
Basically, I'm trying to setup something that looks like this:

However, my code for some reason isn't working. Fist of all, in teh tinkerbin, my arrow image isn't even showing. It works fine on my computer thou... | 2012/07/26 | [
"https://Stackoverflow.com/questions/11663184",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1447908/"
] | Just remove `margin-left:-140px;` and add `float:left;` to `#arrowcenter`
**[Working Demo](http://tinkerbin.com/cxAJaKCQ)** | ```
#answers {
width:220px;
height:50px;
background-color:#DDDDDD;
border-top:1px solid black;
border-bottom:1px solid black;
margin-top:20px;
}
#arrowcenter {
width:75px;
height:31px;
background-image:url('http://fortmovies.com/brazil/arrow.png');
background-position:0 50%;
background-repeat:no-repeat;
height:100%;
f... |
11,663,184 | [Demo](http://tinkerbin.com/JeCiz2uq)
Basically, I'm trying to setup something that looks like this:

However, my code for some reason isn't working. Fist of all, in teh tinkerbin, my arrow image isn't even showing. It works fine on my computer thou... | 2012/07/26 | [
"https://Stackoverflow.com/questions/11663184",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1447908/"
] | 1st of all your arrow was isn't showing because you were using `margin-left:140px;` in `#arrow_center`
See my [**Fiddle**](http://jsfiddle.net/vFZF2/1/)
Just with 1 `<div>` **[Fiddle](http://jsfiddle.net/vFZF2/4/)** | Use the tag instead of the tag.
The tag defaults to display: block, which prevents the content of different s to be aligned next to each other. tags default to display:inline; which suits your ideas better. As analternative you could also set those display rules in your css. |
11,663,184 | [Demo](http://tinkerbin.com/JeCiz2uq)
Basically, I'm trying to setup something that looks like this:

However, my code for some reason isn't working. Fist of all, in teh tinkerbin, my arrow image isn't even showing. It works fine on my computer thou... | 2012/07/26 | [
"https://Stackoverflow.com/questions/11663184",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1447908/"
] | 1st of all your arrow was isn't showing because you were using `margin-left:140px;` in `#arrow_center`
See my [**Fiddle**](http://jsfiddle.net/vFZF2/1/)
Just with 1 `<div>` **[Fiddle](http://jsfiddle.net/vFZF2/4/)** | ```
Little bit changes that i made in just in your css as follow, and it is working...
#answers {
width:220px;
height:50px;
background-color:#DDDDDD;
border-top:1px solid black;
border-bottom:1px solid black;
margin-top:20px;
}
#arrowcenter {
width:120px;
height:31px; float:left;
background-image:url('http://for... |
11,663,184 | [Demo](http://tinkerbin.com/JeCiz2uq)
Basically, I'm trying to setup something that looks like this:

However, my code for some reason isn't working. Fist of all, in teh tinkerbin, my arrow image isn't even showing. It works fine on my computer thou... | 2012/07/26 | [
"https://Stackoverflow.com/questions/11663184",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1447908/"
] | Just remove `margin-left:-140px;` and add `float:left;` to `#arrowcenter`
**[Working Demo](http://tinkerbin.com/cxAJaKCQ)** | Use the tag instead of the tag.
The tag defaults to display: block, which prevents the content of different s to be aligned next to each other. tags default to display:inline; which suits your ideas better. As analternative you could also set those display rules in your css. |
11,663,184 | [Demo](http://tinkerbin.com/JeCiz2uq)
Basically, I'm trying to setup something that looks like this:

However, my code for some reason isn't working. Fist of all, in teh tinkerbin, my arrow image isn't even showing. It works fine on my computer thou... | 2012/07/26 | [
"https://Stackoverflow.com/questions/11663184",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1447908/"
] | This answer is inspired by Mr. Alien's [**answer**](https://stackoverflow.com/a/11663333/1195891) of using less markup (`id` optional).
Reference: [**jsFiddle**](http://jsfiddle.net/EDXS6/)
HTML:
```
<span>Masculino</span>
```
CSS:
```
span {
background-image:url('http://fortmovies.com/brazil/arrow.png'); /*... | ***[Working Demo](http://tinkerbin.com/xBzHqAyi)***
OR
Use this CSS
```
#answers
{
width: 220px;
height: 50px;
background-color: #DDDDDD;
border-top: 1px solid black;
border-bottom: 1px solid black;
margin-top: 20px;
}
#arrowcenter
{
width: ... |
11,052,607 | i am working on my first Ajax Project and i cannot find a solution for this problem:
This is my Ajax Code:
```
$(document).ready(function(){
var seite = $('div.ipadSeite');
$('a').on('click', function(e){
var href = $(this).attr('href');
seite.load( href );
e.preventDefault();
});
```
});
And this ... | 2012/06/15 | [
"https://Stackoverflow.com/questions/11052607",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1280289/"
] | Delegate function:
```
$(document).delegate('a','click',function(){//Write your function here})
```
'On' I find very situational. 'Delegate' and 'live' both work well with asynchronously load elements.
Robert | As far as I can see from a cursory glance you are not using AJAX but simply utilising jQuery's functions.
What exactly are you trying to do? If you lay out a point by point run through of what a user journey is then I am sure someone can help you.
Robert
[Edit]
have you tried accessing a specific section on the hom... |
11,052,607 | i am working on my first Ajax Project and i cannot find a solution for this problem:
This is my Ajax Code:
```
$(document).ready(function(){
var seite = $('div.ipadSeite');
$('a').on('click', function(e){
var href = $(this).attr('href');
seite.load( href );
e.preventDefault();
});
```
});
And this ... | 2012/06/15 | [
"https://Stackoverflow.com/questions/11052607",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1280289/"
] | Delegate function:
```
$(document).delegate('a','click',function(){//Write your function here})
```
'On' I find very situational. 'Delegate' and 'live' both work well with asynchronously load elements.
Robert | First I think you reference the div by class while you have it in id
var seite = $('div.ipadSeite'); => var seite = $('#ipadSeite'); |
657,481 | **Edit 1**: May be I should modify my question after getting the answers. I see why $(X\_c, Y\_c, Z\_c, \theta, \phi)$ are legitimate *Dof*'s of the dumb-bell, I never had any problem with that.
Please consider now *any* rigid body in general. It has $6$ *Dof*'s, two examples of which are mentioned below:
* $(X\_c, Y... | 2021/08/06 | [
"https://physics.stackexchange.com/questions/657481",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/231654/"
] | >
> But can we really know the 6th coordinate?
>
>
>
You are right -- given knowledge of five coordinates, there is a discrete choice (corresponding to a reflection) for the remaining coordinate. However, by convention we typically (but not always) use the word "degree of freedom" to mean a continuously varying qu... | "There is a new suggestion: $(X\_c,Y\_c,Z\_c,θ,ϕ)$ where $(X\_c,Y\_c,Z\_c)$ are the coordinates of the center-of-mass and θ and ϕ are the polar and the azimuthal angles. If this is the effect of the constraint relation, then it doesn't really eliminate one redundant coordinate, but replaces the entire set, with one les... |
657,481 | **Edit 1**: May be I should modify my question after getting the answers. I see why $(X\_c, Y\_c, Z\_c, \theta, \phi)$ are legitimate *Dof*'s of the dumb-bell, I never had any problem with that.
Please consider now *any* rigid body in general. It has $6$ *Dof*'s, two examples of which are mentioned below:
* $(X\_c, Y... | 2021/08/06 | [
"https://physics.stackexchange.com/questions/657481",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/231654/"
] | >
> But can we really know the 6th coordinate?
>
>
>
You are right -- given knowledge of five coordinates, there is a discrete choice (corresponding to a reflection) for the remaining coordinate. However, by convention we typically (but not always) use the word "degree of freedom" to mean a continuously varying qu... | For simplification I will take the 2D space .
The constraint equation is:
$$ \left( x\_{{2}}-x\_{{1}} \right) ^{2}+ \left( y\_{{2}}-y\_{{1}} \right) ^
{2}-{L}^{2}
=0\tag 1$$
thus you obtain three generalized coordinates
solving equation (1) for $x\_2$
$$x\_2=x\_1\pm\sqrt{L^2-(y\_2-y\_1)^2}$$
you get two solution ... |
657,481 | **Edit 1**: May be I should modify my question after getting the answers. I see why $(X\_c, Y\_c, Z\_c, \theta, \phi)$ are legitimate *Dof*'s of the dumb-bell, I never had any problem with that.
Please consider now *any* rigid body in general. It has $6$ *Dof*'s, two examples of which are mentioned below:
* $(X\_c, Y... | 2021/08/06 | [
"https://physics.stackexchange.com/questions/657481",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/231654/"
] | >
> But can we really know the 6th coordinate?
>
>
>
You are right -- given knowledge of five coordinates, there is a discrete choice (corresponding to a reflection) for the remaining coordinate. However, by convention we typically (but not always) use the word "degree of freedom" to mean a continuously varying qu... | You are looking for 5 DOF. This can be established two ways
* 6 DOF of a general rigid body, minus 1 rotational DOF due to symmetry
* 4 DOF of an infinite line in space, plus 1 for locating the object along the line.
Your second approach is the correct one as three position coordinates and two angle coordinates are n... |
657,481 | **Edit 1**: May be I should modify my question after getting the answers. I see why $(X\_c, Y\_c, Z\_c, \theta, \phi)$ are legitimate *Dof*'s of the dumb-bell, I never had any problem with that.
Please consider now *any* rigid body in general. It has $6$ *Dof*'s, two examples of which are mentioned below:
* $(X\_c, Y... | 2021/08/06 | [
"https://physics.stackexchange.com/questions/657481",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/231654/"
] | "There is a new suggestion: $(X\_c,Y\_c,Z\_c,θ,ϕ)$ where $(X\_c,Y\_c,Z\_c)$ are the coordinates of the center-of-mass and θ and ϕ are the polar and the azimuthal angles. If this is the effect of the constraint relation, then it doesn't really eliminate one redundant coordinate, but replaces the entire set, with one les... | For simplification I will take the 2D space .
The constraint equation is:
$$ \left( x\_{{2}}-x\_{{1}} \right) ^{2}+ \left( y\_{{2}}-y\_{{1}} \right) ^
{2}-{L}^{2}
=0\tag 1$$
thus you obtain three generalized coordinates
solving equation (1) for $x\_2$
$$x\_2=x\_1\pm\sqrt{L^2-(y\_2-y\_1)^2}$$
you get two solution ... |
657,481 | **Edit 1**: May be I should modify my question after getting the answers. I see why $(X\_c, Y\_c, Z\_c, \theta, \phi)$ are legitimate *Dof*'s of the dumb-bell, I never had any problem with that.
Please consider now *any* rigid body in general. It has $6$ *Dof*'s, two examples of which are mentioned below:
* $(X\_c, Y... | 2021/08/06 | [
"https://physics.stackexchange.com/questions/657481",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/231654/"
] | You are looking for 5 DOF. This can be established two ways
* 6 DOF of a general rigid body, minus 1 rotational DOF due to symmetry
* 4 DOF of an infinite line in space, plus 1 for locating the object along the line.
Your second approach is the correct one as three position coordinates and two angle coordinates are n... | For simplification I will take the 2D space .
The constraint equation is:
$$ \left( x\_{{2}}-x\_{{1}} \right) ^{2}+ \left( y\_{{2}}-y\_{{1}} \right) ^
{2}-{L}^{2}
=0\tag 1$$
thus you obtain three generalized coordinates
solving equation (1) for $x\_2$
$$x\_2=x\_1\pm\sqrt{L^2-(y\_2-y\_1)^2}$$
you get two solution ... |
29,562,954 | I am working on `meanjs` application generated using <https://github.com/DaftMonk/generator-angular-fullstack>. I am trying to generate a .pdf file using `phantomjs` and download it to the browser.
The issue is that the downloaded .pdf file always shows the blank pages regardless of the number of pages. The original f... | 2015/04/10 | [
"https://Stackoverflow.com/questions/29562954",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1300140/"
] | Usually if you are using phantom to generate a pdf then the file will be written to disc and you have to supply the path and a callback to the render function.
```
router.get('/pdf', function(req, res){
// phantom initialization and generation logic
// supposing you have the generation code above
page.ren... | I don't have experience of the frameworks that you have mentioned but I would recommend using a tool like Fiddler to see what is going on. For example you may not need to add a content-length header since you are streaming and your framework does chunked transfer encoding etc. |
29,562,954 | I am working on `meanjs` application generated using <https://github.com/DaftMonk/generator-angular-fullstack>. I am trying to generate a .pdf file using `phantomjs` and download it to the browser.
The issue is that the downloaded .pdf file always shows the blank pages regardless of the number of pages. The original f... | 2015/04/10 | [
"https://Stackoverflow.com/questions/29562954",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1300140/"
] | I had corruption when serving static pdfs too. I tried everything suggested above. Then I found this:
<https://github.com/intesso/connect-livereload/issues/39>
In essence the usually excellent connect-livereload (package ~0.4.0) was corrupting the pdf.
So just get it to ignore pdfs via:
```
app.use(require('connect-li... | Usually if you are using phantom to generate a pdf then the file will be written to disc and you have to supply the path and a callback to the render function.
```
router.get('/pdf', function(req, res){
// phantom initialization and generation logic
// supposing you have the generation code above
page.ren... |
29,562,954 | I am working on `meanjs` application generated using <https://github.com/DaftMonk/generator-angular-fullstack>. I am trying to generate a .pdf file using `phantomjs` and download it to the browser.
The issue is that the downloaded .pdf file always shows the blank pages regardless of the number of pages. The original f... | 2015/04/10 | [
"https://Stackoverflow.com/questions/29562954",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1300140/"
] | Here is a clean way to serve a file from express, and uses an `attachment` header to make sure the file is downloaded :
```
var path = require('path');
var mime = require('mime');
app.get('/download', function(req, res){
//Here do whatever you need to get your file
var filename = path.basename(file);
var mimety... | I don't have experience of the frameworks that you have mentioned but I would recommend using a tool like Fiddler to see what is going on. For example you may not need to add a content-length header since you are streaming and your framework does chunked transfer encoding etc. |
29,562,954 | I am working on `meanjs` application generated using <https://github.com/DaftMonk/generator-angular-fullstack>. I am trying to generate a .pdf file using `phantomjs` and download it to the browser.
The issue is that the downloaded .pdf file always shows the blank pages regardless of the number of pages. The original f... | 2015/04/10 | [
"https://Stackoverflow.com/questions/29562954",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1300140/"
] | I had corruption when serving static pdfs too. I tried everything suggested above. Then I found this:
<https://github.com/intesso/connect-livereload/issues/39>
In essence the usually excellent connect-livereload (package ~0.4.0) was corrupting the pdf.
So just get it to ignore pdfs via:
```
app.use(require('connect-li... | Here is a clean way to serve a file from express, and uses an `attachment` header to make sure the file is downloaded :
```
var path = require('path');
var mime = require('mime');
app.get('/download', function(req, res){
//Here do whatever you need to get your file
var filename = path.basename(file);
var mimety... |
29,562,954 | I am working on `meanjs` application generated using <https://github.com/DaftMonk/generator-angular-fullstack>. I am trying to generate a .pdf file using `phantomjs` and download it to the browser.
The issue is that the downloaded .pdf file always shows the blank pages regardless of the number of pages. The original f... | 2015/04/10 | [
"https://Stackoverflow.com/questions/29562954",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1300140/"
] | There are a couple of ways to do this:
1. If the file is a static one like brochure, readme etc, then you can tell express that my folder has static files (and should be available directly) and keep the file there. This is done using static middleware:
app.use(express.static(pathtofile));
Here is the link: <http://exp... | I don't have experience of the frameworks that you have mentioned but I would recommend using a tool like Fiddler to see what is going on. For example you may not need to add a content-length header since you are streaming and your framework does chunked transfer encoding etc. |
29,562,954 | I am working on `meanjs` application generated using <https://github.com/DaftMonk/generator-angular-fullstack>. I am trying to generate a .pdf file using `phantomjs` and download it to the browser.
The issue is that the downloaded .pdf file always shows the blank pages regardless of the number of pages. The original f... | 2015/04/10 | [
"https://Stackoverflow.com/questions/29562954",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1300140/"
] | I had corruption when serving static pdfs too. I tried everything suggested above. Then I found this:
<https://github.com/intesso/connect-livereload/issues/39>
In essence the usually excellent connect-livereload (package ~0.4.0) was corrupting the pdf.
So just get it to ignore pdfs via:
```
app.use(require('connect-li... | There are a couple of ways to do this:
1. If the file is a static one like brochure, readme etc, then you can tell express that my folder has static files (and should be available directly) and keep the file there. This is done using static middleware:
app.use(express.static(pathtofile));
Here is the link: <http://exp... |
29,562,954 | I am working on `meanjs` application generated using <https://github.com/DaftMonk/generator-angular-fullstack>. I am trying to generate a .pdf file using `phantomjs` and download it to the browser.
The issue is that the downloaded .pdf file always shows the blank pages regardless of the number of pages. The original f... | 2015/04/10 | [
"https://Stackoverflow.com/questions/29562954",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1300140/"
] | I had corruption when serving static pdfs too. I tried everything suggested above. Then I found this:
<https://github.com/intesso/connect-livereload/issues/39>
In essence the usually excellent connect-livereload (package ~0.4.0) was corrupting the pdf.
So just get it to ignore pdfs via:
```
app.use(require('connect-li... | I don't have experience of the frameworks that you have mentioned but I would recommend using a tool like Fiddler to see what is going on. For example you may not need to add a content-length header since you are streaming and your framework does chunked transfer encoding etc. |
40,825,338 | I have a css media query but it seems to be mixed up and I'm not sure why. It's making the desktop version look like what I want the mobile version to be, and the mobile version looks like what I want the desktop to be. Here is the css page in question:
```css
@media (min-width: 500px;) {
body{background-image:url... | 2016/11/27 | [
"https://Stackoverflow.com/questions/40825338",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6945842/"
] | If your data size is not very large, you can use this work around:
```
l.apply(pd.Series).stack().value_counts()
#2.0 2
#1.0 2
#10.0 1
#4.0 1
#3.0 1
#dtype: int64
```
Or another option with `chain`:
```
from itertools import chain
pd.Series(list(chain.from_iterable(i if isinstance(i, list) else ... | Try
```
pd.value_counts([i for i in chain.from_iterable(l.values.tolist())])
``` |
40,825,338 | I have a css media query but it seems to be mixed up and I'm not sure why. It's making the desktop version look like what I want the mobile version to be, and the mobile version looks like what I want the desktop to be. Here is the css page in question:
```css
@media (min-width: 500px;) {
body{background-image:url... | 2016/11/27 | [
"https://Stackoverflow.com/questions/40825338",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6945842/"
] | If your data size is not very large, you can use this work around:
```
l.apply(pd.Series).stack().value_counts()
#2.0 2
#1.0 2
#10.0 1
#4.0 1
#3.0 1
#dtype: int64
```
Or another option with `chain`:
```
from itertools import chain
pd.Series(list(chain.from_iterable(i if isinstance(i, list) else ... | Here is yet another solution, which uses [np.hstack()](https://docs.scipy.org/doc/numpy/reference/generated/numpy.hstack.html) and `pd.value_counts()` methods:
```
In [24]: pd.value_counts(np.hstack(l.values))
Out[24]:
2 2
1 2
10 1
4 1
3 1
dtype: int64
``` |
22,021,057 | I want something like this?
```
$sql = mysql_query("SELECT lid, ip FROM lua where uid='$uid'");
$rows = mysql_fetch_array($sql);
$ip = $rows['ip'];
$res = array('value 1 of $ip from datebase','value 2 of $ip from datebase','value 3 of $ip from datebase.......');
?>
```
Is it possible?
help related this...thn... | 2014/02/25 | [
"https://Stackoverflow.com/questions/22021057",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2715422/"
] | ```
$arr = array();
while ($rows = mysql_fetch_array($sql)) {
array_push($arr,$rows['ip']); // and so on if you willing other values to be in your array
}
var_dump($arr); // test your array
```
**NOTE:** Though it's deprecated to use `mysql`, use `mysqli` or `pdo` extensions instead. See [this](https://stackoverf... | ```
$result = mysql_query("SELECT ip FROM lua where uid='$uid'");
$ip = array();
while ($ip[] = mysql_fetch_field($result));
$ip = array_filter($ip);
``` |
22,021,057 | I want something like this?
```
$sql = mysql_query("SELECT lid, ip FROM lua where uid='$uid'");
$rows = mysql_fetch_array($sql);
$ip = $rows['ip'];
$res = array('value 1 of $ip from datebase','value 2 of $ip from datebase','value 3 of $ip from datebase.......');
?>
```
Is it possible?
help related this...thn... | 2014/02/25 | [
"https://Stackoverflow.com/questions/22021057",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2715422/"
] | try this:
```
$arrResult = array();
while ($row = mysql_fetch_array($sql)) {
$arrResult[] = $row['ip'];
}
``` | ```
$result = mysql_query("SELECT ip FROM lua where uid='$uid'");
$ip = array();
while ($ip[] = mysql_fetch_field($result));
$ip = array_filter($ip);
``` |
55,474,395 | I am trying to create a network of a custom `class Tile` inside another `class Board` which is storing a `std::array<std::shared_ptr<Tile>, 34>`. I am using `std::shared_ptr<Tile>` objects within `class Tile` to show which nodes are connected. However, when I initialise each of the 34 `Tile` objects, the not yet initia... | 2019/04/02 | [
"https://Stackoverflow.com/questions/55474395",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11012621/"
] | Here:
```
tiles[0] = std::make_shared<Tile> ( 0, 3, TileLink<6>{ tiles[1], tiles[4], tiles[5], nullptr, nullptr, nullptr });
```
`tiles[1]`, `tiles[4]`, and so on, are not yet initialized and are `shared_ptr` to nullptr. When you initialize `tiles[1]` later it doesn't change what is inside `tiles[0]`.
You... | I have solved my problem - thanks to @t.niese and @fjardon for your help.
I had to make `Tile` more complex to facilitate the real issue here: that I was unable to create a unique `Tile` object from std::array in the class. So I added a copy constructor and an assignment operator, removed the smart pointers and the `c... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.