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 |
|---|---|---|---|---|---|
52,765,098 | I have a List of a person object. Now I want to remove an object and all I know is the instance variables of the object.
I mean I don't have the object, all I can do is create another object with same field values.
Obviously the new object can't be used to remove the original, since both are different.
A very silly ... | 2018/10/11 | [
"https://Stackoverflow.com/questions/52765098",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7382577/"
] | The [`Array.filter()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter) method passes the index (`i`) to the callback function, and you can use it to get the previous value from the array. To take the 1st item as well, I use the condition `!i`, which evaluated to `true` whe... | ```
let prevTs = -Infinity;
const result = data.filter((d) => {
const localResult = (d.timestamp - prevTs) > 240;
prevTs = d.timestamp;
return localResult;
});
```
Or you can use index arg in your filter callback:
```
data.filter((d, i) => {
if (!i) {
return true;
}
return (d.timestamp - data[i - 1].... |
50,558,470 | I have to problem when build. i add build firebase core 16.0.0, but when build, this is build firebase core 17.0.0. why it build 17.0.0.I check android
<https://firebase.google.com/docs/android/setup#available_libraries>, now version 16.0.0, i have to remove build project, but this is not success.
Can you help me? Th... | 2018/05/28 | [
"https://Stackoverflow.com/questions/50558470",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3584419/"
] | I have fix problem : import onesignal
```
buildscript {
repositories {
maven { url 'https://plugins.gradle.org/m2/'}
}
dependencies {
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.10.1'
}
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
repositories... | Remove `implementation 'com.google.firebase:firebase-core:16.0.0'`
and use`implementation 'com.google.firebase:firebase-database:10.0.0'` for firebase database, it will solve your problem. |
10,404,276 | I have a situation where lets say i'm trying to get the information about some food. Then I need to display all the information plus all the ingredients in that food.
With my query, i'm getting all the information in an array but only the first ingredient...
```
myFoodsArr =
[0]
foodDescription ... | 2012/05/01 | [
"https://Stackoverflow.com/questions/10404276",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/393373/"
] | One obvious solution is to actually perform two queries:
1) get the food
```
SELECT a.foodId, a.foodName, a.foodDescription, a.typeOfFood
FROM `foods` a
WHERE a.foodsId=4
```
2) get all of its ingredients
```
SELECT c.ingredient, c.ingAmount
FROM `foods_ing` c
WHERE c.foodsId=4
```
This approach has the advantag... | When you compare MySQL's aggregate functions and GROUP BY behavior to SQL standards, you have to conclude that they're simply broken. You can do what you want in a single query, but instead of joining directly to the table of ratings, you need to join on a query that returns the results of the aggregate functions. Some... |
30,006,889 | I made a father class:
```
function MouseController(m,v) {
this.model = m;
this.view = v;
}
MouseController.prototype.mouseClick = function(x, y) {}
```
with two variables inside `this.model` and `this.view`.
Now I have a child class of this father:
```
DragController.prototype = new MouseController();
fu... | 2015/05/02 | [
"https://Stackoverflow.com/questions/30006889",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1501582/"
] | Ensure MouseController inherits from DragController properly.
```
DragController.prototype = MouseController.prototype;
```
Then use:
```
this.model
this.view
```
The properties are inherited :-)
Make sure the arguments are passed to the base class:
```
function DragController(m, v) {
MouseController.call(t... | When you make the call `MouseController.call(this)` inside the `DragController`'s constructor, you are setting the newly instantiated `DragController` object's (`this`) properties `model` and `view`.
So these properties are directly accessible through the current instance i.e. as `this.model` and `this.view`.
Of cour... |
32,504,097 | I've installed OpenShift Version 3 on CentOS7.
I followed the official documentation:
<https://docs.openshift.org/latest/admin_guide/install/prerequisites.html#configuring-docker-storage>
method 1 (Docker):
<https://docs.openshift.org/latest/getting_started/administrators.html#installation-methods>
I chose to instal... | 2015/09/10 | [
"https://Stackoverflow.com/questions/32504097",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4525448/"
] | You should store your states unique identifiers in a dictionary. Then, access the values of that object for each line of `csv_file.csv`.
```
import csv
reader_csv = csv.reader(open('csv_file.csv', 'r')) # no b flag for python3
file_write = open('output.csv', 'a')
writer = csv.writer(file_write)
# Dictionary construc... | ```
import csv
with open('state.csv') as csvfile:
reader = csv.DictReader(csvfile)
states = {row.get('state_id'): row.get('state_name') for row in reader}
with open('csv_file.csv') as csvfile:
reader = csv.DictReader(csvfile)
with open('output.csv', 'wb') as outfile:
fieldnames = ['state_name... |
16,267,053 | So, basically I have a very large array that I need to read data from. I want to be able to do this in parallel; however, when I tried, I failed miserably. For the sake of simplicity, let's say I have an array with 100 elements in it. My idea was to partition the array into 10 equals parts and try to read them in paral... | 2013/04/28 | [
"https://Stackoverflow.com/questions/16267053",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2073001/"
] | Your code has two issues: Your child processes share no data, and you would have a race condition if forked processes would share data. The solution is to `use threads`. Any possibility for race conditions can be eliminated by partitioning the data in the parent thread, and of course, by not using shared data.
### Thr... | So, after my struggle, here's the fix:
EDIT: THIS DOES NOT ACCOMPLISH WHAT I WANTED TO DO
```
#!/usr/local/roadm/bin/perl
use strict;
use warnings;
use Time::HiRes;
use Parallel::ForkManager;
print "Starting main program\n";
my @array=();
my $counter=0;
my $start = Time::HiRes::time();
my $max_processes=20;
my $part... |
5,892,912 | I have a MVC 3 project in which I use \_Layout.cshtml as master page in all web pages. Now I want to remove this master page (layout) from one of the page (progress.cshtml). So I removed the removed the top portion of the page which was
```
@{
ViewBag.Title = "Progress";
Layout = "~/Views/Shared/_Layout.cshtm... | 2011/05/05 | [
"https://Stackoverflow.com/questions/5892912",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/287100/"
] | Set the layout= null to remove the default layout inheritance in that view | ```
@{
ViewBag.Title = "Progress";
Layout = null;
}
``` |
29,350,634 | This is perhaps a naive question from iOS newbie.
I see that typical iOS application main.m has following code:
```
int main(int argc, char * argv[]) {
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}
```
What is the point of having autorelea... | 2015/03/30 | [
"https://Stackoverflow.com/questions/29350634",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1223747/"
] | Currently, with LLVM compiler every thread has an autorelease pool by default and this is not needed. If you use a different compiler with a different implementation for autorelease pools (they are now a language feature), you are required to set up an autorelease pool for every thread. It doesn't matter that the call ... | From [Using Autorelease Pool Blocks](https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmAutoreleasePools.html):
>
> Cocoa always expects code to be executed within an autorelease pool block, otherwise autoreleased objects do not get released and your application leaks memory.... |
6,370,737 | Im trying to get my head around javascript inheritance and this code doesnt work cant see why:
```
function Animal(){
this.hasfur = true;
}
function Cat(){
this.sound = "Meow";
}
$(document).ready(function(){
Cat.protptype = new Animal();
var myCat = new Cat();
console.log(myCat.hasfur);
}
```
T... | 2011/06/16 | [
"https://Stackoverflow.com/questions/6370737",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/223863/"
] | You can change it using the cursor class programtically, like this,
```
this.Cursor = Cursors.WaitCursor;
```
To change it back to normal,
```
this.Cursor = Cursors.Default;
``` | how about using Cursor property of the form?
```
this.Cursor = System.Windows.Forms.Cursors.No;
``` |
45,430,067 | I am new in angular 4 and i am getting `[ts] Cannot find name 'model'` error in
my angular 4 project. kindly help to me where is my mistake.
Thanks in advance.
```
import { Component, OnInit } from '@angular/core';
import { Customer } from './customer';
@Component({
selector: 'app-customer-profile',
templa... | 2017/08/01 | [
"https://Stackoverflow.com/questions/45430067",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | You should not use `Task.Run` or `Task.Factory.StartNew`. It seems you don't actually understand what async is. Namely, it's *not* parallel processing. All async does is allow the running thread to be returned to the pool if it enters a wait-state. Threads are generally a limited commodity; they have overhead and consu... | You should not mix `Task.Factory.StartNew` with `async-await`. Use `Task.Run` instead.
* [Task.Run vs Task.Factory.StartNew](https://blogs.msdn.microsoft.com/pfxteam/2011/10/24/task-run-vs-task-factory-startnew/)
But, since it's an ASP.NET application, by doing async over sync, you're just switching from one thread p... |
20,513,680 | How to insert today date in mysql using php.date format is like `Dec-10-2013`.i tried
```
$sql="insert into tbl_name (colm1,colm2) values (1,now())";
```
Here value inserted in colm2 is 2013-12-11. | 2013/12/11 | [
"https://Stackoverflow.com/questions/20513680",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | What you want to do is save your dates as TIMESTAMP or something similar. When you retrieve it, you can format it. You can insert your dates with 'NOW()' or a given format if they are different.
If you want to display the time, you can do: `new DateTime($row['my_date']);`
For inserting you can use the same method: `(... | I can see in your question that your db timezone format is `YYYY-MM-DD`
```
$date = date("Y-m-d", strtotime($yourDate));
$sql="insert into tbl_name (colm1,colm2) values (1,{$date})";
```
EDIT:
'Dec-10-2013' is known format for php, so you can do this `$yourDate = 'Dec-10-2013'`; |
34,842,211 | I have a repetitive task of calculating the average price of a product for each country. Price and country code (e.g., ES = Spain , TR = Turkey) are located in two different columns in my dataframe. How can I use a for-loop to iterate over the different countries?
```
# get price for ES only
ES = subset(training.data.... | 2016/01/17 | [
"https://Stackoverflow.com/questions/34842211",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | You have a split-apply-combine problem. Try something like:
```
aggregate(priceusd ~ destinationcountry, data = training.data.raw, FUN = mean)
```
As an example, from reproducible data:
```
> aggregate(Sepal.Length ~ Species, data = iris, FUN = mean)
Species Sepal.Length
1 setosa 5.006
2 versicolor... | You can use `dplyr` to do this.
```
library(dplyr)
training.data.raw %>%
group_by(destinationcountry) %>%
summary(avg = mean(priceusd)) # Avg computed for each group in destinationcountry
```
This will calculate the average for each group. |
60,606 | I am struggling to find a philosophical reason for believing in the axiom of power set, and I was hoping you can give me some justifications.
I am not looking for answers of the form "it's convenient to use power set axiom" or "why wouldn't it be true?", as my view of the mathematical world tends to be platonist. Just... | 2019/02/23 | [
"https://philosophy.stackexchange.com/questions/60606",
"https://philosophy.stackexchange.com",
"https://philosophy.stackexchange.com/users/31204/"
] | The power set axiom postulates: For any set X exists a set P(X) which comprises as elements exactly the subsets of X.
Hence the power set axiom acts as a tool to form new sets from existing ones, by fixing a certain defining property.
As one knows, not any defining property is admissible for defining new sets, see t... | After Russell's paradox (and others) the idea of "what a set is?" has changed! from the very broad idea of a set being an extension of a predicate (Frege), to a an entity that is constructed in a controlled step-wise manner in stages, beginning from some particular lower level objects, call them Ur-elements, then const... |
25,682 | I spent a fair bit of time riding in the lane, in traffic. In this situation, it seems that a brake light would be very useful: It's not always obvious when the vehicle ahead of you is slowing down, and I don't want to be rear-ended by someone who doesn't notice me slowing.
This intuition does not match reality. I was... | 2014/11/15 | [
"https://bicycles.stackexchange.com/questions/25682",
"https://bicycles.stackexchange.com",
"https://bicycles.stackexchange.com/users/4175/"
] | I ride my bike to work every day and also ride mountainbikes in my free time. I never had the feeling that cars might crash into my rear end, right turning cars (we're driving on the right side) and opening doors are a larger problem that cannot be fixed by tail lights.
However, there a another light missing from the... | Maybe not too visible to cars, but I think the following brake light is ideal if riding in a pace line on a group ride, for the price and weight it can't be beat. If something comes up you might need both hands on the brake levers and can't signal to riders behind.
<http://gizmodo.com/a-cheap-10-bike-brake-light-that-... |
47,435,066 | I'm using CodeIgniter, and I'm new at it, as I'm in web development.
I'm having a problem with the `base_url` from CI: it leads to `404 Page not found`.
Here is the referrence for the page:
```
<li><a href="<?=base_url('Usual/novo_usual')?>">Cadastrar</a></li>
```
The controller's function:
```
function novo_usual... | 2017/11/22 | [
"https://Stackoverflow.com/questions/47435066",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8989826/"
] | Following @Szarik recommendations, I follow [this link](https://github.com/angular/in-memory-web-api), which has the answer. Actually, it's the official specification of the Library I am using: in-memory-web-api
Diving a little in the README.md, we reach this:
>
> You can override the default parser by implementing ... | To examplify the answer above:
The 'forRoot' takes optional settings, and among these an 'apiBase'. To match an endpoint of
`private url = '/some/endpoint/responseExample';`
set the corresponding 'apiBase' without prefix and suffix slashes:
```
HttpClientInMemoryWebApiModule.forRoot(InMemoryDbItemService, { ap... |
1,671,314 | I live in a rural area with only two choices for Internet connection, 1.2 Mbit/s [DSL](https://en.wikipedia.org/wiki/Digital_subscriber_line) from AT&T or 15 Mbit/s from old-style satellites with 700 ms ping time and fast only in averages.
The fast connection is OK for web access, but the shorter lag time is necessary... | 2021/08/24 | [
"https://superuser.com/questions/1671314",
"https://superuser.com",
"https://superuser.com/users/1500023/"
] | I would opt for a multi-WAN router instead.
I've seen that these offer load-balancing support, but I'm not sure if that is customizable to send certain traffic across one network versus the other; you'll have to read into the router's documentation before buying one.
[This one](https://docs.netgate.com/pfsense/en/lat... | buy a load balance router (TL-R470T) and configure it for BINDING of two VLAN ports on the box. I am rural with hardly any phone signal, just 1 bar on phone 4G+ in some places outside.
Putting two sims in each 4G device and bonding them, I can get 93 mega bits per second down load and 19 upload.
I have 1 external passi... |
73,265,368 | I have been using the following UIView extension for quite a while to fade text in and out. I have been trying to figure out how to implement this with SwiftUI but so far haven't found anything that exactly addresses this for me. Any help would be greatly appreciated.
```
extension UIView {
func fadeKey() {
... | 2022/08/07 | [
"https://Stackoverflow.com/questions/73265368",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12323191/"
] | Please, remove CSS:
```
.MuiDrawer-paper {
width: 10% !important;
}
```
And update this line:
```
const drawerWidth = 240;
```
It can be "200px" or "10%", whatever you need. | If you inspect elements, you will see
```
<div class="MuiDrawer-root MuiDrawer-docked css-1f2xuhi-MuiDrawer-docked">
<div class="MuiPaper-root MuiPaper-elevation MuiPaper-elevation0 MuiDrawer-paper MuiDrawer-paperAnchorLeft MuiDrawer-paperAnchorDockedLeft css-12i7wg6-MuiPaper-root-MuiDrawer-paper">
```
`.MuiDrawer... |
67,715,506 | I have a long list of functions that needs to be executed based on user input
I want a way to do this **without a long if else statement**
Thanks in advance this will save a lot of time
```
def function1(a,b):
return a+b
def function2(a,b):
return a-b
.
.
.
there a are many functions like this
.
.
.
class ... | 2021/05/27 | [
"https://Stackoverflow.com/questions/67715506",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14561199/"
] | Set up a dictionary in the style `action = {'keyword1':function1,'keyword2':function2...}` then for user input `entry` you can check the input with `entry in action` and activate with `action[entry]()`. | Try using the [eval](https://www.programiz.com/python-programming/methods/built-in/eval) function:
```
names = {"function1": function1, "function2": function2 ...}
func = input('which function do you want to call')
print(eval(func, names))
``` |
126 | I'm a novice user, I've been playing with the RPi a lot lately but I haven't seen any questions that I can answer.
My only contribution so far is to up vote questions and comments I think are useful.
Is this helpful to a site in beta?
I will of course be asking questions when they crop up as well!
Am I helping the ... | 2012/06/16 | [
"https://raspberrypi.meta.stackexchange.com/questions/126",
"https://raspberrypi.meta.stackexchange.com",
"https://raspberrypi.meta.stackexchange.com/users/175/"
] | Yes!
====
Don't worry if you can't answer questions, just providing questions to be answered, when you have them, is often the thing a lot of betas struggle with most.
A lot of betas have an initial rush then a bit of a slump, especially on questions - so people who can post a steady stream of good, relevant question... | Yes.
Other things you can do:
* Suggest edits to existing questions & answers.
You gain +2 rep for each edit that is approved by the author.
* Flag spam and "me too" answers for moderation (you don't get rep for this, but you can get the [deputy](https://raspberrypi.meta.stackexchange.com/badges/70/deputy) and [marsh... |
3,386,897 | Strings that match /^\w+$/ are quite common. For example many authentication systems use that pattern to validate usernames. I'm wondering if a term exists that identifies this kind of strings.
I've been thinking of the term "alphanumeric" but is a string alphanumeric if it contains an underscore? | 2010/08/02 | [
"https://Stackoverflow.com/questions/3386897",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/200145/"
] | I do not think that it is a good idea to give it a potentially confusing name. Alphanumeric could be misunderstood. If you need to refer to it, for example in your documentation, define it with an unique name like 'username\_pattern', and refer to that definition of yours whenever you talk about it. | Personally, I’d call it “a string that matches `^\w+$`” if my audience knows what this means. That is probably the most succint “name” that doesn’t significantly sacrifice accuracy. If I had to *say* it, I might call it “a non-empty string containing only word characters”, but once again I need to assume that my listen... |
38,008,354 | I wrote a form where its fields need to be reset after successful submission. The entire flow happens through `ajax` and `php`. Here is the code:
**`HTML`**
```
<form role="form" class="contact-form" id="contact-fm" method="post">
<div class="form-group">
... | 2016/06/24 | [
"https://Stackoverflow.com/questions/38008354",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4185813/"
] | You don't need to have bunch of subscriptions and unsubscribe manually. Use [Subject](https://github.com/ReactiveX/rxjs/blob/6.x/doc/subject.md) and [takeUntil](http://xgrommx.github.io/rx-book/content/observable/observable_instance_methods/takeuntil.html) combo to handle subscriptions like a boss:
```js
import { Subj... | **A Subscription essentially just has an unsubscribe() function to release resources or cancel Observable executions.**
In Angular, we have to unsubscribe from the Observable when the component is being destroyed. Luckily, Angular has a ngOnDestroy hook that is called before a component is destroyed, this enables devs ... |
18,326,398 | How can I retrieve data from OpenStreetMap (OSM) using the OSM API (<http://wiki.openstreetmap.org/wiki/API>) and Ruby? Is there any ruby gem available which serves my purpose? I have been searching for a good solution for my purpose but nothing served me exactly what I need.
As for example : Given the country name as ... | 2013/08/20 | [
"https://Stackoverflow.com/questions/18326398",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/981183/"
] | Unfortunately, there's no concise syntax for constructing populated maps in Java. You'll have to write it out long-hand. A separate helper method can make it a little simpler:
```
HashMap<String, String> makeMap(String name, String desc, String keys) {
HashMap<String, String> map = new HashMap<>();
// Before J... | I really liked the example by "dAv dEv", though he didn't really fill his double array of keys (I added a loop within a loop). I also like TreeMaps better than HashMaps because they aren't as random.
```
import java.util.Map;
import java.util.TreeMap;
TreeMap<String, TreeMap<String, String>> myArray =
... |
2,014,915 | I've come across laplace transforms as a method to solve differential/integral equations by diagonalizing the derivative operator. I've also seen generating functions as a similar way to transform a recurrence relation into an algebraic problem by diagonalizing the shift operator. The laplace transform of a convolution... | 2016/11/15 | [
"https://math.stackexchange.com/questions/2014915",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/261268/"
] | The choice of the appropriate book depends on whether you are looking for basic or advanced references. For a basic approach, I would suggest you the following two books:
* "[An introduction to Transform Theory](http://store.elsevier.com/An-Introduction-to-Transform-Theory/isbn-9780080873558/)" (1971) by David V. Widd... | If you would like to study Laplace transform in depth, there is no better book than **Joel Schiff's book on Laplace Transform**: <http://www.springer.com/gp/book/9780387986982>
If you would like to study a large variety of transforms and see how they relate to each other I highly recommend
**Advanced Engineering Ma... |
8,024,529 | I am trying to scrape a website. I have been able to get the contents on the website into a string/file.
Now, I would like to search for a specific line that has something like:
```
<li><span class="abc">Key 1:</span> <span class="aom_pb">Value 1</span></li>
```
There is gauranteed to be only one Key 1: in the... | 2011/11/06 | [
"https://Stackoverflow.com/questions/8024529",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11212/"
] | You should use a parser such as [`lxml`](http://lxml.de/) to extract data from HTML. Using regular expressions for such a task is [A Bad Ideatm](http://www.codinghorror.com/blog/2009/11/parsing-html-the-cthulhu-way.html).
Lxml allows you to use XPath expressions to select elements, and in this case, the relevant "key"... | Another approach using BeautifulSoup: loop over the <li> elements, and check the <span>s inside them.
```
import BeautifulSoup
downloaded_str='''
<li><span class="abc">Key 0:</span> <span class="aom_pb">Value 1</span></li>
<li><span class="abc">Key 1:</span> <span class="aom_pb">Value 1</span></li>
<li><spa... |
24,239,497 | I'm trying to set a header for a webpage that looks like this:

and here's the code I'm trying so far:
**HTML**
```
<header id="top-section">
<div class="content-wrapper">
<div class="float-left">
<a href="../Home/Index"><img src="http://upload.wikimed... | 2014/06/16 | [
"https://Stackoverflow.com/questions/24239497",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2398715/"
] | Move
```
<p class="user-info">
<div class="user-info">
Welcome Jon
</div>
```
into our float-right div and give header the css style of
```
header{
overflow:hidden;
padding:10px;
}
```
to end up with this result.
<http://jsfiddle.net/P9Zjx/> | I'm not sure what dimensions you want to work with and whether this is supposed to be responsive, e.g. stacked on mobile devices, but this should help you get closer to what you want. I cleaned up the `code` a bit ...
**<http://jsfiddle.net/7VR85/2/>** |
34,095 | This is related to a question I asked earlier - <https://softwareengineering.stackexchange.com/questions/34023/how-to-end-a-relationship-with-a-client-without-pissing-them-off>
What are your obligations when charging by the hour vs charging by project? If you agree to take on a project, give a rough estimate that it m... | 2011/01/06 | [
"https://softwareengineering.stackexchange.com/questions/34095",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/12490/"
] | >
> If you agree to take on a project... work on and charge £X per hour - are you obligated to work for free after those 10 days are up and you have still not managed to complete your project due to unanticipated issues?
>
>
>
No. £X per hour is £X per hour. Clearly, you've never had complex jobs done on your home... | Legal reasons aside, this is a service business after all and you live and you die by references. It can only take one bad one to give you a bad rep. I can only take one really satisfied customer to give you lot's of other work. So apply the golden rule, treat your customer as you'd like to be treated, within reason. P... |
94,615 | I have only one VPS with Windows Server 2008 R2 x64 and want to buy an Antivirus. I tried NOD32 but they do not give less than 5 users in business edition (I have only one server). Kaspersky may be another solution but whether should i go for Internet Security or Anti-virus?
I have few website hosted on this server an... | 2009/12/15 | [
"https://serverfault.com/questions/94615",
"https://serverfault.com",
"https://serverfault.com/users/-1/"
] | I always liked ClamWin. May or may not meet your requirements though. It doesn't scan everything all the time, so performance is better, but that might be something you need. Interestingly enough, I see it performed horribly on an AV "roundup" test a few months ago, but the previous year it was a top performer. Not sur... | Personally I like AVG, and you can buy it on a per machine basis. The only downside is that from time to time when they update their scanner it requires a machine reboot so you have to schedule those for convenient times. |
145,231 | I've recently heard somebody answered "Yes, perhapsy."
Or could it be "perhapsee"?
Could this be used as a slang term for "perhaps"?
It happened in NYC area a few weeks ago. | 2014/01/09 | [
"https://english.stackexchange.com/questions/145231",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/22953/"
] | It sounds like a contraction of *perhaps so*
>
> A: Did they know where she was?
>
> B: Perhaps so --> Perhapsy
>
>
> A: Will he pass?
>
> B: Perhaps so --> Perhapsy
>
>
>
A possible spelling variation might be: *perhapsi* rather than *perhapsee*. It also reminds me of *pepsi*. Words ending in double e ... | I would say it's most likely to be a personal or family idiom rather than slang. Some people like to play with language and come up with their own variants. For example, my own family calls milk "bookum bookum" (long story).
Yes, sometimes a term like that will catch on and become slang for a community (whether large... |
259,639 | I have noticed that when riding in a train travelling at over 100 kmh$^{-1}$, a loud 'slap' can be heard when another train travelling at a similar speed passes in the opposite direction, followed by 'whooshing' as air is sheared between the two trains.
I was wondering what the source of this initial 'slapping' sound ... | 2016/06/03 | [
"https://physics.stackexchange.com/questions/259639",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/105680/"
] | I hear this regularly. I think its a combination of the effects above. The first effect is a front of compressed air being forced ahead of each of the trains. But then, as the fronts of the trains meet and pass, the Bernoulli effect leads to *lower* pressure between the trains. But this isn't uniform, each carriage has... | It is worth to mention two things.
1. Sound is pressure wave traveling in air.
2. When train is in motion, it brings motion to the air by the train. And when air velocity increases, the air pressure decreases based (can be seen in Bernoulli equation).
When two trains move opposite to each other, the air flow is enou... |
50,306,020 | I want to replace a string by removing the s in the end
Example
```
Sticks -> Stick
STiCKs -> STiCK
StICks -> StICK
sticks -> stick
```
while using the
```
string.replace("sticks", "stick");
```
doesn't maintain case as it is case sensitive, so I'm seeking for a better option. | 2018/05/12 | [
"https://Stackoverflow.com/questions/50306020",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8189364/"
] | You could use a very simple regex for this mission.
`(?i)` guarantees that your regex will be treated case insensitive
[**Demo : `(?i)(stick)s`**](https://regex101.com/r/SwTTCP/1/)
[**Ideone Java Demo**](https://ideone.com/SGFWdR)
```
string.replaceAll("(?i)(stick)s", "$1");
``` | I don't really get why all the answers so far are so complex. You can just check the last character and if it's a `s` (or `S`) you use `String#substring` ([documentation](https://docs.oracle.com/javase/10/docs/api/java/lang/String.html#substring(int,int))) and leave out the last character:
```
String text = "STiCks";
... |
4,633,053 | In the quadrilateral ABCD, side AD is equal to side BC, and lines AD and BC intersect at point E. Points M and N are the midpoints of sides AB and CD, respectively. Prove that the segment MN is parallel to the bisector of $\angle{AEB}$
This has a very "easy" synthetic solution which involves constructing the midpoint ... | 2023/02/05 | [
"https://math.stackexchange.com/questions/4633053",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/1089102/"
] | Since $(1+x)^n = \sum\_{k=0}^n \binom{n}{k}x^k$, differentiate twice to get
$$n(n-1)(1+x)^{n-2} = \sum\_{k=2}^n k(k-1)\binom{n}{k}x^{k-2}$$
Substituting $n+1$ for $n$ we also get
$$(n+1)n(1+x)^{n-1} = \sum\_{k=2}^{n+1} k(k-1)\binom{n+1}{k}x^{k-2}.$$
Substitute $x=1$ in each of these, giving
\begin{align\*}
n(n-1)2^{n-2... | Start with
$$
(1+x)^n=\sum\_{k=0}^n \binom nk x^k
$$
First, multiply both sides by $x$:
$$
x(1+x)^n=\sum\_{k=0}^n \binom nk x^{k+1}=\sum\_{k=1}^{n+1}\binom{n}{k-1}x^k
$$
*Now* you can differentiate twice, then set $x=1$, to recover your sum.
$$
\frac{\mathrm d^2}{\mathrm dx^2}\,x(1+x)^n=\sum\_{k=1}^{n+1}\binom{n}{k-1}\... |
31,013,807 | I have a working function implementation in `c` that requires a large locally allocated chunk of memory as a working space. This function gets called a lot in succession where it is guaranteed that the required amount of working space does not change. To optimize the function I have refactored it to allocate a static s... | 2015/06/23 | [
"https://Stackoverflow.com/questions/31013807",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1628893/"
] | If it is guaranteed that the required working space will not be changing during contiguous function calls (as you mentioned), to me it seems the simplest solution would be to use a static array (somewhat similar to your C code, but using 'new' and 'delete[]' instead of 'calloc' and 'free'). | static is a dreadful thing because it plays really badly with thread safety and is wholly unnecessary.
The modern way is one of the following:
Declare the memory further up on the stack. vector<> or array<> or even malloc if you like. Pass a pointer (or, equivalently, reference) to this memory into your function.
... |
21,362,257 | This is the code I am using within my html file
```
<? if (empty($_POST["name"]) || empty($_POST["gender"]) || empty($_POST["dorm"]): ?>
You must provide your name, gender, and dorm! Go <a href="froshims2.php">back</a>.
<? else: ?>
You are registered! (Well, not really.)
<? endif ?>
```
I get a error saying:
... | 2014/01/26 | [
"https://Stackoverflow.com/questions/21362257",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1681338/"
] | Missing closing bracket on this line
```
<? if (empty($_POST["name"]) || empty($_POST["gender"]) || empty($_POST["dorm"]): ?>
```
Should be
```
<? if (empty($_POST["name"]) || empty($_POST["gender"]) || empty($_POST["dorm"])): ?>
```
note the last bracket after `$_POST['dorm']` | you are missing one `)` at the end of your if statement and a semicolon after `endif`:
```
<? if (empty($_POST["name"]) || empty($_POST["gender"]) || empty($_POST["dorm"])): ?>
You must provide your name, gender, and dorm! Go <a href="froshims2.php">back</a>.
<? else: ?>
You are registered! (Well, not really.)
<... |
2,052,684 | Hey, my friends and I are trying to beat each other's runtimes for generating "[Self Numbers](http://en.wikipedia.org/wiki/Self_number)" between 1 and a million. I've written mine in c++ and I'm still trying to shave off precious time.
Here's what I have so far,
```
#include <iostream>
using namespace std;
bool v[1... | 2010/01/12 | [
"https://Stackoverflow.com/questions/2052684",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/131383/"
] | Generate the numbers once, copy the output into your code as a gigantic string. Print the string. | Since the range is limited (1 to 1000000) the maximum sum of the digits does not exceed 9\*6 = 54. This means that to implement the sieve a *circular buffer of 54 elements* should be perfectly sufficient (and the size of the sieve grows very slowly as the range increases).
You already have a sieve-based solution, but ... |
28,958,973 | I have a little problem that I'd love to solve on my website.
Have a look at this JSFIDDLE — <https://jsfiddle.net/sm25t089/>
This is the javascript code:
```
$(document).ready(function () {
$(".bottoni").hide();
$(".reveal").click(function () {
$(this).toggleClass("active").next().slideToggle(200, "linear");
... | 2015/03/10 | [
"https://Stackoverflow.com/questions/28958973",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2175150/"
] | here is one solution using css3
```
transition:0.3s;
```
<https://jsfiddle.net/sm25t089/1/>
if you prefer using only ccs2 then you can do the same with a jquery animate | You can use the jQuery method **[.animate()](http://api.jquery.com/animate/)**
```
(function($) {
$(document).off("click.slide").on("click.slide", ".reveal", function (e) {
var $self = $(this),
$menu = $(".bottoni"),
isActive;
e.preventDefault();
$self.toggleClass("a... |
17,033,694 | Following a Microsoft hands-on lab for Dynamics CRM 2011, I am attempting to add a custom view to a form that responds 'onchange' to a particular property. Here is my function to add the custom view:
```
function HandleOnChangeDVMInformationLookup()
{
var locAttr = Xrm.Page.data.entity.attributes.get("new_referringdvm... | 2013/06/10 | [
"https://Stackoverflow.com/questions/17033694",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1144073/"
] | I had the same error message with the customerAddress entity.
Turns out I referenced the entity as `"customerAddress"` (note the camel case).
But CRM wants logical names of entities and attributes in all lower case. So `"customeraddress"` did work. | Check if you are connecting to correct org (web.config?)
[See](https://community.dynamics.com/crm/f/117/t/208316) |
632,854 | I wanted to calculate the inverse function of
$$
f(x) = \frac{1}{x} + \frac{1}{x-1}
$$
Quite simple I thought, put
$$
y = \frac{1}{x} + \frac{1}{x-1} = \frac{2x-1}{x(x-1)}
$$
rearrange and solve
$$
y(x(x-1)) - 2x + 1 = 0
$$
which give the quadratic equation
$$
yx^2 - (y + 2)x + 1 = 0
$$
Using the [Solution Formula... | 2014/01/09 | [
"https://math.stackexchange.com/questions/632854",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/33817/"
] | Nothing wrong with your answer! Actually Wolfram's answer is wrong! Just check it by $x=3/2$ in wolfram's inverse. | Your error is in the solution formula. You have $(y+2)^2 - 4\cdot y\cdot 1 = y^2+4 \neq (y+2)(y-2)$. It would be $y^2-4 = (y+2)(y-2)$. |
11,856,036 | In an Android book I have it says that themes can be applied to and entire activity or an entire application. It doesn't show how but the Android docs say to simply put the theme statement into the androidmanifest.xml file like so....
```
<application android:icon="@drawable/ic_launcher">
<activity android:theme="... | 2012/08/08 | [
"https://Stackoverflow.com/questions/11856036",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1058647/"
] | See [this fiddle](http://jsfiddle.net/94RuA/2/)
You must do the job in the `change` event.
then calling `.trigger('change')` on the check boxes make the div show/hide on the initial page load.
The code :
```
$(document).ready(function(){
$('input#upload_yes').change(function(){
if($(this).is(':checked'... | You aren't binding this code to the proper event:
```
$(document).ready(function() {
$("#upload_yes").on('change', function() {
if ($(this).is(':checked')) {
$("#upload_form").show();
$("#new_info_form").slideDown(500);
} else {
$("#upload_form, #new_info_form").hide();
}
});
});
``... |
24,060,016 | We have a requirement where we need to crawl one particular set of URLs.
Say for example we have site abc.com. We need to crawl abc.com/test/needed -- all URL matching this pattern under "needed" folder. But we don't want to crawl rest of the URLs under abc.com/test/.
I guess this will be done using RegEx. Can anyone... | 2014/06/05 | [
"https://Stackoverflow.com/questions/24060016",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1085906/"
] | You need to call (P/Invoke) `WinVerifyTrust()` function from `wintrust.dll`. There is (as far as I know) no alternative in managed .NET.
You can find documentation of this method [here](http://msdn.microsoft.com/en-us/library/aa388208.aspx).
Someone already asked this question on SO. It was not accepted, but it shoul... | To validate the integrity of the signed .exe file, we can use StrongNameSignatureVerificationEx method:
```
[DllImport("mscoree.dll", CharSet = CharSet.Unicode)]
public static extern bool StrongNameSignatureVerificationEx(
string wszFilePath, bool fForceVerification, ref bool pfWasVerified);
var assembly ... |
45,934,970 | My question is "Is there a way to avoid sending callbacks deep in the tree when I want to access/react upon child components data".
I have a component `Application` that contains a child component `Person` which in turn contains a child component `TraitCollection` which in turn contains a child component `Trait`.
Whe... | 2017/08/29 | [
"https://Stackoverflow.com/questions/45934970",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4958802/"
] | The way you are handling it is the **recommended** way and the most React-like. There is nothing wrong with that approach by itself other than the problem you have found. It looks like [Redux](http://redux.js.org/docs/introduction/) could help you solve that problem. Redux lets you unify the state of your React applica... | To avoid **Deep** `Callbacks`, according to [React](https://reactjs.org/docs/hooks-faq.html) documentation, [useReducer](https://reactjs.org/docs/hooks-reference.html#usereducer) via `context` as below:
**How to avoid passing callbacks down?**
We’ve found that most people don’t enjoy manually passing `callbacks` thro... |
69,036,319 | I just started to learn python yesterday so complete noob. I have about 10 hours javascript experience to but had to switch since I'm learning Python in college. I decided to try make a program by myself since I learn a lot better doing that instead of countless videos.
The major problem I'm having is saving my variab... | 2021/09/02 | [
"https://Stackoverflow.com/questions/69036319",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16817699/"
] | Since `balance` is local to the function `playgame()` every time the function is called, the variable will be reset. You can fix this problem a couple of ways. You can make `balance` a global variable, or you can add a loop where the function doesn't return after one execution. The second example I gave would look some... | The first thing `playgame` does is set your balance to 2000, so it's always going to be 2000 at the beginning of a game. This is happening because you restart a new game by calling `playgame()` *from within `playgame`.* This is called recursion. It's a powerful tool that has a lot of uses, but this is probably not the ... |
7,458,291 | I have an AutoCompleteTextView in my layout. I also have an alternative way to select the same items which are present in the AutoCompleteTextView. When the alternative way is selected, I populate the value in the AutoCompleteTextView via:
```
autoCompleteTextView.setText(valueFromAlternativeSource);
```
where `valu... | 2011/09/17 | [
"https://Stackoverflow.com/questions/7458291",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/296108/"
] | If you want to support API<17, Subclass AutoCompleteTextview and override `setText(text, filter)` method
```
@Override
public void setText(CharSequence text, boolean filter) {
if(Build.VERSION.SDK_INT>=17) {
super.setText(text, filter);
}else{
if(filter){
setText(text);
}els... | ```
autoCompleteTextView.setText(valueFromOtherMeans, filter);
* @param filter If <code>false</code>, no filtering will be performed
* as a result of this call.
``` |
124,454 | The Gemmorah teaches us that we could learn basic morality from the animal kingdom ([Eruvin.100b.29, see also 28](https://www.sefaria.org.il/Eruvin.100b.29?vhe=William_Davidson_Edition_-_Vocalized_Aramaic&lang=bi&with=Rashi&lang2=en)):
>
> אָמַר רַבִּי יוֹחָנָן: אִילְמָלֵא לֹא נִיתְּנָה תּוֹרָה, הָיִינוּ לְמֵידִין צְ... | 2021/07/28 | [
"https://judaism.stackexchange.com/questions/124454",
"https://judaism.stackexchange.com",
"https://judaism.stackexchange.com/users/15579/"
] | Note: The following is my opinion and is based primarily from the written Torah.
The Bible seems to take it for granted that animals naturally have some form of morality, wisdom/understanding, and holiness. In the story of Gan Eden the serpent is called the "most wise" of the animals, as if other animals are wise and ... | In regards to the basic question, the Ben Yohada on that Gemara mentions in passing that these traits are natural to these species
>
> ונמצא דלמדין צניעות משני מדות טבעיות שבו
>
>
> |
21,239,137 | I've been breaking my head over the following problem.
I've got this array:
```
[596] => 2
[9] => 2
[358] => 2
[1579] => 1
[156] => 1
[576] => 1
[535] => 1
```
As you can see, the values are ordered in a descending way, but the keys are random. I would like to keys to be sorted DESC as well though. I've been playin... | 2014/01/20 | [
"https://Stackoverflow.com/questions/21239137",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1796440/"
] | place conditions touch down, touch up, and touch move in onTouchArea of sprite as follows:
```
public boolean onAreaTouched(TouchEvent event,float X,float Y){
if (event.getAction() == MotionEvent.ACTION_DOWN) {
spr.registerEntityModifier(new MoveXModifier(0.5f,spr.getX(),spr.getX... | It is better to use a PhysicsHandler to move the sprite with a velocity.Modifiers are not accessible until they finished, that is why your sprite wont again go further even you pressed the button.
Else if u want just simple continuous Movement u can simple increment the position of sprite.
```
@Override
... |
73,576 | If I select Radiance or Ambiance in the menu show in the following picture, my whole theme does not change. It only changes the title bar.
How can I resolve this problem? Or how can I reset the theme to default? | 2011/10/29 | [
"https://askubuntu.com/questions/73576",
"https://askubuntu.com",
"https://askubuntu.com/users/25456/"
] | Removing the file ~/.config/dconf/user solves the problem.
PS: To reconstruct the problem I made the following steps:
change in the file /etc/lightdm/unity-greeter.conf the line
```
font-name=Ubuntu 11
```
to
```
font-name=Ubuntu 10
```
and after saving run the command
```
lightdm --test-mode
```
That was ... | I had the same issue in Ubuntu 13.04. I just installed the [gnome-tweak-tool ](https://apps.ubuntu.com/cat/applications/gnome-tweak-tool) and changed the current theme under theme menu. It solved this. |
5,155,379 | I have a html snippet below which renders perfectly in all browsers. However in webkit on an iphone and ipad, when I pinch the page (so that its smaller), I see a black border which is the background color of the body shining through only on the right edge. This only happens when I specifiy the width of the .headerpic ... | 2011/03/01 | [
"https://Stackoverflow.com/questions/5155379",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/541744/"
] | In my case using:
```
<meta name="viewport" content="width=device-width, initial-scale=1.0">
```
Instead of:
```
<meta name="viewport" content="width=device-width">
```
Did the trick! | In my case this :
```
<meta name="viewport" content="width=device-width, initial-scale=1.0">
```
And :
```
html, body {min-width:980px; overflow-x: hidden;}
```
Fixes the problem. |
68,347,899 | I have got access token and expiry time as two columns in a JSON file after doing a POST request and stored the file in Blob storage.
Now I need to look inside the JSON file the I stored before and take the value of Access token and use it as a parameter to another REST request.
Please help... | 2021/07/12 | [
"https://Stackoverflow.com/questions/68347899",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16431805/"
] | Using `awk`:
```
var=$(curl -v ...|awk -F ':' '/^X-Subject-Token/ {print $2}')
echo "$var"
``` | ```sh
# read the _lines_ of the header into an array
mapfile -t header < <(curl --head ...)
declare -A values
for h in "${header[@]}"; do
if [[ $h =~ ^([^:]+):" "(.*) ]]; then
values[${BASH_REMATCH[1]}]=${BASH_REMATCH[2]}
fi
done
declare -p values
echo "${values[X-Subject-Token]}"
```
Sometimes head... |
58,379,079 | I'm working on a homework set and I need some help. I have a list that looks like this:
```
list = [1, 2, [3, 4], 5]
```
The problem is asking me to use list slicing to extract the last element of the nested list. Can someone help me with this? | 2019/10/14 | [
"https://Stackoverflow.com/questions/58379079",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12215024/"
] | ```
list_1 = [1, 2, [3, 4], 5]
new_list = [elem[-1] for elem in list_1 if isinstance(elem, list)]
print(new_list )
```
Output:
```
[4]
```
For getting the last element of a list please refer [here](https://www.geeksforgeeks.org/python-how-to-get-the-last-element-of-list/).
For list comprehension, see [here](https... | If you're just trying to get one element, then you just need to get the index of that element. In this case the external list has 4 elements:
`Index 0 1 2 3`
`Value 1 2 [3,4] 5`
The internal list has 2 elements:
`Index 0 1`
`Value 3 4`
So what you need to do is get the index of the internal list, `2`, and... |
31,318,333 | I am working on a project with directed graphs where the weight of the edges all depend on a variable x.
I'm trying to find the minimum value of x such that my graph does not contain any circuit of positive weight.
My question is -and it is probably pretty stupid but I don't see how- :
How can I use a modified Bellman... | 2015/07/09 | [
"https://Stackoverflow.com/questions/31318333",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5098619/"
] | thanks to everyone.my working answer is here
```
FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init];
[login logInWithReadPermissions:@[@"email"] handler:^(FBSDKLoginManagerLoginResult *result, NSError *error)
{
if (error)
{
// Process error
}
else if (result.... | Yes it is. You need to use `Facebook SDK` and it's `graph API`. You can take a look here:
[Getting started - Facebook SDK for iOS](https://developers.facebook.com/docs/ios)
Here is an example of code in Objective-C:
```
// For more complex open graph stories, use `FBSDKShareAPI`
// with `FBSDKShareOpenGraphContent... |
20,132,254 | I would like to create a select dropdown that contains all values from a column with each value only appearing once.
Is there a way to achieve this in JavaScript or jQuery assuming I have a basic HTML table and the column in question is columnA ? | 2013/11/21 | [
"https://Stackoverflow.com/questions/20132254",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2571510/"
] | ```
function getNthColumn(n) {
var data = [],
i,
yourSelect,
unique;
$("#yourTable tr td:nth-child("+n+")").each(function () {
data.push($(this).text());
});
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter
// Use ... | Plain Javascript, ES6, easy:
```
const cells = [].slice.call(table.querySelectorAll('td.mycell')) //using slice to convert nodelist to array
const values = cells.map(cell => cell.textContent)
const distinct = [...new Set(values)]
``` |
7,189,803 | I have an index.php file in the top level with other files such as "login.php", "register.php" in a folder called includes. The folder hierarchy looks like this:
```
index.php
includes/
register.php
login.php
css/
style.css
images/
image.png
```
How can I set the url to something like <http://www.my... | 2011/08/25 | [
"https://Stackoverflow.com/questions/7189803",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/904570/"
] | using mod\_rewrite:
```
RewriteRule ^register index.php?page=register
RewriteRule ^login index.php?page=login
```
index.php:
```
<?php
include('includes/'.$_GET['pagename'].'.php');
?>
```
EDIT:
For security reasons, see also arnouds comment below. | You can write a .htaccess file with something like this:
```
RewriteEngine On
RewriteRule ^([a-z]+)/?$ /index.php?include=$1 [PT,QSA]
```
and the index.php file with:
```
include('includes/'.$_GET['include'].'.php');
```
Of course you can adapt this code to what you need. |
856,653 | I'm using ARM RealView debug 3.1 and I'm unable to watch variables inside functions defined in a C++ namespace, the code works well and is compiled with armcc. Do any of you know a solution for this? | 2009/05/13 | [
"https://Stackoverflow.com/questions/856653",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/72784/"
] | In my case, the issue ending up being related to both using full IIS (not Express) and having a debug build where it included full debug symbols but also had project properties, `Build`, `Optimize code` checked.
Under Express, this works fine, but under full IIS this doesn't work. Visual Studio attaches to the w3wp pr... | Sounds silly, but put a breakpoint earlier in the process: maybe the process doesn't reach the breakpoint. |
36,357,939 | Looks like time is automatically getting changed during conversion.
My input is `17:15:25`. However, it gets converted to `13:15:25`
What could be the reason?
```
string testDate = Convert.ToDateTime("2016-03-24T17:15:25.879Z")
.ToString("dd-MMM-yyyy HH:mm:ss", CultureInfo.InvariantCulture);
... | 2016/04/01 | [
"https://Stackoverflow.com/questions/36357939",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4379237/"
] | The `Z` in your input indicates a UTC time, but the default behaviour of `Convert.ToDateTime` is to convert the result to your local time. If you look at the result of `Convert.ToDateTime("2016-03-30T17:15:25.879Z").Kind` you'll see it's `Local`.
I would suggest using `DateTime.ParseExact`, where you can specify the *... | Because of the CultureInfo.InvariantCulture.
You are converting a date in your GMT
```
Convert.ToDateTime("2016-03-24T17:15:25.879Z")
```
And then you are converting it to string in an invariant culture
```
ToString("dd-MMM-yyyy HH:mm:ss",CultureInfo.InvariantCulture);
```
You should use DateTime.ParseExact, and... |
7,681,543 | I am playing videos locally from sd card in listview in an android app. Now i want to hide those videos from user so that he can only play those videos but should not locate those videos to copy from sd card. Is there any way to hide videos on sd card? | 2011/10/06 | [
"https://Stackoverflow.com/questions/7681543",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/967686/"
] | Use the [`ShouldSerialize`](http://james.newtonking.com/projects/json/help/?topic=html/ConditionalProperties.htm) feature provided by Json.Net. So basically, your class will look like:
```
public abstract class JsonDocument
{
/// <summary>
/// The document type that the concrete class expects to be deserializ... | You can do this with an Enum, I don't know if DocumentType is a enum but it should.
```
enum DocumentType {
XML,
JSON,
PDF,
DOC
}
```
When deserializing the request it will give you an error if the client sends you an invalid enum. The "InvalidEnumArgumentException" which you can catch and tell the c... |
61,603,419 | I want to create a funtion that accepts two inputs (a dataframe and a string). Moreover, if the string is equal to `"cols"` this function need to return the number of columns, othwerwise it need to be return the number of rows.
My code is:
```
wl_df <- function(df,string) {
if(string == "cols")
return(ncol(df))... | 2020/05/04 | [
"https://Stackoverflow.com/questions/61603419",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Here is another approach, same function but in a more compact way:
```
wl_df <- function(df, string) ifelse(string == "cols", ncol(df), nrow(df))
``` | You can vectorize it, if you want to hit a whole list of data frames.
```
@library(tidyverse)
dfTests <- list(mtcars, iris, diamonds)
wl_df <- function(dfs,string) {
map_dbl(dfs,
~ case_when(
string == "cols" ~ ncol(.x),
string == "rows" ~ nrow(.x),
TRUE ~ NA))
}
# R > wl_df... |
37,384,882 | Here is my code
```
Pattern pbold = Pattern.compile(".*\\* *(.*?) *\\*.*");
Matcher mbold = pbold.matcher(s);
mbold.find();
``` | 2016/05/23 | [
"https://Stackoverflow.com/questions/37384882",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2567997/"
] | What you need is the metacharacter that matches whitespaces charaters: `(?s)`
This whitespace metacharacter matches:
* A space character
* A tab character
* A carriage return character
* A new line character
* A vertical tab character
For more info about this special characters, please consult [The Java Tutorials - R... | Use flags igm like below:
```
Pattern pbold = Pattern.compile(".*\\* *(.*?) *\\*.*");
Matcher mbold = pbold.matcher(s, Pattern.MULTILINE|Pattern.CASE_INSENSITIVE|Pattern.DOTALL);
mbold.find();
``` |
3,941 | Does mining a block mean that anyone else who was working on mining a block loses their progress and must restart? | 2012/06/13 | [
"https://bitcoin.stackexchange.com/questions/3941",
"https://bitcoin.stackexchange.com",
"https://bitcoin.stackexchange.com/users/277/"
] | Yes and no.
When a new block is created, everyone on the network must discard old work and use the new information provided (assuming they don't want to create forks). It does lead to some small performance loss.
On the other hand, creating a block is more or less like playing a lottery - there is no real "progress" ... | No, because there's no progress in mining blocks. If you've mined for 5 minutes and didn't find a block, you aren't any closer to finding it than when you started - the [hazard function](http://en.wikipedia.org/wiki/Failure_rate#Failure_rate_in_the_continuous_sense) is constant. |
40,836,001 | I am trying to write a simple program in c++ where I have 2 classes, and both can access functions from each other. This is a simplification of what I am actually trying to do in the end, which is to create a game with board and piece classes. I was able to do this in java, but I am now running into problems trying to ... | 2016/11/28 | [
"https://Stackoverflow.com/questions/40836001",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7021841/"
] | If you want a pure regex solution then use lookarounds:
```
>>> s = "12.03 5.897 7.10.74 0.103 12.05 6.4.1 8.98"
>>> print re.findall(r'(?<!\.)\b\d+\.\d+\b(?!\.)', s)
['12.03', '5.897', '0.103', '12.05', '8.98']
```
[RegEx Demo](https://regex101.com/r/MFgPui/4)
* `(?<!\.)` is negative lookbehind to assert failure w... | Use `(?<=\s)\d*\.\d*(?=\s|$)|^\d*\.\d*(?=\s|$)`:
```
import re
re.findall(r'(?<=\s)\d*\.\d*(?=\s|$)|^\d*\.\d*(?=\s|$)', s)
# ['12.03', '5.897', '0.103', '12.05', '8.98']
```
* the patten matches either `(?<=\s)\d*\.\d*(?=\s|$)` or `^\d*\.\d*(?=\s|$)` depending on whether the number is at the beginning of the string... |
68,475,076 | I have a series of spreadsheets we use to load parameters into a database for a point and click style of order entry. Some of the spreadsheets have hundreds of sheets and keeping them up to date is constantly a problem. What I am trying to do is insert some code that will go sheet by sheet and compile some data from ea... | 2021/07/21 | [
"https://Stackoverflow.com/questions/68475076",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16497544/"
] | [`GuildEmoji`](https://discord.js.org/#/docs/main/stable/class/GuildEmoji)'s [`author`](https://discord.js.org/#/docs/main/stable/class/GuildEmoji?scrollTo=author) property returns a [`User`](https://discord.js.org/#/docs/main/stable/class/User) object, so you can use either `emoji.author.tag` or `emoji.author.username... | You might need to [fetch](https://discord.js.org/#/docs/main/stable/class/GuildEmoji?scrollTo=fetchAuthor) the author.
```js
const userTag = (await emoji.fetchAuthor()).tag;
```
Don't forget that you can only use `await` inside an [async function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Sta... |
4,337,220 | I've spent the last few days scouring the site looking for an answer to this problem,
i need to create a folder and then make it a shared networked folder, I've tried several different sample code snippets from different sites
<http://www.sarampalis.org/articles/dotnet/dotnet0002.shtml> (this link is dead)
but none s... | 2010/12/02 | [
"https://Stackoverflow.com/questions/4337220",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/528259/"
] | I did follow the link that you have in your question.
I have a Win 7 Professional + VS.NET 2010 Professional as my dev environment on my laptop.
I took the code from the article and quickly fired up a devenv and executed the code. The code executed perfectly without any error. When i looked at the created directory ... | See
<http://www.sarampalis.org/articles/dotnet/dotnet0002.shtml>
<http://www.codeproject.com/KB/system/Share-Folder-c_.aspx> |
545,510 | I want to create a .pem file to connect to the server.
I know that I can use ssh-keygen, But I want to use it for a specific user, And I need a script that will do for me all process.
My need is to run the script one time on server X and so each time that I want to connect to X server I can use this the .pem file, in ... | 2019/10/07 | [
"https://unix.stackexchange.com/questions/545510",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/332990/"
] | I found a way to do it, and I didn't find an answer about how to do it, so I post it.
```
#! /bin/bash
#Based on https://linuxaws.wordpress.com/2017/07/17/how-to-generate-pem-file-to-ssh-the-server-without-password-in-linux/
user=$(echo "$USER")
ssh-keygen << EOF
$user
EOF
mv $user $user.pem
... | I have created a script below for ec2 instances to create a Key based sudo user. Kindly try this.
Note: below script works for all linux OS like redhat, ubuntu, suse, kali, centos, fedora, amazon linux 1/2, debain......etc
```
#!/bin/bash
#author: bablish jaiswal
#purpos: a sudo pem based user creation
clear
#echo "H... |
2,761,934 | Is there any good control or plug-in for uploading multiple photos with preview? As far as I understand it is impossible to preview photo on local computer using just JavaScript. So it has to use Flash or Java.
Thanks, also, I use ASP.NET. | 2010/05/03 | [
"https://Stackoverflow.com/questions/2761934",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/192727/"
] | I have often been annoyed by this problem myself, and unfortunately the solution suggested in [Aaronaught's answer](https://stackoverflow.com/a/2762169/3734747) quickly becomes messy when @parameters and 'strings' are involved. However, I have found a different workaround by exploiting the usage of synonyms:
```
IF(CO... | Try adding a "GO" statement after the ALTER TABLE.
It was news to me, but it says [here](http://msdn.microsoft.com/en-us/library/ms188037.aspx) that all statements in a batch (those preceeding the GO) are compiled into one query plan.) Withou no GO in the SQL, the entire plan is effectively one query.
EDIT: Since GO ... |
2,659 | I am doing a final year project which involves finding the position and orientation of a screw which has to be opened by a robot hand having a screw driver as an end effector.
I have developed a program in matlab that detects the screw and returns its centroid, I have also gone ahead to calibrate the camera and I have... | 2012/06/20 | [
"https://dsp.stackexchange.com/questions/2659",
"https://dsp.stackexchange.com",
"https://dsp.stackexchange.com/users/1537/"
] | I am trying to imagine how the detected screw is represented. Even if you have the centroid point and some representation of the shape, you need to estimate plane in which the screw lays. Such estimation would be very inaccurate given just the elliptic shape of the screw, which is usually small and its perspective and ... | My understanding is that you can not calculate homography from a single conic (conic is projection of a circle, in this case edge of the round screw). When camera calibration and homography between sensor and another plane (in you case the plane of the head of the screw) are known, you can calculate the orientation and... |
9,944 | My question is with regards to booting a Linux system from a separate /boot partition. If most configuration files are located on a separate / partition, how does the kernel correctly mount it at boot time?
Any elaboration on this would be great. I feel as though I am missing something basic. I am mostly concerned wit... | 2011/03/23 | [
"https://unix.stackexchange.com/questions/9944",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/4856/"
] | In ancient times, the kernel was hard coded to know the device major/minor number of the root fs and mounted that device after initializing all device drivers, which were built into the kernel. The `rdev` utility could be used to modify the root device number in the kernel image without having to recompile it.
Eventua... | Sounds like you're asking how does the kernel "know" which partition is the root partition, without access to configuration files on /etc.
The kernel can accept command line arguments like any other program. GRUB, or most other bootloaders can accept command line arguments as user input, or store them and make various... |
21,087,970 | What is the best way to write a method that given a type T and integer n, returns a list of n newly created objects of type T. Is it possible to pass a constructor as argument or will I have to accomplish this in some other way?
Was thinking something like this
```
public <T> ArrayList<Object> generate(T type, int am... | 2014/01/13 | [
"https://Stackoverflow.com/questions/21087970",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2938939/"
] | Use a generic method.
```
public <T> List<T> getList(Class<T> clazz, int size) throws InstantiationException, IllegalAccessException{
List<T> list = new ArrayList<T>();
for(int x = 0; x < size; x++){
list.add(clazz.newInstance());
}
return list;
}
```
**NOTE:** This will only work for objects... | ```
public static <T> List<T> generate(Class<T> clazz, int amount) {
ArrayList<Object> objects = new ArrayList();
for (int i = 0; i < amount; i ++){
objects.add(clazz.newInstance());
}
return list;
}
```
The code above actually tries to use default constructor. You can pass a reflection reference to... |
21,153,433 | I'm having trouble understanding the result of using void when calling a method. Below is a `main()` that calls a `test()`. The `test()` has a return of `void`.
If I call `void test()` (use `void`) the execution seems to stop: no print from `test()`
If I call `test()` (no `void`) the execution works fine.
What is th... | 2014/01/16 | [
"https://Stackoverflow.com/questions/21153433",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1432507/"
] | `void` is only used in the function declaration. When you call a function with `void` return type, just call it without using `void`.
* Use `void testerForVoid();` to declare a function that returns `void`, as the forward declared in your case.
* Use `testerForVoid();` to call the function.
In you example, for option... | option 1 is a call to function `testerForVoid()` which has already been declared.
option 2 is a declaration of function `testerForVoid()`. This fails because it has already been declared. |
12,717,112 | I use this code in PHP:
```
$idcat = 147;
$thumbnail_id = get_woocommerce_term_meta( $idcat, 'thumbnail_id', true );
$image = wp_get_attachment_url( $thumbnail_id );
echo '<img src="'.$image.'" alt="" width="762" height="365" />';
```
Where `147` is the current ID manually set, but i need to current id in other cate... | 2012/10/03 | [
"https://Stackoverflow.com/questions/12717112",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1718405/"
] | This solution with few code. I think is better.
```
<?php echo wp_get_attachment_image( get_term_meta( get_queried_object_id(), 'thumbnail_id', 1 ), 'thumbnail' ); ?>
``` | Add code in `/wp-content/plugins/woocommerce/templates/` loop path
```
<?php
if ( is_product_category() ){
global $wp_query;
$cat = $wp_query->get_queried_object();
$thumbnail_id = get_woocommerce_term_meta( $cat->term_id, 'thumbnail_id', true );
$image... |
55,359,176 | I'm learning react and it's great, but i've ran into an issue and i'm not sure what the best practice is to solve it.
I'm fetching data from an API in my componentDidMount(), then i'm setting some states with SetState().
Now the problem is that because the first render happens before my states have been set, im send... | 2019/03/26 | [
"https://Stackoverflow.com/questions/55359176",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10296538/"
] | It Depends.
suppose you are fetching books data from server.
here is how to do that.
```js
state = {
books: null,
}
```
if, your backend api is correctly setup.
You will get either empty array for no books or array with some length
```js
componentDidMount(){
getBooksFromServer().then(res => {
this.setSta... | I set initial state in constructor. You can of course set initial state of component as static value - empty array or object. I think better way is to set it using props. Therefore you can use you component like so `<App items={[1,2,3]} />` or `<App />` (which takes value of items from `defaultProps` object because you... |
7,933,598 | In one of my tables (sellers), all the fields requires permission from the user for others (registered or non-registered) to see. I could go through and create an associated column for each column, ex. (column1, column1\_privacy, column2, column2\_privacy). However, this seems redundant and bad design.
Is there a more... | 2011/10/28 | [
"https://Stackoverflow.com/questions/7933598",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/610408/"
] | ***As of today, there are four available approaches, two of them requiring a certain storage backend:***
1. **[Django-eav](https://github.com/mvpdev/django-eav)** (the original package is no longer mantained but has some **[thriving forks](https://github.com/mvpdev/django-eav/network)**)
This solution is based on [E... | I've been working on pushing the django-dynamo idea further. The project is still undocumented but you can read the code at <https://github.com/charettes/django-mutant>.
Actually FK and M2M fields (see contrib.related) also work and it's even possible to define wrapper for your own custom fields.
There's also support... |
91,071 | [](https://i.stack.imgur.com/8GRAZ.png)
How to add a custom button to sales order view in magento2, since some of the events was remove in-favor of plugins.
* Removed some events (plugins must be used instead):
+ adminhtml\_widget\_container\_html\_... | 2015/11/21 | [
"https://magento.stackexchange.com/questions/91071",
"https://magento.stackexchange.com",
"https://magento.stackexchange.com/users/519/"
] | Create DI file: `app/code/YourVendor/YourModule/etc/di.xml`:
```
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<virtualType name="SalesOrderViewWidgetContext" type="\Magento\Backend\Blo... | Create di.xml following location
```
app/code/Learning/RewriteSales/etc/di.xml
```
Content should be
```
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\Backend\Block\Wi... |
37,704,404 | So I've been wanting to bind the items of two pickers in Xamarin.Forms to my ViewModel. I have mainly used binding for textfields, where I just write something like:
```
<Label Text="{Binding CurrentDate}" />
```
and simply by setting the binding context, defining a property in the viewmodel
```
public System.D... | 2016/06/08 | [
"https://Stackoverflow.com/questions/37704404",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/750565/"
] | Using [Zakaria's answer](https://stackoverflow.com/questions/37704393/how-to-create-a-link-that-actives-a-bootstrap-tab/37704861#37704637) I actually figured out a better solution.
Set an ID on each tab link like so:
```
<li><a data-toggle="tab" href="#tab-second" id="tab-second-link">Second Tab</a></li>
```
Then a... | try this code (add bootstrap.js and jquery.js)
```
<div class="row">
<div class="tab-content">
<div class="tab-pane active" id="tab1">
//CONTENT OF TAB1
<div style="float: left;">
<a style="margin-left:5px;" class="btn btn-set btn-d... |
2,785,252 | Is it possible to find a retract $r:K \to M$ where the domain $K \subseteq \mathbb{R}^2$ is compact and convex and the codomain is given by
$M = [-1,1] \times \{0\} \ \cup \{0\} \times [-1,1] \subseteq K$ | 2018/05/17 | [
"https://math.stackexchange.com/questions/2785252",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/-1/"
] | I know this is a zombie response to a two-year-old question, but it seems to me that the OP here reinvented/rediscovered the concepts of [cardinality](https://en.wikipedia.org/wiki/Cardinality) **and** [equivalence classes](https://en.wikipedia.org/wiki/Equivalence_class), restricted to the set of natural numbers $\Bbb... | You're really ignoring the following thing:
>
> If $f\colon A\to B$ is a bijection, then $F(X)=\{f(x)\mid x\in X\}$ defines a bijection between $\mathcal P(A)$ and $\mathcal P(B)$. In other words, equinumerous sets have equinumerous power sets.
>
>
>
What you sort of alleging here is that because your set lacks s... |
13,814,763 | Ok. Not sure this is a good idea. I'm building a template which passes a JSON config to a Javascript file assembling the template.
For links I need to include some logic how to build them in my JSON config. I would have to call this:
```
path.href.replace( /.*view=/, "" ) + ".cfm?id="+content.vcard.adresses[1]["iln/g... | 2012/12/11 | [
"https://Stackoverflow.com/questions/13814763",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/536768/"
] | In fact it is [preflight request](https://developer.mozilla.org/en-US/docs/HTTP_access_control#Preflighted_requests), because Prototype adds custom headers [X-Requested-With, X-Prototype-Version](http://api.prototypejs.org/ajax/) to the request. Because of these headers browser sends first `OPTIONS` request. [XHR spec]... | I've never used Prototype and i'm not sure how much use i'll be. But I had a quick look at the docs and I didn't see any support for method and parameters.
So try:
```
new Ajax.Request(REQUEST_ADDRESS+"?stationString="+station_id, {
onSuccess: displayMetar,
onFailure: function() {
$("errors").update("... |
18,794,943 | I'm trying to write a program that decides whether a circle is inside/touching a rectangle. The user puts in the center point for the circle and the radius, and two diagonal points for the rectangle.
I'm not sure how to include all points of the circumference of the circle, to tell that there is at least one point in... | 2013/09/13 | [
"https://Stackoverflow.com/questions/18794943",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2770679/"
] | As others have said, you need a chain of `if ... else if ... else if ... else` for your logic to work properly.
However, there's an easier approach. To test whether any part of a circle touches or is inside a rectangle, just expand the rectangle by the circle radius and then test whether the center of the circle is in... | because you treat every case separately without `else if` ,so if condition is you override value of a if the if condition is true ,your else if is related to the last if statement , not for all .
I suggest to concatenate every result to variable `a` like this to see which conditions are valid:
```
if (cx >= p1x && c... |
180,590 | I have installed Magento 2.1.7, and theme Luma.
I then created a custom theme to inherit from Luma.
I was wondering if the content (blocks and widgets) are also inherited from the parent theme. In my case it does not see to happen. Is it the correct behavior or I am missing something?
See the screenshots.
Thanks
[![T... | 2017/06/24 | [
"https://magento.stackexchange.com/questions/180590",
"https://magento.stackexchange.com",
"https://magento.stackexchange.com/users/55595/"
] | Static blocks and widget are not showing in your custom theme because of luma theme blocks and widget are them specific define.
You can see below attached screen shot.
[](https://i.stack.imgur.com/XZj7X.png)
If you want to show all Luma theme static... | because this content of luma theme show by widget. Widget only apply to specific theme design. So in your theme doesn't define any widget related to content block so it empty |
26,819,963 | I'm attempting to store persistent public data on an xmpp server using. Ideally, a user would be able to store a node on the server, and then retrieve that specific node later. This is all implemented on an openfire server, using strophe for the front end.
When I create the node, I use something like this:
```
$iq({
... | 2014/11/08 | [
"https://Stackoverflow.com/questions/26819963",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2595638/"
] | Try this:
```vb
<%
Dim Views : Views ="Two" 'Change this to check
Response.write "Initial View =" & Views & "<br/>"
'But "One" will always be printed
If InStr(Views,"One")=0 Then
'add if there is no "One" already
Views = Views & ",One"
End If
Response.write "New View =" & Views & "<br/>"
Dim ArrValues :... | There are multiple ways to approach this but without changing your code to much, it can be done by splitting your `Views` variable into an Array using the comma `,` as a delimiter. Once you have the Array use a `For` loop to iterate through the Views and use a `Select` statement to return the correct view.
As you spec... |
24,022,988 | I am trying to get my master changes into my local branch by doing
```
git checkout MyPersonalBranch
git rebase master
```
then I get the error
```
Patch failed at ..blah blah
When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To ch... | 2014/06/03 | [
"https://Stackoverflow.com/questions/24022988",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1110437/"
] | In general, you can use the `--strategy` option to specify how conflicts should be handled. The strategy `theirs` blindly replaces files.
However, in your case, you've only got a single file. You really won't want to use the `theirs` strategy for all files. Instead, after you get the message to resolve the conflict, y... | * check `git status` to see what conflicts exist as some must
* edit the files to resolve said conflicts
* `git add` the files you modifed
* `git status` should no longer show any 'both modified' files
* `git rebase --continue`
Depending upon how many times you made changes to the jar you mentioned, you will have to t... |
13,625 | I recently tiled a bathroom myself for the first time, only to discover afterward that I was not as successful at cleaning the excess grout off as I had initially thought. As a result, there are now a few patches of set grout on the tiles. What is the best way to clean this off now?
Thanks! | 2016/07/22 | [
"https://lifehacks.stackexchange.com/questions/13625",
"https://lifehacks.stackexchange.com",
"https://lifehacks.stackexchange.com/users/12305/"
] | Use a razor blade scraper to remove set grout from tile. For stubborn areas, use a Pumie Scouring Sick. Cheap, works great, doesn’t mar surface.[](https://i.stack.imgur.com/ZifP5.jpg) | microfibre cloth are scratchy to help scrape the excess grout but not mark the tile if this doesnt work try in a small area a steel wool cloth lightly see if it works better |
47,402,460 | I have a basic table in javascript and a few lines of code where I compare the first values from each of the two tables. It skips the 'else if' statement and just goes straight to the 'else' at the end, when the 'else if' condition is true. I'm pretty new to all this so I won't be surprised if I messed up somewhere obv... | 2017/11/20 | [
"https://Stackoverflow.com/questions/47402460",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8974577/"
] | JavaScript starts counting array indexes at 0. You've essentially said:
```
if ( "x" > "x" ) {
print("Outcome 1");
} else if ( "x" < "x" ) {
print("Outcome 2");
} else {
print("Else");
}
```
Since `"x"` is the second element in each array, and `"x" = "x"`, you will always hit the else statement. Change y... | You are comparing the second value, to compare first value use [0].
It goes straight to the last else because 'x' is not less nor greater than 'x' |
7,573,067 | I'm using different books to learn rails and they're all using different versions of ruby and rails. I've got instructions on how to load/use different versions of rails, but I don't know how to do it with ruby.
Can anyone tell me if this is possible and how to indicate which ruby I am using for each app?
i'm using ... | 2011/09/27 | [
"https://Stackoverflow.com/questions/7573067",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/588498/"
] | Use [rvm](http://beginrescueend.com/rvm/install/). It manages different ruby versions and even different gemsets (e.g. per application). | The combination of [rbenv](https://github.com/sstephenson/rbenv) and [ruby-build](https://github.com/sstephenson/ruby-build) are a lighter weight alternative to the aforementioned RVM, though I prefer RVM personally. |
24,417,712 | I have a table of values with decimals and whole numbers. Some of the decimals have zeros two places after the decimal point (e.g. `0.60`) or the two places after the decimal point are both zeros (e.g. `4.00`).
How do I make sure any zeros are removed from after the decimal point? (So the aforementioned numbers would... | 2014/06/25 | [
"https://Stackoverflow.com/questions/24417712",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3676776/"
] | The `General` format will not show any trailing decimal zeros. Regardless of whether the number is entered manually or calculated, if the cell format is `General`, Excel will only show the decimals required to represent the number. | Please try:
```
=INT(A1*100)/100
```
and copy down to suit, assuming your data is in ColumnA and that formatting is 'General'.
---
A comparison of various possibilities:
[](https://i.stack.imgur.com/sFl42.jpg)
[It seems that for the accepted A to be co... |
24,015,948 | I am doing a web service in php to encode data to json. My php code is:
```
function getProgramDay($day)
{
global $DDBB_SERVER, $DDBB_USER, $DDBB_PASSWORD, $DDBB;
$sql = "SELECT program.id, programa.name FROM `mybd` WHERE program.day = '" . $day . "'";
$con = mysqli_connect($DDBB_SERVER, $DDBB_USER... | 2014/06/03 | [
"https://Stackoverflow.com/questions/24015948",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/752254/"
] | ```
return json_encode(array("results"=>$res));
```
As said in the comment, if you want to return an array and create the json in the calling code, do it like this:
```
return array("results"=>$res);
``` | Your output
```
[{"id":"1","nombre":"Hello"}]
```
is an array (witch you build with) `// Prepare data
while ($row = mysqli_fetch_assoc($result)) {
$res[] = $row;
}`
What you want to have is an an object
`object(stdClass)#6 (1) {
["results"] => array(1) {
[0] => object(stdClass)#7 (2) {
["id"] => string(1) ... |
7,235,269 | I've got a dynamic html table and I want to retrieve the data from that table using the POST method. Is it possible to do this? What other ways would you recommend to achieve this.
Here's a simple example from what I got:
```
<html>
<form id="form1" method="post" action="process.php">
<table id="tblSamp... | 2011/08/29 | [
"https://Stackoverflow.com/questions/7235269",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/663593/"
] | A table cannot be accessed as such, unless you use form elements (`input`, `textarea`, etc.) and add `name` attribute to them; then, you can access your elements with `$_POST`.
If you have your data in a table, the best way to retrieve our data is by JavaScript, using `innerHTML`. | You can assign the `innerHTML` of the form to a variable and use AJAX to post it back to the server as a string, or store it in a `textarea` and do the same. Regardless, you need to parse the string to extract the data. |
56,291,781 | i want to export data from my json to csv file but i get this error Cannot use object of type stdClass as array
i want to know please how i can use it as array
```html
public function exportUsers()
{
$users = ServicePoint::all()->where("nature", "SP")->toArray();
$users = ServicePoint::all()->where('statut','... | 2019/05/24 | [
"https://Stackoverflow.com/questions/56291781",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8183519/"
] | The reason that I had strange errors was, that in the second builder function I didn't add the following code:
```
if (!snapshot.hasData) return const Text("Loading...");
```
Once I added it, it worked. Seems the data was just not ready yet, hence it couldn't be read and hence the error. | Be careful to also test for `snap.hasData()` in your nested `StreamBuilder`. |
5,525,289 | I am working on a very basic robotics project, and wish to implement voice recognition in it.
i know its a complex thing but i wish to do it for only 3 or 4 commands(or words).
i know that using wavin i can record audio. but i wish to do real-time amplitude analysis on the audio signal, how can that be done, the wave ... | 2011/04/02 | [
"https://Stackoverflow.com/questions/5525289",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/688927/"
] | There is no simple way to recognize words, because they are basically a sequence of phonemes which can vary in time and frequency.
Classical isolated word recognition systems use signal [MFCC](http://en.wikipedia.org/wiki/Mel-frequency_cepstral_coefficient) (cepstral coefficients) as input data, and try to recognize p... | If you just want to recognize a few commands, there are many commercial and free products you can use. See [Need text to speech and speech recognition tools for Linux](https://stackoverflow.com/questions/877508/need-text-to-speech-and-speech-recognition-tools-for-linux) or [What is the difference between System.Speech.... |
18,643,642 | Building thrift 0.9.1 (support C, C++, java, C#, perl, python) on Ubuntu 13.04 I am getting this error.
./configure run without any options, make run without any options...
```
Making all in test
make[2]: Entering directory `/home/dvb/sw/thrift-0.9.1/test'
Making all in nodejs
make[3]: Entering directory `/home/dvb/s... | 2013/09/05 | [
"https://Stackoverflow.com/questions/18643642",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1874268/"
] | I ran into this problem tonight and "fixed" it. The problem is that ar(1) can't find the .o files in the directory test/cpp/.libs. I'm sure that there's some missing magic in the Makefile.am in test/cpp, but I've neither the patience or automake-fu to fix that.
Instead, I just symlinked the .o files from test/cpp to t... | David V is right that 0.9.1 is broken but 0.9.2 works. The build instructions seem to be a broken link as well. So here are the commands that worked for me, from a fresh Ubuntu install:
```
# Install java if you don't have it
sudo apt-get install default-jre
# install build dependencies
sudo apt-get install libboost-d... |
37,318,719 | Laravel ajax returns 500 (Internal Server Error). Could you tell me what is the problem?
**sample.brade.php**
```
<script type="text/javascript">
$("input.dog_check").click(function(){
var amount = 10000;
var dataString = 'amount='+amount;
console.log(dataString);
$.ajax({
type:'POST',
data:dataString... | 2016/05/19 | [
"https://Stackoverflow.com/questions/37318719",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3575850/"
] | ```
<meta name="csrf-token" content="{{ csrf_token() }}" />
<script>
var CSRF_TOKEN = $('meta[name="csrf-token"]').attr('content');
jQuery.ajax({
type:'POST',
url :"{{url('save_temporary_data')}}",
data:{_token: CSRF_TOKEN,amount:amount},
success:function(data){
... | It is solved by referencing the following page. Thank [ajax post in laravel 5 return error 500 (Internal Server Error)](https://stackoverflow.com/questions/30154489/ajax-post-in-laravel-5-return-error)-500-internal-server-error?rq=1 |
95 | What's your top trick for getting a new employee set up quickly? Do you use images, scripts, something else? | 2009/04/30 | [
"https://serverfault.com/questions/95",
"https://serverfault.com",
"https://serverfault.com/users/32/"
] | I have found that the best to way optimize a new user setup is to start before they are hired. Get with the manager and find out what the employee will need. Have the hiring manager let you know the minute they accept the position. Have the manager give you all their info so you can do things like set up their login cr... | As has been mentioned, setting up the machine with any productivity applications, corporate software, and a proper web browser (Firefox) are important basics. Shared space is another good point, though you should also make sure to map that properly on the user's machine and probably provide links to it so that the user... |
14,628,101 | I am trying to enter `MPMediaItemArtwork` Image into `UITableView's` cell's ImageView with following code.
```
MPMediaItemArtwork *artwork = [[[self.arrayOfAlbums objectAtIndex:indexPath.row] representativeItem]valueForProperty:MPMediaItemPropertyArtwork];
UIImage *artworkImage = [artwork imageWithSize: cell.image... | 2013/01/31 | [
"https://Stackoverflow.com/questions/14628101",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/973477/"
] | Try this for calculating a new and fitting image;
Adjust `newRect` to the rect of your cell.
```
// scale and center the image
CGSize sourceImageSize = [artworkImage size];
// The rectangle of the new image
CGRect newRect;
newRect = CGRectMake(0, 0, 40, 33);
// Figure out a scaling ratio to make sure we maintain th... | The line
```
UIImage *artworkImage = [artwork imageWithSize: cell.imageView.bounds.size];
```
creates an image with the size of the cell. So, it's scaled in this line and the image won't be bigger than the cell and therefore it will not scale afterwards.
I would leave the image at it's original size or at a size 2... |
6,666,060 | Having created a java web service client using wsimport on a wsdl, I need to set the Authorization header for each soap message embedded in an http request. Having generated a subclass of javax.xml.ws.Service, how can I append an http header to each outgoing request??? | 2011/07/12 | [
"https://Stackoverflow.com/questions/6666060",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/349913/"
] | Here is the code, based on Femi's answer.
It can be a little tricky to figure out. Works beautifully!
```
Service jaxwsService = Service.create(wsdlURL, serviceName);
Dispatch<SOAPMessage> disp = jaxwsService.createDispatch(portName, SOAPMessage.class, Service.Mode.MESSAGE);
//Add HTTP request Headers
Map<String, L... | For the sake of completeness and to help others in similar situations, I'd like to illustrate the IMHO cleanest solution using the JAX-WS-handler-chain:
1) Sub-class your service-class (not the port-class) in a different (non-generated) package. Because the service-class (and its entire package) was likely generated f... |
41,886,181 | I am attempting to obtain a result of row information coming from tables named book\_info and copy\_info, and then (if they exist) results from a table named publisher(whose foreign key is in copy\_info), and (if they exist) result from a table name genre via a junction table called books\_genres. Below, $safe\_copy\_i... | 2017/01/27 | [
"https://Stackoverflow.com/questions/41886181",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7038718/"
] | You need to use the second parameter of the callback - it should contain the raw response.
```
request.execute(function(jsonResp, rawResp) {
console.log('rawResp: ', rawResp);
var respObject = JSON.parse(rawResp); // rawResp is encoded JSON string with header, body, etc.
var respBody = respObject.gapiReque... | I believe this is the link you are looking for : )
<https://developers.google.com/drive/v3/web/manage-downloads>
>
> Downloading the file requires the user to have at least read access. Additionally, your app must be authorized with a scope that allows reading of file content. For example, an app using the drive.rea... |
15,625,850 | When I try to add column names and row data to table model, I get null pointer exception. Column names come from list and i add them to table model as array. But in there I get the exception: `tableModel.addColumn(columnNames.toArray());
tableModel.addRow(rowData);`
My full code:
```
public class DBC extends JFrame{... | 2013/03/25 | [
"https://Stackoverflow.com/questions/15625850",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1831187/"
] | What you're looking for is this:
```
$triggerOn = '04/01/2013 03:08 PM';
$user_tz = 'America/Los_Angeles';
echo $triggerOn; // echoes 04/01/2013 03:08 PM
$schedule_date = new DateTime($triggerOn, new DateTimeZone($user_tz) );
$schedule_date->setTimeZone(new DateTimeZone('UTC'));
$triggerOn = $schedule_date->format(... | Create the date using the local timezone, then call `DateTime::setTimeZone()` to change it. |
46,012,144 | I am trying to get customer\_id of a stripe customer from the response of of charge entity. But response is not providing the customer id in return.
```
&stripe.Charge JSON: {
"id": "ch_1AxWbTFytruJp2FXW6iuRd1X",
"object": "charge",
"amount": 100,
"amount_refunded": 0,
"application": null,
"application_fee... | 2017/09/02 | [
"https://Stackoverflow.com/questions/46012144",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6443951/"
] | When you create a `charge` using only the credit card token, no Stripe customer is created, you only create a payment with no associated customer.
So it's normal that you the API returns `customer: null`.
Instead of charging a credit card, I think you should **charge a new customer**.
In your backend code, you could h... | You can access card\_id while creating new customer using following code (in Golang):
```
for _, data := range customer.Sources.Values{
card_id = data.ID
}
fmt.Println(card_id)
```
I spend almost 1 day to figure it out. Actually in customer structure(under stripe package) there are some fields which... |
68,373,918 | The following code produces the following output and ends up in kind of an endless loop with 100% cpu load.
```cpp
#include <iostream>
#include <set>
class Foo{};
void delete_object_from_set(std::set<Foo *>& my_set, Foo* ob)
{
std::set< Foo *>::iterator setIt;
std::cout << "Try to delete object '" << ob <<... | 2021/07/14 | [
"https://Stackoverflow.com/questions/68373918",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4270676/"
] | Hokay, so you asked how this could loop infinitely without continuously triggering the "Check object" print.
The quick answer (that you already got from others) is that calling `operator++` on `my_set.end()` is UB, and thus able to do anything.
A deeper dive into GCC specifically (since @appleapple could reproduce on... | ```
for(setIt = my_set.begin(); setIt != my_set.end();)
{
Foo * tmp_ob = *setIt;
std::cout << "Check object '" << tmp_ob << "'..." << std::endl;
// compare the objects
//
if(ob == tmp_ob)
{
// if the objects are equal, delete this object from the set
//
std::cout << "Dele... |
241,123 | Look at the conversation below please:
>
> A)I want to travel to the Black Bear Island next weekend.
>
> B) Good idea! Make a plan first, \_\_\_\_\_\_ you will enjoy more beautiful scenery.
>
>
>
which of the options below fits better in the blank? (I know that Option A is not a good fit)
```
A. But
B. And... | 2020/03/21 | [
"https://ell.stackexchange.com/questions/241123",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/110499/"
] | Let's tackle this question together. I've divided my answer into two parts, if you want the quick answer skip the first part.
In the English language we have several words to refer to the **reason** why an action happened/happens. there are also a couple of words and structures to refer to the **purpose** of an actio... | ```
"and" shows that making a plan will allow you to enjoy more.
```
"so that" suggests an unspoken opposite can result if you don't plan. |
54,490,143 | Is there any way I can enable all notification settings by default when my app gets installed ?
Users are receiving notifications but sound is disabled by default and we need to manually enable it on the device. Not all users can do this manually. It would be great to know if there is any way we can check all these th... | 2019/02/02 | [
"https://Stackoverflow.com/questions/54490143",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7389792/"
] | Try using with this below permission in AndroidManifest file
```
<uses-permission android:name="android.permission.ACCESS_NOTIFICATION_POLICY"/>
```
and set notification priority for both below and above Oreo versions `IMPORTANCE_HIGH` for Oreo and above, and `PRIORITY_HIGH or PRIORITY_MAX` for below Oreo versions
... | Android 8 or higher you need to use **NotificationChannel** to enable sound, vibration, sound etc.
```
Uri notification_sound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
NotificationChannel notificationChannel = new Notificati... |
63,315,439 | I am a beginner in Jquery. Need your help on the below problem.
I have a html table with 3 columns and 3 rows. Each column has a header example col1,col2 and col3. There is a column approval status with values- Approved, approval pending and not approved. I have to take the sum of the values entered by user in each tex... | 2020/08/08 | [
"https://Stackoverflow.com/questions/63315439",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13841410/"
] | You have to commit `.gitignore` and have it in your repository, otherwise, you'll lose track of it :)
An example, if another friend clones your repository without the `.gitignore`, he will spam your repo with unnecessary files when committing/pushing.
Feel free to `git add .gitignore` and commit ;) | As [Balastrong answered](https://stackoverflow.com/a/63315381/1256452), you should generally add-and-commit a `.gitignore` file. (There can be special weird exceptional cases but usually if you're in that situation, you should be putting these items into `.git/info/exclude`.)
The thing to remember here is what *untrac... |
42,054,960 | I'm downloading images using DropBox's API and displaying them in a Collection View. When the user scrolls, the image either disappears from the cell and another is loaded or a new image is reloaded and replaces the image in the cell. How can I prevent this from happening? I've tried using SDWebImage, this keeps the im... | 2017/02/05 | [
"https://Stackoverflow.com/questions/42054960",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I fixed it. It required setting the cell image = nil in the cellForItemAt func and canceling the image request if the user scrolled the cell off screen before it was finished downloading.
Here's the new cellForItemAt code:
```
override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: In... | Use SDWebImage and add a placeholder image :
```
cell.imageView.sd_setImage(with: URL(string: "http://www.domain.com/path/to/image.jpg"), placeholderImage: UIImage(named: "placeholder.png"))
``` |
6,971,945 | I have an array of array .
Example like
```
a[0]={1,2,3};
a[1]={2,3,4};
**Edit** in a[2] from a[2]={4,5};
a[2]={2,4,5};
and more
```
How can I find common element which exist in all array ? | 2011/08/07 | [
"https://Stackoverflow.com/questions/6971945",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/428705/"
] | You can avoid foreach loop by
```
call_user_func_array('array_intersect',$a);
``` | As the name suggest, I think you can just use [array-intersect](http://php.net/manual/en/function.array-intersect.php)
From that page:
```
<?php
$array1 = array("a" => "green", "red", "blue");
$array2 = array("b" => "green", "yellow", "red");
$result = array_intersect($array1, $array2);
print_r($result);
?>
```
giv... |
18,787,509 | How can i count element once?
Right now, evert time, when i click #totalItems, alert is rised as many times, as many element are in #photoId ?
```
<script type="text/javascript">
$(document).ready(function(){
photoId = $('.photoId');
totalItems = $('#totalItems');
$(photoId).on('click', f... | 2013/09/13 | [
"https://Stackoverflow.com/questions/18787509",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2610146/"
] | Here is a sample of something expanding on the tip from SpykeBytes
```
<div ng-repeat="location in journey.locations">
<div id="location_div_{{ $index }}">
<label class="journey-label">Location name</label>
<input class="journey-input" id="location_{{ $inde... | Index won't help you here because the {{$index}} that ng-repeat provides is within the groupings. That is, each grouping restarts the $index variable. You are going to need a unique identifier for each record though. Without that there is no way to be sure that the record you want to remove is the right one.
As far as... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.