qid int64 1 74.7M | question stringlengths 15 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 4 30.2k | response_k stringlengths 11 36.5k |
|---|---|---|---|---|---|
15,579,898 | I've below code in one of my php files to fetch data from DB:
```
$products = $this->db->get_rows('SELECT * from products WHERE shop_id='.$_SESSION['shop_id'].'AND tags,title,text LIKE \'%'.$_POST['search'].'%\'');
```
Is it problematic? I mean LIKE operator can be injected?
***Edited***
please provide examples of... | 2013/03/22 | [
"https://Stackoverflow.com/questions/15579898",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1020526/"
] | Any operator can be injected without binding.
```
$_POST['search'] = "1%'; DROP TABLE myTable LIKE '%";
```
Would make
```
.... AND tags,title,text LIKE '%1%'; DROP TABLE myTable LIKE '%%'
```
Read on [how to bind parameters](http://php.net/manual/en/pdostatement.bindparam.php). | Never, ever, use database queries like that, don't construct a string with variables and use it for database activities.
Construct a string that will later on be prepared and executed, by inserting the variables into the string, making them not act like "commands" but as "values".
You can do it like this:
```
$query... |
15,579,898 | I've below code in one of my php files to fetch data from DB:
```
$products = $this->db->get_rows('SELECT * from products WHERE shop_id='.$_SESSION['shop_id'].'AND tags,title,text LIKE \'%'.$_POST['search'].'%\'');
```
Is it problematic? I mean LIKE operator can be injected?
***Edited***
please provide examples of... | 2013/03/22 | [
"https://Stackoverflow.com/questions/15579898",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1020526/"
] | Any operator can be injected without binding.
```
$_POST['search'] = "1%'; DROP TABLE myTable LIKE '%";
```
Would make
```
.... AND tags,title,text LIKE '%1%'; DROP TABLE myTable LIKE '%%'
```
Read on [how to bind parameters](http://php.net/manual/en/pdostatement.bindparam.php). | This is really bad. Pulling vars into an SQL statement without cleaning or checking them is a good way to get pwnd. There are several things that people can inject into code. Another injection method to watch out for, 1=1 always returns true.
```
$products = $this->db->get_rows('SELECT * from products WHERE shop_id='.... |
2,322,211 | I've tried a number of different search patterns:
* `[^=]=[^=]` works but only if = is not at the beginning/end and it also matches the sandwiching characters
* `=\@!==\@!` seems like it should work because \@! matches nothing but requires a match, but it doesn't (see :help pattern-overview)
* `[^=]\@==[^=]\@=` also d... | 2010/02/23 | [
"https://Stackoverflow.com/questions/2322211",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/253521/"
] | Ah hah: `=\@<!==\@!` | How about
```
[^=]\?\zs=\ze[^=]\?
```
\zs starts the match
\ze ends the match |
72,990,640 | Hi im new to Flutter and coding and tried do build my first to do app. I've created a textformfield to add new todos with a button in a container above. By pressing a button, a new todo will appear on the todo Container. I managed to dynamically give a column new todos with a CheckboxListtTitle. However, when adding a ... | 2022/07/15 | [
"https://Stackoverflow.com/questions/72990640",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18765099/"
] | ```
df['new_column'] = df['column'].apply(lambda x: x[0]['name'])
```
this assumes that the list is always 1 element long and the 'name' key always exists in that dictionary | I think similar problems you can find in many questions before.
If you want to get single element from list with dictionary then you can use unusual fact that `.str` can work also with `list` and `dictionary`
```
df['Workbooks'] = df['Workbooks'].str[0].str['name']
```
---
Of course you can do the same using `.app... |
11,100,878 | I'm creating an application using `fabric.js`, and experiencing really strange behavior. I'm adding both images and text instances, using the regular `fabric.Canvas` (not `fabric.StaticCanvas`), and am unable to move or resize these items after addition. I've only added a couple of each type. The basic functionality is... | 2012/06/19 | [
"https://Stackoverflow.com/questions/11100878",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/187907/"
] | It's possible that canvas internal offset is not updated properly. Something on the page could change dimensions/position, making canvas positioned at a different location than the one it was during initialization. Try calling `canvas.calcOffset()` after `renderAll()` call, or after adding those objects.
The reason `c... | I had the same problem, in adition to kangax solution, in a VERY extreme environment, you can force it to recalculate the offset anytime the render occurs, with an event.
`canvas.on('after:render', function(){ this.calcOffset(); });` |
8,370,926 | [StyleCop](http://stylecop.codeplex.com/) mandates a particular sort order for the contents of C# files. For example, fields should be declared before methods and public declarations should come before private ones.
It would be useful to have a Visual Studio extension to move these things into that order automatically... | 2011/12/03 | [
"https://Stackoverflow.com/questions/8370926",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/241605/"
] | You can try with [Regionerate](http://www.rauchy.net/regionerate/docs/2007/05/download.html) :
>
> Regionerate is an automated tool which helps you to preserve your
> code's layout over time. Regionerate lets you define regions in your
> code and determine the way members (fields, methods, properties etc.)
> shoul... | ReSharper can do this. It has a "Type Members Layout" feature that allows you to use either a default set of rules, or to define your own. |
8,370,926 | [StyleCop](http://stylecop.codeplex.com/) mandates a particular sort order for the contents of C# files. For example, fields should be declared before methods and public declarations should come before private ones.
It would be useful to have a Visual Studio extension to move these things into that order automatically... | 2011/12/03 | [
"https://Stackoverflow.com/questions/8370926",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/241605/"
] | You can try with [Regionerate](http://www.rauchy.net/regionerate/docs/2007/05/download.html) :
>
> Regionerate is an automated tool which helps you to preserve your
> code's layout over time. Regionerate lets you define regions in your
> code and determine the way members (fields, methods, properties etc.)
> shoul... | I use ReSharper and their Type Member Layout. See my [post](https://stackoverflow.com/a/8599288/568266) for more details. |
8,370,926 | [StyleCop](http://stylecop.codeplex.com/) mandates a particular sort order for the contents of C# files. For example, fields should be declared before methods and public declarations should come before private ones.
It would be useful to have a Visual Studio extension to move these things into that order automatically... | 2011/12/03 | [
"https://Stackoverflow.com/questions/8370926",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/241605/"
] | You can try with [Regionerate](http://www.rauchy.net/regionerate/docs/2007/05/download.html) :
>
> Regionerate is an automated tool which helps you to preserve your
> code's layout over time. Regionerate lets you define regions in your
> code and determine the way members (fields, methods, properties etc.)
> shoul... | CodeMaid is a free and open source Visual Studio extension that will reorganize code to follow StyleCop conventions. You can find it here: <http://visualstudiogallery.msdn.microsoft.com/76293c4d-8c16-4f4a-aee6-21f83a571496>
Disclaimer: This is a totally shameless plug, I wrote it. ;) |
8,370,926 | [StyleCop](http://stylecop.codeplex.com/) mandates a particular sort order for the contents of C# files. For example, fields should be declared before methods and public declarations should come before private ones.
It would be useful to have a Visual Studio extension to move these things into that order automatically... | 2011/12/03 | [
"https://Stackoverflow.com/questions/8370926",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/241605/"
] | You can try with [Regionerate](http://www.rauchy.net/regionerate/docs/2007/05/download.html) :
>
> Regionerate is an automated tool which helps you to preserve your
> code's layout over time. Regionerate lets you define regions in your
> code and determine the way members (fields, methods, properties etc.)
> shoul... | If Code Sorting is your only concern, you can try the Visual Studio Extension [CodeSorter](https://visualstudiogallery.msdn.microsoft.com/3482faf3-5519-4df9-afb1-c66f184766ac)
>
> CodeSorter is highly customizable extension that allows its users to
> sort C# code itby various conditions such as names, types (method,... |
8,370,926 | [StyleCop](http://stylecop.codeplex.com/) mandates a particular sort order for the contents of C# files. For example, fields should be declared before methods and public declarations should come before private ones.
It would be useful to have a Visual Studio extension to move these things into that order automatically... | 2011/12/03 | [
"https://Stackoverflow.com/questions/8370926",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/241605/"
] | ReSharper can do this. It has a "Type Members Layout" feature that allows you to use either a default set of rules, or to define your own. | I use ReSharper and their Type Member Layout. See my [post](https://stackoverflow.com/a/8599288/568266) for more details. |
8,370,926 | [StyleCop](http://stylecop.codeplex.com/) mandates a particular sort order for the contents of C# files. For example, fields should be declared before methods and public declarations should come before private ones.
It would be useful to have a Visual Studio extension to move these things into that order automatically... | 2011/12/03 | [
"https://Stackoverflow.com/questions/8370926",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/241605/"
] | ReSharper can do this. It has a "Type Members Layout" feature that allows you to use either a default set of rules, or to define your own. | If Code Sorting is your only concern, you can try the Visual Studio Extension [CodeSorter](https://visualstudiogallery.msdn.microsoft.com/3482faf3-5519-4df9-afb1-c66f184766ac)
>
> CodeSorter is highly customizable extension that allows its users to
> sort C# code itby various conditions such as names, types (method,... |
8,370,926 | [StyleCop](http://stylecop.codeplex.com/) mandates a particular sort order for the contents of C# files. For example, fields should be declared before methods and public declarations should come before private ones.
It would be useful to have a Visual Studio extension to move these things into that order automatically... | 2011/12/03 | [
"https://Stackoverflow.com/questions/8370926",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/241605/"
] | CodeMaid is a free and open source Visual Studio extension that will reorganize code to follow StyleCop conventions. You can find it here: <http://visualstudiogallery.msdn.microsoft.com/76293c4d-8c16-4f4a-aee6-21f83a571496>
Disclaimer: This is a totally shameless plug, I wrote it. ;) | I use ReSharper and their Type Member Layout. See my [post](https://stackoverflow.com/a/8599288/568266) for more details. |
8,370,926 | [StyleCop](http://stylecop.codeplex.com/) mandates a particular sort order for the contents of C# files. For example, fields should be declared before methods and public declarations should come before private ones.
It would be useful to have a Visual Studio extension to move these things into that order automatically... | 2011/12/03 | [
"https://Stackoverflow.com/questions/8370926",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/241605/"
] | I use ReSharper and their Type Member Layout. See my [post](https://stackoverflow.com/a/8599288/568266) for more details. | If Code Sorting is your only concern, you can try the Visual Studio Extension [CodeSorter](https://visualstudiogallery.msdn.microsoft.com/3482faf3-5519-4df9-afb1-c66f184766ac)
>
> CodeSorter is highly customizable extension that allows its users to
> sort C# code itby various conditions such as names, types (method,... |
8,370,926 | [StyleCop](http://stylecop.codeplex.com/) mandates a particular sort order for the contents of C# files. For example, fields should be declared before methods and public declarations should come before private ones.
It would be useful to have a Visual Studio extension to move these things into that order automatically... | 2011/12/03 | [
"https://Stackoverflow.com/questions/8370926",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/241605/"
] | CodeMaid is a free and open source Visual Studio extension that will reorganize code to follow StyleCop conventions. You can find it here: <http://visualstudiogallery.msdn.microsoft.com/76293c4d-8c16-4f4a-aee6-21f83a571496>
Disclaimer: This is a totally shameless plug, I wrote it. ;) | If Code Sorting is your only concern, you can try the Visual Studio Extension [CodeSorter](https://visualstudiogallery.msdn.microsoft.com/3482faf3-5519-4df9-afb1-c66f184766ac)
>
> CodeSorter is highly customizable extension that allows its users to
> sort C# code itby various conditions such as names, types (method,... |
58,746,225 | I have been searching on why lazy, computed property, and property observer can not be (let) constant, I know for example lazy are not assigned until it is accessed, but why it can not be (let), does that mean lazy will be holding a nil value or whatever value before it's being accessed and assigned to the value we ass... | 2019/11/07 | [
"https://Stackoverflow.com/questions/58746225",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11781807/"
] | **Lazy properties** : You must always declare a lazy property as a variable (with the var keyword), because its initial value might not be retrieved until after instance initialization completes. Constant properties must always have a value before initialization completes, and therefore cannot be declared as lazy.
**c... | **Rules:-**
1. You can declare a property with either `let` or `var` keyword.
2. In swift, `let` variable must be initialized before the owner of the `let` variable is initialized.
3. Once you assign a value to the `let` variable, you can't change its value again.
**Now let's see all three types of properties one by ... |
14,294 | I have the user profile sync service setup and running; with all of it's idiosyncrasies. I am however still getting the domain\username showing up instead of the person's first and last.
I've checked the mappings for the user properties and they appear fine. There are no errors, that I can detect and nothing special ... | 2011/06/09 | [
"https://sharepoint.stackexchange.com/questions/14294",
"https://sharepoint.stackexchange.com",
"https://sharepoint.stackexchange.com/users/-1/"
] | Basically first troubleshooting step is to work out is this the sync service mucking up or SharePoint.
Is the Sync service actually putting first/last name into the Name attribute on the [users list](http://www.zimmergren.net/archive/2008/06/25/sharepoints-hidden-user-list-user-information-list.aspx)? | Under Central Admin - > User Profile Service Application - > People --> Manage User Profile - > Find your user and make sure "Name" property is NOT blank. Also make sure First Name and Last Name are also there. When "Name" property is specified, SharePoint uses it.
Also note that, Name user profile property maps to "D... |
21,345,972 | Am I using this viewholder wrong? I'm getting an NPE on line 165. Is there an obvious reason why that I'm missing? Do I need a group viewholder and a child viewholder if I'm using expandablelistview? I marked line 165 to try to make it easier on the eyes.
Thanks a lot
my expandablelistview that's getting the NPE:
``... | 2014/01/25 | [
"https://Stackoverflow.com/questions/21345972",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1409132/"
] | You have one `ViewHolder` reference in your `Adapter` for all your `Views`. This makes no sense because every View in the List has its own instance of the `ViewHolder` which you get by `View.getTag()`.
You could set an `int[]` with the positions you need as a Tag of `CheckBox`
```
int[] positions = new int[2];
... | This happens if a `Child`'s view is reusing a `Group`'s view, also the `ViewHolder` of it. Obviously, it cannot find `mCheckBox` in line 165, because it has not been set.
Simply adding a flag in `ViewHolder`, to check whether it is a `Child`'s `ViewHolder` could solve your problem. No need to have two kinds of `View... |
21,345,972 | Am I using this viewholder wrong? I'm getting an NPE on line 165. Is there an obvious reason why that I'm missing? Do I need a group viewholder and a child viewholder if I'm using expandablelistview? I marked line 165 to try to make it easier on the eyes.
Thanks a lot
my expandablelistview that's getting the NPE:
``... | 2014/01/25 | [
"https://Stackoverflow.com/questions/21345972",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1409132/"
] | I accepted Towlie288's answer because it pointed me in the right direction. Here's the code change that made everything work:
```
public class MyExpandableListAdapter extends BaseExpandableListAdapter {
private Context mContext;
private ArrayList<ContactNameItems> mListDataHeader;
private ArrayList<String... | This happens if a `Child`'s view is reusing a `Group`'s view, also the `ViewHolder` of it. Obviously, it cannot find `mCheckBox` in line 165, because it has not been set.
Simply adding a flag in `ViewHolder`, to check whether it is a `Child`'s `ViewHolder` could solve your problem. No need to have two kinds of `View... |
48,336,498 | I have an `AnsiString` and I need to convert it in the most efficient way to a `TBytes`. How can I do that ? | 2018/01/19 | [
"https://Stackoverflow.com/questions/48336498",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1114043/"
] | Assuming you want to retain the same encoding you can do this
```
SetLength(bytes, Length(ansiStr));
Move(Pointer(ansiStr)^, Pointer(bytes)^, Length(ansiStr));
```
In reverse it goes
```
SetLength(ansiStr, Length(bytes));
Move(Pointer(bytes)^, Pointer(ansiStr)^, Length(bytes));
``` | The function `BytesOf` converts an AnsiString to TBytes.
```
var
A: AnsiString;
B: TBytes;
begin
A := 'Test';
B := BytesOf(A);
// convert it back
SetString(A, PAnsiChar(B), Length(B));
end;
``` |
17,768,779 | I'm using ProtoBuf.NET to serialize/deserialize some classes. I'm finding that on deserializing, I'm getting a corrupt byte[] (extra 0's). Before you ask, yes, I need the **\*WithLengthPrefix()** versions of the ProtoBuf API since the ProtoBuf portion is at the starts of a custom stream :)
Anyway, I see
```
Original... | 2013/07/21 | [
"https://Stackoverflow.com/questions/17768779",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/862563/"
] | Here we go:
```
public Parent()
{
ByteArray = new byte[12];
}
```
Note: protobuf is designed (by google) to be both appendable and mergeable. Where append / merge is synonymous (for lists / arrays etc) with "append".
Two options (both possible via attributes):
* disable the constructor: `[ProtoContract(SkipCon... | I was facing the same issue and my `Bytestring` data was actually an XML data I get from the server, so in my application I was already having an XML `Serialaizer`, thus I decided to use that instead of introducing a new `serializer` for `Photobuf` and decorate all of my models, I found this task is very time consuming... |
39,512,283 | The code below
```
#include <iostream>
class A
{
public:
int x;
double y;
A(int x_, double y_) : x(x_), y(y_)
{
}
void display(void) const;
};
class B
{
public:
static A staticObject;
};
void A::display(void) const
{
std::cout << x << ' ' << y ... | 2016/09/15 | [
"https://Stackoverflow.com/questions/39512283",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5778994/"
] | And this is another Solution for your code, as this will work even if somebody put "`spaces` or leave it with blank" in the field of Name or Phone.
Check the Fiddle..
```js
// Bind the event handler to the "submit" JavaScript event
$('form').submit(function () {
// Get the Login Name value and trim it
va... | A simple solution would be something like this.
You can do this by using JQuery
```js
// Bind the event handler to the "submit" JavaScript event
$('form').submit(function () {
// Get the Login Name value and trim it
var name = $.trim($('#log').val());
// Check if empty of not
if (name === '') ... |
39,512,283 | The code below
```
#include <iostream>
class A
{
public:
int x;
double y;
A(int x_, double y_) : x(x_), y(y_)
{
}
void display(void) const;
};
class B
{
public:
static A staticObject;
};
void A::display(void) const
{
std::cout << x << ' ' << y ... | 2016/09/15 | [
"https://Stackoverflow.com/questions/39512283",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5778994/"
] | Try W3Schools example of
<http://www.w3schools.com/tags/att_input_required.asp>
```
<input class="form-control input-lg" name="firstname" placeholder="First Name" required >
```
with no equals or anything
I thought the required tag was
required="True/false" | A simple solution would be something like this.
You can do this by using JQuery
```js
// Bind the event handler to the "submit" JavaScript event
$('form').submit(function () {
// Get the Login Name value and trim it
var name = $.trim($('#log').val());
// Check if empty of not
if (name === '') ... |
39,512,283 | The code below
```
#include <iostream>
class A
{
public:
int x;
double y;
A(int x_, double y_) : x(x_), y(y_)
{
}
void display(void) const;
};
class B
{
public:
static A staticObject;
};
void A::display(void) const
{
std::cout << x << ' ' << y ... | 2016/09/15 | [
"https://Stackoverflow.com/questions/39512283",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5778994/"
] | And this is another Solution for your code, as this will work even if somebody put "`spaces` or leave it with blank" in the field of Name or Phone.
Check the Fiddle..
```js
// Bind the event handler to the "submit" JavaScript event
$('form').submit(function () {
// Get the Login Name value and trim it
va... | Try W3Schools example of
<http://www.w3schools.com/tags/att_input_required.asp>
```
<input class="form-control input-lg" name="firstname" placeholder="First Name" required >
```
with no equals or anything
I thought the required tag was
required="True/false" |
22,708,965 | I am learning by Hartl Tutorial and I needed to install geb bcrypt-ruby. I added it to Gemfile
```
gem 'rails', '4.0.0.rc2'
gem 'bootstrap-sass', '2.3.2.0'
gem 'sprockets', '2.11.0'
gem 'bcrypt-ruby', '3.1.2'
```
Everything seemed OK, but if I started run rspec spec/ then I got error:
>
> You don't... | 2014/03/28 | [
"https://Stackoverflow.com/questions/22708965",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1467687/"
] | Your have validation rules but You may Miss the scenario's on validate .
Check the validators on your current object model by this
```
print_r($model->validatorList);
```
refer this [link](http://www.yiiframework.com/doc/api/1.1/CModel#validatorList-detail) | You can validate a model at any time once it is created.
Let's look at the sequence of events :-
You have created a model class :
```
class User extends CActiveRecord
{
...
}
```
This creates a template for the patient class, which inherits from CActiveRecord, which means it has inherited functions available to... |
37,108,220 | ```
QElapsedTimer timer;
timer.start();
slowOperation1();
qDebug() << "The slow operation took" << timer.elapsed() << "milliseconds";
```
<http://doc.qt.io/qt-5/qelapsedtimer.html#invalidate>
After `qDebug()` I would want to stop this timer. I can't see a stop function there, nor a single shot prop... | 2016/05/09 | [
"https://Stackoverflow.com/questions/37108220",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/462608/"
] | You can't stop `QElapsedTimer`, because there is no timer. When you call method `start()`, `QElapsedTimer` saves the current time.
From [qelapsedtimer\_generic.cpp](https://github.com/qtproject/qtbase/blob/5.7/src/corelib/tools/qelapsedtimer_generic.cpp)
```
void QElapsedTimer::start() Q_DECL_NOTHROW
{
restart();... | QElapsedTimer will use the platform's monotonic reference clock in all platforms that support it. This has the added benefit that QElapsedTimer is immune to time adjustments, such as the user correcting the time. Also unlike QTime, QElapsedTimer is immune to changes in the timezone settings, such as daylight-saving per... |
37,108,220 | ```
QElapsedTimer timer;
timer.start();
slowOperation1();
qDebug() << "The slow operation took" << timer.elapsed() << "milliseconds";
```
<http://doc.qt.io/qt-5/qelapsedtimer.html#invalidate>
After `qDebug()` I would want to stop this timer. I can't see a stop function there, nor a single shot prop... | 2016/05/09 | [
"https://Stackoverflow.com/questions/37108220",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/462608/"
] | You can't stop `QElapsedTimer`, because there is no timer. When you call method `start()`, `QElapsedTimer` saves the current time.
From [qelapsedtimer\_generic.cpp](https://github.com/qtproject/qtbase/blob/5.7/src/corelib/tools/qelapsedtimer_generic.cpp)
```
void QElapsedTimer::start() Q_DECL_NOTHROW
{
restart();... | I needed an elapsed timer that wouldn't count the paused time, so here's what I came up with:
ElapsedTimer.hpp:
```
#pragma once
#include <time.h>
#include <cstdio>
#include <cstdint>
#include <cstring>
#include <errno.h>
namespace your_namespace {
class ElapsedTimer {
public:
ElapsedTimer();
~ElapsedTimer(... |
45,357,982 | I'm developing a web service cliente against a wsdl which has the following policies
```
<wsp:Policy xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702" wsu:Id="Sec... | 2017/07/27 | [
"https://Stackoverflow.com/questions/45357982",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2595859/"
] | A [TextCtrl](https://wxpython.org/Phoenix/docs/html/wx.TextCtrl.html) allows the user to type text, and copy & paste as well.
Many samples [here](https://wiki.wxpython.org/AnotherTutorial) | Using the wx.TE\_READONLY on TextCtrl creates a box where text can not be edited but can be copy-pasted
Example:
```
wx.TextCtrl(self.panel, -1, outStr , style=wx.TE_BESTWRAP|wx.TE_READONLY)
``` |
45,357,982 | I'm developing a web service cliente against a wsdl which has the following policies
```
<wsp:Policy xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702" wsu:Id="Sec... | 2017/07/27 | [
"https://Stackoverflow.com/questions/45357982",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2595859/"
] | Whilst you cannot grab the entire MessageDialog, you certainly can capture the message text. You need to click on the text to select it with your mouse or right click and choose `select all`. With the text selected, right click gives you the option to `copy`, as seen in this screen shot.
Caveats: On linux and using ... | Using the wx.TE\_READONLY on TextCtrl creates a box where text can not be edited but can be copy-pasted
Example:
```
wx.TextCtrl(self.panel, -1, outStr , style=wx.TE_BESTWRAP|wx.TE_READONLY)
``` |
64,025,453 | I'm trying to do forecast in my python 3.x. So I wrote following code
```
from statsmodels.tsa.seasonal import seasonal_decompose
decomposition = seasonal_decompose(ts_log)
trend = decomposition.trend
seasonal = decomposition.seasonal
residual = decomposition.resid
```
But I'm getting error message
```
AttributeEr... | 2020/09/23 | [
"https://Stackoverflow.com/questions/64025453",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13877190/"
] | You need to make sure that your Panda Series object `ts_log` have a DateTime index with inferred frequency.
For example:
```
ts_log.index
>>> DatetimeIndex(['2014-01-01', ... '2017-12-31'],
dtype='datetime64[ns]', name='Date', length=1461, freq='D')
```
Noticed how there's a an attribute `freq='D'`, i... | For `statsmodel==0.10.1` and where `ts_log` is not a dataframe or a dataframe without datetime index, use the following
```
decomposition = seasonal_decompose(ts_log, freq=1)
``` |
62,881,940 | I have a procedure which returns the identity of the record added. I am using Entity Framework to call the procedure and retrieve the value, but it is always 0.
This is the code - can you figure out why it is not returning the identity value?
C# Entity Framework domain code:
```
var cNumber = new SqlParameter("CNumb... | 2020/07/13 | [
"https://Stackoverflow.com/questions/62881940",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/565992/"
] | You can change the result of actions based on different options, but clients would be weird and I never see someone or a project that would do this, it will make the debug harder.
When a service works, it always should expose expected behavior, we should know when it's successful it give us a person object, when it fai... | If you are not developing microservices, usually it is not good idea having multiple result set in one endpoint. But if you need you can use [IActionResult](https://learn.microsoft.com/en-us/aspnet/core/web-api/action-return-types?view=aspnetcore-3.1#iactionresult-type) Type . With this type you don't have to declare a... |
62,881,940 | I have a procedure which returns the identity of the record added. I am using Entity Framework to call the procedure and retrieve the value, but it is always 0.
This is the code - can you figure out why it is not returning the identity value?
C# Entity Framework domain code:
```
var cNumber = new SqlParameter("CNumb... | 2020/07/13 | [
"https://Stackoverflow.com/questions/62881940",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/565992/"
] | You can change the result of actions based on different options, but clients would be weird and I never see someone or a project that would do this, it will make the debug harder.
When a service works, it always should expose expected behavior, we should know when it's successful it give us a person object, when it fai... | You can return any model you want from one endpoint by declaring return type as `Task<IActionResult>`.
Suppose you have a `CustomersController`, so `GET` endpoint will be `api/customers?clientType=client1`. Now you want customer's different information for a different based on `clientType` parameter.
```
namespace wa... |
554,121 | let $a,b,c\ge 0$,and such $abc=1$,show that
>
> $$a^2+b^2+c^2+8(ab+bc+ac)+3-10(a+b+c)\ge 0$$
>
>
>
**My solution: Without loss of generality,assume that**
>
> $a=\max{(a,b,c)}$, since $abc=1$,we have
> $a\ge 1$,
>
>
> we will show that
> $$f(a,b,c)\ge f(a,t,t)\ge 0, t=\sqrt{bc},0<t\le 1$$
>
>
> since $$f(... | 2013/11/06 | [
"https://math.stackexchange.com/questions/554121",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/58742/"
] | Let $f(x) = x^2+\dfrac8x + 1 - 10x + 16 \log x$ for $x > 0$.
Then the given inequality is $f(a)+f(b)+f(c) \ge 0$, and it is sufficient to show $f(x) \ge 0$.
We note $f'(x) = \dfrac{2(x-2)^2 (x-1)}{x^2}$.
Thus for $x < 1, f'(x)<0$ and for $x > 1, f'(x) \ge 0$. Hence $\forall x >0, \; f(x) \ge f(1) = 0$. | Let $a+b+c=3u$, $ab+ac+bc=3v^2$ and $abc=w^3$.
Hence, our inequality is a linear inequality of $v^2$, which says that
it's remains to prove the last inequality for an extremal value of $v^2$,
which happens for equality case of two variables.
Let $b=a$ and $c=\frac{1}{a^2}$.
Hence, we need to prove that
$$(a-1)^2(... |
38,414,451 | I do not understand why the input text is slightly offset to bottom when rendered in IOS simulator and in Browser is positioned right.
The code is very simple:
```
<ion-nav-title>
<div class="bar bar-header item-input-inset">
<label class="item-input-wrapper">
<i class="icon ion-ios-search pla... | 2016/07/16 | [
"https://Stackoverflow.com/questions/38414451",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/523384/"
] | The header-bar shouldn't be inside a ion-nav-title. Actually if you use a div with class="bar header-bar" you could declare a title inside using class="title". For example:
```
<div class="bar bar-header bar-light">
<h1 class="title">bar-light</h1>
</div>
```
Removing the ion-nav-title tag should fix the issue. | Just change the ion-nav-title to ion-nav-bar |
1,951,971 | is it not good to use !important in favor of accessibility? How and where use of !important can create problem for site user? | 2009/12/23 | [
"https://Stackoverflow.com/questions/1951971",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/84201/"
] | The `!important` CSS rule has no impact on the users' perceived accessibility.
The only argument against `!important` is code readability/maintainability, as such rules tend to make stylesheets more complicated. As you only have two degree of "importance" (with/without `!important`), you might get yourself into a worl... | It does not create accessibility issues, as `!important` declarations can be overwritten with another `!important` declaration in user's own stylesheet. |
1,951,971 | is it not good to use !important in favor of accessibility? How and where use of !important can create problem for site user? | 2009/12/23 | [
"https://Stackoverflow.com/questions/1951971",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/84201/"
] | The `!important` CSS rule has no impact on the users' perceived accessibility.
The only argument against `!important` is code readability/maintainability, as such rules tend to make stylesheets more complicated. As you only have two degree of "importance" (with/without `!important`), you might get yourself into a worl... | I usually use this keyword when i am changing the theme of a site made with a cms like joomla or wordpress to overwrite their styles.
It has nothing to do with accessibility. |
1,951,971 | is it not good to use !important in favor of accessibility? How and where use of !important can create problem for site user? | 2009/12/23 | [
"https://Stackoverflow.com/questions/1951971",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/84201/"
] | I usually use this keyword when i am changing the theme of a site made with a cms like joomla or wordpress to overwrite their styles.
It has nothing to do with accessibility. | It does not create accessibility issues, as `!important` declarations can be overwritten with another `!important` declaration in user's own stylesheet. |
14,377,291 | I am new to android apps testing. I have downloaded a free android apps (.apk file) and like to test that android application.
What I did, I have installed that **.apk** file in command prompt using this cmd
**" adb install .apk "** File got installed then I have tested the app in an emulator.
But I want to know how ... | 2013/01/17 | [
"https://Stackoverflow.com/questions/14377291",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1986790/"
] | Please check the Android Developers site [here](http://developer.android.com/intl/ja/tools/testing/testing_android.html) for "How to test `android` Applications". First you have to know the [tools](http://www.vogella.com/articles/AndroidTesting/article.html) of `testing` and how the testing structure would be... | Another option is to use a service like AWS Device Farm, Firebase, or Nativetap. FULL DISCLOSURE - I work with [Nativetap](http://nativetap.io).
All of the services mentioned above allow you to perform testing on Android devices remotely, while only Nativetap allows you to perform that testing with multitouch support,... |
14,377,291 | I am new to android apps testing. I have downloaded a free android apps (.apk file) and like to test that android application.
What I did, I have installed that **.apk** file in command prompt using this cmd
**" adb install .apk "** File got installed then I have tested the app in an emulator.
But I want to know how ... | 2013/01/17 | [
"https://Stackoverflow.com/questions/14377291",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1986790/"
] | Please check the Android Developers site [here](http://developer.android.com/intl/ja/tools/testing/testing_android.html) for "How to test `android` Applications". First you have to know the [tools](http://www.vogella.com/articles/AndroidTesting/article.html) of `testing` and how the testing structure would be... | Basically, Android app testing is an important part of all software testing cycles. Every app should run properly without any trouble on various devices and operating systems. To make sure that this is possible, android app testing should be planned and executed effectively with full accuracy.
Here are some basic type... |
45,174,225 | I have 3 labels, A, B, and Z. A & B both have a relationship to Z. I want to find all the A nodes that do not have share any of nodes Z in common with B
Currently, doing a normal query where the relationship DOES exist, works.
```
MATCH (a:A)-[:rel1]->(z:Z)<-[:rel2]-(b:B { uuid: {<SOME ID>} })
RETURN DISTINCT a
```
... | 2017/07/18 | [
"https://Stackoverflow.com/questions/45174225",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4629572/"
] | This is a problem to do with the scope of your query. When you describe a node in a `MATCH` clause like the below
```
MATCH (n:SomeLabel)
```
You're telling cypher to look for a node with the label `SomeLabel`, and assign it to the variable `n` in the rest of the query, and at the end of the query, you can return th... | You get the error because z is the identifier of a node that you are using in a where clause that you have not yet identified.
Since you know **b** already I would match it first and then use it in your where clause. You don't need to assign `:Z` an identifier, simply using the node label will suffice.
```
MATCH (b:... |
44,457,677 | I have been reading about progressive web app for now, pwa uses service worker for offline caching to speed up performance. But why i cant we use localstorage for the same purpose as service worker? so that if we didnt get response from api request we can load the data from local storage. And normal browser cache for t... | 2017/06/09 | [
"https://Stackoverflow.com/questions/44457677",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4226090/"
] | first of all, a service worker runs on a different thread then the main application. that's why you could use a service worker for improved performance since, it's operations won't affect your main application.
You can use the localstorage for storing data on the client side, but you can't use it for offline caching. ... | you absolutely can use localStorage to mimic the caching features offered in service workers. I started doing this about 6-7 years ago.
<https://love2dev.com/blog/use-local-storage-to-make-your-single-page-web-application-rock/>
However, I would advise against localStorage as your caching provider. Instead use IndexedD... |
12,247,004 | I have an ActiveRecord model called `Books` which has a `has_one` association on `authors` and a `has_many` association on `publishers`. So the following code is all good
`books`.`publishers`
Now I have another AR model, `digital_publishers` which is similar but which I would like to transparently use if the book's a... | 2012/09/03 | [
"https://Stackoverflow.com/questions/12247004",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/277668/"
] | I need more information about the project to really make a recommendation, but here are some thoughts to consider:
### 1. Publishers shouldn't belong to books
I'm guessing a publisher may be linked to more than one book, so it doesn't make a lot of sense that they belong\_to books. I would consider
```
#Book.rb
has... | Have a look at this [section](http://guides.rubyonrails.org/v2.3.11/activerecord_validations_callbacks.html#after-initialize-and-after-find) from Rails Guides v-2.3.11. In particular note the following:
>
> The after\_initialize and after\_find callbacks are a bit different from the others. They have no before\_\* co... |
12,247,004 | I have an ActiveRecord model called `Books` which has a `has_one` association on `authors` and a `has_many` association on `publishers`. So the following code is all good
`books`.`publishers`
Now I have another AR model, `digital_publishers` which is similar but which I would like to transparently use if the book's a... | 2012/09/03 | [
"https://Stackoverflow.com/questions/12247004",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/277668/"
] | I need more information about the project to really make a recommendation, but here are some thoughts to consider:
### 1. Publishers shouldn't belong to books
I'm guessing a publisher may be linked to more than one book, so it doesn't make a lot of sense that they belong\_to books. I would consider
```
#Book.rb
has... | My solution is very simple.
```
class Book < ActiveRecord::Base
has_many :normal_publishers, :class_name => 'Publisher'
has_many :digital_publishers, :class_name => 'DigitalPublisher'
def publishers
if self.digital?
self.digital_publishers
else
self.normal_publishe... |
67,899,717 | I need to allow a user to write expressions and build XML tree from the expression. My plan is to use `math.js` which parses and generates an [expression tree](https://mathjs.org/docs/expressions/expression_trees.html#expression-trees), **then convert that expression tree into DOM tree**, and then convert DOM tree into... | 2021/06/09 | [
"https://Stackoverflow.com/questions/67899717",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2545680/"
] | You can extend the node object with a custom property like `DOM` and append children to the `DOM` of the parent node:
```js
const node = math.parse('sqrt(2 + x)')
node.traverse(function(node, path, parent) {
switch (node.type) {
case 'FunctionNode':
node.DOM = document.createElement('div')
b... | I managed to solve it like this using `forEach` method available on each node and `stack` idea from the `HAST/JSX` conversion code I referenced in my question:
```
const parent = new DocumentFragment();
const stack = [];
function _traverse(node, buildDomNode, dom) {
// this is equivalent to `enter` callback
s... |
5,602,559 | I am running ubuntu, and I don't have a .bash\_profile.
So my question is, where exactly is my python path set then?
How can I see what the current python path is, doing:
```
$PYTHON_PATH
```
doesn't return anything? | 2011/04/09 | [
"https://Stackoverflow.com/questions/5602559",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39677/"
] | It's set by the `site` module, and the interpreter executable itself. `sys.path` contains the current value. | You can see your python path in python like so:
```
>> import sys
>> print sys.path
``` |
5,602,559 | I am running ubuntu, and I don't have a .bash\_profile.
So my question is, where exactly is my python path set then?
How can I see what the current python path is, doing:
```
$PYTHON_PATH
```
doesn't return anything? | 2011/04/09 | [
"https://Stackoverflow.com/questions/5602559",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39677/"
] | It's set by the `site` module, and the interpreter executable itself. `sys.path` contains the current value. | `echo $PYTHONPATH` /etc/profile and /etc/bashrc are the global setting files bash scans before looking in your home directory at start up. It's also safe to create a .bash\_profile if one doesn't exist.
Normally PYTHONPATH is empty anyways. |
5,602,559 | I am running ubuntu, and I don't have a .bash\_profile.
So my question is, where exactly is my python path set then?
How can I see what the current python path is, doing:
```
$PYTHON_PATH
```
doesn't return anything? | 2011/04/09 | [
"https://Stackoverflow.com/questions/5602559",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39677/"
] | It's set by the `site` module, and the interpreter executable itself. `sys.path` contains the current value. | you can create a .bash\_profile with your favorite editor, and put into it:
```
export PYTHONPATH=$HOME/lib/python
```
or whatever, that's one example. |
5,602,559 | I am running ubuntu, and I don't have a .bash\_profile.
So my question is, where exactly is my python path set then?
How can I see what the current python path is, doing:
```
$PYTHON_PATH
```
doesn't return anything? | 2011/04/09 | [
"https://Stackoverflow.com/questions/5602559",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39677/"
] | You can see your python path in python like so:
```
>> import sys
>> print sys.path
``` | `echo $PYTHONPATH` /etc/profile and /etc/bashrc are the global setting files bash scans before looking in your home directory at start up. It's also safe to create a .bash\_profile if one doesn't exist.
Normally PYTHONPATH is empty anyways. |
5,602,559 | I am running ubuntu, and I don't have a .bash\_profile.
So my question is, where exactly is my python path set then?
How can I see what the current python path is, doing:
```
$PYTHON_PATH
```
doesn't return anything? | 2011/04/09 | [
"https://Stackoverflow.com/questions/5602559",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39677/"
] | You can see your python path in python like so:
```
>> import sys
>> print sys.path
``` | you can create a .bash\_profile with your favorite editor, and put into it:
```
export PYTHONPATH=$HOME/lib/python
```
or whatever, that's one example. |
5,602,559 | I am running ubuntu, and I don't have a .bash\_profile.
So my question is, where exactly is my python path set then?
How can I see what the current python path is, doing:
```
$PYTHON_PATH
```
doesn't return anything? | 2011/04/09 | [
"https://Stackoverflow.com/questions/5602559",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39677/"
] | you can create a .bash\_profile with your favorite editor, and put into it:
```
export PYTHONPATH=$HOME/lib/python
```
or whatever, that's one example. | `echo $PYTHONPATH` /etc/profile and /etc/bashrc are the global setting files bash scans before looking in your home directory at start up. It's also safe to create a .bash\_profile if one doesn't exist.
Normally PYTHONPATH is empty anyways. |
53,034 | >
> Whatever I have up till now accepted as most true and assured I have gotten either from the senses or through the senses.
>
>
>
What does this sentence mean? I can't find the main verb here. | 2015/03/18 | [
"https://ell.stackexchange.com/questions/53034",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/8947/"
] | >
> "You know," I ventured, "when I saw you perform, I got the feeling
> that singing lets you jump over the fences of your life the way
> writing does for me."
>
>
>
I got the feeling = the vaguely-defined idea came into my head
singing lets you jump over = singing allows you to surmount/overcome
the fences o... | * Singing lets you jump over the fences of your life. Writing lets me jump over the fences of my life.
* Singing lets you jump over the fences of your life [in] the way [that] writing lets me jump over the fences of my life.
There is a lot of ellipsis in the original sentence which my examples above might help clarif... |
32,390,361 | ```
public class MainActivity extends Activity {
ImageView image;
Activity context;
Preview preview;
static Camera camera;
Button exitButton;
ImageView fotoButton;
LinearLayout progressLayout;
String path = "/sdcard/KutCamera/cache/images/";
public static int count = 0;
@Overri... | 2015/09/04 | [
"https://Stackoverflow.com/questions/32390361",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5051487/"
] | same issue i was facing but using this code its work for me try this code:
```
Bitmap bmp = BitmapFactory.decodeByteArray(data, 0, data.length);
Matrix matrix = new Matrix();
matrix.postRotate(90);
Bitmap bitmapFinal=null;
bitmapFinal = Bitmap.creat... | Please try the below code to rotate change image orientation
```
URI imageUri = data.getData();
ExifInterface ei = new ExifInterface(getRealPathFromURI(imageUri));
int orientation = ei.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL);
// float angle = 0;
switch (orientation) {
case Ex... |
32,390,361 | ```
public class MainActivity extends Activity {
ImageView image;
Activity context;
Preview preview;
static Camera camera;
Button exitButton;
ImageView fotoButton;
LinearLayout progressLayout;
String path = "/sdcard/KutCamera/cache/images/";
public static int count = 0;
@Overri... | 2015/09/04 | [
"https://Stackoverflow.com/questions/32390361",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5051487/"
] | same issue i was facing but using this code its work for me try this code:
```
Bitmap bmp = BitmapFactory.decodeByteArray(data, 0, data.length);
Matrix matrix = new Matrix();
matrix.postRotate(90);
Bitmap bitmapFinal=null;
bitmapFinal = Bitmap.creat... | please try below rotate function just pass your bitmap and angle
```
public static Bitmap rotate(Bitmap source, float angle) {
Matrix matrix = new Matrix();
matrix.postRotate(angle);
return Bitmap.createBitmap(source, 0, 0, source.getWidth(),
source.getHeight(), matrix, false);
... |
32,390,361 | ```
public class MainActivity extends Activity {
ImageView image;
Activity context;
Preview preview;
static Camera camera;
Button exitButton;
ImageView fotoButton;
LinearLayout progressLayout;
String path = "/sdcard/KutCamera/cache/images/";
public static int count = 0;
@Overri... | 2015/09/04 | [
"https://Stackoverflow.com/questions/32390361",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5051487/"
] | same issue i was facing but using this code its work for me try this code:
```
Bitmap bmp = BitmapFactory.decodeByteArray(data, 0, data.length);
Matrix matrix = new Matrix();
matrix.postRotate(90);
Bitmap bitmapFinal=null;
bitmapFinal = Bitmap.creat... | save image in local syatem
```
public static void saveImageTolacal(Bitmap bitmapImage,Context context){
// String path = "/sdcard";
String path = Environment.getExternalStorageDirectory().getPath() + "/folder/";
FileOutputStream fos = null;
Calendar c = Calendar.getInstanc... |
32,390,361 | ```
public class MainActivity extends Activity {
ImageView image;
Activity context;
Preview preview;
static Camera camera;
Button exitButton;
ImageView fotoButton;
LinearLayout progressLayout;
String path = "/sdcard/KutCamera/cache/images/";
public static int count = 0;
@Overri... | 2015/09/04 | [
"https://Stackoverflow.com/questions/32390361",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5051487/"
] | same issue i was facing but using this code its work for me try this code:
```
Bitmap bmp = BitmapFactory.decodeByteArray(data, 0, data.length);
Matrix matrix = new Matrix();
matrix.postRotate(90);
Bitmap bitmapFinal=null;
bitmapFinal = Bitmap.creat... | ```
ExifInterface exif;
try {
exif = new ExifInterface(getRealPathFromURI(imageUri));
int orientation = exif.getAttributeInt(
ExifInterface.TAG_ORIENTATION, 0);
Log.d("EXIF", "Exif: " + orientation);
Matrix matrix = new Matrix();
... |
49,106,931 | I can manually update label and entry if i clicked the manual button, but if i clicked the auto button... the console show the random number but the widgets are not updating.
```
from tkinter import *
import random
import time
def manual_settxt():
for t in range(0,3):
rd = random.randrange(1,100)
... | 2018/03/05 | [
"https://Stackoverflow.com/questions/49106931",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4138151/"
] | You created an infinite loop. Delete `while True`.
I refactored some code: used Thread for non-blocking functionality.
Try this
```
from tkinter import *
import random
import time
from threading import Thread
def manual_settxt():
for index in range(3):
rd = random.randrange(1,100)
labelWidgets[in... | I use "root.after" and the script seems to be working fine.
```
from tkinter import *
import random
import time
def manual_settxt():
for index in range(3):
rd = random.randrange(1,100)
labelWidgets[index].configure(text=rd)
entryWidgets[index].delete(0,END)
entryWidgets[index].inse... |
15,533 | When I was still in Okinawa I learned how to say "cheers" / "乾杯{かんぱい}".
You can either say just **karii** or you can use the extended version I pefer **karii sabira**.
My question is how to write it? I have found things saying katakana is best and others saying hiragana is best, but I'm also not sure the best way to ... | 2014/04/22 | [
"https://japanese.stackexchange.com/questions/15533",
"https://japanese.stackexchange.com",
"https://japanese.stackexchange.com/users/125/"
] | As far as I know, there's nothing like the Joyo list for Okinawan, so there's no "right" way in that sense. Ryukyu University is probably the closest thing to an authority in this area; I'm pretty sure they would write "カリー サビラ" (note space!). I couldn't find it in their Shuri-Naha dialect dictionary, but they did have... | Well, I guess the best advisor will be Google. (I'm using exact seach here)
かりいさびら - 24 hits
かりーさびら - 102 000 hits
カリイサビラ - 1 810 hits
カリーサビラ - 794 hits
嘉例さびら - 554 hits
佳例さびら - 3 hits
So judging from the Google opinion - かりーさびら is your choise. |
1,354,918 | Can I use a Samsung 970 EVO 500GB NVMe PCIe M.2 2280 SSD in an Asus H170 Pro Gaming Motherboard? The user guide seems to be unclear. If so, will I get full speeds of the SSD or will they be limited? | 2018/09/03 | [
"https://superuser.com/questions/1354918",
"https://superuser.com",
"https://superuser.com/users/940334/"
] | Yes.
M.2 is the socket for NVMe SSDs, 2280 indicates the physical size of the SSD (your board must support it so screws align).
[Your board](https://www.asus.com/ca-en/Motherboards/H170-PRO-GAMING/specifications/) has this matching storage option: `1 x M.2 Socket 3, with M Key, type 2242/2260/2280/22110 storage devi... | NVMe is not sata III .the manual for the h170-pro says nothing about the NVMe being compatible with the h170-pro board only sata III. so far that i know asus has no updated drivers for the m.2 NVMe ssd |
4,426,879 | I have the following handler of WndProc in my form. It should prevent moving the form horizontally (allowing to move only vertically):
```
protected override void WndProc(ref System.Windows.Forms.Message m)
{
if (!ShowCaption && m.Msg == 0x216)
{ // Trap WM_MOVING
var rc = (RECT)Marshal.PtrToStructure... | 2010/12/13 | [
"https://Stackoverflow.com/questions/4426879",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/188826/"
] | I tried your code, and it works well. It didn't saturated 100% CPU as you said, only took ~16%.
I suppose that what is taking a long time to process, is the drawing of your form, or the drawing of your background windows (and not the wndproc implementation).
Try limiting the amount of redraws that your form can do p... | You could just swallow the message if you don't call base.WndProc in your If block
```
if (!ShowCaption && m.Msg == 0x216)
{
// Trap WM_MOVING
}
else
{
base.WndProc(ref m);
}
```
Another solution (works quite well but somethimes flickers)
```
public partial class Form1 : Form
{
private int initialX;
... |
372,248 | Categorizing [condensed matter physics](https://en.wikipedia.org/wiki/Condensed_matter_physics) and [statistical mechanics](https://en.wikipedia.org/wiki/Statistical_mechanics)? How does one differentiate between these two?
Can statistical mechanics be considered as a particular sub-field in condensed matter physics? ... | 2017/12/03 | [
"https://physics.stackexchange.com/questions/372248",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/137845/"
] | So physics is often all in one big dialogue with each other and these distinctions are much more nebulous than one would like, but there has been an informal classification where there are a bunch of subfields: condensed-matter physicists are very different from particle physicists, who are very different from biophysi... | Complementing CR Drost's [answer](https://physics.stackexchange.com/a/372318/75633), with respect to the question:
>
> How about complex and non-linear systems? Chaos theory? Are they considered a field in condensed matter physics as well?
>
>
>
No, certainly not.
Chaos Theory is part of Dynamical Systems theory... |
68,913,197 | In a css file of an asp.net Blazor app when I use `::deep` VS emits a warning "Validation (CSS 4.0): "::deep" is not a valid pseudo-element." That might be true for regular CSS, but not in the context of a Blazor app.
Is there a way to suppress it? `Right-click -> Suppress -> In File / In Source` do nothing. | 2021/08/24 | [
"https://Stackoverflow.com/questions/68913197",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/924869/"
] | You can add `deep` to the vendor specific extensions.
I've added it to the Microsoft extension and it works.
Open with an editor (in Administrator mode) the file:
**C:\Program Files (x86)\Microsoft Visual Studio\2019\<your version>\Common7\IDE\Extensions\Microsoft\Web Tools\Languages\Schemas\CSS\1033\css-vendor-... | For Resharper users, editing the css-vendor-ms.xml is needed but does not completely solve the issue. Resharper will continue to highlight ::deep elements as errors in your solution. This is [currently a known bug](https://youtrack.jetbrains.com/issue/RIDER-62195), which will hopefully be resolved in a future build.
A... |
68,913,197 | In a css file of an asp.net Blazor app when I use `::deep` VS emits a warning "Validation (CSS 4.0): "::deep" is not a valid pseudo-element." That might be true for regular CSS, but not in the context of a Blazor app.
Is there a way to suppress it? `Right-click -> Suppress -> In File / In Source` do nothing. | 2021/08/24 | [
"https://Stackoverflow.com/questions/68913197",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/924869/"
] | You can add `deep` to the vendor specific extensions.
I've added it to the Microsoft extension and it works.
Open with an editor (in Administrator mode) the file:
**C:\Program Files (x86)\Microsoft Visual Studio\2019\<your version>\Common7\IDE\Extensions\Microsoft\Web Tools\Languages\Schemas\CSS\1033\css-vendor-... | This has now been fixed as of the latest preview version of Visual Studio 2022:
<https://developercommunity.visualstudio.com/t/Support-::deep-in-razorcss-CSS-isolati/1623976>
I just downloaded 17.3 and my project is now down to zero warnings again! Look forward to it being released properly. |
15,189,175 | Hi I am using this code
```
View v= inflater.inflate(R.layout.mylayout, null, false);
int width=v.getWidth();
int height=v.getHeight();
```
but the height and width returns zero, Why is it not working , how to get the height and widht of my view. Thanks in advance | 2013/03/03 | [
"https://Stackoverflow.com/questions/15189175",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | you can sum up the ip list by
```
ip = Enumerable.Range(0, g.Select(a => a.ip.Length).Max()).Select(idx => g.Select(a => a.ip.ElementAtOrDefault(idx)).Sum()).ToList()
``` | It can be done using `SelectMany` and `GroupBy`:
```
List<p> distinctmerge = pList
.GroupBy(t => t.name)
.Select(g => new p
{
name = g.Select(a => a.name).FirstOrDefault(),
sum = g.Sum(a => a.sum),
ip = g.SelectMany(a => a.ip.S... |
9,124,733 | The code given below shows a Stackoverflow error when run.But if I make another class CarChange to create objects of Car ,it runs sucessfully. I am a beginner ,doing this code to understand the importance of upcasting in java.
```
public class Car {
int i;
Car[] c=new Car[2];
Car() {
c[0] = new P... | 2012/02/03 | [
"https://Stackoverflow.com/questions/9124733",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1120524/"
] | A stackoverflow usually means you have an infinite loop.
The reason you're receiving this is because you're calling drive from the testdrive method and in that method you're calling drive again. | It sounds like you might have some infinite recursion happening.
`drive()` calls `testdrive()` which `class drive()` which calls `testdriver()`...forever, or until you run out of memory, hence your stack overflow error. |
9,124,733 | The code given below shows a Stackoverflow error when run.But if I make another class CarChange to create objects of Car ,it runs sucessfully. I am a beginner ,doing this code to understand the importance of upcasting in java.
```
public class Car {
int i;
Car[] c=new Car[2];
Car() {
c[0] = new P... | 2012/02/03 | [
"https://Stackoverflow.com/questions/9124733",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1120524/"
] | A stackoverflow usually means you have an infinite loop.
The reason you're receiving this is because you're calling drive from the testdrive method and in that method you're calling drive again. | ```
Car() {
c[0] = new Polo();
i=0;
}
```
As Polo is a subclass of *Car()* - it must be to fit in the *Car[]* - it will call the *Car*'s constructor when being constructed itself. The *Car* constructor tries to create a new *Polo()*.
As Polo is a subclass of *Car()* - it must be to fit in the *Car[]* - it w... |
46,125,997 | I have a dict file that looks like this:
```
my_dict={0: 'XYZ', 1: 'XYZ', 2: 'XYZ', 3: 'XYZ', 4: 'XYZ', 5: 'XYZ', 6: 'XYZ', 7: 'XYZ', 8: 'XYZ', 9: 'XYZ', 10:'XYZ',11:'XYZ',12:'XYZ',13:'XYZ',14:'XYZ'}
```
I am trying to print every third key from the dict and also print the accompanying value.
So my desire output wo... | 2017/09/09 | [
"https://Stackoverflow.com/questions/46125997",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8582375/"
] | You could try
```
for i in range(0, len(my_dict), 3):
print("{}-{} {}".format(i, i+2, my_dict[i]))
```
but it depends on the contents of `my_dict` actually being as described! | This is how I would do it.
First I'd convert the dict into a list:
```
my_list = [(value, s) for value, s in my_dict.iteritems()]
sorted_list = sorted(my_list, key= lambda tup: tup[0])
shifted = sorted_list[2:]
# every 3rd
small_value = shorted_list[::3]
large_value = shifted[::3]
zip_values = zip(small_value, lar... |
46,125,997 | I have a dict file that looks like this:
```
my_dict={0: 'XYZ', 1: 'XYZ', 2: 'XYZ', 3: 'XYZ', 4: 'XYZ', 5: 'XYZ', 6: 'XYZ', 7: 'XYZ', 8: 'XYZ', 9: 'XYZ', 10:'XYZ',11:'XYZ',12:'XYZ',13:'XYZ',14:'XYZ'}
```
I am trying to print every third key from the dict and also print the accompanying value.
So my desire output wo... | 2017/09/09 | [
"https://Stackoverflow.com/questions/46125997",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8582375/"
] | Another solution could be like so:
```
my_list = [(value, s) for value, s in my_dict.iteritems()]
sorted_list = sorted(my_list, key= lambda tup: tup[0])
for index, value in sorted_list[2::3]:
out_string = '{}-{} {}'.format(index-2, index, value)
print out_string
``` | This is how I would do it.
First I'd convert the dict into a list:
```
my_list = [(value, s) for value, s in my_dict.iteritems()]
sorted_list = sorted(my_list, key= lambda tup: tup[0])
shifted = sorted_list[2:]
# every 3rd
small_value = shorted_list[::3]
large_value = shifted[::3]
zip_values = zip(small_value, lar... |
31,257,613 | Using a REST approach I want to be able to save more than one model in a single action.
```
class MyController extends ActiveController {
public $modelClass = 'models\MyModel';
}
class MyModel extends ActiveRecord {
...
}
```
That automagically creates actions for a REST api. The problem is that I want to sav... | 2015/07/06 | [
"https://Stackoverflow.com/questions/31257613",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4926588/"
] | **ActiveController** implements a common set of basic actions for supporting **RESTful access to ActiveRecord**. For more advanced use you will need to override them or just merge to them your own custom actions where you will be implementing your own code & logic.
Check in your app the `/vendor/yiisoft/yii2/rest/` fo... | So if I understand you wish to add a new database entry not only for the model you are querying, but for another model.
The best place to do this would be in the AfterSave() or BeforeSave() functions of the first model class. Which one would depend on the data you are saving. |
949,780 | Although having studied calculus of variations and lagrangian mechanics, something I've never felt that I've fully justified in my mind is why the lagrangian is a function of position and velocity?
My understanding is that the lagrangian characterises the dynamics of a system in its evolution from one configuration a... | 2014/09/28 | [
"https://math.stackexchange.com/questions/949780",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/172151/"
] | The simplest reason for why we can do that is because
Given a function $f(x)$, if we can write it as $f(x,y)$ where $y = y(x)$, we can apply the identity $$ df = \frac {\partial{f}} {\partial{x}} dx + \frac {\partial{f}} {\partial{y}} dy$$
The derivation of this identity never makes the assumption that $x$ and $y$ ha... | As this would be too long as a comment let me try to answer.
"As such, before invoking any variational principles, we are able to treat position, $q(t)$ and velocity, $\dot q(t)$ as independent variables."
No, I don't think so because by $\dot q(t)=$ is the time derivative of $q$, which is the only degree of freedom... |
16,944,216 | I've managed to write the following piece of code:
```
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main()
{
string sentence;
getline(cin, sentence);
char* ptr = &sentence[0];
while ( *ptr != '\0' ){
if ( *ptr == ' ' ){
cout << endl;
}... | 2013/06/05 | [
"https://Stackoverflow.com/questions/16944216",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2362377/"
] | You want to copy that in a vector:
```
istringstream iss(sentence);
vector<string> tokens;
copy(istream_iterator<string>(iss),
istream_iterator<string>(),
back_inserter<vector<string> >(tokens));
``` | This is actually very straight-forward. You need to set up a loop that will run while input is being taken. For each iteration you should then `push_back` to the vector the new string:
```
#include <iostream>
#include <vector>
#include <string>
int main()
{
std::vector<std::string> words;
std::string word;
... |
2,208,649 | i want to know the string matching algorithms used by Apache Lucene. i have been going through the index file format used by lucene given [here](http://lucene.apache.org/java/2_4_0/fileformats.html). it seems that lucene stores all words occurring in the text as is with their frequency of occurrence in each document.
b... | 2010/02/05 | [
"https://Stackoverflow.com/questions/2208649",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/161628/"
] | The basic design of Lucene uses exact string matches, or defines equivalent strings using an [Analyzer](http://lucene.apache.org/java/3_0_0/api/core/org/apache/lucene/analysis/Analyzer.html). An analyzer breaks text into indexable tokens. During this process, it may collate equivalent strings (e.g. upper and lower case... | As you pointed out Lucene stores only list of terms that occured in documents. How Lucene extracts these words is up to you. Default lucene analyzer simply breaks the words separated by spaces. You could write your own implementation that, for example for source string 'iamrohitbanga' yields 5 tokens: 'iamrohitbanga', ... |
2,208,649 | i want to know the string matching algorithms used by Apache Lucene. i have been going through the index file format used by lucene given [here](http://lucene.apache.org/java/2_4_0/fileformats.html). it seems that lucene stores all words occurring in the text as is with their frequency of occurrence in each document.
b... | 2010/02/05 | [
"https://Stackoverflow.com/questions/2208649",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/161628/"
] | As Yuval explained, in general Lucene is geared at exact matches (by normalizing terms with analyzers at both index and query time).
In the Lucene trunk code (not any released version yet) there is in fact suffix tree usage for inexact matches such as Regex, Wildcard, and Fuzzy.
The way this works is that a Lucene te... | As you pointed out Lucene stores only list of terms that occured in documents. How Lucene extracts these words is up to you. Default lucene analyzer simply breaks the words separated by spaces. You could write your own implementation that, for example for source string 'iamrohitbanga' yields 5 tokens: 'iamrohitbanga', ... |
5,549,838 | How do I get what is being written by log4j in central class which monitors all log4j logs in the application?
Thanks
Edit: I wish I would not have to read it from the log file since it would use more resources | 2011/04/05 | [
"https://Stackoverflow.com/questions/5549838",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/92735/"
] | You can implement your own [Appender](http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/Appender.html) and copy all logs on it using the normal config:
```
log4j.rootLogger=WARN, file, other
log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.File=${catalina.home}/logs/log.log
log4... | By providing log4j configuration that outputs log messages into a file or any other location. |
5,549,838 | How do I get what is being written by log4j in central class which monitors all log4j logs in the application?
Thanks
Edit: I wish I would not have to read it from the log file since it would use more resources | 2011/04/05 | [
"https://Stackoverflow.com/questions/5549838",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/92735/"
] | maybe your requirement is same with me. I just write a relevant class to realize it.
```
public class FixedBufferAppender extends AppenderSkeleton {
private LimitTailSizeList ll;
public FixedBufferAppender(PatternLayout layOut, int size) {
this.layout = layOut;
ll = new LimitTailSizeList(size)... | By providing log4j configuration that outputs log messages into a file or any other location. |
5,549,838 | How do I get what is being written by log4j in central class which monitors all log4j logs in the application?
Thanks
Edit: I wish I would not have to read it from the log file since it would use more resources | 2011/04/05 | [
"https://Stackoverflow.com/questions/5549838",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/92735/"
] | You can implement your own [Appender](http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/Appender.html) and copy all logs on it using the normal config:
```
log4j.rootLogger=WARN, file, other
log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.File=${catalina.home}/logs/log.log
log4... | maybe your requirement is same with me. I just write a relevant class to realize it.
```
public class FixedBufferAppender extends AppenderSkeleton {
private LimitTailSizeList ll;
public FixedBufferAppender(PatternLayout layOut, int size) {
this.layout = layOut;
ll = new LimitTailSizeList(size)... |
39,696,470 | I'm trying to get count of two set of data which is listed under same table name, with specific date range.
Table 'Event'
```
u_id event Create
123 F_log 25-Sep-16
127 C_log 25-Sep-16
123 F_log 25-Sep-16
126 F_log 25-Sep-16
185 M_log 25-Sep-16
146 D_log 25-Sep-16
173 F_log 26-Sep-16
183 C_log 26-Se... | 2016/09/26 | [
"https://Stackoverflow.com/questions/39696470",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6880623/"
] | It's actually a warning and not an error but because of the `-Werror` flag you see it as an error.
Long story short, if you use the variable it won't return the error anymore.
```
#include <stdio.h>
#include <cs50.h>
int main(void)
{
printf("How long is your shower?\n");
int time = GetInt();
float flow... | Seems legit, you are not using the variable anywhere. Try printing it out;
```
printf("%.2f", flow);
``` |
39,696,470 | I'm trying to get count of two set of data which is listed under same table name, with specific date range.
Table 'Event'
```
u_id event Create
123 F_log 25-Sep-16
127 C_log 25-Sep-16
123 F_log 25-Sep-16
126 F_log 25-Sep-16
185 M_log 25-Sep-16
146 D_log 25-Sep-16
173 F_log 26-Sep-16
183 C_log 26-Se... | 2016/09/26 | [
"https://Stackoverflow.com/questions/39696470",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6880623/"
] | `flow` isn't used by your program - it is not involved in any side effects, you just assign a value to it and discard it. Good compilers warn against such unused variables.
By using `-Werror` you turned the warning into an error. | Seems legit, you are not using the variable anywhere. Try printing it out;
```
printf("%.2f", flow);
``` |
13,698,352 | I have a network of nodes created using python `networkx`. i want to store information in nodes such that i can access the information later based on the node label (the name of the node) and the field that in which the information has been stored (like node attributes). the information stored can be a string or a numb... | 2012/12/04 | [
"https://Stackoverflow.com/questions/13698352",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1295112/"
] | As you say, it's just a matter of adding the attributes when adding the nodes to the graph
```python
G.add_node('abc', dob=1185, pob='usa', dayob='monday')
```
or as a dictionary
```
G.add_node('abc', {'dob': 1185, 'pob': 'usa', 'dayob': 'monday'})
```
To access the attributes, just access them as you would with ... | Additionally, you don't have to just assign the attributes when the node is added. Even after it's been added you can still set them directly.
```
import networkx as nx
G=nx.Graph()
G.add_edge(1,2)
#see comment below code for recent versions of networkx.
G.nodes[1]['name'] = 'alpha'
G.nodes[2]['name'] = 'omega'
G.nod... |
13,698,352 | I have a network of nodes created using python `networkx`. i want to store information in nodes such that i can access the information later based on the node label (the name of the node) and the field that in which the information has been stored (like node attributes). the information stored can be a string or a numb... | 2012/12/04 | [
"https://Stackoverflow.com/questions/13698352",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1295112/"
] | As you say, it's just a matter of adding the attributes when adding the nodes to the graph
```python
G.add_node('abc', dob=1185, pob='usa', dayob='monday')
```
or as a dictionary
```
G.add_node('abc', {'dob': 1185, 'pob': 'usa', 'dayob': 'monday'})
```
To access the attributes, just access them as you would with ... | As of `networkx` v2.0, you can use:
```
import networkx as nx
G = nx.Graph()
G.add_node('abc', dob=1185, pob='usa', dayob='monday')
nx.get_node_attributes(G, 'dob')
> {'abc': 1185}
```
You can access this dictionary as usual:
```
{'abc': 1185}['abc']
> 1185
``` |
13,698,352 | I have a network of nodes created using python `networkx`. i want to store information in nodes such that i can access the information later based on the node label (the name of the node) and the field that in which the information has been stored (like node attributes). the information stored can be a string or a numb... | 2012/12/04 | [
"https://Stackoverflow.com/questions/13698352",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1295112/"
] | As you say, it's just a matter of adding the attributes when adding the nodes to the graph
```python
G.add_node('abc', dob=1185, pob='usa', dayob='monday')
```
or as a dictionary
```
G.add_node('abc', {'dob': 1185, 'pob': 'usa', 'dayob': 'monday'})
```
To access the attributes, just access them as you would with ... | Apparently now
```
G.node[1]['name'] = 'alpha'
```
do not work anymore.
I used this : <https://networkx.github.io/documentation/stable/reference/classes/generated/networkx.Graph.nodes.html>
adding an s at node :
```
G.nodes[1]['name'] = 'alpha'
``` |
13,698,352 | I have a network of nodes created using python `networkx`. i want to store information in nodes such that i can access the information later based on the node label (the name of the node) and the field that in which the information has been stored (like node attributes). the information stored can be a string or a numb... | 2012/12/04 | [
"https://Stackoverflow.com/questions/13698352",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1295112/"
] | As you say, it's just a matter of adding the attributes when adding the nodes to the graph
```python
G.add_node('abc', dob=1185, pob='usa', dayob='monday')
```
or as a dictionary
```
G.add_node('abc', {'dob': 1185, 'pob': 'usa', 'dayob': 'monday'})
```
To access the attributes, just access them as you would with ... | To add attributes as dictionary you can do the following
```
g.add_node('node_id', **{"attr1": "val1", "attr2": "val2"})
```
p.s. if you don't add `**` you'll get exception:
`TypeError: add_node() takes 2 positional arguments but 3 were given` |
13,698,352 | I have a network of nodes created using python `networkx`. i want to store information in nodes such that i can access the information later based on the node label (the name of the node) and the field that in which the information has been stored (like node attributes). the information stored can be a string or a numb... | 2012/12/04 | [
"https://Stackoverflow.com/questions/13698352",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1295112/"
] | Additionally, you don't have to just assign the attributes when the node is added. Even after it's been added you can still set them directly.
```
import networkx as nx
G=nx.Graph()
G.add_edge(1,2)
#see comment below code for recent versions of networkx.
G.nodes[1]['name'] = 'alpha'
G.nodes[2]['name'] = 'omega'
G.nod... | As of `networkx` v2.0, you can use:
```
import networkx as nx
G = nx.Graph()
G.add_node('abc', dob=1185, pob='usa', dayob='monday')
nx.get_node_attributes(G, 'dob')
> {'abc': 1185}
```
You can access this dictionary as usual:
```
{'abc': 1185}['abc']
> 1185
``` |
13,698,352 | I have a network of nodes created using python `networkx`. i want to store information in nodes such that i can access the information later based on the node label (the name of the node) and the field that in which the information has been stored (like node attributes). the information stored can be a string or a numb... | 2012/12/04 | [
"https://Stackoverflow.com/questions/13698352",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1295112/"
] | Additionally, you don't have to just assign the attributes when the node is added. Even after it's been added you can still set them directly.
```
import networkx as nx
G=nx.Graph()
G.add_edge(1,2)
#see comment below code for recent versions of networkx.
G.nodes[1]['name'] = 'alpha'
G.nodes[2]['name'] = 'omega'
G.nod... | Apparently now
```
G.node[1]['name'] = 'alpha'
```
do not work anymore.
I used this : <https://networkx.github.io/documentation/stable/reference/classes/generated/networkx.Graph.nodes.html>
adding an s at node :
```
G.nodes[1]['name'] = 'alpha'
``` |
13,698,352 | I have a network of nodes created using python `networkx`. i want to store information in nodes such that i can access the information later based on the node label (the name of the node) and the field that in which the information has been stored (like node attributes). the information stored can be a string or a numb... | 2012/12/04 | [
"https://Stackoverflow.com/questions/13698352",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1295112/"
] | Additionally, you don't have to just assign the attributes when the node is added. Even after it's been added you can still set them directly.
```
import networkx as nx
G=nx.Graph()
G.add_edge(1,2)
#see comment below code for recent versions of networkx.
G.nodes[1]['name'] = 'alpha'
G.nodes[2]['name'] = 'omega'
G.nod... | To add attributes as dictionary you can do the following
```
g.add_node('node_id', **{"attr1": "val1", "attr2": "val2"})
```
p.s. if you don't add `**` you'll get exception:
`TypeError: add_node() takes 2 positional arguments but 3 were given` |
13,698,352 | I have a network of nodes created using python `networkx`. i want to store information in nodes such that i can access the information later based on the node label (the name of the node) and the field that in which the information has been stored (like node attributes). the information stored can be a string or a numb... | 2012/12/04 | [
"https://Stackoverflow.com/questions/13698352",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1295112/"
] | As of `networkx` v2.0, you can use:
```
import networkx as nx
G = nx.Graph()
G.add_node('abc', dob=1185, pob='usa', dayob='monday')
nx.get_node_attributes(G, 'dob')
> {'abc': 1185}
```
You can access this dictionary as usual:
```
{'abc': 1185}['abc']
> 1185
``` | To add attributes as dictionary you can do the following
```
g.add_node('node_id', **{"attr1": "val1", "attr2": "val2"})
```
p.s. if you don't add `**` you'll get exception:
`TypeError: add_node() takes 2 positional arguments but 3 were given` |
13,698,352 | I have a network of nodes created using python `networkx`. i want to store information in nodes such that i can access the information later based on the node label (the name of the node) and the field that in which the information has been stored (like node attributes). the information stored can be a string or a numb... | 2012/12/04 | [
"https://Stackoverflow.com/questions/13698352",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1295112/"
] | Apparently now
```
G.node[1]['name'] = 'alpha'
```
do not work anymore.
I used this : <https://networkx.github.io/documentation/stable/reference/classes/generated/networkx.Graph.nodes.html>
adding an s at node :
```
G.nodes[1]['name'] = 'alpha'
``` | To add attributes as dictionary you can do the following
```
g.add_node('node_id', **{"attr1": "val1", "attr2": "val2"})
```
p.s. if you don't add `**` you'll get exception:
`TypeError: add_node() takes 2 positional arguments but 3 were given` |
32,745,656 | Let's say I have 2 tables like this:
```
--------+-------
| id | name |
--------+-------
| 1 | Paul |
| 2 | Jack |
| 3 | Joe |
--------+-------
--------+--------
| id | Color |
--------+--------
| 1 | Blue |
| 2 | Red |
| 3 | Pink |
--------+--------
```
I would like to ... | 2015/09/23 | [
"https://Stackoverflow.com/questions/32745656",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5291804/"
] | I think the problem is that the heart of joomla currently works with version 2.3.2 Bootstrap
You need to load in the template, bootstrap version you want to use.
Create a directory called "js" in the template and one for the "css"
Then add this in the template, after placing files.
```
$doc->addScript($tpath.'/js/b... | To avoid conflicts, how not to load js files it is as follows:
```
unset($doc->_scripts[$this->baseurl.'/media/jui/js/bootstrap.min.js']);
```
In this case, we remove the bootstrap.min.js joomla file loaded by default.
I hope I've been helpful. Sorry for my English. |
74,372,665 | How can I extend y-axis in the way that line in the top don't finish sharply with the end of graph. In this case would be fine to extend y-axis to 8 or even 9, note that I can't set limit to 8 because speed value will be always different. It's only about visual effect.
Second question, also estetic, graph start with d... | 2022/11/09 | [
"https://Stackoverflow.com/questions/74372665",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6125812/"
] | Without seeing your code it is difficult to understand what you have already done and how your data is structured to create the graph, is it a pandas df? it is a list of values? Also what librarys are you using.
Assuming you are using matplotlib this has already been answered here [How to set the y-axis limit](https://... | I fixed first problem with `ymax = round(max(y))+1` but not the one with zeros, when I'm trying to use same pattern for example `ax.set_xlim([1,xmax])` it's just moving my graph, I would like to keep it unchanged just make one 0 disappear, but it's not so big of a deal |
51,741,940 | I was adding firebase to my project as documented in the official website.
In the 4th step it says to add `compile 'com.google.firebase:firebase-core:16.0.0'`.
But trying to synch gradle I would get errors:

and by trying to download them (`install repository abd synch... | 2018/08/08 | [
"https://Stackoverflow.com/questions/51741940",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9850245/"
] | Upgrade the following:
```
implementation 'com.google.firebase:firebase-auth:11.6.2'
```
into this:
```
implementation 'com.google.firebase:firebase-auth:16.0.2'
```
Add google service plugin version `4.0.1` and `google()` repo in top level gradle file:
```
buildscript {
// ...
dependencies {
// ...
c... | Use same versions of firebase services to avoid conflicts.
Refer <https://firebase.google.com/docs/android/setup>
To solve your problem. |
51,741,940 | I was adding firebase to my project as documented in the official website.
In the 4th step it says to add `compile 'com.google.firebase:firebase-core:16.0.0'`.
But trying to synch gradle I would get errors:

and by trying to download them (`install repository abd synch... | 2018/08/08 | [
"https://Stackoverflow.com/questions/51741940",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9850245/"
] | Upgrade the following:
```
implementation 'com.google.firebase:firebase-auth:11.6.2'
```
into this:
```
implementation 'com.google.firebase:firebase-auth:16.0.2'
```
Add google service plugin version `4.0.1` and `google()` repo in top level gradle file:
```
buildscript {
// ...
dependencies {
// ...
c... | Before you proceed, clean and rebuild your project.
Then at **app/build.gradle**,
add **`apply plugin: 'com.google.gms.google-services'`**
like the code snippet down below.
```
android {
// ...
}
dependencies {
// ...
}
// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'
```
And make ... |
51,741,940 | I was adding firebase to my project as documented in the official website.
In the 4th step it says to add `compile 'com.google.firebase:firebase-core:16.0.0'`.
But trying to synch gradle I would get errors:

and by trying to download them (`install repository abd synch... | 2018/08/08 | [
"https://Stackoverflow.com/questions/51741940",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9850245/"
] | Upgrade the following:
```
implementation 'com.google.firebase:firebase-auth:11.6.2'
```
into this:
```
implementation 'com.google.firebase:firebase-auth:16.0.2'
```
Add google service plugin version `4.0.1` and `google()` repo in top level gradle file:
```
buildscript {
// ...
dependencies {
// ...
c... | Add `firebase-core` to your dependencies block:
```
implementation 'com.google.firebase:firebase-core:16.0.1'
```
The [Firebase SDK release notes](https://firebase.google.com/support/release-notes/android) for the June 12 release explain:
>
> Your app gradle file now has to explicitly list
> com.google.firebase:f... |
51,406,675 | i only need the mapbox geocoding autocomplete without the map (to put the result with lat/lng in another request)
I managed to put it totally alone without the map using this :
```
<template>
<div id='geocoder' class='geocoder'></div>
</template>
<script>
import MapboxGeocoder from '@mapbox/mapbox-gl-geocoder'
... | 2018/07/18 | [
"https://Stackoverflow.com/questions/51406675",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5794331/"
] | From the API docs <https://github.com/mapbox/mapbox-gl-geocoder/blob/master/API.md#on> you can use
```
geocoder.on('results', function(results) {
console.log(results);
})
``` | I've finally found a cheaper and easier to integrate alternative :
<https://community.algolia.com/places/documentation.html#using-npm>
here is the simple code :
```
<template>
<input type="search" id="address-input" placeholder="Where are we going?" />
</template>
<script>
import Places from 'places.js'
...
... |
50,969,888 | Let's assume in my console the user inputs a couple or few strings separated by spaces.
I'm using these lines of code to organize the inputs into an array:
```
string[] inputs = Console.ReadLine().Split();
string firstName = inputs[0];
string lastName = inputs[1];
```
My goal by posting this is to better understand... | 2018/06/21 | [
"https://Stackoverflow.com/questions/50969888",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | These are two different "operations": `Console.ReadLine()` and `String.Split()`, first returns `string` from user input, second splits it. It will be equivalent to:
```
string input = Console.ReadLine();
string[] result = input.Split();
```
You can call as many methods (properties, fields, etc) as you want after do... | Read the input from the console
```
var inputs = Console.ReadLine();
```
Split the input string by whitespace
```
var splitInputs = inputs.Split(' ');
```
Check if the split array has at least one element and take its values
```
string firstName = splitInputs.Count()>0 ? splitInputs[0] : string.Empty;
```
Chec... |
49,567,086 | I have a problem with my subdomain not working for SSL on localhost.
I generated my SSL certificate as "localhost" for my XAMPP installation.
I normally have TWO document roots:
```
DocumentRoot C:\Files\PHPCode
ServerName phpcode.localhost
```
&
```
DocumentRoot C:\server\xampp
ServerName localhost
```
I can ... | 2018/03/30 | [
"https://Stackoverflow.com/questions/49567086",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4663259/"
] | Try
```
mssql+pymssql://user:pass@host/db
```
Reference: <http://docs.sqlalchemy.org/en/latest/dialects/mssql.html> | I was not able to find the required parameter where I can just mention the name of the DB in url. Although there are ways of doing it but if you are using freetds\_name, I have not see any option of setting DB name.
I tried setting default Database name in odbc.ini but for some reason it did not work.
The easiest way ... |
3,330 | This is a duplicate, but answers may vary do to each individual SE policy.
I have a positive reputation in science and math there are negatives. I thought I was OK but now I cannot ask questions or revise on poor(which is an opinion of a few not of the many) questions.
The rules are defined, but the most important ... | 2017/08/27 | [
"https://aviation.meta.stackexchange.com/questions/3330",
"https://aviation.meta.stackexchange.com",
"https://aviation.meta.stackexchange.com/users/-1/"
] | Although [we don't like](https://aviation.meta.stackexchange.com/q/3103/14897) changing questions after being answered (different from accepted), [I did update my answer](https://aviation.stackexchange.com/a/31371/14897) to reflect your changes.
The problem is you are not solving one problem at a time, you are creatin... | You have multiple questions here and it's a hard to understand what some of them are, but you seem to be concerned with:
* what restrictions are there on voting
* how do question bans work
* why can't users be blocked, could the software be changed to allow it
None of these are specific to Aviation.SE, they apply to ... |
3,330 | This is a duplicate, but answers may vary do to each individual SE policy.
I have a positive reputation in science and math there are negatives. I thought I was OK but now I cannot ask questions or revise on poor(which is an opinion of a few not of the many) questions.
The rules are defined, but the most important ... | 2017/08/27 | [
"https://aviation.meta.stackexchange.com/questions/3330",
"https://aviation.meta.stackexchange.com",
"https://aviation.meta.stackexchange.com/users/-1/"
] | You're asking several questions here, which I'll try to address.
>
> The rules are defined, but the most important rules not stated.
>
>
>
The most important rules are about how to ask a good question, which is what you didn't follow and got you banned. Additionally, the question banning policy is prominently sta... | You have multiple questions here and it's a hard to understand what some of them are, but you seem to be concerned with:
* what restrictions are there on voting
* how do question bans work
* why can't users be blocked, could the software be changed to allow it
None of these are specific to Aviation.SE, they apply to ... |
68,190,974 | I have tried to use `shutil`, but rather than deleting the contents of the folder it just deletes the whole folder.
```
def delete_song():
print("Deleting song")
shutil.rmtree('./song_downloads')
print("Deleted song")
```
However it didn't print out "Deleted song". I also tried to use os.remove()
```
de... | 2021/06/30 | [
"https://Stackoverflow.com/questions/68190974",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Convert to numeric and then take the absolute value:
```py
df["Revenue"] = pd.to_numeric(df["Revenue"]).abs()
```
If the above doesn't work, then try:
```py
df["Revenue"] = pd.to_numeric(df["Revenue"].str.strip().str.replace(",", "")).abs()
```
Here I first make a call to `str.strip()` to remove any whitespace in... | Does using `.str.replace()` help?
```py
df["Revenue"] = pd.to_numeric(df["Revenue"].str.replace(',','').abs()
```
If you are getting the DataFrame from a csv file, you can use the following at import to address the commas, and then deal with the `-` later:
```py
df.read_csv ('foo.csv', thousands=',')
df["Revenue"]... |
972,629 | It seems I am one of the few trying to get Mono's mod\_mono to run on httpd on Fedora 10.
Mono is installed and the httpd is configured to use mod\_mono.conf
But when I do this:
```
service httpd start
```
I get this error:
```
Starting httpd: [crit] (13)Permission denied:
Failed to attach to existing dashboard,... | 2009/06/09 | [
"https://Stackoverflow.com/questions/972629",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/78077/"
] | The usual way to do aggregate concatenation in SSRS is with custom code. See here for an example:
<http://blogs.msdn.com/suryaj/archive/2007/08/11/string-aggregation.aspx>
Here's the custom code in basic form:
```
Private CurrGroupBy As String = String.Empty
Private ConcatVal As String = String.Empty
Public Function... | There is a simpler way to concatenate values together by a grouped value. Use something like this as the expression:
```
=Join(LookUpSet(Fields!GroupField.Value, Fields!GroupField.Value, Fields!ConcatField.Value, "DataSet1"), ",")
``` |
16,368,771 | Is there some way to copy the path of a file in the Vim's NERDtree plugin?
Better: is there some plugin to make the same operations the [SideBarEnhancements](https://github.com/titoBouzout/SideBarEnhancements#readme) plugin of Sublime Text does? | 2013/05/03 | [
"https://Stackoverflow.com/questions/16368771",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/922143/"
] | NERD\_tree comes with its own extension system; just put the following fragment into `~/.vim/nerdtree_plugin/yank_mapping.vim`:
```
call NERDTreeAddKeyMap({
\ 'key': 'yy',
\ 'callback': 'NERDTreeYankCurrentNode',
\ 'quickhelpText': 'put full path of current node into the default register' })
f... | This is what I found for NERDTree with a quick google: [CopyPath](https://github.com/vim-scripts/copypath.vim)
However it sounds like you are trying to make vim into Sublime Text. Vim tends to have a very different philosophy on text editing than most text editors. In my personal opinion it is often better to work wi... |
16,368,771 | Is there some way to copy the path of a file in the Vim's NERDtree plugin?
Better: is there some plugin to make the same operations the [SideBarEnhancements](https://github.com/titoBouzout/SideBarEnhancements#readme) plugin of Sublime Text does? | 2013/05/03 | [
"https://Stackoverflow.com/questions/16368771",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/922143/"
] | NERD\_tree comes with its own extension system; just put the following fragment into `~/.vim/nerdtree_plugin/yank_mapping.vim`:
```
call NERDTreeAddKeyMap({
\ 'key': 'yy',
\ 'callback': 'NERDTreeYankCurrentNode',
\ 'quickhelpText': 'put full path of current node into the default register' })
f... | I guess what you really need is a context menu like that sublime plugin?
That's built-in with NERDTree.
Just hit `m` on the node you highlighted and you'll see a new window pop under asking you what you want to do. The basic functions are: Add, Delete, Move, Copy.
There is also a plugin to let you search(using grep)... |
12,986,970 | I ran into a problem that is not supposed to happen (which is why I'm puzzled): on **[THIS](http://www.petrebogdan.com/gegi/garfice.php)** page, the first item of the left side navigation menu has 2 chained classes attached - one for specific formatting as the **first item** and the other to show the **active state**. ... | 2012/10/20 | [
"https://Stackoverflow.com/questions/12986970",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | make sure that when in IE, the document mode is "standardds" and not "quirks" | Ok maybe it's not the solution, but at least try to add `!important;` to your active links. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.