qid int64 1 74.7M | question stringlengths 15 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 4 30.2k | response_k stringlengths 11 36.5k |
|---|---|---|---|---|---|
44,172,452 | Suppose the tag is an embed link from Google maps:
```
<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3025.306387423317!2d-74.04668908414591!3d40.68924937933434!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x89c25090129c363d%3A0x40c6a5770d25022b!2sStatue+of+Liberty+National+Monument!5e0!3m2!1... | 2017/05/25 | [
"https://Stackoverflow.com/questions/44172452",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7364168/"
] | Just use `embed_link` as a selector
```js
$(document).ready(function() {
$(".save_button").on('click', function() {
var embed_link = $("#embed_link").val();
alert($(embed_link).attr('src')); // Works
});
});
```
```html
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jq... | ```
$(document).ready(function() {
$(".save_button").on('click', function() {
var embed_link = $("#embed_link").val();
//var embed_src = $('#embed_link').val().attr('src');
console.log($(embed_link)[0].src);
});
});
``` |
44,172,452 | Suppose the tag is an embed link from Google maps:
```
<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3025.306387423317!2d-74.04668908414591!3d40.68924937933434!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x89c25090129c363d%3A0x40c6a5770d25022b!2sStatue+of+Liberty+National+Monument!5e0!3m2!1... | 2017/05/25 | [
"https://Stackoverflow.com/questions/44172452",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7364168/"
] | ```js
$(document).ready(function() {
$(".save_button").on('click', function() {
var embed_link = $("#embed_link").val();
console.log($(embed_link).attr('src')); // Works
});
});
```
```html
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input type="text" i... | ```
$(document).ready(function() {
$(".save_button").on('click', function() {
var embed_link = $("#embed_link").val();
//var embed_src = $('#embed_link').val().attr('src');
console.log($(embed_link)[0].src);
});
});
``` |
6,673,779 | I have never used a database before, so bear with me. I am programming for the Android tablet and don't have one in my possession yet, but will be getting it within a week. I have a .csv file in Excel whose data I would like to use in my app. I am aware that Androids come with SQLite, but exactly what that is or how to... | 2011/07/13 | [
"https://Stackoverflow.com/questions/6673779",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/794243/"
] | You can [download SQLite](http://www.sqlite.org/download.html) to you PC and tinker with it in the meantime. The import doesn't have to happen on the phone.
You can find many ways to do this process in [their wiki](http://www.sqlite.org/cvstrac/wiki?p=ImportingFiles). | Try something like this:
```
...
BufferedReader buffer = new BufferedReader(new InputStreamReader(inStream));
String line = "";
db.beginTransaction();
try {
while ((line = buffer.readLine()) != null) {
String[] colums = line.split(",");
if (colums.length != 4) {
... |
41,956,644 | Hello: please can someone help me to fix this grade issue I kept seeing this error message "Error: Execution failed for task `:app:processDebugGoogleServices`.
>
> Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at <https:... | 2017/01/31 | [
"https://Stackoverflow.com/questions/41956644",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7468769/"
] | **The problem is**
>
> You should not mix older support libs (eg `9.8.0` in your case) with newer support libs (eg. `10.0.1` in your case)
>
>
>
**Reson is**
Latest 10.0.1 version might have some newer function/features which might not even have definitions in older 9.8.0 lib.
This might lead to compilation ... | Try replacing:
```
compile 'com.google.android.gms:play-services-appindexing:9.8.0'
```
by
```
compile 'com.google.firebase:firebase-appindexing:10.0.1'
```
or
```
compile 'com.google.android.gms:play-services-appindexing:10.0.1'
``` |
58,682,545 | I have two dataframes namely df, and df1. I am interested in currency conversion for dataframe df.
In df dataframe we have 6 columns. First Column is Date and rest are currency values for respective dates. I want to convert these currencies into proper format. In dataframe df1 I have 2 columns, first is currency and se... | 2019/11/03 | [
"https://Stackoverflow.com/questions/58682545",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10893993/"
] | >
> Can anyone explain the technical reason?
>
>
>
No, because there is no technical reason. It would have been perfectly possible to design language semantics that permitted a branch that leaves a finally, and other languages do allow it. There could be some small difficulties, as the rules for where branches may... | Yes, if you're trying to `return` inside a finally, you're getting the error
>
> CS0157 Control cannot leave the body of a finally clause
>
>
>
But Besides Eric's excellent answer, and I completely agree with his opinion, there is still a **workaround** possible:
```
void Main() {
MyFunction();
}
void MyFun... |
63,079,429 | I have a df as such:
```
column A column B column C .... ColumnZ
index
X 1 4 7 10
Y 2 5 8 11
Z 3 6 9 12
```
For the life on me I can't figure out how to sum rows for each... | 2020/07/24 | [
"https://Stackoverflow.com/questions/63079429",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11025776/"
] | You can use:
```
df.loc['total'] = df.sum(numeric_only=True, axis=0)
``` | Try this:
```
import pandas as pd
df = pd.DataFrame({'column A': [1, 2, 3], 'column B': [4, 5, 6], 'column C': [7, 8, 9]})
df.loc['total'] = df.sum()
print(df)
```
Output:
```
column A column B column C
0 1 4 7
1 2 5 8
2 3 6 ... |
27,825 | I am a novice photographer looking to get into DSLR photography. I have an old Maxxum 5 and a couple lenses for it: a [75-300 zoom](http://www.dyxum.com/lenses/detail.asp?idlens=55) and a [28-80 zoom](http://www.dyxum.com/lenses/detail.asp?IDLens=34). After reading [this question](https://photo.stackexchange.com/questi... | 2012/10/07 | [
"https://photo.stackexchange.com/questions/27825",
"https://photo.stackexchange.com",
"https://photo.stackexchange.com/users/11169/"
] | Summary:
* The 18-55mm kit lens is better than many kit lenses and is worth buying.
(This is based on an extensive body of information available for both lenses. See below)
* While many old Minolta Full Frame lenses are very good optically, and better than typical entry level A-mount Sony lenses, in this case the 1... | If you don't think you'll go wider than the full-frame equivalent of 42mm, save the $100.
I'd say you've got two things to consider:
1. Field of view
2. Size and weight
First, **field of view**:
The sensor on an a57 is an APS-C size, which is smaller than the full 135 format frame that your Maxxum 5 would have used... |
1,874,756 | >
> $A = \left\{ \left|\frac{x^2-2}{x^2+2}\right| : x\in\mathbb Q \right\}$
>
>
> 1.) Prove that $A$ is bounded, and that: $\inf A=0$, $\sup A=1$.
>
>
> 2.) Does $\max A$ exist? Does $\min A$ exist?
>
>
>
I'm hoping someone could check my work/train of thought.
Well to show that $A$ is lower bounded is quite ... | 2016/07/29 | [
"https://math.stackexchange.com/questions/1874756",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/345950/"
] | To begin with, you're missing some symbols in your definition of $A$ -- what you probably mean is
$$ A = \left\{ \left|\frac{x^2-2}{x^2+2}\right| : x\in\mathbb R \right\} $$
or (equivalently) to let $A$ be the range of $f$ where
$$ f(x) = \frac{x^2-2}{x^2+2} $$
You have a correct argument that $0$ is **a** lower bound... | For your first part:
>
> Well to show that A is lower bounded is quite trivial, since $|x|\ge 0$, therefore: $\left| \frac{x^2-2}{x^2+2} \right|\ge 0$
>
>
>
There is no any connection between the causation and the conclusion. The reason why the conclusion holds because:
Analytically, one can let $x^2-2=0$ and so... |
1,874,756 | >
> $A = \left\{ \left|\frac{x^2-2}{x^2+2}\right| : x\in\mathbb Q \right\}$
>
>
> 1.) Prove that $A$ is bounded, and that: $\inf A=0$, $\sup A=1$.
>
>
> 2.) Does $\max A$ exist? Does $\min A$ exist?
>
>
>
I'm hoping someone could check my work/train of thought.
Well to show that $A$ is lower bounded is quite ... | 2016/07/29 | [
"https://math.stackexchange.com/questions/1874756",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/345950/"
] | To begin with, you're missing some symbols in your definition of $A$ -- what you probably mean is
$$ A = \left\{ \left|\frac{x^2-2}{x^2+2}\right| : x\in\mathbb R \right\} $$
or (equivalently) to let $A$ be the range of $f$ where
$$ f(x) = \frac{x^2-2}{x^2+2} $$
You have a correct argument that $0$ is **a** lower bound... | The first part is roughly correct. In the second part, however, you seem to be assuming that $A$ is taking rationals values and only those.
That's actually not the case, since numerator and denominator are real numbers. Even if they were integers, the fraction wouldn't necessarily assume all the rational values.
So, ... |
22,487,819 | I have a map `m`, a key `k` and a function `f`. Is it possible to rewrite this code simpler?
```
(assoc m k (f (get m k))
``` | 2014/03/18 | [
"https://Stackoverflow.com/questions/22487819",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/273699/"
] | Try [clojure.core/update-in](http://clojuredocs.org/clojure_core/clojure.core/update-in)
```
(update-in m [k] f)
```
Edit: Clojure 1.7 introduced [clojure.core/update](https://clojuredocs.org/clojure.core/update)
```
(update m k f)
``` | update-in does this nicely, though it's especially useful for nested maps:
```
> (update-in {:a 4} [:a] + 7)
{:a 11}
> (update-in {:a {:b 4 :c {:d 8}} :q :foo} [:a :c :d] + 7)
{:a {:c {:d 15}, :b 4}, :q :foo}
``` |
20,512,814 | I want to implement multi-map support in Leaflet. So far, I've been able to display Google Map tiles. Now I am looking for a way to display the traffic layer as well. | 2013/12/11 | [
"https://Stackoverflow.com/questions/20512814",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/681671/"
] | You can run a query like this (SQL Server version below, other dbs are similar):
```
Select 'db1' as db, 'T1' as table from db1.dbo.T1 where 'Some_value' in (C1, C2)
union all
Select 'db1' as db, 'T2' as table from db1.dbo.T1 where 'Some_value' in (C3, C4, C5)
union all
Select 'db2' as db, 'T1' as table from db2.dbo.T... | try this query in oracle, you can use `val` as variable :
```
select Tab1.* from
(Select 'D1' as DataBase,D1.T1.* from D1.T1
UNION ALL
Select 'D2' as DataBase,D2.T1.* from D2.T1
UNION ALL
Select 'D3' as DataBase,D3.T1.* from D3.T1) Tab1,
(select 'Some_value' as val from dual)Tab2
WHERE
Tab1.C1 = Tab2.val;
``` |
20,512,814 | I want to implement multi-map support in Leaflet. So far, I've been able to display Google Map tiles. Now I am looking for a way to display the traffic layer as well. | 2013/12/11 | [
"https://Stackoverflow.com/questions/20512814",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/681671/"
] | You can run a query like this (SQL Server version below, other dbs are similar):
```
Select 'db1' as db, 'T1' as table from db1.dbo.T1 where 'Some_value' in (C1, C2)
union all
Select 'db1' as db, 'T2' as table from db1.dbo.T1 where 'Some_value' in (C3, C4, C5)
union all
Select 'db2' as db, 'T1' as table from db2.dbo.T... | yes you need dynamic Sql .
i) first find how many database you hv at that time.
then in each loop create another loop thru all tables of that database and so on.
BTW,what are you trying to do in first place that you will have N no. of database and M no. of tables in each . |
20,512,814 | I want to implement multi-map support in Leaflet. So far, I've been able to display Google Map tiles. Now I am looking for a way to display the traffic layer as well. | 2013/12/11 | [
"https://Stackoverflow.com/questions/20512814",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/681671/"
] | try this query in oracle, you can use `val` as variable :
```
select Tab1.* from
(Select 'D1' as DataBase,D1.T1.* from D1.T1
UNION ALL
Select 'D2' as DataBase,D2.T1.* from D2.T1
UNION ALL
Select 'D3' as DataBase,D3.T1.* from D3.T1) Tab1,
(select 'Some_value' as val from dual)Tab2
WHERE
Tab1.C1 = Tab2.val;
``` | yes you need dynamic Sql .
i) first find how many database you hv at that time.
then in each loop create another loop thru all tables of that database and so on.
BTW,what are you trying to do in first place that you will have N no. of database and M no. of tables in each . |
8,436,708 | I have json data as a string that is being passed to javascript. Before the string is passed though, I am doing a search in php for all double quotes and replacing them. This is working fine but some of the json strings have (what looks like) an MS Word style double quote, possibly italicized. So my `<?php $t = str_rep... | 2011/12/08 | [
"https://Stackoverflow.com/questions/8436708",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/545192/"
] | ```
<?php
function mb_str_replace($needle, $replacement, $haystack) {
return implode($replacement, mb_split($needle, $haystack));
}
$t = "as“da”sd";
$t = mb_str_replace("”", "", $t);
$t = mb_str_replace("“", "", $t);
#and all the other weird quotes :)
echo $t;
?>
```
<http://php.net/manual/en/ref.mbstring.php>
... | I tried it myself , so only thing i could come up with that you have to use UTF-8 encoding.
```
<?php
header('content-type: text/html; charset=utf-8');
$str = "“ > and < ”\"";
$replaceArr = array("“", "”", "\"");
$replaced = str_replace($replaceArr,"",$str);
echo $replaced;
?>
```
Looks clean fo... |
59,941,229 | I've just updated R to version 3.6.2 "dark and stormy night" released December 12th last year. I've tried installing the following packages but have received the same error, "installation of package X had non-zero exit status".
The packages include: broom, tidyr, tidyselect, vctrs, and rlang.
I've examined documenta... | 2020/01/28 | [
"https://Stackoverflow.com/questions/59941229",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12413387/"
] | When you call `install.packages("broom")` (or insert package), it appears the message you receive is:
`Do you want to install from sources the packages which need compilation? (Yes/no/cancel)` to which you have answered `yes`.
Try `no` and compare results. This should fix the issue. | I have ran into this issue with other packages. My solution is to read the output of dependent packages that are listed in red and identified with issues (e.g., "cannot install"). In RStudio, go to the "Packages" tab and remove all the packages (click on the x) raising the "red-flags" in the required updates. Restart R... |
8,253,898 | I need to fire a plugin on certain trigger elements.
I'm using this:
```
$( ':jqmData(role="page"):jqmData(trig="true")' ).live( 'pagebeforeshow',function(e){
console.log("detected");
// stuff to do...
});
```
Since this is my background page (first one in the DOM), using **live** fires it on every trans... | 2011/11/24 | [
"https://Stackoverflow.com/questions/8253898",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/536768/"
] | You don't have to "shift" the list, instead when inserting you do something like this (pseudo-code):
```
if new_node.priority > list.head.priority:
new_node.next = list.head
list.head = new_node
else:
previous = null
for current = list.head:
if current.priority < node.priority:
prev... | I think you are having trouble because a priority queue should be implemented with a *heap tree*, not a singly linked-list.
The heap makes everything easy -- all operations are very cheap: updating, deleting and inserting in the heap are all O(log n). |
8,253,898 | I need to fire a plugin on certain trigger elements.
I'm using this:
```
$( ':jqmData(role="page"):jqmData(trig="true")' ).live( 'pagebeforeshow',function(e){
console.log("detected");
// stuff to do...
});
```
Since this is my background page (first one in the DOM), using **live** fires it on every trans... | 2011/11/24 | [
"https://Stackoverflow.com/questions/8253898",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/536768/"
] | I think you are having trouble because a priority queue should be implemented with a *heap tree*, not a singly linked-list.
The heap makes everything easy -- all operations are very cheap: updating, deleting and inserting in the heap are all O(log n). | Ok, i don't know why you need it in C. In C++ STL it is available.
But as you want here is the link to source code of your ask.
```
http://matrixsust.blogspot.com/2011/11/basic-priority-queue-in-c.html
```
OR
```
http://www.indiastudychannel.com/projects/4870-Priority-queue-using-array.aspx
```
Hope it helps. |
8,253,898 | I need to fire a plugin on certain trigger elements.
I'm using this:
```
$( ':jqmData(role="page"):jqmData(trig="true")' ).live( 'pagebeforeshow',function(e){
console.log("detected");
// stuff to do...
});
```
Since this is my background page (first one in the DOM), using **live** fires it on every trans... | 2011/11/24 | [
"https://Stackoverflow.com/questions/8253898",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/536768/"
] | I think you are having trouble because a priority queue should be implemented with a *heap tree*, not a singly linked-list.
The heap makes everything easy -- all operations are very cheap: updating, deleting and inserting in the heap are all O(log n). | A priority queue is an Abstract Data Type which basically keeps items in it in sorted order (ascending or descending) on some chosen key. As mentioned by Anthony Blake, the heap implementation is the most straight forward, the underlying structure you use is simply an array and you perform some manipulation centered th... |
8,253,898 | I need to fire a plugin on certain trigger elements.
I'm using this:
```
$( ':jqmData(role="page"):jqmData(trig="true")' ).live( 'pagebeforeshow',function(e){
console.log("detected");
// stuff to do...
});
```
Since this is my background page (first one in the DOM), using **live** fires it on every trans... | 2011/11/24 | [
"https://Stackoverflow.com/questions/8253898",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/536768/"
] | You don't have to "shift" the list, instead when inserting you do something like this (pseudo-code):
```
if new_node.priority > list.head.priority:
new_node.next = list.head
list.head = new_node
else:
previous = null
for current = list.head:
if current.priority < node.priority:
prev... | Ok, i don't know why you need it in C. In C++ STL it is available.
But as you want here is the link to source code of your ask.
```
http://matrixsust.blogspot.com/2011/11/basic-priority-queue-in-c.html
```
OR
```
http://www.indiastudychannel.com/projects/4870-Priority-queue-using-array.aspx
```
Hope it helps. |
8,253,898 | I need to fire a plugin on certain trigger elements.
I'm using this:
```
$( ':jqmData(role="page"):jqmData(trig="true")' ).live( 'pagebeforeshow',function(e){
console.log("detected");
// stuff to do...
});
```
Since this is my background page (first one in the DOM), using **live** fires it on every trans... | 2011/11/24 | [
"https://Stackoverflow.com/questions/8253898",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/536768/"
] | You don't have to "shift" the list, instead when inserting you do something like this (pseudo-code):
```
if new_node.priority > list.head.priority:
new_node.next = list.head
list.head = new_node
else:
previous = null
for current = list.head:
if current.priority < node.priority:
prev... | You are OK with priority queues. But...
A linked list is not a simple array.
Each item in a linked list has a reference to the next item. You can insert an item after another one just by changing the references of these two items.
```
+--------+
| item A | +--------+
+--------+ +-------... |
8,253,898 | I need to fire a plugin on certain trigger elements.
I'm using this:
```
$( ':jqmData(role="page"):jqmData(trig="true")' ).live( 'pagebeforeshow',function(e){
console.log("detected");
// stuff to do...
});
```
Since this is my background page (first one in the DOM), using **live** fires it on every trans... | 2011/11/24 | [
"https://Stackoverflow.com/questions/8253898",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/536768/"
] | You don't have to "shift" the list, instead when inserting you do something like this (pseudo-code):
```
if new_node.priority > list.head.priority:
new_node.next = list.head
list.head = new_node
else:
previous = null
for current = list.head:
if current.priority < node.priority:
prev... | A priority queue is an Abstract Data Type which basically keeps items in it in sorted order (ascending or descending) on some chosen key. As mentioned by Anthony Blake, the heap implementation is the most straight forward, the underlying structure you use is simply an array and you perform some manipulation centered th... |
8,253,898 | I need to fire a plugin on certain trigger elements.
I'm using this:
```
$( ':jqmData(role="page"):jqmData(trig="true")' ).live( 'pagebeforeshow',function(e){
console.log("detected");
// stuff to do...
});
```
Since this is my background page (first one in the DOM), using **live** fires it on every trans... | 2011/11/24 | [
"https://Stackoverflow.com/questions/8253898",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/536768/"
] | You are OK with priority queues. But...
A linked list is not a simple array.
Each item in a linked list has a reference to the next item. You can insert an item after another one just by changing the references of these two items.
```
+--------+
| item A | +--------+
+--------+ +-------... | Ok, i don't know why you need it in C. In C++ STL it is available.
But as you want here is the link to source code of your ask.
```
http://matrixsust.blogspot.com/2011/11/basic-priority-queue-in-c.html
```
OR
```
http://www.indiastudychannel.com/projects/4870-Priority-queue-using-array.aspx
```
Hope it helps. |
8,253,898 | I need to fire a plugin on certain trigger elements.
I'm using this:
```
$( ':jqmData(role="page"):jqmData(trig="true")' ).live( 'pagebeforeshow',function(e){
console.log("detected");
// stuff to do...
});
```
Since this is my background page (first one in the DOM), using **live** fires it on every trans... | 2011/11/24 | [
"https://Stackoverflow.com/questions/8253898",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/536768/"
] | You are OK with priority queues. But...
A linked list is not a simple array.
Each item in a linked list has a reference to the next item. You can insert an item after another one just by changing the references of these two items.
```
+--------+
| item A | +--------+
+--------+ +-------... | A priority queue is an Abstract Data Type which basically keeps items in it in sorted order (ascending or descending) on some chosen key. As mentioned by Anthony Blake, the heap implementation is the most straight forward, the underlying structure you use is simply an array and you perform some manipulation centered th... |
168,926 | I need my device to have multiple power sources, and connect to different power supplies depending on power availability. Each power source is a different rechargeable, Lithium-ion battery like [this one](http://www.ns-electric.com/products/energyshield/). I am wondering what sensors/techniques/devices/etc. exist so I ... | 2015/05/04 | [
"https://electronics.stackexchange.com/questions/168926",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/52532/"
] | Have you consulted the data sheet? Usually when it does not do anything it is a config problem.
I have absolutely no knowledge on this but from [PIC18(L)F2X/4XK22 Data Sheet](http://ww1.microchip.com/downloads/en/DeviceDoc/41412F.pdf).
>
> Note 1: Quartz crystal characteristics vary according to type, package and ma... | The value of the capacitors affects the final crystal frequency more than it affects the ability to oscillate. So an extra stray 1 pf shouldn't kill it. But maybe it's time to apply a little research. The crystal oscillator is just an amplifier with feedback. The OSC2 pin is the output--it should be sitting high or low... |
168,926 | I need my device to have multiple power sources, and connect to different power supplies depending on power availability. Each power source is a different rechargeable, Lithium-ion battery like [this one](http://www.ns-electric.com/products/energyshield/). I am wondering what sensors/techniques/devices/etc. exist so I ... | 2015/05/04 | [
"https://electronics.stackexchange.com/questions/168926",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/52532/"
] | Have you consulted the data sheet? Usually when it does not do anything it is a config problem.
I have absolutely no knowledge on this but from [PIC18(L)F2X/4XK22 Data Sheet](http://ww1.microchip.com/downloads/en/DeviceDoc/41412F.pdf).
>
> Note 1: Quartz crystal characteristics vary according to type, package and ma... | It actually worked after further improvements on the layout... I can't say I have actually pinpointed where the problem was. I then edited the 2 boards that were not working... connected traces by wires and removed the PCB traces (traces for crystal,caps,and their GND).. they worked fine. |
168,926 | I need my device to have multiple power sources, and connect to different power supplies depending on power availability. Each power source is a different rechargeable, Lithium-ion battery like [this one](http://www.ns-electric.com/products/energyshield/). I am wondering what sensors/techniques/devices/etc. exist so I ... | 2015/05/04 | [
"https://electronics.stackexchange.com/questions/168926",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/52532/"
] | The value of the capacitors affects the final crystal frequency more than it affects the ability to oscillate. So an extra stray 1 pf shouldn't kill it. But maybe it's time to apply a little research. The crystal oscillator is just an amplifier with feedback. The OSC2 pin is the output--it should be sitting high or low... | It actually worked after further improvements on the layout... I can't say I have actually pinpointed where the problem was. I then edited the 2 boards that were not working... connected traces by wires and removed the PCB traces (traces for crystal,caps,and their GND).. they worked fine. |
111,528 | Finn witnesses the destruction of Hosnian Prime and 4 other planets while standing on Takodana. If Takodana is not in the Hosnian system ([Wookieepedia doesn't seem to think it is](http://starwars.wikia.com/wiki/Takodana)) how can they see the planets so distinctly? Is this just a case of "Star Wars is fantasy, not sci... | 2015/12/21 | [
"https://scifi.stackexchange.com/questions/111528",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/5912/"
] | ### No.
According to the map published in *TFA Visual Dictionary*, they are in different **parts of the Galaxy** alltogether.
[](https://i.stack.imgur.com/ld4Ut.jpg)
Hosnian Prime isn't in Western Reaches (because "West" is very well defined in a ga... | [Pablo Hidalgo tweeted](https://twitter.com/pablohidalgo/status/679446507716653056) that the shot from Starkiller Base ripped a hole in hyperspace that made what happened visible to the people on Takodana (and maybe other places as well). I mean that's not science but it's a good Star Wars explanation. |
111,528 | Finn witnesses the destruction of Hosnian Prime and 4 other planets while standing on Takodana. If Takodana is not in the Hosnian system ([Wookieepedia doesn't seem to think it is](http://starwars.wikia.com/wiki/Takodana)) how can they see the planets so distinctly? Is this just a case of "Star Wars is fantasy, not sci... | 2015/12/21 | [
"https://scifi.stackexchange.com/questions/111528",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/5912/"
] | ### No.
According to the map published in *TFA Visual Dictionary*, they are in different **parts of the Galaxy** alltogether.
[](https://i.stack.imgur.com/ld4Ut.jpg)
Hosnian Prime isn't in Western Reaches (because "West" is very well defined in a ga... | The Starkiller weapon fired through hyperspace. This is why it was able to get a beam of energy to travel half-way across the galaxy in a matter of seconds. I think this same hyperspace tunneling created an effect where one could look at the resulting destruction.
Think of it as a hyperspace-window that allows you to... |
111,528 | Finn witnesses the destruction of Hosnian Prime and 4 other planets while standing on Takodana. If Takodana is not in the Hosnian system ([Wookieepedia doesn't seem to think it is](http://starwars.wikia.com/wiki/Takodana)) how can they see the planets so distinctly? Is this just a case of "Star Wars is fantasy, not sci... | 2015/12/21 | [
"https://scifi.stackexchange.com/questions/111528",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/5912/"
] | [Pablo Hidalgo tweeted](https://twitter.com/pablohidalgo/status/679446507716653056) that the shot from Starkiller Base ripped a hole in hyperspace that made what happened visible to the people on Takodana (and maybe other places as well). I mean that's not science but it's a good Star Wars explanation. | The Starkiller weapon fired through hyperspace. This is why it was able to get a beam of energy to travel half-way across the galaxy in a matter of seconds. I think this same hyperspace tunneling created an effect where one could look at the resulting destruction.
Think of it as a hyperspace-window that allows you to... |
63,498,375 | How i can make red label at chart. I want to make red just Sunday and Saturday and leave the others gray: [](https://i.stack.imgur.com/tigz9.png)
```
.ct-label {
font-size: 9px;
color: red; // this is make all label the red
}
```
```
<div style={{height: '100%'}} ... | 2020/08/20 | [
"https://Stackoverflow.com/questions/63498375",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13961512/"
] | Use `display:inline-block` instead of `display:block`
```
.progress .circle,
.progress .bar {
display: block;
}
```
And interchanged `width` and `height` of progress bar
```
.progress .bar {
position: relative;
width: 6px; // already given 80px in question
height: 80px; // already given 6px in question
}
`... | you can use pseudo class to make the stick and use position to center it
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Static Template</ti... |
63,498,375 | How i can make red label at chart. I want to make red just Sunday and Saturday and leave the others gray: [](https://i.stack.imgur.com/tigz9.png)
```
.ct-label {
font-size: 9px;
color: red; // this is make all label the red
}
```
```
<div style={{height: '100%'}} ... | 2020/08/20 | [
"https://Stackoverflow.com/questions/63498375",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13961512/"
] | ```css
*,
*:after,
*:before {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: "Open Sans";
}
/* Form Progress */
body{
display: flex;
justify-content: center;
}
.progress {
display: flex;
flex-direction: column;
justify-content: center;
margin: 20px auto;
text-align: center;
padding... | you can use pseudo class to make the stick and use position to center it
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Static Template</ti... |
63,498,375 | How i can make red label at chart. I want to make red just Sunday and Saturday and leave the others gray: [](https://i.stack.imgur.com/tigz9.png)
```
.ct-label {
font-size: 9px;
color: red; // this is make all label the red
}
```
```
<div style={{height: '100%'}} ... | 2020/08/20 | [
"https://Stackoverflow.com/questions/63498375",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13961512/"
] | Was it necessary? In css, I marked my changes.
```css
*,
*:after,
*:before {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: "Open Sans";
}
/* Form Progress */
/*add*/
.label_box {
display: inline-flex;
align-items: center;
}
/*--------------*/
.progress {
margin: 20px auto;
text-align: ... | you can use pseudo class to make the stick and use position to center it
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Static Template</ti... |
63,498,375 | How i can make red label at chart. I want to make red just Sunday and Saturday and leave the others gray: [](https://i.stack.imgur.com/tigz9.png)
```
.ct-label {
font-size: 9px;
color: red; // this is make all label the red
}
```
```
<div style={{height: '100%'}} ... | 2020/08/20 | [
"https://Stackoverflow.com/questions/63498375",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13961512/"
] | Use `display:inline-block` instead of `display:block`
```
.progress .circle,
.progress .bar {
display: block;
}
```
And interchanged `width` and `height` of progress bar
```
.progress .bar {
position: relative;
width: 6px; // already given 80px in question
height: 80px; // already given 6px in question
}
`... | ```css
*,
*:after,
*:before {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: "Open Sans";
}
/* Form Progress */
body{
display: flex;
justify-content: center;
}
.progress {
display: flex;
flex-direction: column;
justify-content: center;
margin: 20px auto;
text-align: center;
padding... |
63,498,375 | How i can make red label at chart. I want to make red just Sunday and Saturday and leave the others gray: [](https://i.stack.imgur.com/tigz9.png)
```
.ct-label {
font-size: 9px;
color: red; // this is make all label the red
}
```
```
<div style={{height: '100%'}} ... | 2020/08/20 | [
"https://Stackoverflow.com/questions/63498375",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13961512/"
] | Use `display:inline-block` instead of `display:block`
```
.progress .circle,
.progress .bar {
display: block;
}
```
And interchanged `width` and `height` of progress bar
```
.progress .bar {
position: relative;
width: 6px; // already given 80px in question
height: 80px; // already given 6px in question
}
`... | Was it necessary? In css, I marked my changes.
```css
*,
*:after,
*:before {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: "Open Sans";
}
/* Form Progress */
/*add*/
.label_box {
display: inline-flex;
align-items: center;
}
/*--------------*/
.progress {
margin: 20px auto;
text-align: ... |
63,498,375 | How i can make red label at chart. I want to make red just Sunday and Saturday and leave the others gray: [](https://i.stack.imgur.com/tigz9.png)
```
.ct-label {
font-size: 9px;
color: red; // this is make all label the red
}
```
```
<div style={{height: '100%'}} ... | 2020/08/20 | [
"https://Stackoverflow.com/questions/63498375",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13961512/"
] | Was it necessary? In css, I marked my changes.
```css
*,
*:after,
*:before {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: "Open Sans";
}
/* Form Progress */
/*add*/
.label_box {
display: inline-flex;
align-items: center;
}
/*--------------*/
.progress {
margin: 20px auto;
text-align: ... | ```css
*,
*:after,
*:before {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: "Open Sans";
}
/* Form Progress */
body{
display: flex;
justify-content: center;
}
.progress {
display: flex;
flex-direction: column;
justify-content: center;
margin: 20px auto;
text-align: center;
padding... |
58,374,210 | I have a df with boolean values (well int values that are either 0 or 1, but that's not important right now):
```
A B C D
0 0 1 0
1 0 0 0
0 1 1 1
1 0 0 1
```
And I want to convert it so that "1" (True) values are converted to the header name of the column and 0 values to NaN. The resulting df needs not have a header... | 2019/10/14 | [
"https://Stackoverflow.com/questions/58374210",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4731770/"
] | With numpy where
```
np.where(df == 1, df.columns, np.nan)
array([[nan, nan, 'C', nan],
['A', nan, nan, nan],
[nan, 'B', 'C', 'D'],
['A', nan, nan, 'D']], dtype=object)
```
---
How to convert np.array to pd.DataFrame (added by @jezrael)
```
df = pd.DataFrame(np.where(df == 1, df.columns, np.n... | You can also use `where` from `pandas`:
<https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.where.html>)
Note that `T` is important to have proper result.
```
import pandas as pd
import numpy as np
df = pd.DataFrame({'A': [0,1,0,1],
'B': [0,0,1,0],
'C':... |
58,374,210 | I have a df with boolean values (well int values that are either 0 or 1, but that's not important right now):
```
A B C D
0 0 1 0
1 0 0 0
0 1 1 1
1 0 0 1
```
And I want to convert it so that "1" (True) values are converted to the header name of the column and 0 values to NaN. The resulting df needs not have a header... | 2019/10/14 | [
"https://Stackoverflow.com/questions/58374210",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4731770/"
] | you can use np.where or pd.mask like below
```py
np.where(df.values==1, df.columns, np.nan)
## or
df.mask(df==1,df.columns)
``` | You can also use `where` from `pandas`:
<https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.where.html>)
Note that `T` is important to have proper result.
```
import pandas as pd
import numpy as np
df = pd.DataFrame({'A': [0,1,0,1],
'B': [0,0,1,0],
'C':... |
58,374,210 | I have a df with boolean values (well int values that are either 0 or 1, but that's not important right now):
```
A B C D
0 0 1 0
1 0 0 0
0 1 1 1
1 0 0 1
```
And I want to convert it so that "1" (True) values are converted to the header name of the column and 0 values to NaN. The resulting df needs not have a header... | 2019/10/14 | [
"https://Stackoverflow.com/questions/58374210",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4731770/"
] | You can use this:
```
for i in df.columns:
df[i] = df[i].apply(lambda x: i if x==1 else np.nan)
df.columns = [''] * len(df.columns)
``` | You can also use `where` from `pandas`:
<https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.where.html>)
Note that `T` is important to have proper result.
```
import pandas as pd
import numpy as np
df = pd.DataFrame({'A': [0,1,0,1],
'B': [0,0,1,0],
'C':... |
58,374,210 | I have a df with boolean values (well int values that are either 0 or 1, but that's not important right now):
```
A B C D
0 0 1 0
1 0 0 0
0 1 1 1
1 0 0 1
```
And I want to convert it so that "1" (True) values are converted to the header name of the column and 0 values to NaN. The resulting df needs not have a header... | 2019/10/14 | [
"https://Stackoverflow.com/questions/58374210",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4731770/"
] | Maybe something with [DataFrame.apply](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.apply.html):
```py
df.apply(lambda s: [s.name if v == 1 else np.nan for v in s])
``` | You can also use `where` from `pandas`:
<https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.where.html>)
Note that `T` is important to have proper result.
```
import pandas as pd
import numpy as np
df = pd.DataFrame({'A': [0,1,0,1],
'B': [0,0,1,0],
'C':... |
58,374,210 | I have a df with boolean values (well int values that are either 0 or 1, but that's not important right now):
```
A B C D
0 0 1 0
1 0 0 0
0 1 1 1
1 0 0 1
```
And I want to convert it so that "1" (True) values are converted to the header name of the column and 0 values to NaN. The resulting df needs not have a header... | 2019/10/14 | [
"https://Stackoverflow.com/questions/58374210",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4731770/"
] | Use [`numpy.where`](https://docs.scipy.org/doc/numpy/reference/generated/numpy.where.html) with `DataFrame` constructor and no columns parameter if performance is important:
```
df = pd.DataFrame(np.where(df == 1, df.columns, np.nan))
print (df)
0 1 2 3
0 NaN NaN C NaN
1 A NaN NaN NaN
2 NaN ... | You can also use `where` from `pandas`:
<https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.where.html>)
Note that `T` is important to have proper result.
```
import pandas as pd
import numpy as np
df = pd.DataFrame({'A': [0,1,0,1],
'B': [0,0,1,0],
'C':... |
58,374,210 | I have a df with boolean values (well int values that are either 0 or 1, but that's not important right now):
```
A B C D
0 0 1 0
1 0 0 0
0 1 1 1
1 0 0 1
```
And I want to convert it so that "1" (True) values are converted to the header name of the column and 0 values to NaN. The resulting df needs not have a header... | 2019/10/14 | [
"https://Stackoverflow.com/questions/58374210",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4731770/"
] | Use [`numpy.where`](https://docs.scipy.org/doc/numpy/reference/generated/numpy.where.html) with `DataFrame` constructor and no columns parameter if performance is important:
```
df = pd.DataFrame(np.where(df == 1, df.columns, np.nan))
print (df)
0 1 2 3
0 NaN NaN C NaN
1 A NaN NaN NaN
2 NaN ... | you can use np.where or pd.mask like below
```py
np.where(df.values==1, df.columns, np.nan)
## or
df.mask(df==1,df.columns)
``` |
58,374,210 | I have a df with boolean values (well int values that are either 0 or 1, but that's not important right now):
```
A B C D
0 0 1 0
1 0 0 0
0 1 1 1
1 0 0 1
```
And I want to convert it so that "1" (True) values are converted to the header name of the column and 0 values to NaN. The resulting df needs not have a header... | 2019/10/14 | [
"https://Stackoverflow.com/questions/58374210",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4731770/"
] | Maybe something with [DataFrame.apply](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.apply.html):
```py
df.apply(lambda s: [s.name if v == 1 else np.nan for v in s])
``` | You can use this:
```
for i in df.columns:
df[i] = df[i].apply(lambda x: i if x==1 else np.nan)
df.columns = [''] * len(df.columns)
``` |
58,374,210 | I have a df with boolean values (well int values that are either 0 or 1, but that's not important right now):
```
A B C D
0 0 1 0
1 0 0 0
0 1 1 1
1 0 0 1
```
And I want to convert it so that "1" (True) values are converted to the header name of the column and 0 values to NaN. The resulting df needs not have a header... | 2019/10/14 | [
"https://Stackoverflow.com/questions/58374210",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4731770/"
] | Maybe something with [DataFrame.apply](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.apply.html):
```py
df.apply(lambda s: [s.name if v == 1 else np.nan for v in s])
``` | you can use np.where or pd.mask like below
```py
np.where(df.values==1, df.columns, np.nan)
## or
df.mask(df==1,df.columns)
``` |
58,374,210 | I have a df with boolean values (well int values that are either 0 or 1, but that's not important right now):
```
A B C D
0 0 1 0
1 0 0 0
0 1 1 1
1 0 0 1
```
And I want to convert it so that "1" (True) values are converted to the header name of the column and 0 values to NaN. The resulting df needs not have a header... | 2019/10/14 | [
"https://Stackoverflow.com/questions/58374210",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4731770/"
] | With numpy where
```
np.where(df == 1, df.columns, np.nan)
array([[nan, nan, 'C', nan],
['A', nan, nan, nan],
[nan, 'B', 'C', 'D'],
['A', nan, nan, 'D']], dtype=object)
```
---
How to convert np.array to pd.DataFrame (added by @jezrael)
```
df = pd.DataFrame(np.where(df == 1, df.columns, np.n... | You can use this:
```
for i in df.columns:
df[i] = df[i].apply(lambda x: i if x==1 else np.nan)
df.columns = [''] * len(df.columns)
``` |
58,374,210 | I have a df with boolean values (well int values that are either 0 or 1, but that's not important right now):
```
A B C D
0 0 1 0
1 0 0 0
0 1 1 1
1 0 0 1
```
And I want to convert it so that "1" (True) values are converted to the header name of the column and 0 values to NaN. The resulting df needs not have a header... | 2019/10/14 | [
"https://Stackoverflow.com/questions/58374210",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4731770/"
] | Use [`numpy.where`](https://docs.scipy.org/doc/numpy/reference/generated/numpy.where.html) with `DataFrame` constructor and no columns parameter if performance is important:
```
df = pd.DataFrame(np.where(df == 1, df.columns, np.nan))
print (df)
0 1 2 3
0 NaN NaN C NaN
1 A NaN NaN NaN
2 NaN ... | You can use this:
```
for i in df.columns:
df[i] = df[i].apply(lambda x: i if x==1 else np.nan)
df.columns = [''] * len(df.columns)
``` |
40,163,944 | ```
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath){
// 1
self.dismiss(animated: true, completion: nil)
// 2
let correctedAddress:String! = self.searchResults[(indexPath as NSIndexPath).row].addingPercentEncoding(withAllowedCharacters: CharacterS... | 2016/10/20 | [
"https://Stackoverflow.com/questions/40163944",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7050052/"
] | That's because you're passing the promise itself into `res.send`.
```
res.send(/* You are passing a promise here */);
```
What you should do is wait for the promise to resolve with the data and then send that data:
```
getPlayerStats.getPlayerId(req.query.name).then(function(data) {
res.send(data);
});
``` | When you write middleware it sounds like you want the player id to be available for other actions so in addition to the other comments here:
```
app.get('/player/*', function(req, res, next) {
//data i want to return
getPlayerStats.getPlayerId(req.query.name))).then(function(id){
res.locals.play... |
40,163,944 | ```
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath){
// 1
self.dismiss(animated: true, completion: nil)
// 2
let correctedAddress:String! = self.searchResults[(indexPath as NSIndexPath).row].addingPercentEncoding(withAllowedCharacters: CharacterS... | 2016/10/20 | [
"https://Stackoverflow.com/questions/40163944",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7050052/"
] | That's because you're passing the promise itself into `res.send`.
```
res.send(/* You are passing a promise here */);
```
What you should do is wait for the promise to resolve with the data and then send that data:
```
getPlayerStats.getPlayerId(req.query.name).then(function(data) {
res.send(data);
});
``` | And I always recommend to finish your promise chain with a `catch()` to make sure errors are handled:
```
getPlayerStats.getPlayerId(req.query.name)
.then(function(data) {
res.send(data);
})
.catch(function(error){
res.status(500).send('Some error text');
});
``` |
40,163,944 | ```
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath){
// 1
self.dismiss(animated: true, completion: nil)
// 2
let correctedAddress:String! = self.searchResults[(indexPath as NSIndexPath).row].addingPercentEncoding(withAllowedCharacters: CharacterS... | 2016/10/20 | [
"https://Stackoverflow.com/questions/40163944",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7050052/"
] | And I always recommend to finish your promise chain with a `catch()` to make sure errors are handled:
```
getPlayerStats.getPlayerId(req.query.name)
.then(function(data) {
res.send(data);
})
.catch(function(error){
res.status(500).send('Some error text');
});
``` | When you write middleware it sounds like you want the player id to be available for other actions so in addition to the other comments here:
```
app.get('/player/*', function(req, res, next) {
//data i want to return
getPlayerStats.getPlayerId(req.query.name))).then(function(id){
res.locals.play... |
50,906,103 | I want to protect doc and docx files with password using java. I have tried using Apache POI. But it can't help me out.I am not getting any file at the location How would I do that?
Any another way or API??
```
POIFSFileSystem fs = new POIFSFileSystem();
EncryptionInfo info = new EncryptionInfo... | 2018/06/18 | [
"https://Stackoverflow.com/questions/50906103",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9955677/"
] | See: <http://www.quicklyjava.com/create-password-protected-excel-using-apache-poi/>
Try this constructor for info object:
`EncryptionInfo info = new EncryptionInfo(EncryptionMode.agile);` | check this and try to adapt yourself
<http://www.quicklyjava.com/create-password-protected-excel-using-apache-poi/> |
7,955,545 | I have the following Comet server:
```
object UserServer extends LiftActor with ListenerManager {
private var users: List[UserItem] = Nil
def createUpdate = users
override def lowPriority = {
case UserItem(user, room, active, stamp) => {
users :+= UserItem(user, room, active, stamp... | 2011/10/31 | [
"https://Stackoverflow.com/questions/7955545",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/924999/"
] | This sounds like a classic case where you need a map, rather than a list. I don't know about the details of Lift / Comet, but I guess you want something like
```
case class User(id: String)
case class Activity(room: String, active: String, stamp: String)
var lastUserActivity = Map[User, Activity]()
...
... | If you adjust `UserItem` from being a straight case class (I assume) to being one where you have overriden equals to ignore the `stamp` field, then you could make `users` into a `Set`.
Alternatively, you could filter the `List` to remove the old matching values before appending. |
15,555,537 | I have a file that has a lot of words in it, one on each line. I also have a second file that has words all on one line delimited by commas. What I am trying to do is access each word that is delimited by commas. Once I have each word I want to remove that word for the file in the first file.
I am having trouble acce... | 2013/03/21 | [
"https://Stackoverflow.com/questions/15555537",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2049206/"
] | How about this:
```
#!/bin/bash
# split_comma
OIFS=$IFS
IFS=','
for w in $(cat $1)
do
# Do stuff with each word
echo $w
done
IFS=$OIFS
```
---
`$ ./split_comma test_file` where `test_file` contains `this,is,a,test` returns:
```
this
is
a
test
```
You could then easily use `grep` to filter the words out... | Try doing this :
```
grep -w -v -f <(tr ',' '\n' < 2nd_file) 1st_file
``` |
15,555,537 | I have a file that has a lot of words in it, one on each line. I also have a second file that has words all on one line delimited by commas. What I am trying to do is access each word that is delimited by commas. Once I have each word I want to remove that word for the file in the first file.
I am having trouble acce... | 2013/03/21 | [
"https://Stackoverflow.com/questions/15555537",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2049206/"
] | How about this:
```
#!/bin/bash
# split_comma
OIFS=$IFS
IFS=','
for w in $(cat $1)
do
# Do stuff with each word
echo $w
done
IFS=$OIFS
```
---
`$ ./split_comma test_file` where `test_file` contains `this,is,a,test` returns:
```
this
is
a
test
```
You could then easily use `grep` to filter the words out... | You might try something like this:
```
sed -e 's/,/\n/g' fileWithCommas > tempfile
grep -v -f tempfile wordfile > newfile && mv newfile wordfile
rm tempfile
``` |
15,555,537 | I have a file that has a lot of words in it, one on each line. I also have a second file that has words all on one line delimited by commas. What I am trying to do is access each word that is delimited by commas. Once I have each word I want to remove that word for the file in the first file.
I am having trouble acce... | 2013/03/21 | [
"https://Stackoverflow.com/questions/15555537",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2049206/"
] | Try doing this :
```
grep -w -v -f <(tr ',' '\n' < 2nd_file) 1st_file
``` | You might try something like this:
```
sed -e 's/,/\n/g' fileWithCommas > tempfile
grep -v -f tempfile wordfile > newfile && mv newfile wordfile
rm tempfile
``` |
52,885,042 | I have below text
```
ABCDEF
JHJHJNJN<098978686
<jjg>
HGHJFGV XXXX
10-10-2018
JHKGHKGHG
JKHJHHJM
10-10-2019 JGHHGHGVH
HBVJHBHBB
```
I want to replace date followed by XXX+number of spaces
Here is my code
```
public class Regexreplace {
public static void main(String[] a... | 2018/10/19 | [
"https://Stackoverflow.com/questions/52885042",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9748223/"
] | It's replacing the second date because you have a greedy "match anything" sequence in your regular expression:
```
"(XXXX.*)[\\s]+([\\d]{1,2}-[\\d]{1,2}-[\\d]{4})"
// ^^
// Here
```
Answers to [this question](https://stackoverflow.com/questions/2301285/what-do-lazy-and-greedy-mean-in-the-context-of-regular-expr... | Try with this reg expression
```
"XXXX[\\s]+([\\d]{1,2}-[\\d]{1,2}-[\\d]{4})"
``` |
52,885,042 | I have below text
```
ABCDEF
JHJHJNJN<098978686
<jjg>
HGHJFGV XXXX
10-10-2018
JHKGHKGHG
JKHJHHJM
10-10-2019 JGHHGHGVH
HBVJHBHBB
```
I want to replace date followed by XXX+number of spaces
Here is my code
```
public class Regexreplace {
public static void main(String[] a... | 2018/10/19 | [
"https://Stackoverflow.com/questions/52885042",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9748223/"
] | It's replacing the second date because you have a greedy "match anything" sequence in your regular expression:
```
"(XXXX.*)[\\s]+([\\d]{1,2}-[\\d]{1,2}-[\\d]{4})"
// ^^
// Here
```
Answers to [this question](https://stackoverflow.com/questions/2301285/what-do-lazy-and-greedy-mean-in-the-context-of-regular-expr... | `((XXXX\s*)(0[1-9]|[12][0-9]|3[01])[- \/.](0[1-9]|1[012])[- \/.](19|20)\d\d$)`this will match all dd-mm-yyyy format date followed by XXXX..... |
8,867,363 | Can the hlt instruction in assembly shutdown a computer it as it halts the processor? if it can be done using what i have told, is it the right way?
Can hlt shutdown the machine?
```
start:
xor ax, ax; ;clear ax
mov bx, ax; ;clear bx
cli ;stop all interrupts
hlt ;halt the cpu
```
If this is not th... | 2012/01/15 | [
"https://Stackoverflow.com/questions/8867363",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1147882/"
] | The `hlt` instruction stops the x86 until an interrupt occurs. Unless all interrupts are disabled, that will stop the processor for only a millisecond or so.
To power down a modern computer, use the [ACPI (Advanced Configuration and Power Interface)](http://en.wikipedia.org/wiki/Advanced_Configuration_and_Power_Interf... | halt instruction does not turn off the power.
it puts the processor into a non-executing state.
usually, you can come out of the halt state upon processor reset.
in some microcontrollers, specific interrupts can also bring the processor out of the halt state.
power off is a motherboard/bios specific operation. |
8,867,363 | Can the hlt instruction in assembly shutdown a computer it as it halts the processor? if it can be done using what i have told, is it the right way?
Can hlt shutdown the machine?
```
start:
xor ax, ax; ;clear ax
mov bx, ax; ;clear bx
cli ;stop all interrupts
hlt ;halt the cpu
```
If this is not th... | 2012/01/15 | [
"https://Stackoverflow.com/questions/8867363",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1147882/"
] | The `hlt` instruction stops the x86 until an interrupt occurs. Unless all interrupts are disabled, that will stop the processor for only a millisecond or so.
To power down a modern computer, use the [ACPI (Advanced Configuration and Power Interface)](http://en.wikipedia.org/wiki/Advanced_Configuration_and_Power_Interf... | By using these two lines of code:
```
cli ; stop all interrupts
hlt ; halt the cpu
```
you could halt a bootable program for x86 pc:
```
BITS 16
start:
mov ax, 07C0h ; Set up 4K stack space after this bootloader
add ax, 288 ; (4096 +... |
35,168,717 | Are methods in JDBC thread safe? | 2016/02/03 | [
"https://Stackoverflow.com/questions/35168717",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5876045/"
] | Yes,It is thread safe because of synchronized method in the jdbc type 1 driver. | The [type 1 driver](https://en.wikipedia.org/wiki/JDBC_driver#Type_1_driver_.E2.80.93_JDBC-ODBC_bridge) (or the JDBC-ODBC bridge) uses native code, and **no** the database access is not thread safe. |
9,691,855 | I have small problem. I learn java SE and find class ClassLoader. I try to use it in below code:
I am trying to use URLClassLoader to dynamically load a class at runtime.
```
URLClassLoader urlcl = new URLClassLoader(new URL[] {new URL("file:///I:/Studia/PW/Sem6/_repozytorium/workspace/Test/testJavaLoader.jar")});
Cla... | 2012/03/13 | [
"https://Stackoverflow.com/questions/9691855",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1267483/"
] | ```
Class<?> classS = urlcl.loadClass("michal.collection.Stack");
[...]
Object object = classS.newInstance();
michal.collection.Stack new_name = (michal.collection.Stack) object;
```
So you're attempting to dynamically load a class and then you statically refer to it. If you can already statically link to it, then it... | You can't refer to the dynamically-loaded type by name in the code, since that has to be resolved at compile-time. You'll need to use the `newInstance()` function of the `Class` object you get back from `loadClass()`. |
9,691,855 | I have small problem. I learn java SE and find class ClassLoader. I try to use it in below code:
I am trying to use URLClassLoader to dynamically load a class at runtime.
```
URLClassLoader urlcl = new URLClassLoader(new URL[] {new URL("file:///I:/Studia/PW/Sem6/_repozytorium/workspace/Test/testJavaLoader.jar")});
Cla... | 2012/03/13 | [
"https://Stackoverflow.com/questions/9691855",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1267483/"
] | The above answers are both wrong, they don't understand the root problem. Your main refers to the Stack class which was loaded by one class loader. Your urlclassloader is attempting to load a class with the same name. You cannot cast the loaded to the referred because they are not the same, they belong to different cla... | You can't refer to the dynamically-loaded type by name in the code, since that has to be resolved at compile-time. You'll need to use the `newInstance()` function of the `Class` object you get back from `loadClass()`. |
9,691,855 | I have small problem. I learn java SE and find class ClassLoader. I try to use it in below code:
I am trying to use URLClassLoader to dynamically load a class at runtime.
```
URLClassLoader urlcl = new URLClassLoader(new URL[] {new URL("file:///I:/Studia/PW/Sem6/_repozytorium/workspace/Test/testJavaLoader.jar")});
Cla... | 2012/03/13 | [
"https://Stackoverflow.com/questions/9691855",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1267483/"
] | ```
Class<?> classS = urlcl.loadClass("michal.collection.Stack");
[...]
Object object = classS.newInstance();
michal.collection.Stack new_name = (michal.collection.Stack) object;
```
So you're attempting to dynamically load a class and then you statically refer to it. If you can already statically link to it, then it... | The above answers are both wrong, they don't understand the root problem. Your main refers to the Stack class which was loaded by one class loader. Your urlclassloader is attempting to load a class with the same name. You cannot cast the loaded to the referred because they are not the same, they belong to different cla... |
14,855,223 | I need to get the height of the entire available space in the web browser, so I can position a `div` halfway down the screen and stretching it all the way down.
I thought `document.body.clientHeight` would work, but that returned the amount of space that was being *taken up*, not total available space.
I also tried m... | 2013/02/13 | [
"https://Stackoverflow.com/questions/14855223",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1223693/"
] | From the [jQuery docs height()](http://api.jquery.com/height/)
```
This method is also able to find the height of the window and document.
$(window).height(); // returns height of browser viewport
$(document).height(); // returns height of HTML document
``` | A simple example with jquery
```
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
```
```
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
A2CARE 2.0
</title>
<script type="text/java... |
14,855,223 | I need to get the height of the entire available space in the web browser, so I can position a `div` halfway down the screen and stretching it all the way down.
I thought `document.body.clientHeight` would work, but that returned the amount of space that was being *taken up*, not total available space.
I also tried m... | 2013/02/13 | [
"https://Stackoverflow.com/questions/14855223",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1223693/"
] | From the [jQuery docs height()](http://api.jquery.com/height/)
```
This method is also able to find the height of the window and document.
$(window).height(); // returns height of browser viewport
$(document).height(); // returns height of HTML document
``` | you can directly use in javascript
```
screen.width
screen.height
```
u can assign like
```
document.getElementById("parentId").style.width = (screen.width - 100)+"px";
document.getElementById("parentId").style.height = (screen.height-300)+"px";
``` |
14,855,223 | I need to get the height of the entire available space in the web browser, so I can position a `div` halfway down the screen and stretching it all the way down.
I thought `document.body.clientHeight` would work, but that returned the amount of space that was being *taken up*, not total available space.
I also tried m... | 2013/02/13 | [
"https://Stackoverflow.com/questions/14855223",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1223693/"
] | From the [jQuery docs height()](http://api.jquery.com/height/)
```
This method is also able to find the height of the window and document.
$(window).height(); // returns height of browser viewport
$(document).height(); // returns height of HTML document
``` | I you mean the space available in parent of the element, You can try this...
```
var entireHeight=$('#elementID').parent().height();
var siblingHeight=0;
var elementSiblings=$('#elementID').siblings();
$.each(elementSiblings, function() {
siblingHeight= siblingHeight+$(this).height();
});
```
Subtracting the ... |
14,855,223 | I need to get the height of the entire available space in the web browser, so I can position a `div` halfway down the screen and stretching it all the way down.
I thought `document.body.clientHeight` would work, but that returned the amount of space that was being *taken up*, not total available space.
I also tried m... | 2013/02/13 | [
"https://Stackoverflow.com/questions/14855223",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1223693/"
] | From the [jQuery docs height()](http://api.jquery.com/height/)
```
This method is also able to find the height of the window and document.
$(window).height(); // returns height of browser viewport
$(document).height(); // returns height of HTML document
``` | ***it is very simple***
var max\_height=**screen.availHeight - (window.outerHight - window.innerHight)** |
14,855,223 | I need to get the height of the entire available space in the web browser, so I can position a `div` halfway down the screen and stretching it all the way down.
I thought `document.body.clientHeight` would work, but that returned the amount of space that was being *taken up*, not total available space.
I also tried m... | 2013/02/13 | [
"https://Stackoverflow.com/questions/14855223",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1223693/"
] | I you mean the space available in parent of the element, You can try this...
```
var entireHeight=$('#elementID').parent().height();
var siblingHeight=0;
var elementSiblings=$('#elementID').siblings();
$.each(elementSiblings, function() {
siblingHeight= siblingHeight+$(this).height();
});
```
Subtracting the ... | A simple example with jquery
```
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
```
```
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
A2CARE 2.0
</title>
<script type="text/java... |
14,855,223 | I need to get the height of the entire available space in the web browser, so I can position a `div` halfway down the screen and stretching it all the way down.
I thought `document.body.clientHeight` would work, but that returned the amount of space that was being *taken up*, not total available space.
I also tried m... | 2013/02/13 | [
"https://Stackoverflow.com/questions/14855223",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1223693/"
] | ***it is very simple***
var max\_height=**screen.availHeight - (window.outerHight - window.innerHight)** | A simple example with jquery
```
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
```
```
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
A2CARE 2.0
</title>
<script type="text/java... |
14,855,223 | I need to get the height of the entire available space in the web browser, so I can position a `div` halfway down the screen and stretching it all the way down.
I thought `document.body.clientHeight` would work, but that returned the amount of space that was being *taken up*, not total available space.
I also tried m... | 2013/02/13 | [
"https://Stackoverflow.com/questions/14855223",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1223693/"
] | I you mean the space available in parent of the element, You can try this...
```
var entireHeight=$('#elementID').parent().height();
var siblingHeight=0;
var elementSiblings=$('#elementID').siblings();
$.each(elementSiblings, function() {
siblingHeight= siblingHeight+$(this).height();
});
```
Subtracting the ... | you can directly use in javascript
```
screen.width
screen.height
```
u can assign like
```
document.getElementById("parentId").style.width = (screen.width - 100)+"px";
document.getElementById("parentId").style.height = (screen.height-300)+"px";
``` |
14,855,223 | I need to get the height of the entire available space in the web browser, so I can position a `div` halfway down the screen and stretching it all the way down.
I thought `document.body.clientHeight` would work, but that returned the amount of space that was being *taken up*, not total available space.
I also tried m... | 2013/02/13 | [
"https://Stackoverflow.com/questions/14855223",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1223693/"
] | ***it is very simple***
var max\_height=**screen.availHeight - (window.outerHight - window.innerHight)** | you can directly use in javascript
```
screen.width
screen.height
```
u can assign like
```
document.getElementById("parentId").style.width = (screen.width - 100)+"px";
document.getElementById("parentId").style.height = (screen.height-300)+"px";
``` |
2,765,872 | We are in need of converting all MS Office documents to PDF, TIFF, or any similar image format with no loss in formatting (these are official documents that cannot have tampering).
Is there any way to do this without installing Office on the machine that would do this? Ideally, this would go on a server and run multi... | 2010/05/04 | [
"https://Stackoverflow.com/questions/2765872",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/194261/"
] | You could use a third-party library such as Aspose.NET for document conversion, but I'm afraid - if high-fidelity rendering is critical - there is no way around using the original application.
Microsoft Office provides a converter API which allows conversions without Office being installed. However, not only might yo... | If this application will be run on a dedicated machine (i.e. the machine's only job is to convert a gigantic collection of Office documents), your safest bet is probably to use Office automation in a single-threaded manner and let the app happily convert one file at a time. A multi-threaded Office Automation app would ... |
26,354,792 | I just found out (by mistake) that enums have a new operator. Given the following
```
enum fruit {
apple,
orange,
banana,
};
public void Grow() {
var item = new fruit(); //will give an apple
}
```
**What's the reason for such a constructor?** I expected to be able to use enumerations just for... | 2014/10/14 | [
"https://Stackoverflow.com/questions/26354792",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/79485/"
] | Why not just do the check directly in SQL? Your SQL would be something like:
```
SELECT BaseForm, PastForm, PastPartForm
FROM EnglishVerbs
WHERE @Verb IN (BaseForm, PastForm, PastPartForm);
```
Or if you only want partial matches it would be:
```
SELECT BaseForm, PastForm, PastPartForm
FROM EnglishVerbs
W... | There are several improvements that you can make to the posted code.
First of all, it would make sense to let the database do the work of finding the row(s):
```
SqlCommand myCommand = new SqlCommand("select * from EnglishVerbs where BaseForm = @VerbToFind or PastForm = @VerbToFind or PastPartForm = @VerbToFind", con... |
26,354,792 | I just found out (by mistake) that enums have a new operator. Given the following
```
enum fruit {
apple,
orange,
banana,
};
public void Grow() {
var item = new fruit(); //will give an apple
}
```
**What's the reason for such a constructor?** I expected to be able to use enumerations just for... | 2014/10/14 | [
"https://Stackoverflow.com/questions/26354792",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/79485/"
] | You select all the `EnglishVerbs` and iterate through them. If you find the verb contained you do the assignment, else you assign `null`s. However, you don't break the loop when you find the verb. If the last element in the list doesn't contain your verb, as you can guess, it's assigned `null`. Change your loop to some... | There are several improvements that you can make to the posted code.
First of all, it would make sense to let the database do the work of finding the row(s):
```
SqlCommand myCommand = new SqlCommand("select * from EnglishVerbs where BaseForm = @VerbToFind or PastForm = @VerbToFind or PastPartForm = @VerbToFind", con... |
26,965 | I tried installing Craft 3.0 using composer (php composer.phar create-project craftcms/craft PATH)
And when I try to access the /web folder it's giving me the following error. I have tried removing the folder and installing it afresh again. I am currently using MAMP on my osx localhost.
>
> 1. in /Applications/MAMP/... | 2018/07/20 | [
"https://craftcms.stackexchange.com/questions/26965",
"https://craftcms.stackexchange.com",
"https://craftcms.stackexchange.com/users/8607/"
] | For those creating a fresh install using [Craft CMS Nitro](https://craftcms.com/docs/nitro/2.x/) and its `nitro create` command, don't forget to run the the Setup Wizard as a final step, as described in [Step 6: Run the Setup Wizard](https://craftcms.com/docs/3.x/installation.html#step-6-run-the-setup-wizard), from the... | For me, the problem was that Apaches `mod_rewrite` wasn't enabled and Crafts `.htaccess`-file was ignored while the config `omitScriptNameInUrls => true` was set.
Looking at the code from the stacktrace, it looks like Craft was unable to determine that the request actually was for the CP and it didn't allow the instal... |
26,965 | I tried installing Craft 3.0 using composer (php composer.phar create-project craftcms/craft PATH)
And when I try to access the /web folder it's giving me the following error. I have tried removing the folder and installing it afresh again. I am currently using MAMP on my osx localhost.
>
> 1. in /Applications/MAMP/... | 2018/07/20 | [
"https://craftcms.stackexchange.com/questions/26965",
"https://craftcms.stackexchange.com",
"https://craftcms.stackexchange.com/users/8607/"
] | Very likely it cannot connect to the database; that's typically what the `503` error is about:
<https://httpstatuses.com/503>
...so check the credentials in your `.env` file, and make sure that the version of MySQL that your website is using is the internal MAMP MySQL, and not the system-wide MySQL (if any).
This vi... | I had a site where in `general.php`, the staging section had the `'isSystemLive' => false,`
It was driving me batty why I could only see the front-end if logged in. |
26,965 | I tried installing Craft 3.0 using composer (php composer.phar create-project craftcms/craft PATH)
And when I try to access the /web folder it's giving me the following error. I have tried removing the folder and installing it afresh again. I am currently using MAMP on my osx localhost.
>
> 1. in /Applications/MAMP/... | 2018/07/20 | [
"https://craftcms.stackexchange.com/questions/26965",
"https://craftcms.stackexchange.com",
"https://craftcms.stackexchange.com/users/8607/"
] | If you've just imported a database, it could mean your project.yaml is out of sync in your environment.
I fixed this by running the CLI command:
```
./craft project-config/sync
``` | I had to answer a craft prompt about db backup on `/admin` page before I was able to access any other pages |
26,965 | I tried installing Craft 3.0 using composer (php composer.phar create-project craftcms/craft PATH)
And when I try to access the /web folder it's giving me the following error. I have tried removing the folder and installing it afresh again. I am currently using MAMP on my osx localhost.
>
> 1. in /Applications/MAMP/... | 2018/07/20 | [
"https://craftcms.stackexchange.com/questions/26965",
"https://craftcms.stackexchange.com",
"https://craftcms.stackexchange.com/users/8607/"
] | Very likely it cannot connect to the database; that's typically what the `503` error is about:
<https://httpstatuses.com/503>
...so check the credentials in your `.env` file, and make sure that the version of MySQL that your website is using is the internal MAMP MySQL, and not the system-wide MySQL (if any).
This vi... | If you've just imported a database, it could mean your project.yaml is out of sync in your environment.
I fixed this by running the CLI command:
```
./craft project-config/sync
``` |
26,965 | I tried installing Craft 3.0 using composer (php composer.phar create-project craftcms/craft PATH)
And when I try to access the /web folder it's giving me the following error. I have tried removing the folder and installing it afresh again. I am currently using MAMP on my osx localhost.
>
> 1. in /Applications/MAMP/... | 2018/07/20 | [
"https://craftcms.stackexchange.com/questions/26965",
"https://craftcms.stackexchange.com",
"https://craftcms.stackexchange.com/users/8607/"
] | If you've just imported a database, it could mean your project.yaml is out of sync in your environment.
I fixed this by running the CLI command:
```
./craft project-config/sync
``` | For me, the problem was that Apaches `mod_rewrite` wasn't enabled and Crafts `.htaccess`-file was ignored while the config `omitScriptNameInUrls => true` was set.
Looking at the code from the stacktrace, it looks like Craft was unable to determine that the request actually was for the CP and it didn't allow the instal... |
26,965 | I tried installing Craft 3.0 using composer (php composer.phar create-project craftcms/craft PATH)
And when I try to access the /web folder it's giving me the following error. I have tried removing the folder and installing it afresh again. I am currently using MAMP on my osx localhost.
>
> 1. in /Applications/MAMP/... | 2018/07/20 | [
"https://craftcms.stackexchange.com/questions/26965",
"https://craftcms.stackexchange.com",
"https://craftcms.stackexchange.com/users/8607/"
] | Very likely it cannot connect to the database; that's typically what the `503` error is about:
<https://httpstatuses.com/503>
...so check the credentials in your `.env` file, and make sure that the version of MySQL that your website is using is the internal MAMP MySQL, and not the system-wide MySQL (if any).
This vi... | For those creating a fresh install using [Craft CMS Nitro](https://craftcms.com/docs/nitro/2.x/) and its `nitro create` command, don't forget to run the the Setup Wizard as a final step, as described in [Step 6: Run the Setup Wizard](https://craftcms.com/docs/3.x/installation.html#step-6-run-the-setup-wizard), from the... |
26,965 | I tried installing Craft 3.0 using composer (php composer.phar create-project craftcms/craft PATH)
And when I try to access the /web folder it's giving me the following error. I have tried removing the folder and installing it afresh again. I am currently using MAMP on my osx localhost.
>
> 1. in /Applications/MAMP/... | 2018/07/20 | [
"https://craftcms.stackexchange.com/questions/26965",
"https://craftcms.stackexchange.com",
"https://craftcms.stackexchange.com/users/8607/"
] | For those creating a fresh install using [Craft CMS Nitro](https://craftcms.com/docs/nitro/2.x/) and its `nitro create` command, don't forget to run the the Setup Wizard as a final step, as described in [Step 6: Run the Setup Wizard](https://craftcms.com/docs/3.x/installation.html#step-6-run-the-setup-wizard), from the... | I had to answer a craft prompt about db backup on `/admin` page before I was able to access any other pages |
26,965 | I tried installing Craft 3.0 using composer (php composer.phar create-project craftcms/craft PATH)
And when I try to access the /web folder it's giving me the following error. I have tried removing the folder and installing it afresh again. I am currently using MAMP on my osx localhost.
>
> 1. in /Applications/MAMP/... | 2018/07/20 | [
"https://craftcms.stackexchange.com/questions/26965",
"https://craftcms.stackexchange.com",
"https://craftcms.stackexchange.com/users/8607/"
] | For those creating a fresh install using [Craft CMS Nitro](https://craftcms.com/docs/nitro/2.x/) and its `nitro create` command, don't forget to run the the Setup Wizard as a final step, as described in [Step 6: Run the Setup Wizard](https://craftcms.com/docs/3.x/installation.html#step-6-run-the-setup-wizard), from the... | I had a site where in `general.php`, the staging section had the `'isSystemLive' => false,`
It was driving me batty why I could only see the front-end if logged in. |
26,965 | I tried installing Craft 3.0 using composer (php composer.phar create-project craftcms/craft PATH)
And when I try to access the /web folder it's giving me the following error. I have tried removing the folder and installing it afresh again. I am currently using MAMP on my osx localhost.
>
> 1. in /Applications/MAMP/... | 2018/07/20 | [
"https://craftcms.stackexchange.com/questions/26965",
"https://craftcms.stackexchange.com",
"https://craftcms.stackexchange.com/users/8607/"
] | Very likely it cannot connect to the database; that's typically what the `503` error is about:
<https://httpstatuses.com/503>
...so check the credentials in your `.env` file, and make sure that the version of MySQL that your website is using is the internal MAMP MySQL, and not the system-wide MySQL (if any).
This vi... | For me, the problem was that Apaches `mod_rewrite` wasn't enabled and Crafts `.htaccess`-file was ignored while the config `omitScriptNameInUrls => true` was set.
Looking at the code from the stacktrace, it looks like Craft was unable to determine that the request actually was for the CP and it didn't allow the instal... |
26,965 | I tried installing Craft 3.0 using composer (php composer.phar create-project craftcms/craft PATH)
And when I try to access the /web folder it's giving me the following error. I have tried removing the folder and installing it afresh again. I am currently using MAMP on my osx localhost.
>
> 1. in /Applications/MAMP/... | 2018/07/20 | [
"https://craftcms.stackexchange.com/questions/26965",
"https://craftcms.stackexchange.com",
"https://craftcms.stackexchange.com/users/8607/"
] | If you've just imported a database, it could mean your project.yaml is out of sync in your environment.
I fixed this by running the CLI command:
```
./craft project-config/sync
``` | I had a site where in `general.php`, the staging section had the `'isSystemLive' => false,`
It was driving me batty why I could only see the front-end if logged in. |
2,464,888 | I am trying to download a CSV file using HttpResponse to make sure that the browser treats it as an attachment. I follow the instructions provided [here](http://docs.djangoproject.com/en/dev/ref/request-response/#telling-the-browser-to-treat-the-response-as-a-file-attachment) but my browser does not prompt a "Save As" ... | 2010/03/17 | [
"https://Stackoverflow.com/questions/2464888",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/224251/"
] | If the file is **static** (i.e not generated specifically for this request) you shouldn't be serving it through django anyway. You should configure some path (like /static/) to be served by your webserver, and save all the django overhead.
If the file is **dynamic**, there are 2 options:
1. Create it in memory and s... | **Try this**
```
def serve_tsv(request):
# Create the HttpResponse object with the appropriate CSV header.
response = HttpResponse(
content_type='text/csv',
headers={'Content-Disposition': 'attachment; filename="somefilename.csv"'},
)
writer = csv.writer(response)
writer.writerow([... |
2,464,888 | I am trying to download a CSV file using HttpResponse to make sure that the browser treats it as an attachment. I follow the instructions provided [here](http://docs.djangoproject.com/en/dev/ref/request-response/#telling-the-browser-to-treat-the-response-as-a-file-attachment) but my browser does not prompt a "Save As" ... | 2010/03/17 | [
"https://Stackoverflow.com/questions/2464888",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/224251/"
] | Thanks everyone for your suggestions. I picked a few new tricks :)
However I think I have found the answer to my problem here:
[Downloading CSV via AJAX](https://stackoverflow.com/questions/672218/downloading-csv-via-ajax)
My "savefile" function is called via an Ajax request and it appears that ajax has a limitation wh... | Does it make any difference if you don't enclose the filename in double quotes? The sample code does not quote the filename:
```
response['Content-Disposition'] = 'attachment; filename=foo.xls'
```
but your code does:
```
response['Content-Disposition'] = 'attachment; filename="foo.xls"'
``` |
2,464,888 | I am trying to download a CSV file using HttpResponse to make sure that the browser treats it as an attachment. I follow the instructions provided [here](http://docs.djangoproject.com/en/dev/ref/request-response/#telling-the-browser-to-treat-the-response-as-a-file-attachment) but my browser does not prompt a "Save As" ... | 2010/03/17 | [
"https://Stackoverflow.com/questions/2464888",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/224251/"
] | Did you try specifying the content-type?
e.g.
```
response['Content-Type'] = 'application/x-download';
```
Edit:
Note, this code successfully triggers a "Save As" dialog for me. Note I specify "application/x-download" directly in the mimetype argument. You also might want to recheck your code, and ensure your file ... | Does it make any difference if you don't enclose the filename in double quotes? The sample code does not quote the filename:
```
response['Content-Disposition'] = 'attachment; filename=foo.xls'
```
but your code does:
```
response['Content-Disposition'] = 'attachment; filename="foo.xls"'
``` |
2,464,888 | I am trying to download a CSV file using HttpResponse to make sure that the browser treats it as an attachment. I follow the instructions provided [here](http://docs.djangoproject.com/en/dev/ref/request-response/#telling-the-browser-to-treat-the-response-as-a-file-attachment) but my browser does not prompt a "Save As" ... | 2010/03/17 | [
"https://Stackoverflow.com/questions/2464888",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/224251/"
] | Did you try specifying the content-type?
e.g.
```
response['Content-Type'] = 'application/x-download';
```
Edit:
Note, this code successfully triggers a "Save As" dialog for me. Note I specify "application/x-download" directly in the mimetype argument. You also might want to recheck your code, and ensure your file ... | Thomas, I had used an Ajax function to save and download this file. It appears that in such a case the "Save As " box will not appear regardless of the headers. I simply used javascript to download that file.
window.open("path/to/file");
and it does the trick. I tested on IE6 and Firefox and the dialog box appears. |
2,464,888 | I am trying to download a CSV file using HttpResponse to make sure that the browser treats it as an attachment. I follow the instructions provided [here](http://docs.djangoproject.com/en/dev/ref/request-response/#telling-the-browser-to-treat-the-response-as-a-file-attachment) but my browser does not prompt a "Save As" ... | 2010/03/17 | [
"https://Stackoverflow.com/questions/2464888",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/224251/"
] | Thomas, I had used an Ajax function to save and download this file. It appears that in such a case the "Save As " box will not appear regardless of the headers. I simply used javascript to download that file.
window.open("path/to/file");
and it does the trick. I tested on IE6 and Firefox and the dialog box appears. | **Try this**
```
def serve_tsv(request):
# Create the HttpResponse object with the appropriate CSV header.
response = HttpResponse(
content_type='text/csv',
headers={'Content-Disposition': 'attachment; filename="somefilename.csv"'},
)
writer = csv.writer(response)
writer.writerow([... |
2,464,888 | I am trying to download a CSV file using HttpResponse to make sure that the browser treats it as an attachment. I follow the instructions provided [here](http://docs.djangoproject.com/en/dev/ref/request-response/#telling-the-browser-to-treat-the-response-as-a-file-attachment) but my browser does not prompt a "Save As" ... | 2010/03/17 | [
"https://Stackoverflow.com/questions/2464888",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/224251/"
] | If the file is **static** (i.e not generated specifically for this request) you shouldn't be serving it through django anyway. You should configure some path (like /static/) to be served by your webserver, and save all the django overhead.
If the file is **dynamic**, there are 2 options:
1. Create it in memory and s... | Does it make any difference if you don't enclose the filename in double quotes? The sample code does not quote the filename:
```
response['Content-Disposition'] = 'attachment; filename=foo.xls'
```
but your code does:
```
response['Content-Disposition'] = 'attachment; filename="foo.xls"'
``` |
2,464,888 | I am trying to download a CSV file using HttpResponse to make sure that the browser treats it as an attachment. I follow the instructions provided [here](http://docs.djangoproject.com/en/dev/ref/request-response/#telling-the-browser-to-treat-the-response-as-a-file-attachment) but my browser does not prompt a "Save As" ... | 2010/03/17 | [
"https://Stackoverflow.com/questions/2464888",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/224251/"
] | Did you try specifying the content-type?
e.g.
```
response['Content-Type'] = 'application/x-download';
```
Edit:
Note, this code successfully triggers a "Save As" dialog for me. Note I specify "application/x-download" directly in the mimetype argument. You also might want to recheck your code, and ensure your file ... | **Try this**
```
def serve_tsv(request):
# Create the HttpResponse object with the appropriate CSV header.
response = HttpResponse(
content_type='text/csv',
headers={'Content-Disposition': 'attachment; filename="somefilename.csv"'},
)
writer = csv.writer(response)
writer.writerow([... |
2,464,888 | I am trying to download a CSV file using HttpResponse to make sure that the browser treats it as an attachment. I follow the instructions provided [here](http://docs.djangoproject.com/en/dev/ref/request-response/#telling-the-browser-to-treat-the-response-as-a-file-attachment) but my browser does not prompt a "Save As" ... | 2010/03/17 | [
"https://Stackoverflow.com/questions/2464888",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/224251/"
] | Thanks everyone for your suggestions. I picked a few new tricks :)
However I think I have found the answer to my problem here:
[Downloading CSV via AJAX](https://stackoverflow.com/questions/672218/downloading-csv-via-ajax)
My "savefile" function is called via an Ajax request and it appears that ajax has a limitation wh... | Thomas, I had used an Ajax function to save and download this file. It appears that in such a case the "Save As " box will not appear regardless of the headers. I simply used javascript to download that file.
window.open("path/to/file");
and it does the trick. I tested on IE6 and Firefox and the dialog box appears. |
2,464,888 | I am trying to download a CSV file using HttpResponse to make sure that the browser treats it as an attachment. I follow the instructions provided [here](http://docs.djangoproject.com/en/dev/ref/request-response/#telling-the-browser-to-treat-the-response-as-a-file-attachment) but my browser does not prompt a "Save As" ... | 2010/03/17 | [
"https://Stackoverflow.com/questions/2464888",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/224251/"
] | Thanks everyone for your suggestions. I picked a few new tricks :)
However I think I have found the answer to my problem here:
[Downloading CSV via AJAX](https://stackoverflow.com/questions/672218/downloading-csv-via-ajax)
My "savefile" function is called via an Ajax request and it appears that ajax has a limitation wh... | **Try this**
```
def serve_tsv(request):
# Create the HttpResponse object with the appropriate CSV header.
response = HttpResponse(
content_type='text/csv',
headers={'Content-Disposition': 'attachment; filename="somefilename.csv"'},
)
writer = csv.writer(response)
writer.writerow([... |
2,464,888 | I am trying to download a CSV file using HttpResponse to make sure that the browser treats it as an attachment. I follow the instructions provided [here](http://docs.djangoproject.com/en/dev/ref/request-response/#telling-the-browser-to-treat-the-response-as-a-file-attachment) but my browser does not prompt a "Save As" ... | 2010/03/17 | [
"https://Stackoverflow.com/questions/2464888",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/224251/"
] | If the file is **static** (i.e not generated specifically for this request) you shouldn't be serving it through django anyway. You should configure some path (like /static/) to be served by your webserver, and save all the django overhead.
If the file is **dynamic**, there are 2 options:
1. Create it in memory and s... | Did you try specifying the content-type?
e.g.
```
response['Content-Type'] = 'application/x-download';
```
Edit:
Note, this code successfully triggers a "Save As" dialog for me. Note I specify "application/x-download" directly in the mimetype argument. You also might want to recheck your code, and ensure your file ... |
56,895 | Is it usual for postdocs (I'm in the US) to sign one contract with the department and then have to accept a notice of appointment online which supercedes the initial one signed?
I signed my postdoc job offer before moving to the US to take up the position and then when I arrived in the country I had to accept what tur... | 2015/10/25 | [
"https://academia.stackexchange.com/questions/56895",
"https://academia.stackexchange.com",
"https://academia.stackexchange.com/users/43211/"
] | From the OP's comment:
>
> When questioned, I was told that this is what the contract is now.
>
>
>
Hmm. Most of the point of a contract is that it cannot be unilaterally changed during the period it applies to. So you can absolutely insist on the old contract -- in fact, just by not signing the new one -- but t... | It is not fair. It is not normal, but it is also unsurprising. Bureaucratic errors happen in large organizations. For example, once I received a contract after the deadline to sign and return it. I advise you politely ask the university to revise the contract before you sign it. They will probably need the online contr... |
61,799,883 | I am having issues will bold text when using bootstrap. Text that should be bold is not displayed as bold in Chrome:
[](https://i.stack.imgur.com/4Xrt0.png)
However in Safari it works as expected:
[`, because the quote in the query will terminate the JavaScript string.
Put double quotes around the JS string.
```
echo "<script>console.log(\"photo: ".$sql."\");</script>";
``` | Your javascript console is wrapped in `'` quotes, and your `'$username'` value is also using these single quotes so this is causing a problem.
Therefore; if you want to export this SQL string to your console, you need to escape these single quotes or to use alternative quotes in your javascript.
This issue is better ... |
39,166,749 | I've come across two types of functions whilst learning javascript I think. I've tried to put them below as I understand them.
```
function example(arg1, arg2) { //code to do stuff here }
```
and
```
thing.method(function(arg) {
//code to do stuff here
});
```
My thinking is that the first case is creating a fu... | 2016/08/26 | [
"https://Stackoverflow.com/questions/39166749",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | ```
thing.method(function(arg) {
//code to do stuff here
});
```
This uses what is called an **anonymous function**. Like you said, it has no name. It is passed as an argument to `thing.method()`. `thing.method()`'s function body would use this function such as:
```
thing: {
method: function(callback) {
... | Your first function `example` is a named function that is reusable throughout your entire JS program. It has a global scope. To use it, you need to call it, like so:
```
example(value1, value2);
```
This will send `value1` and `value2` into the function and some action will typically be performed using those values.... |
27,401,617 | Let me first present my code sample:
```
<div id="StartScroll"></div>
Many divs and content here !
<div id="EndScroll"></div>
```
My question is that how can i make a scroll bar which starts to scroll from div with id `StartScroll` and end scroling at div with id `EndScroll` .
Note that there is content before ... | 2014/12/10 | [
"https://Stackoverflow.com/questions/27401617",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2661419/"
] | You can simply use `$(doc)` and jQuery's traversal methods:
```
var $doc = $(doc);
var comicContainer = $doc.find('#comics'); // for example
``` | To add, for example, click events to custom loaded items, use this:
```
$(body).on( 'click', 'YOUR_DYNAMIC_SELECTOR', function(){ DO_ALL_THIS } )
``` |
222,900 | PostgreSQL 9.6.
```
create table jon.vins (vin citext primary key);
insert into jon.vins values
('3GNAXUEV1KL221776'),
('3GNAXHEV2KS548975');
CREATE TABLE jon.describe_vehicle (
vin citext primary key,
response jsonb);
```
`jon.describe_vehicle` contains data for only 1 vin, 3GNAXHEV2KS548975;
This query:
``... | 2018/11/19 | [
"https://dba.stackexchange.com/questions/222900",
"https://dba.stackexchange.com",
"https://dba.stackexchange.com/users/165293/"
] | Set returning functions should be put into the from clause. Putting them into the SELECT clause is allowed, but can result in strange result (as you have noticed).
The clean approach would be:
```
select a.vin, r.data ->'attributes'->>'name' as style
from vins a
left join describe_vehicle b on a.vin = b.vin
left... | It is still executing a left join, it is just that some rows are filtered out before they bubble up to the top level. This is how Set Returning Functions in the select list of a query work. It would do the same thing if you had a physical row containing a literal NULL value, rather than a NULL value being generated by ... |
9,547,741 | Most of languages, using garbage collectors (possibly all of them), have one major issue related to parallel computations: garbage collector has to stop all running threads in order to delete unused objects. Haskell has garbage collector too. But, due to purity, Haskell guarantees that no computation changes the origin... | 2012/03/03 | [
"https://Stackoverflow.com/questions/9547741",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/905914/"
] | GHC's garbage collector is *parallel* but not *concurrent*. That means that it can use all threads to perform garbage collection, but it has to stop all threads to do that. Concurrent garbage collection is much harder to implement (and usually has a larger performance overhead).
It is somewhat ironic that Haskell does... | Seval GC implementations may run in parallel without "stopping the world" as you suggest (I think latest Oracle JVM don't stop the world and is multi-threaded, for an example; and most JVM are not "stop-the-world").
Recall that GC implementations may vary widely from one language implementation to another one.
There ... |
66,629,574 | I am currently in the process of making a website for a minecraft server. It is going quite well although it is still in it's infancy. However I have a very stubborn margin on the left which no matter what I try I cannot get rid of. I am not great at web development so maybe there is something that I haven't seen in th... | 2021/03/14 | [
"https://Stackoverflow.com/questions/66629574",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15395977/"
] | From [official documentation](https://flutter.dev/docs/development/accessibility-and-localization/internationalization)
By default, Flutter only provides US English localizations. To add support for other languages, an application must specify additional MaterialApp (or CupertinoApp) properties, and include a package ... | Try using langdetect (if you use tkinter)
```
from langdetect import detect
from tkinter import *
from tkinter.constants import *
arabictext = "مرحبا"
root = Tk()
text = Text(root)
lang = detect(arabictext)
if lang == "ar":
text.tag_configure('tag-right', justify='right')
text.insert('end', arabictext, 'tag... |
66,629,574 | I am currently in the process of making a website for a minecraft server. It is going quite well although it is still in it's infancy. However I have a very stubborn margin on the left which no matter what I try I cannot get rid of. I am not great at web development so maybe there is something that I haven't seen in th... | 2021/03/14 | [
"https://Stackoverflow.com/questions/66629574",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15395977/"
] | you can use this
<https://pub.dev/packages/auto_direction>
This package changes the direction of a widget from ltr direction into rtl direction and vice versa based on the language of the text provided. | Try using langdetect (if you use tkinter)
```
from langdetect import detect
from tkinter import *
from tkinter.constants import *
arabictext = "مرحبا"
root = Tk()
text = Text(root)
lang = detect(arabictext)
if lang == "ar":
text.tag_configure('tag-right', justify='right')
text.insert('end', arabictext, 'tag... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.