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,109,852 | I recently got a reply from a server company asking if we are using an ORM in our application which does all the work of sifting application side (like Rails) or if we write reams of SQL, embedded functions etc which would make the database server do the processing for you.
Can anyone explain what is meant by this. Ou... | 2010/01/21 | [
"https://Stackoverflow.com/questions/2109852",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/77174/"
] | It basically makes your database tables appear like objects on the PHP side of your site so you can easily manipulate data.
For example if you have a User table, getting this user's name is as easy as doing: `$myUser->getName();`
adding a new user in your database would be:
```
$myUser = new User();
$myUser->setName... | Object Relational Mapping is an easy way of mapping Database objects ( tables, views ... ) to classes/objects in OOPL.
Hibernate and NHibernate are a few examples of ORM. it does all the tedious task of handling and mapping result sets.. |
63,527,962 | I'm trying to pass object props to Payments component using render method in route.
I have tried pass props to the functional components, but still no luck.
**App.js**
```
class App extends Component {
state = {
user: {},
};
componentDidMount() {
const url = "/api/current-user";
fetch(url, {
... | 2020/08/21 | [
"https://Stackoverflow.com/questions/63527962",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13143463/"
] | Can't you use a std::function, and use lambdas to capture everything you need? It doesn't appear that your functions take parameters, so this would work.
ie
```
std::function<void()> callIt;
if(/*case 1*/)
{
callIt = [](){ myTemplatedFunction<int, int>(); }
}
else
{
callIt = []() {myTemplatedFunction<floa... | Your choice of manual memory management and over-use of the keyword `struct` suggests you come from a C background and have not yet really converted to C++ programming. As a result, there are many areas for improvement, and you might find that your current approach should be tossed. However, that is a future step. Ther... |
61,820,673 | I have an extension in my personal account, and I already created a Group Publisher account, and now I want to move the extension from my personal account to the Group publisher account I've created.
I already read this document: <https://developer.chrome.com/webstore/publish#move-existing-items-to-a-group-publisher-a... | 2020/05/15 | [
"https://Stackoverflow.com/questions/61820673",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9434604/"
] | It is my first answer here, and I am glad to be helpful to you.
«Transfer existing item(s)» option is not available in new version of Developer Dashboard, which you are using.
In lower left-corner find Feedback window, press «Show more» and click «Opt out».
You will be redirected to older version of Dashboard, when... | You can find the option "transfer to group publisher" in the kebab menu on the right of the "Submit for review" button now.
[ sutta Buddha says the following:
>
> When this was said, the Buddha said to those mendicants: “The
> mendicants who develop mindfulness of death by wishing to live for a
> day and night … or to live for a day … or to live for ha... | 2018/05/12 | [
"https://buddhism.stackexchange.com/questions/26398",
"https://buddhism.stackexchange.com",
"https://buddhism.stackexchange.com/users/11541/"
] | Oh, this is easy. This one I was taught many *many* times. Here is how it goes:
Regular untrained people live their life as if they will live forever. They 1) worry about small unimportant stuff, get offended, or scared, or enraged at things that are not really important. And 2) they waste days, months and years of li... | In the Lamrim, there is what is known as the nine fold contemplation on death. This has three main points and each of the three has three sub points. I will list and try to explain them:
The main points are:
1. Contemplating death’s certainty.
2. Contemplating the uncertainty of the time of death.
3. Contempl... |
43,742,772 | I am getting a class "fluid-width-video-wrapper" with padding"59%".
can anybody let me know, how can i get rid of this class.
I don't found this class in files also.
Thanks | 2017/05/02 | [
"https://Stackoverflow.com/questions/43742772",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7903273/"
] | I want just to extend a bit @FEMP's answer.
Indeed, the wrapper added by the FitVids.js plugin.
You can simply add the `fitvidsignore` class to your `<iframe>` to ignore all effects of the plugin. It will be useful if you still need this script on some other page... | Check your code for FitVids.js it's a plugin for fitting video on the page, check it here:
<https://github.com/davatron5000/FitVids.js> |
44,193,045 | I know `RecyclerView` animates item additions/deletions for us for free. Is it supposed to support animating item height changes as well?
**For example** : Consider a row item with the following xml :-
```
<LineaLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation=... | 2017/05/26 | [
"https://Stackoverflow.com/questions/44193045",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1219278/"
] | Add a `visibility` component to your object that you're using in your adapter. In the item view's `onClickListener`, change the state of that object's visibility component depending on the current state. In the `onBindViewHolder`, set the visibility of `tv2` depending on the state of your object and notify the adapter ... | Try setting `android:animateLayoutChanges="true"` in the `LinearLayout` in XML |
72,893,643 | I have a pandas data frame like so.
| fruit | year | price |
| --- | --- | --- |
| apple | 2018 | 4 |
| apple | 2019 | 3 |
| apple | 2020 | 5 |
| plum | 2019 | 3 |
| plum | 2020 | 2 |
and I want to add column [last\_year\_price]
please help...... | 2022/07/07 | [
"https://Stackoverflow.com/questions/72893643",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19500501/"
] | You can use the shift function:
```
df['last_year_price'] = df.sort_values(by=['year'], ascending=True).groupby(['fruit'])['price'].shift(1)
``` | Use [`DataFrameGroupBy.idxmax`](http://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.core.groupby.DataFrameGroupBy.idxmax.html) for rows with maximal years and join to oriinal DataFrame:
```
df = df.merge(df.loc[df.groupby('fruit')['year'].idxmax(), ['fruit','price']].rename(columns={'price':'last_year_pri... |
327,929 | >
> This coffee is also available in packs **with** smaller amounts?
>
>
>
>
> This coffee is also available in packs **of** smaller amounts?
>
>
>
Which preposition should I use in the sentence above “of” or “with”? I thought a pack has an amount of something but I couldn’t decide whether I should use “with”... | 2022/11/23 | [
"https://ell.stackexchange.com/questions/327929",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/145531/"
] | "Packs **of** smaller amounts" means the packs themselves are smaller, so they hold a smaller amount of the substance. They will likely be marked with a smaller number on the outside, like packs of 1 kg, 500 g, etc.
"Packs **with** smaller amounts" could mean the same as above, OR it could mean the *same sized packs, ... | >
> This coffee is also available in packs with/of smaller amounts
>
>
>
Both versions are so awkward that as a native I honestly don't know which might be technically right or wrong. You can count packs using 'of', but there would usually be a quantifier.
"You can buy these in packs of ten." etc.
No-one would... |
18,946,863 | So I have to get words from a text file, change them, and put them into a new text file.
The problem I'm having is, lets say the first line of the file is
hello my name is bob
the modified result should be:
ellohay myay amenay isay bobay
but instead, the result ends up being
ellomynameisbobhay
so scanner has .ne... | 2013/09/22 | [
"https://Stackoverflow.com/questions/18946863",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2780384/"
] | I realized I was making this too complicated. If I'm going to implement a factory method for each `enum` instance, I may as well just have separate factory methods for each interface.
```
public interface Factory {
IFooBar createFooBar();
IFooBaz createFooBaz();
}
class CodeFactory implements Factory {
pu... | A possible solution would be defining a wrapper that implements `IFoo` and the `getCode()` method, and your method would return the intended class in one of such wrappers.
If the wrapped instance has a `getCode` implemented, the wrapper would return its value, return it, otherwise return `null`. |
18,669,966 | Blender noob trying to render an object but certain parts of it keep coming out black. I'm not sure why. My image is here which might help:

A few extra details:
* The shelves I've been trying to render are just a collection of planes which I've aligne... | 2013/09/07 | [
"https://Stackoverflow.com/questions/18669966",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1979071/"
] | ```
android:listSelector="@drawable/list_selectorcolor"
```
In drawable create like this
```
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<gradient
android:angle="90"
android:endColor="#000000"
android:startColor="#000000"
andr... | Try this according to your code
```
viewHolder.imageview.setText(entry.getString("calculator"));
if(position % 2 == 0){
viewHolder.linearLayout.setBackgroundResource(R.color.grey);
}
else{
//viewHolder.linearLayout.setBackgroundResource(R.color.white);
}
```
I... |
18,720,714 | I have a session object in my c# class, that contains an [ArrayList](http://msdn.microsoft.com/en-us/library/system.collections.arraylist%28v=vs.90%29.aspx) type of data. How can I access the array within the session object?
Given the image below, how would I access \_confNum value?
HttpContext.Current.Session["DriverTripLog"];
TripAssignment log = logs[0];
```
By the way, you shouldnt use ArrayList, if possible.
```
ArrayList logs = (ArrayList)... | ```
var list = Session["DriverTripLog"]!=null? (ArrayList)Session["DriverTripLog"]:null;
``` |
3,394,194 | I refer to this page: [Post array of multiple checkbox values](https://stackoverflow.com/questions/1557273/jquery-post-array-of-multiple-checkbox-values-to-php)
```
<input type="checkbox" class="box" value="blue" title="A" />
<input type="checkbox" class="box" value="red" title="B" />
<input type="checkbox" class="b... | 2010/08/03 | [
"https://Stackoverflow.com/questions/3394194",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/409329/"
] | <http://jsfiddle.net/PgKEt/2/>
This is the best that I can do.
If you try to use setInterval and such to animate it, it will keep redrawing even when it does not need to. So by doing this, you essentially only redraw when the mouse moves, and only draw 2 lines, instead of whatever content you want it on top.
In additi... | This approach works fast enough for me in Firefox 3.6.8 to do in a mousemove event. Save the image before you draw the crosshair and then restore it to erase:
To save:
```
savedImage = new Image()
savedImage.src = canvas.toDataURL("image/png")
```
The to restore:
```
ctx = canvas.getContext('2d')
ctx.drawImage(sav... |
19,451,150 | I am making a basic calculator for Android by eclipse and Java. The task is there are two values, like input and result. So when the first number is pressed, it saves it, then a plus or minus sign is pressed ad then the second value which is result.
My idea was to create a method for every button something like this:
... | 2013/10/18 | [
"https://Stackoverflow.com/questions/19451150",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2888552/"
] | First, no space between `<` and `div` (saw here: `< DIV id="phone_valid" class="popup-value"></DIV>'` )
Second:
```
function checkSubmit(){
var country=$("#phone_valid").text(); // it is a div not input to get val().
if(country=="No")
{
alert("Not a valid number");
return false;
}
``` | If you need to include HTML comments then consider using [contents() method](http://api.jquery.com/contents/)
`$('#mydiv').contents()`
Other wise `html()` method or even `text()` will be what you are looking for because `val()` purpose is for form elements ;) |
30,712,474 | Is it possible to completely disable sanitizingof HTML?
What I want to achieve is to have in my controller:
```
$scope.greeting = '<h2>Hello World</h2>'
```
And in my view
```
{{greeting}}
```
I cannot (and dont want to) use ng-bind-html and such, I want to disable sanitizing all together.
Just to give some ... | 2015/06/08 | [
"https://Stackoverflow.com/questions/30712474",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/820942/"
] | Try enhance or change standard behavior of $sce using decorators:
```
angular
.module( appName, [ ] )
.config([ "$provide", function( $provide )
{
// Use the `decorator` to enhance or change behaviors of original service instance;
$provide.decorator( '$sce', [ "$delegate", function( $delegate ... | I managed to find another way of solving the problem without using any directives.
Basically I use an injector to use the $compile service.
JS:
```
angular.injector(['ng']).invoke(function($compile, $rootScope) {
$('.html-content').append($compile('<h2>Hello World</h2>')($rootScope));
});
```
Here's a demo: <h... |
6,913,532 | How can I display `Decimal('40800000000.00000000000000')` as `'4.08E+10'`?
I've tried this:
```
>>> '%E' % Decimal('40800000000.00000000000000')
'4.080000E+10'
```
But it has those extra 0's. | 2011/08/02 | [
"https://Stackoverflow.com/questions/6913532",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13009/"
] | Given your number
```
x = Decimal('40800000000.00000000000000')
```
Starting from Python 3,
```
'{:.2e}'.format(x)
```
is the recommended way to do it.
`e` means you want scientific notation, and `.2` means you want 2 digits after the dot. So you will get `x.xxE±n` | I prefer Python 3.x way.
```
cal = 123.4567
print(f"result {cal:.4E}")
```
`4` indicates how many digits are shown shown in the floating part.
```
cal = 123.4567
totalDigitInFloatingPArt = 4
print(f"result {cal:.{totalDigitInFloatingPArt}E} ")
``` |
8,806,659 | I'm learning `backbone.js` for a `Rails 3` application I'm working on. Backbone uses `underscore` which, I believe, has its own template engine built in.
I've read good things about mustache but was wondering if I should consider using it instead of the built in template engine of underscore?
What are your thoughts?
... | 2012/01/10 | [
"https://Stackoverflow.com/questions/8806659",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/59202/"
] | I am about halfway through my first enterprise level backbone app. I am currently using underscores built in templates because when I started the way I had learned was with underscore.. I don't necessarily have any problem with them. All of the templating solutions are pretty straight forward.
I have since looked at ... | The question asks Rails, but isn't tagged so; so a con is conflicts with languages using mustache-like syntax such as django's templates.
If a django template parses a block first, it will attempt to fill in the `{{ }}` blocks before ever writing the JS.
I am using a `verbatim` django template tag that ignores `{{}}... |
3,092,686 | >
> It is given that
> $$f(x)= \sin(x+30^\circ) + \cos(x+60^\circ)$$
>
>
> A) Show that $$f(x)= \cos(x)$$
>
>
> B) Hence, show that
> $$f(4x) + 4f(2x) =8\cos^4(x)-3$$
>
>
>
I managed to prove $f(x)$ equals $\cos(x)$, but after that I'm stumped. | 2019/01/29 | [
"https://math.stackexchange.com/questions/3092686",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/639594/"
] | You can use the property:
$$cos(2x) = cos^2(x)-sin^2(x)$$
Since this will allow you to express $cos(4x)$ =
$$cos^2(2x)-(1-cos^2(2x)) = 2cos^2(2x)-1$$
By substituting again $cos(2x)$ by the aforementioned expression you will be able to express $4cos(2x)+cos(4x)$ in terms of $sin(x)$ and $cos(x)$ raised to some powers... | $$f(x)=\sin(30^{\circ}+x)+\sin(30^{\circ}-x)=2\sin30^{\circ}\cos{x}=\cos{x}.$$
Thus, $$f(4x)+4f(2x)=\cos4x+4\cos2x=8\cos^4x-8\cos^2x+1+8\cos^2x-4=8\cos^4x-3.$$ |
1,940,175 | I am appending some text containing '\r\n' into a word document at run-time.
But when I see the word document, they are replaced with small square boxes :-(
I tried replacing them with `System.Environment.NewLine` but still I see these small boxes.
Any idea? | 2009/12/21 | [
"https://Stackoverflow.com/questions/1940175",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/186280/"
] | Have you not tried one or the other in isolation i.e.`\r` or `\n` as Word will interpret a carriage return and line feed respectively. The only time you would use the Environment.Newline is in a pure ASCII text file. Word would handle those characters differently! Or even a Ctrl+M sequence. Try that and if it does not ... | Word uses the `<w:br/>` XML element for line breaks. |
97 | Как правильно писать: «при**йт**и» или «при**дт**и»? | 2011/12/19 | [
"https://rus.stackexchange.com/questions/97",
"https://rus.stackexchange.com",
"https://rus.stackexchange.com/users/17/"
] | Глагол «идти» (или устаревший «итти») — одно из самых древних слов русского языка. Раньше действительно употреблялась форма «при**дт**и» (с корнем *ид*, как в слове «пр**ид**ешь»), однако сейчас она исчезла из русского языка, заменившись формой «пр**ий**ти».
Таким образом, правильно — «пр**ий**ти». | **Кодифицированным** написанием (по Розенталю) является «пр**ий**ти».
До некоторого времени несколько десятилетий обе формы употреблялись одновременно, в 19 веке и начале 20-го литературной формой была только «при**дт**и» («пр**ий**ти» относилась к просторечиям). |
28,757,056 | I came across this code in Googles Web login example ([Here](https://github.com/googleplus/gplus-quickstart-csharp.git)) and I dont know why this is purple.
I believe that it is some kind of global value, kinda like the Author item in Office. but if thats so, how do you set them? what is it even called?
![Purple Text... | 2015/02/27 | [
"https://Stackoverflow.com/questions/28757056",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2921949/"
] | The html file that you see there is read in by the application and the values that you see between the curly braces are replaced with values from the application. Look at the c# code to see where this is happening.
<https://github.com/googleplus/gplus-quickstart-csharp/blob/master/gplus-quickstart-csharp/signin.ashx.c... | the purple text is a placeholder to be replaced by the actual value. look at signin.ashx.cs for the following code:
```
static public string APP_NAME = "Google+ C# Quickstart";
//...
templatedHTML = Regex.Replace(templatedHTML, "[{]{2}\\s*APPLICATION_NAME\\s*[}]{2}", APP_NAME);
``` |
6,127,729 | I have a Postgres DB running 7.4 (Yeah we're in the midst of upgrading)
I have four separate queries to get the Daily, Monthly, Yearly and Lifetime record counts
```
SELECT COUNT(field)
FROM database
WHERE date_field
BETWEEN DATE_TRUNC('DAY' LOCALTIMESTAMP)
AND DATE_TRUNC('DAY' LOCALTIMESTAMP) + INTERVAL '1 ... | 2011/05/25 | [
"https://Stackoverflow.com/questions/6127729",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/93966/"
] | I have some idea of using prepared statements and simple statistics (record\_count\_t) table for that:
```
-- DROP TABLE IF EXISTS record_count_t;
-- DEALLOCATE record_count;
-- DROP FUNCTION updateRecordCounts();
CREATE TABLE record_count_t (type char, count bigint);
INSERT INTO record_count_t (type) VALUES ('d'), (... | Yikes! Don't do this!!! Not because you can't do what you're asking, but because you probably shouldn't be doing what you're asking in this manner. I'm guessing the reason you've got `date_field` in your example is because you've got a `date_field` attached to a user or some other meta-data.
Think about it: you are as... |
43,758,971 | I'm trying to do a button like the number pad key but with a number in the left corner. It supose to have a glyphicon in the center, a text bellow that and a small number on the left top corner.
I can't put the number in the top left corner he always stand on the left of the glyphicon.
```css
.btn-default{
height... | 2017/05/03 | [
"https://Stackoverflow.com/questions/43758971",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7798293/"
] | Simply, use float left to left item and float right to right item and use padding on button to apply alignment on elements of button. | You need to give the **button** `position:relative` and the **span** `position:absolute` |
7,937,369 | I am having trouble animating scale of a view to zero. Here's my code:
```
[UIView animateWithDuration:0.3 animations:^{
myView.transform = CGAffineTransformMakeScale(0.0, 0.0);
} completion:^(BOOL finished){
}];
```
For some reason, the view stretches and squeezes horizontally like old TV tube switching off. I... | 2011/10/29 | [
"https://Stackoverflow.com/questions/7937369",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/58505/"
] | If someone is still interested, here's what I did (in Swift) to make it work (almost):
```
UIView.animate(withDuration: 1) {
myView.transform = CGAffineTransform(scaleX: 0.01, y: 0.01)
}
```
If the duration is short, you don't get to see that is doesn't scale exactly to 0 and it effectively fades. | In case anyone is still having this issue, the problem lies with the affine transform matrix not being unique for a scale factor of zero – there is no way of knowing how to interpolate "properly" between the initial matrix and the zero matrix, so you get weird effects like you described.
The solution is simply to use ... |
40,875,794 | I am making an ajax to call data from database with php and i want to load the result in two inputs(label and listbox) in html page,the problem is that it show the value in the label`#FrmCount` but it is not showing anything in the listbox `#FarmersID`..
Here is the ajax
```
$.ajax({
type:"POST",
url:"AddDat... | 2016/11/29 | [
"https://Stackoverflow.com/questions/40875794",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7171921/"
] | To weed out default cameras, you could query for `startupCamera` using the `cmds.camera`. Here is some code (with comments) to explain.
Pymel Version
-------------
```
# Let's use Pymel for fun
import pymel.core as pm
# Get all cameras first
cameras = pm.ls(type=('camera'), l=True)
# Let's filter all startup / defa... | You probably need to depend on [listCamera](http://help.autodesk.com/cloudhelp/2015/ENU/Maya-Tech-Docs/CommandsPython/listCameras.html) command which you can list only persp camera or other. eg :
perspCameras = cmds.listCameras( p=True ) |
35,823,599 | I have a textfile that has
>
> 1
>
>
> 2
>
>
> 3
>
>
> 4
>
>
>
I am trying to tokenize the data per line into an array. However,tokens[0] is reading 1 2 3 4. How do I make it in such a way where
>
>
> ```
> tokens[0] = 1
>
> tokens[1] = 2;
>
> tokens[2] = 3;
>
> ```
>
>
What is wrong with my code ... | 2016/03/06 | [
"https://Stackoverflow.com/questions/35823599",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5327929/"
] | I think your problem is the way you are using the tokens array.
Using an ArrayList as NullOverFlow suggested will give the behaviour you want.
Here's a quick solution using an ArrayList, and Raghu K Nair's suggestion to take the whole line instead of splitting. It is complete - you can run it yourself to verify:
`... | I think this might solve your problem
```
public static void readFile() {
try {
List<String> tokens = new ArrayList<>();
Scanner scanner;
scanner = new Scanner(new File("test.txt"));
scanner.useDelimiter(",|\r\n");
while (scanner.hasNext()) {
tokens.add(scanner.... |
35,940,057 | I'm pretty sure this is a dumb issue, but I searched and could not find a similar/equal scenario.
So, I have a main PHP page in which I include several Javascript files in the `head` section of the HTML. Then at some point I grab content (HTML + Javascript) from an outside source via `file_get_contents` and output it ... | 2016/03/11 | [
"https://Stackoverflow.com/questions/35940057",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2440505/"
] | Strictly speaking all SQL statements should be terminated with a semicolon. i.e.
```
SELECT
Example
FROM
Test1
;
SELECT
Example
FROM
Test2
;
```
In practice SQL Server only enforces this for certain query types, for now. Statements that precede CTEs and MERGEs are an example of this.
From [MSDN](h... | When you are executing your script under the visual studio editor in script file, at end of the script you need to add `;` after adding the semicolon VS will build the script successfully |
45,499,152 | This is my `advertisements` table:
[](https://i.stack.imgur.com/YVK2b.png)
And this is my `works` table:
[](https://i.stack.imgur.com/rU2ML.png)
I want to find data from the `advertisements` table which ha... | 2017/08/04 | [
"https://Stackoverflow.com/questions/45499152",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6898181/"
] | First, you don't use the correct terminology.
You didn't declare a inner class but a static nested class.
>
> Terminology: **Nested classes are divided into two categories**: static
> and non-static. Nested classes that are declared static are called
> **static nested classes**. Non-static nested classes are cal... | No. You don't need outer class reference to access static inner class.
Static nested class is just like any another top level class and just grouped to maintain the relation. It is not at all a member of outer class. You can access it directly.
>
> Note: A [static nested class](https://docs.oracle.com/javase/tutori... |
4,083,848 | What is the equivalent of Linux's /proc/cpuinfo on FreeBSD v8.1? My application reads /proc/cpuinfo and saves the information in the log file, what could I do to get similar information logged on FreeBSD?
A sample /proc/cpuinfo looks like this:
```
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model ... | 2010/11/03 | [
"https://Stackoverflow.com/questions/4083848",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/115751/"
] | I don’t believe there is anything as detailed as Linux’s `/proc/cpuinfo`. Look into `sysctl hw` and `/var/run/dmesg.boot`. Most of the information like CPU speed and instruction sets should be in there somewhere.
This is what I see (with a few uninteresting `hw.*` fields removed):
```
$ uname -sr
FreeBSD 4.10-RELEASE... | FreeBSD 11.2
`sysctl hw.model`
Result:
`hw.model: Intel(R) Xeon(R) CPU E5620 @ 2.40GHz` |
48,046,814 | Imagine you want to align a series of x86 assembly instructions to certain boundaries. For example, you may want to align loops to a 16 or 32-byte boundary, or pack instructions so they are efficiently placed in the uop cache or whatever.
The simplest way to achieve this is single-byte NOP instructions, followed close... | 2018/01/01 | [
"https://Stackoverflow.com/questions/48046814",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/149138/"
] | Let's look at a specific piece of code:
```
cmp ebx,123456
mov al,0xFF
je .foo
```
For this code, none of the instructions can be replaced with anything else, so the only options are redundant prefixes and NOPs.
**However, what if you change the instruction ordering?**
You could convert the code into t... | Depends on the nature of the code.
Floatingpoint heavy code
========================
**AVX prefix**
One can resort to the longer AVX prefix for most SSE instructions.
Note that there is a fixed penalty when switching between SSE and AVX on intel CPUs [[1]](https://software.intel.com/en-us/articles/avoiding-avx-sse-... |
10,422,989 | I am eager to know what happens to a object in .NET when it falls out of scope. Something like this:
```
class A
{
ClassB myObjectB = new ClassB();
}
//what happens to object at this point here?
```
What happens in the memory? Does GC get called when it falls out of scope and loose it reference in the heap? | 2012/05/02 | [
"https://Stackoverflow.com/questions/10422989",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/529995/"
] | I find "falling out of scope" to be a much more C++-specific way of thinking of things, where at the end of a given scope an object with automatic storage is freed and has its destructor called.
In the C# world, there's no "falling out of scope". Variables (read: names) exist in a certain scope, and that's it. The GC ... | If there's nothing referencing the object, it gets eventually collected by GC. The thing is, you can't predict WHEN exactly it will happen. You just know, it will happen. |
21,726,396 | I have the following string which is from an ajax response.
```
"<option value="1000133925">Abhishek</option>
<option value="1000182033">FRESH</option>
<option value="1000390154">Testing</option>"
```
I have another string of the same above format, i need to compare both the strings and remove duplicate values in th... | 2014/02/12 | [
"https://Stackoverflow.com/questions/21726396",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1696497/"
] | I don't see why you insist on using regex, when you can do it using `jQuery` like:
```
var options = '<option value="1000133925">Abhishek</option><option value="1000182033">FRESH</option><option value="1000390154">Testing</option>';
$(options).filter(function(index, el){
//put here your condition for instance I ha... | A regex solution :
```
var obj = {}, m, r = /<option value="([^"]*)">([^<]*)<\/option>/g;
while (m = r.exec(s)) obj[m[1]] = m[2];
```
It builds
```
{1000133925: "Abhishek", 1000182033: "FRESH", 1000390154: "Testing"}
``` |
4,421 | I have to drill a perfectly centred hole in the flat part of a cylinder.I don't know how to do but I thought something like this:
I want to take a piece of wood and fix it at the base of the drill press and then drill a hole of the same diameter as the cylinder. Then put the cylinder in the hole and drill it. In this... | 2016/07/22 | [
"https://woodworking.stackexchange.com/questions/4421",
"https://woodworking.stackexchange.com",
"https://woodworking.stackexchange.com/users/2494/"
] | I've done it as you suggest, and it works. Obviously, the dowel you're drilling has to be fairly short. You also have to make sure it's held securely so it doesn't spin in the wood that's holding it. | For small cylinders as described (4mm dia, 15mm long) the premise in your OP will work, but the drill press used needs to be accurate.
My recommended execution of your idea:
Assumes negligible play in drill press and use of good brad-point drill bits. Drill press table should be as close to chuck as will still allow ... |
47,229,802 | Given a matrix, for example:
```
[[2 5 3 8 3]
[1 4 6 8 4]
[3 6 7 9 5]
[1 3 6 4 2]
[2 6 4 3 1]]
```
...how to find the greatest sub-matrix (i.e. with most values) in which all rows are sorted and all columns are sorted?
In the above example the solution would be the sub-matrix at (1,0)-(2,3):
```
1 4 6 8 ... | 2017/11/10 | [
"https://Stackoverflow.com/questions/47229802",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8915716/"
] | You could use recursion to get a maximised area that could fit below a given row segment, that itself has already been verified to be a non-decreasing value sequence. The found area will be guaranteed to stay within the column range of the given row segment, but could be more narrow and span several rows below the give... | One approach, which it sounds like you have tried, would be using brute force recursion to check first the entire matrix, then smaller and smaller portions by area until you found one that works. It sounds like you already tried that, but you may get different results depending on whether you check from smallest to lar... |
46,268,491 | I have a Spring Boot `@Configuration` class that's located at `com.app.config` and a controller located at `com.app.controller` and my test (in the tests directory) is at `com.app.controller`. When I run it, the configuration class is never used.
```
package com.app.config;
import org.springframework.context.annotati... | 2017/09/17 | [
"https://Stackoverflow.com/questions/46268491",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/857025/"
] | `@ComponentScan` is for `@Configuration` classes. Try replacing that in your test class with `@SpringBootTest`, which loads and configures the application context | You can make the following changes.
In Configuration file, add `@ComponentScan("Your Package path")`
```
import org.springframework.context.annotation.ComponentScan;
@Configuration
@EnableWebMvc
@ComponentScan("com.app")
public class ValidationConfig {
```
In Test File, add `@ContextConfiguration(c... |
63,677 | When casting [Prayer](http://paizo.com/pathfinderRPG/prd/spells/prayer.html), you give your allies a bonus and your foes a penalty on most rolls. Now, assuming you get to choose who your allies and foes are, can a creature tell which one you've designated him?
Example: I'm an evil cleric working with other evil charac... | 2015/06/17 | [
"https://rpg.stackexchange.com/questions/63677",
"https://rpg.stackexchange.com",
"https://rpg.stackexchange.com/users/23196/"
] | A creature doesn't know if it's affected by spell unless the spell says so; likewise, a creature doesn't know *how* a spell is affecting it unless the spell says so
-----------------------------------------------------------------------------------------------------------------------------------------------------------... | First of all, I'm going to assume you are looking for an in character answer, as it will be fairly obvious to the players right away that they have to subtract from their dice rolls instead of add. (And if it's not obvious to them, things are going to get really confusing.)
**But can a creature, in game, tell that the... |
192,425 | I'm trying to repair an old circuit based on the Micro-controller S87C751 interfaced with an inductive proximity sensor similar to one already posted here
[](https://i.stack.imgur.com/libiH.jpg)
The sensor is powered +24V.
I followed the circuit paths from the senso... | 2015/09/27 | [
"https://electronics.stackexchange.com/questions/192425",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/59110/"
] | I'm almost1 certain that in your scenario you can connect the ground of USB to the ground of the wall-wart and not worry about it. Wall-warts2 have isolation transformers. Its ground is floating. When you connect the floating ground to the other ground, they will equalize, and there will be no current between the groun... | You cannot have two ground references for one IC (or connected circuit).
You need to make sure that all the grounds are at the same potential.
If you cannot guarantee that they will be at the same potential you need to implement isolation of the data and ground.
If you only need the USB for simple comms you could po... |
9,030,446 | I accidentally unzipped files into a wrong directory, actually there are hundreds of files... now the directory is messed up with the original files and the wrongly unzip files. I want to pick the unzipped files and remove them using shell script, e.g.
```
$unzip foo.zip -d test_dir
$cd target_dir
$ls test_dir | rm -r... | 2012/01/27 | [
"https://Stackoverflow.com/questions/9030446",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1165196/"
] | The following script has two main benefits over the other answers thus far:
1. It does not require you to unzip a whole 2nd copy to a temp dir (I just list the file names)
2. It works on files that may contain spaces (parsing `ls` will break on spaces)
---
```
while read -r _ _ _ file; do
arr+=("$file")
done < <(u... | Compacting the previous one. Run this command in the /DIR/YOU/MESSED/UP
```
unzip -qql FILE.zip | awk '{print "rm -rf " $4 }' | sh
```
enjoy |
3,817,926 | I want to use django template to process plain text file, and tried this:
```
from django.template import loader, Context
t = loader.get_template('my_template.txt')
```
however, it works for this:
```
from django.template import loader, Context
t = loader.get_template('my_template.html')
```
Can we load txt files... | 2010/09/29 | [
"https://Stackoverflow.com/questions/3817926",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/311884/"
] | As @Seth commented I don't see any reason why this shouldn't work. Django doesn't care about the extension of the file. You can very well load `my_template.foo`.
Check the following:
1. The file is indeed present where it should be. If it is in a subdirectory then you'll have to use `loader.get_template('<subdirecto... | I would leave this for some one else to answer as I am not very comfortable with Django.
How ever, if you are interested in templates and plain text processing, why don't you look at slew of other products available within python.
* <https://stackoverflow.com/questions/98245/what-is-your-single-favorite-python-templa... |
62,136,974 | I'm giving mainteinence to an app with Angular 7.0.7 and Node 10.20.1.
I were working fine, I installed long ago Sweetalert and the plugin was working fine. Yesterday my PC restarted and when I run `ng serve` I got this error
>
> ERROR in node\_modules/sweetalert2/sweetalert2.d.ts(277,39): error
> TS1005: ',' expect... | 2020/06/01 | [
"https://Stackoverflow.com/questions/62136974",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6605722/"
] | Hello I also started facing the same issue.Found a fix for the meantime till a better solution comes.I just downgraded it.Check and see if it works for you.
npm install sweetalert2@v9.11.0 | The problem most probably comes from a mismatch on the typescript version needed by `sweetalert2` and the one of your project.
On your package.json you have the following:
```
"sweetalert2": "^9.14.0" // Wants any version like 9.X where X must be >= 14
"typescript": "~3.1.6" // Wants any version like 3.1.Y where Y mu... |
51,330,059 | I'm new to VBA so this is probably a very obvious mistake.
To keep it short, I am trying to delete rows based on two criteria: In Column A, if they have the same value (duplicate) and in Column B, the difference is *less than* 100, then one row is deleted from the bottom.
Example data:
```
Column A Column B ... | 2018/07/13 | [
"https://Stackoverflow.com/questions/51330059",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10024322/"
] | Sticking to the format of your code, you can do this using one `For` loop as well.
```
For i = lrow To 3 Step -1
If .Cells(i, "A") = .Cells(i - 1, "A") And (.Cells(i, "B") - .Cells(i - 1, "B")) < 100 Then
.Cells(i, "A").EntireRow.Delete
End If
Next i
``` | Why not to use the built-in command:
```
Worksheets("Sheet1").Range("$A:$A").RemoveDuplicates Columns:=1, Header:=xlYes
```
[Range.RemoveDuplicates Method (Excel)](https://msdn.microsoft.com/en-us/vba/excel-vba/articles/range-removeduplicates-method-excel?f=255&MSPPError=-2147217396) |
59,913,778 | I have been coding for a while in Visual Studio with visual basic and there was an option to autoformat code at the same time you were coding.
I know i can format it in Android Studio with CTRL+ALT+L but is there any option so the software do it automatically?
Thanks. | 2020/01/25 | [
"https://Stackoverflow.com/questions/59913778",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10725028/"
] | All i had to do was add an initContainer and mount the Configmaps to /tmp and have it moved to the necessary path /var/opt/jfrog/artifactory/etc/, instead of mounting the configmap in the volumemount /var/opt/jfrog/artifactory.
Reason: ConfigMaps are ReadOnly hence /etc was and would always be Readonly.
```
initCon... | As explained [here](https://serverfault.com/questions/906083/how-to-mount-volume-with-specific-uid-in-kubernetes-pod), [here](https://stackoverflow.com/questions/46974105/kubernetes-setting-custom-permissions-file-ownership-per-volume-and-not-per-p?rq=1), [here](https://github.com/moby/moby/issues/2259) and [here](http... |
5,327,803 | I would like to know whether its possible to execute different http protocol methods like GET,POST,HEAD,etc manually without using browser either through command prompt or using any programming language?
If yes, then how to do this?
Please enlighten !!! | 2011/03/16 | [
"https://Stackoverflow.com/questions/5327803",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/194476/"
] | Almost every language has at least one mechanism for performing HTTP requests. From the command line you can use tools such as wget and cURL. | It's possible, using php's header() functions or using telnet and typing out the headers manually. |
39,975,565 | IMAGE -

Please refer to the image for better understanding of the scenarios
- For input from table I have 5 columns COL1,COL2,COL3,COL4,COL5
- Scenario 1, 2, 3, 4 explains the types of input I will receive. The Value in Col 4 can vary(for e... | 2016/10/11 | [
"https://Stackoverflow.com/questions/39975565",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6997912/"
] | Do an aggregated sum based on the columns B, C, and D and then use a Joiner transformation to join your aggregated output (4 rows) with original source rows (17 rows). Do not forget to use sorted input in the joiner, which is mandatory for this kind of self join.
```
Source ------> Sorter ----> Aggregator -----> Joine... | Why don't you just use the `SUM(Value) OVER (PARTITION BY COL1, ..., COLN) AS ValueSum` analytical functionality in Netezza? All you need to do is to define how to partition the sums.
Read more here: <https://www.ibm.com/support/knowledgecenter/SSULQD_7.2.1/com.ibm.nz.dbu.doc/c_dbuser_report_aggregation_family_syntax.... |
98,216 | Introduction
------------
I defined the class of antsy permutations in [an earlier challenge](https://codegolf.stackexchange.com/questions/97217/antsy-permutations).
As a reminder, a permutation **p** of the numbers from **0** to **r-1** is antsy, if for every entry **p[i]** except the first, there is some earlier ent... | 2016/11/01 | [
"https://codegolf.stackexchange.com/questions/98216",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/32014/"
] | JavaScript (ES6), 52 bytes
==========================
```
v=>[...v,l=0].map(x=>x?l++:h--,h=v.length).reverse()
```
Test it out:
```js
f=v=>[...v,l=0].map(x=>x?l++:h--,h=v.length).reverse()
g=v=>console.log(f((v.match(/[01]/g)||[]).map(x=>+x)))
```
```html
<input oninput="g(this.value)" value="010">
```
### Expla... | Haskell, 40 bytes
-----------------
```haskell
foldl(\r a->map(+0^a)r++[a*length r])[0]
```
[Dennis's Python solution](https://codegolf.stackexchange.com/a/98231/20260) golfs wonderfully in Haskell with `map` and `fold`. It's shorter than my attempts to port my [direct entrywise construction:](https://codegolf.stack... |
157,800 | What technologies (hardware/software) are available for streaming audio in realtime (with some latency, of course) over a Wifi network? Although I'm using mostly Macs, I would like something that any client can access (especially smart phones that can access Wifi). | 2010/06/28 | [
"https://superuser.com/questions/157800",
"https://superuser.com",
"https://superuser.com/users/4952/"
] | [Subsonic](http://www.subsonic.org/pages/index.jsp) can stream over WiFi or the internet. I have it running at home so I can listen to my music over the air from work on my PC or from my Android phone, but there is also an iPhone app. | For me: ices + icecast on the ubuntu server side; any stream player on the client side (e.g. XiiaLive Lite on the Android) |
60,006,524 | I want to replace part of the string with asterisk (\* sign).
How can I achieve that? Been searching around but I can't find a solution for it.
For example, I getting 0123456789 from backend, but I want to display it as \*\*\*\*\*\*6789 only.
Please advise.
Many thanks. | 2020/01/31 | [
"https://Stackoverflow.com/questions/60006524",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3180690/"
] | try using replaceRange. It works like magic, no need for regex. its replaces your range of values with a string of your choice.
```
//for example
prefixMomoNum = prefs.getString("0267268224");
prefixMomoNum = prefixMomoNum.replaceRange(3, 6, "****");
//Output 026****8224
``` | You can easily achieve it with a `RegExp` that matches all characters but the last `n` char.
Example:
```
void main() {
String number = "123456789";
String secure = number.replaceAll(RegExp(r'.(?=.{4})'),'*'); // here n=4
print(secure);
}
```
Output: `*****6789`
Hope that helps! |
165,949 | I noticed the following today: [Mono at the PDC 2008](http://tirania.org/blog/archive/2008/Oct-01-1.html)?
>
> My talk will cover new technologies that we have created as part of Mono. Some of them are reusable on .NET (we try to make our code cross platform) and some other are features that specific to Mono's implem... | 2008/10/03 | [
"https://Stackoverflow.com/questions/165949",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5147/"
] | Looking at the [roadmap](http://www.mono-project.com/Mono_Project_Roadmap), maybe the new JIT/IL implementation that they're quite proud of; could be the C# Evaluation API / C# Shell. However, I suspect we'll have to wait for PDC to find out...
Many of the roadmap items are (quite reasonably) like-for-like comparable w... | [Here](http://www.mono-project.com/Release_Notes_Mono_2.0) is more details about Mono 2.0 |
453,551 | I'm curious about the use of the famous British plural verb form with a group noun¹ *in a contraction*. The general custom for the plural is discussed [here](https://english.stackexchange.com/questions/331377/british-mass-nouns-versus-american-count-nouns) and [here](https://english.stackexchange.com/questions/76448/pr... | 2018/07/06 | [
"https://english.stackexchange.com/questions/453551",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/15679/"
] | "England **are** in Russia," because the "guys from England" are in Russia, not the country.
"**England's** going all the way" because the team (England) is, not the members individually. | I am Canadian and our school taught that: Nouns like team, group, family, class etc are a singular entity and were therefore treated as such. However I watch some British television and they repeatedly say things like "The team were riding on their new bus" rather than "The team was riding on it's new bus." Of course t... |
235,296 | Determining genetic fatherhood is very important in my worldbuilding experiment for lots of reasons, one being succession, but regardless it's the genetic component that's important But it's possible that people don't know who the father is of their child as well. Note that this is *not a medieval European world*. I sp... | 2022/09/08 | [
"https://worldbuilding.stackexchange.com/questions/235296",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/39866/"
] | Depending on when you need the test to be done by, you say "no more than 5 years" and if knowledge is as functionally unrestricted as you're saying, while *only* technology is restricted...
Using precise timing, the list of candidates can be constrained so that we might be able to use [uncommonly known inheritable tra... | Medieval and older systems what was used:
1. woman found with a man who was not their husband was banished.
2. woman found with a man who was not their husband was stoned to death.
3. man found with a married woman was castrated.
4. harems; married women were prohibited from meeting men, all work where a man was neede... |
18,668 | I am starting a (mainly) body-weight fitness routine and I have found squats to be WAY to easy.
There are two progressions I can try that I know of:
I can try to work towards pistol squats
OR I can use a backpack and keep adding weights to it.
What are the benefits/downsides of each approach?
Recommend any alte... | 2014/08/20 | [
"https://fitness.stackexchange.com/questions/18668",
"https://fitness.stackexchange.com",
"https://fitness.stackexchange.com/users/10441/"
] | Pull ups are much harder for women, than for men. Males have significant more muscle mass on their upper bodies than women does, so it is natural, it is hard.
That said, focus on assisted exercises to begin with. Grip strength also plays a role, but should come quite quickly for beginners.
* Rubber-bands
* Assisted... | Pull ups require good development of the back muscles , and you are lifting your body weight. So to increase the number of pull ups you can start doing lat pull downs on machine . These pull downs are to be performed with strict form , with no or least bent in the spine, and bringing the bar to your chins.As you progre... |
18,996,141 | I have done my OR mapping by using NHibernate in my C# web application. When i want to get all leaf nodes, i use a query statement like this:
```
List<NODE> LeafList =(List<NODE>) Session.CreateQuery("from NODE as node where node.Id not in (select FatherNodeId from NODE)").List<NODE>();
```
However, i get the count ... | 2013/09/25 | [
"https://Stackoverflow.com/questions/18996141",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2813532/"
] | Try with following code
```
// Example #1: Write an array of strings to a file.
// Create a string array that consists of three lines.
string[] lines = { "First line", "Second line", "Third line" };
// WriteAllLines creates a file, writes a collection of strings to the file,
... | ```
File.WriteAllLines(filePath, ActorArrayList.ToArray());
``` |
1,388,578 | hi i have written app on vs2008 c# (express edition) on win XP which reads and creates excel files (excel 2003) using microsoft excel 11.0 object library (because that's the only available one through add references in COM section)... now i publish this project, then copy the setup.exe and take it to my friend's win vi... | 2009/09/07 | [
"https://Stackoverflow.com/questions/1388578",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Where do you create the excel files? May be your programm has not right to access the directory where you store the files.
An other case may be that your friend´s computer does not support the used excel 11.0 object library cause he has an other version of excel (Excel 2007) installed. | Should really say what the exceptions are otherwise it's a random stab in the dark, but...
Are the same version excel libraries available on the target machine? |
11,251,826 | I have a desktop client that sends data to a web server and I can't seem to get through the proxy server.
**Update**: I am getting a 407 HTTP error when trying to communicate through the proxy.
When downloading information from my web server, everything is fine. Once the user configures the proxy server (using a dial... | 2012/06/28 | [
"https://Stackoverflow.com/questions/11251826",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1134211/"
] | Just for completeness, since this question is found searching for JVM http.proxy properties, if using JVM infrastructure proxy username and passwords can be provided using :
```
System.setProperty("http.proxyUser",proxyUserName)
System.setProperty("http.proxyPassword",proxyUsePassword).
``` | For some reason, setting parameters on client didn't work for me.
But worked on http method. |
9,543,143 | I have a viewController pushed in navigationController.
When this viewController pushed, the navigation bar was attached on top(0.0, 0.0), and
the viewController's view was attached just under that. (maybe.. 0.0, 44.0)
But, I want this view to locate to (0.0, 0.0) with navigation bar.
Namely, the top side of the vi... | 2012/03/03 | [
"https://Stackoverflow.com/questions/9543143",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/619267/"
] | Your first try was correct:
```
command_name "$abstract"
```
That executes `command_name` with a single argument, `test1 and "test2"`. For example:
```
:; mkdir empty
:; cd empty
:; abstract='test1 and "test2"'
:; touch "$abstract"
:; ls -l
total 0
-rw-r--r-- 1 mayoff wheel 0 Mar 2 21:26 test1 and "test2"
```
... | The differences between `"$abstract"` and `$abstract` and `\"$abstract\"` are:
* **`"$abstract"`** expands to **`test1 and "test2"`** as a single word
* **`$abstract`** expands to **`test1 and "test2"`**, then split to (**`test1`**, **`and`**, **`"test2"`**) as 3 words
* **`\"$abstract\"`** is nothing but string conca... |
6,731,140 | ```
(gdb) disas func
Dump of assembler code for function func:
0x00000000004004b8 <func+0>: push %rbp
0x00000000004004b9 <func+1>: mov %rsp,%rbp
0x00000000004004bc <func+4>: movl $0x64,0xfffffffffffffff0(%rbp)
0x00000000004004c3 <func+11>: movb $0x61,0xfffffffffffffff4(%rbp)
0x00000000004004c7 <func... | 2011/07/18 | [
"https://Stackoverflow.com/questions/6731140",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/807893/"
] | RAX is big enough to hold the entire structure. At 0x00000000004004c7 you're loading the entire structure (with mov), not its address (you'd use lea instead).
The x86-64 System V ABI's calling convention returns C structs up to 16 bytes in RDX:RAX or RAX. [C++ on x86-64: when are structs/classes passed and returned in... | Your original code is returning a copy of the structure created in the function - because you're returning a structure type, not a pointer to a structure. What it looks like is that the entire structure is passed by value with `rax`. Generally speaking, the compiler can produce various assembly codes for this, dependin... |
29,453,615 | Is there a way that I can compare an array and an arraylist like
```
if (array[0]==arraylist[0])
```
I am working on this problem:
```
String[] s= {"a","a","b","b","b","c"};
ArrayList<String> list = new ArrayList<String>();
list.add("a");
list.add("b");
list.add("c");
// create a new arraylist that stores the frequ... | 2015/04/05 | [
"https://Stackoverflow.com/questions/29453615",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4593157/"
] | ```
import java.util.ArrayList;
public class ArrayAndArrayListElementsComparison {
public static int compareArrayAndArrayListElements(String[] array, ArrayList<String> arraylist) {
int count = 0;
for (String s : array) {
if (arraylist.contains(s)) {
count++;
... | You try
```
if (array[0].equals(arraylist[0]))
```
As in java comparisons string should use equals(). It's not like javascript. |
114,294 | I have a server that listens to simple tcp sockets. If connecting to it, it prints a prompt and I can type commands, hit enter, see (and save) results, and then have the prompt again. I'm using telnet right now to connect, but want something more console/shell like.
Specifically, I'm looking for a tool that only sends... | 2010/02/18 | [
"https://serverfault.com/questions/114294",
"https://serverfault.com",
"https://serverfault.com/users/35316/"
] | Did you have a look at netcat ( <http://netcat.sourceforge.net/>) | Try `ncat`, which comes with [nmap](http://nmap.org/) 5.0 and later. I run:
```
C:\>"\Program Files (x86)\Nmap\ncat.exe" www.google.com 80
```
I type:
```
HEAD / HTTP/1.0
Host: www.google.com
<extra return>
```
I get:
```
HTTP/1.0 200 OK
Date: Thu, 18 Feb 2010 20:48:34 GMT
Expires: -1
Cache-Control: private, max... |
27,746,614 | Let's say I have a cell array containing 1x2 cells. eg. `deck = {{4,'c'},{6,'s'}...{13,'c'}...{6,'d'}}`
How can I find the index of a specific cell? E.g I want to find the index of the cell with the values `{13,'c'}`.
Thanks! | 2015/01/02 | [
"https://Stackoverflow.com/questions/27746614",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4098307/"
] | Another method I can suggest is to operate on each column separately. We could use logical operators on each column to search for cards in your cell array that contain a specific number in the first column, followed by a specific suit in the second column. To denote a match, we would check to see where these two output... | Try [`cellfun`](http://www.mathworks.com/help/matlab/ref/cellfun.html) with [`isequal`](http://www.mathworks.com/help/matlab/ref/isequal.html):
```
>> deck = {{4,'c'},{6,'s'},{13,'c'},{6,'d'}};
>> targetCell = {13,'c'};
>> found = cellfun(@(c) isequal(c,targetCell),deck)
found =
0 0 1 0
```
`cellfun... |
4,207,989 | I have heared that PHP is not good for large websites althogh I do not know what is the meaning of large websites in this case, is it something like Facebook for example? Any way, is it true that PHP does scale with large websites? | 2010/11/17 | [
"https://Stackoverflow.com/questions/4207989",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/514103/"
] | I'm going to differ with my counterparts here. As a language, nothing about PHP is built for scalability. Any language can be extended for that, and PHP has far more than its fair share of tools to do it, but as far as built-in tools to support that need, it has none.
Which is exactly what makes it a great choice.
Yo... | It depends on your application architecture not programming languages. If your architecture and design is optimised your application will perform very well on large scale. And also depends on your servers. |
50,641 | Good day,
I have a sensor which supports serial data output using RS422 which has 4 wires (RX+, RX-, TX+, TX-)
my question is how can I connect this sensor to the Arduino.
I read that i can use 2 max485 chips to do this but uncertain of the exact procedure.
Thanks in advance. | 2018/03/11 | [
"https://arduino.stackexchange.com/questions/50641",
"https://arduino.stackexchange.com",
"https://arduino.stackexchange.com/users/35288/"
] | There are pre-made and very inexpensive Arduino RS-485 modules available on Ebay or Amazon. Much simpler than building your own circuit.
They look like this:
[](https://i.stack.imgur.com/kG1OF.jpg) | The MAX490 chip consists of DI (pin 3) and RO (pin 2) pins that connect to the Arduino TX and RX respectively. the rs-422 side of the chip consists of pin 5 (Y / T+), Pin 6 (Z / T-), pin 7 (B / R-) and pin 8 (A / R+)
<http://arduinotronics.blogspot.com/2018/09/long-distance-serial-with-rs-422.html> |
6,339,287 | The following command is working as expected...
```
cp -ur /home/abc/* /mnt/windowsabc/
```
Does `rsync` has any advantage over it? Is there a better way to keep to backup folder in sync every 24 hours? | 2011/06/14 | [
"https://Stackoverflow.com/questions/6339287",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/139150/"
] | Keep in mind that while transferring files internally on a machine i.e not network transfer, using the **-z** flag can have a massive difference in the time taken for the transfer.
**Transfer within same machine**
```
Case 1: With -z flag:
TAR took: 9.48345208168
Encryption took: 2.79352903366
CP took = 5... | I used rsynk to transfer 330G data from a local HD to a external HD via USB 3.0. It took me three days. The transfer rate went down to 800 Kb/s and rised to 50 M/s for a while only after pausing the job. It is a typical overbuffering issue. Bad experience for local file tranfers: as the name indicates, (R)sync stands f... |
16,007,880 | The Following is my code when i am fetching the value from the GameByGameTypes and Categories but in table called GameByGameTypes have column CategoryId have NULL value. So i want 0 inplace of NULL
```
Category objCategory;
var query = (from gametypebygametype in db.GameByGameTypes.Where( x => x.Gam... | 2013/04/15 | [
"https://Stackoverflow.com/questions/16007880",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2049563/"
] | Or you can replace
```
select new
{
category.CategoryId,
category.CategoryName
}
```
with
```
select new
{
CategoryId = category.CategoryId ?? 0,
CategoryName = category.CategoryName ?? "",
}
```
If you use ReSharper - it will 'complain' that `?? 0` part is not needed. Ignore it.
And Linq-cod... | You have three ways to work with this:
1. You can set column in database `not null` and set default to column 0.
2. You can set Category property `int? CategoryId`.
3. You can change your query to use DefaultIfEmpty with default value
```
var query = (from gametypebygametype in db.GameByGameTypes.Where( x =... |
74,246,337 | I have a button that changes an element's style. Can I have this button auto-reset the CSS changed, back to default? Here is the code:
```
<div class="coinboxcontainer"><img id="coin1" src="/wp-content/uploads/2022/10/coin.png" alt="box" width="40" height="40">
<a onclick="tosscoin()"><img src="/wp-content/uploads/202... | 2022/10/29 | [
"https://Stackoverflow.com/questions/74246337",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15846302/"
] | You can't circumvent auto-play from being blocked. There has to be some user interaction before the audio can play. This is the same for both HTML `<audio>` element as well as the web-audio API's `audioContext`
There's some reading about this on MDN [Autoplay guide for media and Web Audio's API](https://developer.mozi... | You can try to play the audio on javascript `onload`.
Example:
HTML:
```
<audio controls id="horseAudio">
<source src="https://www.w3schools.com/html/horse.ogg" type="audio/ogg">
<source src="https://www.w3schools.com/html/horse.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</au... |
19,316,285 | suppose I have this string:
```
var inputStr="AAAA AAAAAAAA AAA AAAAA";
```
**(The asumption here is that I don't know the size of each 'A...' sequence in the string.)**
I need a simple way to reduce 2 'A' characters from every "A..." sequence in that string
somthing like:
```
var result=Regex.Replace(inputStr... | 2013/10/11 | [
"https://Stackoverflow.com/questions/19316285",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1219182/"
] | If you know that all the 'words' are `A`s, you can use this replace:
```
var result=Regex.Replace(inputStr,@"AA\b","");
```
[regex101 demo for the regex replace](http://regex101.com/r/jU4dO3)
---
As per edit, a more general pattern would be:
```
var result=Regex.Replace(inputStr,@"AA(?!A)","");
```
[regex101 de... | Although not a regex but it will work
```
String.Join(" ", inputStr.Split().Select(x => x.Substring(0, x.Length - 2)).ToArray());
``` |
32,420,956 | The scrolling on my UICollectionView is really choppy. As I scroll past half the screen, it gets stuck for a moment and then proceeds. How can I make the scrolling more smooth using SWIFT? | 2015/09/06 | [
"https://Stackoverflow.com/questions/32420956",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5146927/"
] | Use Time Profiler instrument to find out where the bottleneck is. Swift has nothing to do with scroll view's performance. | There are two complementary ways:
1) [Fast way] When choppy effect is large enough for giving you time for pressing pause button on the debugger. And then review what is doing main thread (Thread 1), most probably won't be doing UI tasks. Move those task to background.
2) When doesn't use instruments with core image. |
602,237 | '`hello, world`' is usually the first example for any programming language. I've always wondered where this sentence came from and where was it first used.
I've once been told that it was the first sentence ever to be displayed on a computer screen, but I've not been able to find any reference to this.
So my question... | 2009/03/02 | [
"https://Stackoverflow.com/questions/602237",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22674/"
] | Brian Kernighan actually wrote the first "hello, world" program as part of the documentation for the BCPL programming language developed by Martin Richards. BCPL was used while C was being developed at Bell Labs a few years before the publication of Kernighan and Ritchie's C book in 1972.
[![enter image description he... | From <http://en.wikipedia.org/wiki/Hello_world_program>:
>
> The first known instance of the usage
> of the words "hello" and "world"
> together in computer literature
> occurred earlier, in Kernighan's 1972
> Tutorial Introduction to the Language
> B[1], with the following code:
>
>
>
> ```
> main( ) {
> e... |
58,046,980 | Please run the example below. I'm trying to stretch the left line further to the left to compensate the parent's padding as you can see in the second example, **while** keeping the title centered relative to the parent like in the first example. I can't seem to have both.
(For anyone who's familiar, the divider I'm tr... | 2019/09/22 | [
"https://Stackoverflow.com/questions/58046980",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11153160/"
] | First, I would use flexbox instead of table layout then adjust the margin/padding:
Kept only the relevant code for the demo
```css
#container {
width: 400px;
background: #EFEFEF;
padding: 24px;
}
/* Normal use case */
.divider {
display: flex;
margin: 16px 0;
align-items:center;
}
.divider::b... | Solution with minimum CSS, without flex, without transform.
```css
.divider {
position: relative;
text-align:center;
}
.divider:before {
content:'';
position: absolute;
top:50%;
height: 1px;
width: 100%;
background: #000;
left: 0;
z-index: -1;
}
.divider span{
padding: 0 24px;
... |
50,512,600 | I'm trying to do a shader to curve the world like [Subway Surfer](https://www.youtube.com/watch?v=Muh7QFisCfE&ab_channel=Throneful) does.
I have found a [GitHub repo](https://gist.github.com/grimmdev/9e63af5ab00c91d7ad09) where someone pushes an approximation for it that works cool.
This is the code:
```
Shader "Cu... | 2018/05/24 | [
"https://Stackoverflow.com/questions/50512600",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9419887/"
] | edited:
Here's an example for unity 2018.1
<https://gist.github.com/bricevdm/caaace3cce9a87e081602ffd08dee1ad>
```c
float4 worldPosition = mul(unity_ObjectToWorld, v.vertex);
// get world space position of vertex
half2 wpToCam = _WorldSpaceCameraPos.xz - worldPosition.xz;
// get vector to camera and dismiss vertica... | It's because there isn't value as position in `appdata_full` struct:
```
struct appdata_full {
float4 vertex : POSITION;
float4 tangent : TANGENT;
float3 normal : NORMAL;
float4 texcoord : TEXCOORD0;
float4 texcoord1 : TEXCOORD1;
fixed4 color : COLOR;
#if defined(SHADER_API_XBOX360)
half4 t... |
464,150 | Цитирую отрывок из "Иерусалима" А. Мура в переводе С. Карпова. Стр. 835.
>
> Я вижу Томаса а Беккета, и вижу смуглую женщину со шрамом, которая
> работает в корпусе Святого Петра в две тысячи двадцать пятом году.
>
>
>
"Вижу" и "вижу" — это два однородных сказуемых, соединённых союзом "и". В таких случаях запятая... | 2021/04/13 | [
"https://rus.stackexchange.com/questions/464150",
"https://rus.stackexchange.com",
"https://rus.stackexchange.com/users/4120/"
] | Второй ответ от 20.04.2021 (обсуждение продолжено по просьбе автора вопроса)
Да, вопрос непростой. Я уже привела в комментарии ссылку на обсуждение подобной темы на форуме. [https://rus.stackexchange.com/questions/458555/Как-отличить-сложное-предложение-с-односоставными-частями-от-простого-с-однородн](https://rus.stac... | **Вместо вступления**
Как мне кажется, мы обычно воспринимаем правила как **инструкцию** (руководство) для правильного оформления текстов, но не более того. Писатель должен писать по правилам, потому что это требует редактор издательства, а обычные люди соблюдают правила, чтобы считать себя грамотными и чтобы другие т... |
56,615,820 | I meet a question in Codeignter when I try to get an object return, some of controllers codes are
```
$sql = $this->user_model->userdetail($data);
if ($sql) {
echo json_encode(array(
"status" => "0",
"message" => "",
"data" => $sql
));
exit();
}
```
And the mod... | 2019/06/16 | [
"https://Stackoverflow.com/questions/56615820",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11493319/"
] | Your **problem** is you are using **result\_array()**. You have to use **row()** instead, *row()* function will give you the object instead of array.
The model code:
```
function userdetail($data) {
$id = $data["id"];
$sql = "select email, name from user where id='".$id."'";
$query = $this->db->query($sql... | I think I find the reason, in model
```
return $query->result_array(); // also can be changed to return $query->result_object(); or return $query->result();
```
They can return array or object, and in controller file
```
$sql = $this->user_model->userdetail($data);
```
`$sql` should be array or object, but actua... |
642,537 | I run CentOS 6.4. After configuring bridge I am unable to connect to internet through PPPoE Bsnl Dsl. I set up the bridge as follows:
```
DEVICE="br0"
NM_CONTROLLED="no"
ONBOOT=yes
TYPE=Bridge
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="br0"
```
I added `BRIDGE= br0` at the end of eth0 file... | 2013/09/08 | [
"https://superuser.com/questions/642537",
"https://superuser.com",
"https://superuser.com/users/-1/"
] | If you are doing a search using Active Directory tools, then the `*` character is the one you would use for a wildcard, not `%`. This comes from the LDAP directory search syntax.
But it looks to me like the search box available from `dsquery.dll` only works correctly with a wildcard placed at the end of the string. So... | One Outlook addin you might want to check out is [Company Contacts for Outlook](https://wizardsoft.nl/products/companycontactsoutlook). It provides a full text searchable global address book. Wild cards, search in specific column, sort and rearrange columns, quick actions, etc. |
848,415 | What is the best way to assemble a dynamic WHERE clause to a LINQ statement?
I have several dozen checkboxes on a form and am passing them back as: Dictionary<string, List<string>> (Dictionary<fieldName,List<values>>) to my LINQ query.
```
public IOrderedQueryable<ProductDetail> GetProductList(string productGroupName... | 2009/05/11 | [
"https://Stackoverflow.com/questions/848415",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/86555/"
] | I have similar scenario where I need to add filters based on the user input and I chain the where clause.
Here is the sample code.
```
var votes = db.Votes.Where(r => r.SurveyID == surveyId);
if (fromDate != null)
{
votes = votes.Where(r => r.VoteDate.Value >= fromDate);
}
if (toDate != null)
{
votes = votes.... | Just to share my idea for this case.
Another approach by solution is:
```
public IOrderedQueryable GetProductList(string productGroupName, string productTypeName, Dictionary> filterDictionary)
{
return db.ProductDetail
.where
(
p =>
(
(String.IsNullOrEmpty(... |
4,972,810 | Hey all, I'm writing an application which records microphone input to a WAV file. Previously, I had written this to fill a buffer of a specified size and that worked fine. Now, I'd like to be able to record to an arbitrary length. Here's what I'm trying to do:
* Set up 32 small audio buffers (circular buffering)
* Sta... | 2011/02/11 | [
"https://Stackoverflow.com/questions/4972810",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/537002/"
] | The most likely reason is you're writing from the address of the pointer to your buffer, not from the buffer itself. Ditch the "&" in the final mFile.write. (It may have some good data in it if your buffer is allocated nearby and you happen to grab a chunk of it, but that's just luck that your write hapens to overlap y... | Shoot, sorry -- had a late night of work and am a bit off today. I forgot to show y'all the actual callback. This is it:
```
// Called when buffer is full
void CaptureApp::onData(float * data, int32_t & size)
{
// Check recording flag and buffer size
if (mRecording && size <= BUFFER_LENGTH)
{
// ... |
460,952 | I saw a practice SAT question on Khan Academy:
>
> Certified Executive Chef Hilary DeMane has prepared confections for **celebrities, governors, and even** Ronald Reagan.
>
>
>
The correct answer is filled in and in boldface. While I find this correct answer most natural, I wonder when it is permissible to add a ... | 2018/08/20 | [
"https://english.stackexchange.com/questions/460952",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/241797/"
] | What you're talking about is adding parenthetical nonessential information as denoted by a pair of commas.
It's also something that's quite acceptable.
However, you do need to make sure that there are *two* commas used.
>
> ... governors, and even, Ronald Reagan.
>
>
>
In this example, the usage is wrong becaus... | The first is a case of an Oxford comma used for emphasizing the end clause. It's not one of a parenthetical as in the other.
HTH. |
60,665,435 | When `MyFgment` appear in screen, I want to set cursor focus on `EditText` in `MyFragment` automatically. I've tried `EditText.requestFocus()`, but it doesn't focus on `EditText`. How can I do?? | 2020/03/13 | [
"https://Stackoverflow.com/questions/60665435",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12350049/"
] | set this in your xml
```
android:focusable="true"
android:focusableInTouchMode="true"
```
and you can set this on onViewCreated program `editText.isFocusableInTouchMode();
editText.setFocusable(true);` | Add this kotlin extension function
```
fun EditText.focus() {
text?.let { setSelection(it.length) }
postDelayed({
requestFocus()
val imm = context.getSystemService(Activity.INPUT_METHOD_SERVICE) as InputMethodManager
imm.showSoftInput(this, InputMethodManager.SHOW_IMPLICIT)
}, 200)
... |
42,002,826 | I have a page where the user want to add new category to the database,
I want to check if the category is already added before in the database or not,if it is new one add it to the database, it is working fine but it adds it many times(equal to the data in the table) i know it is because of `foreach`,how can it be done... | 2017/02/02 | [
"https://Stackoverflow.com/questions/42002826",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7115432/"
] | Try this:
```
<?php
include_once "connect.php";
$stmt ="SELECT distinct Category_Name FROM Categories";
$exists = false;
foreach ($conn->query($stmt) as $row) {
if ($row['Category_Name'] == $_POST["CatName"]) {
$exists = true;
}
}
if(!$exists) { // The category does... | You can make Category\_Name in your data base As index unique So the database can't inserte a duplicated mane. and in your inerte SQl add ON DUPLICATE KEY
[Exemple](https://dev.mysql.com/doc/refman/5.7/en/insert-on-duplicate.html) |
26,514 | Is it possible to do the following?
Input would be to generate a new AES key, encrypt the private data with that key, encrypt the AES key with the FHE key, and send the FHE-encrypted AES key along with the AES encrypted data to the compute node. | 2015/06/25 | [
"https://crypto.stackexchange.com/questions/26514",
"https://crypto.stackexchange.com",
"https://crypto.stackexchange.com/users/25204/"
] | In the first section of this answer I'll assume that through better hardware or/and algorithmic improvements, it has become routinely feasible to exhibit a collision for SHA-1 by a method similar to that of [Xiaoyun Wang, Yiqun Lisa Yin, and Hongbo Yu's attack](https://www.c4i.org/erehwon/shanote.pdf), or [Marc Stevens... | When people say HMAC-MD5 or HMAC-SHA1 are still secure, they mean that they're still secure as PRF and MAC.
The key assumption here is that the key is unknown to the attacker.
$$\mathrm{HMAC} = \mathrm{hash}(k\_2 | \mathrm{hash}(k\_1 | m)) $$
* Potential attack 1: Find a universal collision, that's valid for many ke... |
2,584,055 | The information given in the task:
\*X and Y are independent random variables.
$\ X$~$R(0,1)$
$\ Y$~$R(0,1)$\*
I am then told to calculate:
$P(X>1/4)$, expected values and so on. The last problem is the one I am struggling with:
*Calculate $P(X+Y>1|Y>1/2)$, (The solution is 3/4)*
Somehow I'm unable to solve this... | 2017/12/29 | [
"https://math.stackexchange.com/questions/2584055",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/516638/"
] | The denominator $(x+1)^2$ is always non-negative. When $x$ tends to $-1$, since the denomiator is slightly larger than zero, while the numerator is negative, the limit diverges to negative infinity. | To decide the sign of the $\infty$ consider e.g. $$\lim \_{x \to 0^+} \quad \frac{1}{x}$$
i.e. $x$ tends to zero via positive values. Everything is positive and the value of $\frac{1}{x}$ simply increases. i.e. $\frac{1}{x} \to \infty$
Consider $$\lim \_{x \to 0^-} \quad \frac{1}{x}$$
i.e. $x$ tends to zero via negati... |
182,116 | I'm right before Anor Londo bosses and I need to soul farm to level 69 so I can use soul spear. I would also like to upgrade my pyromancy glove and buy the remaining spells that I can. At the moment I'm level 59. The dragon bridge isn't enough anymore, even with the update. Right now, I'm farming Valley of the Drakes. ... | 2014/08/25 | [
"https://gaming.stackexchange.com/questions/182116",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/86087/"
] | I take it that you're building an Int build then.
I myself have a dex build and have been farming in **anor londo** myself a lot by parrying silver knights. After a few tries you get their patterns down and they yield a lot of souls. Because of the crit damage from the parry/riposte you get 20% extra souls.
* Silver ... | Since you're in Anor Londo, you can go to the first bonfire and farm the sentinels. They go down fast with a bleeding weapon. This area is also not open to invasion if I remember correctly. |
18,949,978 | I've been trying to generate a pattern of circles using a for loop. However, when it runs everything looks fine except for the 9th ring of circles which is ever so slightly. Having looked at a print out of numbers for that circle everything looks fine, so I can't work out what is going wrong. However, when I add one to... | 2013/09/22 | [
"https://Stackoverflow.com/questions/18949978",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2457072/"
] | You get the `segment` as a `float`, but then you use an `int` to calculate the degrees.
```
for (int j=0; j < 360; j+=segment)
```
and
```
float x = 325 + (radius*cos(radians(j)));
```
This is what is causing the rounding errors.
And if you make `i` to get a value bigger than `60` the program will never end. | Use `double` instead of float to minimise representation error.
Change the for loop to reduce error.
```
for (int k = 0; k < div; k++) {
int j = k * 360 / div;
```
This will give you different values for `j` which are likely to be more correct. |
3,995,529 | I completed the square as to get $(x+1010.5)^2-102110.25 = k^2$ but I don't know where to go from here.
Please help, thank you
I then got $(2x+2021)^2-4084441=4k^2$ then $(2k-2x-2021)(2k+2x+2021)=43^2\*47^2$ | 2021/01/22 | [
"https://math.stackexchange.com/questions/3995529",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/-1/"
] | $$\begin{align}x^2+2021x-a^2&=0, a\in\mathbb Z^{+}&\end{align}$$
$$\begin{align} &\Delta =2021^2+(2a)^2=T^2, T\in\mathbb Z^{+} \\
&\implies (T-2a)(T+2a)=2021^2\\
&\implies \begin {cases} T+2a =\dfrac {2021^2}{m} \\ T-2a=m \end {cases} \\
&\implies a=\dfrac {2021^2-m^2}{4m}\end{align}$$
Then, note that $2021^2=43^2×47... | For $x(x+2021)$ to be a square there has to be integers $a,b,c$ such that $$x=ab^2,x+2021=ac^2.$$
Subtracting these two equations we obtain $a(c-b)(c+b)=2021=43\times 47$. Since $43$ and $47$ are primes the only possibilities for $a, c-b$ and $c+b$ are
$$(1,43,47),(1,1,2021),(43,1,47),(47,1,43).$$
These give, in turn,... |
33,500 | How can you indict somebody for a crime that they didn't commit? But they might do. I find that a baffling concept. How is it justified? | 2018/11/14 | [
"https://law.stackexchange.com/questions/33500",
"https://law.stackexchange.com",
"https://law.stackexchange.com/users/12479/"
] | >
> What is the legal status of predictive policing?
>
>
>
You mean [this](https://en.wikipedia.org/wiki/Predictive_policing)?
First, "predictive policing" is a very wide concept. When police send officers to a sporting event or a protest rally they are practicing "predictive policing". If we are specifically con... | The determination of whether a person did a thing is made at trial, so actual guilt logically has to be follow the accusation. Whether or not that formal accusation is in the form of a grand jury indictment (as must be the case in US federal crimes, pursuant to the 5th Amendment), or by a prosecutor filing a charging d... |
58,406,976 | Can anyone is facing issue in Manage release in Google play store?
When I try to upload an app in production track. It's not opening. I am getting this error.
```
An unexpected error occurred. Please try again later. (3200000)
```
[](https://i.stack... | 2019/10/16 | [
"https://Stackoverflow.com/questions/58406976",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1136023/"
] | [An unexpected error occurred. Please try again later. (3200000](https://i.stack.imgur.com/Q3LaV.png)
I got this error just now , this error occurs while i need to manage my apk release
All App release has same error while i need to manage it , i do not know what happened
I do clear browser cache and close all my log... | I used USA proxy and now this error is not coming, everything is working fine.
Maybe Google has pushed some bug in certain countries rollout. |
62,812,741 | ```
SQL*Plus: Release 12.2.0.1.0 Production on Thu Jul 9 15:06:37 2020
Copyright (c) 1982, 2016, Oracle. All rights reserved.
SQL> conn sys@Databasename as sysdba
Enter password:
Connected to an idle instance.
SQL> shutdown abort;
ORACLE instance shut down.
SQL> startup nomount;
ORA-01078: failure in processing syst... | 2020/07/09 | [
"https://Stackoverflow.com/questions/62812741",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12240124/"
] | our "fields" are object with text,top and left. So, you can create a function
```
changePosition(event:CdkDragEnd<any>,field)
{
console.log(field)
field.top=+field.top.replace('px','')+event.distance.y+'px'
field.left=+field.left.replace('px','')+event.distance.x+'px'
}
```
And you call in the .html
... | It's very easy to achieve your goal with [ng-dnd](https://github.com/ng-dnd/ng-dnd). You can check the [examples](https://ng-dnd.github.io/ng-dnd/examples/index.html#/html5/drop-effects) and have a try.
Making a DOM element draggable
------------------------------
```html
<div [dragSource]="source">
drag me
</div>
... |
57,594,142 | I'm getting the same error and cant seem to understand where it comes from. tried messing with the constraints but im keep coming back to this specific problem.
Error:
```
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.rapp, PID: 11288
java.lang.RuntimeException: Unable to start activity Compone... | 2019/08/21 | [
"https://Stackoverflow.com/questions/57594142",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5352085/"
] | used the answer given here: <https://stackoverflow.com/a/53061877/5357676>
unchecked "Enable Instant Run to hot swap code/resource changes on deploy" in Setting > Build, Execution, Deployment > Instant run | You can reference here to import constraint layout into the project [Add ConstraintLayout to your project](https://developer.android.com/training/constraint-layout#add-constraintlayout-to-your-project)
Add this in you app -> build.gradle file
```
dependencies {
implementation 'com.android.support.constraint:const... |
27,827,234 | How can I make the `onKeyPress` event work in ReactJS? It should alert when **`enter (keyCode=13)`** is pressed.
```
var Test = React.createClass({
add: function(event){
if(event.keyCode == 13){
alert('Adding....');
}
},
render: function(){
return(
<div>
... | 2015/01/07 | [
"https://Stackoverflow.com/questions/27827234",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/544079/"
] | For me `onKeyPress` the `e.keyCode` is always `0`, but `e.charCode` has correct value. If used `onKeyDown` the correct code in `e.charCode`.
```
var Title = React.createClass({
handleTest: function(e) {
if (e.charCode == 13) {
alert('Enter... (KeyPress, use charCode)');
}
if (e.keyCode ==... | Keypress event is deprecated, You should use Keydown event instead.
<https://developer.mozilla.org/en-US/docs/Web/API/Document/keypress_event>
```
handleKeyDown(event) {
if(event.keyCode === 13) {
console.log('Enter key pressed')
}
}
render() {
return <input type="text" onKeyDown={this.handleKeyD... |
31,684,372 | My table view is divided in two sections :
completed tasks and to do.
When I hit delete I want the to do task in the completed task and vice versa.
This is my viewDidAppear:
```
override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)
}
```
and this my commit:
```
func tableView(tableVie... | 2015/07/28 | [
"https://Stackoverflow.com/questions/31684372",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3686341/"
] | I solved this problem by using following code in settings.gradle
```
include ‘:project2', ‘dev:project1'
project(':project1').projectDir = new File(settingsDir, ‘../../../project1’)
```
build.gradle
```
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':project1')
}
``` | Assuming that you have the `settings.gradle` file placed at root folder:
`include ':dev:project1', ':dev:android:apps:project2'` |
14,543,363 | I have a c++ library that provides an object with complicated logic. During data processing, this object outputs lots of things to std::cout (this is hardcoded now). I would like the processing output not to go to standard output but to a custm widget (some text displaying). I tried to create a `std::ostream` class mem... | 2013/01/27 | [
"https://Stackoverflow.com/questions/14543363",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/769384/"
] | You've got two options here:
* Use references, or
* Use pointers
You can't use normal instances because `ostream` is non-copyable.
**Using references (direct reference to an already-instantiated `ostream`)**
```
class PVirtualMachine {
private:
std::ostream & output;
[...]
public:
PVirtualMachine(st... | I would actually use an ostream instance in the module I might want to debug. Note that there is no default constructor for this type, you have to pass a pointer to a streambuffer, but that pointer can be null. Now, when/if you want to capture the module's output, you just attach a streambuffer to it using `rdbuf()`. T... |
19,734 | Today I was investigating an issue with a Microsoft DLL, `mscordacwks.dll`, which is part of the .NET framework. I've seen it many times before and it always was a regular PE file, meaning that it started with the magic `MZ`.
However, the file today starts with `DCD` in ASCII. I could only find a reference to ELF bina... | 2018/10/26 | [
"https://reverseengineering.stackexchange.com/questions/19734",
"https://reverseengineering.stackexchange.com",
"https://reverseengineering.stackexchange.com/users/3355/"
] | Looks like these files use a variation of the delta compression format ([MSDelta](https://msdn.microsoft.com/en-us/library/bb417345.aspx)) used previously for the Windows Update packages.
I found [a project](https://github.com/hfiref0x/SXSEXP) which claims to decompress such files:
>
> Supported file types
> ======... | These file are created using PatchAPI and MSDelta API:
[Link to MSDN article on subject](https://docs.microsoft.com/en-us/windows/win32/devnotes/msdelta) |
38,100 | I understand that some people who speak Inuktitut self-designate as "Inuit" which allegedly means "people", or "human beings" or something similar. I've heard the same about people who are described with the exonym "Shoshone" calling themselves "newe" (or a similar term), which is supposed to mean "humans" or "people".... | 2021/01/19 | [
"https://linguistics.stackexchange.com/questions/38100",
"https://linguistics.stackexchange.com",
"https://linguistics.stackexchange.com/users/31554/"
] | From the perspective of linguistics, the question is meaningless though well-intentioned. "Word" is not a well-defined technical concept in linguistics (or, some people may have concocted a definition of "word" for their purposes, but there isn't even a widely-believed definition). The best definition is "a maximal str... | There are double leş-tir suffix in muvaffakiyetsizleştiricileştir- so it is non-sense. If you want you may add more suffixes like this to any word and you may reach a gibberish string sounds like Turkish. |
57,529,346 | I have a 3 box Solr cloud setup with ZooKeeper, each server has a Solr and ZK install (not perfect I know). Everything was working fine until a network outage this morning.
Post outage boxes A and C came back as expected. Box B did not, a restart of the Solr service revealed an error which states
`A previous ephemer... | 2019/08/16 | [
"https://Stackoverflow.com/questions/57529346",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10287010/"
] | My guess is that you might want to design an expression, maybe similar to:
```
:\s*(?:[^;\r\n]*;)?\s*(.*)$
```
### [Demo](https://regex101.com/r/zPO6FW/1/) | One option is to use an [alternation](https://www.regular-expressions.info/alternation.html) to first check if the string has no `;` If there is none, then match until the first `:` and capture the rest in group 1.
In the case that there a `;` match until the first semicolon and capture the rest in group 1.
For the l... |
41,716,125 | How to set minimum date in **bootstrap datetimepicker 2.0**. In 4.0 we can use `minDate` is there any way to set this in version 2.0 | 2017/01/18 | [
"https://Stackoverflow.com/questions/41716125",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5434280/"
] | Because the OP said it was an AngularJS datepicker and I never had any contact with Angular, myself not being a front-end guy, I wanted to learn something and now I am sharing it with you, for whatever it is worth.
Here is a Geb test which does not use any JS, but gathers information from and interacts with the Angula... | Use following code to resolve the issue:
```java
js.exec(
"document.getElementsByClassName('ui-form-control ng-isolate-scope')[0]" +
".removeAttribute('readonly')"
)
``` |
705,435 | I'm trying to look for something that I'm not used to. My search is related to Tidal forces and the purpose is: making a qualitative explanation (@ High School level) of this phenomenon, using daily life situations to "build the model in my students' mind". One idea one could come across is: fishing schedules at differ... | 2022/04/25 | [
"https://physics.stackexchange.com/questions/705435",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/240433/"
] | I like the second diagram. The downward force is the weight of the car (from gravity). (That can be broken into components; one backwards and one perpendicular to the road. The normal force (up and to the left is from the road reacting to the perpendicular component of gravity. The backward force (from friction with th... | At the level you are asking about the system that you are considering (the car) should be treated as a point mass at the centre of mass of the car.
After all in a real car there are two (four) normal forces, all not necessarily equal, and the same number of frictional forces which are not shown separately.
So the f... |
355,833 | I have been searching for a simple way to convert a dataset from a [PostgreSQL](http://en.wikipedia.org/wiki/PostgreSQL) database to JSON for use in a project that I am building.
This is my first time using JSON, and I have found it really tricky to find a simple way of doing this. I have been using a StringBuilder at... | 2008/12/10 | [
"https://Stackoverflow.com/questions/355833",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | For others looking at this topic:
Here is the simplest way to convert a dataset to a JSON array as `json_encode` ([PHP](http://php.net/manual/en/function.json-encode.php)) does with ASP.Net:
```
using Newtonsoft.Json;
public static string ds2json(DataSet ds) {
return JsonConvert.SerializeObject(ds, Formatting.In... | Maybe you've heard about the [system.runtime.serialization.json](http://msdn.microsoft.com/en-us/library/system.runtime.serialization.json.aspx) namespace in the newly announced [*.NET Framework 4.0*](http://www.microsoft.com/net/dublin.aspx). |
2,570,131 | I'm kind of lost as to how to do this:
I have some chained select boxes, with one select box per view. Each choice should be saved so that a query is built up. At the end, the query should be run.
But how do you share state in django? I can pass from view to template, but not template to view and not view to view. Or... | 2010/04/03 | [
"https://Stackoverflow.com/questions/2570131",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/283857/"
] | There's a couple ways you could go about this, the first has already been mentioned by spudd86 (except you need to use `GL_PIXEL_PACK_BUFFER`, that's the one that's written to by `glReadPixels`).
The other is to use a framebuffer object and then read from its texture in your vertex shader, mapping from a vertex id (th... | The specification for [GL\_pixel\_buffer\_object](http://www.opengl.org/registry/specs/ARB/pixel_buffer_object.txt) gives an example demonstrating how to render to a vertex array under "Usage Examples".
The following extensions are helpful for solving this problem:
[GL\_texture\_float](http://www.opengl.org/registry/... |
3,770,927 | When I run the conversion in the browser it simply shows the white blank space. Only after the conversion process page will load.
Please suggest how to implement a progress bar which shows the progress to the user when the video conversion takes place.
I have this in my php script
```
exec("ffmpeg -i filename.flv -s... | 2010/09/22 | [
"https://Stackoverflow.com/questions/3770927",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/434111/"
] | If you're using PHP-FFMpeg, they've added an on function that you can listen for progress and execute a call back with. You set it up on your video format container like so:
```
$format = new Format\Video\X264();
$format->on('progress', function ($video, $format, $percentage) {
echo "$percentage % transcoded";
});... | I don't believe this is possible.
The problem is that you need your `PHP` script to be aware of the current `ffmpeg` processing status. If you do an `ffmpeg` conversion via the command line, it displays the progress to the user, but you don't have access to that output stream when you spawn `ffmpeg` using commands in ... |
1,705,530 | We have to show that $$ n^4 -n^2 $$ is divisible by 3 and 4 by mathematical induction
Proving the first case is easy however I do not know how what to do in the inductive step.
Thank you. | 2016/03/20 | [
"https://math.stackexchange.com/questions/1705530",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/315166/"
] | Since $a\_n=n^4-n^2=n^2(n-1)(n+1)$, we can also write
$$
a\_{n+1}=(n+1)^4-(n+1)^2=(n+1)^2n(n+2)
$$
Suppose $a\_n=n^4-n^2$ is divisible by $3$; then $3$ divides one among $n$, $n-1$ and $n+1$. Since $n$ and $n+1$ appear in the decomposition of $a\_{n+1}$. The only remaining case is when $3$ divides $n-1$; but in this ca... | Let's prove that
if $n^4-n^2$ is a multiple of both $3$ and $4$,
then so is $(n+1)^4-(n+1)^2$.
Consider
$
((n+1)^4-(n+1)^2)-(n^4-n^2)=4 n^3+6 n^2+2 n
$.
Ignoring $6n^2$, we have $4 n^3+2 n=3n^3+3n+n^3-n=3n^3+3n+6\binom{n+1}{3}$, which is always a multiple of $3$.
Ignoring $4n^3$, we have
$6 n^2+2 n=4n^2+2n(n+1)=4n^... |
1,947,031 | The year 2009 is coming to an end, and with the economy and all, we'll save our money and instead of buying expensive fireworks, we'll celebrate in ASCII art this year.
The challenge
-------------
Given a set of fireworks and a time, take a picture of the firework at that very time and draw it to the console.
The be... | 2009/12/22 | [
"https://Stackoverflow.com/questions/1947031",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/115866/"
] | Heres my solution in Python:
```
c = [(628, 6, 6, 3, 33),
(586, 7, 11, 11, 23),
(185, -1, 17, 24, 28),
(189, 14, 10, 50, 83),
(180, 7, 5, 70, 77),
(538, -7, 7, 70, 105),
(510, -11, 19, 71, 106),
(220, -9, 7, 77, 100),
(136, 4, 14, 80, 91),
(337, -13, 20, 106, 128)]
t=input()
z=' '
s... | **C:**
With all unnecessary whitespace removed (632 bytes excluding the fireworks declaration):
```
#define N 10
int F[][5]={628,6,6,3,33,586,7,11,11,23,185,-1,17,24,28,189,14,10,50,83,180,7,5,70,77,538,-7,7,70,105,510,-11,19,71,106,220,-9,7,77,100,136,4,14,80,91,337,-13,20,106,128};
#define G F[i]
#define R P[p]
g(x... |
33,359,694 | I have following html
```
<p contenteditable>The greatest p tag of all p tags all the time</p>
```
and this js
```
var p = document.querySelector('p');
p.addEventListner('keypress', function (e) {
if (e.which === 13) {
//this.focusout() ??;
}
});
```
**[DEMO](https://jsfiddle.net/sameerachathuran... | 2015/10/27 | [
"https://Stackoverflow.com/questions/33359694",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2094106/"
] | I think the correct method for this is `.blur()`
So the following should suffice:
```
var p = document.querySelector('p');
p.addEventListener('keypress', function (e) { // you spelt addEventListener wrongly
if (e.which === 13) {
e.preventDefault();// to prevent the default enter functionality
thi... | You can use the `onblur` or `onfocusout` event:
```
<p onblur="myFunction()" contenteditable>
The greatest p tag of all p tags all the time
</p>
```
or
```
<p onfocusout="myFunction()" contenteditable>
The greatest p tag of all p tags all the time
</p>
``` |
60,918,029 | I need help resolving a problem with my code.
I want to get the score that's in the score id, and use it in an if condition wherein I will determine their grade rank.
I shouldn't be typing a value in p tag
Below is the code specific to the problem - All the ones that are needed should be below.
Thank you for the h... | 2020/03/29 | [
"https://Stackoverflow.com/questions/60918029",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13082803/"
] | SafeArgs don't support cross-module navigation
<https://developer.android.com/guide/navigation/navigation-multi-module>
---
**Update:**
You need to use the [deep link](https://developer.android.com/guide/navigation/navigation-navigate#uri) instead: <https://developer.android.com/guide/navigation/navigation-multi-mod... | you must add
```
id "kotlin-kapt"
id "androidx.navigation.safeargs.kotlin"
```
into your `plugins { ... }` body of your modules
or, with old approache
```
apply plugin "kotlin-kapt"
apply plugin "androidx.navigation.safeargs.kotlin"
```
Don't forget to make `Rebuild Project` after `Gradle Sync` |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.