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 |
|---|---|---|---|---|---|
2,769 | I know you can create a rounded-corner rectangle; but, how do you create a triangle with rounded corners in Photoshop?
I am actually interested in making it from scratch, not basing it on a custom shape that is available in Photoshop. Thanks. | 2011/07/07 | [
"https://graphicdesign.stackexchange.com/questions/2769",
"https://graphicdesign.stackexchange.com",
"https://graphicdesign.stackexchange.com/users/1854/"
] | There are several ways to do this. You can use the pen tool draw it yourself.
My answer is based on the way I've been doing it over the years.

Draw a triangle in a new layer. hit cmd+a(select all) then cmd+c(copy)

switch... | 1. Create a triangle shape of the desired size
2. Place circle shapes of the desired radius in the corners of the triangle, so that they align with the edges but not intersect.
3. Combine shapes.
4. Done. :) |
6,258,283 | I am trying to merge the latest changes from trunk into a branch of my project, but the problem is I don't know what revision of the trunk I checked out that I eventually created the branch from. I would think SVN logged this somewhere. Does anyone know how I can find the revision number?
(In other words, the Subversi... | 2011/06/06 | [
"https://Stackoverflow.com/questions/6258283",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/200224/"
] | Are you using TortoiseSvn or command line?
Command Line: `svn log --stop-on-copy` and then look at the smallest rev number.
Tortoise SVN: `right-click, tortoise-svn, show log, make sure 'stop on copy' is *checked* and press refresh. Scroll to the bottom and find the smallest rev number.`
![enter image description her... | For the Cornerstone app, to see where a tag or branch originated, look in the timeline. |
237,352 | **check\_prime.cpp**
**Description**: Accepts user input to check if the user entered a prime number.
**Notes**: If any text inputted after an integer will be ignored.
**For example**: 1234.5678 and 98abc will be interpreted as 1234 and 98, respectively.
Please provide any feedback (positive or negative).
```
//... | 2020/02/16 | [
"https://codereview.stackexchange.com/questions/237352",
"https://codereview.stackexchange.com",
"https://codereview.stackexchange.com/users/218519/"
] | * Formatting: Indent your code consistently. This makes it easier to understand and spot errors. Also, it attracts people here to read it at all. Your's is not a mess, but inconsistent still.
* Another rather obvious error is not to return a boolean for a function that gives you a true/false result. This is implicit do... | * `int` is redundant in this variable declaration: `unsigned long int num`
See the properties table on this reference page: <https://en.cppreference.com/w/cpp/language/types>
* in this case, it is better to use `++n` rather than `n++` for better readability. `++n` precisely describes what this imperative procedure trie... |
9,600,592 | i am working with javafx 2.0 and netbean 7.1, I am facing an problem when doing a drag and drop on a image over a ImageView, .i kept image as a source(one image) and 2 target point(2 box as target point).when trying to drag an image first time, its working fine and after sources image is entered in to target box.and ag... | 2012/03/07 | [
"https://Stackoverflow.com/questions/9600592",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1254528/"
] | ```
SELECT Company_Name, Company_ID, SUM(Amount)
FROM TableName GROUP BY Company_Name, Company_ID
``` | You need to use `GROUP BY` and `SUM` function.
```
SELECT Company_Name, Company_ID, SUM(Amount) AS TOTAL_AMOUNT
FROM myTable
GROUP BY Company_Name, Company_ID
``` |
12,258 | There is much information regarding learning styles and ways to leverage them, along with boosting focus, alertness and concentration.
However, I'm looking for accompanying information that would be useful in addition to those answers.
**Witnessed countless times:**
When one is either learning or working with a ne... | 2015/09/26 | [
"https://cogsci.stackexchange.com/questions/12258",
"https://cogsci.stackexchange.com",
"https://cogsci.stackexchange.com/users/849/"
] | I'm guessing you don't want to generally increase the level of those chemicals in the brain, just in the reward-motivation area.
In order to do so, you need to be rewarded and motivated, obviously. The learning need to be exciting, with feedback and reinforcement. Socializing it will help, too.
There is a relativ... | This is more of a subjective opinion, (though there are some real world examples) but I feel that the concept of "gamification" (adding game-like qualities to non-gaming tasks) is quite relevant to this topic. Sites like khan academy or codecademy use this pretty effectively, and make the process of learning math or co... |
6,619,042 | I downloaded <http://www.cryptopp.com/#download> 5.6.1 and have no clue that to do at this point. I am a total noob and need good instructions. thanks. | 2011/07/08 | [
"https://Stackoverflow.com/questions/6619042",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/473795/"
] | Directly from the readme (Which can be found here [Crypto++ Svn Trunk](http://svn.code.sf.net/p/cryptopp/code/trunk/c5/ "Crypto++ SVN Trunk")):
**\* MSVC-Specific Information \***
On Windows, Crypto++ can be compiled into 3 forms: a static library including all algorithms, a DLL with only FIPS Approved algorithms, an... | You'll need to compile the library before using it with anything. You can't just install it. Here is a page from their wiki about compiling the library: <http://www.cryptopp.com/wiki/Compiling> |
43,091,923 | please take look at Node \*newNode(), i dont understand why i must add \* for p=x
i made an Node named x(with data & next), and created a new memory space \*p by using malloc,
then let p = x, but by i must add \* for p=x?
```
#include<stdio.h>
#include<stdlib.h>
struct Node{
int data;
Node *next;
};
Node *new... | 2017/03/29 | [
"https://Stackoverflow.com/questions/43091923",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7715019/"
] | In your UITabBarController class **viewDidAppear func** , call it's super class, like this
```
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
if goTasks {
self.selectedIndex = 0
} else if goTodo {
self.selectedIndex = 2
} else if ... | i think you have to call function from super:
```
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated) // here what i ment
if goTasks {
self.selectedIndex = 0
} else if goTodo {
self.selectedIndex = 2
} else if goProjects {
self.selectedIndex = 3
}... |
40,927,253 | I am writing a program where i am using Multi-dimensional array. The concept will enter the subject name and index will be shown that who student is studying that subject.
```
$var= [ 'Abdullah'=>['full_name'=>'Abdullah_Faraz',
'Subject'=>['English','Urdu','Maths']],
'Hamid'=>['full_name'=>'Hami... | 2016/12/02 | [
"https://Stackoverflow.com/questions/40927253",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4506331/"
] | You can use this
```
foreach ($var as $key => $value) {
$lang = $value['Subject'][1];
if($lang != 'Urdu'){
echo $key.'<br>';
}
}
``` | Replace your inner two *foreach* loops with normal for-loop over array length.
```
<?php
for ($x = 0; $x < dim-Length; $x++) {
echo "The number is: $x <br>";
}
?>
``` |
502,653 | Pretty much the title. I don't like the way that a single scroll wheel 'notch' moves an entire slide. I would rather scroll continuously between slides if possible.
Maybe I'm wrong and it would be more annoying that way, but I'd like to try it if I can. | 2012/11/08 | [
"https://superuser.com/questions/502653",
"https://superuser.com",
"https://superuser.com/users/74422/"
] | Continuous scroll works in Slide sorter view. Just zoom in slides as much as you want. | You can add a transition between two slides. Try a 'Push from bottom' transition with slow transition speed and you will get a scroll effect, though you wont have a control of scroll as you want like in a pdf file. |
123,443 | I have a fisheries dataset for which I have calculated value for each grid cell on a map. The value is the proportion of the total fishing sets in that cell for each month/year. So, I have values between 0-1, but not including 0 and 1 (the range is actually very skewed and is: 0.0005347594 to 0.1933216169). I am intere... | 2014/11/10 | [
"https://stats.stackexchange.com/questions/123443",
"https://stats.stackexchange.com",
"https://stats.stackexchange.com/users/60391/"
] | With count data of that form, I'd actually fit a *multinomial* model (at least to start with\*), because several numerators are present in the denominator - each '+1' count could have gone into any of $k$ cells ('sets').
(e.g. see [here](http://en.wikipedia.org/wiki/Multinomial_logistic_regression))
You'll need the d... | Based on your answer of how the proportion is calculated I believe the beta regression is most appropriate. The logistic regression for count binomial would only make sense if you have counts out of a total that is constant. Since your total changes from month to month you have a continuous proportion. Therefore beta r... |
58,184,582 | After I build my image, there are a bunch of images. When I try to delete them I get “image has dependent child images” errors. Is there anyway to clean this up?
These do NOT work:
```
docker rmi $(docker images -q)
docker rmi $(docker images | grep “^” | awk “{print $3}”)
docker rmi $(docker images -f “dangling=true... | 2019/10/01 | [
"https://Stackoverflow.com/questions/58184582",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5729597/"
] | ```
docker rmi `docker images | grep "<none>" | awk {'print $3'}`
``` | docker rmi `docker images -a | grep "<none>" | awk {'print $3'}`
Adding `-a` is required. |
69,577,447 | I am new to Tailwind CSS and CSS in general.
I need to make my buttons stop doing transform/transition effects when they are disabled. Currently, the disabled color changes are getting applied but the transformations/transitions are still taking place on hover.
I tried using - ***disabled:transform-none*** and ***disa... | 2021/10/14 | [
"https://Stackoverflow.com/questions/69577447",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6081163/"
] | You can [use the `enabled` modifier](https://tailwindcss.com/docs/hover-focus-and-other-states#enabled) to only apply a certain class when the button is enabled.
This allows you to specify classes to be added only when the button enabled, rather than attempting to "remove" certain classes when the button is disabled.
... | If you want your disabled buttons to not trigger any interaction state like `:hover` or `active`, you can also simply add
```
disabled:pointer-events-none
```
to the tailwind className. |
54,615 | As far as I know, it's possible to create a radially polarised ring magnet, where one pole is on the inside, and the field lines cross the circumference at right angles.

So imagine if I made one which was shaped like a sector of a torus.
![Radial... | 2013/02/21 | [
"https://physics.stackexchange.com/questions/54615",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/3220/"
] | I think Emilio Pisanty's answer is good enough. But here is another longer, 'magnetic charge' approach. (
Let's specify the coordinates first (sorry I borrow your picture).

It's obvious that the toroid is symmetrical under rotation along $\hat{\phi... | If all of the segments necessary to form such a toroid could be put in place, it would form a larger, and more powerful, version of one of the segments except that it would be hollow instead of solid. This is possible due to the fact that a magnetic field is capable of penetrating, and passing through, the material of ... |
22,758,460 | I´m sure that I`m missing something but it seams to me that the behavior hows the HttpClient sends request differs, when it comes to arguments.
The Problem is, that any request with arguments results in the status code 501.
With the 4.2 version those requests was handled properly.
The tricky part is, that there is no... | 2014/03/31 | [
"https://Stackoverflow.com/questions/22758460",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1195266/"
] | >
> I am using Netbeans on a Windows machine, what happens is that if I
> run the main java file the look and feel I get is different than in
> the case I run the whole program.
>
>
>
When you run a Swing application the default Look and Feel is set to a cross-platform L&F also called [Metal](http://docs.oracle.... | I would recommend to try to change your LAF in your main method, like:
```
public static void main(String[] args){
Frame f; // Your (J)Frame or GUI-Class.
// some code here...
try{
UIManager.setLookAndFeel(new NimbusLookAndFeel()) // Because it seems to be Nimbus what you want.
SwingUtilities.updateCompo... |
23,566,980 | I'm writing an app that gets a `Json` list of objects like this:
```
[
{
"ObjectType": "apple",
"ObjectSize": 35,
"ObjectCost": 4,
"ObjectTaste": "good",
"ObjectColor": "golden"
},
{
"ObjectType": "books",
"ObjectSize": 53,
"ObjectCost": 7,
"Pages... | 2014/05/09 | [
"https://Stackoverflow.com/questions/23566980",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2426155/"
] | Some time ago I had the same problem.
You'll can use Json.NET, but if you don't have control over the json document (as in: 'it has been serialized by some other framework') you'll need to create a custom JsonConverter like this:
```
class MyItemConverter : JsonConverter
{
public override bool CanConvert(Type ob... | You can use a [CustomCreationConverter](http://james.newtonking.com/json/help/index.html?topic=html/CustomCreationConverter.htm). This lets you hook into the deserialization process.
```
public abstract class Base
{
public string Type { get; set; }
}
class Foo : Base
{
public string FooProperty { get; set; }... |
8,603,336 | Due to me receiving a very bad datafile, I have to come up with code to read from a non delimited textfile from a specific starting position and a specific length to buildup a workable dataset. The textfile is not delimited in **any** way, **but** I do have the starting and ending position of each string that I need to... | 2011/12/22 | [
"https://Stackoverflow.com/questions/8603336",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1069299/"
] | Solved this ages ago, just wanted to post the solution that was suggested
```
using (StreamReader sr = new StreamReader(path2))
{
string line;
while ((line = sr.ReadLine()) != null)
{
dsnonhb.Tables[0].Columns.Add("InvoiceNum" );
... | I've created a class called `AdvancedStreamReader` into my `Helpers` project on git hub here:
<https://github.com/jsmunroe/Helpers/blob/master/Helpers/IO/AdvancedStreamReader.cs>
It is fairly robust. It is a subclass of `StreamReader` and keeps all of that functionality intact. There are a few caveats: a) it resets t... |
1,817,370 | I would like to be able to use ediff with "git mergetool".
I found some patches that alter the source code, which I don't want to do. Instead, I'd like to add ediff support with my .gitconfig.
I know git has builtin support for emerge, but I prefer ediff.
I attempted to add these lines to my .gitconfig:
```
[merget... | 2009/11/30 | [
"https://Stackoverflow.com/questions/1817370",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/205756/"
] | Thanks, it also works in xemacs, however the quoting as in [the reply by pmr](https://stackoverflow.com/questions/1817370/using-ediff-as-git-mergetool/1817763#1817763) doesn't seem to work whereas I think the quoting in all the other replies is fine:
```
[mergetool "ediff"]
cmd = xemacs -eval \"(ediff-merge-files-... | Combining my favorite ideas from above. This configuration uses
emacsclient and require therefore that an emacs is already running.
This also works for git difftool - it will invoke ediff-files. (When
git difftool calls then the ancestor will be equal to the merged.)
In .gitconfig:
```
[mergetool "ec-merge"]
... |
35,899,498 | I am trying to convert datetime value from this format `Wed Mar 9 09:48:09 PST 2016` into the following format `YYYY-MM-DD HH:mm:ss`
I tried to use [moment](https://github.com/moment/moment) but it is giving me a warning.
```
"Deprecation warning: moment construction falls back to js Date. This is discouraged and wil... | 2016/03/09 | [
"https://Stackoverflow.com/questions/35899498",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4967389/"
] | You could try using `Date.toJSON()` , `String.prototype.replace()` , `trim()`
```js
var date = new Date("Wed Mar 9 09:48:09 PST 2016").toJSON()
.replace(/(T)|(\..+$)/g, function(match, p1, p2) {
return match === p1 ? " " : ""
});
console.log(date);
``` | Since you tagged your question with [moment](/questions/tagged/moment "show questions tagged 'moment'"), I'll answer using moment.
First, the deprecation is because you are parsing a date string without supplying a format specification, and the string is not one of the standard ISO 8601 formats that moment can recogni... |
17,442,340 | I have create an popup menu in my app the problem with it is when i open the popup menu and then scroll the page the popup menu also scrolls up with the page even i tried using data-dismissible="false" but nothing happen still the problem remains same.
Thanks in advance. | 2013/07/03 | [
"https://Stackoverflow.com/questions/17442340",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2307391/"
] | There's an easy fix for this problem. Just prevent page scrolling when popup is active.
Working **`jsFiddle`** example: <http://jsfiddle.net/Gajotres/aJChc/>
For this to work popup needs to have an attribute: **`data-dismissible="false"`** it will prevent popup closure when clicked outside of it. Another attribute ca... | For me this method didn't work, it works on browser but not in Phone Gap application.
So I resolve it in this way:
```
$('#Popup-id').on({
popupbeforeposition: function(){
$('body').on('touchmove', false);
},
popupafterclose: function(){
$('body').off('touchmove');
}
});
```
Hope it helps! |
11,994,008 | I'm totally new to AWK, however I think this is the best way to solve my problem and a good time to learn AWK.
I am trying to read a large data file that is created by a simulation program. The output is made to be readable by humans, so its formatting isn't very consistent. An example of the output is in this image
<... | 2012/08/16 | [
"https://Stackoverflow.com/questions/11994008",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1585760/"
] | I ran into the same problem; it seems you need these three settings in particular:
1. `STATIC_ROOT` must be defined in your `settings.py`, for example:
```
STATIC_ROOT = os.path.join(PROJECT_PATH, 'served/static/')
```
Where `PROJECT_PATH` is your project root (in your case, the absolute path to the `myproject_djan... | I found [here](http://www.realpython.com/blog/python/migrating-your-django-project-to-heroku/) good way to resolve all my problems with Django on heroku |
7,428,610 | Is there a way to get the parameters from a XML view, modify some stuff on it and then use it as content view ?
Let's say I have a normal LinearLayout and I want to make that work:
```
LinearLayout layout = (LinearLayout) findViewById(R.layout.main);
setContentView(layout);
```
Instead of :
```
setContentView(R.la... | 2011/09/15 | [
"https://Stackoverflow.com/questions/7428610",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/880670/"
] | Yes.
To be more specific, we need more specific info from you.
**Edit**
You can, for example, do the following.
Say you have in your xml specification a TextView:
```
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:id="@+id/mytv"
android:lay... | You can do anyything you want to the layouts even after setContentView. When you do operations like add items to a layout or set a background, the views in the screen are redrawn.
onCreate method is where you can modify layouts as it it about to begin drawing on to a screen. |
14,512,182 | I am looking for a simple code to create a WebSocket server. I found phpwebsockets but it is outdated now and doesn't support the newest protocol. I tried updating it myself but it doesn't seem to work.
```
#!/php -q
<?php /* >php -q server.php */
error_reporting(E_ALL);
set_time_limit(0);
ob_implicit_flush();
$m... | 2013/01/24 | [
"https://Stackoverflow.com/questions/14512182",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1839439/"
] | I was in the same boat as you recently, and here is what I did:
1. I used the [phpwebsockets](http://socketo.me/) code as a reference for how to structure the server-side code. (You seem to already be doing this, and as you noted, the code doesn't actually work for a variety of reasons.)
2. I used PHP.net to read the ... | As far as I'm aware [Ratchet](http://socketo.me/) is the best PHP WebSocket solution available at the moment. And since it's [open source](https://github.com/cboden/Ratchet) you can see how the author has built this WebSocket solution using PHP. |
674,700 | I was for quite some time under the impression that a `for` loop could exist *solely* in the following format:
```
for (INITIALIZER; STOP CONDITION; INC(DEC)REMENTER)
{
CODE
}
```
This is, however, most *definitely* not the case; take a look at this JavaScript implementation of the [Fisher-Yates Shuffle](http:... | 2009/03/23 | [
"https://Stackoverflow.com/questions/674700",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/59107/"
] | The code you quote is obfuscated in my opinion. There are much clearer ways to write the same functionality.
However, your understanding is pretty much right. The following is the exact same code, except for whitespace and comments.
```
for (
// Initializer
var j, x, i = o.length;
// Continue condition... | They've pretty much just moved the body of the loop into the incrementer section. You can re-write the for loop as a while loop to get some idea of what it is doing:
```
shuffle=function(o) {
var j; //Random position from 0 up to the current position - 1
var x; //temp holder for swapping positions
var i=o... |
909,361 | i want to realize a construct in MS SQL that would look like this in Oracles PL/SQL:
```
declare
asdf number;
begin
for r in (select * from xyz) loop
insert into abc (column1, column2, column3)
values (r.asdf, r.vcxvc, r.dffgdfg) returning id into asdf;
update xyz set column10 = asdf where ID = r.ID;
end ... | 2009/05/26 | [
"https://Stackoverflow.com/questions/909361",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/109321/"
] | If I understood what you asked (I'm not proficient with PL/SQL), looks like a pretty easy task:
```
INSERT INTO abc(column1, column2, column3) SELECT asdf, vcxvc, dffgdfg FROM xyz;
UPDATE xyz SET column10 = id;
```
But I'm just guessing your intention, hope haven't misunderstood.
P.S.: as someelse already pointed o... | Hope this is what you are looking for:
```
declare
asdf number;
begin
for r in (select * from xyz) loop
insert into abc (column1, column2, column3)
values (r.asdf, r.vcxvc, r.dffgdfg) returning id into asdf;
update xyz set column10 = asdf where ID = r.ID;
end loop;
end;
```
*would become*
```
DECLARE @... |
82,937 | I'm implementing a D3D10 version of my renderer (not porting to avoid losing Windows XP support). I didn't go straight to D3D11 because MSDN and other sources recommend upgrading to 10 and then to 11.
From what I've read so far, what used to be done with `IDirect3D9::SetRenderState` is done in D3D10 with `ID3D10Raster... | 2014/09/04 | [
"https://gamedev.stackexchange.com/questions/82937",
"https://gamedev.stackexchange.com",
"https://gamedev.stackexchange.com/users/15732/"
] | Direct3D 10.x and Direct3D 11.x do not support the 'legacy fixed-function' pipeline that your Direct3D 9 code is using. Preparing to move to Direct3D 10 or 11 means eliminating all fixed-function usage and moving to programmable shaders.
It is also apparent from your code snippet that you are not using the state objec... | You're right, there is no lighting in D3D10 unless you implement it yourself in shaders. |
344,537 | I have a work question. In our attempt to give names to fields on a repair card we are now using the phrase "Source card" and "Child card".
My opinion is that it would be more logical to use "Parent card" and "Child card", but if I want to keep using the term "Source card" how would I now name the child card???
>
> "... | 2016/08/24 | [
"https://english.stackexchange.com/questions/344537",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/192864/"
] | Somewhat similar and probably rare and usually circulated in Christian circles.
>
> Today, I have a meeting with Pastor Pillow and Sister Sheets.
>
>
>
It uses a typical term for a Christian leader (pastor and sister), but uses a last name of articles found on a bed. Thereby it refers to scheduled time in bed, pr... | Focusing on the sickness aspect rather than the being in bed part should produce a lot of phrases in English, probably predominantly euphemisms for the actual act of vomiting. If I wanted to make light of having been so ill recently that I'd thrown up, I might pick one of:
* driving the porcelain bus (gripping the toi... |
10,187,280 | I'm trying to "select" a img inside a $(this) selector. I know I can find it by using `.find('img')` but is this possible:
`$("img",this)` ?
What's the most optimal way to do this?
Originally code
```
<a class="picture" href="test.html">
<img src="picture.jpg" alt="awesome">
</a>
``` | 2012/04/17 | [
"https://Stackoverflow.com/questions/10187280",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1071525/"
] | >
> What's the most optimal way to do this?
>
>
>
Both `$(this).find('img')` and `$('img', this)` are equivalent.
From the docs:
>
> Internally, selector context is implemented with the .find() method,
> so $('span', this) is equivalent to $(this).find('span').
>
>
>
<http://api.jquery.com/jQuery/> | Why can't you use `.find('img')`? it works to me : <http://jsfiddle.net/nnmEY/> |
51,070 | Is it possible to push or pop a length like parindent? I want to change it temporarily but reset it soon after.
I have a solution but looking for something a little nicer. I'll post it as an answer. | 2012/04/07 | [
"https://tex.stackexchange.com/questions/51070",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/11637/"
] | You can implement a stack without using LaTeX3 as well, by using a token list and some macros. That would work as follows:
```
\documentclass{article}
\newtoks\paridstack
\paridstack={\empty}
\def\push#1#2{%
\begingroup\toks0={{#1}}%
\edef\act{\endgroup\global#2={\the\toks0 \the#2}}\act
}% push #1 onto #2
\def\p... | This solution is just a response to Roelof. I hope it is appropriate here. I replace `\empty` by `\roelofstackbegin` in his solution. This is safer than using `\empty`. Roelof's stack looks like an all-purpose stack. So any possible source of failure should be avoided.
```
\documentclass{article}
\makeatletter
\newtok... |
73,207,202 | When load more is clicked, `count` value is not getting updated only on the second click it is getting updated.
Expectation is on load more button click value should be passed as `2`, but now it is sending as `1`.
what I'm doing wrong here. Please guide
Below is the sample code.
```
const [count, setCount] = useSta... | 2022/08/02 | [
"https://Stackoverflow.com/questions/73207202",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16491376/"
] | The error was pretty stupid, I wrote "$this->$price" instead of "$this->price".
Sorry | ```
return User::where('id', $this->seller_id)->update(array('balance' => $money));
``` |
8,434,356 | Page link I am working on is <http://www.whatcar.com/car-news/subaru-xv-review/260397>
I am trying to automate 'clicking the google link' but am having no luck and keep receiving an error.
Link HTML:
```
<a tabindex="0" role="button" title="" class="s5 JF Uu" id="button" href="javascript:void(0);" aria-pressed="fals... | 2011/12/08 | [
"https://Stackoverflow.com/questions/8434356",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1049663/"
] | The link is inside a frame. To make it even more fun, frame `id` is different every time the page is refreshed.
```
browser.frames.collect {|frame| frame.id}
=> ["I1_1323429988509", "f3593c4f374d896", "f4a5e09c20624c", "stSegmentFrame", "stLframe"]
browser.refresh
=> []
browser.frames.collect {|frame| frame.id}
=>... | **The technical answer:**
The class of the button on the page that you linked is different for me than the class that you list. It looks like it behaves differently based on the cookies on your local machine (which would be absent during a Watir-driven Firefox or IE session).
You would need to find a different element... |
67,981,140 | I have an alert component which has a flag `isVisible`, this flag is becoming true when the component is created, and also in the created HOOK I have a `setTimeout` which starts if the component receives DESTROY boolean prop:
```
props: {
destroy: {
type: Boolean,
default: false,
},
}
```
```
data() {
... | 2021/06/15 | [
"https://Stackoverflow.com/questions/67981140",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16230004/"
] | Your need to use fake timers here.
After all imports call `jest.useFakeTimers()`.
Then in test after mounting the component call `jest.runTimersToTime(2500)`. And after that you can do your assertions. Test example:
```
jest.useFakeTimers()
test('Component disappears after 2.5 seconds when it receives DESTROY prop', ... | Answer from @Eduardo is correct, just noting that Jest renamed **runTimersToTime()** to **advanceTimersByTime()** since Jest 22.0.0 |
298,177 | Or vice versa. Or perhaps a name for the pair itself?
For example:
* *hold* an *opinion*
* *make* a *complaint*
* *offer* an *apology*
Also, where might I find a list of such pairs?
---
EDIT: I chose my title wording randomly. I have no idea whether 'cognate verb' is the correct term for these things. However, I'v... | 2016/01/06 | [
"https://english.stackexchange.com/questions/298177",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/61558/"
] | These phrases are sometimes called "collocations". I don't know of a word for one element in the collocation. | As pointed out by others, the name for the phenomenon you've isolated is ***verb noun collocation*** or ***verb + noun collocation***.
If you google these phrases, you should be directed to various sites which give examples. I know of no master list, but you could probably start to compile one yourself. |
481,947 | I am having problems while trying to start my first node using KVM (QEMU 2.0.0) and MAAS. Automatic detection worked fine, and during the commission (virtual machine window) I get errors such as:
```
Booting under MAAS directions...
nomodeset iscsi_target_name=(...)
maas loading amd64/generic/trusty/release/boot-kerne... | 2014/06/11 | [
"https://askubuntu.com/questions/481947",
"https://askubuntu.com",
"https://askubuntu.com/users/287964/"
] | In the later days of the teletypes, it was adopted by the deaf community as a form of communications. Officially called TDD (Telephone Device for the Deaf) with the development & refinement of equipment that used the same communication media of Baudot and Ascii, it was widely adopted by the deaf to sign "TTY" because i... | Some of us want a one sentence answer:
>
> is this just a fancy name for saying "I am using the terminal" or **tty = the "the process associated to the terminal process that exchanges information with the system and you"**
>
>
>
I like the visual analogy here: <https://askubuntu.com/a/482244/230288> you can see h... |
21,878,005 | I am using dc.js,
I want to add filter based on checkbox selection. Here is my scenario

When i select checkboxes based on that i need filter.
Here is my code
```
var ndx = crossfilter(readData);
var practiceDimension = ndx.dimension(... | 2014/02/19 | [
"https://Stackoverflow.com/questions/21878005",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/998600/"
] | HTTP is stateless protocol and the global variable are not preserved between postback. You can store data required to be preserved in `postback` in ViewState. If the data is not small it would be better for storing it in some persistent medium like XML / database to keep the ViewState as small as possible as it is adde... | As Adil says HTTP is stateless. every time request goes to the server you get a refresh page.
If viewstate is not doing your work you can store your data in session. But avoid saving large amount of data in session or viewstate. if you have large data to store then use xml to store data.some of the benifite of usin... |
275,643 | Let $$A(p,q) = \sum\_{k=1}^{\infty} \frac{(-1)^{k+1}H^{(p)}\_k}{k^q},$$
where $H^{(p)}\_n = \sum\_{i=1}^n i^{-p}$, the $n$th $p$-harmonic number. The $A(p,q)$'s are known as *alternating [Euler sums](http://mathworld.wolfram.com/EulerSum.html)*.
>
> Can someone provide a nice proof that
> $$A(1,1) = \sum\_{k=1}^{\i... | 2013/01/11 | [
"https://math.stackexchange.com/questions/275643",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/2370/"
] | Actually it suffices to know the generating function
$$\sum\_{k\geq 1}H^{(p)}\_kx^k=\frac{\mathrm{Li}\_p(x)}{1-x}$$
Upon integrating we obtain
$$\sum\_{k\geq 1}\frac{H^{(p)}\_k}{k}x^k=\mathrm{Li}\_{p+1}(x)+\int^x\_0 \frac{\mathrm{Li}\_p(t)}{1-t}\,d t$$
$$\sum\_{k\geq 1}\frac{H\_k}{k}x^k=\mathrm{Li}\_{2}(x)+\frac{... | A full derivation of $A(m,1), \ m\ge2$, is found in [this answer](https://math.stackexchange.com/q/3236584),
\begin{equation\*}
\sum\_{n=1}^{\infty} (-1)^{n-1}\frac{H\_n^{(m)}}{n}=\frac{(-1)^m}{(m-1)!}\int\_0^1\frac{\displaystyle \log^{m-1}(x)\log\left(\frac{1+x}{2}\right)}{1-x}\textrm{d}x
\end{equation\*}
\begin{equat... |
9,411,711 | I'm stuck,
this must be very simple to accomplish but i'm not seeing how.
I have this code:
```
var divEl = doc.DocumentNode.SelectSingleNode("//div[@id='" + field.Id + "']");
var newdiv = new HtmlGenericControl("div");
newdiv.Attributes.Add("id", label.ID);
newdiv.Attributes.Add("text", label.Text);
newdiv.Att... | 2012/02/23 | [
"https://Stackoverflow.com/questions/9411711",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1141518/"
] | Why not just create the node using HAP's API instead? It should work very similarly.
```
var newDiv = HtmlNode.CreateNode("<div/>");
newDiv.Attributes.Add("id", label.ID);
newDiv.Attributes.Add("text", label.Text);
newDiv.Attributes.Add("class", label.CssClass);
divEl.AppendChild(newDiv);
```
There is no easy way t... | Well there is a way to get your OuterHtml from HtmlGenericControl:
```
using (TextWriter textWriter = new StringWriter())
{
using (HtmlTextWriter htmlWriter = new HtmlTextWriter(textWriter))
{
HtmlGenericControl control = new HtmlGenericControl("div");
control.Attributes.Add("One", "1");
... |
62,725,323 | I have an Object that i will later write to a JSON for storage. This particular project is for spawning enemies for an rpg-bot I'm making. I have a "bestiary" with the enemies stats, and I'm trying to spawn multiple enemies in order into an encounter.
Here's a code snippet as it is now:
```js
SpawnEncounter(message, ... | 2020/07/04 | [
"https://Stackoverflow.com/questions/62725323",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13556588/"
] | **State look be like this**
```
const [name, setName] = useState ('')
const [date, setDate] = useState ('')
```
**function look be like this**
```
const onChangeText = e => setName(e.target.value)
const onChangeDate = e => setDate(e.target.value)
```
**input look be like this**
```
<TextInput style =... | setting the state to object should be done like this, accessing each key-value pair.
```
export default function CreateOrderPage() {
const [state, setState] = useState ({
companyName: '',
beginDate: ''
})
return (
{/* Some code */}
<TextInput style = {styles.inputText}
... |
69,764,994 | I am trying to insert a value using following code
```
insert_query = """INSERT OR REPLACE INTO results
(output_text, processed)
VALUES
('html', 1)
select user_id, user_token FROM results
... | 2021/10/29 | [
"https://Stackoverflow.com/questions/69764994",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7460823/"
] | You'll want to drop that [`await-to-js`](https://www.npmjs.com/package/await-to-js) that transforms promise rejections into error/result tuples here and just use the plain functions.
Once you've done that, you can just
```
try {
const loginRes = await sa_login(req);
const infoRes = await sa_getUserInfo(loginRes);... | Just use `Promise.all()`. But the 1st request has to complete before you can kick off the next two (which can run in parallel):
```js
try {
const login = await sa_login(req)
const [ userInfo, courseInfo ] = await Promise.all([
sa_getUserInfo(login),
sa_getCourseInfo(login)
]);
// do something usefu... |
42,344,232 | I am using laravel 5.1 with mongodb, I need to display users list on a blade, i am using Laravel relationship method(hasMany), i tried but i got
```
error(Undefined property: Illuminate\Database\Eloquent\Collection::$roles)
```
Table structure:
```
users-> userid, username,email, roleid.
user_roles->roleid,rolename... | 2017/02/20 | [
"https://Stackoverflow.com/questions/42344232",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | in controller update your code to this
```
$users = User::with('roles')->whereHas('roles', function ($query) {
$query->where('roleid', '>', 0);
})->get();
return view('Manage_users', compact('users'));
``` | you can use following code in your view.
```
<table>
<tr>
<th>User Name</th>
<th>Role</th>
</tr>
@foreach($users as $user)
<tr>
<td>{{ $user->username }}</td>
<td>{{ $user->roles->rolename }}</td>
</tr>
@endforeach
</table>
```
Above code will ... |
48,540,460 | I'm getting a weird regex validation failure for Kubernetes Api version - "extensions/v1beta1" while creating a deployment.
```
kubectl --kubeconfig=/var/go/.kube/mcc-pp-config --context=sam-mcc2-pp --namespace=sam-mcc2-pp apply -f k8s-config-sam-mcc2-pp/sf-spark-worker-deployment.yaml --record
Error from server (Bad... | 2018/01/31 | [
"https://Stackoverflow.com/questions/48540460",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5887944/"
] | you need to add some methods to your code :
FirebaseMessagingService:
```
package com.example.firebasenf.firebasenf;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.support.v4.app.NotificationCompat;
import c... | you need to override `onMessageReceived` in `MyFirebaseMessagingService` class to do some actions when notification is pushed.
[doc](https://firebase.google.com/docs/cloud-messaging/android/receive)
>
> By overriding the method FirebaseMessagingService.onMessageReceived,
> you can perform actions based on the recei... |
6,260,383 | I have set up Jenkins, but I would like to find out what files were added/changed between the current build and the previous build. I'd like to run some long running tests depending on whether or not certain parts of the source tree were changed.
Having scoured the Internet I can find no mention of this ability within... | 2011/06/07 | [
"https://Stackoverflow.com/questions/6260383",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/451079/"
] | With Jenkins pipelines (pipeline supporting APIs plugin 2.2 or above), this solution is working for me:
```
def changeLogSets = currentBuild.changeSets
for (int i = 0; i < changeLogSets.size(); i++) {
def entries = changeLogSets[i].items
for (int j = 0; j < entries.length; j++) {
def entry = entries[j]
def... | Note: You have to use Jenkins' own SVN client to get a change list. Doing it through a shell build step won't list the changes in the build. |
70,147,309 | Lately i followed a course of Operating Systems that sent me to the barrier pseudocode from the little book of semaphores. But for a few hours now i'm struggling to implement this barrier, i can't seem to understand it properly. To understand it, i tried a simple program that lets threads come to barrier, and when all ... | 2021/11/28 | [
"https://Stackoverflow.com/questions/70147309",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17329663/"
] | You need to format your float result with the .toFixed(x) method.
Here is a full code sample for this:
```
const p1 = parseFloat(product.price1['regionalPrice']);
const p2 = parseFloat(product.price2['marketPrice']);
const p3 = parseFloat(product.price3['localPrice']);
const price = Math.floor((p1 + p2 + p3) * 10) /... | You could try rounding your numbers with the number.toFixed() function where you pass 1 as a function argument.
I tried it and
`num = 22; num = nums.toFixed(1); console.log(num)`
prints out 22.0.
Hope that this is what you were looking for ^^ |
3,291,889 | All rings are commutative ring with unity.
Let $A$ and $B$ are two $R$-algebras and $I$ and $J$ are two ideals of $A$ and $B$ respectively. I want to show that $A\otimes\_R B/(I\otimes\_R B+A\otimes\_R J)\cong (A/I)\otimes\_R (B/J)$.
Theres is a map from $A\otimes\_R B/(I\otimes\_R B+A\otimes\_R J)$ to $(A/I)\otimes\... | 2019/07/13 | [
"https://math.stackexchange.com/questions/3291889",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/688673/"
] | You can use $\cos 3x=4\cos^3x-3\cos x$, along with $\cos\pi=-1$. If we let $t=\cos\pi/3$, we have
$$4t^3-3t=-1$$
$4t^3-3t+1$ factorises as $(t+1)(4t^2-4t+1)$, giving $t=-1$ or $t=\frac12$. These correspond to $t=\cos\pi$ and $t=\cos\pm\pi/3$. Hence $\cos\pi/3=\frac12$. | We have that $\cos(3x)=4\cos^3(x)-3\cos(x)$ (by <https://en.wikipedia.org/wiki/List_of_trigonometric_identities#Triple-angle_formulae>).
Then $-1=\cos(\pi)=4\cos^3(\pi/3)-3\cos(\pi/3)$. Try solving the equation $4y^3-3y+1=0$. |
15,032,487 | (sorry for my english)
I can't belive the only way for animations on canvas is the 'setInterval()'
somebody know better?
setInterval is too slow and its work bad with old devices. | 2013/02/22 | [
"https://Stackoverflow.com/questions/15032487",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1980508/"
] | Use CSS3 animations and transitions.
Most modern browsers will hardware accelerate them; they will be much faster than anything you can write in Javascript.
If your animations are too complicated for pure CSS, use `requestAnimationFrame()`, which will allow your animations to run at the browser frame rate and avoid... | Try using `setTimeout` rather than `setInterval`. It often works smoother. |
30,840,819 | Users upload files into my express app. I need to calc hash of the uploaded file and then write file to disk using calculated hash as a filename. I try to do it using the following code:
```
function storeFileStream(file, next) {
createFileHash(file, function(err, hash) {
if (err) {
return next... | 2015/06/15 | [
"https://Stackoverflow.com/questions/30840819",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2568741/"
] | The correct and simple way should be as follow:
**we should resume the passthroughed stream**
```js
function storeFileStream(file, directory, version, reject, resolve) {
const fileHashSource = new PassThrough();
const writeSource = new PassThrough();
file.pipe(fileHashSource);
file.pipe(writeSource);
// th... | You could use the [async](https://github.com/caolan/async) module (not tested but should work):
```
async.waterfall([
function(done) {
var hash = crypto.createHash('sha1');
hash.setEncoding('hex');
file.on('error', function(err) {
done(err);
});
file.on('end', f... |
16,213,498 | Currently I'm using InStr to find a string in a string, I'm new to VB.NET and wondering if I can use InStr to search every element of an array in a string, or a similar function like this:
```
InStr(string, array)
```
Thanks. | 2013/04/25 | [
"https://Stackoverflow.com/questions/16213498",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1134550/"
] | Converting SysDragon's answer to classic asp:
You need to loop:
```
Dim bFound
bFound = False
For Each elem In myArray
If InStr(myString, elem)>=0 Then
bFound = True
Exit For
End If
Next
```
You can transform it into a function to call it more than once easily:
```
Function MyInStr(myStrin... | `Instr` returns an integer specifying the start position of the first occurrence of one string within another.
Refer [this](http://www.homeandlearn.co.uk/net/nets7p4.html)
To find string in a string you can use someother method
Here is an example of highlighting all the text you search for at the same time but if th... |
43,935,283 | My goal is to provide a new means of communication to merchants. These merchants will seize their ads on a platform and the beacons will take care of "spreading" them.
The mobile application will therefore scan the beacons on the background (the most frequent case) and retrieve merchants' ads based on the ids of the d... | 2017/05/12 | [
"https://Stackoverflow.com/questions/43935283",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8001849/"
] | Using Gridview Row Databound bind value of label4
```
Label Label4 = (Label)e.row.findcontrol("Label4");
Label4.text = (Your Value assign here)
```
so display your value | I've had this issue which disappeared when I commented out everything inside my GridView1\_RowDataBound(object sender, GridViewRowEventArgs e) method. I was adding a tooltip to all cells in the row which I think overwritten it.
```
protected void GridView2_RowDataBound(object sender, GridViewRowEventArgs e)
{
// ... |
47,013,147 | The JSON Data is as below
```
{"ServerFiles": [
{"filepath": "in/b1_30102017d.ini"},
{"filepath": "in/b1_30102017d.log"},
{"filepath": "in/b1_30102017d.txt"},
{"filepath": "out/b1_30102017d.log"},
{"filepath": "out/b1_30102017d.csv"}
]}
```
I want to get the the path of ini file. This works
```
$.Se... | 2017/10/30 | [
"https://Stackoverflow.com/questions/47013147",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2587935/"
] | Replace `PSWD` with `PASSWD` and replace `PASSWD="aabbcc"` with `export PASSWD="aabbcc"`. | YES is good now
it's been hours that I'm on and I could not see anything!
```
#!/bin/bash
USERNAME=$1 # "toto02"
export PASSWD=$2 # "aabbcc"
ORIGPASS=`grep -w "$USERNAME" /etc/shadow | cut -d: -f2`
export ALGO=`echo $ORIGPASS | cut -d"$" -f2`
export SALT=`echo $ORIGPASS | cut -d"$" -f3`
echo "a... |
22,780,143 | OK so i'm trying to clean up my code because it is a mess and what i have is 25 richtext boxes and i want to put their .Visible variable into an array and have a for statement go through and make each false so that the text box doesn't show up what i have tried hasn't worked and i can't figure it out what i have is.
`... | 2014/04/01 | [
"https://Stackoverflow.com/questions/22780143",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3448117/"
] | You canot change the `bool` in the array and expect that that changes the `Visible` state of the TextBoxes.
You have to change that property. Therefore you either have to store these controls in a collection or use a different approach: If they are in the same container control (like `Form`, `GroupBox`, `Panel` etc.)... | `TextBox.Visible` is a property and as such returns a *value*. Your array of Boolean therefore contains values as well. Changing this value does nothing to your textbox, because it doesn't know anything of the textbox anymore.
Storing a reference to a value is not possible in C#, so try the following instead:
```
R... |
232,058 | If AV auto-scan will detect and prevent the malware from executing why there is a need to enable schedule/full scans?
I'm asking because a full scan can create sometimes overhead on the machine and network, so I'm trying to understand the advantages of enabling full scanning if auto-scan will provide AV protection wh... | 2020/05/23 | [
"https://security.stackexchange.com/questions/232058",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/188315/"
] | From your description of a full scan a reason why it is better, is if a file or executable on your computer that is malicious was downloaded from the internet, but bypassed the Auto-protect at the time. This is possible if the type of virus was was not known at the time the file was downloaded, (this type of scenario i... | Typically (and perhaps just personally) I don't perform full scans on schedule or any other method unless I notice actual *symptoms* or suspicious system activity/behavior. On the other hand, some may disagree with this - I would have been among them 10-15 years ago - therefore, if its believed to be a necessity, I sug... |
3,138 | I am looking through unanswered questions (specifically in combinatorics, but this is irrelevant) and I want to ask advice on how to proceed.
Apart from questions that I can simply answer or where I can upvote a correct answer that got no votes at all, I found the following type of questions:
1. Hard questions
Obvio... | 2011/10/30 | [
"https://math.meta.stackexchange.com/questions/3138",
"https://math.meta.stackexchange.com",
"https://math.meta.stackexchange.com/users/9325/"
] | For case (3) you should just write an answer yourself, summarizing the solution from the comments -- or even just pointing to it, if it is more than a few days old. This will bump the question and hopefully attract someone else to upvote the answer.
Some may see this as a way to troll for easy points. Personally I don... | Case 2 is partially addressed in [Moderator Clean-up of Abandoned Poor-Quality Questions](https://math.meta.stackexchange.com/questions/2018/moderator-clean-up-of-abandoned-poor-quality-questions) , where the consensus seems to be that moderators shouldn't unilaterally close those questions. For questions that are old ... |
61,641,280 | I found similar posts, mostly related to linux on venv having an issue with working. [python 3.8 venv missing activate command](https://stackoverflow.com/questions/59557922/python-3-8-venv-missing-activate-command) However, I am confused on how to solve it on windows, and what is happening.
I installed python3.8 from... | 2020/05/06 | [
"https://Stackoverflow.com/questions/61641280",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12392112/"
] | I had the same problem (with both Python 3.7 and 3.8), I believe it was due to a Windows update when I enrolled in the Windows Insiders program, but that could have just been a coincidence.
```
PS C:\Users\Your Name\AppData\Local\Programs\Python\Python38> ./python -m venv c:\TEMP\py38-venv
Error: Command '['c:\\TEMP\\... | Thanks. I faced the same issue and this thread worked around for me. I uninstalled Python and installed 3.9. Python version (which was available for me at the time) checking "Install for all users" in advanced installing. Remember to check "Add the PATH" box so that you can run Python from the command prompt. |
67,776,758 | I am working on a top-down 2D game project. The character must follow the mouse cursor all the time, this is what I could do so far. I also want the character to slide towards the mouse for a limited distance when clicked.
So let's say the character position is: 0, 0, 0
Mouse click position: 8, 4, 0
When clicked, the ... | 2021/05/31 | [
"https://Stackoverflow.com/questions/67776758",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7086686/"
] | The main issue I guess is that you constantly update the targetPosition as long as you hold the mouse button down. This would make it pretty hard to tell from which start point you actually want to allow maximum distance and when exactly you allow a new range.
I would assume you allow to move around in a range of `max... | You can simply calculate the delta distance and its vector between Origin and your Destination.
After normalizing those values, you could multiply them with some kind of 'base distance' for example in this case your (2, 2, 0) and add/subtract it from your destination, something like that should do the trick:
```
var d... |
9,866 | How can I go about killing IP connections that seem to be sending a lot of requests to the same url? Let's say I have someone who requests the same url for more than 10 times in 5 seconds, I want to "cool" him off. Any ideas on how it's done? | 2011/12/19 | [
"https://security.stackexchange.com/questions/9866",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/6475/"
] | On \*nix, you can use fail2ban with a something like this in your jail.conf (100 requests in 30 seconds means a 5 minute ban). Of course, you'll have to adjust this for how many requests you expect from a legitimate user -- as @Jeff Ferland points out in the comments below, you need to account for the number of request... | Would [mod\_evasive](http://www.zdziarski.com/blog/?page_id=442) be what you're looking for? It's focused on DoS attacks and limits the number of requests to a page per second. Otherwise, you might be able to adapt [fail2ban](http://www.fail2ban.org) to help out. |
34,425,237 | Came across this question in an interview blog. Given free-time schedule in the form `(a - b) i.e., from 'a' to 'b'` of `n` people, print all time intervals where all `n` participants are available. It's like a calendar application suggesting possible meeting timinings.
```
Example:
Person1: (4 - 16), (18 - 25)
Perso... | 2015/12/22 | [
"https://Stackoverflow.com/questions/34425237",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/685621/"
] | Got this today during an interview. Came up with an `O(N*logN)` solution. Wondering whether there is an `O(N)` solution available...
Overview: Join individual schedules into one list `intervals` --> Sort it by intervals' starting time --> Merge adjacent intervals if crossing --> Returning the availability is easy now.... | I prefer to take a slightly different approach that's set based! I'll let the language elements do the heavy lift for me. As you guys have already figured out I'm making some assumptions that all meetings are on the top of the hour with an interval length of 1 hour.
```py
def get_timeslots(i, j):
timeslots = set()... |
24,863,713 | I am new to Scrapy and Python and I am enjoying it.
Is it possible to debug a scrapy project using Visual Studio? If it is possible, how? | 2014/07/21 | [
"https://Stackoverflow.com/questions/24863713",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3860415/"
] | You can install [PTVS](http://pytools.codeplex.com/) in visual studio 2012. Then create a python project from existing python code, and import your code.
If you are familiar with Visual Studio, it's the same as other languages in Visual Studio, like C++/C#. Just create some break points and start your script with Debu... | I had the same problem, and Yuan's [initial answer](https://stackoverflow.com/a/24864440/25507) didn't work for me.
To run Scrapy, you need to open `cmd.exe` and
```
cd "project directory"
scrapy crawl namespider
```
* scrapy is scrapy.bat.
* namespider is the value of the field in spider class.
* To run Scrapy fro... |
20,206,852 | I have the following:
```
<tr>
<td>Value 1</td>
<td>Value 2</td>
<td>Value 3</td>
</tr>
```
Now, with jQuery I do this:
```
var jTR = $('tr');
var jFirstChild = jTR.find(':first-child');
```
but jFirstChild.length returns 0.
I also find that when I do jTR.length it too returns 0.
Ultimately, I am trying t... | 2013/11/26 | [
"https://Stackoverflow.com/questions/20206852",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1273008/"
] | If your subclasses vary only in the parameters passed to the superclass, you might be looking for the [Builder Pattern](http://en.wikipedia.org/wiki/Builder_pattern). A builder for the superclass lets you pass in whatever parameters you need without cluttering your constructor, and if you want subclasses for readabilit... | One thing to check is: should SuperClass be split into simpler classes?
If this can't be done: if you have too many parameters then you can have a special class that holds the parameters; with setters and getters for each parameter.
One can fill the values in from property files, so you can have profiles for common c... |
51,490,700 | I do not have admin rights on my work laptop. Have got python and pip installed on my machine, version numbers as below:
```
C:\Users\banand\AppData\Local\Programs\Python\Python36\Scripts>python --version
Python 3.6.1
C:\Users\banand\AppData\Local\Programs\Python\Python36\Scripts>pip --version
pip 9.0.1 from c:\users... | 2018/07/24 | [
"https://Stackoverflow.com/questions/51490700",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5373329/"
] | The post is 7 months old, but this can help others.
This worked for me on Windows 10 Pro without admin privileges:
python.exe -m pip install | I tried right on Jupiter notebook and it worked perfectly:
**code:**
```
import sys
!{sys.executable} -m pip install xarray
```
**sysmtem answer:**
```
Collecting xarray
Using cached https://files.pythonhosted.org/packages/10/6f/9aa15b1f9001593d51a0e417a8ad2127ef384d08129a0720b3599133c1ed/xarray-0.16.2-py3-none... |
786,527 | >
> Suppose $f:\mathbb{R} \supset E \rightarrow \mathbb{R}$ and $g: \mathbb{R} \supset E \rightarrow \mathbb{R}$ are uniformly continuous. Show that $f+g$ is uniformly continuous. What about $fg$ and $\dfrac{f}{g}$?
>
>
>
### My Attempt
Firstly let's state the definition; a function is uniformly continuous if
... | 2014/05/08 | [
"https://math.stackexchange.com/questions/786527",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/148713/"
] | **Product $fg$**
Boundnness is suffient but not necessary for uniform continuity of product $fg$.
Here is an example where $f,g$ both are unbounded but their product is uniformly continuous:
Let $E=[0,\infty)$ and $f(x)=g(x)=\sqrt{x}$. Here $f$ and $g$ are unbounded but their product $(fg)(x)=x$ is uniformly continuo... | As BCLC noted, how you got $$|f(x)g(x)-f(y)g(y)| \leq |g(x)||f(x)+f(y)|+|f(y)||g(x)+g(y)|$$ wasn't very clear. For the case $\frac{f}{g}$, you could note that $$\frac{f}{g} = f \cdot \frac{1}{g}$$
and use the previous part. |
114,919 | I'm looking for paper(s) that talk about "why low $R^2$ value is acceptable in social science or education research". Please point me to the right journal if you know one. | 2014/09/10 | [
"https://stats.stackexchange.com/questions/114919",
"https://stats.stackexchange.com",
"https://stats.stackexchange.com/users/55415/"
] | An arm-waving argument that nevertheless has much force works backwards. What would perfect prediction imply? For example, it would imply that we can predict students' performance **exactly** by just knowing their age, sex, race, class, etc. Yet we know that is absurd; it contradicts much else of what we know in social... | Abelson's point could be summarised: What is improbable becomes probable in case of sufficiently many repetitions.
Evolution is build on this principle: It is improbable that a mutation would be an advantage to the mutant. But, in case of sufficiently many mutations, it is likely that a few are advantageous. By means... |
645,194 | I find `array` environment pretty useful for aligning some blocks of equations, especially more flexible way of aligning each column as a whole, unlike `alugn`, however it has a couple of issues
1. You have to put `array` inside another math environment
2. All math like fractions, sum limits, integrals look small, bec... | 2022/05/22 | [
"https://tex.stackexchange.com/questions/645194",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/213149/"
] | This is the way `align` is meant to be used:
```
\documentclass{article}
\usepackage{amsmath}
\begin{document}
some text
\begin{align}
\frac{a+b}{c} &= d &\quad x+y &=z \\
\frac{k}{i-j} &= n &\quad m &=n
\end{align}
some more text
\end{document}
```
[](ht... | You could always define new column types to set all math in display style, and wrap an `array` into another environment where `\arraystretch` is larger.
[](https://i.stack.imgur.com/TJzSn.png)
```
\documentclass{article}
\usepackage{amsmath}
\usepackage{array}
\newcolumntype{C}... |
12,231,700 | The other night I had the iTunes Visualizer (new not classic) playing. I started to think and wonder if it is possible to create a similar style type effects for transitioning of `div` or other tags to create a flashy effect. Here is the catch, while I assume something of that sort can be done in Flash is it possible t... | 2012/09/01 | [
"https://Stackoverflow.com/questions/12231700",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/825757/"
] | With Google Cloud Messaging, your server doesn't talk directly to the client. It goes through the "Cloud" part first. Thus putting the client certificate in your server's trust manager doesn't work.
Instead, your server will have to validate the SSL certificate of Google's Cloud Messaging servers. Those are backed by ... | I created a standalone java program which acted as 'server' and could push the message to GCM server which in turn could deliver message to my handset app.
I don't had to install any certificate in my jre\lib\security\cacerts file as the shipped trusted entries are sufficient to connect to GCM server.
The only depend... |
49,090,476 | I'm working through a tutorial in Google Colaboratory, and the author has handily hidden some of the solutions cells. When you click the hidden cell, it expands and becomes visible. How can I hide the cells?
An example is in this tutorial: [Creating and Manipulating Tensors](https://colab.research.google.com/notebooks... | 2018/03/03 | [
"https://Stackoverflow.com/questions/49090476",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/326238/"
] | The black triangle, that makes it possible to fold and unfold sections, appears when you create a section (which is equivalent to creating a title).
You can create a section by creating a text cell that starts with `# <your section title>`.
This is how you create title in Markdown: `# This is a title` `## This is a s... | Here is the hot key for ya:
```
ctrl + "
```
After setting up the text part in Colab like what others have said, you can press **control and quote** key at the same time and collapse whichever cell/section you want. |
6,598 | Could anyone please inform me in which case(s) SharePoint groups will NOT be deleted when a site or subsite is deleted? | 2010/10/28 | [
"https://sharepoint.stackexchange.com/questions/6598",
"https://sharepoint.stackexchange.com",
"https://sharepoint.stackexchange.com/users/-1/"
] | You could somehow serialize or store the groups (Iterate through them somehow and build an XML file representing them to rebuild later on, for example) using a SPWebEventReceiver and extending WebDeleting.
Other than this, groups are deleted with SPWeb and SPSite objects. | In my experience the OOTB behavior is that once a site is deleted the groups go with it. That is default behavior. However, I have to imagine that there are some third party tools that might be able to preserve the groups. Perhaps this can be done with STSADM? |
42,133,628 | I am using Laravel queues for commenting on Facebook posts. Whenever I receive data from a Facebook webhook, based on the received details I comment on the post. To handle 100 responses at once from Facebook webhooks, I am using Laravel queues, so that it can execute one by one.
I used the step by step process as menti... | 2017/02/09 | [
"https://Stackoverflow.com/questions/42133628",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6770506/"
] | I am seeing that you already have Queue table.
Try running `php artisan queue:listen --tries=3` or `php artisan queue:work` etc.
Queue work is for executing only one Job per command. So if there are 20 jobs in the table you might have to run queue work 20 times. That's why you can run `queue:listen` command. But it e... | All thing are set-up and still not work then make sure added schedule on crontab -e
`* * * * * cd /var/www/html/<project_name> && php artisan schedule:run >> /dev/null 2>&1` |
15,482 | Nietzsche claims we must say "yes" to life, and be healthy and strong that way.
But he also makes scathing remarks both in Zarathustra and in his late notebooks, about the Biblical maxim "thou shalt not kill".
Is there anyway of reconciling the will to life with the first commandment? | 2014/08/26 | [
"https://philosophy.stackexchange.com/questions/15482",
"https://philosophy.stackexchange.com",
"https://philosophy.stackexchange.com/users/-1/"
] | You asked, "In Nietzsche is there any way of reconciling the 'will to life' with the first commandment?" Actually, the first four commandments (Exodus 20:1-11) refer to our duty toward God; the next six commandments (Exodus 20:12-17) outline our duty toward mankind. Your question regards the *sixth* commandment (Exodus... | So it is "will to power" and not "will to life". To me the best way to avoid putting these directly at odds is to look at what "power" actually means from a perspective like post-Marxist-Feminism of Starhawk or some other position that deeply undercuts the power of both kings and martyrs.
This is a vast oversimplifica... |
33,191,769 | I've created a service (angular.js) that represents a model in my application:
```
angular.module("MyApp").factory('ItemService', function() {
this.items = [1, 2, 3];
this.getItems = function() {
return items;
};
this.addItem = function(i) { ... };
this.deleteItem = function(i) { ... };
return this... | 2015/10/17 | [
"https://Stackoverflow.com/questions/33191769",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5458129/"
] | What worked for me
```
\
\
```
[](https://i.stack.imgur.com/RozIQ.png) | You can also wrap it in a fenced code block. The advantage of this approach is you need not go for additional stuff for every line.
However, the content shall be displayed as a highlighted block with a background, so it may not be apt for all use cases.
```
Lorem inmissa qui propinquas doleas
Accipe fuerat accipiam
`... |
32,815 | I am trying to clean up as much of the metadata as I can in my iTunes Library. One issue I came across is albums from a band, where the band releases multiple albums in a year. While this doesn't happen all that much, a good example is the Smashing Pumpkins, who released [Machina](http://en.wikipedia.org/wiki/Machina/T... | 2011/12/02 | [
"https://apple.stackexchange.com/questions/32815",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/181/"
] | Hey I have this exact same problem, and I think I figured it out.
1. Right click on the selected album as a whole.
2. Go to the Sorting tab.
3. Under *Sorting Album*, for the album you would like to be second, type a number or any letter that is alphabetically before (if you want the album to be in front of another) t... | If put a letter or number in front of the album title in the "sort album" field, when you sync to your ipod the album will show up alphabetically on the ipod under that letter or number when you search by Album on the ipod. Still need a fix for this. |
558,989 | Assuming a poisson distribution, is there a way to solve for lambda in R?
My inputs would be "x", and Pr(X<=x) ... and I would like R to tell me the lambda.
Thanks | 2022/01/02 | [
"https://stats.stackexchange.com/questions/558989",
"https://stats.stackexchange.com",
"https://stats.stackexchange.com/users/345698/"
] | Let's call your original CI a 'probability-symmetric' confidence interval. For a symmetrical distribution, such an interval may be the narrowest one.
However, the probability-symmetric 95% CI for normal $\sigma^2,$ based on pivoting $$\frac{(n-1)S^2}{\sigma^2}\sim\mathsf{Chisq}(\nu = n-1)$$
is not the shortest because... | ### The symmetric interval minimises interval length in this case
You can find a general exposition of optimal confidence intervals in this [related answer](https://stats.stackexchange.com/questions/477785/477861#477861). Here I will show you how to do the relevant optimisation for a confidence interval for the mean w... |
656,906 | I am trying to make a web app print receipts for my customer (he asked me for it) I've placed a table and everything however when I print it I just can't get it to print correctly into the fields of the receipts. Let me explain, the receipts are already made so I am merely making a place where the user inputs all the r... | 2009/03/18 | [
"https://Stackoverflow.com/questions/656906",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28586/"
] | Based on this link [here](http://forums.macrumors.com/archive/index.php/t-205556.html), it's possible that there's some optimization going on under the covers for common NSNumbers (which may not happen in all implementations hence a possible reason why @dizy's retainCount is 1).
Basically, because NSNumbers are non-mu... | You should **never** rely on the `retainCount` of an object. You should **only** use it as a debugging aid, never for normal control flow.
Why? Because it doesn't take into account `autorelease`s. If an object is `retain`ed and subequently `autorelease`d, its `retainCount` will increment, but as far as you're concerne... |
53,508,168 | I'm attempting to create a JPA entity for a view. From the database layer, a table and a view should be the same.
However, problems begin to arise and they are two fold:
1. When attempting to setup the correct annotations. A view does not have a primary key associated with it, yet without the proper `@javax.persisten... | 2018/11/27 | [
"https://Stackoverflow.com/questions/53508168",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1478636/"
] | **1. Create View with native SQL in the database,**
```
create or replace view hunters_summary as
select
em.id as emp_id, hh.id as hh_id
from employee em
inner join employee_type et on em.employee_type_id = et.id
inner join head_hunter hh on hh.id = em.head_hunter_id;
```
**2. Map that, View to an 'Immutable En... | I hope this helps you, the id you can assign it to a united value in your view.
We map the view to a JPA object as:
```
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
@Entity
@Table(name = "my_view")
public c... |
847,153 | I know that, for $|x|\leq 1$, $e^x$ can be bounded as follows:
\begin{equation\*}
1+x \leq e^x \leq 1+x+x^2
\end{equation\*}
Likewise, I want some *meaningful* lower-bound of $\sqrt{a^2+b}-a$ when $a \gg b > 0$.
The first thing that comes to my mind is $\sqrt{a^2}-\sqrt{b} < \sqrt{a^2+b}$, but plugging this in ends ... | 2014/06/25 | [
"https://math.stackexchange.com/questions/847153",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/18526/"
] | Factor out an $a^2$ from the radical to get $a\sqrt{1+\frac{b}{a^2}}-a=a\left(\sqrt{1+\frac{b}{a^2}}-1\right)$
Which can then be expanded for $\left|\frac{b}{a^2}\right|<1$, which is true for $a \gg b > 0$.
This expansion, to first order, is $a\left(1+\frac{b}{2a^2}-1\right)=\frac{b}{2a}$.
EDIT: Forgot that you were... | By the mean value theorem,
$$\sqrt{1 + x} - 1 = f(1 + x) - f(1) = x f'(c)$$
where $f$ is square root, $f'$ is its derivative,
and $c$ is some point in $[1, 1+x]$.
We need a lower bound and $f'$ is decreasing,
so $c$ is at worst $1 + x$ and we obtain
$$x f'(c) ≥ xf'(1 + x) = \frac{x}{2\sqrt{1 + x}}.$$
Backtrack: you w... |
23,512,304 | I've an array titled `$form_data` as follows:
```
Array
(
[op] => preview
[id] =>
[form_submitted] => yes
[company_id] => 46
[1] => Array
(
[pack] => 10
[quantity] => 20
[volume] => 30
[units] => 9
... | 2014/05/07 | [
"https://Stackoverflow.com/questions/23512304",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1897974/"
] | `$products` doesn't appear to be defined. Did you mean:
```
foreach( $value as $k => $v) {
``` | Looking again, it would rather be:
```
foreach($element as $key => $value) {
/*check for each key of inner array [1], [2], [3],.. whether it's an array or not*/
if(is_array($value)) {
foreach($value as $key1=>$value1){
if($key1 == 'products') {
foreach... |
1,725,856 | Given the following table structure:
```
CREATE TABLE user (
uid INT(11) auto_increment,
name VARCHAR(200),
PRIMARY KEY(uid)
);
CREATE TABLE user_profile(
uid INT(11),
address VARCHAR(200),
PRIMARY KEY(uid),
INDEX(address)
);
```
Which join query is more efficient: #1,
```
SELECT u.name FROM us... | 2009/11/12 | [
"https://Stackoverflow.com/questions/1725856",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/207834/"
] | The first syntax is generally more efficient.
`MySQL` buffers the derived queries so using the derived query robs the `user_profile` of possibility to be a driven table in the join.
Even if the `user_profile` is leading, the subquery results should be buffered first which implies a memory and performance impact.
A `... | The answer usually depends on the statistics gathered by database. The first form seems to be easier for optimizer.
As far as I remember, MySQL doesn't work well with IN... queries and subselects |
13,760,844 | I define below data type:
```
typedef int MyInt;
```
Then I hope to define a new data type based on size of MyInt, something like below code, but I can't find a solution for it.
```
#if sizeof(MyInt) == 2
typedef long MyLong;
#else
typedef short MyLong;
#endif
```
Could anybody help? | 2012/12/07 | [
"https://Stackoverflow.com/questions/13760844",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1877689/"
] | It's not the preprocessor's job to evaluate `sizeof`, that's done by the compiler which is a later stage in the process. Evaluating `sizeof` needs deep C knowledge that the preprocessor simply doesn't have.
You could (in theory) consider the preprocessor as a separate step, that does *text only* transforms, in effect ... | You can use `UINT_MAX` - it can give you a clue about the size of integer.
```
#if (UINT_MAX <= 65536)
typedef long MyLong;
#else
typedef short MyLong;
#endif
``` |
16,344,683 | I am creating a dictionary, that potentially has keys that are the same, but the values of each key are different. Here is the example dict:
```
y = {44:0, 55.4:1, 44:2, 5656:3}
del y[44]
print y
{5656: 3, 55.399999999999999: 1}
```
I would like to be able to do something like:
```
del y[44:0]
```
Or something o... | 2013/05/02 | [
"https://Stackoverflow.com/questions/16344683",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/557695/"
] | Just an idea- instead of having scalar values, why not a collection of some kind? Perhaps even a set if they are unique values:
```
myDict = {44:set([1, 2, 3])}
```
So to add or remove an object:
```
myDict[44].add(1)
myDict[44].remove(1)
```
For adding a new key:
```
if newKey not in myDict:
myDict[newKey] ... | Your question is moot. In your `y` declaration, the `44:2` wouldn't go alongside `44:0`, it would overwrite it. You'd need to use a different key if you want both values in the dictionary. |
3,544,221 | I built a small cms for personal websites using Rails. Each site has a simple blog.
I've been looking for a good third party comment system to add to the cms.
Have you used (or know of) any "comment service" that I can seamlessly integrate via their API, and if they have a ruby gem even better.
Thanks in advance
D... | 2010/08/23 | [
"https://Stackoverflow.com/questions/3544221",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/226619/"
] | In addition to the two above, I've found this service (formerly called jskit) interesting, and it seems to have some great Twitter-integration features: <http://aboutecho.com/> | I have used [Intensedebate](http://intensedebate.com/) and [disqus](http://disqus.com/)
I feel Intensedebate is better. |
879,408 | How can I write a wrapper that can wrap any function and can be called just like the function itself?
The reason I need this: I want a Timer object that can wrap a function and behave just like the function itself, plus it logs the accumulated time of all its calls.
The scenario would look like this:
```
// a funct... | 2009/05/18 | [
"https://Stackoverflow.com/questions/879408",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/60628/"
] | A solution using macros and templates: For example you want to wrap
```
double foo( double i ) { printf("foo %f\n",i); return i; }
double r = WRAP( foo( 10.1 ) );
```
Before and after calling foo() the wrapper functions beginWrap() and endWrap() should be called. (With endWrap() being a template function.)
```
void... | If your compiler supports variadic macros, I'd try this:
```
class Timer {
Timer();// when created notes start time
~ Timer();// when destroyed notes end time, computes elapsed time
}
#define TIME_MACRO(fn, ...) { Timer t; fn(_VA_ARGS_); }
```
So, to use it, you'd do this:
```
void test_me(int a, float b);
... |
18,863 | In John Michael McDonagh's wonderful philosophical black comedy [Calvary](http://www.imdb.com/title/tt2234003/?ref_=fn_al_tt_1), a good priest receives a death threat during a confessional giving him a week to sort out his affairs.
During the course of the week there are a lot of encounters between the priest and his... | 2014/04/21 | [
"https://movies.stackexchange.com/questions/18863",
"https://movies.stackexchange.com",
"https://movies.stackexchange.com/users/134/"
] | I think it is intentionally left unclear so that you analyze everyone in the movie in retrospect and study each and every criticism of the church as presented by each character.
It is a clever way to really force across the point. | Good Question! I agree with John Smith Optional that the film leaves this open-ended, but my sense after hearing the killer's denial was that killing the dog was a very personal attack in the sense that burning down the church and murdering Father James was not, and that as a result the suspicion falls on the one perso... |
15,320 | Qualifying offenses for the [sex offender registry](http://en.wikipedia.org/wiki/Sex_offender_registry#Application_to_offenses_other_than_felony_sexual_offenses)
can [include public urination](http://freestudents.blogspot.com/2009/12/pee-nal-code-and-sex-crimes.html). Though the chance may be small, the potential conse... | 2013/04/16 | [
"https://bicycles.stackexchange.com/questions/15320",
"https://bicycles.stackexchange.com",
"https://bicycles.stackexchange.com/users/3649/"
] | Plan your route accordingly. Make sure there's a couple gas stations or restaurants along the way that you could stop at if the need arises. It's probably a good idea to be somewhat close to civilization not only for urination purposes, but also in case you have some major mechanical problem with your bike, or you fall... | I use an external catheter for on-the-road urination while riding the recumbent. For upright and other bikes you might make some changes. Here is what, how and why I do it.
<http://psychling1.blogspot.com/2010/12/use-of-external-catheter-for-racing-or.html>
I also use this device in work meetings, on long car trips o... |
271,518 | Consider:
```
$ find . -name *.css
./style.css
./view/css/style.css
$ ls view/css/
consultation.css jquery.scombobox.min.css page-content.css style.css
```
**Why might `find` have missed the files in `view/css`?** This is on Ubuntu 15.10, an obscure Debian derivative. | 2016/03/22 | [
"https://unix.stackexchange.com/questions/271518",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/9760/"
] | So while the answer by Thomas got me thinking along the right path, it was actually the comment on Thomas's answer by cas that solved my issue completely:
Before cloning the partition, i edited `/etc/default/grub`, and uncommented the line that said `GRUB_DISABLE_LINUX_UUID=true` and ran `update-grub`.
After cloning ... | Yes, your root partition is mounted with the filesystem UUID and both, the original and the cloned one have the same UUID.
To work around this, you could comment the corresponding line and mount it with the `/dev/sda1` path.
```
#UUID=20d4493c-5934-4633-998e-0c6dd970d4ad / ext4 errors=remount-ro 0 ... |
54,160,655 | I am really trying very hard to figure out how to return string from a function to other. Please help me to solve this problem.
Returning Password as String from this function:
```
char* password(void) {
const maxPassword = 15;
char password[maxPassword + 1];
int charPos = 0;
char ch;
printf(
"\n\n\n... | 2019/01/12 | [
"https://Stackoverflow.com/questions/54160655",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10375821/"
] | Because the lifetime of `char password[maxPassword+1];` is in `password` function after function finished automatic delete from ram.
Variables defined inside a function, which are not declared static, are automatic. There is a keyword to explicitly declare such a variable – auto – but it is almost never used. Automati... | `char password[maxPassword+1]` is local to the function, you need to allocate memory for it like that `char *password = malloc(maxPassword+1)` or use global variable.
Also change `const maxPassword=15` to `int maxPassword=15`, and `ch=getch()` to `ch=getchar()`.
Generally I recommend reading a book about C, because i... |
57,412,942 | I have an array [a0,a1,...., an] I want to calculate the sum of the distance between every pair of the same element.
1)First element of array will always be zero.
2)Second element of array will be greater than zero.
3) No two consecutive elements can be same.
4) Size of array can be upto 10^5+1 and elements of ar... | 2019/08/08 | [
"https://Stackoverflow.com/questions/57412942",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8090037/"
] | There is a gem for this [RailsCallbackLog](https://github.com/jaredbeck/rails-callback_log)
Author already posted it here, in [this](https://stackoverflow.com/questions/13089936/tracking-logging-activerecord-callbacks) question (second answer) .
An example: for this code
`Mechanic.first.save` (`Mechanic` is just an... | This callback works when using the upgrade method:
", on: :update" |
2,184,763 | Got Link error (Fatal: Access violation. Link terminated) in Borland 6.0.
How do I know what is the cause of it ?
Is there any output file that I can open and get more informative message ? | 2010/02/02 | [
"https://Stackoverflow.com/questions/2184763",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/264416/"
] | You should be able to use the command line that gets passed to the linker to determine which .obj files are being passed to the linker. You can then include/exclude files to see when the error occurs.
A number of linker problems have been fixed since BCB6, you may want to try the linker from a demo of a newer version ... | Some files in the project had incorrect file path. |
2,990,547 | Consider a DB with a Client table and a Book table:
Client: person\_id
Book: book\_id
Client\_Books: person\_id,book\_id
How would you find all the Person ids which have no books?
(without doing an outer join and looking for nulls) | 2010/06/07 | [
"https://Stackoverflow.com/questions/2990547",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/249571/"
] | ```
select *
from Client
where person_id not in (select person_id from Client_Books)
``` | ```
SELECT * FROM Client WHERE person_id not in (SELECT person_id FROM Client_Books)
``` |
55,653,244 | Here is the data
```
DPS Comodity Std Issue
111 Hard drive No Post
111 MBD NoBoot
111 LCD Flicker
222 MBD No Post
222 LCD No Post
333 MBD No power
```
I have to get in the below format
```
DPS Comodity Std Issue
111 Hard drive,MBD,LCD Hard drive-No Post,MBD-N... | 2019/04/12 | [
"https://Stackoverflow.com/questions/55653244",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10009769/"
] | You can do this by using `data.table` package-
```
> library(data.table)
> setDT(dt)[,Std_Issue:=paste0(Comodity,"-",Std.Issue)]
> setDT(dt)[, list(Comodity = paste(Comodity, collapse=","),
`Std Issue` = paste(Std_Issue, collapse=",")), by = DPS]
```
**Output**-
```
DPS Comodity ... | Finally I found the solution which worked :
```
test_df <- data.frame(DPS=c(111,111,111,222,222,333),comodity =c("HDD","MBD","LCD","MBD","LCD","MBD"),stdIss=c("No Post","No Boot","Flicker","No Post","No Post","No Power"))
A <- data.frame(tapply(test_df$comodity,test_df$DPS,FUN = function(x){toString(x)}))
B <- data.fr... |
34,545,875 | I have created a bearer token using ASP.net Identity. In AngularJS I wrote this function to get authorized data.
```
$scope.GetAuthorizeData = function () {
$http({
method: 'GET',
url: "/api/Values",
headers: { 'authorization': 'bearer <myTokenId>' },
}).success(function (data) {
alert("Authorized ... | 2015/12/31 | [
"https://Stackoverflow.com/questions/34545875",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4586387/"
] | There is a `$cookies` service available in the AngularJS API using the
`ngCookies` module. It can be used like below:
```
function controller($cookies) {
//set cookie
$cookies.put('token', 'myBearerToken');
//get cookie
var token=$cookies.get('token');
//remove token
$cookies.remove('token')... | I would advise against keeping the data in a cookie, for security purposes you should set the cookies to secure and HttpOnly (not accessible from javascript). If you're not using SSL, I would suggest moving to `https`.
I would pass the token from the auth endpoint in a json response:
```
{
tokenData: 'token'
}
`... |
34,383,162 | My table has these columns
```
[ID] [bigint] IDENTITY(1,1) NOT NULL,
[PersonID] [bigint] NOT NULL,
[B] [bit] NULL
```
Given a list of `PersonID` values, I would like to update the table, setting the value of `B` for the most recent entry for each `PersonID` to 1.
The below script only updates a single record, but i... | 2015/12/20 | [
"https://Stackoverflow.com/questions/34383162",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/426493/"
] | If am not wrong this is what you are trying to achieve
```
;with cte as
(
select row_number()over(partition by PersonID order by ID desc) as rn,*
from yourtable
Where PersonID in (<idlist>)
)
update cte set B=1
where Rn=1
```
Or use correlated sub-query
```
UPDATE A
SET A.B = 1
from table A
WHERE PersonID in... | `IN (Select MAX(ID) FROM ...)` limits to a unique MAX(ID).
Group by PersonID in order to get the MAX(ID) for each Person.
```
UPDATE table
SET B = 1
WHERE
ID IN (SELECT MAX(ID)
FROM table
WHERE PersonID in (<idlist>)
GROUP BY PersonID)
``` |
3,723,044 | If I input `5 5` at the terminal, press enter, and press enter again, I want to exit out of the loop.
```
int readCoefficents(double complex *c){
int i = 0;
double real;
double img;
while(scanf("%f %f", &real, &img) == 2)
c[i++] = real + img * I;
c[i++] = 1 + 0*I; // most significant coeff... | 2010/09/16 | [
"https://Stackoverflow.com/questions/3723044",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/449021/"
] | The specific problem you're having is that a `scanf` format string of `%f` will skip white space (*including* newlines) until it finds an actual character to scan. From the c99 standard:
>
> A conversion specification is executed in the following steps:
>
> - Input white-space characters (as specified by the... | There's a way to do what you want using just scanf:
```
int readCoefficents(double complex *c) {
int i = 0;
double real;
double img;
char buf[2];
while (scanf("%1[\n]", buf) == 0) { // loop until a blank line or EOF
if (scanf("%lf %lf", &real, &img) == 2) // read two floats
... |
2,354 | So I was going to get a new acoustic. I really want to start getting into acoustics but I don't want to lose the ability to jam with friends who are on drums/bass, and have their own electrics plugged in. Does it make sense to get an acoustic/electric?
I've never played one before plugged in. I know they sound okay un... | 2011/02/07 | [
"https://music.stackexchange.com/questions/2354",
"https://music.stackexchange.com",
"https://music.stackexchange.com/users/-1/"
] | IMHO, it's generally not a good idea to buy an acoustic/electric that lists for anything less than $1000. Why? Because no matter how much the guitar costs, some of what you're paying for in an acoustic/electric are the pickups and electronics. In other words, a $500 acoustic guitar is a $500 acoustic guitar, but a $500... | Some of the low-end guitars can be surprising... Depends what you're looking for. I bought a decidedly-low-end Yamaha (APX500) for 300 bucks a couple of years ago.
An inexpensive guitar to be sure, I bought it mostly because that's what I could afford and it had a small body so it didn't hurt my aging shoulders.
So... |
1,250,892 | I'm reading an algorithms book and I came across a code example for a primality test. The problem is that I couldn't understand the condition for the [for-loop](http://www.tutorialspoint.com/cprogramming/c_for_loop.htm):
```
public static boolean isPrime( int N ) {
if (N < 2) return false;
for ( int i ... | 2015/04/25 | [
"https://math.stackexchange.com/questions/1250892",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/119055/"
] | If $n$ is not prime, then at least one of the factors of $n$ is at most as large as $\sqrt n$. To see why, let's suppose not. Since $n$ is not prime, $n = ab$ for some $a,b \neq 1$. If both $a$ and $b$ are larger than $\sqrt n$, then $a\cdot b > \sqrt n \cdot \sqrt n = n$. This clearly cannot be!
So you only need to c... | The trial division test, abstractly formulated, is this: for each number $i$ in some suitable set, check whether $i$ divides $n$. If one such number is found, output "$n$ is composite", else output "$n$ is prime". (Perhaps you need to special-case $n=1$; I'll leave that to the reader).
Clearly no suitable set can cont... |
220,520 | [Related](https://codegolf.stackexchange.com/questions/126172/create-a-binary-ruler), [related](https://codegolf.stackexchange.com/questions/71833/how-even-is-a-number)
Introduction
============
The [ruler sequence](https://oeis.org/A001511) is the sequence of the largest possible numbers \$a\_n\$ such that \$2^{a\_n... | 2021/03/11 | [
"https://codegolf.stackexchange.com/questions/220520",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/94066/"
] | [05AB1E](https://github.com/Adriandmen/05AB1E), ~~8~~ 6 bytes
=============================================================
```
ÝoʒÖ}θ
```
[Try it online!](https://tio.run/##yy9OTMpM/f//8Nz8U5MOT6s9t@P/fzMA "05AB1E – Try It Online")
Turns out I'm way too used to Vyxal. -2 thanks to Makonede
Explained
---------
``... | [APL (Dyalog Unicode)](https://www.dyalog.com/), 16 bytes
=========================================================
Nth Term
```apl
{2*(⊥⍨~)2⊥⍣¯1⊢⍵}
2* ⍝ exponentiation
⊥⍨~ ⍝ number of trailing zeros
2⊥⍣¯1⊢ ⍝ bit vector conversion
⍵ ⍝ argument
```
[Try it online!](https://tio.run/##SyzI0U2pTMz... |
21,780,252 | I am creating an app where i need to find current location of user .
So here I would like to do a task like when user returns from that System intent, my task should be done after that.(Displaying users current location)
So i am planning to use `OnActivityResult()`.
```
protected void onActivityResult(int requestCo... | 2014/02/14 | [
"https://Stackoverflow.com/questions/21780252",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3247551/"
] | You need an Activity on order to receive the result.
If its just for organisation of code then call other class from Activty class.
```
public class Result {
public static void activityResult(int requestCode, int resultCode, Intent data){
...
}
}
@Override
protected void onActivityResult(int reques... | **You can't call this method out of his scope.**
```
protected void onActivityResult (int requestCode, int resultCode, Intent data)
```
If the method is **protected** like this case, you can see the table of **Access Levels** to know how to proceed.
```
|-----------------------------------------------------------|... |
37,422,781 | I have been stuck with this exercise for way too long.
I've been given some part of the code and i had to write the rest of it.
First of all, i got a VolleyManager class that helps with some Volley tools (like adding to request queue). Then another Gson class that helps parsing the requested Json.
This is the code ... | 2016/05/24 | [
"https://Stackoverflow.com/questions/37422781",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4808318/"
] | You could use a normal for loop iterating over the array elements or follow a [functional](https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Array/map) [approach](https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach).
```js
var data = [
{item1: 12... | You can use a for loop to iterate over each item, in order, in the array.
```
for(var i = 0; i < data.length; i++) {
//check to see if item3 is NOT there
if(typeof data[i].item3 === 'undefined') {
data[i].item3 = 'default value';
}
}
``` |
42,304,745 | I have a JSONB column with JSON that looks like this:
>
> {"id" : "3", "username" : "abcdef"}
>
>
>
Is there way to update the JSON to :
>
> {"id" : 3, "username" : "abcdef"}
>
>
> | 2017/02/17 | [
"https://Stackoverflow.com/questions/42304745",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2069092/"
] | OK, that was my misunderstanding.
<https://github.com/streamproc/MediaStreamRecorder>
>
> MediaStreamRecorder can record audio as WAV and video as either WebM or animated gif on Chrome
>
>
>
no mp4 possible. | Checkout [ffmpeg.wasm](https://ffmpegwasm.netlify.app/)
You can install it via:
```sh
# Use npm
$ npm install @ffmpeg/ffmpeg @ffmpeg/core
# Use yarn
$ yarn add @ffmpeg/ffmpeg @ffmpeg/core
```
And then, you can convert your blobs into an mp4 file.
Checkout the example that they provided in the link I shared. |
39,093,941 | What I want to do :
```css
div#test { color: green;}
div { color: blue; background-color:white;}
```
```html
<div id="test">
<span>Text</span>
</div>
<div>
<span>Text2</span>
</div>
```
I want to apply only `color:green`(not `background-color`) to `div` tag having `id="test"`. But as you can see here... | 2016/08/23 | [
"https://Stackoverflow.com/questions/39093941",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3595632/"
] | You need to add background none property to id
```css
div#test { color: green; background-color:none;}
div { color: blue; background-color:white;}
```
```html
<div id="test">
<span>Text</span>
</div>
<div>
<span>Text2</span>
</div>
``` | You should separate the style you want to apply into a class.
Then add that class to an element you want apply the background style to, like so:
```css
div#test { color: green;}
div { color: blue;}
.bg-white { background-color: white;}
```
```html
<div id="test">
<span>Text</span>
</div>
<div class="bg-whit... |
1,311,713 | Basically, I do not totally understand how GNOME the whole stuff works.
As the title shows, I am currently working on using [TigerVNC](https://tigervnc.org/) to start a GNOME desktop, which is separate from the original GNOME when I use a physical screen to log in.
[Here is my physical desktop appearance.](https://i.... | 2021/01/28 | [
"https://askubuntu.com/questions/1311713",
"https://askubuntu.com",
"https://askubuntu.com/users/1167241/"
] | AppImages have limited integration with your desktop environment. You can manually add a launcher to your menu, but there is also a tool in development that can integrate appimages
**Manual approach**
You can [manually add a launcher](https://askubuntu.com/a/95278/558158) for your AppImage in the dash. Once it is the... | Use AppImageLauncher
* <https://github.com/TheAssassin/AppImageLauncher>
* <https://github.com/TheAssassin/AppImageLauncher/wiki/Install-on-Ubuntu-or-Debian>
```
sudo apt install software-properties-common
sudo add-apt-repository ppa:appimagelauncher-team/stable
sudo apt update
sudo apt install appimagelauncher
... |
44,007,693 | this is what I need: from the saledate column I need to extract just the month and date and combine with the 2017 year in NewDate column, but I couldn't update. Any suggestions?
[](https://i.stack.imgur.com/eLRQh.png)
This is the Select statment, I'm ... | 2017/05/16 | [
"https://Stackoverflow.com/questions/44007693",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8021081/"
] | You could use `dateadd()` with the `day()` and `month()` functions like so:
```
select dateadd(day,day(saledate)-1,dateadd(month,month(saledate)-1,'20180101')) as NewDate
```
---
For example:
```
select dateadd(day,day(getdate())-1,dateadd(month,month(getdate())-1,'20180101'))
```
returns: `2018-05-16` | You say you need it with the 2017 year, but you're using a 2018 value. Here's something to get started.
```
SELECT CONVERT(DATE,'2017-'+CONVERT(VARCHAR(2),MONTH(SaleDate))+'-'+CONVERT(VARCHAR(2),DAY(SaleDate))) AS NewDate
``` |
39,695,542 | I have three tables, `tbl_doctors_details`, `tbl_time` and `tbl_token`.
I have to select the details from `tbl_time` or `tbl_token`. That is if for particular doctor in hospital have `t_type` is `time` then select from `tbl_time` else select from `tbl_token`.
For example, for `doctor_id` is 100 and `hospital_id` 1, t... | 2016/09/26 | [
"https://Stackoverflow.com/questions/39695542",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3115085/"
] | Second function will be called in both the cases, as the your redefining the function definition.
Also there is no function overloading in javascript, in the second case change function signature( i.e arguments it takes) will redefine the same A function (defined 1st). | In both cases the second function will be called because it overwrites the global variable `A` when declared.
It's similar to writing:
```
var a = 1;
var a = 2;
a === 2; // true
``` |
16,703,886 | Where are static local variables stored in memory? Local variables can be accessed only inside the function in which they are declared.
Global static variables go into the .data segment.
If both the name of the static global and static local variable are same, how does the compiler distinguish them? | 2013/05/23 | [
"https://Stackoverflow.com/questions/16703886",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/713179/"
] | Static variables go into the same segment as global variables. The only thing that's different between the two is that the compiler "hides" all static variables from the linker: only the names of extern (global) variables get exposed. That is how compilers allow static variables with the same name to exist in different... | As mentioned by dasblinken, GCC 4.8 puts local statics on the same place as globals.
More precisely:
* `static int i = 0` goes on `.bss`
* `static int i = 1` goes on `.data`
Let's analyze one Linux x86-64 ELF example to see it ourselves:
```
#include <stdio.h>
int f() {
static int i = 1;
i++;
return i;... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.