qid int64 1 74.6M | question stringlengths 45 24.2k | date stringlengths 10 10 | metadata stringlengths 101 178 | response_j stringlengths 32 23.2k | response_k stringlengths 21 13.2k |
|---|---|---|---|---|---|
31,778,365 | So I am trying to read the words from a file. However, I have to use `putchar(ch)` where `ch` is an `int`. How do I convert ch to a string (char \*) so I can store it in a char \* variable and pass it to another function that takes char \* as a parameter. And I actually just want to store it but not print it.
This is ... | 2015/08/03 | ['https://Stackoverflow.com/questions/31778365', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4807625/'] | `sprintf(char_arr, "%d", an_integer);`
This makes `char_arr` equal to string representation of `an_integer`
(This doesn't print anything to console output in case you're wondering, this just 'stores' it)
An example:
```
char char_arr [100];
int num = 42;
sprintf(char_arr, "%d", num);
```
`char_arr` now is the strin... | You can use math functions to do that. Like this:
```
#include <stdio.h> // For the sprintf function
#include <stdlib.h> // for the malloc function
#include <math.h> // for the floor, log10 and abs functions
const char * inttostr(int n) {
char * result;
if (n >= 0)
result = malloc(floor(log10(n)) + 2)... |
31,778,365 | So I am trying to read the words from a file. However, I have to use `putchar(ch)` where `ch` is an `int`. How do I convert ch to a string (char \*) so I can store it in a char \* variable and pass it to another function that takes char \* as a parameter. And I actually just want to store it but not print it.
This is ... | 2015/08/03 | ['https://Stackoverflow.com/questions/31778365', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4807625/'] | To represent a single character as a character string, I find using a simple 2-character buffer to be as easy as anything else. You can take advantage of the fact that dereferencing the string points to the first character and simply assign the character you wish to represent as a string. If you have initialized your 2... | You can use math functions to do that. Like this:
```
#include <stdio.h> // For the sprintf function
#include <stdlib.h> // for the malloc function
#include <math.h> // for the floor, log10 and abs functions
const char * inttostr(int n) {
char * result;
if (n >= 0)
result = malloc(floor(log10(n)) + 2)... |
40,783,814 | I am quite new to R and managed to use ggplot2 using google. ;)
I wanted to "stack-plot" relative abundances vs. time blocks (1-8).
What the plot looks like now:
[](https://i.stack.imgur.com/l69h4.png)
Now to my aim and problem:
I have data for male... | 2016/11/24 | ['https://Stackoverflow.com/questions/40783814', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/7204441/'] | With your data that should be something like (pretty much the same idea as Axeman's ):
```
ggplot(family_abundance, aes(x=interaction(sex,row), y=value, group=sex,fill=factor(variable))) +
geom_bar(stat="identity")+
facet_grid(.~row, scales = 'free')+
scale_x_discrete("Week",labels=levels(family_abundance$sex))
... | ```
ggplot(mpg, aes(interaction(year, class))) +
geom_bar(aes(fill = drv), position = "stack")
```
[](https://i.stack.imgur.com/FChvB.png)
```
ggplot(mpg, aes(as.factor(year))) +
geom_bar(aes(fill = drv), position = "stack") +
facet_grid(~cl... |
35,648,453 | I have the following quesry, where the variables are arrays...
```
c.execute("INSERT into userData values=(%s,%s,%s,%s,%s,%s)",
t[i],k[0],k[1],k[2],user[i],total)
```
This gives a syntax error.
I have also tried this:
```
a = "INSERT INTO userData VALUES ('"+t[i]+"','"+k[0]+"','"+k[1]+"','"+k[2]+"',
... | 2016/02/26 | ['https://Stackoverflow.com/questions/35648453', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3788972/'] | [`cursor.execute()`](http://mysql-python.sourceforge.net/MySQLdb.html#cursor-objects) expects the query parameters as a tuple. Try this:
```
cursor.execute("INSERT INTO userData VALUES (%s, %s, %s, %s, %s, %s)",
(t[i], k[0], k[1], k[2], user[i], total))
```
Don't use `+` or the like for constructing S... | Maybe try with the following syntax:
```
INSERT INTO table(col1,col2,...)VALUES(val1,val2,...)
``` |
26,938,250 | I am trying to map a valid json string to a POJO with code that worked about 2 weeks ago. **I have made no changes to the code in those 2 weeks.**
My json string is valid according to <http://jsonformatter.curiousconcept.com/>.
I am using Jackson to map the json to the POJO:
```
response = new ObjectMapper().readVal... | 2014/11/14 | ['https://Stackoverflow.com/questions/26938250', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2879594/'] | This does not answer the question exactly as written, but is the final solution to my problem.
I have refactored my code, which ultimately has led to some code reduction.
I no longer map the JSON to a java object. After inspecting my code, I realized I do very little processing on the java object, before it is resera... | I am guessing that something has indeed changed for you; and based on my experience it could be upgrade of JSK -- definition of `Exception` did change between JDK 1.6 and 1.7.
But as to solving the problem, make sure you are using a recent version of Jackson. From class names, it looks like you are using Jackson 1.x (... |
26,938,250 | I am trying to map a valid json string to a POJO with code that worked about 2 weeks ago. **I have made no changes to the code in those 2 weeks.**
My json string is valid according to <http://jsonformatter.curiousconcept.com/>.
I am using Jackson to map the json to the POJO:
```
response = new ObjectMapper().readVal... | 2014/11/14 | ['https://Stackoverflow.com/questions/26938250', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2879594/'] | Just came across this problem myself and I found out that I had duplicate names in my `JsonProperty` annotations. In my case the bean that caused the error referenced a separate class where the actual typo was present:
```
@JsonProperty("attributes") Object attributes,
@JsonProperty("attributes") BoundingBox boundingB... | I am guessing that something has indeed changed for you; and based on my experience it could be upgrade of JSK -- definition of `Exception` did change between JDK 1.6 and 1.7.
But as to solving the problem, make sure you are using a recent version of Jackson. From class names, it looks like you are using Jackson 1.x (... |
50,378,316 | I have two tables `source_product` and `target_product` as shown here:
**source\_product**:
```
pitem_id prev_id citem_id crev_id qty check_no status
-------------------------------------------------------------------
AAA null null null null null null
AAA A It... | 2018/05/16 | ['https://Stackoverflow.com/questions/50378316', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/9463188/'] | You can try to hack something like this:
```py
from pyspark.sql.functions import col, lit, posexplode, expr, split
(DF1
.select("*", posexplode(split(expr("repeat('_', num_elements - 1)"), '_')))
.select(col("vars").getItem(col("pos")),col("vals").getItem(col("pos")))
.show())
# +---------+---------+
# |... | ***Using SQL DDL schema format is another alternative.***
I have a similar problem in Scala, where we struggled so much to create a dynamic nested structure using case classes. A few days prior, I attended Databricks courses where I learned about a different approach and I'm not sure why nobody is talking about this a... |
24,311,754 | Please see the query below:
```
update dbusns
set thisdate = created
from
(select
MAX(created) AS CREATED, DBCUSTODY.REFERENCE
from dbusns
inner join [server].Custody.DBO.dbcustody on dbusns.urns = dbcustody.reference
where dbusns.datasetname = 'CUSTODY'
group by dbcustody.refere... | 2014/06/19 | ['https://Stackoverflow.com/questions/24311754', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/937440/'] | Your `UPDATE` syntax seems wrong for what you want. In this case, the best way would be to use an `INNER JOIN`:
```
UPDATE D
SET thisdate = T.created
FROM dbusns D
INNER JOIN (SELECT MAX(created) created,
C.reference
FROM dbusns
INNER JOIN [server].Custody.DBO.dbcustody ... | I think your `update` syntax is right, except for one small thing. Consider this line:
```
update dbusns set thisdate = created from ( . . .
```
The `created` column -- I am guessing -- is in `dbusns`. So, it is just setting `thisdate` to the created value i the same table.
You can fix this by using a table alias:
... |
9,915,900 | We are using Fluent NH with convention based mapping. I have the following:
```
public class Foo() : Entity
{
public BarComponent PrimaryBar { get; set; }
public BarComponent SecondaryBar { get; set; }
}
public class BarComponent
{
public string Name { get; set; }
}
```
I have it to the point where it will cr... | 2012/03/28 | ['https://Stackoverflow.com/questions/9915900', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/12503/'] | Just tested this and it works fine. If I have a Pick with a send and receive inside a trigger and a delay inside the action, the reply is received immediately.
Are you sure the Request on your SendReply activity appears to be set correctly?
Patrick is still right, you should implement your database activity as an Asy... | This is working as intended. If the operations take such a long time, would you be better served by calling them asynchronously? Check out AsyncCodeActivity here:
<http://msdn.microsoft.com/en-us/library/system.activities.asynccodeactivity.aspx> |
9,915,900 | We are using Fluent NH with convention based mapping. I have the following:
```
public class Foo() : Entity
{
public BarComponent PrimaryBar { get; set; }
public BarComponent SecondaryBar { get; set; }
}
public class BarComponent
{
public string Name { get; set; }
}
```
I have it to the point where it will cr... | 2012/03/28 | ['https://Stackoverflow.com/questions/9915900', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/12503/'] | Ok, I think I have a resolution for this. As per [Maurice's answer here](https://stackoverflow.com/a/7868111/132599), I added a Delay activity following the SendReplyToReceive and the workflow then started behaving as expected.
 | This is working as intended. If the operations take such a long time, would you be better served by calling them asynchronously? Check out AsyncCodeActivity here:
<http://msdn.microsoft.com/en-us/library/system.activities.asynccodeactivity.aspx> |
9,915,900 | We are using Fluent NH with convention based mapping. I have the following:
```
public class Foo() : Entity
{
public BarComponent PrimaryBar { get; set; }
public BarComponent SecondaryBar { get; set; }
}
public class BarComponent
{
public string Name { get; set; }
}
```
I have it to the point where it will cr... | 2012/03/28 | ['https://Stackoverflow.com/questions/9915900', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/12503/'] | I my experience checking **PersistBeforeSend** on **SendReplyToReceive** to True fixes this problem. Putting Persist block after SendReplyToReceive also helps. | This is working as intended. If the operations take such a long time, would you be better served by calling them asynchronously? Check out AsyncCodeActivity here:
<http://msdn.microsoft.com/en-us/library/system.activities.asynccodeactivity.aspx> |
9,915,900 | We are using Fluent NH with convention based mapping. I have the following:
```
public class Foo() : Entity
{
public BarComponent PrimaryBar { get; set; }
public BarComponent SecondaryBar { get; set; }
}
public class BarComponent
{
public string Name { get; set; }
}
```
I have it to the point where it will cr... | 2012/03/28 | ['https://Stackoverflow.com/questions/9915900', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/12503/'] | Ok, I think I have a resolution for this. As per [Maurice's answer here](https://stackoverflow.com/a/7868111/132599), I added a Delay activity following the SendReplyToReceive and the workflow then started behaving as expected.
 | Just tested this and it works fine. If I have a Pick with a send and receive inside a trigger and a delay inside the action, the reply is received immediately.
Are you sure the Request on your SendReply activity appears to be set correctly?
Patrick is still right, you should implement your database activity as an Asy... |
9,915,900 | We are using Fluent NH with convention based mapping. I have the following:
```
public class Foo() : Entity
{
public BarComponent PrimaryBar { get; set; }
public BarComponent SecondaryBar { get; set; }
}
public class BarComponent
{
public string Name { get; set; }
}
```
I have it to the point where it will cr... | 2012/03/28 | ['https://Stackoverflow.com/questions/9915900', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/12503/'] | Ok, I think I have a resolution for this. As per [Maurice's answer here](https://stackoverflow.com/a/7868111/132599), I added a Delay activity following the SendReplyToReceive and the workflow then started behaving as expected.
 | I my experience checking **PersistBeforeSend** on **SendReplyToReceive** to True fixes this problem. Putting Persist block after SendReplyToReceive also helps. |
43,814,422 | I created a simple snake game after following some simple tutorials on YouTube.
The problem is that the game does not have a pause function (e.g. when pressing P the game should pause/resume) and when the snake hits the border of the canvas the game restarts itself (but that is another problem).
Here is the complet... | 2017/05/05 | ['https://Stackoverflow.com/questions/43814422', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/7971087/'] | Create a Boolean variable called paused and set it to true if the player presses p, Then put an if statement around the loop that runs your game. and say if (!paused){run loop}
You can create a toggle pause function for when p is pressed.
```
function togglePause()
{
if (!paused)
{
paused = true;
... | Your game loop is not based on `setTimeout`, but on `requestAnimationFrame`. So setting and clearing a timer will not change anything.
Secondly, you did not bind your `keyDown` function to any event, so it will never get invoked.
### Solution:
Have a look at your `loop` function: it calls itself asynchronously, whic... |
43,814,422 | I created a simple snake game after following some simple tutorials on YouTube.
The problem is that the game does not have a pause function (e.g. when pressing P the game should pause/resume) and when the snake hits the border of the canvas the game restarts itself (but that is another problem).
Here is the complet... | 2017/05/05 | ['https://Stackoverflow.com/questions/43814422', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/7971087/'] | Create a Boolean variable called paused and set it to true if the player presses p, Then put an if statement around the loop that runs your game. and say if (!paused){run loop}
You can create a toggle pause function for when p is pressed.
```
function togglePause()
{
if (!paused)
{
paused = true;
... | Game state managment
--------------------
Games will usually have various game states. Pause, End game, Press key to start, etc... As the optimal way to run a game is via a single main loop the easiest way to manage game states is to have variable hold the current state function and just assign that variable the appro... |
43,814,422 | I created a simple snake game after following some simple tutorials on YouTube.
The problem is that the game does not have a pause function (e.g. when pressing P the game should pause/resume) and when the snake hits the border of the canvas the game restarts itself (but that is another problem).
Here is the complet... | 2017/05/05 | ['https://Stackoverflow.com/questions/43814422', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/7971087/'] | Game state managment
--------------------
Games will usually have various game states. Pause, End game, Press key to start, etc... As the optimal way to run a game is via a single main loop the easiest way to manage game states is to have variable hold the current state function and just assign that variable the appro... | Your game loop is not based on `setTimeout`, but on `requestAnimationFrame`. So setting and clearing a timer will not change anything.
Secondly, you did not bind your `keyDown` function to any event, so it will never get invoked.
### Solution:
Have a look at your `loop` function: it calls itself asynchronously, whic... |
10,223,722 | I have to design a crystal report in which I have to retrieve values from a particular field in a database. But this field has many entries that follow increase numerically i.e., 1 to 10000, then 10000 to 20000, 20000 to 30000 etc..
Now I want to group them in a way that 1 to 10000 are in one group, 10000 to 15000 in ... | 2012/04/19 | ['https://Stackoverflow.com/questions/10223722', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1343318/'] | Set up a Crystal formula, similar to:
```
if {myTable.myField} >= 1 and {myTable.myField} <= 10000 then 'A'
else if {myTable.myField} > 10000 and {myTable.myField} <= 15000 then 'B'
else if {myTable.myField} > 15000 and {myTable.myField} <= 20000 then 'C'
```
- and group on your new formula. | You might consider the `SELECT` expression:
```
SELECT {table.field}
CASE 1 TO 10000: "A"
CASE 10001 TO 15000: "B"
CASE 15001 TO 20000: "C"
DEFAULT: "ERROR"
``` |
81,507 | By the completeness of FOL, one can show that a sentence $S$ in FOL is valid, i.e. that it holds true in every model, by exhibiting a proof of $S$. Such a proof string is a certificate of the validity of $S$.
To show that $S$ is *not valid*, one can either exhibit a counterexample model in which $S$ doesn't hold, or f... | 2017/09/22 | ['https://cs.stackexchange.com/questions/81507', 'https://cs.stackexchange.com', 'https://cs.stackexchange.com/users/10594/'] | The completeness theorem states, in an equivalent form:
>
> If a formula $S$ is *not* valid, then there exists some model $\cal M$ such that $$ {\cal M}\not\models S$$
> or, equivalently
> $${\cal M}\models\neg S $$
>
>
>
This is simply the contraposative of the completeness theorem, as stated on e.g. [wikipedi... | Let $\varphi(x)$ be a formula in first-order logic with free variables $x$. If $\varphi(x)$ is not valid, then $\exists x. \neg \varphi(x)$ is valid. Let $\psi$ denote the formula $\exists x. \neg \varphi(x)$. As you stated, if $\psi$ is valid, then there exists a finite proof of $\psi$.
Thus, if $\varphi(x)$ is not v... |
68,698,392 | Hello i want to make a YouTube downloader in python using tkinter but there's an error
the code is:
```
from tkinter import *
from tkinter import filedialog, ttk
from pytube import YouTube
from tkinter.ttk import *
window = Tk()
window.geometry("500x500+350+100")
def openpath():
download_out.config(text="من الط... | 2021/08/08 | ['https://Stackoverflow.com/questions/68698392', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/16312753/'] | You dont define `download_out` until line 100, however you call `openpath()` on line 73, so your calling this function before you have defined `download_out`. This function `openpath` first line is referncing `download_out` as this function is called before you define `download_out` is why you get the error saying its ... | since download\_out was declared as global variable you should use the reserved word `global` in order to use it from within the function `openpath`
```
global download_out
download_out.config(text="من الطبيعي عدم استجابة الكمبيوتر عند التحميل")
``` |
68,698,392 | Hello i want to make a YouTube downloader in python using tkinter but there's an error
the code is:
```
from tkinter import *
from tkinter import filedialog, ttk
from pytube import YouTube
from tkinter.ttk import *
window = Tk()
window.geometry("500x500+350+100")
def openpath():
download_out.config(text="من الط... | 2021/08/08 | ['https://Stackoverflow.com/questions/68698392', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/16312753/'] | Using wrong value for option `command` in a `Button`, it should be a function name to call when button click, not result of a function.
In your code, function will be called when button defined befor variable `download_out` defined.
```py
#path_btn = Button(window,width=11,text= "Selcet Path " ,style="PT.TButton",com... | since download\_out was declared as global variable you should use the reserved word `global` in order to use it from within the function `openpath`
```
global download_out
download_out.config(text="من الطبيعي عدم استجابة الكمبيوتر عند التحميل")
``` |
68,698,392 | Hello i want to make a YouTube downloader in python using tkinter but there's an error
the code is:
```
from tkinter import *
from tkinter import filedialog, ttk
from pytube import YouTube
from tkinter.ttk import *
window = Tk()
window.geometry("500x500+350+100")
def openpath():
download_out.config(text="من الط... | 2021/08/08 | ['https://Stackoverflow.com/questions/68698392', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/16312753/'] | You dont define `download_out` until line 100, however you call `openpath()` on line 73, so your calling this function before you have defined `download_out`. This function `openpath` first line is referncing `download_out` as this function is called before you define `download_out` is why you get the error saying its ... | Using wrong value for option `command` in a `Button`, it should be a function name to call when button click, not result of a function.
In your code, function will be called when button defined befor variable `download_out` defined.
```py
#path_btn = Button(window,width=11,text= "Selcet Path " ,style="PT.TButton",com... |
118,996 | This is my hangman game code for my GCSE computer science coursework. It has been submitted but I was wondering if there is anyway to improve it.
```
import random
import time
#Variables holding different words for each difficulty
EASYWORDS = open("Easy.txt","r+")
words = []
for item in EASYWORDS:
words.append(it... | 2016/02/05 | ['https://codereview.stackexchange.com/questions/118996', 'https://codereview.stackexchange.com', 'https://codereview.stackexchange.com/users/96787/'] | Input checking
==============
The way you're currently checking input is clunky, hard to write, and hard to read. For example, you have the following chunk of code:
>
>
> ```
> menu=input("Welcome to Hangman, type in what difficulty you would like... ").lower()
>
> if menu == "hard" or menu == "h":
>
> hard()... | Word Storage
------------
1. Don't leave file handles open if you're done with them
Each time you `open()` a file, it allocates operating system and interpreter resources (*handles*). If you're done with a file, `close()` it!
2. You're actually **just making ONE huge word list** (**EDIT**: I see [@Ethan Bierlein](http... |
55,092,777 | I have created this function called `createTeams()` which is creating data for the table.
```
func createTeams() {
let team1 = teams(Team1: "Chelsea", Team2: "Arsenal" , startTime: "15/06/2019", location: "London")
let team2 = teams(Team1: "Barcelona", Team2: "Manchester" , startTime: "16/06/2019", location: "... | 2019/03/10 | ['https://Stackoverflow.com/questions/55092777', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/-1/'] | So after doing a lot of research and following the previous steps mentioned about the console not showing it turned out that I've hid the console area or deactivated it.
To activate/show it :
1. Hover to "View" in the top menu in Xcode
2. Tap "Debug Area"
3. Choose "Activate Console"
or simply click command+shift+c | The problem is sometimes xcode debugger crashed due to some internal inconsistency or for other reasons. So what we write print statements cannot be shown in debugger window.
You need to do these steps:
1. Clean the xcode.
2. Force quit the xcode.
3. Clean the derieved data.
4. Restart the xcode and run it.
It will ... |
362,271 | This is kind of a meta-question *for* Meta Stack Exchange.
You may remember my question about a [Vietnamese to English translation issue](https://meta.stackexchange.com/questions/361994).
I realized it wasn't suitable for Meta Stack Exchange, and because regular users can't delete questions with answers, I decided to... | 2021/03/18 | ['https://meta.stackexchange.com/questions/362271', 'https://meta.stackexchange.com', 'https://meta.stackexchange.com/users/879421/'] | The really funny thing is that I was having a conversation about multiple flags earlier today.
>
> There's nothing that annoys a mod more than repeated flagging of a thing. I vaguely remember there's folks who literally have been flagging the same post over years.
>
>
> It's been seen, we've decided what to do. Mod... | >
> I realize now that this is really about SE, so I was wondering if I could have it deleted?
>
>
>
If it's about SE, it's [on-topic for Meta Stack Exchange](/help/whats-meta). That's a good reason to have it *not* deleted, so declining the flags is a logical response. |
43,963,589 | got a little problem. I have the following code:
```
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document doc = builder.parse("result1.xml");
XPathFactory xPathfactory = XPathFactory.newInstance();
XPath ... | 2017/05/14 | ['https://Stackoverflow.com/questions/43963589', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/-1/'] | The stack trace is pretty clear, it "talks" about this line:
```
<div th:utext="'Exception: ' + ${exception.message}" th:remove="tag">${exception.message}</div>
```
It seems that your server is failing to parse the Thymeleaf page,
**it can't find the exception object with a message field**.
I tried to figure out ... | You can check for null on the `exception`:
```
<div th:if="${exception != null}"
th:utext="'Exception: ' + ${exception.message}" th:remove="tag">
</div>
```
Or you can use the shorthand:
```
<div th:utext="'Exception: ' + ${exception?.message}" th:remove="tag"></div>
``` |
37,933,403 | I have a presentational component called Navbar.jsx that returns another presentational component based on whether the user is authenticated or not. When I run webpack, I am getting an error saying that the "if" in my if statement is an unexpected token. You'll see the if else statement in the navbar-collapse div. Here... | 2016/06/20 | ['https://Stackoverflow.com/questions/37933403', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5264835/'] | There is no silver bullet. [Different HTML parsers behave differently](https://www.crummy.com/software/BeautifulSoup/bs4/doc/#differences-between-parsers) and you should pick the one that works for your particular page. Works in this case basically means, that you can get to your desired data.
`lxml` parser is genera... | I've learned it the hard way. It's been killing me. I just couldn't figure out why the tag I wanted included something that wasn't in that tag. Turned out the html parser wasn't working correctly with that site. After hours of headache, I suddenly tried switching to lxml parser, and lo and behold... The unwated stuff w... |
31,663,672 | I am using a console application and I have batches of 20 URIs that I need to read from and I have found a massive speed boost by making all tasks and running them in parallel then sorting the results on completion in a different thread (allowing the next batch to be fetched).
In the calls I am currently using, each t... | 2015/07/27 | ['https://Stackoverflow.com/questions/31663672', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/915839/'] | You should use [CSS counters](https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Counters) in this case.
**Update solution (better)**. Finally, a little more flexible approach would be resetting counter on the `body` initially instead of `section:first-child` and also on any immediate next sibling of the `h1`.
``... | ```
li{
text-align: center;
}
<ol type="1">
<li>this</li>
<li>is</li>
<li>a</li>
<li>List</li>
</ol>
```
thats not testet but should work |
1,471,570 | How can I use dynamic SQL statements in MySQL database and without using session variables?
Right now I have such a code (in MySQL stored procedure):
```
(...)
DECLARE TableName VARCHAR(32);
SET @SelectedId = NULL;
SET @s := CONCAT("SELECT Id INTO @SelectedId FROM ", TableName, " WHERE param=val LIMIT 1");
PREPARE st... | 2009/09/24 | ['https://Stackoverflow.com/questions/1471570', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/160760/'] | Sorry, prepared statements in MySQL are session-global. According to <http://dev.mysql.com/doc/refman/5.1/en/sql-syntax-prepared-statements.html>, "A prepared statement is also global to the session."
And there's no other way (besides prepared statements) to execute dynamic SQL in MySQL 5.x.
So you can of course re... | The link above gives a page not found. See here instead :
<https://dev.mysql.com/doc/refman/5.7/en/prepare.html>
The end para clearly states :
"
A statement prepared in stored program context cannot refer to stored procedure or function parameters or local variables because they go out of scope when the program ends ... |
25,414 | As an Electrical Engineer (emphasis in RF and radar, class of '74) who has followed the space program(s) since Mercury, and a prior flight test telemetry engineer, I was wondering if anyone knows what frequency (frequencies), effective radiated power (ERP), and the modulation modes (I am assuming it's PCM) are being us... | 2018/02/16 | ['https://space.stackexchange.com/questions/25414', 'https://space.stackexchange.com', 'https://space.stackexchange.com/users/23550/'] | You can see the FCC launch permit here: <https://apps.fcc.gov/oetcf/els/reports/STA_Print.cfm?mode=current&application_seq=80036>
(STA is a Special Temporary Authority) "Application includes three sub-orbital first stage boosters, and an orbital second stage."
There are separate listings for "Launch vehicle 1st stag... | That is a lot of questions, let me try to address them one by one:
>
> I was wondering if anyone knows what frequency (frequencies),
> effective radiated power (ERP), and the modulation modes (I am
> assuming it's PCM) are being used
>
>
>
There has been little in the public domain in regards to the on-board RF... |
13,724,271 | please give me correct way of movemenent. where can i get useful info?
what i want is: -
there is the form with parameters and 2 buttons: Search, Reset.
i want to implement logic - input some params and click search button - GridView as result is shown below.
examples, articles would be helpful.Thanks! | 2012/12/05 | ['https://Stackoverflow.com/questions/13724271', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1450372/'] | Are the devices all running the same version of the OS? Another possibility (beyond colorspaces, which someone already mentioned) is that the JPG decoding libraries may be subtly different. As JPEG is a lossy image format, it's not inconceivable that different decoders would produce resulting bitmaps that were not bit-... | I assume the "device grey" color space varies by device. Try with a device independent color space. |
23,415,492 | I have two tables:
**ID,YRMO,Counts**
1,Dec 2013,4
1,Jan 2014,6
1,Feb 2014,7
2,Jan,2014,6
2,Feb,2014,8
**ID,YRMO,Counts**
1,Dec 2013,10
1,Jan 2014,8
1,March 2014,12
2,Jan 2014,6
2,Feb 2014,10
I want to find the pearson corelation coefficient for each sets of ID. There are about more than 200 different I... | 2014/05/01 | ['https://Stackoverflow.com/questions/23415492', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3325141/'] | To calculate Pearson Correlation Coefficient; you need to first calculate `Mean` then `standard daviation` and then `correlation coefficient` as outlined below
1. Calculate Mean
-----------------
```
insert into tab2 (tab1_id, mean)
select ID, sum([counts]) /
(select count(*) from tab1) as mean
from tab1
group by ID... | A Single-Pass Solution:
=======================
There are two flavors of the Pearson correlation coefficient, one for a Sample and one for an entire Population. These are simple, single-pass, and I believe, correct formulas for both:
```
-- Methods for calculating the two Pearson correlation coefficients
SELECT
... |
562,745 | Ladies and Gentlemen,
I was hoping someone here could guide me in the right direction regarding the problem I am facing. I have literally tried all possible options in the internet forums with no luck.
I am trying to connect to a samba share running on a headless server running Fedora Server. I am trying to connect t... | 2020/01/18 | ['https://unix.stackexchange.com/questions/562745', 'https://unix.stackexchange.com', 'https://unix.stackexchange.com/users/240469/'] | I was working on something similar the other night. My setup is a little different in that I do not use a home directory, each LVM is mounted at its own root level directory but a few things that may help:
In the [Global] section, i enforce a minimum SMB level using:
```
[Global]
min protocol = SMB2
```
If you are ... | Have you tried telling SELinux on the server that the directory may be accessed by Samba?
It might be as simple as telling SELinux that sharing of home directories is allowed:
setsebool -P samba\_enable\_home\_dirs 1 |
546,926 | Trying to use `dpkg` and `egrep` commands to list packages whose names starts with `q`. Already tried:
```
dpkg -l | egrep -l q
dpkg -l | egrep -l ^q
dpkg -l | egrep q
dpkg -l | grep q
```
What is going wrong? | 2019/10/15 | ['https://unix.stackexchange.com/questions/546926', 'https://unix.stackexchange.com', 'https://unix.stackexchange.com/users/377372/'] | Use `--get-selections` instead of `-l` option:
```
dpkg --get-selections |grep ^q
```
Or using `awk` to change the column order:
```
dpkg -l |awk '{print $2 , $3 "\t\t" $1}' | grep ^q
``` | The regular expressions for egrep do not match the expected output of `dpkg -l`. If you wish to keep the same output format as `dpkg -l`, which includes the sate of the package, the version and a description, then the regular expression needs to be changed to match the expected format: three characters at the start of ... |
546,926 | Trying to use `dpkg` and `egrep` commands to list packages whose names starts with `q`. Already tried:
```
dpkg -l | egrep -l q
dpkg -l | egrep -l ^q
dpkg -l | egrep q
dpkg -l | grep q
```
What is going wrong? | 2019/10/15 | ['https://unix.stackexchange.com/questions/546926', 'https://unix.stackexchange.com', 'https://unix.stackexchange.com/users/377372/'] | You don't really need grep (or egrep) at all here: the `dpkg -l` command accepts a pattern:
```
-l, --list package-name-pattern...
List packages matching given pattern.
```
Note that `package-name-pattern` is a glob pattern not a regular expression. So
```
dpkg -l 'q*'
```
If you want the output in more confi... | The regular expressions for egrep do not match the expected output of `dpkg -l`. If you wish to keep the same output format as `dpkg -l`, which includes the sate of the package, the version and a description, then the regular expression needs to be changed to match the expected format: three characters at the start of ... |
37,849,294 | I am using this ajax code to send data to server:
```
$.ajax({
data: postData,
type: method,
url: url,
timeout: 20000,
contentType: "application/x-www-form-urlencoded;charset=UTF-8",
error: function(jqXHR,textStatus,err){alert("Error returned from ajax call "+err);},
success: function(data,... | 2016/06/16 | ['https://Stackoverflow.com/questions/37849294', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4575293/'] | You should try jQuery Base64 encode.
JavaScript:
```
<script src="jquery.min.js"></script>
<script src="jquery.base64.min.js"></script>
<script>
enctext = $.base64.encode("yourtext");
//your ajax code goes here.
</script>
```
PHP :
```
<?php
$org_text = base64_decode($_POST['your_variable']);
?>
```
... | Try changing the column in the database to utf16\_bin Collation
>
> Post you php database connection code.
>
>
> |
37,849,294 | I am using this ajax code to send data to server:
```
$.ajax({
data: postData,
type: method,
url: url,
timeout: 20000,
contentType: "application/x-www-form-urlencoded;charset=UTF-8",
error: function(jqXHR,textStatus,err){alert("Error returned from ajax call "+err);},
success: function(data,... | 2016/06/16 | ['https://Stackoverflow.com/questions/37849294', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4575293/'] | Just for information and to help others that might fall in the same situation...
The problem was with the postData itself... it was parsed such that every post variable was applied with escape()... Using encodeURIComponent() instead of escape() worked!
**Summary:**
Donot use escape() function to url-escape query comp... | Try changing the column in the database to utf16\_bin Collation
>
> Post you php database connection code.
>
>
> |
8,977,967 | I want to install latest stable version of Sphinx ([sphinxsearch.com](http://sphinxsearch.com/)) on Mac OS X Lion. What is a right way to do that? | 2012/01/23 | ['https://Stackoverflow.com/questions/8977967', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/561626/'] | Here is short guide, <http://pat.github.com/ts/en/installing_sphinx.html> its regarding thinking\_sphinx, ruby gem for workign with rails, but it covers also installing sphinx server. | What wasn't obvious from those instructions was that the main executables would be found in /usr/local/bin/searchd and /usr/local/bin/indexer... I was a bit puzzled after install when I couldn't find anything *sphinx* in /usr/local/bin. |
8,977,967 | I want to install latest stable version of Sphinx ([sphinxsearch.com](http://sphinxsearch.com/)) on Mac OS X Lion. What is a right way to do that? | 2012/01/23 | ['https://Stackoverflow.com/questions/8977967', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/561626/'] | Here is short guide, <http://pat.github.com/ts/en/installing_sphinx.html> its regarding thinking\_sphinx, ruby gem for workign with rails, but it covers also installing sphinx server. | I just checked and it's on brew, so you can just run if you have HomeBrew:
`brew install sphinx`. |
8,977,967 | I want to install latest stable version of Sphinx ([sphinxsearch.com](http://sphinxsearch.com/)) on Mac OS X Lion. What is a right way to do that? | 2012/01/23 | ['https://Stackoverflow.com/questions/8977967', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/561626/'] | Here is short guide, <http://pat.github.com/ts/en/installing_sphinx.html> its regarding thinking\_sphinx, ruby gem for workign with rails, but it covers also installing sphinx server. | You can try the easy Install.
-Open your terminal.
-Execute the following command: sudo easy\_install sphinx
Then it works. |
8,977,967 | I want to install latest stable version of Sphinx ([sphinxsearch.com](http://sphinxsearch.com/)) on Mac OS X Lion. What is a right way to do that? | 2012/01/23 | ['https://Stackoverflow.com/questions/8977967', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/561626/'] | I just checked and it's on brew, so you can just run if you have HomeBrew:
`brew install sphinx`. | What wasn't obvious from those instructions was that the main executables would be found in /usr/local/bin/searchd and /usr/local/bin/indexer... I was a bit puzzled after install when I couldn't find anything *sphinx* in /usr/local/bin. |
8,977,967 | I want to install latest stable version of Sphinx ([sphinxsearch.com](http://sphinxsearch.com/)) on Mac OS X Lion. What is a right way to do that? | 2012/01/23 | ['https://Stackoverflow.com/questions/8977967', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/561626/'] | What wasn't obvious from those instructions was that the main executables would be found in /usr/local/bin/searchd and /usr/local/bin/indexer... I was a bit puzzled after install when I couldn't find anything *sphinx* in /usr/local/bin. | You can try the easy Install.
-Open your terminal.
-Execute the following command: sudo easy\_install sphinx
Then it works. |
8,977,967 | I want to install latest stable version of Sphinx ([sphinxsearch.com](http://sphinxsearch.com/)) on Mac OS X Lion. What is a right way to do that? | 2012/01/23 | ['https://Stackoverflow.com/questions/8977967', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/561626/'] | I just checked and it's on brew, so you can just run if you have HomeBrew:
`brew install sphinx`. | You can try the easy Install.
-Open your terminal.
-Execute the following command: sudo easy\_install sphinx
Then it works. |
36,443,086 | I am trying to add ffmpeg into my android project. I am using ubuntu 14.04 OS.
I am following this link. [Link](https://software.intel.com/en-us/android/blogs/2013/12/06/building-ffmpeg-for-android-on-x86)
But I am getting error while executing this line.
```
$ANDROID_NDK/build/tools/make-standalone-toolchain.sh --t... | 2016/04/06 | ['https://Stackoverflow.com/questions/36443086', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3564344/'] | **Yes**: CLion doesn't allow you to open multiple projects *from the menu* because it uses the *CMake* system, which is script based.
However, *CMake* is quite capable of encompassing multiple projects, and CLion will correctly parse your CMake file and show all relevant directories in the project explorer.
### Examp... | No. CLion either:
* opens a new window with the other project you want to work on
* **closes** your current project and opens the new one in the current window
as you can see in the [documentation](https://www.jetbrains.com/help/idea/2016.1/opening-multiple-projects.html). I think this is wanted in their design; prob... |
36,443,086 | I am trying to add ffmpeg into my android project. I am using ubuntu 14.04 OS.
I am following this link. [Link](https://software.intel.com/en-us/android/blogs/2013/12/06/building-ffmpeg-for-android-on-x86)
But I am getting error while executing this line.
```
$ANDROID_NDK/build/tools/make-standalone-toolchain.sh --t... | 2016/04/06 | ['https://Stackoverflow.com/questions/36443086', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3564344/'] | No. CLion either:
* opens a new window with the other project you want to work on
* **closes** your current project and opens the new one in the current window
as you can see in the [documentation](https://www.jetbrains.com/help/idea/2016.1/opening-multiple-projects.html). I think this is wanted in their design; prob... | Adding some visual clues based on the answer from @c-z
This is how my project structure looking -
[](https://i.stack.imgur.com/2vF6D.png)
This is how my root level CMakeLists.txt is looking -
[
But I am getting error while executing this line.
```
$ANDROID_NDK/build/tools/make-standalone-toolchain.sh --t... | 2016/04/06 | ['https://Stackoverflow.com/questions/36443086', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3564344/'] | **Yes**: CLion doesn't allow you to open multiple projects *from the menu* because it uses the *CMake* system, which is script based.
However, *CMake* is quite capable of encompassing multiple projects, and CLion will correctly parse your CMake file and show all relevant directories in the project explorer.
### Examp... | Adding some visual clues based on the answer from @c-z
This is how my project structure looking -
[](https://i.stack.imgur.com/2vF6D.png)
This is how my root level CMakeLists.txt is looking -
[">
```
in my jquery I have function defined as
```
function createPanels(requiredButtons) {
var abc = JSON.stringify(requiredButtons)
abc.each(function (key, value) {
alert(value);
... | 2013/07/23 | ['https://Stackoverflow.com/questions/17804096', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1243271/'] | Thats not how `$.each` is to be used:
Try this:
```
$.each(abc, function (key, value) {
alert(value);
});
```
It will alert each character in the string. | "{a,b,c,d}" is not a object that's why your code is not working.
Second point is : **Use jQuery.each() for iterating a collection.**
Try to put it in this form :
```
var x= ['a','b','c','d','e'];
jQuery.each(x,function (key, value) {
console.log(value);
});
```
It will return **a,b,c,d,e** as you want.
He... |
17,804,096 | I am calling a jquery function from .aspx page as follows
```
<body onload="JavaScript:createPanels('[{a,b,c,d,e}]')">
```
in my jquery I have function defined as
```
function createPanels(requiredButtons) {
var abc = JSON.stringify(requiredButtons)
abc.each(function (key, value) {
alert(value);
... | 2013/07/23 | ['https://Stackoverflow.com/questions/17804096', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1243271/'] | Thats not how `$.each` is to be used:
Try this:
```
$.each(abc, function (key, value) {
alert(value);
});
```
It will alert each character in the string. | I lurve jQuery and everything, but there's no need to invoke it to iterate an array.
```
abc.forEach( function (elem) {
console.log(elem);
});
```
should work, once you've tidied up your JSON thing |
17,804,096 | I am calling a jquery function from .aspx page as follows
```
<body onload="JavaScript:createPanels('[{a,b,c,d,e}]')">
```
in my jquery I have function defined as
```
function createPanels(requiredButtons) {
var abc = JSON.stringify(requiredButtons)
abc.each(function (key, value) {
alert(value);
... | 2013/07/23 | ['https://Stackoverflow.com/questions/17804096', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1243271/'] | Thats not how `$.each` is to be used:
Try this:
```
$.each(abc, function (key, value) {
alert(value);
});
```
It will alert each character in the string. | Thanks for your valuable suggessions
I solved the problem as
.aspx page
```
<body onload="JavaScript:createPanels('a,b,c,d,e')">
```
jquery
```
function createPanels(requiredButtons) {
var abc = requiredButtons.split(',');
$.each(abc, function (key, value) {
alert(value);
});
```
} |
17,804,096 | I am calling a jquery function from .aspx page as follows
```
<body onload="JavaScript:createPanels('[{a,b,c,d,e}]')">
```
in my jquery I have function defined as
```
function createPanels(requiredButtons) {
var abc = JSON.stringify(requiredButtons)
abc.each(function (key, value) {
alert(value);
... | 2013/07/23 | ['https://Stackoverflow.com/questions/17804096', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1243271/'] | Several issues there.
a. This is not JSON `[{a,b,c,d,e}]`
If you really want to do it on the body element then this is how to do it:
```
<body onload="JavaScript:createPanels('{"posts": [{"key":"value"}, {"key":"value"}]}')">
```
This is not a really good idea, so you call i... | "{a,b,c,d}" is not a object that's why your code is not working.
Second point is : **Use jQuery.each() for iterating a collection.**
Try to put it in this form :
```
var x= ['a','b','c','d','e'];
jQuery.each(x,function (key, value) {
console.log(value);
});
```
It will return **a,b,c,d,e** as you want.
He... |
17,804,096 | I am calling a jquery function from .aspx page as follows
```
<body onload="JavaScript:createPanels('[{a,b,c,d,e}]')">
```
in my jquery I have function defined as
```
function createPanels(requiredButtons) {
var abc = JSON.stringify(requiredButtons)
abc.each(function (key, value) {
alert(value);
... | 2013/07/23 | ['https://Stackoverflow.com/questions/17804096', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1243271/'] | Several issues there.
a. This is not JSON `[{a,b,c,d,e}]`
If you really want to do it on the body element then this is how to do it:
```
<body onload="JavaScript:createPanels('{"posts": [{"key":"value"}, {"key":"value"}]}')">
```
This is not a really good idea, so you call i... | I lurve jQuery and everything, but there's no need to invoke it to iterate an array.
```
abc.forEach( function (elem) {
console.log(elem);
});
```
should work, once you've tidied up your JSON thing |
17,804,096 | I am calling a jquery function from .aspx page as follows
```
<body onload="JavaScript:createPanels('[{a,b,c,d,e}]')">
```
in my jquery I have function defined as
```
function createPanels(requiredButtons) {
var abc = JSON.stringify(requiredButtons)
abc.each(function (key, value) {
alert(value);
... | 2013/07/23 | ['https://Stackoverflow.com/questions/17804096', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1243271/'] | Several issues there.
a. This is not JSON `[{a,b,c,d,e}]`
If you really want to do it on the body element then this is how to do it:
```
<body onload="JavaScript:createPanels('{"posts": [{"key":"value"}, {"key":"value"}]}')">
```
This is not a really good idea, so you call i... | Thanks for your valuable suggessions
I solved the problem as
.aspx page
```
<body onload="JavaScript:createPanels('a,b,c,d,e')">
```
jquery
```
function createPanels(requiredButtons) {
var abc = requiredButtons.split(',');
$.each(abc, function (key, value) {
alert(value);
});
```
} |
17,804,096 | I am calling a jquery function from .aspx page as follows
```
<body onload="JavaScript:createPanels('[{a,b,c,d,e}]')">
```
in my jquery I have function defined as
```
function createPanels(requiredButtons) {
var abc = JSON.stringify(requiredButtons)
abc.each(function (key, value) {
alert(value);
... | 2013/07/23 | ['https://Stackoverflow.com/questions/17804096', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1243271/'] | This is not a valid JSON format. Json Format is like as below:
```
var obj = {
"flammable": "inflammable",
"duh": "no duh"
};
```
Then Use as below:
```
$.each( obj, function( key, value ) {
alert( key + ": " + value );
});
```
[Reference](http://api.jquery.com/jQuery.each/) | "{a,b,c,d}" is not a object that's why your code is not working.
Second point is : **Use jQuery.each() for iterating a collection.**
Try to put it in this form :
```
var x= ['a','b','c','d','e'];
jQuery.each(x,function (key, value) {
console.log(value);
});
```
It will return **a,b,c,d,e** as you want.
He... |
17,804,096 | I am calling a jquery function from .aspx page as follows
```
<body onload="JavaScript:createPanels('[{a,b,c,d,e}]')">
```
in my jquery I have function defined as
```
function createPanels(requiredButtons) {
var abc = JSON.stringify(requiredButtons)
abc.each(function (key, value) {
alert(value);
... | 2013/07/23 | ['https://Stackoverflow.com/questions/17804096', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1243271/'] | This is not a valid JSON format. Json Format is like as below:
```
var obj = {
"flammable": "inflammable",
"duh": "no duh"
};
```
Then Use as below:
```
$.each( obj, function( key, value ) {
alert( key + ": " + value );
});
```
[Reference](http://api.jquery.com/jQuery.each/) | I lurve jQuery and everything, but there's no need to invoke it to iterate an array.
```
abc.forEach( function (elem) {
console.log(elem);
});
```
should work, once you've tidied up your JSON thing |
17,804,096 | I am calling a jquery function from .aspx page as follows
```
<body onload="JavaScript:createPanels('[{a,b,c,d,e}]')">
```
in my jquery I have function defined as
```
function createPanels(requiredButtons) {
var abc = JSON.stringify(requiredButtons)
abc.each(function (key, value) {
alert(value);
... | 2013/07/23 | ['https://Stackoverflow.com/questions/17804096', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1243271/'] | This is not a valid JSON format. Json Format is like as below:
```
var obj = {
"flammable": "inflammable",
"duh": "no duh"
};
```
Then Use as below:
```
$.each( obj, function( key, value ) {
alert( key + ": " + value );
});
```
[Reference](http://api.jquery.com/jQuery.each/) | Thanks for your valuable suggessions
I solved the problem as
.aspx page
```
<body onload="JavaScript:createPanels('a,b,c,d,e')">
```
jquery
```
function createPanels(requiredButtons) {
var abc = requiredButtons.split(',');
$.each(abc, function (key, value) {
alert(value);
});
```
} |
23,808,057 | While my C# program writes data continuously to an Excel spreadsheet, if the end user clicks on the upper right menu and opens the
**Excel Options** window, this causes following exception:
>
> System.Runtime.InteropServices.COMException with HRESULT: 0x800AC472
>
>
>
This interrupts the data from being written t... | 2014/05/22 | ['https://Stackoverflow.com/questions/23808057', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3597426/'] | We finally went all the way to Microsoft Support with this issue. Their final response was:
>
> I am able to reproduce the issue. I researched on this further and
> found that this behaviour is expected and by design. This
> exception, 0x800AC472 – VBA\_E\_IGNORE, is thrown because Excel is busy
> and will not ser... | ```
xlApp = new Excel.Application();
xlApp.Interactive = false;
``` |
23,808,057 | While my C# program writes data continuously to an Excel spreadsheet, if the end user clicks on the upper right menu and opens the
**Excel Options** window, this causes following exception:
>
> System.Runtime.InteropServices.COMException with HRESULT: 0x800AC472
>
>
>
This interrupts the data from being written t... | 2014/05/22 | ['https://Stackoverflow.com/questions/23808057', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3597426/'] | What I have done successfully is to make a temp copy of the target excel file before opening it in code.
That way I can manipulate it independent of the source document being open or not. | Since Interop does cross threading, it may lead to accessing same object by multiple threads, leading to this exception, below code worked for me.
```
bool failed = false;
do
{
try
{
// Call goes here
failed = false;
}
catch (System.Runtime.InteropServices.COMException e)
{
... |
23,808,057 | While my C# program writes data continuously to an Excel spreadsheet, if the end user clicks on the upper right menu and opens the
**Excel Options** window, this causes following exception:
>
> System.Runtime.InteropServices.COMException with HRESULT: 0x800AC472
>
>
>
This interrupts the data from being written t... | 2014/05/22 | ['https://Stackoverflow.com/questions/23808057', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3597426/'] | What I have done successfully is to make a temp copy of the target excel file before opening it in code.
That way I can manipulate it independent of the source document being open or not. | One possible alternative to automating Excel, and wrestling with its' perculiarities, is to write the file out using the OpenXmlWriter writer (DocumentFormat.OpenXml.OpenXmlWriter).
It's a little tricky but does handle sheets with > 1 million rows without breaking a sweat.
[OpenXml docs on MSDN](http://msdn.microsoft... |
23,808,057 | While my C# program writes data continuously to an Excel spreadsheet, if the end user clicks on the upper right menu and opens the
**Excel Options** window, this causes following exception:
>
> System.Runtime.InteropServices.COMException with HRESULT: 0x800AC472
>
>
>
This interrupts the data from being written t... | 2014/05/22 | ['https://Stackoverflow.com/questions/23808057', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3597426/'] | We finally went all the way to Microsoft Support with this issue. Their final response was:
>
> I am able to reproduce the issue. I researched on this further and
> found that this behaviour is expected and by design. This
> exception, 0x800AC472 – VBA\_E\_IGNORE, is thrown because Excel is busy
> and will not ser... | What I have done successfully is to make a temp copy of the target excel file before opening it in code.
That way I can manipulate it independent of the source document being open or not. |
23,808,057 | While my C# program writes data continuously to an Excel spreadsheet, if the end user clicks on the upper right menu and opens the
**Excel Options** window, this causes following exception:
>
> System.Runtime.InteropServices.COMException with HRESULT: 0x800AC472
>
>
>
This interrupts the data from being written t... | 2014/05/22 | ['https://Stackoverflow.com/questions/23808057', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3597426/'] | ```
xlApp = new Excel.Application();
xlApp.Interactive = false;
``` | Since Interop does cross threading, it may lead to accessing same object by multiple threads, leading to this exception, below code worked for me.
```
bool failed = false;
do
{
try
{
// Call goes here
failed = false;
}
catch (System.Runtime.InteropServices.COMException e)
{
... |
23,808,057 | While my C# program writes data continuously to an Excel spreadsheet, if the end user clicks on the upper right menu and opens the
**Excel Options** window, this causes following exception:
>
> System.Runtime.InteropServices.COMException with HRESULT: 0x800AC472
>
>
>
This interrupts the data from being written t... | 2014/05/22 | ['https://Stackoverflow.com/questions/23808057', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3597426/'] | Make Excel Interactive is a perfect solution. The only problem is if the user is doing something on Excel at the same time, like selecting range or editing a cell. And for example your code is returning from a different thread and trying to write on Excel the results of the calculations. So to avoid the issue my sugges... | Since Interop does cross threading, it may lead to accessing same object by multiple threads, leading to this exception, below code worked for me.
```
bool failed = false;
do
{
try
{
// Call goes here
failed = false;
}
catch (System.Runtime.InteropServices.COMException e)
{
... |
23,808,057 | While my C# program writes data continuously to an Excel spreadsheet, if the end user clicks on the upper right menu and opens the
**Excel Options** window, this causes following exception:
>
> System.Runtime.InteropServices.COMException with HRESULT: 0x800AC472
>
>
>
This interrupts the data from being written t... | 2014/05/22 | ['https://Stackoverflow.com/questions/23808057', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3597426/'] | Make Excel Interactive is a perfect solution. The only problem is if the user is doing something on Excel at the same time, like selecting range or editing a cell. And for example your code is returning from a different thread and trying to write on Excel the results of the calculations. So to avoid the issue my sugges... | One possible alternative to automating Excel, and wrestling with its' perculiarities, is to write the file out using the OpenXmlWriter writer (DocumentFormat.OpenXml.OpenXmlWriter).
It's a little tricky but does handle sheets with > 1 million rows without breaking a sweat.
[OpenXml docs on MSDN](http://msdn.microsoft... |
23,808,057 | While my C# program writes data continuously to an Excel spreadsheet, if the end user clicks on the upper right menu and opens the
**Excel Options** window, this causes following exception:
>
> System.Runtime.InteropServices.COMException with HRESULT: 0x800AC472
>
>
>
This interrupts the data from being written t... | 2014/05/22 | ['https://Stackoverflow.com/questions/23808057', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3597426/'] | We finally went all the way to Microsoft Support with this issue. Their final response was:
>
> I am able to reproduce the issue. I researched on this further and
> found that this behaviour is expected and by design. This
> exception, 0x800AC472 – VBA\_E\_IGNORE, is thrown because Excel is busy
> and will not ser... | One possible alternative to automating Excel, and wrestling with its' perculiarities, is to write the file out using the OpenXmlWriter writer (DocumentFormat.OpenXml.OpenXmlWriter).
It's a little tricky but does handle sheets with > 1 million rows without breaking a sweat.
[OpenXml docs on MSDN](http://msdn.microsoft... |
23,808,057 | While my C# program writes data continuously to an Excel spreadsheet, if the end user clicks on the upper right menu and opens the
**Excel Options** window, this causes following exception:
>
> System.Runtime.InteropServices.COMException with HRESULT: 0x800AC472
>
>
>
This interrupts the data from being written t... | 2014/05/22 | ['https://Stackoverflow.com/questions/23808057', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3597426/'] | ```
xlApp = new Excel.Application();
xlApp.Interactive = false;
``` | One possible alternative to automating Excel, and wrestling with its' perculiarities, is to write the file out using the OpenXmlWriter writer (DocumentFormat.OpenXml.OpenXmlWriter).
It's a little tricky but does handle sheets with > 1 million rows without breaking a sweat.
[OpenXml docs on MSDN](http://msdn.microsoft... |
23,808,057 | While my C# program writes data continuously to an Excel spreadsheet, if the end user clicks on the upper right menu and opens the
**Excel Options** window, this causes following exception:
>
> System.Runtime.InteropServices.COMException with HRESULT: 0x800AC472
>
>
>
This interrupts the data from being written t... | 2014/05/22 | ['https://Stackoverflow.com/questions/23808057', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3597426/'] | Make Excel Interactive is a perfect solution. The only problem is if the user is doing something on Excel at the same time, like selecting range or editing a cell. And for example your code is returning from a different thread and trying to write on Excel the results of the calculations. So to avoid the issue my sugges... | What I have done successfully is to make a temp copy of the target excel file before opening it in code.
That way I can manipulate it independent of the source document being open or not. |
50,389,264 | I am learning how to code and working on a Hack Reactor puzzle (see below). *I don't understand why the else part of my function block does not work. Can anyone point me in the right direction?*
>
> Write a function called `getElementsThatEqual10AtProperty`.
>
>
> Given an object and a key, `getElementsThatEqual10A... | 2018/05/17 | ['https://Stackoverflow.com/questions/50389264', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/8193814/'] | Use only isArray to check for array, no need of `typeof` here.
```js
var obj = {
key: '[1000, 10, 50, 10]'
};
console.log(Array.isArray(obj.key)) // false
console.log(typeof Array.isArray(obj.key)) // 'boolean'
console.log(Boolean(typeof Array.isArray(obj.key))) // true
```
Array at 'key' value should be declared w... | Obj[key] is not declared as an array in your code but as a string. You can also do much simpler to meet your requirements :
```js
var obj = {
key: [1000, 10, 50, 10]
};
function getElementsThatEqual10AtProperty(obj, key) {
if (obj[key] && obj[key] instanceof Array) {
return obj[key].filter( element => eleme... |
50,389,264 | I am learning how to code and working on a Hack Reactor puzzle (see below). *I don't understand why the else part of my function block does not work. Can anyone point me in the right direction?*
>
> Write a function called `getElementsThatEqual10AtProperty`.
>
>
> Given an object and a key, `getElementsThatEqual10A... | 2018/05/17 | ['https://Stackoverflow.com/questions/50389264', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/8193814/'] | Use only isArray to check for array, no need of `typeof` here.
```js
var obj = {
key: '[1000, 10, 50, 10]'
};
console.log(Array.isArray(obj.key)) // false
console.log(typeof Array.isArray(obj.key)) // 'boolean'
console.log(Boolean(typeof Array.isArray(obj.key))) // true
```
Array at 'key' value should be declared w... | Your problem is that you set `obj.key` instead of `obj[key]` in the `else` part of your function. |
50,389,264 | I am learning how to code and working on a Hack Reactor puzzle (see below). *I don't understand why the else part of my function block does not work. Can anyone point me in the right direction?*
>
> Write a function called `getElementsThatEqual10AtProperty`.
>
>
> Given an object and a key, `getElementsThatEqual10A... | 2018/05/17 | ['https://Stackoverflow.com/questions/50389264', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/8193814/'] | Use only isArray to check for array, no need of `typeof` here.
```js
var obj = {
key: '[1000, 10, 50, 10]'
};
console.log(Array.isArray(obj.key)) // false
console.log(typeof Array.isArray(obj.key)) // 'boolean'
console.log(Boolean(typeof Array.isArray(obj.key))) // true
```
Array at 'key' value should be declared w... | Filter the array:
```
var obj = {
key: [1000, 10, 50, 10]
}
function getElementsThatEqual10AtProperty(obj, key) {
var tens = []
if (Array.isArray(obj[key])) {
tens = obj[key].filter(function(el) {
return (10 === el)
})
}
return tens
}
var tensArray = getElementsThatEqual10AtProperty(obj, 'key... |
50,389,264 | I am learning how to code and working on a Hack Reactor puzzle (see below). *I don't understand why the else part of my function block does not work. Can anyone point me in the right direction?*
>
> Write a function called `getElementsThatEqual10AtProperty`.
>
>
> Given an object and a key, `getElementsThatEqual10A... | 2018/05/17 | ['https://Stackoverflow.com/questions/50389264', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/8193814/'] | Obj[key] is not declared as an array in your code but as a string. You can also do much simpler to meet your requirements :
```js
var obj = {
key: [1000, 10, 50, 10]
};
function getElementsThatEqual10AtProperty(obj, key) {
if (obj[key] && obj[key] instanceof Array) {
return obj[key].filter( element => eleme... | Your problem is that you set `obj.key` instead of `obj[key]` in the `else` part of your function. |
50,389,264 | I am learning how to code and working on a Hack Reactor puzzle (see below). *I don't understand why the else part of my function block does not work. Can anyone point me in the right direction?*
>
> Write a function called `getElementsThatEqual10AtProperty`.
>
>
> Given an object and a key, `getElementsThatEqual10A... | 2018/05/17 | ['https://Stackoverflow.com/questions/50389264', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/8193814/'] | Filter the array:
```
var obj = {
key: [1000, 10, 50, 10]
}
function getElementsThatEqual10AtProperty(obj, key) {
var tens = []
if (Array.isArray(obj[key])) {
tens = obj[key].filter(function(el) {
return (10 === el)
})
}
return tens
}
var tensArray = getElementsThatEqual10AtProperty(obj, 'key... | Your problem is that you set `obj.key` instead of `obj[key]` in the `else` part of your function. |
16,853,778 | I Have a simple unordered list containing over 12 li's.
```
<ul>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href... | 2013/05/31 | ['https://Stackoverflow.com/questions/16853778', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2335523/'] | Use
```
ul li:nth-child(-n+4)
```
for the first four, and
```
ul li:nth-last-child(-n+4)
```
for the last four. | Using `nth-child` is the best practice.
```
li:nth-child(-n+4) {
background-color:gren;
}
```
But you **won't get full browser compatibility.** especially in lower versions of **IE**
If you are using static html, you can create a class and and apply to the first four `li`
eg:
```
.special{
background-c... |
16,853,778 | I Have a simple unordered list containing over 12 li's.
```
<ul>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href... | 2013/05/31 | ['https://Stackoverflow.com/questions/16853778', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2335523/'] | Use
```
ul li:nth-child(-n+4)
```
for the first four, and
```
ul li:nth-last-child(-n+4)
```
for the last four. | You can user **nth-child** and **nth-last-of-type**.
So the CSS code will be :
```
ul li:nth-child(-n+4) {
background: red;
}
ul li:nth-last-of-type(-n+4) {
background: blue;
}
``` |
16,853,778 | I Have a simple unordered list containing over 12 li's.
```
<ul>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href... | 2013/05/31 | ['https://Stackoverflow.com/questions/16853778', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2335523/'] | Using `nth-child` is the best practice.
```
li:nth-child(-n+4) {
background-color:gren;
}
```
But you **won't get full browser compatibility.** especially in lower versions of **IE**
If you are using static html, you can create a class and and apply to the first four `li`
eg:
```
.special{
background-c... | You can user **nth-child** and **nth-last-of-type**.
So the CSS code will be :
```
ul li:nth-child(-n+4) {
background: red;
}
ul li:nth-last-of-type(-n+4) {
background: blue;
}
``` |
640,409 | Someone asked me to provide my public id\_rsa key to make be able to connect to their server via ssh. I did so and it's working fine. I want to do that from my another laptop as well without having to bother them. If I just copy a public and a private keys from my first laptop to the second one, will it allow me to con... | 2014/10/29 | ['https://serverfault.com/questions/640409', 'https://serverfault.com', 'https://serverfault.com/users/250802/'] | Followed advice from Microsoft support and created claim description items which included the attributes I wanted to include, these were then present in the metadata file. Applying an Issuance Transform allowed me to map values to these attributes. | This is normal. The metadata file contains the "claim descriptions" as you say, plus the endpoints of your ADFS farm, the public key of your token signing and token decrypting certificates; general information about your deployment. All of this, but not your relying party configuration (this would be a security issue i... |
4,314,060 | I'm looking for an explanation / API doc / examples of how to use (and train?) Tesseract in C++, nothing useful on the google Tesseract page, and yet to find something over the web.
Anyone useful sources, experiences would be more than welcome, as I have no idea how to begin with it.
**P.S:**
1. I'm open for sugges... | 2010/11/30 | ['https://Stackoverflow.com/questions/4314060', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/427306/'] | I have some experience with Tesseract...
a simple google of 'training tesseract' reveals this page:
<http://code.google.com/p/tesseract-ocr/wiki/TrainingTesseract>
where you must choose which version of tesseract you wish to train..
While 3 is the latest version, it's brand new and thus people are still ironing out any... | Tesseract Ocr is an open source library for detecting Optical Character. You just need to include the library files if you are using visual studio. If you are using qt creator then you have to build the library to work on the QT. You need to use CMakelist or Cmake Gui to build the library.
You can visit the link
[Open... |
30,867,462 | I have been given a web application written in Classic ASP to port from Windows 2003 Server (SQL Server 2000 and IIS 6) to Windows 2008 Server (SQL Server 2008 and IIS 7.5).
The site uses a `GLOBAL.ASA` file to define global variables, one of which is the connection string (`cnn`) to connect to SQL Server.
Below is... | 2015/06/16 | ['https://Stackoverflow.com/questions/30867462', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5015237/'] | One of the best and easiest way to connect to create a Database Connection String is to crease a new ASP file in the root directory or elsewhere and include the Connection string into it:
//Global.asp //
```
<%
Dim connectionString
connectionString = "PROVIDER=SQLOLEDB;DATA SOURCE=YourSQLServer;UID=sa;PWD=*******;DAT... | I keep the Connection String in Global.asa but create the connection in a separate function loaded as needed. An Application connection object may not be aware of temporary network issues that may close that connection, and then future attempts to use the connection will not be successful.
Hope this makes sense. |
9,480,338 | I have taken 2 text boxes and 1 text area
User will be to search the content through search box
and provides by which word it should be replaced.
Scenerio 1 :
I want to replace "Good" with word "bad"
But this code does not replace the text area content.
It rather appends with the new replaced string
what's the so... | 2012/02/28 | ['https://Stackoverflow.com/questions/9480338', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1361058/'] | What about [the Intl Twig extension](https://github.com/fabpot/Twig-extensions/blob/master/lib/Twig/Extensions/Extension/Intl.php)?
Usage in a twig template:
```
{{ my_date | localizeddate('full', 'none', locale) }}
``` | I didn't want to install a whole extensions just for this stuff and need to do a few things automatically: It's also possible to write a helperclass (or expand an existing helper) in Bundle/Twig/Extensions for example like this:
```
public function foo(\Datetime $datetime, $lang = 'de_DE', $pattern = 'd. MMMM Y')
{
... |
9,480,338 | I have taken 2 text boxes and 1 text area
User will be to search the content through search box
and provides by which word it should be replaced.
Scenerio 1 :
I want to replace "Good" with word "bad"
But this code does not replace the text area content.
It rather appends with the new replaced string
what's the so... | 2012/02/28 | ['https://Stackoverflow.com/questions/9480338', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1361058/'] | What about [the Intl Twig extension](https://github.com/fabpot/Twig-extensions/blob/master/lib/Twig/Extensions/Extension/Intl.php)?
Usage in a twig template:
```
{{ my_date | localizeddate('full', 'none', locale) }}
``` | I really only wanted the day & month names to be translated according to the locale and wrote this twig extension. It accepts the normal `DateTime->format()` parameters and converts day & months names using `strftime()` if needed.
```
<?php
namespace AppBundle\Twig\Extension;
use Twig_Extension;
use Twig_SimpleFilte... |
9,480,338 | I have taken 2 text boxes and 1 text area
User will be to search the content through search box
and provides by which word it should be replaced.
Scenerio 1 :
I want to replace "Good" with word "bad"
But this code does not replace the text area content.
It rather appends with the new replaced string
what's the so... | 2012/02/28 | ['https://Stackoverflow.com/questions/9480338', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1361058/'] | I didn't want to install a whole extensions just for this stuff and need to do a few things automatically: It's also possible to write a helperclass (or expand an existing helper) in Bundle/Twig/Extensions for example like this:
```
public function foo(\Datetime $datetime, $lang = 'de_DE', $pattern = 'd. MMMM Y')
{
... | I really only wanted the day & month names to be translated according to the locale and wrote this twig extension. It accepts the normal `DateTime->format()` parameters and converts day & months names using `strftime()` if needed.
```
<?php
namespace AppBundle\Twig\Extension;
use Twig_Extension;
use Twig_SimpleFilte... |
59,814,742 | I'm trying to create an alias to help debug my docker containers.
I discovered bash [accepts a `--init-file`](https://serverfault.com/a/586272/28684) option which ought to let us run some commands before passing over to interactive mode.
So I thought I could do
```
docker-bash() {
docker run --rm -it "$1" bash --i... | 2020/01/19 | ['https://Stackoverflow.com/questions/59814742', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/65387/'] | In points:
* The `<(...)` is a bash extension [process subtitution](https://www.gnu.org/software/bash/manual/html_node/Process-Substitution.html).
* From the manual above: `Process substitution is supported on systems that support named pipes (FIFOs) or the /dev/fd method of naming open files.`.
* The process substitu... | For my use-case I wanted to set an `alias` which won't persist if we re-exec the shell. However, aliases can be written to `~/.bashrc` which will be reloaded on the subsequent exec. Ergo,
```
docker-bash() {
docker run --rm -it "$1" bash -c $'set -o xtrace; echo "alias ll=\'ls -lAhtrF --color=always\'" >> ~/.bashrc;... |
12,585,447 | The npm documentation says this:
>
> * If you’re installing something that you want to use in your program, using
> require('whatever'), then install it locally, at the root of your project.
> * If you’re installing something that you want to use in your shell, on the command line or
> something, install it global... | 2012/09/25 | ['https://Stackoverflow.com/questions/12585447', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/404568/'] | >
> Therefore, according to the above, my dependencies should be installed as global modules.
>
>
>
Not quite.
It meant that *your module* could be installed as a global so its [binaries](https://npmjs.org/doc/json.html#bin) would be available from the shell:
```sh
npm install -g your-module
your-module-binary -... | So the instructions you have pertain to npm modules, but you are doing local development. Here are some guidelines.
In terms of your source code, you only need 2 types of `require` statements
```
var dep = require('somedep')
```
Use this for any core modules (like `fs`) and third party modules your library needs th... |
12,585,447 | The npm documentation says this:
>
> * If you’re installing something that you want to use in your program, using
> require('whatever'), then install it locally, at the root of your project.
> * If you’re installing something that you want to use in your shell, on the command line or
> something, install it global... | 2012/09/25 | ['https://Stackoverflow.com/questions/12585447', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/404568/'] | So the instructions you have pertain to npm modules, but you are doing local development. Here are some guidelines.
In terms of your source code, you only need 2 types of `require` statements
```
var dep = require('somedep')
```
Use this for any core modules (like `fs`) and third party modules your library needs th... | Additionally, Node.js will search in the following list of GLOBAL\_FOLDERS:
1: $HOME/.node\_modules
2: $HOME/.node\_libraries
3: $PREFIX/lib/node |
12,585,447 | The npm documentation says this:
>
> * If you’re installing something that you want to use in your program, using
> require('whatever'), then install it locally, at the root of your project.
> * If you’re installing something that you want to use in your shell, on the command line or
> something, install it global... | 2012/09/25 | ['https://Stackoverflow.com/questions/12585447', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/404568/'] | >
> Therefore, according to the above, my dependencies should be installed as global modules.
>
>
>
Not quite.
It meant that *your module* could be installed as a global so its [binaries](https://npmjs.org/doc/json.html#bin) would be available from the shell:
```sh
npm install -g your-module
your-module-binary -... | Additionally, Node.js will search in the following list of GLOBAL\_FOLDERS:
1: $HOME/.node\_modules
2: $HOME/.node\_libraries
3: $PREFIX/lib/node |
54,962,657 | I'm using an header bar from the `clarity.design` examples, I tinkered with it trying to make the search input occupy 100% of the center of the header bar, but I'm unable to do it.
The code:
```html
<clr-header class="header-6">
<div class="branding">
<a [routerLink]="['/']" routerLinkActive="router-link-ac... | 2019/03/02 | ['https://Stackoverflow.com/questions/54962657', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4962126/'] | Your code is okay. You could dismiss temporary results and chain method calls
```
var numbers = new StringBuilder();
string[] coordinatesVal = coordinateTxt
.Trim()
.Split(new string[] { ",0" }, StringSplitOptions.None);
for (int i = 0; i < coordinatesVal.Length - 1; i++) {
numbers
.Append(coordina... | Your solution is fine. Maybe you could write it a bit more elegant like this:
```
string[] coordinatesVal = coordinateTxt.Trim().Split(new string[] { ",0" },
StringSplitOptions.RemoveEmptyEntries);
string result = string.Empty;
foreach (string line in coordinatesVal)
{
string[] numbers = line.Trim().Split(',');
... |
54,962,657 | I'm using an header bar from the `clarity.design` examples, I tinkered with it trying to make the search input occupy 100% of the center of the header bar, but I'm unable to do it.
The code:
```html
<clr-header class="header-6">
<div class="branding">
<a [routerLink]="['/']" routerLinkActive="router-link-ac... | 2019/03/02 | ['https://Stackoverflow.com/questions/54962657', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4962126/'] | Your code is okay. You could dismiss temporary results and chain method calls
```
var numbers = new StringBuilder();
string[] coordinatesVal = coordinateTxt
.Trim()
.Split(new string[] { ",0" }, StringSplitOptions.None);
for (int i = 0; i < coordinatesVal.Length - 1; i++) {
numbers
.Append(coordina... | Or you can do extremely short one-liner. Harder to debug, but in simple cases does the work.
```
string result =
string.Join(", ",
coordinateTxt.Trim().Split(new string[] { ",0" }, StringSplitOptions.RemoveEmptyEntries).
Select(i => i.Replace(",", " ")));
``` |
54,962,657 | I'm using an header bar from the `clarity.design` examples, I tinkered with it trying to make the search input occupy 100% of the center of the header bar, but I'm unable to do it.
The code:
```html
<clr-header class="header-6">
<div class="branding">
<a [routerLink]="['/']" routerLinkActive="router-link-ac... | 2019/03/02 | ['https://Stackoverflow.com/questions/54962657', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4962126/'] | Your code is okay. You could dismiss temporary results and chain method calls
```
var numbers = new StringBuilder();
string[] coordinatesVal = coordinateTxt
.Trim()
.Split(new string[] { ",0" }, StringSplitOptions.None);
for (int i = 0; i < coordinatesVal.Length - 1; i++) {
numbers
.Append(coordina... | heres another way without *defining your own loops* and replace methods, or using LINQ.
```
string coordinateTxt = @" -82.9494547,36.2913021,0
-83.0784938,36.2347521,0
-82.9537782,36.079235,0";
string[] coordinatesVal = coordinateTxt.Replace(",", "*").Trim().Split(new string[] { "*0", Environment.NewLi... |
54,962,657 | I'm using an header bar from the `clarity.design` examples, I tinkered with it trying to make the search input occupy 100% of the center of the header bar, but I'm unable to do it.
The code:
```html
<clr-header class="header-6">
<div class="branding">
<a [routerLink]="['/']" routerLinkActive="router-link-ac... | 2019/03/02 | ['https://Stackoverflow.com/questions/54962657', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4962126/'] | Your code is okay. You could dismiss temporary results and chain method calls
```
var numbers = new StringBuilder();
string[] coordinatesVal = coordinateTxt
.Trim()
.Split(new string[] { ",0" }, StringSplitOptions.None);
for (int i = 0; i < coordinatesVal.Length - 1; i++) {
numbers
.Append(coordina... | You ask about efficiency, but you don't specify whether you mean code efficiency (execution speed) or programmer efficiency (how much time you have to spend on it).
One key part of professional programming is to judge which one of these is more important in any given situation.
The other answers do a good job of cover... |
54,962,657 | I'm using an header bar from the `clarity.design` examples, I tinkered with it trying to make the search input occupy 100% of the center of the header bar, but I'm unable to do it.
The code:
```html
<clr-header class="header-6">
<div class="branding">
<a [routerLink]="['/']" routerLinkActive="router-link-ac... | 2019/03/02 | ['https://Stackoverflow.com/questions/54962657', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4962126/'] | You ask about efficiency, but you don't specify whether you mean code efficiency (execution speed) or programmer efficiency (how much time you have to spend on it).
One key part of professional programming is to judge which one of these is more important in any given situation.
The other answers do a good job of cover... | Your solution is fine. Maybe you could write it a bit more elegant like this:
```
string[] coordinatesVal = coordinateTxt.Trim().Split(new string[] { ",0" },
StringSplitOptions.RemoveEmptyEntries);
string result = string.Empty;
foreach (string line in coordinatesVal)
{
string[] numbers = line.Trim().Split(',');
... |
54,962,657 | I'm using an header bar from the `clarity.design` examples, I tinkered with it trying to make the search input occupy 100% of the center of the header bar, but I'm unable to do it.
The code:
```html
<clr-header class="header-6">
<div class="branding">
<a [routerLink]="['/']" routerLinkActive="router-link-ac... | 2019/03/02 | ['https://Stackoverflow.com/questions/54962657', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4962126/'] | You ask about efficiency, but you don't specify whether you mean code efficiency (execution speed) or programmer efficiency (how much time you have to spend on it).
One key part of professional programming is to judge which one of these is more important in any given situation.
The other answers do a good job of cover... | Or you can do extremely short one-liner. Harder to debug, but in simple cases does the work.
```
string result =
string.Join(", ",
coordinateTxt.Trim().Split(new string[] { ",0" }, StringSplitOptions.RemoveEmptyEntries).
Select(i => i.Replace(",", " ")));
``` |
54,962,657 | I'm using an header bar from the `clarity.design` examples, I tinkered with it trying to make the search input occupy 100% of the center of the header bar, but I'm unable to do it.
The code:
```html
<clr-header class="header-6">
<div class="branding">
<a [routerLink]="['/']" routerLinkActive="router-link-ac... | 2019/03/02 | ['https://Stackoverflow.com/questions/54962657', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4962126/'] | You ask about efficiency, but you don't specify whether you mean code efficiency (execution speed) or programmer efficiency (how much time you have to spend on it).
One key part of professional programming is to judge which one of these is more important in any given situation.
The other answers do a good job of cover... | heres another way without *defining your own loops* and replace methods, or using LINQ.
```
string coordinateTxt = @" -82.9494547,36.2913021,0
-83.0784938,36.2347521,0
-82.9537782,36.079235,0";
string[] coordinatesVal = coordinateTxt.Replace(",", "*").Trim().Split(new string[] { "*0", Environment.NewLi... |
46,467,481 | I have tensorflow program that work with TFRecord and i want to read the data with tf.contrib.data.TFRecordDataset but when i try to parse the example i get an exception: "TypeError: Failed to convert object of type to Tensor"
When trying with only
The code is:
```
def _parse_function(example_proto):
features = ... | 2017/09/28 | ['https://Stackoverflow.com/questions/46467481', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1211587/'] | TensorFlow added support for this in v1.5
<https://github.com/tensorflow/tensorflow/releases/tag/v1.5.0>
"tf.data now supports tf.SparseTensor components in dataset elements." | The Tutorial in the Tensor Flow programming [guide](https://www.tensorflow.org/programmers_guide/datasets#parsing_tfexample_protocol_buffer_messages) have a different indenting.
```
# Transforms a scalar string `example_proto` into a pair of a scalar string and
# a scalar integer, representing an image and its label, ... |
46,467,481 | I have tensorflow program that work with TFRecord and i want to read the data with tf.contrib.data.TFRecordDataset but when i try to parse the example i get an exception: "TypeError: Failed to convert object of type to Tensor"
When trying with only
The code is:
```
def _parse_function(example_proto):
features = ... | 2017/09/28 | ['https://Stackoverflow.com/questions/46467481', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1211587/'] | TensorFlow added support for this in v1.5
<https://github.com/tensorflow/tensorflow/releases/tag/v1.5.0>
"tf.data now supports tf.SparseTensor components in dataset elements." | tf.VarLenFeature creates SparseTensor. And most of the times the SparseTensors are associated with the mini batch. Can you try it like below?
dataset = tf.contrib.data.TFRecordDataset(filenames)
dataset = dataset.batch(batch\_size=32)
dataset = dataset.map(\_parse\_function) |
551,536 | How to prove that the new number produced by the Cantor's diagonalization process applied to $\Bbb Q$ is not a rational number ?
Suppose, someone claims that there is a flaw in the Cantor's diagonalization process by applying it to the set of rational numbers. I want to prove that the claim is false by showing that th... | 2013/11/04 | ['https://math.stackexchange.com/questions/551536', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/103623/'] | This has very little to do with rational numbers themselves. You apply the diagonal argument to construct a number that is not on the list. Now the *only* reason that you must have produced an irrational number is that all the rational numbers are on the list, so it cannot be any of them. There is nothing intrinsic the... | I might have an approach that shows a counter example - where the flipped diagonal number produced is also rational. See: [Should a Cantor diagonal argument on a list of all rationals always produce an irrational number?](https://math.stackexchange.com/questions/677649/should-a-cantor-diagonal-argument-on-a-list-of-all... |
551,536 | How to prove that the new number produced by the Cantor's diagonalization process applied to $\Bbb Q$ is not a rational number ?
Suppose, someone claims that there is a flaw in the Cantor's diagonalization process by applying it to the set of rational numbers. I want to prove that the claim is false by showing that th... | 2013/11/04 | ['https://math.stackexchange.com/questions/551536', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/103623/'] | This has very little to do with rational numbers themselves. You apply the diagonal argument to construct a number that is not on the list. Now the *only* reason that you must have produced an irrational number is that all the rational numbers are on the list, so it cannot be any of them. There is nothing intrinsic the... | Despite replying to an old post, I would like to supplement things that that I missed out after reading all replies.
Fact:
1. $\pi$ is irrational
Cantor's technique for finding a contradiction has 1 property
1. The generated new number must be different
Cantor's contradiction makes sense because the new number is
... |
551,536 | How to prove that the new number produced by the Cantor's diagonalization process applied to $\Bbb Q$ is not a rational number ?
Suppose, someone claims that there is a flaw in the Cantor's diagonalization process by applying it to the set of rational numbers. I want to prove that the claim is false by showing that th... | 2013/11/04 | ['https://math.stackexchange.com/questions/551536', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/103623/'] | I might have an approach that shows a counter example - where the flipped diagonal number produced is also rational. See: [Should a Cantor diagonal argument on a list of all rationals always produce an irrational number?](https://math.stackexchange.com/questions/677649/should-a-cantor-diagonal-argument-on-a-list-of-all... | Despite replying to an old post, I would like to supplement things that that I missed out after reading all replies.
Fact:
1. $\pi$ is irrational
Cantor's technique for finding a contradiction has 1 property
1. The generated new number must be different
Cantor's contradiction makes sense because the new number is
... |
47,005,284 | I've used the column command to split some of my output into 3 different columns. Problem is with the final column, the filetype output is being split into a 4th and 5th column because of the spaces.
Can somebody tell me how to change my code so that output stays under the Filetype column?
```
list_files()
{
if... | 2017/10/29 | ['https://Stackoverflow.com/questions/47005284', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/8791139/'] | The proper way to do this would be to pass the clipping function `tf.clip_by_value` as the `constraint` argument to the `tf.Variable` constructor:
```
Mj=tf.get_variable('Mj_',
dtype=tf.float32,
shape=[500,4],
initializer=tf.random_uniform_initializer(maxval=1, ... | I think the function you're looking for is `tf.clip_by_value`.
Link to [Docs](https://www.tensorflow.org/api_docs/python/tf/clip_by_value). |
19,486,762 | I know this question has been asked before, but I was just wondering why it isn't working in my particular case.
I am trying to send an invitation from multipeer connectivity from one view controller and receive it on another. My code for sending it is:
```
[self invitePeer:selectedPeerID toSession:self.mySession wit... | 2013/10/21 | ['https://Stackoverflow.com/questions/19486762', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2218728/'] | This should be expected, as per the [JavaDoc:](http://docs.oracle.com/javase/7/docs/api/java/lang/Thread.html#sleep%28long%29)
>
> Causes the currently executing thread to sleep (temporarily cease
> execution) for the specified number of milliseconds, subject to the
> precision and accuracy of system timers and sch... | Idea is to go to sleep, wake up(possibly prematurely) and check time again to go to sleep.
Under heavy system load, your timer thread does not get scheduled and thread may not wake up from sleep resulting your clock going off time.
But its always about showing correct time, whenever possible.
General suggestion: max... |
36,536,657 | I have a simple script on my site that adds a css class to the navigation bar after the user has started to scroll, and removes it when they are back at the top of the page.
However, this is causing a significant amount of jank (fps lag), and it 100% is not worth the performance hit.
Is there a way to optimise this o... | 2016/04/10 | ['https://Stackoverflow.com/questions/36536657', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2484643/'] | You code is accessing the DOM potentially 100 times per second, which is the reason for your performance issue, to improve performance you can throttle the scroll event so that it executes your code less by using a Timeout that first unbinds the Scroll event then binds it after a delay(threshold), increasing the thresh... | You could cache the results of processing to process less often by storing results in global variables or at least variables that persist outside the scroll callback.
There is so little in the callback to begin with that we don't have much room for improvement.
```
var navbar = $('#navbar');
var navborder = false;
$... |
46,545,841 | I have a list of file names produced by a third party. They all look like this: `'D:\\a\\b\\c/d/e/f/g.cpp'`.
I would like to normalize these to have a uniform path separator. However the command:
```
os.path.normpath('D:\\a\\b\\c/d/e/f/g.cpp')
```
does nothing to the string under Linux (Python3).
Under Windows I get... | 2017/10/03 | ['https://Stackoverflow.com/questions/46545841', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2077783/'] | On Windows, `os.path` redirects to `ntpath` module which is aware of `\`, drives, ...
On Linux, you have to import & use `ntpath` explicitly because you're not using the native separators.
The code below works on both platforms:
```
>>> import ntpath
>>> ntpath.normpath(r'D:\a\b\c/d/e/f/g.cpp')
'D:\\a\\b\\c\\d\\e\\f... | I find this to be the best option just write your own function
```
import os
def norm_path(path_in, sep=None):
if sep==None:
sep = os.sep
tmp_list = '\\'.join([k for k in path_in.split('/') if len(k)>0])
final_list = [k for k in tmp_list.split('\\') if len(k)>0]
return sep.join(final_list)
```... |
22,706,628 | I am not able to figure out the error :NoClassDefFoundError . I am trying to create a simple Google map. Is there any problem with the Google play services library?
error:-
```
03-28 03:17:45.489: E/AndroidRuntime(2338): FATAL EXCEPTION: main
03-28 03:17:45.489: E/AndroidRuntime(2338): Process: com.example.gpsd... | 2014/03/28 | ['https://Stackoverflow.com/questions/22706628', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3467204/'] | This is [documented](http://docs.python.org/2/library/itertools.html#itertools.groupby):
>
> The returned group is itself an iterator that shares the underlying iterable with `groupby()`. Because the source is shared, when the `groupby()` object is advanced, the previous group is no longer visible.
>
>
>
When you... | The example in the documentation is not as nice as:
```
list((key, list(group)) for key, group in itertools.groupby(...))
```
in turning the iterator into a list of tuples of keys and lists of groups: `[(key,[group])]` if that is what is desired. |
53,473,475 | What does `_` mean in this example code:
```
if (_(abc.content).has("abc")){
console.log("abc found");
}
```
Many people say "\_" means a private member, but if `abc` or `content` is a private member, shouldn't we use `_abc.content` or `abc._content`?
Thank you | 2018/11/26 | ['https://Stackoverflow.com/questions/53473475', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/7025179/'] | For that to be valid, `_` must refer to a *function*. Perhaps the script is using [`underscore`](https://underscorejs.org/#has), in which case `_(abc.content).has("abc")` returns a Boolean - `true` if the `abc.content` object has a *key* of `abc`, and `false` otherwise:
```js
const abc = { content: { key1: 'foo', abc:... | That's just a variable name. You are right, conventions suggest that underscore refer to private members in an object such as:
```
const num = 2;
function Multiply(num) {
this._multiplier = 2;
this._input = num;
this.start = function(){
return this._multiplier * this._input;
}
}
const produc... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.