qid int64 10 74.7M | question stringlengths 15 26.2k | date stringlengths 10 10 | metadata list | response_j stringlengths 27 28.1k | response_k stringlengths 23 26.8k |
|---|---|---|---|---|---|
45,484 | The other day, I ate at a restaurant; the food was fine, and I got to paying the bill. Their payment system went down. They couldn't accept cards; only cash, and I didn't have the cash on me for the bill. In the end, their payments system was down for about 45 minutes, with several diners being forced to wait around. T... | 2019/10/14 | [
"https://law.stackexchange.com/questions/45484",
"https://law.stackexchange.com",
"https://law.stackexchange.com/users/14515/"
] | They can’t hold you there for any period of time, as that would be false imprisonment. You have a legal obligation to pay the bill; however, there is no contract about when your payment is due.
You can leave at any time without paying, so long as you have the intention to pay. You can leave your contact details so the... | Leaving contact details and demanding that an invoice will be sent should count as a reasonable intent to settle the billed amount.
In gastronomy, in case one is a regular guest, it is not that uncommon to have debts accumulated by consume paid later (even if this is far more common for beverages).
In such an excepti... |
64,288 | I would like to create a small dtmf dialler that connects to a telephone line and dials a single preprogrammed telephone number when a set of contacts closes, how easy is this and how small could this device be? | 2013/04/03 | [
"https://electronics.stackexchange.com/questions/64288",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/21850/"
] | It's fairly easy. You can buy DTMF chips that you can attach a keyboard to and input a number and use "last number redial". I've actually designed one for a track-side telephone that just had one button and called a guy in his signal-box to open the barrier on a track-crossing point.
A couple of issues - you have to d... | Simplest way is to interface to an old phone to emulate the off-hook & key presses. Glue in appropriate electronic switches with a 4017 counter and clock and you have an auto dialer. |
16,453,843 | I'm really curious. Is it possible to have a jQuery Ajax post operation send the entire form data, serialized or not, to a MVC 4 method that has specific parameters with the same names as the form's input IDs while excluding elements that do not match?
MVC 4 Controller Method
```
[HttpPost]
public JsonResult DoWork(s... | 2013/05/09 | [
"https://Stackoverflow.com/questions/16453843",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1148554/"
] | >
> Is it possible to have a jQuery Ajax post operation send the entire
> form data, serialized or not, to a MVC 4 method that has specific
> parameters with the same names as the form's input IDs while excluding
> elements that do not match?
>
>
>
Yes it is possible. But you remember that you can still access ... | Ugh I hope you didn't resort to using the accepted answer here as the way to do it. This question is actually a duplicate, and the and the answer here is the preferred way of doing what you want:
[Passing parameters when submitting a form via jQuery in ASP.NET MVC](https://stackoverflow.com/questions/4005639/passing-pa... |
12,610,098 | I am searching for days how to run in the background a stream Shoutcast whose content / type: **audio / AACP**.
At the moment, I'm getting the run stream using the library [aacdecoder-android](http://code.google.com/p/aacdecoder-android/), but do not understand how to use a service to leave the stream in the backgroun... | 2012/09/26 | [
"https://Stackoverflow.com/questions/12610098",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1438343/"
] | **before follow please read my edited comments below**
1. Quit XCode
2. Quit Simulator
3. go to all the path in the image and delete all these folders

4. Open simulator and in iOS Simulator menu `Reset content and settings`. Reset it
Start XCode and... | I had to go to Product > Schema > Edit Schema
Then in the Run dialog, the Executable dropdown was on None. I changed it to the .app file and it worked! |
1,298,035 | In Perl, if a variable holds the name for another variable, how do I use the first variable to visit the other one?
For example, let
```
$name = "bob";
@bob = ("jerk", "perlfan");
```
how should I use $name to get to know what kind of person bob is?
Although I'm not quite sure, my vague memory tells me it might rel... | 2009/08/19 | [
"https://Stackoverflow.com/questions/1298035",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/157300/"
] | See [`perldoc -q "variable name"`](http://faq.perl.org/perlfaq7.html#How_can_I_use_a_vari):
>
> Beginners often think they want to have a variable contain the name of a variable. ...
>
>
>
Short answer: Don't. Long answer: Read the FAQ entry (which is also available on your computer). Longer answer: Read MJD's [W... | Symbolic references are worth avoiding, but if you really want to use them, they have the same use syntax as regular references: see <http://perlmonks.org/?node=References+quick+reference>. |
8,409 | I'm working with a system where we want to allow users to play around with the date and time if they want, and where reboots may happen arbitrarily. This is fine, except for one thing: if there's a large time jump backwards, the following error appears on reboot:
```
Checking filesystems
IMAGE2: Superblock last mount ... | 2011/03/01 | [
"https://unix.stackexchange.com/questions/8409",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/2134/"
] | I was going to suggest hacking `e2fsck` to disable the specific checks for a last mount time or last write times in the future. These are defined in [problem.c](http://git.kernel.org/?p=fs/ext2/e2fsprogs.git;a=blob_plain;f=e2fsck/problem.c;hb=HEAD) / [problem.h](http://git.kernel.org/?p=fs/ext2/e2fsprogs.git;a=blob_pla... | I doubt there's a way to remove this check specifically, short of modifying the source code. Ignoring all errors from fsck sounds dangerous, what if there was some other problem?
Therefore I'll suggest the following workaround: change the boot scripts to set the system date to some time in the future (say 2038-01-18 o... |
923,384 | I've read a bunch of documentation on installers and haven't come across anything good that explains the underlying concepts. Most of the installer software I've come across is based on the same "database" like structure that I just don't understand at all.
All of the documentation that comes with the various product... | 2009/05/28 | [
"https://Stackoverflow.com/questions/923384",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53119/"
] | I recommend the following feeds:
<http://blog.deploymentengineering.com/feeds/posts/default>
<http://forum.installsite.net/newsfeed.php>
<http://msmvps.com/blogs/installsite/rss.aspx>
<http://robmensching.com/blog/Rss.aspx>
<http://support.acresso.com/rss/acresso_is.xml> | If your install needs are not terribly complex, I would suggest trying out InnoSetup. I used it on a suite of windows applications installers a few years ago and had no complaints. Much simpler than InstallShield and MSI, but your mileage may vary.
I am not in any way affiliated with InnoSetup. |
3,016,701 | So. I'm using V2010 release on Windows 7.
And it doesn't attach automatically. How can I enable to auto attach?
Thanks in advance. | 2010/06/10 | [
"https://Stackoverflow.com/questions/3016701",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/140634/"
] | Make sure you do that with VS2010 unloaded, otherwise the setting gets overwritten upon exit to zero again. | In the web application project properties on the web tab check the "asp.net" in debugger section. It hepls me. |
19,603,998 | I want to add multiple items/rows in SQLite using single insert query,
```
insert into suppliers (supoliers_no,supply_name,city,phone_no)
values (1,'Ali','amman',111111), (2,'tariq','amman',777777), (3,'mohmmed','taiz',null);
```
Is it possible using Sqlite? | 2013/10/26 | [
"https://Stackoverflow.com/questions/19603998",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2922391/"
] | This is possible but the way to do this is different in SQLITE,
Try this...
```
insert into myTable (mycol1,mycol2)
select aValue as mycol1,anotherValue as mycol2
union select moreValue,evenMoreValue
union...
```
in your case it will be as,
```
INSERT INTO suppliers
SELECT 1 AS supoliers_no, 'Ali' ... | Inserting multiple records with a single INSERT statement is supported only in SQLite [3.7.11](http://www.sqlite.org/releaselog/3_7_11.html) and later.
On earlier versions, you have to use `INSERT ... SELECT ...` with `UNION ALL`, or use multiple statements. |
439,177 | How do I calculate sum of a finite harmonic series of the following form?
$$\sum\_{k=a}^{b} \frac{1}{k} = \frac{1}{a} + \frac{1}{a+1} + \frac{1}{a+2} + \cdots + \frac{1}{b}$$
Is there a general formula for this? How can we approach this if not? | 2013/07/08 | [
"https://math.stackexchange.com/questions/439177",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/76116/"
] | **This answer is more for additional information and as an exercise for myself to remember Gosper's algorithm.**
There is no nice closed formula for this. By nice we can take *hypergeometric functions* (functions $f(n)$ such that $f(n+1)/f(n)$ is a rational function) or even finite sums of hypergeometric functions. If... | The formula for sum of H.P. remained unknown for many years, but now I have found the formula as an infinite polynomial.
The formula or the infinite polynomial which is
equal to the sum of th H.P. $\frac{1}{a} + \frac{1}{a+d} + \frac{1}{a+2d} + \frac{1}{a+3d} + ........$ is :-
$Sum of H.P. = (1/a) [1 + \frac{1}{1×(1+... |
2,702,041 | In particular, I'm interested in the property that the surface area of a sphere in D dimensions gets concentrated near the equator. I know it can be shown with some integrals, for example done in Section 1.2.5 [here](https://www.cs.cmu.edu/~venkatg/teaching/CStheory-infoage/chap1-high-dim-space.pdf).
What I want to kn... | 2018/03/21 | [
"https://math.stackexchange.com/questions/2702041",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/162285/"
] | If $(x\_1,\dots,x\_D)$ is far from the equator, then $|x\_D|$ is large. Let $P(C)$ denote the fraction of the sphere where $|x\_D|>C$. Then by symmetry, $P(C)$ also gives the fraction of the sphere where $|x\_k|>C$ for any $k<D$. But any given point can have at most $\left\lfloor \frac{1}{C^2}\right \rfloor$ coordinate... | I dont know much about higher dimensional spheres so I'll leave some links here for reference which are pretty good.
[A Breakthrough in Higher Dimensional Spheres | Infinite Series | PBS Digital Studios](https://www.youtube.com/watch?v=ciM6wigZK0w)
[Thinking visually about higher dimensions- 3Blue1Brown](https://www.... |
28,916,917 | I need to send a SQL query to a database that tells me how many rows there are in a table. I could get all the rows in the table with a SELECT and then count them, but I don't like to do it this way. Is there some other way to ask the number of the rows in a table to the SQL server? | 2015/03/07 | [
"https://Stackoverflow.com/questions/28916917",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4229007/"
] | ```
select sum([rows])
from sys.partitions
where object_id=object_id('tablename')
and index_id in (0,1)
```
is very fast but very rarely inaccurate. | Use This Query :
```
Select
S.name + '.' + T.name As TableName ,
SUM( P.rows ) As RowCont
From sys.tables As T
Inner Join sys.partitions As P On ( P.OBJECT_ID = T.OBJECT_ID )
Inner Join sys.schemas As S On ( T.schema_id = S.schema_id )
Where
( T.is_ms_shipped = 0 )
AND
( P.index_id IN (1... |
45,979,007 | In the answer to this question I don't understand why the `input.nextInt` has a newline character as a leftover.
[Scanner is skipping nextLine() after using next(), nextInt() or other nextFoo()?](https://stackoverflow.com/questions/13102045/scanner-is-skipping-nextline-after-using-next-nextint-or-other-nextfoo) | 2017/08/31 | [
"https://Stackoverflow.com/questions/45979007",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8542239/"
] | The answer is quite simple:
`Scanner#nextInt()` reads the next integer but not the newline (`ENTER`) the user presses to submit the integer.
To understand this you must know that everything you type will be written to a buffer, from which the `Scanner` methods try to read from.
---
Regard the following example:
``... | This is purly a design decision, the reason `nextInt()` doesn't consume the newline character, is because there may be some other tokens that haven't been parsed yet, it would be most inappropriate to assume there's nothing left in the string, and consume the newline char.
For instance, you are given the following inp... |
58,674,154 | Can you tell me, please?
Why does the mysql2 value substitution not work inside the IN operator?
I do this, but nothing works.
Only the first character of the array is being substituted (number 6)
```
"select * from products_categories WHERE category_id IN (?)", [6,3]);
```
You can do it like this, of course:
IN(?,... | 2019/11/02 | [
"https://Stackoverflow.com/questions/58674154",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10971604/"
] | The `equals` method you're using is comparing references, which is basically the same thing as doing `==` between them (or between any other reference types). Both references are considered equal if they point to the same object in memory. Since you're creating two individual arrays of integers, they are two different ... | When you are using `.equals()` on two arrays, it will do the same thing as `==`, which is to check if the references are the same. Because they are not, it will return `false`. You want to use [`java.util.Arrays.equals(A, ex.getA())`](https://docs.oracle.com/en/java/javase/13/docs/api/java.base/java/util/Arrays.html#eq... |
17,537,871 | I run into a very strange problem when using macvim.
Env:
OS: OS X Mountain Lion,
Macvim: <https://github.com/b4winckler/macvim/archive/snapshot-66.tar.gz>
Steps to reproduce:
1. connecting my labtop to a extra display.
2. open macvim
3. disconnecting labtop from extra display
4. restart macvim
I got the followin... | 2013/07/08 | [
"https://Stackoverflow.com/questions/17537871",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1877703/"
] | The accepted answer didn't work for me by itself, but rebooting after deleting the plist files worked. | There's no need to reboot or delete entire plist files. This command clears the troublesome property:
```
$ defaults delete org.vim.MacVim MMTopLeftPoint
``` |
8,261,971 | I want to read XML Messages from a Message Queue in a C# WPF Application. Messages are saved into the Queue by a Navision codeunit. Firstly, I am not really sure if the messages that are saved in the Queue are usable, because they are in some sort of hexadecimal format which looks like this:
```
FF FE 3C 00 3F 00 78 0... | 2011/11/24 | [
"https://Stackoverflow.com/questions/8261971",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/825928/"
] | In competent\_tech's answer, no overload for
```
Encoding.Unicode.GetString(m.Body);
```
takes a string argument.
If this is the approach that you want to use, you need to convert the string to a byte array -
```
byte[] arr;
using(MemoryStream ms = new MemoryStream())
{
... | It looks like the data is little-endian UTF-16 since the data starts with FF FE.
You need to decode the string using something like:
```
string text = Encoding.Unicode.GetString(m.Body);
``` |
31,662,225 | I can't figure out how to click on the sign-in element (from UI Automator):
[](https://i.stack.imgur.com/FdHdr.png)
Keep in mind there are multiple TextView-s with 0-index in the UI. Can I use its text ("Sign in") or its unique ListView/TextView path ... | 2015/07/27 | [
"https://Stackoverflow.com/questions/31662225",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1817550/"
] | There are two ways to do it:
First, try this:
```
driver.findElementByName("SignIn").click();
```
Second, try this:
```
public void tap(int index){
List<WebElement> li = driver.findElementByClass("PUT YOUR class name");
li.get(0).click();
}
``` | Try this:
```
driver.findElement(By.xpath("//*[@class='android.widget.TextView' and @index='0']")).click();
```
**OR**
```
driver.findElement(By.name("Sign In")).click();
```
Ideally Both should work. |
78,211 | My understanding is that in a private blockchain, the participating nodes verify and agree that the block is valid and only then add it to the blockchain.In this scenario, are consensus protocols (such as RAFT, PAXOS, etc.) needed? Am I missing anything here? | 2018/08/14 | [
"https://bitcoin.stackexchange.com/questions/78211",
"https://bitcoin.stackexchange.com",
"https://bitcoin.stackexchange.com/users/86357/"
] | **TL;DR** Yes, consensus protocols are always needed in distributed systems where there could be multiple writers to the same data. When it is possible for multiple participants to simultaneously update their local state, it can result in two inconsistent versions which can't be merged together into a globally consiste... | Yes consensus is needed and for the consensus RAFT ,PAXOS is used for general node failure.If their is malicious node Byzantine Fault Tolerance can be used.But POW isn't used in case of private blockchain as the participating users are known. |
9,649,047 | I'm trying to create a backbone router that can match optional parameters.
Consider the following code:
```
routes: {
'/jobs' : 'jobs',
'/jobs/p:page' : 'jobs',
'/jobs/job/:job_id' : 'jobs',
'/jobs/p:page/job/:job_id' ... | 2012/03/10 | [
"https://Stackoverflow.com/questions/9649047",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Instead of messing with regexes it would be easier and less error prone just to have a second function. You will probably have to bindAll this in an initialize function for this.jobs to work.
```
routes: {
'/jobs' : 'jobs',
'/jobs/p:page' : 'jobs',... | If you're going to be doing a lot of these, you might glance at [this pattern](http://blog.rjzaworski.com/2011/12/regex-routing-with-backbone-js/) for wrapping them up tidily. For just these, though, the following regexs ought to do it:
```
/\/jobs\/p(\d+)/ => /jobs/pXXX
/\/jobs\/p(\d+)\/job\/(\d+)/ => /... |
8,469,668 | I tried implementing this for a radio button
```
<form>
<input name="rad" type="radio" value="Yes" onclick="this.form['sub'].disabled=false"> Agreement
<br>
<br>
<input type="submit" name="sub" value="Submit" disabled>
</form>
```
The problem is I need a hyperlink next to Agreement so that people can click and see ... | 2011/12/12 | [
"https://Stackoverflow.com/questions/8469668",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/343040/"
] | A compatible implementation with `save_virtual_workbook` deprecated since version 2.6:
```py
from io import BytesIO
from tempfile import NamedTemporaryFile
def save_virtual_workbook(workbook):
with NamedTemporaryFile() as tf:
workbook.save(tf.name)
in_memory = BytesIO(tf.read())
return in_... | ```
from openpyxl import Workbook
from io import BytesIO
rows = [[1,2], [3,4]]
book = Workbook()
sheet = book.active
for row in rows:
sheet.append(row)
io = BytesIO
book.save(io)
content = io.getValue()
return Response(
content,
mimetype=magic.from_buffer(content, mime=True),
headers={
'Conten... |
9,632,229 | >
> **Possible Duplicate:**
>
> [declaring a const instance of a class](https://stackoverflow.com/questions/4674332/declaring-a-const-instance-of-a-class)
>
> [Why does C++ require a user-provided default constructor to default-construct a const object?](https://stackoverflow.com/questions/7411515/why-does-c-req... | 2012/03/09 | [
"https://Stackoverflow.com/questions/9632229",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1253826/"
] | You've got sort of a recursive doubleloop there.
Try this:
```
$(function(){
var a = setInterval("getSuggestions()",5000);
});
function getSuggestions(){
var url = $("#baseUrl").val() + '/placement/suggestions/x-fetch-suggestions';
var data ={}
var result = myAjaxJson(data,url); //gets json object via... | Don't use setInterval, use setTimeout. setInterval calls the function every 5 seconds regardless of whether the previous Ajax request completed. setTimeout will wait 5 seconds after the previous Ajax request to start thenext one.:
```
$(function(){
getSuggestions();
});
function getSuggestions(){
var url = $("#ba... |
70,012,069 | ok so I have been going at it for a while im making a palindrome program on html for the first time but when I input 111 it says its not a palindrome even tho i went through the while loop with a calc and it should be the same. I checked the outputs by revealing em and
"input" = 111.
"temp" = 0 as it should.
"reversed"... | 2021/11/17 | [
"https://Stackoverflow.com/questions/70012069",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10401954/"
] | You're doing floating point division, so `temp` will never be more than 0 until you do many iterations and get floating point underflow. After each iteration it becomes `11.1`, then `1.11`, then `0.111`, `.0111`, and so on. This is multiplying `reversed` by 10 each time, and it eventually overflows to infinity.
Round ... | As Barmar explained in his answer about percent division try to git rid of it!
```js
function Palindrome() {
let input = document.querySelector("#userInput").value;
//convert input to number
var temp = +input;//or parseInt(input)
let reversed = 0;
while (temp > 0) {
const lastDigit = temp % 10;
rever... |
41,929,709 | I'm wondering if there is a **shortcut** for VS Code that **highlights** in solution explorer tree current opened file. Like we have in Visual Studio:
```
Alt + Shift + L
``` | 2017/01/30 | [
"https://Stackoverflow.com/questions/41929709",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1393225/"
] | Couldn't live with no complete answer, so figured out the following:
**Without a direct keyboard shortcut:**
1. Open the command palette via `Cmd`-`Shift`-`P` (or `Cmd`+`P` then `>`) and type `Files: Reveal Active File in Side Bar`.
2. This reveals the active file in the side bar similar to Visual Studio's `Alt`+`Shi... | Try this:
Together with @Rob's correct answer:
```
"explorer.autoReveal": true
```
then `Ctrl`-`Shift`-`E` (Show explorer) focuses that file in the explorer and the `arrow` keys will navigate up/down/left/right like any list. This works even if the explorer is closed prior to the `Ctrl`-`Shift`-`E`.
`Ctrl`-`Shift`... |
14,055 | I was working in a reputable IT company for 2 years, however I took a break of 2 years to pursue a career in Indian Civil Services. I got selected at state level but couldn't make it to Highest post and now I am planning to return to IT.
Please guide on how I can describe my this career gap in the interviews. | 2013/08/29 | [
"https://workplace.stackexchange.com/questions/14055",
"https://workplace.stackexchange.com",
"https://workplace.stackexchange.com/users/10356/"
] | **Emphasise your strengths**
As always with interviews you should be trying to present yourself in the best light possible.
So when it comes to them asking about your 2 year gap don't just say 'Oh I was meeting personal goals' you want to show what you did and amaze them with the transferable skills you learnt.
**Tr... | >
> Please guide on how I can describe my this career gap in the interviews.
>
>
>
I'd go with something like this:
>
> I was working in a reputable IT company for 2 years, however I took a break of 2 years to pursue a career in Indian Civil Services. I got selected at state level but couldn't make it to Highest... |
8,044,549 | unsure how to go about describing this but here i go:
For some reason, when trying to create a release build version of my game to test, the enemy creation aspect of it isn't working.
```
Enemies *e_level1[3];
e_level1[0] = &Enemies(sdlLib, 500, 2, 3, 128, -250, 32, 32, 0, 1);
e_level1[1] = &Enemies(sdlLib, 500, 2, ... | 2011/11/08 | [
"https://Stackoverflow.com/questions/8044549",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1015476/"
] | ```
e_level1[0] = &Enemies(sdlLib, 500, 2, 3, 128, -250, 32, 32, 0, 1);
```
doesn't do what you think it does. If it is the constructor call, it creates a temporary and its address is stored in e\_level1[0]. When e\_level1[1] is initialized e\_level1[0] destructor is probably already called.
You probably want to do
... | The code initializes the pointers to point to temporary objects that are immediately destroyed. Accessing temporaries that no longer exist through pointers or references is undefined behavior. You want:
```
Enemies *e_level1[3];
e_level1[0] = new Enemies(sdlLib, 500, 2, 3, 128, -250, 32, 32, 0, 1);
e_level1[1] = new E... |
4,649,639 | How to convert date format to DD-MM-YYYY in C#? I am only looking for DD-MM-YYYY format not anything else. | 2011/01/10 | [
"https://Stackoverflow.com/questions/4649639",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/570183/"
] | ```
DateTime dt = DateTime.Now;
String.Format("{0:dd-MM-yyyy}", dt);
``` | From C# 6.0 onwards (Visual Studio 2015 and newer), you can simply use an interpolated string with formatting:
```cs
var date = new DateTime(2017, 8, 3);
var formattedDate = $"{date:dd-MM-yyyy}";
``` |
21,421,821 | I'm building an Android application using ListView. I have list view items as show below.

^ List Item Index 0

^ List Item Index 1
The xlm is as follows.
```
<?xml version="1.0" encoding="utf-8"?>
<... | 2014/01/29 | [
"https://Stackoverflow.com/questions/21421821",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2464556/"
] | Allright I was having a similar kind of problem but i was using a **`ViewPager`** with a **`ListFragment`** and a custom `ListView` Layout.
In the above case you are using just **`ImageViews`**, but just in case if you use controls like `ImageButton`, `CheckBox` ,`Button` etc then you would face problems discussed [... | You must be setting the content of your list view in an Adapter, So inside the adapter, there is a method `getView()`. Inside that `getView()` define each of your view and then set onCLickListener inside those view.
For Ex:
```
dog.setOnClickListener(new OnClickListener() {
@Override
public void onClic... |
24,302,398 | how to access immediate unknown key in object. in pic "367:sl" is dynamic key and i want to access cptyName value which is in "367:sl". Thanks in advance
 | 2014/06/19 | [
"https://Stackoverflow.com/questions/24302398",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2396721/"
] | If your dynamic key is the only key in `quotes` object, you can get the first key and then access value with:
```
var firstKey = Object.keys(quotes)[0];
var cptyName = quotes[firstKey].cptyName;
```
<http://jsfiddle.net/mGZpa/> | You can iterate through the object.
```
var quotes = {
'367:sl': 'cptyname'
}
for(var i in quotes) {
alert(quotes[i]);
}
```
[Demo](http://jsfiddle.net/LPK3L/) |
348,449 | I recently flagged the following answer as being of low-quality, and both flags were disputed.
* <https://stackoverflow.com/a/43623198/1415724>
The flags and responses are as follows:
1) *very low quality – Fred -ii- 12 hours ago
Response: disputed*
2) (for moderation): *I flagged this question yesterday as being... | 2017/04/26 | [
"https://meta.stackoverflow.com/questions/348449",
"https://meta.stackoverflow.com",
"https://meta.stackoverflow.com/users/1415724/"
] | That answer is not "link only" by the ["Castle" guidance.](https://meta.stackexchange.com/questions/225370/your-answer-is-in-another-castle-when-is-an-answer-not-an-answer)
The answer, without link markup (as it is supposed to be reviewed for link-onlyness):
>
> include bootstrap.min.css and bootstrap.min.js
>
>
>... | I think this is perfectly valid complete answer "include bootstrap.min.css and bootstrap.min.js".
Anyone with minimal knowledge of HTML should be able to understand it and create solution based on given information.
Is it the best ever answer - no. Should it be improved - it could, but it is not beneficial for the s... |
5,894,262 | I am trying to solve the reverse word problem. My solution works, and even skips blank lines. However, after all the lines of a file are read, the program gets stuck in a loop, constantly accepting input. This is very puzzling, and I feel like it has to do with my outer while loop, but I can't see what's wrong with it.... | 2011/05/05 | [
"https://Stackoverflow.com/questions/5894262",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/224322/"
] | The problem is the inner loop. If I give in a text file containing only one word on a single line, it will fail since it will never come out of the inner loop.
This code works for me:
```
int main(int argc, char** argv)
{
stack<string> s;
ifstream in;
in.open(argv[1]);
do
{
do
{
... | Here is an approach that may work.
```
// read the file line by line
string line;
while (std::getline(in, line))
{
if (!line.empty())
{
// now have a valid line, extract all the words from it
<input string stream> in_str(line); // construct a input string stream with the string
string word;
while (... |
15,557,088 | I am refactoring a class with a public facing interface and thinking about the usage led me to ask:
What is the difference between declaring the following within some larger class (as an instance variable):
```
private final OnClickListener mButtonOnClickListener = new OnClickListener() {
@Override
public voi... | 2013/03/21 | [
"https://Stackoverflow.com/questions/15557088",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/822005/"
] | Those are both anonymous classes. In the first one, you can reuse it, but both are just objects that are created. An anonymous class is necessarily an inner class, and can access any fields of the enclosing class.
I think you may be getting anonymous classes confused with [inner classes and static nested classes](http... | Both are anonymous classes. Taking the example of a listener, if you intend to use the same listener for two components you can have an instance variable for that else you can directly attach it to the component. So it depends on the requirement.
But mostly its a sort-of one-time use, that is, you avoid creating insta... |
11,340,619 | I'm currently doing an internship in a medical laboratory
They want to buy Ipad and medical device connected to it
example: diabet tester <http://www.ibgstar.us/>
blood pressure monitoring system <http://www.ihealth99.com/>
I'm wondering if I can code my own application that gets the data from the medical device an... | 2012/07/05 | [
"https://Stackoverflow.com/questions/11340619",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/862637/"
] | I think they're some step to success it .
At first you need a Hardware solution like said "Mundi".
You need to grab data from device and store them somewhere accessible (like in a BDD with online acces).
And then the iPad application just have to connecte to the data-Source and play with it | I'm not sure this applies, but I've seen some really cool medical apps written using Harvard's SMART project. They provide a simple but effective framework, which is independent of the Hospital Information System (like Cerner, Epic, VistA). |
14,330,470 | I have an app that has 2 models, City and Neighborhood. on the root page, I use collection\_set to display all cities
```
<%= form_tag('/sales/neighborhood', :method => :get) %>`
<%= collection_select(:neighborhood, :city_id, City.all, :id, :name) %>
<%= submit_tag 'Go' %>
```
I then want to have in the followin... | 2013/01/15 | [
"https://Stackoverflow.com/questions/14330470",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1855249/"
] | According to the collection select
```
<%= collection_select(:neighborhood, :city_id, City.all, :id, :name) %>
```
parameter you should get in your controller will be like
```
params[:neighborhood][:city_id]
```
But according to your GET url `http://localhost:3000/sales/neighborhood?utf8=%E2%9C%93&city%5Bid%5D=1&... | You have `city_id` as a query parameter, and yet you look for `params[:id]` in your controller.
I would change that to
```
def neighborhood
city = City.find(params[:city_id])
@nbhds = city.neighborhoods
end
```
If that doesn't solve your problem I'll have a better look tomorrow :) |
22,561 | Can you help me to understand this phrase:
>
> I wish I could meet you so bad.
>
>
> | 2014/05/01 | [
"https://ell.stackexchange.com/questions/22561",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/8481/"
] | Don't interpret bad, as a negative thing here. When the person says they want to meet you so bad, they mean they really want to meet you. Not that the manner in which they want to meet you, is a negative thing. | The idiom "so bad" should be taken to mean "very intensely and urgently", and generally applies to wanting, desiring, or needing. As in "I have to go to the bathroom so bad." |
1,698,114 | is there any way to execute multiple statements (none of which will have to return anything) on Firebird? Like importing a SQL file and executing it.
I've been looking for a while and couldn't find anything for this. | 2009/11/08 | [
"https://Stackoverflow.com/questions/1698114",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/95511/"
] | In IBExpert you can execute multiple commands in single script via Tools->Script Executive (Ctrl+F12) | You can do this with IBOConsole (download from www.mengoni.it). The SQL window allows you to enter a complete script with the usual ";" delimiter. |
41,642 | I know that the order of the words has changed to form an interrogative sentence, and I comprehend that *a* means "has" and *il/elle* means "he/she", but what is the meaning of *-t-*, and from where it has arrived into the question?
For example, the interrogative form of "Tu as douze ans." is "Quel âge as-tu ?". I don'... | 2020/04/04 | [
"https://french.stackexchange.com/questions/41642",
"https://french.stackexchange.com",
"https://french.stackexchange.com/users/-1/"
] | It has no meaning. It occurs for the sound only, or as the French say, *des raisons [euphoniques](https://fr.wikipedia.org/wiki/Euphonie)*.
Specifically, it's a species of [liaison](https://en.wikipedia.org/wiki/Liaison_(French)#Liaison_on_inverted_verbs). Liaison is when the phonological environment of a syllable wit... | It is only for sound reasons, if we say "quel âge a il" it will be so hard to pronounce it, so they add the "t". |
8,412,868 | I am wondering if it's possible to program TPM ( <http://en.wikipedia.org/wiki/Trusted_Platform_Module> ) present in most of Intel chips, in such a way to:
```
- decide what to store in the persistent memory
- decide which cryptographic algorithms to implement.
```
Obviously it should not be reprogrammable once that... | 2011/12/07 | [
"https://Stackoverflow.com/questions/8412868",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/907921/"
] | The behaviour of a TPM is defined by the [specifications](http://www.trustedcomputinggroup.org/developers/trusted_platform_module/specifications) issued by the Trusted Computing Group. A TPM must exactly behave as specified, so you cannot change the functionality of a proper implemented TPM. The manufacturers of TPMs h... | Yes, you can use the TPM chip for exactly these sorts of operations, and many more.
The [TrouSerS](http://trousers.sourceforge.net/faq.html) stack is an open source implementation of the trusted computing software stack necessary for using the TPM chip reliably. |
1,583,979 | new to Spring and here @stackoverflow
I'm building an stand-alone Inventory & Sales tracking app (Apache Pivot/Spring/JPA/Hibernate/MySQL) for a distributor business.
So far I think everything is CRUD, so I plan to have a base class with everything @Transactional.
Then I got a problem with my save generic method. Do... | 2009/10/18 | [
"https://Stackoverflow.com/questions/1583979",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/265916/"
] | By local hosting, I'm guessing you mean on your own box, so essentially free. If you're not too strapped for cash, you could probably pick up a cheap box, and install a headless linux on there. Well, that's only if you're adverse to using linux as a desktop...
So, first, since you're only learning, I'm assuming you're... | Try [nginx](http://nginx.net/) - another lightweight alternative to apache, fast and stable. fastcgi on windows works ok.
Regarding your question - I think the reason is that lighttpd is loosing its popularity, look at the web server stats. So less people use it, less features are tested, more bugs are lurking around. |
25,063,324 | I am making four or more ajax rest calls in `$(document).ready(function(){}`.
As a hack, I added `.done()` to largest call. It is "working." I want to improve and add a spinning gif for part of page, not on entire body. I tried method for entire body, the spinner launches on my page transitions. I would like to avoid ... | 2014/07/31 | [
"https://Stackoverflow.com/questions/25063324",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/428862/"
] | An alternative would be to use deferred:
```
$(function() { // on document ready
$("#spinner").show(); // show the spinner
var a = $.getJSON(...);
var b = $.getJSON(...);
// more calls...
$.when(a,b).always(function() {
$("#spinner").hide();
});
});
```
<http://api.jquery.com/catego... | ```
<script type="text/javascript">
$(document).ready(function()
{
$('#loading')
.hide()
.ajaxStart(function() {
$(this).show();
})
.ajaxStop(function() {
$(this).hide();
});
});
</script>
<div id="loading">... |
1,767,679 | Microsoft Visual Studio 2008 is giving me the following warning:
warning C4150: deletion of pointer to incomplete type 'GLCM::Component'; no destructor called
This is probably because I have defined Handles to forward declared types in several places, so now the Handle class is claiming it won't call the destructor o... | 2009/11/20 | [
"https://Stackoverflow.com/questions/1767679",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/208358/"
] | Per the C++ Standard (ISO/IEC 14882:2003 5.3.5/5):
>
> If the object being deleted has incomplete class type at the point of deletion and the complete class has a non-trivial destructor or a deallocation function, the behavior is undefined.
>
>
>
So, if your class has a non-trivial destructor, don't do this, rega... | In g++, the warning could be reproduced too using following code:
```
class A;
void func(A *p)
{
delete p;
}
int main(int argc, char **argv)
{
return 0;
}
```
Warnings but no any errors:
```
test.cpp: In function void func(A*):
test.cpp:6: warning: possible problem detected in invocation
of del... |
14,276,892 | When I try to use any javascript template Eclipse always hangs and I get this message:
"Unhandled event loop exception Java heap space" on a popup.
I started a top command (using Ubuntu) for the Eclipse process and for Java process and then tried to use an auto-complete on Eclipse. I notice that the Java process takes... | 2013/01/11 | [
"https://Stackoverflow.com/questions/14276892",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1769128/"
] | I managed to find the problem. I temporarily moved some js files to my project (some of them duplicated the original ones) and auto-complete was searching in too many files. So I changed the src folder like this:
* Right click on project
* Choose properties
* Javascript
* Include path
* On the source tab I excluded th... | after working several hours in my case I found the solution I hope it works for you ;
change my JDK to alternate JRE
[](https://i.stack.imgur.com/CdPIh.jpg) |
23,586,229 | I am just wondering, how unique is a mt\_rand() number is, if you draw 5-digits number?
In the example, I tried to get a list of 500 random numbers with this function and some of them are repeated.
<http://www.php.net/manual/en/function.mt-rand.php>
```
<?php
header('Content-Type: text/plain');
$errors = array();
$u... | 2014/05/10 | [
"https://Stackoverflow.com/questions/23586229",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2156512/"
] | The birthday paradox is at play here. If you pick a random number from 10000-99999 500 times, there's a good chance of duplicates.
**Intuitive idea with small numbers**
If you flip a coin twice, you'll get a duplicate about half the time. If you roll a six-sided die twice, you'll get a duplicate 1/6 of the time. If y... | Your question deals with a variation of the "Birthday Problem" which asks if there are N students in a class, what is the probability that at least two students have the same birthday? See [Wikipedia: The "Birthday Problem"](http://en.wikipedia.org/wiki/Birthday_problem).
You can easily modify the formula shown there ... |
3,267,145 | I have a makefile structured something like this:
```
all :
compile executable
clean :
rm -f *.o $(EXEC)
```
I realized that I was consistently running "make clean" followed by "clear" in my terminal before running "make all". I like to have a clean terminal before I try and sift through nasty C++ compilat... | 2010/07/16 | [
"https://Stackoverflow.com/questions/3267145",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/394103/"
] | Actually you are right: it runs another instance of make.
A possible solution would be:
```sh
.PHONY : clearscr fresh clean all
all :
compile executable
clean :
rm -f *.o $(EXEC)
fresh : clean clearscr all
clearscr:
clear
```
By calling `make fresh` you get first the `clean` target, then the `clearsc... | If you removed the `make all` line from your "fresh" target:
```
fresh :
rm -f *.o $(EXEC)
clear
```
You could simply run the command `make fresh all`, which will execute as `make fresh; make all`.
Some might consider this as a second instance of make, but it's certainly not a sub-instance of make (a make i... |
70,466 | I am a Malevolent and deceitful god. My cruelty and treachery is well known throughout the world. These true stories about me are spread by my nemesis, the god of love, kindness and truth. Worship of my nemesis is the main religion around. I desire to make a religion to rivel my nemesis but I have one problem: as a God... | 2017/02/07 | [
"https://worldbuilding.stackexchange.com/questions/70466",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/17551/"
] | This religion would give true believers (and those who only pretend to believe) an excuse why they can be evil themselves. No more fasting and giving alms and meekness.
Has your story an afterlife with heaven and hell? If so, can any god provide tickets or is it just one?
In the temporal world, the god would tell hi... | First, elaborate on how you can be deceitful but not tell a lie. Do the people *know* this?
As for why follow you, what do you have to offer? There’s no downside to *not*, as that is the status quo. Do you have powers? Do you reward followers? What’s your **offer**? |
37,596,899 | I have several string resources for different languages. As you can see, all of them starts with capitalized letter and then in lower case. So, is there any way how to Converter all of them to UPPERCASE without direct changing of resources? Is it possible to do it in XAML? Maybe combination of Binding's converter?
[!... | 2016/06/02 | [
"https://Stackoverflow.com/questions/37596899",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5033823/"
] | Here's a C# version of the same thing:
```
public class ToUpperConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
string stringValue = value as string;
return string.IsNullOrEmpty(stringValue) ? string.Empty : stringValue.ToUp... | You told the answer yourself. Use a converter.
```
Public Namespace Converter
Public Class ToUpperValueConverter
Implements IValueConverter
Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object
Dim str = TryCast(value, String... |
360,890 | I am revising undergrad statistics course via [this course](https://lagunita.stanford.edu/courses/course-v1:OLI+ProbStat+Open_Jan2017/info), where i am learning technique to pull out sample from population.
While ensuring that sample is decent representative of population, i am left with this couple of question.
* Sh... | 2018/08/06 | [
"https://stats.stackexchange.com/questions/360890",
"https://stats.stackexchange.com",
"https://stats.stackexchange.com/users/172680/"
] | This depends hugely of what you even want to do about outliers, through what mechanism they arise and whether they even affect what you want to do.
If outliers are perfectly good values that just happen to be (a bit) extreme, then it may be more a matter of making sure it does not affect what you intend to do too much... | In general, you won't *have* the population. So, if you, in class exercises, remove the outliers from the population before taking the sample, your exercises will be poor examples for the students when they do future work. |
50,661,871 | I have this dictionary:
```
analytics = {
datetime.datetime(2018, 4, 1, 0, 0):{
'clicks': 5049,
'month': datetime.datetime(2018, 4, 1, 0, 0)
},
datetime.datetime(2018, 3, 1, 0, 0): {
'clicks': 592,
'month': datetime.datetime(2018, 3, 1, 0, 0)
},
datetime.datetime(2018, ... | 2018/06/02 | [
"https://Stackoverflow.com/questions/50661871",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1327870/"
] | Dictionaries aren't orderable. When you call `sorted` on a dictionary it treats it as an iterable, which it produces by key only. You can test this with:
```
for k in some_dict:
print(k) # should produce each key
```
What you want instead is to sort `dict.items`, which is still not a dict, but instead more like... | instead of dict you should use OrderedDict
```
from collections import OrderedDict
ordered_dict = OrderedDict()
sorted_keys = sorted(analytics.keys())
for key in sorted_keys:
ordered_dict.update({key: analytics[key]})
```
see the docs: <https://docs.python.org/2/library/collections.html#collections.OrderedDic... |
17,941,626 | I am using PHP to insert rows into mysql.
I wanted to know the pid (primary ID) immediately after inserting that row as a return value.
Kindly advice ... how can I do this.
Thanks in advance | 2013/07/30 | [
"https://Stackoverflow.com/questions/17941626",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2633200/"
] | Depending on the extension you're using:
mysql: `mysql_insert_id()` ([DOCUMENTATION](http://php.net/manual/en/function.mysql-insert-id.php))
mysqli: `mysqli::$insert_id` ([DOCUMENTATION](http://php.net/manual/en/mysqli.insert-id.php))
PDO: `PDO::lastInsertId()` ([DOCUMENTATION](http://php.net/manual/en/pdo.lastinser... | You can use as below :
```
$id = mysql_insert_id();
```
For more details refer [This link](http://php.net/manual/en/function.mysql-insert-id.php) |
46,947 | Are the following sentences correct?
>
> *He just got up.* -- Can I say this, informally?
>
> *He just waked up.*
>
>
> | 2015/01/16 | [
"https://ell.stackexchange.com/questions/46947",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/4069/"
] | We can say either sentence, but waked is used far less often than **woke**.
He just **woke** up.
wake (base/infinitive)
**woke** (simple past)
woken (past participle)
The two sentences have almost the same meaning, and we often use them interchangeably.
There is a slight distinction: "He just woke up" tells us... | It's fine!
>
> He just got up = He just waked up
>
>
>
Both mean informally that he's not sleeping now. He just finished his sleep.
However, it's worth knowing that '[wake up](http://www.macmillandictionary.com/dictionary/british/wake-up_1)' and '[get up](http://www.thefreedictionary.com/get+up)' mean many thi... |
65,715,251 | **Note: Most answers that I could find here on stack overflow were either outdated (and used deprecated methods) or were closely related but not exactly useful for my case**
I am making an app that generates a color palette from the image input by the user. I am using [this Jetpack library](https://developer.android.c... | 2021/01/14 | [
"https://Stackoverflow.com/questions/65715251",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11620703/"
] | ### Assumption
* The array is sorted.
### The Condition
* Check if it is smaller then the current element in the array and greater then the next element in the array.
**Note:** If the array isn't sorted you can do `Array.sort()`
```js
const arr = [200, 180, 150, 120, 80];
let sum = arr.reduce((acc, x) => {
retu... | Use `findIndex` method. (inline comments)
```js
const getIndexesBound = (arr, avg) => {
const index = arr.findIndex((num) => avg > num);
if (index < 1) {
// when index 0 means first element
// when index -1, can not find num
return "Can not find indexes bound";
} else {
return [index - 1, index];... |
7,228,141 | How do I parse XML, and how can I navigate the result using jQuery? Here is my sample XML:
```
<Pages>
<Page Name="test">
<controls>
<test>this is a test.</test>
</controls>
</Page>
<Page Name = "User">
<controls>
<name>Sunil</name>
</controls>
</Page>
</Pages>
```
I would like to... | 2011/08/29 | [
"https://Stackoverflow.com/questions/7228141",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/320126/"
] | you can use [`.parseXML`](http://api.jquery.com/jQuery.parseXML/)
```
var xml='<Pages>
<Page Name="test">
<controls>
<test>this is a test.</test>
</controls>
</Page>
<page Name = "User">
<controls>
<name>Sunil</name>
... | Have a look at jQuery's [`.parseXML()` *[docs]*](http://api.jquery.com/jQuery.parseXML):
```
var $xml = $(jQuery.parseXML(xml));
var $test = $xml.find('Page[Name="test"] > controls > test');
``` |
27,157,168 | Is it possible to examine the contents of a directory in squirrel? I need a list of file names, including their paths, in a given directory and its subdirectories.
I'm writing a script for use in Code::Blocks, which uses squirrel as a scripting language. I've had a look at the squirrel standard library, but couldn't f... | 2014/11/26 | [
"https://Stackoverflow.com/questions/27157168",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/692359/"
] | I think you want to:
```
git fetch --all -Pp
```
where:
`git fetch` Download objects and refs from another (remote) repository
`--all` fetch all remotes.
`-P` remove any remote-tracking references that no longer exist on the remote.
`-p` remove any local tags that no longer exist on the remote.
for more use `git... | Here is a script I wrote that will fetch and fast forward all your branches without doing any checkouts (so it's faster and doesn't affect your current working tree.
<https://stackoverflow.com/a/24451300/965176> |
8,959,720 | I am trying to sort my `locations` array from shortest to longest distance with the following code:
```
for(var i=0; i<locations.length;i++)
{
var swapped = false;
for(var j=locations.length; j>i+1;j--)
{
if (locations[j]['distance'] < locations[j-1]['distance'])
{
var temp = l... | 2012/01/22 | [
"https://Stackoverflow.com/questions/8959720",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/897740/"
] | You started 1 to late, remember array keys are indexes, which start at 0
```
for(var j=locations.length-1; j>i+1;j--)
{
console.log(j);
if (locations[j-1]['distance'] && locations[j]['distance'] < locations[j-1]['distance'])
{
var temp = locations[j-1];
locations[j-1]=locations[j];
lo... | Index of an array is from 0 to length-1
```
for(var j=locations.length; j>i+1;j--)
```
so `locations[j]` is out of bound |
97,476 | I removed two room's worth of walls and ceiling horsehair plaster and wood lath from a home built in 1890. Would the plaster or paint used in those days cause the wood to release any toxins when burned? I'm wondering if the material can safely be used for firewood. | 2016/08/15 | [
"https://diy.stackexchange.com/questions/97476",
"https://diy.stackexchange.com",
"https://diy.stackexchange.com/users/3917/"
] | Wood smoke itself contains many toxins and carcinogens. I mention it because folks have the false impression that it's somehow more "natural" than other types of smoke, and therefore safer.
If you're managing your fire well, the little bit of extra stuff that clings to the lath shouldn't be an issue. (How would there... | That old lathe board makes great kindling wood to start a fire. It gets very hot, so I wouldn't load the stove to the top with it. Your whole wood stove is full of toxins when lit so it's all going out the chimney anyways. |
30,774,600 | I'm trying to write a script that counts the number of matches of some pattern in a list of files and outputs its findings. Essentially I want to call the command like this:
`count-per-file.sh str_needle *.c`
and get output like:
```
Main.c: 12
Foo.c: 1
```
The script:
```
#!/bin/bash
# Count occurences of patter... | 2015/06/11 | [
"https://Stackoverflow.com/questions/30774600",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/797744/"
] | As suggested I used `shift` which seems to 'pop' the first argument. Here's my working script:
```
#!/bin/bash
# Count occurences of pattern in files.
#
# Usage:
# count-per-file.sh SEARCH_PATTERN GLOB_EXPR
search_pattern="$1"
shift
for file in "$@"; do
count=$(grep -aiE "$search_pattern" "$file" | wc -l)
i... | You can use substring parameter expansion with an start index like this to skip the first n-1 values in `$@`
`"${@:n}"`
e.g.
```
for FILE in "${@:2}"
do
echo $FILE
done
```
**N.B.** Your script doesn't get a 'glob pattern' as the second argument.
The shell that calls your script expands the glob to a space sep... |
74,226,657 | When I use the `<Link>` tag in NextJs to navigate between pages it doesn't rerun my scripts after changing pages. It only runs the scripts after the first page load or when I press reload. When using plain `<a>` tags instead, it works fine because the page reloads after each navigation. As far as I can tell this happen... | 2022/10/27 | [
"https://Stackoverflow.com/questions/74226657",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19677826/"
] | The capturing group that participated in the match was different. In the first case, it was Group 1, in the second case, it was Group 2.
Also, note that the non-capturing group is superfluous, remove it.
To fix the immediate issue, you can use `r'\1\2\3'` as replacement:
```py
re.sub(r'avenue(\d+)|road(\d+)|lane(\d+... | Would this work? The part that changes, avenue, road or lane can go in the non capturing group, then get the following number:
```py
re.sub(r'(?:avenue|road|lane)(\d+)',r'\1','road12')
``` |
23,664,726 | Ok so I have 3 sets of data like this:
Now I'd like to retrieve information about each pair
1. Product - Warehouse (I have 1000 records)
2. Warehouse - TransferNumber
3. Product - TransferNumber - Quantity
The final result I'm expecting is Product - Warehouse - Quantity.
It is bizarrely designed, but I want to pull... | 2014/05/14 | [
"https://Stackoverflow.com/questions/23664726",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3597281/"
] | require('child\_process').spawn;
================================
Running a Gulpfile from a different directory is quite simple with [Node's `child_process#spawn` module](http://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options).
Try adapting the following to your needs:
```js
... | Maybe this would help someone too, so I'll give this a shot. I don't know specifically what the OP intends to do but the question is similar to my problem which my solution is to access the other gulp file in another way like using a project's pre-build event, for example:
```
cd $(SolutionDir)\ProjectThatHasTargetGul... |
46,408,073 | I have the following tables. As Canada day is July 1st and my data source is in business days only. Notice that July 1st is missing from TABLE\_A (name: `conm`) which is my source table.
```
CREATE TABLE [dbo].[comn]
(
CONM varchar(48),
valuedate datetime,
closeprice decimal(5,2)
)
GO
INSERT INTO comn VAL... | 2017/09/25 | [
"https://Stackoverflow.com/questions/46408073",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8670543/"
] | Use [calculated properties](https://technet.microsoft.com/en-us/library/ff730948.aspx) to create the split fields and exclude the original `Unit` field:
```
Import-Csv $file -Header Unit, IP, Hostname |
Select-Object -Property @{n='Unit';e={$_.Unit.Substring(0,4)}},
@{n='Town';e={$_.Unit.Substring(5)}}, * ... | Or you can recreate object :
```
Import-Csv $file -Header Unit, IP, Hostname | %{
[pscustomobject]@{
Unit=$_.Unit.Substring(0,4)
Town=$_.Unit.Substring(5)
IP=$_.IP
Hostname=$_.Hostname
}
}
``` |
35,852,286 | I am really new to JavaScript and Node JS. I have various image URLs that I want to buffer. I have tried the request npm module but want a lower level library for what I want to achieve.
For example:
<http://assets.loeildelaphotographie.com/uploads/article_photo/image/128456/_Santu_Mofokeng_-_TOWNSHIPS_Shebeen_Soweto_... | 2016/03/07 | [
"https://Stackoverflow.com/questions/35852286",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5884189/"
] | This is the native way:
```
var http=require('http'), imageBuffer;
http.get(
'http://www.kame.net/img/kame-anime-small.gif',
function(res) {
var body=new Buffer(0);
if (res.statusCode!==200) {
return console.error('HTTP '+res.statusCode);
}
res.on('data', function(chunk) {
body=Buffe... | Here's a simple example using the built-in streaming that the http response has:
```
var http = require('http');
var fs = require('fs');
var file = fs.createWriteStream("test.png");
var request = http.get("some URL to an image", function(response) {
response.pipe(file);
});
```
I ran this myself and successfully ... |
8,072,933 | ```
public class SieveGenerator{
static int N = 50;
public static void main(String args[]){
int cores = Runtime.getRuntime().availableProcessors();
int f[] = new int[N];
//fill array with 0,1,2...f.length
for(int j=0;j<f.length;j++){
f[j]=j;
}
f[0]=0;f[1]=0;//eliminate these cases
... | 2011/11/09 | [
"https://Stackoverflow.com/questions/8072933",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1014888/"
] | You could implement Runnable instead and use new Thread( $Runnable here ).start() or use a ExecutorService to reuse threads. | ThreadPools can be used for delivering tasks to set number of threads. When initiating you set the number of threads. Then you add tasks for the pool. And after you can block until all tasks have finished processing. [Here](http://www.java2s.com/Code/Java/Threads/Threadpooldemo.htm) is some sample code. |
11,593,091 | Ho to check gems ready to update, without update them? | 2012/07/21 | [
"https://Stackoverflow.com/questions/11593091",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1537135/"
] | If you are not using bundler, just run `gem outdated` and it will give you a list of outdated gems.
Example of output:
```
$ gem outdated
a... | `gem outdated` will give you a list of outdated gems including version number you currently have and the latest version number.
Then to update:
* `gem update GEMNAME` to update a specific gem
or just
* `gem update` to update all gems to the latest stable version |
7,473,536 | I have uploaded the file.css file on server with filezilla and also with cpanel.
But when i browse the website the css has no impact.
I changed: padding-left: 10px; If i see the Page view source i see that the older file is there.
What can be the reason for that ? | 2011/09/19 | [
"https://Stackoverflow.com/questions/7473536",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/884995/"
] | Try doing a hard refresh. CTRL Shift R. That should force any cached files to clear. Chances are that's the problem, unless the file isn't uploading. If you see the new file listed in Filezilla then it's a cache issue. | Did you replace/overwrite the existing css file?
It sounds like maybe the old one wasn't overwritten - in which case you'll have to do that for the changes to take effect.
Are you using a CMS? Some of them have Cache features where it may take time for those changes to be reflected unless you hard refresh. |
13,011,394 | What's the best way to sum two or more lists even if they have different lengths?
For example I have:
```
lists = [[1, 2], [0, 3, 4], [5]]
```
and the result should be:
```
result = [6, 5, 4]
``` | 2012/10/22 | [
"https://Stackoverflow.com/questions/13011394",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1003123/"
] | You can use [`itertools.izip_longest()`](http://docs.python.org/library/itertools.html?highlight=itertools#itertools.izip_longest), and use a `fillvalue` equal to `0`
```
In [6]: [sum(x) for x in itertools.izip_longest(*lists, fillvalue=0)]
Out[6]: [6, 5, 4]
```
for Python < 2.6:
```
In [27]: ml = max(map(len, list... | The best I came up with is the following:
```
result = [sum(filter(None, i)) for i in map(None, *lists)]
```
It's not so bad, but I have to add NoneTypes and then filter them in order to sum up. |
55,126,381 | I'm using the latest version of Laravel. Fresh project. Just created the make:auth function.
My goal was to add additional fields to the registration field. The original model only requires name, email and password. I'm using SQLite and PHP 7.1.19
I wanted to add first name, last name and age. Somehow I'm getting th... | 2019/03/12 | [
"https://Stackoverflow.com/questions/55126381",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11192429/"
] | Namespace and use statements are not supported in PHP versions < `5.3`
Please check your php version using `<?php echo phpversion(); ?>` and check if its lower than 5.3
Otherwise the class looks good. If you had whitespaces at the start before the starting php tag, you would receive a different error like
>
> Name... | ```
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('users');
}
```
} |
3,221 | If I would like to keep my emacs settings and packages in another computer or after a format **is there a way to avoid having to install all the packages from the beginning?**
I don't just mean saving the `.emacs` as to have the customizations but also the packages that come with it. I was wondering **if I copy and sa... | 2014/11/07 | [
"https://emacs.stackexchange.com/questions/3221",
"https://emacs.stackexchange.com",
"https://emacs.stackexchange.com/users/2248/"
] | >
> If I would like to keep my emacs settings and packages in another computer or after a format is there a way to avoid having to install all the packages from the beginning?
>
>
> I don't just mean saving the .emacs as to have the customizations but also the packages that come with it. I was wondering if I copy an... | Providing you will be using the same version of Emacs, you can duplicate your .emacs.d with all compiled / packages in-place.
This is also true of keeping your .emacs.d in version control.
Personally I would recommend this method.
There is a current trend of using require-package (in various forms) which will impli... |
18,873,125 | When I have list of ids that I want to update their property the `updated_at` field in the database doesn't seem to change, here is what I mean :
```
ids = [2,4,51,124,33]
MyObj.where(:id => ids).update_all(:closed => true)
```
After this update is executed `updated_at` field doesn't change. However when I enter rai... | 2013/09/18 | [
"https://Stackoverflow.com/questions/18873125",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/190623/"
] | Updates all, This method constructs a single SQL UPDATE statement and sends it straight to the database. It does not instantiate the involved models and it does not trigger Active Record callbacks or validations. Values passed to update\_all will not go through ActiveRecord's type-casting behavior. It should receive on... | If anyone is interested I did make a gist that outlines how to roll it yourself.
<https://gist.github.com/timm-oh/9b702a15f61a5dd20d5814b607dc411d>
It's a super simple implementation just to get the job done.
If you feel like there is room for improvement please comment on the gist :) |
44,535,994 | Here is my JSON CODE
```
<?php
require '../db_connect.php';
if (isset($_GET['username']) && isset($_GET['password']))
{
$myusername = $_GET['username'];
$mypassword = $_GET['password'];
$sql = "SELECT * FROM user_registration WHERE (username = '$myusername' or email = '$myusername' or phone = '$myusernam... | 2017/06/14 | [
"https://Stackoverflow.com/questions/44535994",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6808152/"
] | ```
public class NewLogin extends ActionBarActivity {
private EditText editTextUserName;
private EditText editTextPassword;
private ProgressDialog pDialog;
JSONParser jsonParser = new JSONParser();
public static final String USER_NAME = "USERNAME";
String username;
String password;
... | Check Below Tutorial For JSON Parsing in Android,
<http://www.androidhive.info/2012/01/android-json-parsing-tutorial/>
```
JSONObject jsonObject =new JSONObject(response);
if(jsonObject.getString("message").equalsIgnoreCase("success"))
{
//start your activity
}else
{
// Give a Message
}
``` |
28,628,978 | I put a box shadow around the main #container div and although the #footer div is inside the #container div, the shadow is not displayed around #footer
Fiddle here: <http://jsfiddle.net/tfua7ebw/>
Can you please help me?
Thank you.
HMTL code:
```
<div id="container">
<div id="banner">
</div><!--end of banner-->
<... | 2015/02/20 | [
"https://Stackoverflow.com/questions/28628978",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4587041/"
] | Try removing **float: left;** from **footer** div css.
It will help. I tried that. | Try this.. may this will help you,
change `box-shadow` style in #container
<http://jsfiddle.net/sympbqx9/2/> |
20,046,806 | ```
public void activityStarter(Class<?> cls){
Intent intent = new Intent( ?, cls);
startActivity(intent);
}
```
What should be passed (see the ? mark) in order start a new activity (another java class I have in the same package, say MyActivity)? | 2013/11/18 | [
"https://Stackoverflow.com/questions/20046806",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2964784/"
] | ```
NSMutableDictionary *tempDict = [[yourArray objectAtIndex:1] mutableCopy];
[tempDict setObject:@"New Name" forKey:@"Name"];
[yourArray replaceObjectAtIndex:1 withObject:tempDict];
``` | You should replace your object once you get index of object.
```
[arrayOfData replaceObjectAtIndex:yourIndex withObject:yourObject];
``` |
44,463,509 | I have next code which gets http code when url has been opened directly:
```
require 'net/http'
require 'uri'
def visit_page(url, response_code: false)
@browser.goto(url)
if response_code
page_status_code(url)
end
end
def page_status_code(url)
uri = URI.parse(url)
connection = Net::HT... | 2017/06/09 | [
"https://Stackoverflow.com/questions/44463509",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4389785/"
] | Yes. This is called concatenation and is a fundamental part of string building in any language. In PHP this is accomplished with the `.` concatenation operator.
```
"string etc ".some_func()." continuation of string"
```
Note you can use single or double quotes. | ```
<?php
$title = the_title();
$field['url'] = "<iframe src='http://xxx.xx/=$title' width='640' height='360' allowscriptaccess='always' allowfullscreen='true' scrolling='no' frameborder='0'></iframe>;"
?>
``` |
60,549,566 | The following function is designed to block macrotasks, by repeatedly creating microtasks using `await`.
But why does it cause a stack overflow?
I thought `await` would put the recursive call on a microtask, and therefore empty the stack (clearly I was wrong).
```js
const waitUsingMicroTasks = async (durationMs, sta... | 2020/03/05 | [
"https://Stackoverflow.com/questions/60549566",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38522/"
] | This recursive function is resolving entirely within the same microtask.
A new microtask is created when an `await` is encountered, you're correct. But the `await` operator needs to have a Promise or value in order to implicitly wrap it in a new Promise and attach callbacks. This means the value being `await`ed *needs... | There are no blocking tasks done in the function. So it will keep executing the next recursion almost immediately, and since there is no recursion escape results in stack overflow.
Introducing a time consuming tasks like console log into the code and it will run fine.
```
let count=0;
const waitUsingMicroTasks = asyn... |
6,705,743 | Hello I am new to `affineTransform` in java. I want to use it to shear some GUI I have to use later.
For now I just wanted to test a sample code but i cannot explain its output.
Here is the code
```
package main;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import j... | 2011/07/15 | [
"https://Stackoverflow.com/questions/6705743",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/808216/"
] | The `setTransform` method is intended only for restoring the original `Graphics2D` transform after rendering. That being said, you should ***never*** apply a new coordinate transform on top of an existing transform because the `Graphics2D` might already have a transform that is needed for other purposes, such as render... | Expanding on @littel's [answer](https://stackoverflow.com/questions/6705743/problems-with-affinetransform/6707085#6707085), you can compare the current [transform](http://download.oracle.com/javase/6/docs/api/java/awt/geom/AffineTransform.html) to the identity as the frame is resized using the example below. Note that ... |
365 | When you reach 10k rep, you get to see other users deleted answers. I just think it's dishonest as a system to call a feature "delete," but show that to totally random strangers in the backroom. Due to the nature of the rep, given enough time, all of the regular users would eventually reach 10k rep, no matter how insen... | 2009/06/28 | [
"https://meta.stackexchange.com/questions/365",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/3827/"
] | This is nothing like email. You are posting info to a public forum, if anything it is more like NNTP. In that regard the 'CABAL' of the NTP admins could view everything including deletes. Anyone who captured the post pre delete sees it too (one very good reason the admins have to be able to see the deletes if they need... | I'm not sure how many answers are actually un-deleted - it seems of much greater benefit to restore deleted *questions* - since it cascade-deletes other peoples answers (which they may have worked hard on)
Perhaps one solution could be - when an answer is deleted, the edit-history is destroyed, and only the current re... |
24,636,372 | I have a HEALPix map that I have read in using healpy, however it is in galactic coordinates and I need it in celestial/equatorial coordinates. Does anybody know of a simple way to convert the map?
I have tried using `healpy.Rotator` to convert from (l,b) to (phi,theta) and then using `healpy.ang2pix` to reorder the p... | 2014/07/08 | [
"https://Stackoverflow.com/questions/24636372",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1026674/"
] | I found another potential solution, after searching off and on for a few months. I haven't tested it very much yet, so please be careful!
Saul's **Solution 2**, above, is the key (great suggestion!)
Basically, you combine the functionality of `healpy.mollview` (`gnomview`, `cartview`, and `orthview` work as well) wit... | This function seems to do the trick (reasonably slow, but should be better than the for loop):
```
def rotate_map(hmap, rot_theta, rot_phi):
"""
Take hmap (a healpix map array) and return another healpix map array
which is ordered such that it has been rotated in (theta, phi) by the
amounts given.
... |
17,195,279 | I need to use an existing C library in a C++ project.
My problem is the C existing library uses FILE\* as streams, is there a standard compliant way to use FILE\* streams to put or to get from C++ streams?
I tried seeking FILE\* in the C++11 standard, but it appears only if few examples.
```
-
```
EDIT, example. ... | 2013/06/19 | [
"https://Stackoverflow.com/questions/17195279",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1876111/"
] | The C++ standard, with very few exceptions says that C functionality is all included. Certainly all the stadnard C `FILE *` functionality is supported [obviously subject to general support for `FILE *` on the platform - an embedded system that doesn't have a 'files' (e.g. there is no storage) in general will hardly hav... | As far as I understand, doing so is [non-portable and non-standard](http://stdcxx.apache.org/doc/stdlibug/34-2.html). Whether it works in practice or not is another question. I would create wrapper classes around your legacy code, or use FILE\* streams directly like in C - they are not that bad. :) |
1,616,876 | I have a new laptop (2 months old) with the following specs
* AMD Ryzen 4700
* AMD Radeon Graphics
* 8GB RAM 1200GHz
* 500GB storage SSD
and, most of the time, it boots very quickly (i'd say a few seconds) and runs perfectly. Sometimes, however, when it boots with low battery (maybe <20%) it does that incredibly slow... | 2021/01/12 | [
"https://superuser.com/questions/1616876",
"https://superuser.com",
"https://superuser.com/users/1261142/"
] | Adobe removed the flash player download link from their website in 2021. Even if you have a spare copy of the installer on your computer, it still won't work as it's an "online installer" that retrieves a copy of the latest version from Adobe's website, which Adobe also deleted in 2021 so the installers Adobe provided ... | I spent many hours on this and eventually found *my ideal solution*. After that, I found out other people are suggesting something very similar. However, I am still posting it since I am sure it will help some people, because of some details and because I am providing a working sample.
What I did is setting up a porta... |
37,803,940 | am getting an error like
```
Unknown column 'code' in 'where clause'
SELECT * FROM `payment` WHERE `code` = 'ORD00023'
```
even though i had used joined method for joining of payment table and services table.Here iam finding the solution of previous row value but its not getting.
this is my model
```
public funct... | 2016/06/14 | [
"https://Stackoverflow.com/questions/37803940",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5064637/"
] | Did you want this?
```
$this->db->query("SELECT p1.*, p2.balance AS previous_balance FROM payment p1 INNER JOIN payment p2 ON p1.order_id = p2.order_id + 1 AND p1.customer_id = p2.customer_id LEFT JOIN services s ON p1.customer_id = s.customer_id AND s.code = ? ORDER BY p1.id DESC", array($order_code));
``` | This is showing error because you are missing alias of table name, in which column code is available. replace code
```
$query = $this->db->get_where('payment p1', array('code' => $order_code));
```
with
```
$query = $this->db->get_where('payment p1', array('services.code' => $order_code));
```
or
```
$query = $t... |
10,825,619 | I think everyone's (mostly beginner of CI users) facing difficulties in pagination using with active record.
In CI's official documents, there is no clear statements explains how to use pagination class object in active record. My problem is; can not define current page and set it to SQL statement. Therefore, when pr... | 2012/05/30 | [
"https://Stackoverflow.com/questions/10825619",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1405703/"
] | Assuming you have *Manage Jenkins > Configure Global Security > Enable Security* and *Jenkins Own User Database* checked you would go to:
* *Manage Jenkins > Manage Users > Create User* | You need to *Enable security* and set the security realm on the *Configure Global Security* page (see: [Standard Security Setup](https://wiki.jenkins.io/display/JENKINS/Standard+Security+Setup)) and choose the appropriate Authorization method (*Security Realm*).
[, their corresponding pictures are also hidden? | 2012/07/09 | [
"https://superuser.com/questions/446627",
"https://superuser.com",
"https://superuser.com/users/144869/"
] | * You can also use the Select button and select all the pictures by dragging a box around all pictures. Then right click properties etc., or
* Select one picture and hit `CTRL`+`A` (select All), then right click properties etc.
Excel seems to understand that when selecting one picture and you press Select all (`CTRL`+... | I had the same issue with Excel 2016 and used a combination of answers to solve this:
1. Ctrl+G or F5
2. Select Special, then 'Objects' and click 'OK'
3. Right-click on one of the images and click Size and Properties
4. Select 'Move and size with cells' from 'Properties' and close
5. Done
HOWEVER ONLY filtering works... |
57,238,602 | This long question can be combined into one simple sentence: **How do I set a border of a table selectively (bottom or top) without impacting its tr or td elements?** I thought it would be as simple as changing the border of any element. I was wrong.
**The rest of the question explains where I need this and what I hav... | 2019/07/28 | [
"https://Stackoverflow.com/questions/57238602",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9158613/"
] | The character class `[\S^\n*.$]` matches 1 time any of the listed, that is why it does not math `2019-07:27`.
If you want to match `2019-07-27_2313hr_19sec` you could match the "date like" format and follow the match by matching 0+ times a non whitespace char `\S*`
```
\d{4}[-/:._]\d{2}[-/:._]?\d{2}\S*
```
[Regex d... | The negation operator needs to be the first character to create a negated character class. To do what you attempted, maybe try `[^\s\n]`. There is no way for a character class to be partially negated (if you think about it, what would that mean?) - it's either an enumeration of allowed characters, or an enumeration of ... |
160,870 | I've worked with a company for some time and we had a few interview seasons. I've participated in two of them so far. Anyways, since the pandemic, I've honestly felt less inclined (maybe lazy) to want to do any interviews any more. Anyways, they had a hold on the third interview season a few months ago and during that ... | 2020/07/23 | [
"https://workplace.stackexchange.com/questions/160870",
"https://workplace.stackexchange.com",
"https://workplace.stackexchange.com/users/78879/"
] | >
> has become a chore
>
>
>
Well, work isn't fun - that's kind of why they have to pay people to do it.
That said there's no harm in asking to be taken out of consideration to act as an interviewer - assuming it's not something that would be considered a core part of your role of course.
I'd probably avoid allu... | Well, not everybody is good at everything. You should talk to your manager and explain that you want to e left out from the interviewing, *if possible*.
As a reasoning, present the following:
* you had the initiative and good will to learn and to get involved and to make yourself useful;
* you found out that this is ... |
1,587,723 | im beginning in Objective-C development and as i can see in the development blogs(about Objective-C) like w3schools.com we dont have such type of sutes to learn Objective-c language , can any one known the such type of Sites to Learn objective-c language .. please let me know-- | 2009/10/19 | [
"https://Stackoverflow.com/questions/1587723",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/185590/"
] | <http://cocoaheads.byu.edu/resources> | In addition to the above-listed resources, I've found a lot of good stuff on <http://www.cocoadevcentral.com/> |
31,534,082 | This is my sample string (this one has five words; in practice, there may be more):
```
$str = "I want to filter it";
```
Output that I want:
```
$output[1] = array("I","want","to","filter","it");
$output[2] = array("I want","want to","to filter","filter it");
$output[3] = array("I want to","want to filter","to fil... | 2015/07/21 | [
"https://Stackoverflow.com/questions/31534082",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1712287/"
] | more generic solution that works with any length word:
```
$output = array();
$terms = explode(' ',$str);
for ($i = 1; $i <= count($terms); $i++ )
{
$round_output = array();
for ($j = 0; $j <= count($terms) - $i; $j++)
{
$round_output[] = implode(" ", array_slice($terms, $j, $i));
}
$outpu... | You can use a single for loop and if conditions to do
```
$str = "I want to filter it";
$text = trim($str);
$text_exp = explode(' ',$str);
$len = count($text_exp);
$output1=$text_exp;
$output2=array();
$output3=array();
$output4=array();
$output5=array();
for($i=0;$i<count($text_exp);$i++)
{
if($i+1<count($text... |
56,129,953 | How to print this dynamically?
```
data = {
"name": "EU",
"size": 10,
"nodes": [
{
"name": "England",
"size": 2,
"nodes": [
{
"name": "Center",
"size": 1,
"nodes": [
{
... | 2019/05/14 | [
"https://Stackoverflow.com/questions/56129953",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9127066/"
] | You were on the right track - you can indeed use recursion to walk the data structure. What you also need is to get the `name` property and build up a the start of each line from each `name` encountered. You can ferry that information using a second parameter to the recursive function. Then you need to recursively call... | One way is to use recursion on the nodes list:
I'm outputting the results with console.log.
Changed thanks to comment by VLAZ.
```js
var data = { "name": "EU", "size": 10, "nodes": [ { "name": "England", "size": 2, "nodes": [ { "name": "Center", "size": 1, "nodes": [ { "name": "main street", "size": 0.5, "nodes": [] }... |
1,309,926 | I'm developing a web app specifically for mobile phones, and I've run into a doozy of a problem. On the Blackberry emulator I've installed, everything works fine. But when I run my Openwave or Nokia N60 emulators, I can't log into my app any more. When I check the logs, I find that the reason is that ALL of the $\_POST... | 2009/08/21 | [
"https://Stackoverflow.com/questions/1309926",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8327/"
] | Show us the code for the input button (and general form). I think I've had this problem before, and the button wasn't of type 'submit' (or some other very very stupid mistake like that). | Does the behavior change if you post to a page rather than the root of the site? |
13,435,023 | I came across this question:
There are two persons. There is an ordered sequence of n cities, and the distances between every pair of cities is given. You must partition the cities into two subsequences (not necessarily contiguous) such that person A visits all cities in the first subsequence (in order), person B visi... | 2012/11/17 | [
"https://Stackoverflow.com/questions/13435023",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/648290/"
] | Q:: Two-Person Traversal of a Sequence of Cities: You are given an ordered sequence of n cities, and the distances between every pair of cities. Design an algorithm to partition the cities into two subsequences (not necessarily contiguous) such that person A visits all cities in the first subsequence (in order), person... | You're right that the proposed solution is somewhat messy and incorrect.
The way to think about the problem is, as always, inductive: If I need to solve the problem of size n, how can I reduce it to smaller problems (0,..., n-1). If you'd like to solve this problem for size n, you note that one of the players needs to... |
30,721 | I recently switched from Textpad to Notepad++. Overall, I have found N++ to generally be superior, but one of the few things I have been looking for since the beginning that I have not found is the ability to extend the current selection to the next blank line.
In Textpad, this is done with `ctrl` + `shift` + `up` or ... | 2009/08/27 | [
"https://superuser.com/questions/30721",
"https://superuser.com",
"https://superuser.com/users/7548/"
] | By default `Ctrl` `[` and `Ctrl` `]` move up and down "paragraphs".
So `Ctrl` `Shift` `[` and `Ctrl` `Shift` `]` will do what you want.
To edit the shortcut, go to *Settings > Shortcut Mapper > Scintilla Commands* and edit the SCI\_PARA\* commands. | It's simply `shift` + `up/down` without pressing `control`. |
62,904,386 | I would be using kotlin regex engine.
There are a lot of other questions posted about matching unescaped quotes, but I'm struggling to implement my specific case.
Some example text:
```
"the Five Aggregates (from Sanskrit \"skandha\") (Buddhism)"
```
I want to match the whole pattern with something like
```
\"[^"... | 2020/07/14 | [
"https://Stackoverflow.com/questions/62904386",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10326441/"
] | That's probably because the element scrolling is not the body. Take as example this snippet. I am binding the scrolling to the body, but since the element scrolling is the and not the body, the element won't be triggered. You should check out your style and your dom.
```js
document.body.addEventListener('scroll', () =... | i faced this problem during last project you need to fill the quotation of html
the solution is
```js
import HomeModule from "./home";
HomeModule.init();
document.getElementById("app").innerHTML = `<div class="page__inner"><main class="main main_width-limit"><header class="main__header"><div class="main__he... |
4,634,376 | Is there any way to use regex match on a stream in python?
like
```
reg = re.compile(r'\w+')
reg.match(StringIO.StringIO('aa aaa aa'))
```
And I don't want to do this by getting the value of the whole string. I want to know if there's any way to match regex on a srtream(on-the-fly). | 2011/01/08 | [
"https://Stackoverflow.com/questions/4634376",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/492162/"
] | This seems to be an old problem. As I have posted to a [a similar question](https://stackoverflow.com/questions/13004359/regular-expression-on-stream-instead-of-string), you may want to subclass the Matcher class of my solution [streamsearch-py](https://github.com/gitagon/streamsearch-py) and perform regex matching in ... | The answers here are now outdated. Modern Python `re` package now supports [bytes-like](https://docs.python.org/3/glossary.html#term-bytes-like-object) objects, which have an api you can implement yourself and get streaming behaviour. |
99,930 | I typically do 5 or 6 minute long exposure with digital.
With film, technical specs usually go up to 2 minutes. Is the formula available for computing longer exposure? | 2018/07/12 | [
"https://photo.stackexchange.com/questions/99930",
"https://photo.stackexchange.com",
"https://photo.stackexchange.com/users/8312/"
] | The information you require is available on the Ilford website:
<https://www.ilfordphoto.com/wp/wp-content/uploads/2017/06/Reciprocity-Failure-Compensation.pdf>
It differs depending on the film in use, and as always, reciprocity and "correct" exposure are a little inexact, but there are factors listed there to help ca... | In short, you can expose film as long as you want - multiple hours, if you like - but colour may shift (on colour film) and you may not see a doubling of time equal one stop of additional exposure (*reciprocity failure*). As mentioned in the other posts, Ilford will have a table and some guidelines as to how its films ... |
28,780,422 | The aim is to have skeleton spec `fun.spec.skel` file which contains placeholders for `Version`, `Release` and that kind of things.
For the sake of simplicity I try to make a build target which updates those variables such that I transform the `fun.spec.skel` to `fun.spec` which I can then commit in my github repo. Th... | 2015/02/28 | [
"https://Stackoverflow.com/questions/28780422",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/188533/"
] | Assuming the implied question is "How would I do this?", the common answer is to put placeholders in the file like `@@VERSION@@` and then `sed` the file, or get more complicated and have autotools do it. | I found two ways:
a) use something like
```
Version: %(./waf version)
```
where `version` is a *custom* `waf` target
```
def version_fun(ctx):
print(VERSION)
class version(Context):
"""Printout the version and only the version"""
cmd = 'version'
fun = 'version_fun'
```
this checks the version a... |
53,375,545 | j is destroyed when the function calls return
k is destroyed at the end of the enclosing brackets
If i pass in 9 for j, k is created and will be assigned 81
Returning k will set func1 which is a reference to an integer = k
Returning will immediately terminate the function
My question is, are k and j terminated at ... | 2018/11/19 | [
"https://Stackoverflow.com/questions/53375545",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10466720/"
] | >
> and it works...
>
>
>
No, it *appears* to work. The moment you try to access the reference returned by `func1` you enter the Undefined Behavior realm. At that point all bets are off, it could've printed out 42, printed out nothing, crash, eat your CMOS battery etc. | >
> If they are func1 should reference nothing...
>
>
>
You are correct. Try using the reference some more time and you will see:
```
#include <iostream>
int& func1(int j) {
int k = j * j;
return(k);
}
int main() {
int& addr = func1(9);
for (int i = 0; i < 10; ++i) {
std::cout << addr <... |
34,633,064 | I want to have articles next to each other, as much as the browser width allows it. Each article has a fixed width. This attempt does not work each span takes 100% width. I guess because the elements inside the spans are making the trouble, but how to fix this?
```css
span {
width: 200px;
}
```
```html
<span>
<... | 2016/01/06 | [
"https://Stackoverflow.com/questions/34633064",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2420037/"
] | Best thing is to wrap `inline` elements inside `block` elements
best option is to use a `div` element which is `block` which takes a full `width` by default once you add a width it will work perfectly
```css
div {
border: 1px solid red;
/*width:200px*/
}
```
```html
<div>
<h2>Article 1</h2>
<p>Content f... | Add `display: block;` to your span's class, or better use div.
Also check this article on w3c schools: [HTML Block and Inline Elements](http://www.w3schools.com/html/html_blocks.asp) |
6,621,591 | I am converting my HTC file to jquery plugin.
In my HTC file i am using below Microsoft.Fade.
```
progid:DXImageTransform.Microsoft.Fade(duration=0.15,overlap=1.0)
```
It is IE only thing. So i want optional thing for other browsers.
Is there any optional thing for this. | 2011/07/08 | [
"https://Stackoverflow.com/questions/6621591",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/834818/"
] | Use the fadeOut or fadeIn function:
<http://api.jquery.com/category/effects/fading/> | On jQuery, There are several option to fade.
To certain opacity level, on certain time.
```
$("div").fadeTo(1000, 15);
```
or fade Out completely
```
$("#div").fadeOut(1000);
```
or fade in
```
$("#div").fadeIn(1000);
``` |
202,749 | I've got an USB pen drive and I'd like to turn it into a bootable MBR device. However, at some point in its history, that device had a GPT on it, and I can't seem to get rid of that. Even after I ran `mklabel dos` in `parted`, `grub-install` still complains about
```
Attempting to install GRUB to a disk with multiple ... | 2015/05/11 | [
"https://unix.stackexchange.com/questions/202749",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/20807/"
] | If you don't want to fiddle with `dd`, `gdisk` can do:
```
$ sudo gdisk /dev/sdb
GPT fdisk (gdisk) version 0.8.8
Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present
Found valid GPT with protective MBR; using GPT.
Command (? for help): ?
b back up GPT data to a file
<snip>
... | You could do it with [`wipefs`](http://manpages.ubuntu.com/manpages/bionic/en/man8/wipefs.8.html):
>
> **wipefs** can erase filesystem, raid or partition-table signatures (magic strings) from the
> specified device to make the signatures invisible for libblkid. wipefs does not erase the
> filesystem itself nor any ... |
67,116,880 | I am not able to run project created under WSL2. I am getting this error. Does anyone have idea what could cause it?
```
Abnormal build process termination:
C:\WINDOWS\system32\wsl.exe --distribution Ubuntu-20.04 --exec /bin/sh -c "cd /home/jakub/.cache/JetBrains/IntelliJIdea2021.1/compile-server && /usr/lib/jvm/java... | 2021/04/15 | [
"https://Stackoverflow.com/questions/67116880",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12804925/"
] | In my case, setting correct Shell path of WSL 2.0 distro in Intelij's terminal settings path helped. Instead of `wsl.exe` set whole path for your distro ( I took path from [Windows Terminal](https://learn.microsoft.com/en-us/windows/terminal/install)).
In my case, when I'm using Ubuntu 20.04, changing from `wsl.exe` t... | Had the same issue.
All the mentioned PowerShell commands, including the ones on the JetBrains site, didn't really help.
But what eventually did the trick was that Windows Defender's "Inbound Rules" panel. Had to just find all the Restrictive rules (i.e. the ones with "Action: Block") for both "idea64.exe" and "Intell... |
19,737,692 | I have a NSArray of NSDictionaries, in this array there are several values which I do not want to show in the UITableView, I would like to know how to avoid returning these cells in the **tableView:cellForRowAtIndexPath:**
I have tried to `return nil;` but this has caused me errors.
This is what my code looks like
`... | 2013/11/02 | [
"https://Stackoverflow.com/questions/19737692",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/748343/"
] | This method must return a cell. It cannot return nil. The best thing to do is filter your list before you load your table and use the filtered array when dequeueing cells. | The UITableView is only asking for a cell because you told it to ask. Your implementation of the [UITableViewDataSource](https://developer.apple.com/library/ios/documentation/uikit/reference/UITableViewDataSource_Protocol/Reference/Reference.html#//apple_ref/occ/intf/UITableViewDataSource) protocol implements the two m... |
3,968,197 | Hi I'm a grad student and I was re reading the lecture notes my professor from a previous semester posted for algebraic number theory.
The lecture notes state: "If $O\_K$ is a number field and $I$ is an ideal of $O\_K$, then $N(I)$ is defined as $N(I) = |O\_K : I|$."
I took this definition to mean, if $N(I) = n$ then... | 2020/12/31 | [
"https://math.stackexchange.com/questions/3968197",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/723878/"
] | As pointed out in the comments, $f$ is not continuous at $4$, since $\lim\_{x\rightarrow 4^{-}}f(x)=-8\neq f(4)$. Recall that $x\in D(f)$ is an isolated point of the domain if there exists $\delta> 0$ such that $[(x-\delta,x+\delta)\setminus \{x\}]\cap D(f)=\emptyset$. Check that this is not the case.
Now, differentia... | The (one-sided) derivative at $4$ would be
$$ \lim\_{x\to 4} \frac{f(x) - f(4)}{x-4} = \lim\_{x\to 4} \frac{-2x - 8}{x-4} = \lim\_{x\to 4}\left(-2- \frac{16}{x-4} \right)$$
which doesn't exist. So $f$ is not differentiable at $4$, nor is it continuous at $4$: $$\lim\_{x\to 4} f(x) = -8 \neq f(4).$$
In order to defin... |
30,046,608 | I´m using a `Button` and `CheckBox` in my code. I want when the button is clicked to make the checkboxes visible, but when I click on this button, then this error is coming in logcat: `NullExceptionPointer` .
Here is the code:
```
public class FriendListActivity extends Activity {
SimpleCursorAdapter adapter;
... | 2015/05/05 | [
"https://Stackoverflow.com/questions/30046608",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4748373/"
] | `chk` variable is `null` So use **findViewById** to initialize it.
```
chk= (CheckBox)findViewById(R.id.chk_id);
``` | You did not initialize check box in your code. Please insert following code in onCreate method.
```
chk=(CheckBox)findViewwByid(R.id.chk_frnd);
``` |
43,593 | I walked into work yesterday and 2 colleagues were leaving an office that I share with a male colleague. When I entered the office it had been transformed to a Fairy princess themed room ( I share the office with a male) The theme was only in his work space and definitely for his benefit.
What should I do about it?
... | 2015/04/02 | [
"https://workplace.stackexchange.com/questions/43593",
"https://workplace.stackexchange.com",
"https://workplace.stackexchange.com/users/33771/"
] | >
> What should I do about it?
>
>
>
Laugh, be part of the April 1 fun, then plan your "revenge" for next year.
Some offices have a culture of fun, and this sort of prank is perfectly appropriate. If your office is like that, the best thing is to go along with what appears like good, clean fun.
I've worked in co... | The answer to the subject question is "if you have to ask, ***NO***". Interfering with ANYONE else's productivity is more rude than funny, and abusing innocent bystanders is right out -- unless you are in a position to authorize the list time, in a company culture which will accept it, **and** you have something that's... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.