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 |
|---|---|---|---|---|---|
31,860 | To force myself and collaborators to only use AMS-Math commands, I load this package in the preamble:
```
\usepackage[all,warning]{onlyamsmath}
```
However, when this is combined with `TikZ`, I get into trouble when using TikZ's calc library, as this involves using `$` for computations. How can I resolve this confli... | 2011/10/17 | [
"https://tex.stackexchange.com/questions/31860",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/1183/"
] | You could adjust the catcode of the `$` within the `tikzpicture` environment as follows:
```
\documentclass{article}
\usepackage[all,warning]{onlyamsmath}
\usepackage{tikz}
\usetikzlibrary{calc}
\makeatletter
\let\@@tikzpicture\tikzpicture
\def\tikzpicture{\catcode`\$=3 \@@tikzpicture}
\makeatother
\begin{document}
... | The `$$` protection from `onlyamsmath` makes lots of problems, not only with `tikz` (see e.g. this [question](https://tex.stackexchange.com/questions/59984/use-mathematical-equation-in-caption-with-onlyamsmath)).
To disable this incompatible feature, but not the other protections from `onlyamsmath`, add to your preambl... |
504,358 | Hello and thank you for any help.
I have a Lenovo Yoga 11s and I wanted to try out using Ubuntu on it. I have used Linux a little bit in the past, but I would still consider myself a complete novice at it.
I went through the process of making the bootable USB drive and also made a separate partition for me to insta... | 2014/07/29 | [
"https://askubuntu.com/questions/504358",
"https://askubuntu.com",
"https://askubuntu.com/users/310436/"
] | Credit to kraxor's comment on the original question:
You should try reinstalling `iptables` by executing the following command:
```
sudo apt-get --reinstall install iptables
``` | Use following command:
```
sudo apt-get update
sudo apt-get install iptables-persistent
```
and it will install the `iptables-persistent` package for you. |
44,210,656 | I would like to install the modules 'mutagen' and 'gTTS' for my code, but I want to have it so it will install the modules on every computer that doesn't have them, but it won't try to install them if they're already installed. I currently have:
```
def install(package):
pip.main(['install', package])
install('mu... | 2017/05/26 | [
"https://Stackoverflow.com/questions/44210656",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7781906/"
] | you can use simple try/except:
```py
try:
import mutagen
print("module 'mutagen' is installed")
except ModuleNotFoundError:
print("module 'mutagen' is not installed")
# or
install("mutagen") # the install function from the question
``` | If you would like to preview if a specific package (or some) are installed or not maybe you can use the idle in python.
Specifically :
1. Open IDLE
2. Browse to File > Open Module > Some Module
3. IDLE will either display the module or will prompt an error message.
Above is tested with python 3.9.0 |
4,603,859 | I have this Dispose method I want to change. (Yeah I should check every object for null, I know)
```
protected override void Dispose(bool disposing)
{
if( disposing )
{
if( monthLineBrush != null)
monthLineBrush.Dispose();
monthHeaderLineBrush.Dispose();
... | 2011/01/05 | [
"https://Stackoverflow.com/questions/4603859",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/171953/"
] | **The code to add each object that is created to the `components` container is automatically generated and added to the `*.Designer.cs` file associated with each form by the designer.**
For example, the `Form1.Designer.cs` file might look something like this in a brand new, empty project once you've added a `ToolTip` ... | For who cares, I just added a "DisposeIfNotNull" method. Writing my own IContainer seems overkill, since I'll then too will have to manually add the objects to the container ...
```
protected override void Dispose(bool disposing)
{
if( disposing )
{
DisposeIfNotNull(monthLineBrush);... |
2,445,874 | I am getting an error in an ajax call from jQuery.
Here is my jQuery function:
```
function DeleteItem(RecordId, UId, XmlName, ItemType, UserProfileId) {
var obj = {
RecordId: RecordId,
UserId: UId,
UserProfileId: UserProfileId,
ItemType: ItemType,
FileName: XmlName
};
... | 2010/03/15 | [
"https://Stackoverflow.com/questions/2445874",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/207817/"
] | Using
```
data : JSON.stringify(obj)
```
in the above situation would have worked I believe.
Note: You should add json2.js library all browsers don't support that JSON object (IE7-)
[Difference between json.js and json2.js](https://stackoverflow.com/questions/552135/difference-between-json-js-and-json2-js) | If manually formatting JSON, there is a very handy validator here: [jsonlint.com](http://jsonlint.com/)
Use double quotes instead of single quotes:
### Invalid:
```
{
'project': 'a2ab6ef4-1a8c-40cd-b561-2112b6baffd6',
'franchise': '110bcca5-cc74-416a-9e2a-f90a8c5f63a0'
}
```
### Valid:
```
{
"project"... |
29,395,873 | I have an assignment and I cannot figure out this part.
The assignment requires that I create two separate functions and call them in the main. So my question is what is the syntax for calling a pointer to an array and how do I call that function in the main program? For example,
```
int function_1(int x, *array);
... | 2015/04/01 | [
"https://Stackoverflow.com/questions/29395873",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4598281/"
] | ```
int function(int x, char *array)
{
//do some work
return 0;
}
```
And in main
```
int main()
{
char arr[5] = {'a', 'b', 'c', 'd'};
int x = 5;
function(x, &arr[0]);
return 0;
}
``` | Interestingly enough, arrays are already pointers in C. So if you want to pass an array as a pointer to your function, you just simply pass the array you declared! I gave a little example below, although, I don't know what your code is supposed to do. I passed `function_1(...)` the number 12, and then the array pointer... |
402,246 | When in shell (bash) - I want to have Ctrl-Backspace binded to "delete word backward". Is it possible?
**Edit**:
I'm using `konsole` - terminal at KDE. | 2012/03/17 | [
"https://superuser.com/questions/402246",
"https://superuser.com",
"https://superuser.com/users/84963/"
] | I found this thread via google, but the answer wasn't what I wanted to hear.
So I played around:
On my terminal, normal backspace sends `^H`, while ctrl+backspace sends `^?`.
So it should simple be a case of rebinding `^?` to delete a word, which by default is available via Ctrl+W.
### First (unsuccessful try):
```
... | There are some good answers here, but I solved it in Konsole with Settings->Edit Current Profile->Keyboard->Edit, then adding a mapping from `Backspace+Control` to `\x17`. (I found the ASCII code for Ctrl-w using `showkey --ascii`.) |
6,001,464 | I have a three different folders (css, js, images)placed where the system, application, user\_guide folders live.. Now I am trying to include those files in my header\_view.php like below:
```
<link rel="stylesheet" href="<?php echo base_url()?>/css/styles.css" type="text/css" media="screen">
<link rel="stylesheet" h... | 2011/05/14 | [
"https://Stackoverflow.com/questions/6001464",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/684972/"
] | In ios UITableView you can only have one column/cell. If you want more propertyes, in a same cell you need to create a custom table view cell by subcalssing UITableViewCell. In interface builder you can customize the layout. TUTORIAL: <http://adeem.me/blog/2009/05/30/iphone-sdk-tutorial-part-6-creating-custom-uitablevi... | In iOS6 you can use the [UICollectionView](http://developer.apple.com/library/ios/#documentation/uikit/reference/UICollectionView_class/Reference/Reference.html).
If you need iOS5 support [AQGridView](https://github.com/AlanQuatermain/AQGridView) is a grid control that will give you what you are after. |
48,794,897 | In MySQL, it is fairly easy to find the number of records that exist within some time interval.
```
SELECT COUNT(*) FROM records WHERE create_date > '2018-01-01 01:15:00' AND create_date < '2018-01-01 02:15:00'
```
But I want to do the opposite, sort of. Rather than providing a time interval and getting a count of r... | 2018/02/14 | [
"https://Stackoverflow.com/questions/48794897",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/446738/"
] | The kotlinx.coroutines library actually makes use of multiplatform projects since it supports both the JVM and JS compilation targets.
You can find the common module [here](https://github.com/Kotlin/kotlinx.coroutines/tree/master/kotlinx-coroutines-core/common), and the specific `expect` declarations for the function... | While the source code in the other answer helped, I found [this page](https://kotlinlang.org/docs/multiplatform-connect-to-apis.html) (linked off of the page @jim-andreas mentioned in the comments above) was much more helpful.
Specifically, this passage:
>
> If you're developing a multiplatform application that need... |
5,176 | Some of my larger annealer embeddings (~200 qubits) don't anneal down to the ground state while some of them do very easily.
Are there established guidelines for designing annealer embeddings to ensure that ground state configurations can be easily found? If so, where can this information be found?
If not, is addres... | 2019/01/11 | [
"https://quantumcomputing.stackexchange.com/questions/5176",
"https://quantumcomputing.stackexchange.com",
"https://quantumcomputing.stackexchange.com/users/4943/"
] | A necessary and sufficient condition is that, given an $n\times n$ matrix $M$, you can construct a $2n\times 2n$ unitary matrix $U$ provided the singular values of $M$ are all upper bounded by 1.
Sufficiency
===========
To see this, express the singular value decomposition of $M$ as
$$
M=RDV
$$
where $D$ is diagonal ... | Here's a solution that follows a slightly different idea, but provides the precise number of rows that need to be added to get a unitary matrix.
Let $M$ be an arbitrary $n\times m$ matrix. As a first observation, note that the task of adding rows/columns can be reduced to that of adding rows to get $m$ orthonormal col... |
29,625,693 | I am accessing my database using model by using following code.
```
$persons = WysPerson::where('family_id', $id)->get();
```
I checked `$persons`is empty or not by using following code.
```
if($persons){
var_dump($persons);
}
```
Actually `$persons` is empty. But I am getting result for `var_dump` as... | 2015/04/14 | [
"https://Stackoverflow.com/questions/29625693",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3659972/"
] | try this.
```
is_null($var)?abort('empty'):abort('filled')
``` | You can use isEmpty() method.
At the same time you can check it by simply with count() method before once you fetch the data.
```
$count = WysPerson::where('family_id', $id)->count();
if($count==0){
return redirect()->back()->withErrors('Empty Data');
}
$persons = WysPerson::where('family_id'... |
59,242,176 | I have 3 tables
```
Product(id, sku, product_name)
product_sales_forecast_3(id,product_id)
product_sales_forecast_detail_3(id,product_sales_forecast,forecast,year)
```
`forecast` field in table `product_sales_forecast_detail_3` is a JSON,
it looks like:
>
> `{"25":{"qty":0},"26":{"qty":0},"27":{"qty":0},"28":{"q... | 2019/12/09 | [
"https://Stackoverflow.com/questions/59242176",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8577943/"
] | **Try this ...**
```
<?php
$objs = '{
"forecast":
{
"1":{"qty":145}
,"2":{"qty":0}
,"3":{"qty":0}
,"4":{"qty":0}
,"5":{"qty":0}
,"6":{"qty":0}
,"7":{"qty":58}
,"8":{"qty":69}
,"9":{"qty":74}
,"10":{"qty":97}
,"11":{"qty... | **Change in your controller like ...**
```
$DataForecasts=DB::table('product_sales_forecast_3')
->join('product_sales_forecast_detail_3','product_sales_forecast_3.id',
"=",'product_sales_forecast_detail_3.product_sales_forecast_id')
->join('products','products.id','=','product_sales_forecast_3.product_id')
->select('p... |
21,703,547 | I've a little problem.
I use modrewrite to load language-content dynamically into webpage...
example:
www.mydomain.xyz/en (the english version)
www.mydomain.xyz/fr (the french version)
...
My .htaccess:
```
RewriteRule ^en$ index.html?lang=en
```
But:
*www.mydomain.xyz/en?foo=bar*
and
```
<?php
if(isset($_GE... | 2014/02/11 | [
"https://Stackoverflow.com/questions/21703547",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1736442/"
] | Use `QSA` flag:
```
RewriteRule ^en$ index.html?lang=en [L,QSA]
```
To make this work for en and fr use this:
```
RewriteRule ^(en|fr)/?$ index.html?lang=$1 [L,QSA]
```
* `QSA` (Query String Append) flag preserves existing query parameters while adding a new one. | You need the `[QSA]` instruction right after your rewrite rule
<http://httpd.apache.org/docs/current/mod/mod_rewrite.html>
QSA is "query string append" and preserves query strings on rewrite
I'd also recomment using (/|$) instead of just $, or calling `yourdomain.com/ensomefile.php` would also result in rewriting
`... |
27,746,819 | I am trying to install and run a CakePHP 3.0 project on a shared host.
However, CakePHP 3.0 requires `php-intl` extension, but the hosting provider has denied me to install/enable `intl` extension on the shared hosting.
How can I run CakePHP 3.0 without `intl` extension ?
Is there anyway to disable it in CakePHP?... | 2015/01/02 | [
"https://Stackoverflow.com/questions/27746819",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2143117/"
] | In both XAMPP and WAMP, mcrypt and mbstring extensions are working by default.
In XAMPP, intl extension is included but you have to uncomment extension=php\_intl.dll in php.ini and restart the server through the XAMPP Control Panel.
In WAMP, the intl extension is “activated” by default but not working. To make it wor... | Just open php.ini file and look around below this line:
**[ExtensionList]**
You must see this line: **extension=php\_intl.dll**. if not, please add it :) |
5,893,392 | In short, when the property value changing, I have to update some logic in my code, for example:
```
- (void)setProp:(NSString *)theProp
{
if (prop != theProp){
[prop release];
prop = [theProp copy];
[self myLogic];
}
}
```
or:
```
- (void)observeValueForKeyPath:(NSString *)keyPath
... | 2011/05/05 | [
"https://Stackoverflow.com/questions/5893392",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/395213/"
] | Tough call, IMHO both options suck.
The first one forces you to write your own setter, which is a lot of boilerplate code. (Not to mention that you have to remember to also fire KVO notifications with `willChangeValueForKey:` and `didChangeValueForKey:` if you want KVO for the property in question to work.)
The secon... | In your case the best option is to add the logic inside the setter. Your setter implementation is correct if your property declaration is something like
@property (nonatomic, copy) YCYourClass \*prop;
KVO is used normally when checking for changes on external objects properties.
NSNotifications are better suited to ... |
1,578,070 | I'm making this tiny utility program (Windows Forms) and it would need to save a bit of data to the disk. In DB terms it would be about one table, no more than about couple thousand rows, each row being less then 1KB in size.
What would you use?
**Added:** Forgot to say - it would be really neat if the whole program ... | 2009/10/16 | [
"https://Stackoverflow.com/questions/1578070",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41360/"
] | You can create an array of your class, mark it [Serializable] and just use the built-in serialize/deserialize methods for persistence. | [Berkeley DB](http://en.wikipedia.org/wiki/Berkeley_DB) is also a good choice for embedded database. And there is a [library](http://sourceforge.net/projects/libdb-dotnet/) that provides a .NET 2.0 interface for it. |
2,726,195 | I have the equation: $$z^4 + 8z^3 + 16z^2 + 9 = 0$$
I need to find all the complex solutions and I've got no clue how to approach it. I've tried factoring but nothing came out of it. I'm still very new to the world of complex numbers so I'll appreciate any help. | 2018/04/07 | [
"https://math.stackexchange.com/questions/2726195",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/549828/"
] | If you substitute $$x=z+2$$ the equation turns into $$x^4-8x^2+25=0$$ which can be solved by a further substitution $y=x^2$ | $$z^2(z+4)^2 =9i^2$$
so $$z^2+4z-3i=0\;\;\;\;{\rm or}\;\;\;\;z^2+4z+3i=0$$
You have a discriminant $D = 2(3+i)^2$ in the first case and $D = 2(3-i)^2$ in the second case. |
18,407,860 | I recently typed out this java program to accept ten areas and their pin-codes and then search to find a particular area and print out it's pin-code.
Here's the code from the program :
```
import java.util.Scanner;
public class Sal {
public static void main (String args []){
Scanner s=new Scanner(System... | 2013/08/23 | [
"https://Stackoverflow.com/questions/18407860",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2711784/"
] | From the docs for [`Scanner#nextInt()`](http://docs.oracle.com/javase/7/docs/api/java/util/Scanner.html#nextInt%28%29):
>
> InputMismatchException - if the next token does not match the Integer regular expression, or is out of range
>
>
>
So, it sounds like your `Scanner` is trying to read in an `int` but getting... | The input can not be parsed as an integer.
Maybe you have a comma at the end of line.
btw:
>
> if(search==area[j])
>
>
>
is bad practice to check string equality. use search.equals(area[j]) with null-check. |
47,094 | I am using the Earth-Sun distance to teach kids the usefulness of trigonometry. [This site](http://www.eso.org/public/outreach/eduoff/aol/market/collaboration/solpar/) is helpful.
But one of the more engaged asked what the most accurate measurement is. After some research, I found that elapsed time measurements of ref... | 2021/10/17 | [
"https://astronomy.stackexchange.com/questions/47094",
"https://astronomy.stackexchange.com",
"https://astronomy.stackexchange.com/users/33853/"
] | As mentioned in a comment, the AU is no longer measured, it is defined, as 149 597 870 700 metres, or exactly the distance that light travels in a vacuum in $499 \frac{9823}{2053373}$seconds.
But I suppose your question is about the accuracy of the measurement of the distance between the Earth and Sun.
As noted in th... | As Wikipedia says, the [Astronomical unit](https://en.wikipedia.org/wiki/Astronomical_unit) is "*roughly* the distance from Earth to the Sun".
>
> The astronomical unit was originally conceived as the average of Earth's aphelion and perihelion; however, since 2012 it has been defined as exactly $149\,597\,870\,700$ ... |
2,018,480 | I'm looking for a function to dump variables and objects, with human readable explanations of their data types. For instance, in php `var_dump` does this.
```
$foo = array();
$foo[] = 1;
$foo['moo'] = 2;
var_dump($foo);
```
Yields:
```
array(2) {
[0]=>
int(1)
["moo"]=>
int(2)
}
``` | 2010/01/07 | [
"https://Stackoverflow.com/questions/2018480",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/245292/"
] | Check out the `dump` command:
```
> x <- c(8,6,7,5,3,0,9)
> dump("x", "")
x <-
c(8, 6, 7, 5, 3, 0, 9)
``` | I think you want 'str' which tells you the structure of an r object. |
80,638 | Any feedback is welcome. I'm new to puzzling in general so please let me know how long it took you to come up with your answer and what your thoughts were. I have tough skin.
**Hint**
>
> There's two parts here, If you're struggling then solve it bit by bit.
>
>
>
**Hint 2**
>
> There should be 10 symbols at... | 2019/03/13 | [
"https://puzzling.stackexchange.com/questions/80638",
"https://puzzling.stackexchange.com",
"https://puzzling.stackexchange.com/users/9810/"
] | I don't get it yet, but this is my first attempt on this puzzle.
>
> Code is based on Webdings and Wingdings. Therefore, the top part is saying:
>
>
>
>
> SQR [CRACK/MISSING?] PU [SPACE][SPACE] 7A
>
>
>
Door 1
>
> R (C/P/O?)
>
>
>
Door 2
>
> LR
>
>
>
Door 3
>
> QR
>
>
>
Door 4
>
... | Not a full answer but an initial thought.
I hope that the answer includes
>
> Magic Eye
>
>
>
Because then you could
>
> Make the 4 doors into 5 to match the 10 symbols up top with the pattern involving superposition of door symbols on top of each other.
>
>
> |
59,625,685 | For a class project, my groupmates and I are to code a tic tac toe program. So far, this is what we have. All of us have 0 experience in python and this is our first time actually coding in python.
```
import random
import colorama
from colorama import Fore, Style
print(Fore.LIGHTWHITE_EX + "Tic Tac Toe - Below is t... | 2020/01/07 | [
"https://Stackoverflow.com/questions/59625685",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12262043/"
] | I have changed your code in such a way that first of all "save players choices" and in second "check if a player won and break the loop":
```
import random
import colorama
from colorama import Fore, Style
print(Fore.LIGHTWHITE_EX + "Tic Tac Toe - Below is the key to the board.")
Style.RESET_ALL
player_1_pick = "... | Firstly, you need a condition which doesn't allow the same space to be allocated twice, when test running I could type space 3 as much as I wanted for example without it stopping me. You need some sort of check for this.
Secondly, for the actual win system, you made it easy because you already have the co-ordinates fo... |
11,873,265 | Would anyone know why my submit button wouldn't call javascript to verify if certain fields are populated in the form?
To have better idea I have provided a link to the website: <http://www.flyingcowproduction.com/pls> and click on the button "reservation" from the top menu.
Form:
```
<form method="post" action="pro... | 2012/08/08 | [
"https://Stackoverflow.com/questions/11873265",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1399599/"
] | Your function is fine and is getting called if one uses your provided html above. But the site you gave link of shows this
```
<input type="submit" value="MAKE RESERVATION" id="FormId">
```
see that id="FormId" it should be "submit"
Ok now please try this
1) Make sure you backup things
2) Remove the validation fun... | In your click event handler you'll probably want to prevent the default action of the click which is submitting the form before your code runs.
```
$('#submit').click(function(e) {
e.preventDefault();
...
});
```
However, I'd do what Laurent said and bind on the form submit instead. |
11,172,827 | I have a UITableView with static cells and I am trying to change the height of the cell when it meets a condition. The conditions are being met but the cell heights won't change.
The code I am using is
```
[self.tableView setRowHeight:10];
```
And
```
self.tableView rowHeight = 10;
```
Neither of these will ch... | 2012/06/23 | [
"https://Stackoverflow.com/questions/11172827",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1282180/"
] | you can use this for all row of tableview
```
override func tableView(tableView: UITableView, estimatedHeightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
return 100
}
``` | You Can create the dynamic cell with Text height then you can set the static and dynamic cell both in on table view
Here is link to dynamic cell with text
[How to change cell height dynamically in UITableView static cell](https://stackoverflow.com/questions/25420980/how-to-change-cell-height-dynamically-in-uitableview... |
4,008,598 | I want to connect to a mongodb database using excel macros, does anybody knows how to acomplish this task? | 2010/10/24 | [
"https://Stackoverflow.com/questions/4008598",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/270494/"
] | My own solution was to let Python glue them together using pymongo and win32com. It's then fairly straightforward to run whatever you want. In my case I have the Python loop simply continuously "listen" to certain Excel cells, call what it needs from Mongo, then put it back into Excel. It's flexible and many things can... | They say there is a 3rd party Mongodb COM driver around:
<http://na-s.jp/MongoCOM/index.en.html>
After installing and referencing it, you can run queries like
```
Dim oConn
Dim oCursor,o
Set oConn = oMng.NewScopedDBConnection( cHostAndPort )
Set oCursor = oConn.Query( "ec.member", oM... |
44,749,992 | I am using Socket.io to create a simple application. To test if the client side and the server side are working correctly I use `socket.emit` to send message to the server and `socket.on` to write the message on the server console.
Now, I have been able to connect the client side to the server side by writing somethi... | 2017/06/25 | [
"https://Stackoverflow.com/questions/44749992",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2595059/"
] | You can use an intermediate variable to hold the value of one.
```
var a = 1
var b = 2
var c = a
a = b
b = c
```
You can use a method shown in this link [here](https://stackoverflow.com/a/16201730/4216035) but in my opinion is not very readable. | ```
let foo = {
example: '2',
anotherExample: '1'
};
let anotherFoo = 'orange';
```
First, use a dummy variable to store the original value of one variable:
```
const dummy = anotherFoo;
```
Then, overwrite that variable with the original value of the second variable:
```
anotherFoo = Object.assign({}, foo);... |
5,437,806 | >
> **Possible Duplicate:**
>
> [Simulating a BlueScreen](https://stackoverflow.com/questions/667581/simulating-a-bluescreen)
>
>
>
Hello SO,
I'm trying to induce a BSOD somehow inline in my C code. My main background is Java but have been fortunate to have been tutored by some coworkers and am helping out wi... | 2011/03/25 | [
"https://Stackoverflow.com/questions/5437806",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/584947/"
] | Your best bet is to write a trivial driver that calls [`KeBugCheck()`](http://msdn.microsoft.com/en-us/library/ff551948.aspx) as you yourself suggest. You can take the most simple example from the [Windows Driver Kit](http://msdn.microsoft.com/en-us/windows/hardware/gg487428.aspx) and cut it down to the barebones. | I recomment [Not My Fault](http://download.sysinternals.com/Files/Notmyfault.zip) from sysinternals. |
1,758,363 | When creating a query with EF, Normally we will create an anonymous type in order to limit the number of columns returned.
But anonymous type cannot be returned or used as a parameter to a method call, which means all work related to that anonymous object should be done inside a single method. This is really bad.
And... | 2009/11/18 | [
"https://Stackoverflow.com/questions/1758363",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/214024/"
] | ```
And certainly, we don't want to create explicit types just to represent a subset of an existing entity.
```
I don't think there is a way to work around it. If you domain model has small set of properties than the EF generated types, then just use LINQ to project the EF model to your domain model. It's actually no... | You can return an anonymous type as `System.Object`, else you have to "create explicit types to represent a subset of an existing entity". What I would do is create a public interface with a subset of the properties of the entity type, and then make the entity type and the subset type both implement it. The subset type... |
1,104,660 | In Carl Sagan's novel *Contact*, the main character (Ellie Arroway) is told by an alien that certain megastructures in the universe were created by an unknown advanced intelligence that left messages embedded inside transcendental numbers. To check this, Arroway writes a program that computes the digits of $\pi$ in sev... | 2015/01/14 | [
"https://math.stackexchange.com/questions/1104660",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/203950/"
] | Let us assume that pi is a normal number (a reasonable, yet unproven conjecture). Then yes, any combination, specifically the one envisioned by Sagan, is buried somewhere deep inside pi. In this sense there is nothing surprising. However, the surprise would be to find it much sooner than expected. That is the main mean... | I think the point is that it's would be a highly unusual finding based on the part of Pi we've seen until now. I don't know how big the pattern was but it was the product of two prime number indicating a structure - lets just say it was 121 numbers long (11x11).
That would mean there was a sequence of 121 number that... |
61,814,929 | I want to migrate my JSF Application from ManagedBean to CDI Beans.
First of all I have done a simple test to see if CDI are working, but they don't.
Here my example, using Wildfly 10 and myfaces 2.2
beans.xml in .\WEB-INF
```
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001... | 2020/05/15 | [
"https://Stackoverflow.com/questions/61814929",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/834035/"
] | The problem is more general.
In JSF 2.3, JSF picks up CDI via BeanManager#getELResolver. In pre JSF 2.3, the container or the CDI impl has to marry JSF and CDI. | I think you need to Declare a @FacesConfig annotated class to activate CDI in JSF 2.3
```
import javax.enterprise.context.ApplicationScoped;
import javax.faces.annotation.FacesConfig;
@FacesConfig
@ApplicationScoped
public class ConfigurationBean {
}
``` |
46,270,606 | I'm trying to calculate the cosine similarity between all the values.
The time for 1000\*20000 calculations cost me more than 10 mins.
Code:
```
from gensim import matutils
# array_A contains 1,000 TF-IDF values
# array_B contains 20,000 TF-IDF values
for x in array_A:
for y in array_B:
matutils.cossim(x,y... | 2017/09/18 | [
"https://Stackoverflow.com/questions/46270606",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8000414/"
] | *O*(*m*√*n*) seems a bit strange to me, but you can get *O*(*m* log *n*) — which is asymptotically even better — by adapting a balanced binary search tree structure (such as a red–black tree) instead of using a literal list.
Specifically, you need a normal binary tree structure, *plus*:
* the nodes have a "subtree-si... | Imagine an indexed doubly-linked list. The index is an array `INDICES` of pointers, pointing at nodes numbered 0, √n, 2√n, ..., (n-1)√n. Each node also stores its own index number `IDX` (first √n nodes always store 0, next √n nodes store 1, ...; the indices get updated with each operation so that to keep this invariant... |
6,788,340 | I have a `Map<String, String>` that I'd like to display to a user but I don't want them to be able to select the field to modify it's value. I've been using a form with textfields and setting setting a property to disable them. This is not ideal as their aesthetics change. Am I doing it the correct way and simply need ... | 2011/07/22 | [
"https://Stackoverflow.com/questions/6788340",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/374265/"
] | You could make a form 'label' which is un-modifiable but looks like the rest of the form. Might need a few tweaks but this should get you started:
```
Ext.form.LabelField = function(config){
Ext.form.LabelField.superclass.constructor.call(this, config);
};
Ext.extend(Ext.form.LabelField, Ext.form.Field, {
isF... | I have had the same need and wanted the field to function similar to the ExtJS displayfield. I have done this in Sencha Touch by creating the field, disabling it, then adding back the normal field class. The editor is removed using the disable : true, but the field isn't grayed out and still is easy to read.
```
{
... |
243,670 | I looted a cybernetic pain inhibitor and cybernetic limb actuator off of Kellogg's body and they are worth quite a bit of caps. I can't tell, however, if they're useful for anything else... like, are they something you can give to Valentine, for instance? Or are they just sellable junk pieces? | 2015/11/16 | [
"https://gaming.stackexchange.com/questions/243670",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/69426/"
] | Pretty sure the post indicating you can have the implants installed by the Institute is a hoax.
I have completed the institute endgame (and non-radiant side quests) and talked to every named NPC in every division (nobody was killed or exiled), none of them mentions the implants when they are in my inventory and no do... | The two cybernetic items not used for the next quest are miscellaneous items and you can sell them if you want. |
221,069 | I would like to remove an existing cable from the breaker panel, that feeds a single home run outlet, and wire it to a consumer UPS that I will locate near the panel, through a junction box.
**Questions**:
1. To join the power cord from the UPS to the junction box can I put a NEMA 5-15 inlet on the box and use a cons... | 2021/03/30 | [
"https://diy.stackexchange.com/questions/221069",
"https://diy.stackexchange.com",
"https://diy.stackexchange.com/users/65210/"
] | Yes.
You can run an isolated electrical line, using normal in-wall wiring methods, from a single inlet to outlets.
The inlet will need to be in the NEMA family. A C13 inlet won't cut it for at least 2 reasons off the top of my head: first it lacks the necessary ampacity, and second it is voltage-agnostic, and the inl... | You could install one of these upstream of the outlet: <https://ezgeneratorswitch.com>
I am not affiliated with them in any way. |
38,027,402 | I'm going through some tutorials on how smart pointers work in **C++**, but I'm stuck on the first one I tried: the *unique pointer*. I'm following guidelines from [wikipedia](https://en.wikipedia.org/wiki/Smart_pointer), [cppreference](http://en.cppreference.com/w/cpp/memory/unique_ptr) and [cplusplus](http://www.cplu... | 2016/06/25 | [
"https://Stackoverflow.com/questions/38027402",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2959880/"
] | Essentially you invoke a member function through a null pointer:
```
int main()
{
SubFig* testing = nullptr;
testing->three();
}
```
... which is undefined behavior.
From 20.8.1 Class template unique\_ptr (N4296)
>
> 4 Additionally, u can, upon request, transfer ownership to another
> unique pointer u2. ... | On calling `std::unique_ptr<int> p3 = std::move(p1);` your original pointer `p1` is in undefined state, as such using it will result in undefined behavior. Simply stated, never ever do it. |
951,473 | Let A be matrix $2\times 2$ and take integer $k \geq 2$. Show that if $A^k = 0$ then we must have that $A^2 = 0$ | 2014/09/29 | [
"https://math.stackexchange.com/questions/951473",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/179403/"
] | Suppose that $A$ has an inverse matrix. Then, multiplying the both sides of
$$A^k=O$$
by $\left(A^{-1}\right)^k$ gives us $I=O$ where $I$ is the identity matrix, which is a contradiction.
Hence, if we set $A=\begin{pmatrix} a&b\\c&d\end{pmatrix}$, then we have $ad-bc=0$. So, by the Cayley–Hamilton theorem, we have
$$A... | Here is a laboured way of explaining a more general case (you have $k=2$). But it relies on more general theory.
Presumably it is a matrix over a field $\mathbb F$. Once a basis is chosen for a vector space $V$ of dimension $k$ over $\mathbb F$, a $k\times k$ matrix $M$ represents a linear map on $V=\mathbb F^k$.
Let... |
3,262,904 | Can anyone solve the matrix equation $A^5=I$ where $I$ is the $2 \times 2$ identity matrix and $A$ is such that $\det(A)$ is non-zero and $A^n \neq I$ for $n \lt 5.$
I have tried to solve it but I do not know how to solve matrix equations.I actually want to find an infinite group in GL(2,R) such that infinitely many e... | 2019/06/15 | [
"https://math.stackexchange.com/questions/3262904",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/-1/"
] | OP indicates that what's wanted is a matrix $A$ with real entries. That means its characteristic polynomial $p(x)$ must be a factor of $(x^5-1)/(x-1)=x^4+x^3+x^2+x+1$ with real coefficients. Letting $z$ stand for $e^{2\pi i/5}$, the zeros of $p(x)$ (which are the eigenvalues of $A$) must be $z$ and $z^{-1}$, or $z^2$ a... | The firdt answer is true. But there is more. The most general is
$$A=S\begin{pmatrix}
\xi^a & 0\\
0 & \xi^b
\end{pmatrix} S^{-1}$$
For any S, and $(a, b)\in\{0, 1, 2, 3, 4\}^2\backslash\{(0,0)\}$ |
107,822 | I installed Mavericks (upgrading from Mountain Lion) on my MacBook Pro (from early 2011) and the install seemed to go fine. However, this morning while I was working on PowerPoint, it switched off with no warning at all (it was connected to AC power and battery was full). Then, it refused to boot. After the spinning ba... | 2013/10/31 | [
"https://apple.stackexchange.com/questions/107822",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/61206/"
] | Most likely a hardware failure. See here: <http://appleinsider.com/articles/13/10/14/apples-2011-macbook-pro-lineup-suffering-from-sporadic-gpu-failures> | I have the same issue as you. It is a GPU failure. I have a solution for that which is I am using.
First reset the PRAM. It will boot with waves on the screen. The screen will go grey with no Apple logo. It will shutdown itself after sometime. Boot now and it will work. Download a software called gfxCardStatus. Change... |
29,782,587 | ```
df <- as.data.frame(cbind(c(1:10), c(15, 70, 29, 64, 57, 29, 10, 80,81, 71)))
V1 V2
1 1 15
2 2 70
3 3 29
4 4 64
5 5 57
6 6 29
7 7 10
8 8 80
9 9 81
10 10 71
cuts <- c(5, 10, 90, 95)
```
I would like to create logical variables for all (in this case, four) cut values `x` (e.g. `P5`, `P10`, `P... | 2015/04/21 | [
"https://Stackoverflow.com/questions/29782587",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/819272/"
] | Surely you don't need dplyr for something this simple.
```
names(cuts) <- paste0("p", cuts)
data.frame(df, lapply(cuts, function(x) df$V2 <= x))
V1 V2 p5 p10 p90 p95
1 1 15 FALSE FALSE TRUE TRUE
2 2 70 FALSE FALSE TRUE TRUE
3 3 29 FALSE FALSE TRUE TRUE
4 4 64 FALSE FALSE TRUE TRUE
5 5 57 FALSE FAL... | If you plan to eventually convert your data to a tidy data, you may simply start with one:
```
library(dplyr)
df <- as.data.frame(cbind(c(1:10), c(15, 70, 29, 64, 57, 29, 10, 80,81, 71)))
cuts <- data_frame(P=c(5, 10, 90, 95))
p_df <- df %>% tidyr::crossing(cuts) %>%
mutate(flag=V2<=P)
p_df
# V1 V2 P flag
#1 ... |
31,632,078 | In my application, I want to check whether or not the server I am connecting to is trustable. Instead of using SSL, which would come with the cost of a certificate , I thought about creating my own identity check, where I would send a random string to the server at connection. The server would rsa encrypt the string wi... | 2015/07/25 | [
"https://Stackoverflow.com/questions/31632078",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4119197/"
] | >
> I want to check whether or not the server I am connecting to is trustable.
>
>
>
Both your approach and the approach with using SSL can not provide any information about how trustable the server is but offer only a way to identify the server, i.e. to make sure that your are talking with the expected server. Th... | I recommend that you use TLS. Over time, mistakes in TLS have been found and fixed. To start with your own design and make the assumption that you could not make similar mistakes is a big risk.
You can create your own server certificate for free, especially if you are embedding the server public key in the client beca... |
4,607,594 | I am working on a LAMP(PHP) stack.
Scenario - I want to redirect the incoming traffic to the site to a different website based on a percentage.
Example : Main www.a.com. I have few other sites - www.a1.com, www.a2.com, www.b1.com, www.b2.com.
Now when the traffic comes to my main site www.a.com, I would like to divi... | 2011/01/05 | [
"https://Stackoverflow.com/questions/4607594",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/351062/"
] | Generate a random number between 1 and 100,
```
0-32 redirected to www.a1.com
33-65% redirected to www.a2.com
66-95% redirected to www.b1.com
96-99% redirected to www.b2.com
```
you can provide these functionalities using your server. Check out those keywords: nginx, round robin. | ```
$route_decider = rand(0, 99);
/**
/* Remember there should not be an output before the header response. Browsers must see HTTP header
/* response first! Upon logout redirect to a page containing this code.
/*
**/
if ( $router_decider >= 0 && $route_decider <= 32) # 33 %
header( 'Location: http://www.a1.com'... |
54,095,476 | I am trying to run my server and have my app.component.html load on localhost:8000. Instead, I am receiving this error
>
> compiler.js:7992 Uncaught Error: Expected 'styles' to be an array of strings.
> at assertArrayOfStrings (compiler.js:7992)
> at >CompileMetadataResolver.push../node\_modules/@angular/compiler/f... | 2019/01/08 | [
"https://Stackoverflow.com/questions/54095476",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10885103/"
] | I had the same console error, spent a few days reading every hit on Google...
Solved!
The story:
I had to add functionality to an existing Angular project. When I performed git clone, ng serve, open browser -> error assert....
I decided to upgrade to Angular 8 and see if the problem goes away, and it didn't. Eventua... | changing scss loader in webpack.config.js fixed it for me.
It should look like this:
```
{
test: /\.scss$/,
exclude: [/node_modules/, /\.global\.scss$/],
use: ["to-string-loader", "css-loader", "sass-loader"]
}
```
and in package json:
```
"to-string-loader": "^1.1.6",
"css-loader": "^3.4.2",
"sass-loader": "... |
6,592,318 | ```
int numbers*;
numbers = malloc ( sizeof(int) * 10 );
```
I want to know how is this dynamic memory allocation, if I can store just 10 `int` items to the memory block ? I could just use the array and store elemets dynamically using index. Why is the above approach better ?
I am new to C, and this is my 2nd day an... | 2011/07/06 | [
"https://Stackoverflow.com/questions/6592318",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/305228/"
] | The main reason why `malloc()` is useful is *not* because the size of the array can be determined at runtime - modern versions of C allow that with normal arrays too. There are two reasons:
* Objects allocated with `malloc()` have flexible lifetimes;
That is, you get runtime control over when to create the object, an... | Array is used to allocate memory statically and in one go.
To allocate memory dynamically malloc is required.
e.g. `int numbers[10];`
This will allocate memory statically and it will be contiguous memory.
If you are not aware of the count of the numbers then use variable like count.
```
int count;
int *numbers;
sca... |
1,866,584 | I have the following classes...
```
public class Order
{
private Guid id;
public Guid ID
{
get { return id; }
set { id = value; }
}
private List<Items> orderItems;
public List<Items> OrderItems
{
get { return orderItems; }
set { orderItems= value; }
}
}... | 2009/12/08 | [
"https://Stackoverflow.com/questions/1866584",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/222614/"
] | Is your application on the client side of a Web service?
If so, the proxy generator for .asmx and WCF Web services generates an array `T[]` on the client side where a service interface uses a `List<T>` (or, indeed, any other enumerated type).
Your application will need to cast the list to an array (use `.ToArray()`) ... | Ignoring typos I would recommend turning your generic list on Order to auto initialize. Then you just always deal with the list directly instead of worrying about initialization when adding items. So something like:
```
public class Order
{
public Guid ID { get; set; }
private List<Item> orderI... |
41,268,419 | I have this html snippet:
```
<form class="job-manager-form" enctype="multipart/form-data">
<fieldset>
<label>Have an account?</label>
<div class="field account-sign-in">
<a class="button" href="">Sign in</a>
</div>
</fieldset>
<!-- Job Information Fields -->
<fieldset class="fieldset-job... | 2016/12/21 | [
"https://Stackoverflow.com/questions/41268419",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1385385/"
] | ```
fieldset:first-child {
background-color: red;
}
```
This will work. However, your first-child fieldset is set to display:none; so it will not actually show the background color. | It selects an element if it is the first child of its parent.
Your selector doesn't select any fieldsets. It selects the form.
The fieldsets have a (default) transparent background, so you can see the red through them.
To select the fieldset that is the first child of a form you would need:
```
form.job-manager-for... |
56,536,422 | I am trying to create two sections, one left and one right, where one of them is a image and the other one is text. They should always be the same width and height and always square. I use the Avada theme on Wordpress and trying to fix this with their Element Builder and custom css. No luck.
Here is a page where the r... | 2019/06/11 | [
"https://Stackoverflow.com/questions/56536422",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2739771/"
] | You Just go through following links then you will get an idea about the aspect ratios and responsive blocks.
[Learn how to maintain the aspect ratio of an element with CSS.](https://www.w3schools.com/howto/howto_css_aspect_ratio.asp)
[Aspect Ratio Boxes Advanced](https://css-tricks.com/aspect-ratio-boxes/)
```
<div... | Thanks for the help!
I ended up to justify the square with media querys every 200 och 300px to keep it close to square. Not a beautiful solution, but a simple one. |
17,372,572 | I'm trying to authenticate using ADAM and LDAP. I really have no experience with this stuff, but I've been thrown in the deep end at work to figure it out.
Here's what I know. I'm using a program called JXplorer to look at the ADAM server, running on a VM on my computer. [Here are the login details](http://tinypic.co... | 2013/06/28 | [
"https://Stackoverflow.com/questions/17372572",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1786580/"
] | Thanks for the thoughts Geoff, I eventually figured it out. It turned out that I needed the connection string not including the OU=Users. The final string ended up being -
LDAP://10.0.0.142:389/DC=TEST,DC=corp
I've no idea why it didn't want the OU=Users. I spend about a day trying all the different combinations un... | It is almost certainly a need for `userName` to be the full DN. ADAM needs a full DN for logins in most cases. |
605 | Depuis quelques jours, le Colonel Kadhafi fait la une des journaux mondiaux. En anglais, c'est orthographié Gadhafi (CNN) ou Gaddafi (BBC) et, dans les pays francophones, par Kadhafi. L'arabe se prononce [ainsi](http://upload.wikimedia.org/wikipedia/commons/8/86/Ar-Muammar_al-Qaddafi.ogg).
Je pense aussi à [Mikhaël ... | 2011/08/26 | [
"https://french.stackexchange.com/questions/605",
"https://french.stackexchange.com",
"https://french.stackexchange.com/users/104/"
] | L'orthographe de noms étrangers a différentes sources:
* une longue tradition (qui peut avoir sa source dans un des points suivants)
* l'orthographe de la langue source
* un approximation phonétique
* un système de translittération (c.-à.-d. une transformation mécanique de l'orthographe étrangère — souvent dans un alp... | Dans le cas de [Pékin](http://fr.wikipedia.org/wiki/P%C3%A9kin), l'ortographe usuelle a été recommandée par une certaine [Commission générale de terminologie et de néologie](http://fr.wikipedia.org/wiki/Commission_g%C3%A9n%C3%A9rale_de_terminologie_et_de_n%C3%A9ologie), et [publiée](http://www.legifrance.gouv.fr/affich... |
42,571,175 | I have updated android studio from 2.2 to 2.3,then I found **Instant run** not working.
>
> Error while executing: am startservice com.example.codingmaster.testcc/com.android.tools.fd.runtime.InstantRunService
> Starting service: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.... | 2017/03/03 | [
"https://Stackoverflow.com/questions/42571175",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6138207/"
] | [](https://i.stack.imgur.com/CLTQo.png)
from 2.3 There is new icon.
[see this.](https://www.youtube.com/watch?v=lpaByLW_ctw) | * Goto File-settings, "Build, Execution, Deployment"
* click on instantRun
* Uncheck Enable instant run Checkbox
* then apply and ok will solve your problem |
63,810,941 | I wrote a python script which is deployed in a EC2 Instance and lets say this EC2 reside in AWS account **A1**. Now my script from **A1** want to access 10 other AWS account.
And remember I don't have any `AWS_ACCESS_KEY` or `SECRET_KEY` of any account cause using `AWS_ACCESS_KEY` or `SECRET_KEY` is strictly prohibite... | 2020/09/09 | [
"https://Stackoverflow.com/questions/63810941",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7145207/"
] | The EC2 should assume an IAM Role.
Then log in to all your 10 other accounts and create roles there. These roles should give cross account access to the EC2 instance role. It is also in these roles that you define what permissions the EC2 instance should have. | Storing `AWS_ACCESS_KEY` and `AWS_SECRET_KEY` in your code or EC2 instances is generally considered a bad practice.
You should handle permissions by attaching an IAM Role to the EC2 instance that is running your business logic ([Docs here](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use_switch-role-ec2.h... |
32,870,004 | In my Rivr application I was using
>
> firstTurn.getParameter("nexmo\_caller\_id");
>
>
>
to get caller ID as I saw that parameter passed by Nexmo, but I've changed to Voxeo and obviously that is not working anymore. Does Rivr has any standard method to get Caller ID (remote caller number) in a Dialogue?
Thanks | 2015/09/30 | [
"https://Stackoverflow.com/questions/32870004",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/194735/"
] | After a bit of playing around I was able to figure out a solution to my problem:
I can see that an extension is added to the experimental instance of Visual Studio when you successfully build the project (I've found no other way of installing the extension (VS2013)). If you try to build the project without the extensi... | This great post shows all the possible solutions:
[http://comealive.io/Vsix-extension-could-not-be-found/](https://web.archive.org/web/20180830055205/http://comealive.io/Vsix-extension-could-not-be-found/)
This one worked for me:
Increasing the version of the package in the .vsixmanifest file |
68,390,320 | Is it possible to add objects into an Arraylist through a for-loop?
I would like to shorten down the code! or do you have any other tips on how to create a word quiz with different classes and methods?
I have three classes, `Main` that drives the game, `Quiz` where the game is constructed, and a class with the Dictio... | 2021/07/15 | [
"https://Stackoverflow.com/questions/68390320",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16356260/"
] | Not using a for-loop but this may help you nonetheless.
```
ArrayList<Sweng> Wordlist = new ArrayList<Sweng>();
Wordlist.add(new Sweng("bil", "car"));
Wordlist.add(new Sweng("blå", "blue"));
Wordlist.add(new Sweng("baka", "bake"));
Wordlist.add(new Sweng("hoppa", "jump"));
Wordlist.add(new Sweng("simma", "swim"));
Wo... | **Snippet 1**
```java
List<Sweng> Wordlist = Arrays.asList(
new Sweng("bil", "car"),
new Sweng("blå", "blue"),
new Sweng("baka", "bake"),
new Sweng("hoppa", "jump"),
new Sweng("simma", "swim")
new Sweng("måne", "moon")
new Sweng("väg", "road")
new Sweng("snäll", "kind")
new Sweng("s... |
1,070,949 | I'm using `openssl sess_id -in sess.pem -noout -text` to decode the ssl session parameters in sess.pem file (which i got using sess\_out) into human readable text. I wanted to know if there is a way to do the opposite i.e convert the text into sess.pem kind of format. Basically i just want to change a couple of paramet... | 2021/07/28 | [
"https://serverfault.com/questions/1070949",
"https://serverfault.com",
"https://serverfault.com/users/787748/"
] | The Short Answer is: *it depends*
The Longer Answer is regarding:
### Would a NAS used for storing backup files be a good idea or an overkill?
* In Fact, it is a commonly used practice to do so for short-Term backup
* Long-Term Backups should be saved on Tapes or other medias.
### what kind of NAS do I need to stor... | To answer your question about the possibility that two drives fail at the same time: It could happen and it might be more likely than you think. I have seen it happen on a RAID5 system which then got all its data wiped.
Usually the RAID system detects that a drive has gone bad and starts rebuilding on a hot spare or m... |
37,815 | I installed the bitcoind and started it as daemon.
After 10hours I've tried "du -h"
```
ubuntu@ip-172-31-37-93:~/.bitcoin$ du -h
16K ./database
59M ./blocks/index
29G ./blocks
646M ./chainstate
30G .
```
How to know if it synced or not?
UPD found an interesting script to monitor node sync status... | 2015/06/06 | [
"https://bitcoin.stackexchange.com/questions/37815",
"https://bitcoin.stackexchange.com",
"https://bitcoin.stackexchange.com/users/26327/"
] | You can compare the block count from Blockexplorer with your local block count. Something like this:
```
$ wget -q -O- https://blockchain.info/q/getblockcount; echo
359721
$ bitcoin-cli -conf=/u0/bitcoin/bitcoin.conf getblockcount
359721
```
As you can see above my node is synched since the counter is equal. | 29G doesn't look after fully synced up.
But you should use bitcoin-cli (RPC command line app).
Do `bitcoin-cli getinfo` (check the "blocks" value and compare against blockchain or another full node) or `bitcoin-cli getchaintips` (more complicated to read)
Example:
```
:~/node/bitcoin$ ./src/bitcoin-cli getblockchai... |
15,717,420 | ```
LblExpirydate.Text = dataReader(0).ToString()
```
Output in asp.net form : `01/05/2013 12:00:00 AM`
I want to change format to (`01/05/2013`)
Notes : My database
Column : `Expirydate`
data type : `Date` | 2013/03/30 | [
"https://Stackoverflow.com/questions/15717420",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2223728/"
] | You can format the string using .ToString() in several different ways:
```
dataReader(0).ToString("dd/MM/yyyy");
dataReader(0).ToString("d");
```
The second option is better as it will format using the current locale. See this MSDN article for more info:
<http://msdn.microsoft.com/en-gb/library/az4se3k1.aspx> | ```
DateTime thisDate1 = DateTime.Now;
Label1.Text =thisDate1.ToString("MM/dd/yyyy") ;
```
output:
03/30/2013
```
DateTime thisDate1 = DateTime.Now;
Label1.Text =thisDate1.ToString("MM-dd-yyyy") ;
```
output:
03-30-2013
```
DateTime thisDate1 = DateTime.Now;
Label1.Text =thisDate1.ToString("MM,dd,yyyy")... |
182,733 | I was messing around with base conversion between decimal and Base26 (alphabet) with no 0th case because I needed it for the Google Sheets API in order to find specific cell values from a 3 dimensional list of all of the entered cell values on a spreadsheet. Remember that with spreadsheets, the columns are counted with... | 2017/12/14 | [
"https://codereview.stackexchange.com/questions/182733",
"https://codereview.stackexchange.com",
"https://codereview.stackexchange.com/users/154539/"
] | There is a lot of sound advice in other answers, so I will only touch on aspects that I think are worth considering, but are not yet addressed (or that I misunderstood).
### Recursion
I like recursion. But when I find myself trying to use it in Python I stop and reconsider. Using recursion in Python is possible, but ... | The `column_name_to_column_number` function would be a good match for [using `functools.reduce`](https://docs.python.org/3/library/functools.html?highlight=reduce#functools.reduce). It operates on any sequence type (including `str`, the type of strings) and allows you to build up a result piece by piece while parsing t... |
192,218 | **What is the best-practice for storing geographic features (lines, polygons and their multipart equivalents) when these features span the antimeridian (±180° longitude), and need to be sent to and recieved from client web applications as GeoJSON?**
---
I am starting work on a server-side web API with support from a ... | 2016/05/04 | [
"https://gis.stackexchange.com/questions/192218",
"https://gis.stackexchange.com",
"https://gis.stackexchange.com/users/25417/"
] | Speaking purely from a data storage and analysis perspective, the [`geography` type for PostGIS](http://postgis.net/docs/using_postgis_dbmanagement.html#PostGIS_Geography) was designed with the antimeridian in mind (among several design goals). There are [several functions specifically designed for the `geography` type... | Surely, the preferred answer is (1), i.e., have clients do the "right
thing". A good case to consider is the polygon representing the
continent of Antarctica approximated by this kml file
`<kml>
<Folder>
<name>Antarctica</name>
<Placemark>
<name>Antarctica</name>
<Polygon>
<tessellate>1</tessellate>
<outerBound... |
34,747,746 | I don't want a splash screen for my Cordova project (Android and iOS), how to remove it? I tried to disable the splash screen plugin, but it continues to appear! How to solve?
```
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<widget xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns... | 2016/01/12 | [
"https://Stackoverflow.com/questions/34747746",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5576116/"
] | As you are using cordova for your project, you can easily remove the splash screen by adding this tag to the config.xml
```
<preference name="SplashScreen" value="none"/>
``` | Ah, finally! I struggled with the same problem. It seems - at least for the IOS build - that a a splash screen is mandatory no matter what I tried.
I found that I could add png files for each of the supported/recommended sizes, then the startup would use that one. I chose to have a proper picture, but you can create a... |
453,327 | Why is it not possible to find a Hamiltonian formulation of general relativity as easily as in classical mechanics? There was a remark to this in my lecture but no real explanation as to why this is.
What stops us from creating a Hamiltonian formulation of GR? | 2019/01/10 | [
"https://physics.stackexchange.com/questions/453327",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/-1/"
] | Kirchhoff's voltage law (or loop law) is simply that the sum of all voltages around a loop must be zero:
$$\sum v=0$$
In more intuitive terms, all "used voltage" must be "provided", for example by a power supply, and all "provided voltage" must also be "used up", otherwise charges would constantly accelerate somewher... | You will need to specify what kind of voltage is involved. The following assumes a 10 vrms sinusoidal voltage. You will also need to know the frequency, since the impedance of a capacitor depends on frequency.
The resistance (R) of a resistor is a special case of electrical impedance (Z). The current through and volta... |
265,401 | When you try playing Don't Starve Together for the first time, the game recommends you to play Alone mode.
Does Don't Starve Together - Alone mode make the original Don't Starve obsolete, or does the original Don't Starve have unique content in it's own right compared to Don't Starve Together - Alone mode? | 2016/05/12 | [
"https://gaming.stackexchange.com/questions/265401",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/10015/"
] | The two versions of the game are balanced differently in terms of difficulty.
As you can read in [this discussion](http://steamcommunity.com/app/322330/discussions/0/619574421433381738/) on the Steam Community, one of the devs says exactly that: you can play Don't Starve Together as a solo game, to start to grasp the ... | Based on you comments I would recommend playing Don't Starve Together Alone, first.
DST has unique content and game mechanics not available in DS. If your trying to warm up to play with a friend then best to warm up with all the same mechanics.
You will find that playing DST alone is more challenging then if you wer... |
393,488 | I am using a [LM358D](https://www.onsemi.com/pub/Collateral/LM358-D.PDF) dual amplifier at the moment and my goal is to measure over-current on 2 motors. Before I'll be doing that, I made a test setup to test the equations and check the output signal of the op-amp. The gain is set to 100 with standard resistors.
![sch... | 2018/08/30 | [
"https://electronics.stackexchange.com/questions/393488",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/186646/"
] | If you want an example of something that is widely used, but different, look at 1000BASE-T gigabit Ethernet. That uses parallel cables and non-trivial signal encoding.
Mostly, people use serial buses because they are simple. Parallel buses use more cable, and suffer from signal skew at high data rates over long cables... | >
> Why did the serial bit stream become so common?
>
>
>
Using serial links has the advantage that it reduced the physical size of the connection. Modern integrated circuit architectures have so many pins on them that this created a strong need to minimize the physical interconnection demands on their design. Thi... |
339,255 | How can I make manpages (from the `man` command) open in a web browser for easier navigation? | 2013/08/30 | [
"https://askubuntu.com/questions/339255",
"https://askubuntu.com",
"https://askubuntu.com/users/176889/"
] | Using the man program
---------------------
Looking at the manpage of man,
```
man man
```
There is the `-H` option, or its equivalent `--html` which will generate the HTML for the manual and open them in the browser.
>
> This option will cause groff to produce HTML output, and will display that output in a web b... | man2html
--------
### To search man pages
I installed the `man2html` package then navigated to `http://localhost/cgi-bin/man/man2html` to view the man pages. These pages can be viewed offline, link to other man pages and feature a search function.
[Source](https://web.archive.org/web/20150317121959/http://linuxers... |
14,314,252 | In my application, when I press the home button the activity is going to `onDestroy()`. It suppose to be called `onPause()` method only right?
Why it is happening so? | 2013/01/14 | [
"https://Stackoverflow.com/questions/14314252",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/746292/"
] | You activity could be destroyed upon pressing the home button if the system is constrained and has determined it needs to free some resources. The [documentation](http://developer.android.com/reference/android/app/Activity.html#ActivityLifecycle) states that `onDestroy()` can be called if:
>
> This can happen either ... | Well, it depends on a lot of factors. If you are facing this issue on Android 3.2+ devices, you should add screenSize property to android:configChanges
```
android:configChanges="keyboardHidden|orientation|screenSize"
```
Besides, also add android:launchMode="singleTop" to your launcher activity. Do note that yo... |
14,515 | Some video cards have two vga outputs. But how to have more than two monitors? | 2009/05/29 | [
"https://serverfault.com/questions/14515",
"https://serverfault.com",
"https://serverfault.com/users/5188/"
] | Take a look at [Matrox](http://www.matrox.com) website - they have triple- and quad-head video cards.
You can also use more than one video card in a single computer - not in SLI or Crossfire mode. Of course your OS must support such configurations. | Use multiple video cards. Some video cards (matrox for example) have two outputs, or one high-density connector (Dell for example) that splits using a converter. Multiple cards can be fitted to provide multiple displays.
Why? Flight simulator games (front, left, right, lowered front and elevated front displays) :O, pr... |
7,624,562 | I have something where it randomly generates words using PHP...
I have a iFrame currently linking to dictionary.com...
I don't like this because it's old and ugly.
I want to get the definition of a word and display it how I want!
Is this possible by using PHP? | 2011/10/02 | [
"https://Stackoverflow.com/questions/7624562",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/974866/"
] | You can do this, but you still have to keep the `new` keyword, and create the nested class as a path-dependent type:
```
class Bippy(x: Int) {
class Bop {
def getIt = x
}
}
val bip = new Bippy(7)
val bop = new bip.Bop
bop.getIt // yields 7
val bop2 = new bip.Bop{ override def getIt = 42 }
bop2.getIt // yie... | I don't think it's possible. However, a common pattern is to add a parameter to factory methods which takes a function modifying the created object:
```
trait MyClass {
var name = ""
def doStuff():Unit
}
class Foo extends MyClass {
def doStuff() { println("FOO: " + name) }
}
trait MyClassFactory {
def make: ... |
5,256,718 | How to Redirect <http://example.com> to <http://www.example.com> using htaccess | 2011/03/10 | [
"https://Stackoverflow.com/questions/5256718",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/276030/"
] | use a `.htaccess` file with following content:
```
RewriteEngine on
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^www\.example\.com
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
```
In case of IIS make sure, that the host listens to all urls you want to use for your block (including www.example.com an... | By having a correct configured DNS.
Make sure you have following line:
```
@ IN A your.server.ip.address
```
Which says anyone requesting yourdomain.bla will be sent to the server with the given IP. In your case, the IP-address would be the same as the CNAME configuration for "www".
Though, if you use a web... |
44,503 | Not to be confused with the common parsnip that is usually found in regular supermarkets. Either online or in specialty markets that ship via FedEx would be ideal.
Thank you. | 2014/05/29 | [
"https://cooking.stackexchange.com/questions/44503",
"https://cooking.stackexchange.com",
"https://cooking.stackexchange.com/users/25190/"
] | Peruvian Parsnips seem to be pretty difficult to find, even online. I found this link that has an "Email me when available" option: <https://www.greenharvest.com.au/Plants/SummerLeafyGreens.html#PeruvianParsnip>
But the website appears to be in Australia and may not ship to the USA, or perhaps if exorbitant shipping c... | It is very hard to find it. Also it has many names depending on the country: Mandioquinha, Batata Salsa, Peruvian carrot, etc... The latin is *Arracacia xanthorrhiza E.N. Bancroft*.
It seems you can find them online at this place in the US (but I have not yet bought them yet).
In general, you will find only frozen. It... |
48,675,377 | I am trying to get Intellij to recognize my properties using gradle. I have followed the steps [here](https://docs.spring.io/spring-boot/docs/current/reference/html/configuration-metadata.html#configuration-metadata-annotation-processor). So this means I have a `@ConfigurationProperties` annotated class with some prope... | 2018/02/08 | [
"https://Stackoverflow.com/questions/48675377",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3884529/"
] | * [Turn the annotation processing on](https://www.jetbrains.com/help/idea/annotation-processors.html)
* Do not [delegate IDE build/run actions to Gradle](https://www.jetbrains.com/help/idea/runner.html)
* Rebuild your project in IDE: **Build** -> **Rebuild Project** | As far as I can tell, IntelliJ (at the time of this writing, 2018.1.2) wants the `spring-configuration-metadata.json` file to either be in a main source root (`src/main/resources/META-INF/ or src/main/java/META-INF/`) or in its default output directory for it to pick it up for autocompletion of properties in your sourc... |
316,338 | Let's say we have a list of players in our `Event` class. And we have a dictionary with the score of each player. We can add a score to a player using the `addScore` method:
```
public class Event {
private List<Player> players;
private Map<Player, Integer> score;
public void addScore(Player p, int player... | 2016/04/20 | [
"https://softwareengineering.stackexchange.com/questions/316338",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/223143/"
] | The best idea to follow here is known as "fail fast". The basic philosophy goes as follows:
* When the program's data is in an invalid state, errors occur which cause the program to not do what it's intended to do.
* Depending on how widely different the invalid data is from the expected data, it's possible for the in... | What does your documentation say? I can't see any reason why you would treat null and a player outside your players list differently. If it's a bug, anyone calling it incorrectly won't handle your exception reasonably. Use an assertion at development time. Check with your local coding standards what you should do in a ... |
1,207,688 | A friend of mine is writing a book on female scientists and mathematicians, and one of the subjects will be Alicia Boole Stott, a British mathematician who studied 4D geometry and polytopes. Are there any books people could recommend for someone who is new to the topic that explain 4D well or help with the visual under... | 2015/03/26 | [
"https://math.stackexchange.com/questions/1207688",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/70732/"
] | You did it upside down ;). Just invert your final answer, which is correct. Solve for the radius...
$$-1 \le {{x-\pi} \over {2}} \le 1$$
$$-2 \le {x-\pi} \le 2$$
$$ \pi-2 \le x \le \pi+2$$
Looks like the radius is $2$. | You are trying to use the ratio test, but you have the formula inverted. It should be $\lim\_{n\to \infty} \frac {|a\_{n+1}|} {|a\_n|} $. As in, the $|a\_{n+1}|$ term should be on $\textit {top}.$
Zach's answer is not correct. The radius of convergence is not $\pi$. Rather, the power series is $\textit centered$ at $\... |
9,467 | I have a very good (I assume) point and shoot high end camera with me. Model is Panasonic Fz35. I think it has very nice features and using the camera in manual mode is nice too.
However, with all the nice in-built features in my camera, can I say it's equivalent to any base SLR camera (ignoring additional lens for S... | 2011/03/05 | [
"https://photo.stackexchange.com/questions/9467",
"https://photo.stackexchange.com",
"https://photo.stackexchange.com/users/1272/"
] | To be an SLR the camera has to have a mirror and optical viewfinder as cabbey states. The optical viewfinder has several advantages, namely a crisper image for easier manual focus (as you're getting the full resolving power of the lens, instead of a small LCD screen) and zero lag (as what you're seeing is happening in ... | Others have pointed out that an SLR has a mirror while a P&S does not, which is true. Another important difference is the autofocus mechanism; a P&S uses contrast detection off the image captured by the image sensor, an SLR has an entirely separate set of autofocus sensors that reads part of the image reflected off the... |
55,757,339 | I am trying to print variables to my file by using a sh file, but it doesn't work.
It is very simple code. How can I fix it? And I don't understand at a point. the script works in command as I expected. But it shows me totally different result when I move the scripts to a `sh` file.
```
#! /bin/bash
var=12345
echo -e ... | 2019/04/19 | [
"https://Stackoverflow.com/questions/55757339",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11382235/"
] | One thing to be aware of, is that when you write:
```
class BottomPanel extends React.Component<Props, {}> {
dropDownUpdate = e => this.setState({ dropDownValue: e.currentTarget.textContent });
}
```
This (currently) is not valid ES6 syntax. You can't assign a class variable with an equals sign that way. The reas... | Since dropDownUpdate is an Arrow function, It should work as expected without
`this.dropDownUpdate = this.dropDownUpdate;` Or
`this.dropDownUpdate = this.dropDownUpdate.bind(this);`
In Arrow functions, value of `this` is lexically bound, unlike regular functions where the value of `this` changes based on the contex... |
730,999 | These are tables I have:
```
Class
- id
- name
Order
- id
- name
- class_id (FK)
Family
- id
- order_id (FK)
- name
Genus
- id
- family_id (FK)
- name
Species
- id
- genus_id (FK)
- name
```
I'm trying to make a query to get a list of Class, Order, and Family names that does not have any Species under them. You... | 2009/04/08 | [
"https://Stackoverflow.com/questions/730999",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/191083/"
] | Well, just giving this a quick and dirty shot, I'd write something like this. I spend most of my time using Firebird so the MySQL syntax may be a *little* different, but the idea should be clear
```
select f.name
from family f left join genus g on f.id = g.family_id
left join species s on g.id = species.genus... | Sub-select to the rescue...
```
select f.name from family as f, genus as g
where
f.id == g.family_id and
g.id not in (select genus_id from species);
``` |
26,209 | My 16 GB Nexus 7 arrived a few days ago. It's my first mobile device, believe it or not, and I've already found it to be incredibly useful. It has performed flawlessly, but there is one small issue that's an annoyance, nothing more. The screen flickers.
It happens in dimmer light, and only for a second or two at a tim... | 2012/07/21 | [
"https://android.stackexchange.com/questions/26209",
"https://android.stackexchange.com",
"https://android.stackexchange.com/users/17159/"
] | There just was a [Blog on Land of Droid](http://www.landofdroid.com/2012/nexus-7-screen-flicker/) covering this issue. The author summed up a few conditions under which this "flicker" occurs:
* back-light is dimmed under 30%
* a weak WiFi signal
* the device is accessing the net
According to that report, these 3 thin... | Turning off auto brightness worked for me. |
494,303 | **Can I simply hook up an opamp inputs, (either using a differential or in-amp topology that is/are also powered from a floating power supply), across a device under test that itself has exceeding voltages for the opamp (<50Vdc) ?**
so idea is to build smth that uC's ADC can measure and eventually for PC to read (via ... | 2020/04/19 | [
"https://electronics.stackexchange.com/questions/494303",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/123589/"
] | 1) There's only two points, how much data you must send within some given time frame, and which baud rates your microcontroller is capable of with the master clock they have. Some have only simple baud rate generators that divide with an integer, some have more complex ones that have a fractional baud rate generator. F... | >
> 4) What's the essence of oversampling (8,16) of the data on the RX
> side? if the baud rates are the same on both TX and RX
>
>
>
They are not the same rates and that is the point.
Even if both sides were using a 1.843200 MHz or a multiple of, there would be error as no two crystals are exactly the same and ... |
21,262,815 | I have two paths: application root path and target path. What is the simplest way to ensure that the target path is the children of application root path?
Basically the target path provided by the user is to be displayed by my server. But I want to constrain my server so only the files under the application root path ... | 2014/01/21 | [
"https://Stackoverflow.com/questions/21262815",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/474597/"
] | Another way:
```
def child?(root, target)
raise ArgumentError, "target.size=#{target.size} < #{root.size} = root.size"\
if target.size < root.size
target[0...root.size] == root &&
(target.size == root.size || target[root.size] == ?/)
end
root = "/root/app"
p child?(root, "/root/app/some/path") # => true... | You haven't provided any use case, thus I assume the following variables apply to your case
```
root = "/var/www/"
target = "/var/www/logs/something/else.log"
```
You can use a regular expression or even more simple [`String#start_with?`](http://ruby-doc.org/core-2.1.0/String.html#method-i-start_with-3F)
```
targ... |
70,045,427 | Consider this input dictionary:
```py
my_dict = {
'group1':{
'type1': {'val1' : 45, 'val2' : 12, 'val3' : 65},
'type2': {'val5' : 65, 'val6' : 132, 'val7' : 656},
},
'group2':{
'type3': {'val11' : 45, 'val12' : 123, 'val13' : 3},
'type4': {'val51' : 1, 'val61' : 2, 'val71' :... | 2021/11/20 | [
"https://Stackoverflow.com/questions/70045427",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14917037/"
] | install and uninstall kotlin plugin.it Worked for me | Updating ktx implementation and syncing gradle worked for me! |
14,829,648 | How should I understand this? And how this can happens?
Go into django shell:
```
>>> from customauth.models import Profile
>>> p = Profile.objects.get(user_id=1)
>>> p.status
u'34566'
>>> p.status = 'qwerty'
>>> p.status
'qwerty'
>>> p.save()
>>> p.status
'qwerty'
>>> p = Profile.objects.get(user_id=1)
>>> p.status
u... | 2013/02/12 | [
"https://Stackoverflow.com/questions/14829648",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/897413/"
] | I was having the same problem, I'm using Django and Mongo... the data wasn't persisted after `object.save()`... Them, I used it to solve:
```
object.save_base(force_update=True)
```
Now is working for me, hope can help. | The shell session is a single database transaction. Connections outside that won't see the changes, because of transaction isolation. You'll need to commit the transaction - the easiest way would be to quit the shell and restart.
In a normal request, Django commits automatically at the end of the request, so this beha... |
511,101 | I searched for this and was surprised to hear that “dipped in shit” meant a measure of surprise.
I’ve always heard it used as being lucky or untouchable.
“I blew through that speed trap and as the cop started coming after me, another car crashed into him. I’m dipped in shit!” | 2019/09/10 | [
"https://english.stackexchange.com/questions/511101",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/237446/"
] | **Cull** complexity (for the ruthless connotations)
**Trim** the requirements.
**Decimate** complexity (also ruthless, but in the literal sense only paring down to 9/10, so maybe not as far reaching as you'd like)
**Skeletonize** the requirements (i.e. reducing them to bare bones..., also image processing lingo with... | "*Pare down*" seems to fit in your context -
>
> Pare down
> =========
>
>
> : To reduce the size or amount of something by gradually taking away
> parts of it.
>
>
>
([Source](https://idioms.thefreedictionary.com/pare+down))
Another definition -
>
> Pared-down
> ==========
>
>
> : With no unnecessary feat... |
37,481,539 | I have an array of objects where i need sum of object property values in new array of objects,
Input:
```
var inputArray = [
{ subject: 'Maths', marks: '40', noOfStudents: '5' },
{ subject: 'Science', marks: '50', noOfStudents: '16' },
{ subject: 'History', marks: '35', noOfStudents: '23' },
{ subject: 'Scien... | 2016/05/27 | [
"https://Stackoverflow.com/questions/37481539",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3748892/"
] | Simple `reduce` solution :
```js
const data = [
{ subject: 'Maths', marks: '40', noOfStudents: '5' },
{ subject: 'Science', marks: '50', noOfStudents: '16' },
{ subject: 'History', marks: '35', noOfStudents: '23' },
{ subject: 'Science', marks: '65', noOfStudents: '2' },
{ subject: 'Maths', marks: '30', noOf... | The solution using `Array.forEach`, `parseInt` and `Object.keys` functions:
```
var summed = {}, result;
inputArray.forEach(function (obj) {
obj['marks'] = parseInt(obj['marks']);
obj['noOfStudents'] = parseInt(obj['noOfStudents']);
var subj = obj['subject'];
if (!summed[subj]) {
summed[subj] ... |
30,623,688 | I'm not sure how to explain this since the plan/idea is mostly in my head since I don't know how to execute it, but I'll try (comment with questions!):
I have a sheet that lists which department of "my" company made an error, which type of error, and how many of that specific error in the department per fiscal month. ... | 2015/06/03 | [
"https://Stackoverflow.com/questions/30623688",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4293071/"
] | Well color me surprised. [PostSharp lets you do exactly what you're looking for](http://doc.postsharp.net/control-visibility#types). In a nutshell, you'd use the `ComponentInternalAttribute` to control visibility of a type:
```
public class Item {
[ComponentInternal(typeof(Manager))]
public Item(...) {
}
.... | There are way better ways to achieve your goal than your current approach, **given that you can actually change that code**.
You could for example mark the contructor of Item class as private and add a static factory method to Item class which would be responsible for creating an instance of the class.
Another way is... |
853,262 | I'm working on an iphone app that needs to display superscripts and subscripts. I'm using a picker to read in data from a plist but the unicode values aren't being displayed corretly in the pickerview. Subscripts and superscripts are not being recognized. I'm assuming this is due to the encoding of the plist as utf-8, ... | 2009/05/12 | [
"https://Stackoverflow.com/questions/853262",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/86837/"
] | The \u variants only work when presented to the C compiler. For UTF-8, if you really want to type character codes rather than simply typing them (the companion to the character palette is the keyboard viewer, which will update as you press modifier keys so you can search for specific characters that way), then you'll h... | Doesn't seem to work with longer unicode like
>
> `𢌾`
>
>
>
header of the plist:
```
<?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3 <plist version="1.0">
``` |
4,003,087 | >
> **Possible Duplicate:**
>
> [Difference between a Structure and a Union in C](https://stackoverflow.com/questions/346536/difference-between-a-structure-and-a-union-in-c)
>
>
>
I could understand what a struct means. But, i am bit confused with the difference between union and struct. Union is like a share ... | 2010/10/23 | [
"https://Stackoverflow.com/questions/4003087",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/484153/"
] | I've used unions to convert bytes to and from other types. I find it easier than bit-shifting.
```
union intConverter {
int intValue;
struct {
byte hi;
byte lo;
} byteValue;
}
intConverter cv;
cv.intValue =1100;
printf("%X %X\n", cv.byteValue.hi, cv.byteValue.lo);
```
Where int is 16-bit... | Run this program and find out the output.
#include < stdio.h >
```
int main()
{
union _testUnion
{
long long x;
long long y;
} testUnion;
struct _testStruct
{
long long x;
long long y;
}testStruct;
printf("Sizeof Union %d\n",sizeof(testUnion));
printf("Sizeof Struct %d\n",sizeof(tes... |
10,171,709 | I am using [Flex slide](http://www.woothemes.com/flexslider/)r for one project. I need to control two sliders on one page with same controls.
One part is main slider that will show images, and the second one is text (in this case it will be taken from "the\_excerpt" in WP ).
Basically, this is the code I am using to ... | 2012/04/16 | [
"https://Stackoverflow.com/questions/10171709",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1103763/"
] | You could accomplish what you're trying to do by ditching the controlsContainer setting and creating your own navigation that you then link to both sliders. Here's an idea of how (please note it's untested)
Your markup would look something like this. Note the rel attribute on the links - we'll use them below. Also not... | So, I have been having the same issue and it can be a real drag... But I have come to a quick solution that is easy as pie. This will work for 1 child or a hundred children controlled by on parent flexslider. Works for all actions. Hopefully I can talk them into fixing this and allowing an array of jquery objects for t... |
51,981,643 | On page load date-picker working fine but after refresh the div it is not working
it gives error like
>
> jquery-ui.js:8633 Uncaught TypeError: Cannot read property 'settings'
> of undefined error
>
>
>
my code is below
```
<!DOCTYPE html>
<html>
<head>
<title>Image Select</title>
<link rel="styleshee... | 2018/08/23 | [
"https://Stackoverflow.com/questions/51981643",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4910709/"
] | >
> How to catch exception message with skip method in spring batch?
>
>
>
You can do that by implementing the `SkipListener` interface or extending the `SkipListenerSupport` class. All methods in the `SkipListener` interface have a `Throwable` parameter which is the exception thrown and that caused the item to be... | I couldn't get it to work either with implementing SkipListener (would be nice to know why) but in the end I went with the annotation way which is only briefly mentioned in the docs. Also somebody had a similar issue here using the implementation method ([question](https://stackoverflow.com/questions/7638924/spring-bat... |
58,906,149 | Does anyone know any way of converting DXF files to either PNG or PDF?
I have a huge list of DXF Files and I want to convert them to Images to view them quicker.
If its possible, how could you extract the DXF file values, like the thickness or measurements of that drawing that's in the DXF File. | 2019/11/17 | [
"https://Stackoverflow.com/questions/58906149",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12139409/"
] | EDIT!!!
```py
import matplotlib.pyplot as plt
import ezdxf
from ezdxf.addons.drawing import RenderContext, Frontend
from ezdxf.addons.drawing.matplotlib import MatplotlibBackend
# import wx
import glob
import re
class DXF2IMG(object):
default_img_format = '.png'
default_img_res = 300
def convert_dxf2img(... | [Dia](https://wiki.gnome.org/Apps/Dia/) from the `GNOME` project can convert `dxf` to `png`, it also has a `Python` [interface allowing for scripting](https://wiki.gnome.org/Apps/Dia/Python). |
18,584,960 | I have the following table,
```
CREATE TABLE [dbo].[Catalogs]
(
[ID] [INT] IDENTITY(1,1) NOT NULL,
[Name] NVARCHAR(255) NOT NULL,
[Description] NVARCHAR(500) NULL,
[Icon] NVARCHAR(255) NULL,
[Order] INT NOT NULL,
[ParentID] INT NULL,
[CreatorID] INT NOT NULL,
[LastModifierID] INT NOT NU... | 2013/09/03 | [
"https://Stackoverflow.com/questions/18584960",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/960567/"
] | ```
SELECT *,
CASE WHEN EXISTS (SELECT * FROM [dbo].[Catalogs] c WHERE c.ParentID = p.Id)
THEN 1 ELSE 0 END AS HasChildren
FROM [dbo].[Catalogs] p
``` | ```
SELECT * ,
CASE WHEN(SELECT COUNT(*) FROM Table1 as child
WHERE parent.[ID]=child.[ParentID])>0 THEN 1 ELSE 0 END
AS HasChildren
FROM Table1 as parent
```
**[FIDDLE](http://www.sqlfiddle.com/#!3/ffd1a/17)** |
56,861 | National Science Foundation (NSF) in US enforces a limit on salary compensation over all grants, often referred to as the [**two-ninths-rule**](http://www.nsf.gov/pubs/policydocs/pappguide/nsf08_1/aag_5.jsp):
>
> Summer salary for faculty members on academic-year appointments is
> limited to no more than two-ninths ... | 2015/10/25 | [
"https://academia.stackexchange.com/questions/56861",
"https://academia.stackexchange.com",
"https://academia.stackexchange.com/users/386/"
] | I don't know for sure if this is historically accurate, but the story I've always heard is that the two-ninths rule was an attempt to avoid the vacation issue. If you take three months of summer salary, then that leaves no time at all for any vacation, since you can't accept summer salary for any time not spent on rese... | One way to look at this is actually look at your question slightly differently - what assumptions do NSF vs. NIH funding make about who you are, and why they're funding you.
The NIH model is *clearly* meant to support dedicated, purely-NIH funded research positions run on 100% soft money, or something very, very near ... |
55,376,125 | I have a 2d np.array with 3 columns, coming from 4 categories of registrations. I want to implement K-means on this 3-columns np array to test if it can automatically be clustered to 4 3-dimensional good-enough clusters. So I initiate my centroids from the medians of the real categories (3 medians \* 4 categories i wan... | 2019/03/27 | [
"https://Stackoverflow.com/questions/55376125",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7919440/"
] | **PART 1:**
>
> TypeError: 'builtin\_function\_or\_method' object is not subscriptable
>
>
>
This is a pure `numpy` error and it appears because you have forgotten to use **parentheses** () in order to define the numpy array.
---
**PART 2:**
**First of all, in the `init_medians` you pass 4 lists but they did ... | Did you not simply forget to put brackets around np.array?
```
init_medians=np.array([...])
``` |
45,315,582 | I am creating an IOS app for a school project where the user ask the app to encrypt/decrypt strings using an asymmetric algorithm.
I would like the user to be able to 'talk' to the machine as if where talking to another human. For example the user could ask the app "Could you encrypt 'How are you?' for me, using John... | 2017/07/26 | [
"https://Stackoverflow.com/questions/45315582",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8366709/"
] | A simple way to get this working is to use the Speech framework that @dannymout mentioned to turn the user's speech into text. But I suggest you take two steps:
In the first step the user says something like "Encrypt please" or "I want to decrypt", but not the actual text yet. So here you just look for the word "encr... | So, if I understand correctly, you're trying to build a chatbot. I'd suggest using NLP and the [Speech](https://developer.apple.com/documentation/speech) framework for voice dictation or just looking for the key words using the input from Speech.
CoreML would be a lot more complicated to get setup, not really suited f... |
43,260,832 | I am currently using Ansible to provision bare metal using an IPv6 link local address. Once the servers are provisioned, ansible will run a series of tests on the server, as one shell command, to ensure provisioning was successful. These tests take approximately 10 minutes to run.
The issue that I'm facing is that th... | 2017/04/06 | [
"https://Stackoverflow.com/questions/43260832",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7128479/"
] | TL;DR
=====
Add this one liner to your `ansible.cfg` located on `/etc/ansible/ansible.cfg`
```bash
echo -e "[persistent_connection]\ncommand_timeout = 60\n" | sudo tee -a /etc/ansible/ansible.cfg
```
---
I searched about this and in the [`Ansible` official documents](https://docs.ansible.com/ansible/latest/network... | I was having almost the similar issue and -vvv did not give me much info. But checking the syslog in the guest showed me I was running out of memory when running the ansible script. It would be good if you can see the syslog entry to see if you have any issues in the guest when running ansible script. |
82,379 | [A full FAQ post has been written on meta.chem.SE](https://chemistry.meta.stackexchange.com/questions/3779/everything-you-need-to-know-about-synthesis-golf), explaining the premise of synthesis golf and the 'rules'. Please take a look at this before answering (if you haven't already).
---
This fifth round of golf co... | 2017/09/09 | [
"https://chemistry.stackexchange.com/questions/82379",
"https://chemistry.stackexchange.com",
"https://chemistry.stackexchange.com/users/21296/"
] | OK, new route. Retrosynthesis:
[](https://i.stack.imgur.com/cMEEL.png)
Denopamine **1** can be made by a reductive amination between amine **2** and aldehyde **3** (either of the two reductive amination disconnections are fairly obvious choices).
The requisite am... | A synthesis using Sharpless dihydroxylation for stereoinduction:
 |
3,457,372 | Given an array of strings
```
["the" "cat" "sat" "on" "the" "mat"]
```
I'm looking to get all combinations of items in sequence, from any starting position, e.g.
```
["the"]
["the" "cat"]
["the" "cat" "sat"]
...
["cat" "sat" "on" "the" "mat"]
["sat" "on" "the" "mat"]
["on" "the" "mat"]
...
["sat" "on"]
["sat" "on"... | 2010/08/11 | [
"https://Stackoverflow.com/questions/3457372",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/160406/"
] | If you're into one-liners, you might try
```
(0..arr.length).to_a.combination(2).map{|i,j| arr[i...j]}
```
BTW, I think those are called "all subsequences" of an array. | here you can get all the combinations
```
(1...arr.length).map{ | i | arr.combination( i ).to_a }.flatten(1)
``` |
21,853,070 | I'm doing my first maven spring Rest project which includes an embedded tomcat service and some MongoDb queries. I'm very new to both Maven and Spring, and can't seem to understand this error.
```
Exception in thread "main" java.lang.IllegalAccessError: tried to access method org.springframework.core.io.support.Spring... | 2014/02/18 | [
"https://Stackoverflow.com/questions/21853070",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1998234/"
] | You get circular dependency when:
A depends on B and B depends on A.
If you think both need this dependency then they should belong to one project. | you can move **FetchDetails()** to another project and reference to this project from both **xml** and **synchronise** projects |
9,288,394 | What is the real use of the security:http element in the spring security configurations. Is it applicable only for the web applications?
Please see the following code:
```
<security:http use-expressions="true">
<security:intercept-url pattern="/client/**"
access="isAuthenticated()" />
<sec... | 2012/02/15 | [
"https://Stackoverflow.com/questions/9288394",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/421753/"
] | The `<http>` element is only applicable to web applicaitons. You should probably start with [the namespace chapter](http://static.springsource.org/spring-security/site/docs/3.1.x/reference/springsecurity-single.html#ns-minimal) of the manual.
There is also an [appendix](http://static.springsource.org/spring-security/s... | I found the xsd documentation helpful. check this out.
<http://www.springframework.org/schema/security/spring-security.xsd> |
1,633,790 | Does $x^{y^z}$ equal $x^{(y^z)}$? If so, why?
Why not simply apply the order of the operation from left to right? Meaning $x^{y^z}$ equals $(x^y)^z$?
I always get confused with this and I don't understand the underlying rule. Any help would be appreciated! | 2016/01/30 | [
"https://math.stackexchange.com/questions/1633790",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/245761/"
] | In the usual computer science jargon, exponentiation in mathematics is [right-associative](https://en.wikipedia.org/wiki/Operator_associativity), which means that $x^{y^z}$ should be read as $x^{(y^z)}$, not $(x^y)^z$.
In expositions of the [BODMAS](https://www.mathsisfun.com/operation-order-bodmas.html) rules that ar... | The exponent is evaluated first if it is an expression. Examples are $3^{x+1}=3^{\left(x+1\right)}$ and $e^{5x^3+8x^2+5x+10}$ (the exponent is a cubic polynomial) and $10^{0+0+0+10^{15}+0+0+0}=10^{10^{15}}$. The left-associativity simply fails when the exponent contains multiple terms. |
24,805,738 | I'm trying to store the value from the class below as a variable, so i could used it later on, but I can't get it working.
Any ideas?
```
class Dates {
public function __construct($date) {
$this->DateCompare($date);
}
public function DateCompare($date) {
$date1 = new DateTime("2015-04-08");
... | 2014/07/17 | [
"https://Stackoverflow.com/questions/24805738",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3628153/"
] | As a contestant for the ugliest hack of the day:
```
sh$ TERMPID=$(ps -ef |
grep gnome-terminal | grep myWindow123 |
head -1 | awk '{ print $2 }')
sh$ kill $TERMPID
```
---
A probably better alternative would be to record the PID of the terminal at launch time, and then kill by that pid:... | In the script that starts the terminal:
```
#!/bin/bash
gnome-terminal --title "myWindow123" --disable-factory -x watch ls /tmp &
echo ${!} > /var/tmp/myWindow123.pid
```
In the script that shall slay the terminal:
```
#!/bin/bash
if [ -f /var/tmp/myWindow123.pid ]; then
kill $(cat /var/tmp/myWindow123.pid && r... |
23,736,315 | I'm trying to find a way to get a php variable value (in admin.php file) on the javascript.js file.
This is the javascript.js file. And the `from` variable is the variable that should get the value from the admin.php file.
```
var from;
function table() {
var atttHeader1 = document.createAttribute("data-hide");
va... | 2014/05/19 | [
"https://Stackoverflow.com/questions/23736315",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3584897/"
] | Just removing folder **[workspace].metadata.plugins\org.eclipse.wst.validation** and restarting eclipse solved the problem for me | Go to the .metadata and then inside the folder go to org.eclipse.wst.validation directory of the workspace and delete the dep.index file, and restart eclipse. |
22,302,327 | ```
package Message;
public class Example_R {
public static void main (String args[])
int n=1;
int input[]={1, 2, 1, 3, 4};
for (int j=0; j<=4; j++) {
int Add = 0;
for (int i=0; i<=4; i++) {
if (input[j] !=input[i]) {
Add+=input[i];
}
}
... | 2014/03/10 | [
"https://Stackoverflow.com/questions/22302327",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3402001/"
] | Hint: use a variable that is holding "the largest sum reached so far". You will update it very time you compute a new sum.
You will need to find "how and when do I initialize this variable ?" and "how do I update it ?" | You can use variables of type `Comparable` and use the `compareTo()` method.
1. `one.compareTo(two)` will return > 0 if `one > two`
2. `one.compareTo(two)` will return < 0 if `one < two`
3. `one.compareTo(two)` will return 0 if `one` and `two` are equal
Go through the array, compare the current index with the previou... |
44,401,103 | If I call filter() on a list, say:
```
>>> filter(lambda x: x > 1, [1,2,3,4])
[2, 3, 4]
```
Is this:
a) creating a totally new list in memory with the results
or
b) is it just pop()-ing items from the existing list and returning the same list? | 2017/06/06 | [
"https://Stackoverflow.com/questions/44401103",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/849354/"
] | For the sake of completeness, I'll just leave this here.
```
>>> a = [i for i in range(10)]
>>> b = list(filter(lambda x: x > 1, a))
>>> id(a)
4510567816
>>> id(b)
4500803808
>>> id(a) == id(b)
False
```
If you know python, you'll know `id` gives you a unique reference identifier. If they're not equal, it means they... | not really
```
class Person:
def __init__(self, age) -> None:
self.age = age
p1 = Person(1)
p2 = Person(2)
p3 = Person(3)
p4 = Person(4)
p5 = Person(5)
p6 = Person(6)
list1= [p1, p2, p3, p4, p5, p6]
list2 = list(filter(lambda p : p.age > 3, list1))
list2[0].age = 100
print(p4.age)
print(p5.age)
print(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.