qid int64 10 74.7M | question stringlengths 15 26.2k | date stringlengths 10 10 | metadata list | response_j stringlengths 27 28.1k | response_k stringlengths 23 26.8k |
|---|---|---|---|---|---|
217,266 | I'm making a French cleat wall for a home office. I'm wondering how to make the strongest French cleat. Is it the length/angle of the bevel that matters most, like in B vs A in the diagram? Or is it the overall width of the cleat that is attached to the wall, like in X vs Y? Or does overall thickness of material (as in... | 2021/02/24 | [
"https://diy.stackexchange.com/questions/217266",
"https://diy.stackexchange.com",
"https://diy.stackexchange.com/users/115472/"
] | If you consider the physics of this, the B wedge is going to apply more outward force on the cleat attached to the wall then the A wedge for a given amount of weight supported. So you might cause the attachment to the wall to fail long before you would be reaching the capacity of the bolt's shear limit.
Generally a re... | I don't know that the strength really lies in the angle. If I were picking, I'd go with X over Y, but because you don't want to create too much of a wedge between the cleat and the wall (Y will put more stress on the cleat fasteners). The bevel helps it not slide off the cleat.
The main advantage of the cleat is you c... |
7,857,882 | I need to read from a file from using C.
```
#include <stdio.h>
struct record{
char name[2];
int arrival_time;
int job_length;
int job_priority;
};
const int MAX = 40;
main(){
struct record jobs[MAX];
FILE *f;
fopen("data.dat","rb");
int count =0;
while(fscanf(f, "%c%c %d %d %d", &jobs[count].name... | 2011/10/22 | [
"https://Stackoverflow.com/questions/7857882",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/695156/"
] | You need to get the line and parse it according to the type you want to read.
```
while(fgets(line, 80, fr) != NULL)
{
/* get a line, up to 80 chars from fr. done if NULL */
sscanf (line, "%s %d %d %d", &myText, &int1, &int2, &int3);
}
```
See example here:
<http://www.phanderson.com/files/fil... | No, the lines do not contain ints. Each line is a string which can be easily parsed into four shorter strings. Then each of the strings can either be extracted and stored in your struct, or converted to ints which you can store in your struct.
The `scanf` function is the usual way that people do this kind of input str... |
26,015,237 | I am trying to run multiple suites from one overall suite file. I define the suites I need to run and run the "master" suite file. I have used preserve-order to run each suite in sequence, however the behaviour is not as I would expect. It seems that it runs them straight away, one after the other, almost in parallel.
... | 2014/09/24 | [
"https://Stackoverflow.com/questions/26015237",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4074322/"
] | According to the [testng documentation](http://testng.org/doc/documentation-main.html#testng-xml),
>
> By default, TestNG will run your tests in the order they are found in the XML file. If you want the classes and methods listed in this file to be run in an unpredictible order, set the preserve-order attribute to f... | In Suite tag, specify attribute thread-count=1, parallel="false". Let me know if this works. |
56,744,537 | I am trying to map the values of one column in my dataframe to a new value and put it into a new column using a UDF, but I am unable to get the UDF to accept a parameter that isn't also a column. For example I have a dataframe `dfOriginial` like this:
```
+-----------+-----+
|high_scores|count|
+-----------+-----+
| ... | 2019/06/24 | [
"https://Stackoverflow.com/questions/56744537",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7082628/"
] | The problem is that parameters to an `UDF` should all be of column type. One solution would be to convert `binList` into a column and pass it to the `UDF` similar to the current code.
However, it is simpler to adjust the `UDF` slightly and turn it into a `def`. In this way you can easily pass other non-column type dat... | **Try this** -
```
scala> case class Bin(binMax:BigDecimal, binWidth:BigDecimal) {
| val binMin = binMax - binWidth
|
| // only one of the two evaluations can include an "or=", otherwise a value could fit in 2 bins
| def fitsInBin(value: BigDecimal): Boolean = value > binMin && value ... |
2,345,926 | I'm upgrading a script to a new version with a hole new database layout. The upgrade starts fine but slowly starts taking more and more time for the same query. The query in question is the following:
```
SELECT nuser.user_id, nfriend.user_id AS friend_user_id, f.time
FROM oldtable_friends AS f
JOIN oldtable_user AS u... | 2010/02/27 | [
"https://Stackoverflow.com/questions/2345926",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/143231/"
] | Take a look at [ORDER BY … LIMIT Performance Optimization](http://www.mysqlperformanceblog.com/2006/09/01/order-by-limit-performance-optimization/) for completeness although you don't appear to be doing anything wrong as such.
Large `OFFSET`s are slow. There's no getting around that after a certain point.
You say you... | @cletus: There are almost 2 million records, but it's still a good idea. It takes almost the same for MySQL to get me 200 or 20,000 rows from that query so I think it should work.
Unfortunately when I try to do that in my PHP script I get a "Prematue end of scripts header". After a lot of debugging I'm sure it's not a... |
14,297,607 | I am having trouble trying to show that certain numbers (product numbers) exist in an associative array. When I try this code, I always get "false".
```
<?php
$products = array(
'1000' => array('name' => 'Gibson Les Paul Studio',
'price' => 1099.99),
'1001' => array('name' => 'Fender Ameri... | 2013/01/12 | [
"https://Stackoverflow.com/questions/14297607",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1973046/"
] | You're looking for [`array_key_exists()`](http://php.net/array_key_exists), not `in_array()`, since you are searching for a specific key, not searching the values:
```
if( array_key_exists('1001', $products))
``` | You cannot use [in\_array()](http://php.net/manual/en/function.in-array.php) here (*checks if a value exists in an array*).
Try [array\_key\_exists()](http://php.net/manual/en/function.array-key-exists.php) (*checks if the given key or index exists in the array*).
```
if (array_key_exists('1001', $products)) {
ec... |
930,611 | Does anybody know of a way I can calculate very large integers in c#
I am trying to calculate the factorial of numbers e.g.
5! = 5\*4\*3\*2\*1 = 120
with small numbers this is not a problem but trying to calculate the factorial of the bigest value of a unsigned int which is 4,294,967,295 it doesn't seem possible.
I... | 2009/05/30 | [
"https://Stackoverflow.com/questions/930611",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/114907/"
] | To calculate the factorial of `uint.MaxValue` you'd need a *lot* of storage.
For example, the [Wikipedia article](http://en.wikipedia.org/wiki/Factorial) as 8.2639316883... × 10^5,565,708. You're going to gain information like crazy.
I *strongly* suspect you're not going find any way of calculating it on a sane compu... | If you are doing calculations with factorials like combinations for example you rarely need to multiply all the way down to 1 (eg. 98 \* 98 \* 97 since everything else cancels out). |
36,599,004 | Problem Statement
=================
I am having problems running a python file that import's the enchant library. I've installed the enchant module with the following command:
```
$ pip install -U pyenchant
> Requirement already up-to-date: pyenchant in /usr/lib/python3.4/site-packages
```
My Python Environment
===... | 2016/04/13 | [
"https://Stackoverflow.com/questions/36599004",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3858801/"
] | It looks like you are missing at least one dependency the 'enchant' C library. It is either called libenchant or enchant. The python module is a wrapper around this library so you need this library to use the wrapper.
To see what is available try:
```
yum whatprovides '*enchant*'
```
Your command
```
yum list inst... | In case you have Python 2.7 and Centos 7 (any minor version) these are the steps to install and run enchant library.
1. Install epel release for centos7, following other dependencies for enchant.
```
RUN rpm -Uvh ./rpms/epel-release-7-11.noarch.rpm
RUN rpm -Uvh ./rpms/hunspell-1.2.8-16.el6.x86_64.rpm
RUN rpm -Uvh ./... |
37,130 | I have read so many internet articles about safety in Spain, and the fake police scam is one of the most mentioned problems.
Most of those reported cases are that the victims are surrounded by group of undercover 'police', accusing you of having drugs and wants to check your ID and wallet.
How can we avoid that or ha... | 2014/10/03 | [
"https://travel.stackexchange.com/questions/37130",
"https://travel.stackexchange.com",
"https://travel.stackexchange.com/users/20555/"
] | Follow the steps:
1. Remain calm. Ask for identification before going anywhere with them or giving them anything.
2. Don't sign anything without a lawyer present. If they start accusing you of anything, state that you require they then contact your embassy to help you with a lawyer. Generally if they're scamming, they... | I have been in similar situations with people trying to pretend that they have a legitimate reason to pressure you to do things that might be taken advantage of.
What I do is that I immediately pick up my phone and start dialling the police. When they ask me what I am doing I am honest and tell them that I am phoning ... |
6,110,082 | I want to compare two strings, such as:
```
str1 = "this is a dynamic data";
str2 = "this is a <data_1> data";
```
Is there any method that will find the nearest match? I have used Ternary Search Tree (TST) Dictionary functions. Are there any other ways to do this kind of thing? | 2011/05/24 | [
"https://Stackoverflow.com/questions/6110082",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/347045/"
] | Some things to look at for SSO and Moodle 1.9:
* If you are ready to spend quite some hours you could use Mnet: <http://docs.moodle.org/en/MNet>
* There is also a phpcas authentication method that could do what you want: <http://docs.moodle.org/en/CAS_server_(SSO>) | Here is what I did
**1 -** I enabled the **(External database) Authentication Plugin**
**2 -** Create this php file in folder (my/moodle/root/login/)
```
<?php
require('../config.php');
$username = $_GET['id'];// 's3265';
$serverName = 'moodle' ;
$connectionInfo = array( "UID"=>"mssqlUser","PWD... |
36,651,256 | My code:
```
<div id="title">
<h2>
My title <span class="subtitle">My Subtitle</span></h2></div>
```
If I use this code:
```
title = soup.find('div', id="title").h2.text
print title
>> My title My Subtitle
```
It matches everything. I want to match My title and My Subtitle as 2 different objects:
```
print title... | 2016/04/15 | [
"https://Stackoverflow.com/questions/36651256",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4866484/"
] | One way to do it without using the class attribute is:
```
h2 = soup.find('div', id="title").h2
subtitle = h2.span.text
title = str(h2.contents[0])
```
The `h2.contents[0]` will return a `NavigableString` object here. Its behavior for print is same as that as the string version of it. If you're only going to use the... | Another solution.
```
from simplified_scrapy import SimplifiedDoc
html = '''
<div id="title">
<h2>
My title <span class="subtitle">My Subtitle</span></h2></div>
'''
doc = SimplifiedDoc(html)
h2 = doc.select('div#title').h2
print ('title:',h2.firstText())
print ('subtitle:',h2.span.text)
```
Result:
```
title: My ti... |
2,470,035 | I have a form that sends info into a database table. I have it checked with a Javascript but what is the best way to stop spammers entering http and such into the database with PHP when Javascript is turned off? | 2010/03/18 | [
"https://Stackoverflow.com/questions/2470035",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/212148/"
] | There are two things to consider which should be implemented in parallel (maybe there's more).
1. Captcha (as mentioned before)
2. Verify your data on server side! You wrote you do this by javascript. This is good, but the very same verification proccess should be written in PHP.
Well, for CAPTCHA you'll have to make... | I suggest using the [`htmlentities()`](http://php.net/manual/en/function.htmlentities.php) function before doing your insert.
Obviously your insert should be done using [parametrized queries](http://us2.php.net/manual/en/pdo.prepared-statements.php) to interact with the database as well. captcha is certainly an optio... |
30,576,610 | We have a big application which uses a lot of `Strings`:
* for serial numbers
* for product names
* for order number
* for customer references
* ... and many more ...
Unfortunately our developers are only human. Sometimes the `String` values get mixed up when calling methods.
For example:
```
// this method
public v... | 2015/06/01 | [
"https://Stackoverflow.com/questions/30576610",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1833961/"
] | Autocompletion's behaviour in RubyMine has been changed since there were a lot of complains against it in previous versions (because it was choosing not always the desirable one option).
If you want to restore the old behaviour, type "Registry" in Search everywhere and look for **ide.completion.lookup.element.preselec... | There is now an option for this in the settings.
Go to `Settings > Editor > Code Completion` in the Ruby section and uncheck the checkbox `Preselect first completion element` :
[](https://i.stack.imgur.com/WA0jN.png) |
44,170,329 | I'm trying to write a real time battle system for a text game. I would like the player to be able to act and have to wait a certain number of seconds before they're able to act again, while the NPC is doing the same.
I've written a small example:
```
import threading
import time
def playerattack():
print("You at... | 2017/05/25 | [
"https://Stackoverflow.com/questions/44170329",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7965650/"
] | The problem is that the thread is already running and you cannot start a running thread again because of while loop calling `n.start()` again.
Even after the thread is dead you need to reinitialize the thread instance and start again. You cannot start an old instance.
In your case in `while True` loop it is trying ... | I found a (hacky) way to reuse a threading.Thread object, by creating a subclass and implementing a reset method, in case you just want to change the arguments of the function that the thread is "linked" to.
```
class ReusableThread(threading.Thread):
def __init__(self, *args, **kwargs):
threading.Thread._... |
269 | I've been using a house rule for a while now. If you have a trained skill, and you are making a knowledge check it's free.
For example, if you are trained in nature, and fighting natural beasts; you may make a free action nature check to see if you know anything about the beasts.
So far, I haven't had any ill effects... | 2010/08/19 | [
"https://rpg.stackexchange.com/questions/269",
"https://rpg.stackexchange.com",
"https://rpg.stackexchange.com/users/53/"
] | That's actually not even a house rule — it's by the book. See pages 179-180 of the Player's Handbook, which discuss monster knowledge checks. On page 180:
>
> Monster Knowledge: No action required — either you know the answer or you don't.
>
>
> | There is nothing that "breaks" the game as long as you the DM reserve the right to run the rules the way you want. I'm sure there's some option somewhere, now or future, that lets a PC do a Knowledge check to accomplish something nontrivial, and when that happens, you'll need to say "well, that's not a free action."
O... |
255,969 | When booting into Linux, there are sometimes one or two lines that get quickly cleared. I think that some of them don't even appear in dmesg. If nothing else, I want to suppress the clear before the "login:" prompt. Is there a kernel command or sysctl that I can set to prevent this so I can read them on the console scr... | 2011/04/05 | [
"https://serverfault.com/questions/255969",
"https://serverfault.com",
"https://serverfault.com/users/11131/"
] | Most of the information you want will be in `/var/log/dmesg` and `/var/log/messages` after the system boots, you should check those files first.
Generally linux machines run [mingetty](http://linuxcommand.org/man_pages/mingetty8.html) for the virtual terminals. If you have a traditional sysv init system, those are con... | With systemd things are different. See article [Stop Clearing My God Damned Console](http://mywiki.wooledge.org/SystemdNoClear). In short:
```
mkdir /etc/systemd/system/getty@.service.d
cat >/etc/systemd/system/getty@.service.d/noclear.conf <<EOF
[Service]
TTYVTDisallocate=no
EOF
systemctl daemon-reload
```
Verify t... |
4,901 | Как писать такой сорт винограда, как Бастардо м(М)агарачский? "Каберне-Совиньон" вроде бы два слова с прописной, должна сработать аналогия по идее. Или нет? | 2012/05/25 | [
"https://rus.stackexchange.com/questions/4901",
"https://rus.stackexchange.com",
"https://rus.stackexchange.com/users/913/"
] | Скорее всего написание в общем случае пока не нормировано.
Я в курсе, т.к. на gramota.ru года четыре назад изрядно копий сломали, в чем и мне довелось участвовать. Попозже попробую найти ту ветку.
Тут вот какая штука. Строго говоря, в типичном случае приведенные вами названия не являются названиями сортов винограда.... | Внесу уточнение. Сравнивать Каберне Совиньон с Homo sapiens не совсем правильно. В латинских названиях живых существ с прописной буквы пишется только название рода, вид же - со строчной: Canis domestica, Ehium vulgare и т.д. |
12,843 | Recently I was in a fish and chip shop in [Mandurah, WA](http://en.wikipedia.org/wiki/Mandurah), selling local crumbed scallops.
* Is *local crumbed scallops* the correct form?
* Is *crumbed local scallops* more appropriate?
* What if "nonlocal" scallops were also available?
* [optional] What form would a native Germa... | 2011/02/16 | [
"https://english.stackexchange.com/questions/12843",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/3093/"
] | *Local crumbed scallops* seems ambiguous, as it could be understood as *local-crumbed scallops*, where *local* is referring to *crumbed*; in that case, the hyphen is necessary to avoid the ambiguity.
*Crumbed local scallops* is more clear, as it's evident that *local* is referring to *scallops*.
In English, the adject... | There is a theory that adjective ordering is essentially universal (i.e. the same across all languages), so that in principle we ought to be able to give rules something like this:
* keep words forming a compound or colloquation together;
* if the adjectives all come before the noun in your native language, keep them ... |
51,642 | **Task**
Get 100 as an answer with only four keystrokes on a regular calculator.
**Disallowed keys**
* 0
* 00
**Allowed keys**
All other than the aforementioned two keys.
Take the below image as a reference.
[](https://i.stack.imgur.com/1vVky.jpg)
**Cond... | 2017/05/09 | [
"https://puzzling.stackexchange.com/questions/51642",
"https://puzzling.stackexchange.com",
"https://puzzling.stackexchange.com/users/36532/"
] | I found another solution.
>
> .1 first and second key, 1/x third key, x2 fourth key. You need a calculator with those buttons though.
>
>
>
The OP says that calculator is just for reference, meaning I can use "a regular calculator" that's slightly different?
It's the standard calculator that came with my windows... | You can do it with 3 mouse clicks on a virtual claculator (Windows or Mac):
>
> With the calculator in "programmer" mode, base 16 selected, click 6 4 "base 10"
>
>
>
And for the pedants that require *2* "operators":
>
> With the calculator in "programmer" mode, base 16 selected, click 6 4 "base 10" =
>
>
> |
9,773,627 | I was wondering how I could set up css pseudo classes, specifically hover so when I hover over an element, like a div with an id, the properties of a different div with an id get changed?
so normally it would be this:
```css
#3dstack:hover {
listed properties
}
```
I'm not sure what the change would be to have it... | 2012/03/19 | [
"https://Stackoverflow.com/questions/9773627",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1119918/"
] | I do not think that is possible unless the element you want to change the properties of is a descendent or a sibling of the hovered element, in which case you can do:
```
#myElement:hover #myElementDescendent {
background-color: blue;
}
/*or*/
#myElement:hover + #myElementSibling {
background-color: blue;
}
... | *Visually* you can do this using [LESS](http://lesscss.org/), but *under the hood* it's actually using JavaScript. |
59,127,979 | Is there any way to append data to an existing XML document using XML serializer.
I am currently doing it like this
```
string filePath = "Data.xml";
var serializer = new XmlSerializer(typeof(Event));
extWriter writer = new StreamWriter(filePath, true);
serializer.Serialize(writer, event);
```
This way adds the elem... | 2019/12/01 | [
"https://Stackoverflow.com/questions/59127979",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11210734/"
] | No, there is no way to manipulate the file without loading it. The Serializers always handle the entire file.
So the right way to do modifications is to Load the File into memory, modify it, and save it again.
For direct anonymous Xml-Node-Level manipulation you should rather use XmlDocument.Load, instead of an XmlSe... | If you now the data is at the end of the file
you can open the file by as text
seek to the end
delete the last row
write the data
and add the last row again
**This is only recommended in case of writing to large uniform files** |
5,734,629 | I have built a simple CSS drop down menu. What I am looking for is a way to add a css style class to the menu span depending on what directory you are in.
For example, you are in the contact directory <http://www.site.org/contact> on any page in that directory I would like the contact menu item which is a span with an... | 2011/04/20 | [
"https://Stackoverflow.com/questions/5734629",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/717649/"
] | One thing you could do is to treat the CSS like it is a theme. The way this is done for a "theme per directory" sort of approach is to have a base-line set of styles that will always apply to the site, and then also have a style sheet within each directory that overrides the base styles to change the theme for that dir... | Let's say you have something like this:
```
<ul id="nav">
<li id="nav-menu1">...</li>
<li id="nav-menu2">...</li>
<li id="nav-about">...</li>
<li id="nav-contact">...</li>
</ul>
```
Then you can do something like:
```
var whichCurrent = 'nav-' + window.location.href.replace('http://www.site.org/', '');
docu... |
74,308,028 | Question.
Write a PL/SQL program to check whether a date falls on weekend i.e.
‘SATURDAY’ or ‘SUNDAY’.
I tried running the code on livesql.oracle.com
My Code:
[](https://i.stack.imgur.com/loPAX.png)
I am very new to sql and don't really know why i a... | 2022/11/03 | [
"https://Stackoverflow.com/questions/74308028",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20410463/"
] | It is fairly straightforward, when you consider the namespaces involved. This is hinted at by the fact that you get a `NameError`, when you actually try and do anything with `test_var`, such as passing it to a function (like `print`). It tells you that the *name* you used is not known to the interpreter.
What does var... | Python will not initialize a variable automatically, so that variable doesn't get set to anything. `a: int` doesn't actually define or initialize the variable. That happens when you assign a value to it. The typings really only act as hints to the IDE, and have no practical effect without assigning a value during compi... |
19,239,605 | In joomla 2.5 is there any built in function to fetch all article from the specific category.
I don't want to use custom query to fetch article from the database. | 2013/10/08 | [
"https://Stackoverflow.com/questions/19239605",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1740136/"
] | I'm not sure how're you're setting up your slider however to answer your actual question:
```
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('*')
->from($db->quoteName('#__content'))
->where($db->quoteName('catid') . ' = 2');
$db->setQuery($query);
$rows = $db->lo... | Check this out: /modules/mod\_articles\_category for a full-fledged (and fairly slow) implementation. You might want to make it simpler:
select introtext, params from #\_\_content where catid=%s AND state=1 AND ...
(you might want to add some checks on publish\_up fields etc, but if you're happy with managing publish... |
1,583,982 | >
> We have a linear transformation $T:P\rightarrow P$ where $T(p)=p+p'$ and $P$ is the vector space of all real polynomials. I want to show that $T$ invertible.
>
>
>
I was able to prove that its injective, but I have difficulty to show that is surjective or is possible even to find $S$ such that $T\circ S=I$. | 2015/12/21 | [
"https://math.stackexchange.com/questions/1583982",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/95052/"
] | Notice that
$$
32^5=2^{25} \equiv 2^{10}\cdot 2^{10} \cdot 2^5 \equiv 24^2 \cdot 32 \equiv 32 \mod 100
$$
(I think what you wrote there does not make sense as stated)
and it follows that
$$
2^{5^k} \equiv 32 \mod 100
$$
for all $k\ge 1$
So indeed
$$
2^{5}+2^{5^2}+\cdots+2^{5^{2015}} \equiv 32 \cdot 2015 \equiv ... | If $X \equiv \sum\_{k=1}^{2015} 2^{\left(5^k\right)} \pmod {100}$, then you can compute:
$$X\_4 \equiv \sum\_{k=1}^{2015} 2^{\left(5^k\right)} \pmod 4$$
$$X\_{25} \equiv \sum\_{k=1}^{2015} 2^{\left(5^k\right)} \pmod {25}$$
$X\_4 \equiv 0$ in each term. $2^{20} \equiv 1 \pmod {25}$, this you seem to have noted. So
$$... |
186,960 | How to say something like I am forced to agree or accept the situation in one word?
I believe there is a precise word to express this. | 2014/07/25 | [
"https://english.stackexchange.com/questions/186960",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/86186/"
] | Depending on the reasons, one of the following words may make sense.
1. Coerced
2. Blackmailed
3. Compelled
4. Required
5. Held hostage
6. Obligated or bound | Acquiesce, essentially to agree without protest, yet you'd prefer something else |
68,161,909 | ```py
Date
-1.476329
-2.754683
-0.763295
-3.113292
-1.353446
```
when I am trying to convert these -ve float values into `dd-mm-yyyy` , I am getting the year as 1969 or something with almost same date in every row. But the year should be near to 2018-2020 | 2021/06/28 | [
"https://Stackoverflow.com/questions/68161909",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16333302/"
] | You can refer to the following documentation: <https://material.io/develop/android/theming/color>
* **colorPrimary**: The color displayed most frequently across your app’s screens and components. This color should pass accessibilty guidelines for text / iconography when drawn on top of the surface or background color.... | If you're looking for specifics about each component, the [material.io](https://material.io) documentation usually provides information about the default values for various attributes.
For example, the documentation for [`MaterialCardView`](https://material.io/components/cards/android#card) specifies that the default ... |
57,535,565 | i want to send array with rest api in php but i don't know how to do this
i tried with json and without json but not response to me
```php
$drv = array('mobile'=>'+123456', 'title'=>"MR", 'firstName_en'=>'john', 'lastName_en'=>'wilet');
curl_setopt($process, CURLOPT_POSTFIELDS, "checkoutStation=xxx&checkoutDate=20190... | 2019/08/17 | [
"https://Stackoverflow.com/questions/57535565",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7933827/"
] | Setting something as `async` will wrap the return object into a `Promise`. Promises are used to deal with asynchronous behavior, but there's nothing inherently asynchronous about the content of the `test` function. If instead you were to wrap the contents into a `setTimeout` function, that would cause a delay which wou... | an async function means that what is inside the function is expected to have some asynchronous calls. like if you had an Http call inside your test function.
and since nothing is asynchronous inside your function (you only have a normal loop) then your function will execute normally and sequentially until it finishes ... |
44,063,286 | I am trying to add users to Tencent Cloud (QCloud) account, similar to one would do using AWS IAM.
Under "User Management" I added a user, but the user received an email indicating he is a collaborator and will receive notifications rather than the instruction on how to login to the account I created.
What is the Ten... | 2017/05/19 | [
"https://Stackoverflow.com/questions/44063286",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2360262/"
] | **virtualenv** is a tool that allows you to create isolated Python environments, which can be quite helpful when you have different projects with differing requirements.
**mkvirtualenv** is command under **virtualenvwrapper** which is just a wrapper utility around virtualenv that makes it even easier to work with.
Fo... | It used by a wrapper on `virtualenv`. It makes working on these environments easier since you can swap them by using `workon` command and they are stored in one place. [See this](http://virtualenvwrapper.readthedocs.io/en/latest/command_ref.html). |
46,927,667 | I am using nodejs with express and ejs.
Every one on internet ask how to pass value from node to the view, but what about the opposite?
For example, I ask my user to input a string in a form, when the user clicks the button, how can I get this string without passing it as a parameter in the url?
The form:
```
<div ... | 2017/10/25 | [
"https://Stackoverflow.com/questions/46927667",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6213883/"
] | Use POST as a method for your html form
```
<form action="/myapi" method="post">
<input type="text" class="form-control" id="pName" name="pName">
<button type="submit" class="btn btn-default">Submit</button>
</form>
```
And then handle the client form "action" with `app.post` on the back end
```
app.post('/... | From your question, In general if you want to get a value from the unique id, you will store that value as a global variable. so you can easily get the current user and user related details. |
31,493,816 | I crawl a table from a web link and would like to rebuild a table by removing all script tags. Here are the source codes.
```
response = requests.get(url)
soup = BeautifulSoup(response.text)
table = soup.find('table')
for row in table.find_all('tr') : ... | 2015/07/18 | [
"https://Stackoverflow.com/questions/31493816",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3067748/"
] | You are asking about [`get_text()`](http://www.crummy.com/software/BeautifulSoup/bs4/doc/#get-text):
>
> If you only want the text part of a document or tag, you can use the
> `get_text()` method. *It returns all the text in a document or beneath a
> tag, as a single Unicode string*
>
>
>
```
td = soup.find("td... | Try calling col.string. That will give you the text only. |
1,246,315 | I want to find out the natural block size of the IO media being used in an cocoa application. I saw a function in IOMedia.cpp called "getPreferredBlockSize()" which supposedly gives me my block size. Please can you guys explain me how to use this function in my app or if there is any other method using which i can find... | 2009/08/07 | [
"https://Stackoverflow.com/questions/1246315",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/148712/"
] | The C/C++ preprocessor acts in units of tokens, and a string literal is a *single* token. As such, you can't intervene in the middle of a string literal like that.
You could preprocess script.py into something like:
```
"some code\n"
"some more code that will be appended\n"
```
and #include that, however. Or you ca... | This won't get you all the way there, but it will get you pretty damn close.
Assuming `script.py` contains this:
```
print "The current CPU time in seconds is: ", time.clock()
```
First, wrap it up like this:
```
STRINGIFY(print "The current CPU time in seconds is: ", time.clock())
```
Then, just before you incl... |
9,913,353 | I have a cancel button in a form:
```
@using (Html.BeginForm("ConfirmBid","Auction"))
{
some stuff ...
<input type="image" src="../../Content/css/img/btn-submit.png" class="btn-form" />
<input type="image" src="../../Content/css/img/btn-cancel.png" class="btn-... | 2012/03/28 | [
"https://Stackoverflow.com/questions/9913353",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/991788/"
] | Either you can convert the Cancel button as an anchor tag with @Html.ActionLink helper method and apply a css class which makes the link to looks like a button and then in the controller action for that link, you can return the specific view.
```
@Html.ActionLink("Cancel","Index","Products",null, new { @class="clsButt... | Lot of the answers worked in either of the browsers, chrome or ie but not all.
This worked in all -
```
<input type="button" value="Cancel" onclick="location.href='@Url.Action("Index","Home")';"/>
``` |
2,474,912 | >
> $$A = \begin{pmatrix} 2 & -1 \\ 1 & -1 \end{pmatrix} $$ Find the $2 \times 2$ matrix $X$ such that $XA^2 − XA^{-1} = A$.
>
>
>
Can anyone advise me on how to do questions like this? Very confusing. Trying to teach myself matrices. | 2017/10/16 | [
"https://math.stackexchange.com/questions/2474912",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/492079/"
] | Hint
Multiply by $A$ to the right, to get
$$XA^3 - X = A^2$$
$$X(A^3 - \mathbb{1}) = A^2$$
Then you just need to compute $A^3 - \mathbb{1} = AAA - \mathbb{1}$ and $A^2 = AA$.
At the end, calling $A^3 - \mathbb{1} = B$ you will have
$$XB = A^2$$
Multiply for $B^{-1}$ to the right to get the solution:
$$X = A^2 B... | Hint: use Cayley-Hamilton to find out an equation $A^2+aA+bI=0$.
Then you can reduce all higher matrix powers $A^k$ for $k\ge 2$, so that
$A$ appears only in degree $1$ and $0$. Then $X=A^2(A^3-I)^{-1}$ can be reduced, too. |
22,038,494 | I am developing a MVC 4 application ,using JavaScript jQuery for validations.
But the JavaScript functions are not getting triggered in Mozilla Firefox.
Can some body explain me what might be the issue here.
I have the following JavaScript function inside script tag of the page.
```
function dateValidation() { debug... | 2014/02/26 | [
"https://Stackoverflow.com/questions/22038494",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3090286/"
] | For example, use [`array_keys()`](http://php.net/array_keys):
```
$a = array(
0 => '',
'address_country' => '',
'1' => '2011-11-29 14:49:10',
'createdtime' => '2011-11-29 14:49:10'
);
$keys = array_keys($a);
$i = 1;
$m = count($keys);
foreach($a as $key=>$value)
{
echo(sprintf('M... | try this. I think this is what you want
```
$c = array_values($a);
for($i = 0; $i < count($c); $i++){
if(count($c)-1 > ($i)) {
if(array_search($c[$i+1],$a) == "address_country")
echo "found";
}
}
``` |
1,070,425 | Im building multi-server support for a file upload site Im running. When images are uploaded.... they are thumbnailed and stored on the main front-end server, until cron executes (every 10 mins) and moves them to storage servers, so for the first 10 mins, they will reside, and be served off the main front-end server.
... | 2009/07/01 | [
"https://Stackoverflow.com/questions/1070425",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Have you considered a database storing the image\_name/image\_location, and a generic PHP script to serve the images from the database-details? | Really, given your situation the only option I can see is to give your users the actual URL's, since I'm sure you will be able to know them. You will then need to notify the users that they cannot actually use the link for 10 minutes.
In an idea world, I would see you putting this file directly to its final resting pl... |
33,842 | A legacy software application needs to be rewritten to improve performance. This software is used on an hourly basis to bring money to the business. Because of the nature of its importance to the business, the business wants to know what is the impact to the current systems if it is rewritten. They have a concern that ... | 2022/04/03 | [
"https://pm.stackexchange.com/questions/33842",
"https://pm.stackexchange.com",
"https://pm.stackexchange.com/users/49476/"
] | You need to develop a case for change. You need to discuss:
* Problem statement and the need for change
* Current state with current business metrics such as revenue and
profit over the past several quarters
* Analysis of alternatives
* For each alternative, provide:
Expected business value, both objective and subjec... | Without specific knowledge of the business and the application, it is unlikely that anyone can give you a definitive answer. However, there are principles that you can use to guide you:
1. Don't try to do everything yourself. Use colleagues both in the business and in the technical teams to provide information on what... |
6,484,177 | I have a text file which always has one line, how could I set a string for the first line of the text file in C#?
e.g. line1 in test.txt = string version | 2011/06/26 | [
"https://Stackoverflow.com/questions/6484177",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/816110/"
] | A text file is not line based, so you can't change a specific line in a text file, you would need to rewrite the entire file.
If your file only ever contains that single line, you can just rewrite the file with the new string:
```
File.WriteAllText(fileName, newValue);
```
### Edit:
As you said that what you actua... | Have a look at the [`File` class](http://msdn.microsoft.com/en-us/library/system.io.file.aspx). |
50,276,833 | Ok, first time posting a question so I hope I do everything by the book.
I wanted to use javascript to retrieve and display the width/height of an image that the user picks using an Input button. But it's a hot day here and I can feel my brain just going round in circles.
Using this script I get it to display the ima... | 2018/05/10 | [
"https://Stackoverflow.com/questions/50276833",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9771747/"
] | You should use [`HTMLImageElement.naturalWidth`](https://www.w3schools.com/jsref/prop_img_naturalwidth.asp) and [`HTMLImageElement.naturalHeight`](https://www.w3schools.com/jsref/prop_img_naturalheight.asp) instead of just [`image.width`](https://www.w3schools.com/jsref/prop_img_width.asp) and [`image.height`](https://... | As correctly pointed out by LGSon, you have to wait for onLoad.
```
var reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = function (e) {
var image = new Image();
image.src = e.target.result;
image.onload = function () {
var height = this.height;
var width = this.width;... |
33,823 | I have a server in the closet and an extra monitor which I setup on the wall just outside the closet. I would like to have it display various status tools. I like RDP as is but want to have the experience something like VNC provides without it's sluggish performance.
Is it possible with Windows Server 2008 R2 (or pre... | 2009/06/30 | [
"https://serverfault.com/questions/33823",
"https://serverfault.com",
"https://serverfault.com/users/411/"
] | **RDP** acts like RDP.
You may want to consider using something else.
**[Best Windows remote support / screen sharing tools?](https://serverfault.com/questions/155/best-windows-remote-support-screen-sharing-tools)** | -console does not work with windows 2008, vista, or windows 7. that switch has been depreciated.
the closest match is /admin, but that just gives you an administrative RDP session, it does not give you the console itself.
in fact, if the same use is logged in on the console of a 2008r2 server, you will convert their ... |
1,303,029 | I am playing around with C# collections and I have decided to write a quick test to measure the performance of different collections.
My performance test goes like this:
```
int numOps= (put number here);
long start, end, numTicks1, numTicks2;
float ratio;
start = DateTime.Now.Ticks;
for(int i = 0; i < numOps; i++)... | 2009/08/19 | [
"https://Stackoverflow.com/questions/1303029",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/159615/"
] | The proper way to time things diagnostically is to run the code many times iteratively (so that the total time is many multiples of the resolution of whatever timing mechanism you use) and then divide by the number of iterations to get an accurate time estimate.
Stopwatch returns times that are not quantized by 15 ms... | I used the following code to test the performance of a `Dictionary` using three different `GetHash` implementations:
```
class TestGetHash
{
class First
{
int m_x;
}
class Second
{
static int s_allocated = 0;
int m_allocated;
... |
82,867 | A [field](https://en.wikipedia.org/wiki/Field_(mathematics)) in mathematics is a set of numbers, with addition and multiplication operations defined on it, such that they satisfy certain axioms (described in Wikipedia; see also below).
A finite field can have pn elements, where `p` is a prime number, and `n` is a natu... | 2016/06/14 | [
"https://codegolf.stackexchange.com/questions/82867",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/25315/"
] | JavaScript (ES6), 10 + 49 = 59 bytes
------------------------------------
```
a=(x,y)=>x^y
m=(x,y,p=0)=>x?m(x>>1,2*y^283*(y>>7),p^y*(x&1)):p
```
Domain is 0 ... 255. [Source](https://en.wikipedia.org/wiki/Finite_field_arithmetic#Program_examples). | IA-32 machine code, 22 bytes
============================
"Multiplication", 18 bytes:
```
33 c0 92 d1 e9 73 02 33 d0 d0 e0 73 02 34 1b 41
e2 f1
```
"Addition", 4 bytes:
```
92 33 c1 c3
```
This stretches rules a bit: the "multiplication" code lacks function exit code; it relies on the "addition" code being in me... |
66,737 | It was pointed out [in this answer](https://christianity.stackexchange.com/a/66731) and [this answer](https://christianity.stackexchange.com/a/66712) that in the book of Mormon, [2 Nephi 2:22-23](https://www.lds.org/scriptures/bofm/2-ne/2) it states
>
> 22. And now, behold, if Adam had not transgressed he would not h... | 2018/10/19 | [
"https://christianity.stackexchange.com/questions/66737",
"https://christianity.stackexchange.com",
"https://christianity.stackexchange.com/users/35851/"
] | The Bible doesn't have a direct reference to this, but this is part of the reason the Church of Jesus Christ believes in the need for multiple scriptures. One can see that in Genesis Adam and Eve were only kicked out of the Garden of Eden and only started having children after partaking of the fruit of knowledge of goo... | >
> This seems to contradict God's first instruction to Adam and Eve in Genesis 1:28
>
>
>
Correct. Note that there are two types of human, the general found in Gen 1:27 and the specific in Gen 2:7. This is implied in Cain's fear of being killed by other humans and his wife Gen 4:14,17. So Gen 1:28 applies to the ... |
4,037,081 | We have a sequence given by:
$$a\_1 = 1 \\ a\_2 = b \\
a\_{n+2}=a\_{n+1}+a\_n$$
We need to find the limit of the sequence. The procedure of getting the solution is that we $a\_n = p^n$ and then somehow solve the equation $p^{n+2}=\frac{1}{3}p^n+\frac{2}{3}p^{n+1}\implies p^2 - \frac{2}{3}p-\frac{1}{3} = 0$
For this ... | 2021/02/23 | [
"https://math.stackexchange.com/questions/4037081",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/511545/"
] | I guess what you are asking is how the "guess" $a\_n = p^n$ can be justified, i.e. why is this the way to proceed and why is it complete, i.e. it produces all solutions.
Without having to develop a theory of difference equations from scratch, we can use mighty results from linear algebra. Transform your difference equ... | Here is some presentation without matrices, it is easy to understand for a recurrence with only two terms, but keep in mind that the generalization with many terms is easier to handle with linear algebra theory as in Andreas's answer.
* Let start with the simple case $x\_{n+1}=ax\_n$
It can be solved by induction to ... |
10,667,286 | I have seen some applications that scan image and give back text. Is there any library for this or not? I mean either scanning text or taking a picture of it and identify characters?
I have searched for OCR but I have not found material so as to read. Can you help me with this? | 2012/05/19 | [
"https://Stackoverflow.com/questions/10667286",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1267718/"
] | Have a look at a library called [Tesseract](http://code.google.com/p/tesseract-ocr/). Here's [a tutorial](http://gaut.am/making-an-ocr-android-app-using-tesseract/). | Yes you can use google vision library for convert image to text, it will give better output from image.
Add below library in build gradle:
```
compile 'com.google.android.gms:play-services-vision:10.0.0+'
TextRecognizer textRecognizer = new TextRecognizer.Builder(getApplicationContext()).build();
Frame ... |
55,382 | My understanding of the Heartbleed vulnerability is that there is no bounds check on the payload length/buffer size so the server can read into memory outside of its process space.
But can the start address be modified?
If not, then the probability of snagging anything interesting from a server with gigs of RAM, wher... | 2014/04/10 | [
"https://security.stackexchange.com/questions/55382",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/29911/"
] | The 64k block that gets returned is selected effectively at random, which seems like it would make it hard to find worthwhile data. However, there are two factors that significantly increase the threat:
First, the attack won't return memory that was allocated during program start-up. This means the area occupied by bo... | There was an answer here that has since been deleted that was really interesting, at least in the comments it provoked.
Essentially, the answererer was (not very clearly) trying to say that each new allocation of buffer to read the heartbeat from changes the start address, and because you are able to run the attack ma... |
1,099,371 | In Perl 5.10, how do I create and access a hash with scalar keys whose values are arrays?
```
#Doing this does not work properly.
%someHash= ("0xfff" => ('Blue', 'Red', 'Yellow'));
@arr = @fileContents{"0xfff"};
print @arr;
```
When I print the array, the only thing that prints is "ARRAY('randmemAddr')". When I do a... | 2009/07/08 | [
"https://Stackoverflow.com/questions/1099371",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/57627/"
] | My original answer posted working code, but didn't really explain the problem with yours. This is expanded a bit to correct that. Your example had two problems. First, you had a problem when making the reference. You need to use `[ ]` instead of the standard parentheses in order to create a reference (to an anonymous a... | I find it much easier to use [Data::Dumper](http://search.cpan.org/~smueller/Data-Dumper-2.124/Dumper.pm) module. Odds are very high that it comes with your perl distribution. It allows you to quickly see what your data structure is.
In your case it would be:
```
use Data::Dumper;
my %someHash= ("0xfff" => ('Blue', '... |
58,338,604 | I have problem to automate this drop down using selenium web driver using Java
[This](https://jedwatson.github.io/react-select/) is the link - Go to 5th drop down named as Github users (fetch. js)
I am not able to enter the data into search field.
I am using send keys after perform click but it throws an exception ... | 2019/10/11 | [
"https://Stackoverflow.com/questions/58338604",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12180800/"
] | We can handle this requirement with the help of `ROW_NUMBER` and a pivot query:
```
WITH cte AS (
SELECT *, ROW_NUMBER() OVER (PARTITION BY CustomerID ORDER BY PhoneID) rn
FROM Phones
)
SELECT
CustomerID,
MAX(CASE WHEN rn = 1 THEN PhoneNum END) AS PhoneNum1,
MAX(CASE WHEN rn = 2 THEN PhoneNum END)... | ```
The query above was very useful. But when I use the Where, the result is not right
WITH cte AS (
SELECT *, ROW_NUMBER() OVER (PARTITION BY CustomerID ORDER BY PhoneID) rn
FROM Phones
)
SELECT
CustomerID,
MAX(CASE WHEN rn = 1 THEN PhoneNum END) AS PhoneNum1,
MAX(CASE WHEN rn = 2 THEN PhoneNum ... |
56,719,066 | * At the end of each unit tests, I call `tf.reset_default_graph()` to clear the default graph.
* However, when a unit test fails, the graph doesn't get cleared. That makes the next unit test fails as well.
How to clear a graph upon exiting the `tf.Session()` context?
Example (pytest):
```
import tensorflow as tf
de... | 2019/06/22 | [
"https://Stackoverflow.com/questions/56719066",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8704463/"
] | I suggest to use the tools `pytest` offers:
```
@pytest.fixture(autouse=True)
def reset():
yield
tf.reset_default_graph()
```
The fixture will be automatically invoked before and after each test (flag `autouse`), code before/after `yield` is executed before/after test. This way the tests from your question w... | Would something like this work?
```py
import tensorflow as tf
def test_1():
G = tf.Graph()
with G.as_default():
x = tf.get_variable('x', initializer=1)
with tf.Session() as sess:
sess.run(tf.initializers.global_variables())
print(sess.run(x))
print(4 / 0)
d... |
722,593 | Show that there is no solution to:
$$v(x)=1+3 \int\_0^1 xy v(y) dy$$
When the solution $v(x)$ must be of the form $1+cx$ for some constant $c$.
I tried solving this I am getting $x=0$. What am I doing wrong? | 2014/03/22 | [
"https://math.stackexchange.com/questions/722593",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/126012/"
] | I assume $y$ is a dummy variable for the integration and independent of $x$. Pull the $x$ out of the integral, and write $v(y)=1+cy$; then this says
$$1+cx=1+3x\int\_0^1 y+cy^2dy$$
Integrating gives $\frac {y^2}2+c\frac{y^3}3$, so after evaluating this becomes $$1+cx = 1+3x\left(\frac 13 c+\frac 12\right)=1+cx+\frac ... | See that
LHS: $1+cx$
RHS: $$1+3\int\_{0}^{1}xy(1+cy)dy=1+3x\int\_{0}^{1}y+cy^2dy=1+x[\frac{1}{2}y^2+\frac{c}{3}y^3]^{1}\_{0}=1+3x(\frac{1}{2}+\frac{c}{3})$$So if it should be equal we have that $$
c=3(\frac{1}{2}+\frac{c}{3})\Rightarrow 0=\frac{3}{2}
$$
which is clearly impossible |
12,410 | I am writing selenium tests, and following the convention of using Webdriver Waits to have the webdriver poll for an object before it tries to interact with it.
I am frequently finding my tests are failing, and it seems like it is due to a race condition where I am interacting with an element before it has fully loade... | 2015/03/12 | [
"https://sqa.stackexchange.com/questions/12410",
"https://sqa.stackexchange.com",
"https://sqa.stackexchange.com/users/8937/"
] | Se2 experts suggest NOT USE IMPLICIT WAIT at all. [Especially don't mix them with explicit waits](https://stackoverflow.com/questions/15164742/combining-implicit-wait-and-explicit-wait-together-results-in-unexpected-wait-ti) (Jim Evans is Se2 core team member). So @kirbycope advice is against opinion of experts (and my... | Explicit Waits are not ideal. Look into using an Implicit Wait. Official documentation, [here](http://docs.seleniumhq.org/docs/04_webdriver_advanced.jsp).
Here is a copy+paste should the URL change or something:
>
> An implicit wait is to tell WebDriver to poll the DOM for a certain amount of time when trying to fi... |
1,232,796 | The recent SIGGRAPH 2009 saw the announcement of [WebGL](http://www.khronos.org/news/press/releases/khronos-webgl-initiative-hardware-accelerated-3d-graphics-internet/) - a port of OpenGL ES to javascript.
The application that immediately came to my mind is web-based 3D first person shooters with AJAX as basis for co... | 2009/08/05 | [
"https://Stackoverflow.com/questions/1232796",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9611/"
] | 3D Google Maps in the browser with real-time navigation using location awareness.
3D How To Find Us.
3D Bar Charts in online techy reviews.
Cross-platform 3D role playing games, because WebGL will be slower because of Javascript, and probably not suitable for low-latency, high-framerate 3D games. Well, not in the ne... | Here's my WebGL based 3D map. I just got the blue marble tiles working today.
<http://github.com/fintler/lanyard>
Here's a live demo. Zooming with the mouse wheel works, but dragging to rotate is broken at the moment.
<http://github.bringhurst.org/lanyard-pre-demo-2> |
64,036,826 | I have a DevOps pipeline that is tasked with updating a file, and committing it back to a protected branch in Github. Checking out from the repo works just fine. I thought I had the right permission setup, but it doesn't work.
I have allowed azure-pipelines the permissions here:
[:
>
> Install the firebase npm package and save it to your package.json file
> by running:
>
>
>
> ```
> npm install --save firebase
>
> ```
>
> To include only specific... |
54,530,257 | I'm adding a material **ChipGroup** dynamically to a parent linear layout which is set to VERTICAL orientation but the chip items seem to be added horizontally. Is there any way to make it lay out the chip items vertically?
**setLayoutDirection()** method of ChipGroup class method doesn't seem to take any parameter th... | 2019/02/05 | [
"https://Stackoverflow.com/questions/54530257",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8889580/"
] | you can set width = match\_parent in each Chip item
```
<com.google.android.material.chip.ChipGroup
android:id="@+id/chipGroup"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginTop="20dp"
android:layou... | ```
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.chip.ChipGroup
android:id=... |
196,197 | I have a document library by which I want staff to only see items they create or modify. However, I want supervisors to see all items. Is this possible? | 2016/10/06 | [
"https://sharepoint.stackexchange.com/questions/196197",
"https://sharepoint.stackexchange.com",
"https://sharepoint.stackexchange.com/users/60769/"
] | * Create a page.
* Add your doc library as a web part.
* Then modify the web part's view.
* This will be exclusive to this page. Then set permissions on the page.
That satisfies the question in the title.
* You can use a workflow to trim item level permissions and can set to a sharepoint group of supervisors, Create... | Create a default view that only show the documents created or modified by [me]. That way user will only see the documents created or modified by them. Then remove the Allitems.aspx view from library setting. However, when you type out the URL of the view, you can still see and supervise all the documents. |
72,848,624 | I have a list of words with the format `word1**word2`
I want to put the firt word at the end of the String like `word2 - word1`.
how can I split the first word without `**` and add a `-` before paste the word at the end?
I want to let the lines read from a file `words.txt` and create a new file `new-words.txt`
For ... | 2022/07/03 | [
"https://Stackoverflow.com/questions/72848624",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15204441/"
] | Look at the [official java doc](https://docs.oracle.com/javase/7/docs/api/java/io/FileOutputStream.html). There are 3 options of how to use the `write` method, and none of them take a string as an argument.
>
> * **void write(*byte[] b*)**: Writes b.length bytes from the specified byte array
> to this file output str... | ```
star.split('**').reverse().join('-')
``` |
1,006,746 | I am trying to accomplish something in C# that I do easily in Java. But having some trouble.
I have an undefined number of arrays of objects of type T.
A implements an interface I.
I need an array of I at the end that is the sum of all values from all the arrays.
Assume no arrays will contain the same values.
This Jav... | 2009/06/17 | [
"https://Stackoverflow.com/questions/1006746",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/79534/"
] | The issue here is that C# doesn't support [co-variance](http://weblogs.asp.net/astopford/archive/2006/12/28/c-generics-covariance.aspx) (at least not until C# 4.0, I think) in generics so implicit conversions of generic types won't work.
You could try this:
```
List<I> list = new List<I>();
foreach (T[] arrayOfA in a... | [Arrays of reference objects are covariant in C#](http://blogs.msdn.com/ericlippert/archive/2007/10/17/covariance-and-contravariance-in-c-part-two-array-covariance.aspx) (the same is true for Java).
From the name, I guess that your T is a generic and not a real type, so you have to restrict it to a reference type in o... |
53,300,103 | I have a web page in which there are 'n' number of combo boxes in a column. In which I have to verify that all the drop down items in each and every combo boxes are clickable in iteration using robot framework. I have my script as follows:
```
*** Keywords ***
User should be able to select each and every role suggeste... | 2018/11/14 | [
"https://Stackoverflow.com/questions/53300103",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9669560/"
] | It should work as follows:
```
Policy.HandleResult<HttpResponseMessage>(r => r.StatusCode == HttpStatusCode.InternalServerError)
.OrResult(r => r.StatusCode == HttpStatusCode.BadGateway)
.WaitAndRetry(3, retryAttempt => TimeSpan.FromSeconds(5));
```
The `.OrResult(...)` does n... | Correct your Retry definition specifing type:
```
private RetryPolicy<HttpResponseMessage> Retry { get; }
``` |
11,471,624 | I created a conformation box from jquery. I want to submit the page and view PHP echo message when click the confirm button in the confirmation box. Can you help me with code that comes for the confirmation button?
My jQuery/javascript function is here:
```
$(document).ready(function(){
$('#click').click(function... | 2012/07/13 | [
"https://Stackoverflow.com/questions/11471624",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1434869/"
] | Do you have the HiddenHttpMethodFilter filter in your web.xml?
```
<filter>
<filter-name>hiddenHttpMethodFilter</filter-name>
<filter-class>org.springframework.web.filter.HiddenHttpMethodFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>hiddenHttpMethodFilter</filter-name>
<url-pattern>/*</... | The error messages indicate that the browser is *actually* sending a GET request rather than a DELETE request.
What you need to do is:
* examine the source of the web page that the browser is on at the time, and
* using the browser's web debugger, see what the request URL and method actually are. |
579,414 | So, I was reading an article, and just saw this sentence here:
*I figured I'd sort out the train into the city instead of hopping in a cab.*
Is that a common usage of "sort out"? It seems like it would mean "search for" or something like that, but I've never seen it used in this way. I checked in [Macmillan](https://... | 2021/11/30 | [
"https://english.stackexchange.com/questions/579414",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/439499/"
] | **sort out** (v.)
>
> Arrange or organize something
>
>
> *They are anxious to sort out travelling arrangements*
>
>
> *I've sorted the travel - that's no problem.* [Lexico](https://www.lexico.com/definition/sort_out)
>
>
>
---
>
> He stood beside her as she **sorted out** the ticket, then they walked
> acr... | From [Longman Dictionary](https://www.ldoceonline.com/dictionary/sort-out):
Sort out:
>
> 4. (especially British English) to succeed in making arrangements for something.
>
>
> |
8,051,569 | ```
USE NORTHWIND;
GO
SELECT SHIPCOUNTRY,[ORDERS_ID] =
CASE ORDERID
WHEN ORDERID = 10300
THEN 'I AM FROM 10300'
WHEN ORDERID = 10400
THEN 'I AM FROM 10400'
WHEN ORDERID = 10500
THEN 'I AM FROM 10500'
ELSE 'I AM OUT OF RANGE'
END
FROM ORDERS;
GO
```
>
> Error - Msg 102, Level 15, State 1, Line 3 Incorrect syntax nea... | 2011/11/08 | [
"https://Stackoverflow.com/questions/8051569",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1035724/"
] | The `case` construct can have two different forms:
```
case n
when n then n
when n then n
end
```
and:
```
case
when n = n then n
when n = n then n
end
```
You are mixing them. Use:
```
SELECT SHIPCOUNTRY,[ORDERS_ID] =
CASE ORDERID
WHEN 10300 THEN 'I AM FROM 10300'
WHEN 10400 THEN 'I AM FROM 1... | ```
USE NORTHWIND;
GO
SELECT SHIPCOUNTRY,
CASE ORDERID
WHEN 10300
THEN 'I AM FROM 10300'
WHEN 10400
THEN 'I AM FROM 10400'
WHEN 10500
THEN 'I AM FROM 10500'
ELSE 'I AM OUT OF RANGE'
END ORDERS_ID
FROM ORDERS;
GO
``` |
69,546 | I'm in the process of getting an apartment with my girlfriend and a friend. We plan on all sharing rent and utilities but there is a large gap in earnings between the three of us, mostly that I out-earn both combined. I want to do things as fairly as possible, so I'm unsure how to split the rent, and ensuing utilities.... | 2016/08/15 | [
"https://money.stackexchange.com/questions/69546",
"https://money.stackexchange.com",
"https://money.stackexchange.com/users/49209/"
] | Myself and my partner do things a little differently to most. We split accommodation and utilities payments by net income proportion to ensure that we both have the same amount of spending money.
For example;
* if we both earn $40,000pa we both pay 50% of the bills
* if she earns $50,000pa and I earn $25,000 she pay... | Does your apartment have several bedrooms that are all different in size? If yes, then everyone can pay by square footage. However, if you share the room with your girlfriend, it won’t work. Even if your live in a master bedroom with her, you friend will probably pay more than your girlfriend.
I heard there are websi... |
442,026 | Why don't more mainstream statically typed languages support function/method overloading by return type? I can't think of any that do. It seems no less useful or reasonable than supporting overload by parameter type. How come it's so much less popular? | 2009/01/14 | [
"https://Stackoverflow.com/questions/442026",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23903/"
] | To steal a C++ specific [answer from another very similar question](https://stackoverflow.com/questions/249296/return-type-polymorphism-in-c-like-languages#249309) (dupe?):
---
Function return types don't come into play in overload resolution simply because Stroustrup (I assume with input from other C++ architects) w... | This one is slightly different for C++; I don't know if it would be considered overloading by return type directly. It is more of a template specialization that acts in the manner of.
**util.h**
```
#ifndef UTIL_H
#define UTIL_H
#include <string>
#include <sstream>
#include <algorithm>
class util {
public:
sta... |
24,326,291 | I have the code below in a file called `code.py`. I am using `IDLE` to edit the file. When I click `Run>Run Module` I get the error:
>
> "IDLE's subprocess didn't make connection. Either IDLE can't start a
> subprocess of personal firewall software is blocking the connection."
>
>
>
I am using Windows 7 Ultimat... | 2014/06/20 | [
"https://Stackoverflow.com/questions/24326291",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3759884/"
] | Another fix!!! Hopefully this will help someone.
I had the same problem and noticed something quite interesting. I had accidentally named a file (inside the desktop folder I was working in) "tkinter" (it will cause the same problem if you rename a file by any reserved keyword, I assume). Everytime I ran or attempted ... | I also had the following problem. My file was named code.py, and was working fine untill I installed Canopy, and numpy.
I tried reinstalling python, but what solved the problem for me was simply renaming the file. I called my file myCode.py, everything started working fine. Strange problem... |
37,183,254 | I'm having some troubles using AWS C++ SDK, due to a serious lack of documentation. However I managed to compile and install it on my computer.
I'm now trying hard to have a program working and resolved quite a lot of problems, but a (hopefully) last one remains that I cannot defeat alone...
Here is the code :
```
#... | 2016/05/12 | [
"https://Stackoverflow.com/questions/37183254",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4114072/"
] | ### Answering last comment: Only one line... Pure [bash](/questions/tagged/bash "show questions tagged 'bash'"):
```
read string <InputFile
echo -n "${string%$'\r'}"
```
Explanation: `read` will read by line, so drop naturally trailing *newline*. Then `${variable%$'\r'}` will remove **1** trailing *CR*.
Have a look... | With GNU awk for multi-char RS and Binary Mode:
```
$ od -tc file
0000000 f o o b a r \r \n
0000011
$ awk -v BINMODE=3 -v RS='\r\n' -v ORS= '1' file | od -tc
0000000 f o o b a r
0000007
```
Here's why you need to set `BINMODE=3`:
```
$ awk '1' file | od -tc
0000000 f o o ... |
24,582,384 | I have 2 go files:
`/Users/username/go/src/Test/src/main/Test.go`
```
package main
import "fmt"
func main() {
fmt.Printf(SomeVar)
}
```
and file `/Users/username/go/src/Test/src/main/someFile.go`
```
package main
const SomeVar = "someFile"
```
However I am constantly getting compiler error:
>
> /Users/... | 2014/07/05 | [
"https://Stackoverflow.com/questions/24582384",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3806851/"
] | Try
```
go run Test.go someFile.go
``` | You code is correct:
* `someFile.go` and `Test.go` belong to the same package (`main`)
* `SomeVar` is a `const` declared at top level, so it has a package block scope, namely the `main` package block scope
* as a consequence, `SomeVar` is visible and can be accessed in both files
(if you need to review scoping in Go... |
2,341,976 | Supose I have a sequence $\{a\_n\}$ of positive real numbers such that $\lim\limits\_{n \to \infty}a\_n^{1/n} = 1$. Is it true that $\lim\limits\_{n \to \infty} \frac{a\_{n + 1}}{a\_n} = 1$ or depends of the sequence that a choose? | 2017/06/30 | [
"https://math.stackexchange.com/questions/2341976",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/364941/"
] | Here a simple counterexample: let $a\_n=1$ if $n$ is even, and $a\_n=2$ if $n$ is odd. Clearly $\lim\limits\_{n \mapsto \infty}a\_n^{\frac{1}{n}} = 1,$ while $a\_{n+1}/a\_n$ oscillates between $2$ and $1/2,$ i.e., does not converge. | Let $r\_n = \frac{a\_{n + 1}}{a\_n}$ and $s\_n = a\_n^{1/n}$. Then the rule is
$$ \liminf r\_n \le \liminf s\_n \le \limsup s\_n \le \limsup r\_n. $$
So if both limits exist then they are equal but $\lim s\_n$ might exist where $\lim r\_n$ might not. |
3,953,854 | I've recently become heavily involved in a few projects that are going to work as company-wide intranet systems. They will basically be intranet websites, replacing older legacy systems that are desktop-based. I'd like to research the best ways to set-up these web site, or web application projects.
Most notably, I'm ... | 2010/10/17 | [
"https://Stackoverflow.com/questions/3953854",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38629/"
] | wget (GNU command line tool) will do this for you.
The documentation for what you want to do is here:
<http://www.gnu.org/software/wget/manual/html_node/Recursive-Retrieval-Options.html> | Try Wget. it's a simple command line utility able to do that. |
943,000 | **This question has been retitled/retagged so that others may more easily find the solution to this problem.**
---
I am in the process of trying to migrate a project from the Django development server to a Apache/mod-wsgi environment. If you had asked me yesterday I would have said the transition was going very smoot... | 2009/06/03 | [
"https://Stackoverflow.com/questions/943000",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24608/"
] | Another possibility is a bug in "old" releases of mod\_wsgi (I got crazy to find, and fix, it). More info in this [bug report](http://code.google.com/p/modwsgi/issues/detail?id=121). I fixed it (for curl uploads) thanks to the [following hint](http://the-stickman.com/web-development/php-and-curl-disabling-100-continue-... | Normally apache runs as a user "www-data"; and you could have problems if it doesn't have read/write access. However, your setup doesn't seem to use apache to access the '/home/sk/src/sitename/uploads'; my understanding from this config file is unless it hit /static or /media, apache will hand it off WGSI, so it might ... |
5,896,576 | I have done its configurations using configuration wizard but I couldn't understand where it is logging messages. I even see app.config file but couldn't find any logging source.
Please guide me where it does logs and how I can check that log.
Here is my config file:
```
<?xml version="1.0" encoding="utf-8"?>
<conf... | 2011/05/05 | [
"https://Stackoverflow.com/questions/5896576",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/576510/"
] | You need to configure one or more [Trace Listeners](http://msdn.microsoft.com/en-gb/library/ff664768%28PandP.50%29.aspx). Also see [Configuration Overview](http://msdn.microsoft.com/en-gb/library/ff664760%28PandP.50%29.aspx)
**Edit 1**
Thank you for an example of you config file. You are logging your messages into App... | This is correct.
Authentication has been added to the email tracelistener in v5.0.
If you must use v4.1, there's a version of the email tracelistener with authentication on [EntLibContrib](http://entlibcontrib.codeplex.com/). |
37,977,223 | I want to remove a matching substring from a string in python .
Here is what I have tried so far:
```
abc= "20160622125255102D87Z2"
if "Z2" in abc:
abc.rstrip("Z2")
print(abc)
```
But this doesn't work. Kindly help | 2016/06/22 | [
"https://Stackoverflow.com/questions/37977223",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6500607/"
] | `rstrip()` returns a new string; it does not modify the existing string.
You have to reassign abc to contain the new string:
```
abc = abc.rstrip("Z2")
``` | It's because rstrip returns a new string. Try
```
abc = abc.rstrip("Z2")
```
Also, if the substring you want to remove could appear anywhere in the string (as opposed to being at the end always), you might instead want to use
`abc.replace("Z2","")` |
13,801 | What's the thing with $\sqrt{-1} = i$? Do they really teach this in the US? It makes very little sense, because $-i$ is also a square root of $-1$, and the choice of which root to label as $i$ is arbitrary. So saying $\sqrt{-1} = i$ is plainly false!
So why do people say $\sqrt{-1} = i$? Is this how it's taught in the... | 2010/12/10 | [
"https://math.stackexchange.com/questions/13801",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/3793/"
] | I believe this is a common misconception. Here in Sweden we (or at least I) was taught that $i^2 = -1$, *not* that $\sqrt{-1} = i$. They are two fundamentally different statements. Of course most of the time one chooses $\sqrt{-1} = i$ as the principal branch of the square root. | Alex it is just a notion. We use the value of $i = \sqrt{-1}$ so that we can work more freely. For example consider the Quadratic Equation $$x^{2}+x+1=0$$ The discriminant for this is $D=b^{2}-4ac=-3$. So the roots have the value $$x = \frac{-1 \pm{\sqrt{3}i}}{2}$$ which looks better when written with an $i$ notation. ... |
4,019,849 | Let's say I have these two functions:
```
function fnChanger(fn) {
fn = function() { sys.print('Changed!'); }
}
function foo() {
sys.print('Unchanged');
}
```
Now, if I call `foo()`, I see `Unchanged`, as expected. However, if I call `fnChanger` first, I still see `Unchanged`:
```
fnChanger(foo);
foo(); //U... | 2010/10/26 | [
"https://Stackoverflow.com/questions/4019849",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/130442/"
] | As @CMS pointed out you cannot assign it within the function due to the scope. However you could reassign it like this:
```
var fnChanger = function() {
return function() {
alert('changed!');
}
}
var foo = function() {
alert('Unchanged');
}
foo = fnChanger();
foo();
```
[example](http://jsfiddle.net/su... | **In Javascript, functions are first class objects that can be treated just as another variable**. But for the function to return its result, it has to be first invoked.
When you are invoking the fnChanger(foo), the fn variable actually gets overridden with foo().
But you are not getting the result because that funct... |
56,833 | We recently had a c.s. theory / networks paper accepted at a special issue after addressing a major revision. After we got the letter of acceptance, author proofs, signed the copyright release, etc., we got a letter saying
>
> the paper was inadvertently marked as "Accepted" which was not the decision of the guest ed... | 2015/10/24 | [
"https://academia.stackexchange.com/questions/56833",
"https://academia.stackexchange.com",
"https://academia.stackexchange.com/users/43156/"
] | Unfortunately, these things do happen sometimes, and there's not much you can do about it. If the journal does not want to publish your paper yet, there's not much you can do to get it to publish your paper without carrying out the revisions that they request. At least they caught their mistake before it was actually p... | No one here can tell you what will insure the publication of your article beyond satisfactorily making the changes that the reviewer wants.
On the other hand, I have had at least one successful case writing a strongly worded, polite, and well-reasoned rebuttal letter to the editor explaining why the reviewer is wrong... |
39,901,949 | I´m lost, so
```
public class Filter {
public static void main(String[] args) {
// read in two command-line arguments
int a = Integer.parseInt(args[0]);
int b = Integer.parseInt(args[1]);
// repeat as long as there's more input to read in
while (!StdIn.isEmpty()) {
// read in the next intege... | 2016/10/06 | [
"https://Stackoverflow.com/questions/39901949",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5388980/"
] | ```
public class Filter {
public static void main(String[] args) {
// read in two command-line arguments
int a = Integer.parseInt(args[0]);
int b = Integer.parseInt(args[1]);
// repeat as long as there's more input to read in
while (!StdIn.isEmpty()) {
// read in the next integer
int ... | `?????` needs to be `--a <= 0 && --b >= 0`.
Note that I'm exploiting the fact that `&&` is short-circuited. i.e. `--b` will not be evaluated until `--a` is 0 or less.
Eventually, of course, the `int` will underflow for a very long input steam session, but this is still a very cool solution. |
8,392,905 | I have an audio stream I'd like to include on a Facebook Page, above or at the top of, the wall. Apparently BBC did this (though I can't find the link). Any suggestions on where I should start? I have the html hosted as a Heroku app right now, and can get it to display as a separate link on the Page. But how do I move ... | 2011/12/05 | [
"https://Stackoverflow.com/questions/8392905",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/558386/"
] | value is a custom property for a td,
so you can access it using this method
```
function typeThis(){
document.getElementById('box_1').value = this.getAttribute("value");
}
```
**Side Note:**
this is how your table should look like
```
<table id = "typewriter">
<tr>
<td value="k" onclick="typeThi... | How about
```
var box = document.getElementById("box_1");
var tds = document.getElementsByTagName("td");
for (var i = 0; i < tds.length; i++) {
var valToAdd = tds[i].textContent ? tds[i].textContent :
(tds[i].innerText ? tds[i].innerText : tds[i].innerHTML);
box.value = box.value + valToAdd;
}
```... |
48,339,862 | I have a huge form with around 30 parameters and I don't think it's a good idea to do what I usually do.
The form will be serialized and pass all the parameters via ajax post to spring controller.
I usually do like this:
```
@RequestMapping(value = "/save-state", method = RequestMethod.POST)
public @ResponseBody
vo... | 2018/01/19 | [
"https://Stackoverflow.com/questions/48339862",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | You can do something like this:
```
@RequestMapping(value = "/save-state", method = RequestMethod.POST)
public void deleteEnvironment(@RequestBody MyData data) {
//code
}
```
Create a class containing all your form parameters and receive that on your method. | Correct way is to serialize all parameters as Json and call back end api with one parameter.
On back-end side get that json and parse as objects.
Example:
```
` @RequestMapping(method = POST, path = "/task")
public Task postTasks(@RequestBody String json,
@RequestParam(value = "session... |
62,091,622 | We use a shared Outlook email box and we need to save some of the attachments from that email.
I need the macro to:
* Allow user to select multiple emails and save all the attachments in the selection
* Allow the user to select what folder to save the attachments in (it will be different every time)
* Add the `Receiv... | 2020/05/29 | [
"https://Stackoverflow.com/questions/62091622",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13643329/"
] | ```
int initQueue_ch(Queue_ch* q)
{
q = (Queue_ch*)malloc(sizeof(Queue_ch));
q->count = 0;
q->front = NULL;
q->rear = NULL;
return 0;
}
```
This function is unusable. It ignores the value of `q` passed into it and does not return a pointer to the queue it initialized. C is strictly pass by value.
... | If you are initializing using malloc() then return the pointer() instead of passing pointer to function like following.
```
struct wordlist* wordlist_create(void)
{
struct wordlist* wordListPtr = (struct wordlist*) malloc(sizeof(struct wordlist));
wordListPtr->count = 0;
wordListPtr->root = getTrieNode();... |
13,506,460 | Capture the domain till the ending characters `$, \?, /, :`. I need a regex that captures `example.com` in all of these.
```
example.com:3000
example.com?pass=gas
example.com/
example.com
``` | 2012/11/22 | [
"https://Stackoverflow.com/questions/13506460",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/340688/"
] | If you actually have valid URLs, this will work:
```
var urls = [
'http://example.com:3000',
'http://example.com?pass=gas',
'http://example.com/',
'http://example.com'
];
for (x in urls) {
var a = document.createElement('a');
a.href = urls[x];
console.log(a.hostname);
}
//=> example.com
/... | I'm using Node `^10` and this is how I extract the hostname from a URL.
```
var url = URL.parse('https://stackoverflow.com/q/13506460/2535178')
console.log(url.hostname)
//=> stackoverflow.com
``` |
9,469,174 | I'm trying to set the theme for a fragment.
Setting the theme in the manifest does not work:
```
android:theme="@android:style/Theme.Holo.Light"
```
From looking at previous blogs, it appears as though I have to use a ContextThemeWrapper. Can anyone refer me to a coded example? I can't find anything. | 2012/02/27 | [
"https://Stackoverflow.com/questions/9469174",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1232691/"
] | I know its a bit late but it might help someone else because this helped me.You can also try adding the line of code below inside the onCreatView function of the fragment
```
inflater.context.setTheme(R.style.yourCustomTheme)
``` | Use this in fragment which you want different theme:
```
@Override
public void onAttach(@NonNull Context context) {
context.setTheme(R.style.your_them);
super.onAttach(context);
}
``` |
10,539,579 | Is it possible to add an app icon , like it shows in Live Aquarium Wallpaper (https://play.google.com/store/apps/details?id=fishnoodle.aquarium\_free&feature=search\_result#?t=W251bGwsMSwxLDEsImZpc2hub29kbGUuYXF1YXJpdW1fZnJlZSJd)
When I install this wallpaper, it shows and icon which opens up the settings page when cl... | 2012/05/10 | [
"https://Stackoverflow.com/questions/10539579",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1182140/"
] | You would need to declare an Activity in your `AndroidManifest.xml` with the default [intent-filter](http://developer.android.com/guide/topics/intents/intents-filters.html):
```
<activity
android:name="com.your.company.ui.SettingsActivity"
android:label="@string/app_name" >
<intent-filter>
... | For those still looking for the correct answer:
You need to declare a `<meta-data>` tag, inside your declaration of Wallpaper Service tag inside the manifest file:
```
<service
android:name=".MyWallpaperService"
android:enabled="true"
android:label="My Wallpaper"
android:permissi... |
24,083,659 | I am having a problem with multiple `ng-repeat` elements when showing `div` elements as `inline-block`. There is a strange gap between elements where one `ng-repeat` ends and the next one starts, as illustrated by the image:

I have created a [plunk](htt... | 2014/06/06 | [
"https://Stackoverflow.com/questions/24083659",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/757391/"
] | Check this [plunk](http://plnkr.co/edit/cCpFl5gqHMVMhmRxMNBZ)
There is a hack to remove space between inline elements that appears at line-break.
```
<div class="red" ng-controller="TestCtrl">
<div class="blue number" ng-repeat="number in array1 track by $index">{{number}}</div><!--
--><div class="green number" n... | This is caused by the whitespace between the `<div>` elements. There are various ways to address this like the other answers have suggested. My preferred layout is:
```
<div class="blue number" ng-repeat="number in array1 track by $index">{{number}}</div
><div class="green number" ng-repeat="number in array2 track... |
31,793,078 | I have a tail recursive implementation as below
```
@tailrec
def generate() : String = {
val token = UUID.randomUUID().toString
val isTokenExist = Await.result(get(token), 5.seconds).isDefined
if(isTokenExist) generate()
else token
}
```
`get(token)` will return a `Future[Option[Token]]`.
I know that block... | 2015/08/03 | [
"https://Stackoverflow.com/questions/31793078",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5180015/"
] | `consume` is a static method, COM does not support any support static methods only instance methods and properties. Get rid of the `static`'s from your code.
You're consume method will also always return an empty string. You are stating your `Consumer` inside of a task but you are not waiting for that task to complete... | Couple of things. In the VBA code Consumer means two things (both the variable and the container of netConsumer); this is going to cause confusion at the least.
What is the external Consumer anyway? (The one that's not the variable.) It looks from the C# code like it should be netConsumer. How are you exporting the cl... |
41,131 | The MT 1 Samuel 2:31 reads:
>
> הִנֵּה, יָמִים בָּאִים, וְגָדַעְתִּי אֶת-זְרֹעֲךָ, וְאֶת-זְרֹעַ בֵּית
> אָבִיךָ--מִהְיוֹת זָקֵן, בְּבֵיתֶךָ.
>
>
> Behold, the days come, that I will cut off thine arm, and the arm of
> thy father's house, that there shall not be an old man in thy house.
>
>
>
Or as the NIV (who ... | 2019/06/16 | [
"https://hermeneutics.stackexchange.com/questions/41131",
"https://hermeneutics.stackexchange.com",
"https://hermeneutics.stackexchange.com/users/15819/"
] | Great question, as usual!
Some possibilities/considerations:
1. Earlier spellings of the word may have made it clear that this was the correct reading. For example, in this case, the full spelling of zera (seed) would be spelled זרע, while the full spelling of zero'a (strength) would be spelled זרוע. If there were ea... | If God cut off the seed there would be no one in the house at all, but if he cut off the strength then they would all be weak and would not live to old age, so the second part of the verse supports the MT. Eli's house was deposed from the priesthood, rather than destroyed altogether. |
7,583,716 | I am facing this error when i try to commit my SVN .
```
svn: 'C:\Users\wageeha junaid\workspace\Copy of HOLS\gwt-unitCache\gwt-unitCache- 00000132A65F0D8B' does not exist
``` | 2011/09/28 | [
"https://Stackoverflow.com/questions/7583716",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/764446/"
] | you should not commit the unitCache to the versioning system. use [svn:ignore](http://svnbook.red-bean.com/en/1.1/ch07s02.html#svn-ch-7-sect-2.3.3) for that purpose. | Easy fix if you are using Eclipse: Right click on the gwt-unitCache folder and press Refresh. The problem is that you need to update the folder from the package explorer before you commit. |
56,154,094 | I have a 2 row table with `input` fields that does a calculation when I focusout on the first input. The problem I am experiencing is when I focusout on the second row, my new value is displayed in the first row corresponding `input`. I'm not sure why this is happening. I would greatly appreciate your help.
My expecta... | 2019/05/15 | [
"https://Stackoverflow.com/questions/56154094",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1465183/"
] | Your use of id's is kind of messed up. First of all be sure to use an id once in the entire HTML file.
For your usecase better use classes.
Also be sure to type your function names correct ;)
```js
function Calculate(element) {
var dollar = 216.98;
var parent = $(element).closest('tr');
var oldcost = $(eleme... | * Firstly, there is a a typo.Change `caluculate` to `calculate`
* There must not be the same `id` two elemnts have the same `id`.You could change the id of the first to `old-1` or something different |
59,165,133 | I can figure out how to see who it was last updated by, but I'm looking for a list of Jira Tickets that has been updated by someone at any point during the week. Even if someone else updated it afterwards. | 2019/12/03 | [
"https://Stackoverflow.com/questions/59165133",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5366100/"
] | I'm not sure if you're referring to Jira Server/DC or Jira Cloud. For on-premise solutions, here is my answer.
**Jira 7.x and lower**
There are no JQL functions to get this information. With out-of-the-box functions, you can actually get information only about status changes by a certain user or query history of cert... | Depends on what changes you are looking for. Jira does have limited support for search functions on history enabled fields (specifically: `Assignee`, `Fix Version`, `Priority`, `Reporter`, `Resolution` and `Status`)
Meaning you could do a search similar to:
```
status changed by "replace_user_name_here" AFTER startOf... |
15,526 | I'm making a kind of editor that have tool views (on sides of the main window) and documents being edited. In fact those documents are themselves "views" of a specific document, so you can have several different views of the same document, but it's not really the point. Each "view" has it's own state and manipulations ... | 2011/12/29 | [
"https://ux.stackexchange.com/questions/15526",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/6824/"
] | It's still fairly common to have "Document" menus in applications that will adjust settings or make changes to one particular document. I was going to mention Acrobat as @dnbrv did- they definitely used to do this, but seem to have moved away from it in version 10.
"View" menus exist as well, but they tend to deal wi... | You can go the way of Adobe Acrobat, which has a menu item called Document containing all commands for manipulating the document as opposed to reviewing tools. Having 2 sets of menus will clutter your interface more than confuse users. |
10,546,504 | I am designing a program in JAVA that captures results in about 10 iterations. At the end of these iterations all the results must be written into a log file.
If any exception occurs then it should be written on my text file and secondly the program must not stop, it must go on till the last iteration is completed...... | 2012/05/11 | [
"https://Stackoverflow.com/questions/10546504",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1365268/"
] | You're looking for the `try`-`catch` block. See, for example, [this tutorial](http://docs.oracle.com/javase/tutorial/essential/exceptions/). | the case is, in this kind of a question, you should better provide us a sample code, then only we can identify the problem without any issue.
If you just need to view the error, then "e.printStackTrace" will help you. The "e" is an instance of class "Exception".
However, if you need to LOG, then "Logger" class will h... |
47,850,439 | How can I change the parameter "symbol" in the url to each element of the array one by one and run the function multiple times?
```
var symbols = [MSFT, CSCO, FB, AMZN, GOOG];
window.onload = function() {
$.ajax({
type: "GET",
url: "https://www.alphavantage.co/query?function=TIME_SERIES_INTRADAY&symbol=AAPL&i... | 2017/12/16 | [
"https://Stackoverflow.com/questions/47850439",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9101762/"
] | You have to separate the AJAX call to stand alone function, and then call the that function each time with different parameter.
Like so:
```
window.onload = function() {
var symbols = ['MSFT', 'CSCO', 'FB', 'AMZN', 'GOOG'];
symbols.forEach( symbol => makeAjaxCall(symbol));
}
function makeAjaxCall(param){
... | You can set it as a variable:
```
$ node
> var symbol = 'aallalla'
undefined
> var html = 'http://www.google.com/?symbol='
undefined
> html + symbol
'http://www.google.com/?symbol=aallalla'
>
```
This will allow you to change it on demand. |
26,395,776 | I am constructing a navigation bar using bootstrap framework. I am trying to align the search field to extreme right,but its not happening.
any suggestion would be appreciated . below is my code
```
<h1 id="topHeader"><a href="/EduTechOnline/jsp/secure/index.jsp" id="topHeaderLink"></a></h1>
<div id="logo">
<img src="... | 2014/10/16 | [
"https://Stackoverflow.com/questions/26395776",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2218797/"
] | I wouldn't call it beautiful, but here's a method using `map`:
```
let numbers = ["1","2","3","4","5","6","7"]
let splitSize = 2
let chunks = numbers.startIndex.stride(to: numbers.count, by: splitSize).map {
numbers[$0 ..< $0.advancedBy(splitSize, limit: numbers.endIndex)]
}
```
The `stride(to:by:)` method gives y... | In Swift 4 or later you can also extend `Collection` and return a collection of `SubSequence` of it to be able to use it also with `StringProtocol` types (`String` or `Substring`). This way it will return a collection of substrings instead of a collection of a bunch of characters:
**Xcode 10.1 • Swift 4.2.1 or later**... |
2,217,132 | `AddPage()` in tcpdf automatically calls Header and Footer. How do I eliminate/override this? | 2010/02/07 | [
"https://Stackoverflow.com/questions/2217132",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15654/"
] | Use the `SetPrintHeader(false)` and `SetPrintFooter(false)` methods before calling `AddPage()`. Like this:
```
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, 'LETTER', true, 'UTF-8', false);
$pdf->SetPrintHeader(false);
$pdf->SetPrintFooter(false);
$pdf->AddPage();
``` | >
> How do I eliminate/override this?
>
>
>
Also, [Example 3 in the TCPDF docs](http://www.tcpdf.org/examples/example_003.phps) shows how to override the header and footer with your own class. |
6,822,929 | Has something was changed in the way IE9 treats the **title** attribute in an anchor tag?
I try to use a regular anchor, such as -
```
<a href="http://www.somelink.com" title="Some title here">This is a link</a>
```
A tooltip should be with the title is expected to appear, and it does appear in previous versions of... | 2011/07/25 | [
"https://Stackoverflow.com/questions/6822929",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/776561/"
] | I have found a good work-around, Place your title in an abbr tag. I've tested this in Safari, Chrome, IE9, and Firefox. It works in all of them. | I had a typical scenario wherein we had to show a image with tooltip. The image was inside a Iframe and tooltips were not being displayed, when opened in a Browser with IE 10 Compat Mode.
The alt tag helped me out. The solution was to set the images alt tag.
```html
<A onclick=navigate() title="Did not work" href="ja... |
27,531,050 | I want the cell spacing to be 0.5 for an ASP GridView. Is there any way to accomplish this as it tries to cast the value to Int32 and obviously 0.5 will not cast to Int32. I want it this way because IE expresses really ugly cell separators, but if I set CellSpacing to 0 or remove it, the cells are way too crowded.
IE9... | 2014/12/17 | [
"https://Stackoverflow.com/questions/27531050",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1282988/"
] | To call `OnMapReady(GoogleMap map)`, append the following to your `onCreate(...)` method :
```
MapFragment mapFragment = (MapFragment)
getFragmentManager().findFragmentById(R.id.map);
```
then, add:
```
// This calls OnMapReady(..). (Asynchronously)
mapFragment.getMapAsync(MapDisplay.this);
``` | Add:
```
mMap = map
```
above `onMapReady` |
20,832 | I found it odd that in John 9:30-33, the (healed) blind man refers to scripture, suddenly speaking as a learned scholar to the point where the Pharisees accuse him of lecturing them. I wonder, was it common back in those days, that even the blind and beggars would have thorough understanding of scripture? I assumed onl... | 2015/12/02 | [
"https://hermeneutics.stackexchange.com/questions/20832",
"https://hermeneutics.stackexchange.com",
"https://hermeneutics.stackexchange.com/users/11359/"
] | The setting here is long before the invention of the printing press. The scriptures were hand copied, thus ordinary people would not have been able to own a copy of the scriptures. However, in ancient Judea during the Second Temple Period, the Jewish scriptures(Christian Old Testament) would have been publicly availabl... | All Israelites men were required to teach all of their household the laws as well as assemble themselves on the Sabbath at the synagogue to hear the master builders (rabbis) and the reading of the Torah. |
21,795 | My Nikon D3100 out of the blue cannot focus correctly.
It seem the that the focus motor always stops at the end of the run (Infinity) and cannot lock on the target, thus cannot release the shutter. I tried with two other AF-S lens but still the same.
This only happen when I use the viewfinder. The AF motor works fine... | 2012/03/28 | [
"https://photo.stackexchange.com/questions/21795",
"https://photo.stackexchange.com",
"https://photo.stackexchange.com/users/9177/"
] | If it won't focus in OVF mode with several lens, especially after checking all focus options and switches, switching in/out of manual focus, re-seating the lens, cleaning the contacts AND verifying that the live-view CDAF works in the very same situations, I would contact the vendor and/or Nikon and possibly send in fo... | I read this thread when I had the same problem (with live view). Turned the Rangefinder off, then back on and now it works. |
669,062 | I have a variable, `var`, that contains:
```
XXXX YY ZZZZZ\n
aaa,bbb,ccc
```
All I want is `aaa` in the second line.
I tried:
```
out=$(echo "$var" | awk 'NR==2{sub(",.*","")}' )
```
but I get no output. I tried using `,` as the FS but I can't get the syntax right. I really want to learn awk/regex syntax.
I want... | 2021/09/15 | [
"https://unix.stackexchange.com/questions/669062",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/475899/"
] | You don't want regexes there. The entire point of `awk` is to automatically split a line into fields, so just set the field separator to `,` and print the first field of the second line:
```
$ printf '%s' "$var" | awk -F, 'NR==2{print $1}'
aaa
```
Or, if your shell supports `<<<`:
```
$ awk -F, 'NR==2{print $1}' <<... | Using `cut`:
```
cut -d, -f1
```
will give you the first field (`-f1`) until the delimiter `-d`
If you want the last line only, you can pipe from `tail`. Or pipe from `sed` to get a specific line.
```
tail -n1 <<< "$var" | cut -d, -f1
sed -n 2p <<< "$var" | cut -d, -f1
``` |
21,705,533 | I'm currently developing an application on MVC3 and:
1. I have a form in which the user is completing the form for each
register.
2. When he click one button the records are passed to the controller
and stored in a list and then passed to the view again to show a
preview of what is at the momment in the "buffer"
3. Th... | 2014/02/11 | [
"https://Stackoverflow.com/questions/21705533",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2662302/"
] | You can use [array\_walk](http://us1.php.net/array_walk) and [explode](http://us1.php.net/explode) to do this.
```
$array = array();
$string = "2,100|7,104|15,1110";
array_walk(explode("|", $string), function($value) use(&$array) {
$group = explode(",", $value);
$array[$group[0]] = $group[1];
});
```
PHP 5.... | Like Yatin Trivedi said, exploding twice should give you the result that you are after:
```
$string = '2,100|7,104|15,1110';
$result = array();
foreach (explode('|', $string) as $entry) {
$values = explode(',', $entry);
$result[$values[0]] = $values[1];
}
``` |
57,944,714 | I got an error when I tried to add flutter to an existing iOS app it worked fine on the android side, in IOS I got this error message :
```
/Users/mac/Library/Developer/Xcode/DerivedData/Fixit- dffmmspbqmueppghdvveloietubr/Build/Intermediates.noindex/Fixit.build/Debug- iphoneos/Fixit.build/Script-04B0EA9A232E6ABD008A0... | 2019/09/15 | [
"https://Stackoverflow.com/questions/57944714",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6462382/"
] | if you create a script file in the build phase for building dart code remove it and add this to your podfile :
```
flutter_application_path = 'Users/mac/FixitApps/customerApp/fixit_flutter_customer_app/'
eval(File.read(File.join(flutter_application_path, '.ios', 'Flutter', 'podhelper.rb')), binding)
install_all_... | In my case when I have deleted some files from assets but forget to remove from pubspes.yaml.
Error solved after
1. remove deleted files from pubspes.yaml
2. click on `pub get`.
3. run on device |
51,703,562 | I have this query
```
select p.ID, dp.ID
from MyDB.dbo.Table1 as p
inner join MyDB.dbo.Table2 as dp
on p.Title = dp.Title
```
It compares two strings(varchars) and it gives 113 rows which is the right result.
I am not sure what should I do in TSQL to get only the IDs/rows where p.Title is different then dp.Title.
... | 2018/08/06 | [
"https://Stackoverflow.com/questions/51703562",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/885838/"
] | Try the following query-:
```
select a.ID,b.ID from (
select ID,ROW_NUMBER() over (order by ID) rn
from MyDB.dbo.Table1
where ID
not in (select MyDB.dbo.Table1.ID from MyDB.dbo.Table1 join MyDB.dbo.Table2 on MyDB.dbo.Table1.name=MyDB.dbo.Table2.name)
)a
full outer join (
select ID,ROW_NUMBER() over (order by ID) ... | I am not entirely sure what you are after. Here is a little fiddle showing the simple join on "inequality" of titles: <http://rextester.com/TFIXP19067>
```
select p.ID id1, dp.ID id2, p.title t1, dp.title t2
from Table1 as p
inner join Table2 as dp
on p.Title != dp.Title
```
This query will give you a "Cartesian pro... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.