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
19,693,410
I am trying to create a Metro Tile type grid with Angular, to achieve this i want each of the tiles to be a different colour. So my plan of action was to create a function that would randomly pick a colour inside a loop (using `ng-repeat`). Here is what i have so far.... ```html <div class={{RandomColourClass()}} ng-r...
2013/10/30
[ "https://Stackoverflow.com/questions/19693410", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2859298/" ]
Angular performs a **digest** function to update the DOM when your data changes. During the digest, it recomputes all the values you have bound in the DOM, in this case `{{RandomColorClass()}}`. If any of them change, it again performs a digest cycle (since some variables may depend on the value of of the changed vari...
I encountered this error when I mistyped ng-class="submit()" instead of ng-click="submit()". I can't imagine anyone else making such a silly error, but for the record, this is another way to create 10 $digest() iterations reached aborting!
19,693,410
I am trying to create a Metro Tile type grid with Angular, to achieve this i want each of the tiles to be a different colour. So my plan of action was to create a function that would randomly pick a colour inside a loop (using `ng-repeat`). Here is what i have so far.... ```html <div class={{RandomColourClass()}} ng-r...
2013/10/30
[ "https://Stackoverflow.com/questions/19693410", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2859298/" ]
I had the same problem in IE10 turns ut that the problem was that I was redirecting using window.location. ``` window.location = "#route/yada"; ``` Changed the code to ``` $location.path("/route/yada); ``` And that solved my issues. =D
Answer unrelated to this particular question, but I'm adding it here because it's on the Google front page when you search for the error message and it took me a bit until I figured it out: I had something like this in my view: ``` <custom-tag data="[1,2,3]"/> ``` And the controller of the custom tag had a watcher ...
19,693,410
I am trying to create a Metro Tile type grid with Angular, to achieve this i want each of the tiles to be a different colour. So my plan of action was to create a function that would randomly pick a colour inside a loop (using `ng-repeat`). Here is what i have so far.... ```html <div class={{RandomColourClass()}} ng-r...
2013/10/30
[ "https://Stackoverflow.com/questions/19693410", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2859298/" ]
Answer unrelated to this particular question, but I'm adding it here because it's on the Google front page when you search for the error message and it took me a bit until I figured it out: I had something like this in my view: ``` <custom-tag data="[1,2,3]"/> ``` And the controller of the custom tag had a watcher ...
I encountered this error when I mistyped ng-class="submit()" instead of ng-click="submit()". I can't imagine anyone else making such a silly error, but for the record, this is another way to create 10 $digest() iterations reached aborting!
19,693,410
I am trying to create a Metro Tile type grid with Angular, to achieve this i want each of the tiles to be a different colour. So my plan of action was to create a function that would randomly pick a colour inside a loop (using `ng-repeat`). Here is what i have so far.... ```html <div class={{RandomColourClass()}} ng-r...
2013/10/30
[ "https://Stackoverflow.com/questions/19693410", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2859298/" ]
I had the same problem in IE10 turns ut that the problem was that I was redirecting using window.location. ``` window.location = "#route/yada"; ``` Changed the code to ``` $location.path("/route/yada); ``` And that solved my issues. =D
I encountered this error when I mistyped ng-class="submit()" instead of ng-click="submit()". I can't imagine anyone else making such a silly error, but for the record, this is another way to create 10 $digest() iterations reached aborting!
6,698,030
> > **Possible Duplicate:** > > [Python 'self' keyword](https://stackoverflow.com/questions/6019627/python-self-keyword) > > > Forgive me if this is an incredibly noobish question, but I never did understand self in Python. What does it do? And when I see things like ``` def example(self, args): return se...
2011/07/14
[ "https://Stackoverflow.com/questions/6698030", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
`self` is the reference to the instance of the class that the method (the `example` function in this case) is of. You'll want to take a look at the [Python docs on the class system](http://docs.python.org/tutorial/classes.html#a-first-look-at-classes) for a full introduction to Python's class system. You'll also want ...
Self it a reference to the instance of the current class. In your example, `self.something` references the `something` property of the `example` class object.
6,698,030
> > **Possible Duplicate:** > > [Python 'self' keyword](https://stackoverflow.com/questions/6019627/python-self-keyword) > > > Forgive me if this is an incredibly noobish question, but I never did understand self in Python. What does it do? And when I see things like ``` def example(self, args): return se...
2011/07/14
[ "https://Stackoverflow.com/questions/6698030", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
It sounds like you've stumbled onto the object oriented features of Python. `self` is a reference to an object. It's very close to the concept of `this` in many C-style languages. Check out this code: ``` class Car(object): def __init__(self, make): # Set the user-defined 'make' property on the self object ...
`self` is the reference to the instance of the class that the method (the `example` function in this case) is of. You'll want to take a look at the [Python docs on the class system](http://docs.python.org/tutorial/classes.html#a-first-look-at-classes) for a full introduction to Python's class system. You'll also want ...
6,698,030
> > **Possible Duplicate:** > > [Python 'self' keyword](https://stackoverflow.com/questions/6019627/python-self-keyword) > > > Forgive me if this is an incredibly noobish question, but I never did understand self in Python. What does it do? And when I see things like ``` def example(self, args): return se...
2011/07/14
[ "https://Stackoverflow.com/questions/6698030", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
It sounds like you've stumbled onto the object oriented features of Python. `self` is a reference to an object. It's very close to the concept of `this` in many C-style languages. Check out this code: ``` class Car(object): def __init__(self, make): # Set the user-defined 'make' property on the self object ...
Self it a reference to the instance of the current class. In your example, `self.something` references the `something` property of the `example` class object.
5,053,769
I'm attempting to build a queue of queues that I can use to manage multiple data sets, but I'm not sure how. Simply delaring `queue<queue>` doesn't work and returns the following error: ``` error: type/value mismatch at argument 1 in template parameter list for ‘template<class Type> class queue’ main.cpp:18: error: ...
2011/02/19
[ "https://Stackoverflow.com/questions/5053769", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
The particular error you're getting is that queue is a template class, so you need to specify an argument to it everywhere you use it. Thus writing ``` queue<queue> ``` Is illegal because the inner queue isn't paramterized over anything. It's definitely possible to write your own queue of queues - in fact, it's pos...
You need to define the type of the second queue, like `queue<queue<int> >` to have a queue of queues of integers.
5,053,769
I'm attempting to build a queue of queues that I can use to manage multiple data sets, but I'm not sure how. Simply delaring `queue<queue>` doesn't work and returns the following error: ``` error: type/value mismatch at argument 1 in template parameter list for ‘template<class Type> class queue’ main.cpp:18: error: ...
2011/02/19
[ "https://Stackoverflow.com/questions/5053769", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
A queue must have a type. You are creating a queue of queues of.... nothing. So it's reading the token `queue` inside of the `<` and `>` as an error, not a type. `queue` is not a type, technically. `queue<int>` is a type. Do you want to write your own queue class or your own queue of queues class? What I'd advise is w...
You need to define the type of the second queue, like `queue<queue<int> >` to have a queue of queues of integers.
5,053,769
I'm attempting to build a queue of queues that I can use to manage multiple data sets, but I'm not sure how. Simply delaring `queue<queue>` doesn't work and returns the following error: ``` error: type/value mismatch at argument 1 in template parameter list for ‘template<class Type> class queue’ main.cpp:18: error: ...
2011/02/19
[ "https://Stackoverflow.com/questions/5053769", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
A queue must have a type. You are creating a queue of queues of.... nothing. So it's reading the token `queue` inside of the `<` and `>` as an error, not a type. `queue` is not a type, technically. `queue<int>` is a type. Do you want to write your own queue class or your own queue of queues class? What I'd advise is w...
The particular error you're getting is that queue is a template class, so you need to specify an argument to it everywhere you use it. Thus writing ``` queue<queue> ``` Is illegal because the inner queue isn't paramterized over anything. It's definitely possible to write your own queue of queues - in fact, it's pos...
54,593,925
In my angular project have angular material and use mat-select. Mat-select is the first element for my form in my case set auto focus while page was loaded successfully but I wasn't able to set auto focus on mat-select. Anyone can help me to find the way to set auto focus in mat-select. ``` @ViewChild("name") nameFiel...
2019/02/08
[ "https://Stackoverflow.com/questions/54593925", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9020593/" ]
We can use default angular attribute for autofocus ``` <mat-form-field> <mat-select formControlName="xyz" cdkFocusInitial> <mat-option value="abc">Abc</mat-option> </mat-select> </mat-form-field> ```
You can call the focus on `OnInit` ts: ``` options2 = ['A', 'B']; @ViewChild('name') nameField: MdSelect; ngOnInit() { setTimeout(() => { this.nameField.open(); }, 0); } ``` html: ``` <div> <md-select [(ngModel)]="nameField" #name> <md-option *ngFor="let option of options2" [value]="op...
54,593,925
In my angular project have angular material and use mat-select. Mat-select is the first element for my form in my case set auto focus while page was loaded successfully but I wasn't able to set auto focus on mat-select. Anyone can help me to find the way to set auto focus in mat-select. ``` @ViewChild("name") nameFiel...
2019/02/08
[ "https://Stackoverflow.com/questions/54593925", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9020593/" ]
HTML : ```html <mat-select #someRef > <mat-option *ngFor="let item of items;" [value]="item"> {{item.name}} </mat-option> </mat-select> ``` .ts : make sure you import **MatSelect** ```js import { MatSelect } from '@angular/material'; ``` ```js @ViewChild('someRef') someRef: MatSelect; ngOnInit() { ...
As this is the First hit that shows up on Google I'll provide what I found: **Note that I did this specifically for a `mat-select` as there is no *real* inner html element that the reference could be attached to**. What I found works is getting a reference to the element through `view-child` and then calling ``` re...
54,593,925
In my angular project have angular material and use mat-select. Mat-select is the first element for my form in my case set auto focus while page was loaded successfully but I wasn't able to set auto focus on mat-select. Anyone can help me to find the way to set auto focus in mat-select. ``` @ViewChild("name") nameFiel...
2019/02/08
[ "https://Stackoverflow.com/questions/54593925", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9020593/" ]
As this is the First hit that shows up on Google I'll provide what I found: **Note that I did this specifically for a `mat-select` as there is no *real* inner html element that the reference could be attached to**. What I found works is getting a reference to the element through `view-child` and then calling ``` re...
You can adapt this example to your own project. Clicking on the button becomes focus. [focusing on form elements the Angular way](https://stackblitz.com/edit/form-focus?file=src%2Fapp%2Fapp.component.ts) [show more](https://codeburst.io/focusing-on-form-elements-the-angular-way-e9a78725c04f)
54,593,925
In my angular project have angular material and use mat-select. Mat-select is the first element for my form in my case set auto focus while page was loaded successfully but I wasn't able to set auto focus on mat-select. Anyone can help me to find the way to set auto focus in mat-select. ``` @ViewChild("name") nameFiel...
2019/02/08
[ "https://Stackoverflow.com/questions/54593925", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9020593/" ]
HTML : ```html <mat-select #someRef > <mat-option *ngFor="let item of items;" [value]="item"> {{item.name}} </mat-option> </mat-select> ``` .ts : make sure you import **MatSelect** ```js import { MatSelect } from '@angular/material'; ``` ```js @ViewChild('someRef') someRef: MatSelect; ngOnInit() { ...
First, let’s create the Directive **auto-focus.directive.ts** ``` import { AfterContentInit, Directive, ElementRef, Input } from '@angular/core'; @Directive({ selector: '[autoFocus]' }) export class AutofocusDirective implements AfterContentInit { public constructor(private el: ElementRef) { } ...
54,593,925
In my angular project have angular material and use mat-select. Mat-select is the first element for my form in my case set auto focus while page was loaded successfully but I wasn't able to set auto focus on mat-select. Anyone can help me to find the way to set auto focus in mat-select. ``` @ViewChild("name") nameFiel...
2019/02/08
[ "https://Stackoverflow.com/questions/54593925", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9020593/" ]
HTML : ```html <mat-select #someRef > <mat-option *ngFor="let item of items;" [value]="item"> {{item.name}} </mat-option> </mat-select> ``` .ts : make sure you import **MatSelect** ```js import { MatSelect } from '@angular/material'; ``` ```js @ViewChild('someRef') someRef: MatSelect; ngOnInit() { ...
We can use default angular attribute for autofocus ``` <mat-form-field> <mat-select formControlName="xyz" cdkFocusInitial> <mat-option value="abc">Abc</mat-option> </mat-select> </mat-form-field> ```
54,593,925
In my angular project have angular material and use mat-select. Mat-select is the first element for my form in my case set auto focus while page was loaded successfully but I wasn't able to set auto focus on mat-select. Anyone can help me to find the way to set auto focus in mat-select. ``` @ViewChild("name") nameFiel...
2019/02/08
[ "https://Stackoverflow.com/questions/54593925", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9020593/" ]
If I understand it correctly, you want to focus select element on load. If this is the case, your code is perfectly fine, you just need to move focus logic in to another life cycle event which is > > ngAfterViewInit > > > HTML: ``` <mat-select #fff> <mat-option *ngFor="let food of foods" [value]="food.value...
As this is the First hit that shows up on Google I'll provide what I found: **Note that I did this specifically for a `mat-select` as there is no *real* inner html element that the reference could be attached to**. What I found works is getting a reference to the element through `view-child` and then calling ``` re...
54,593,925
In my angular project have angular material and use mat-select. Mat-select is the first element for my form in my case set auto focus while page was loaded successfully but I wasn't able to set auto focus on mat-select. Anyone can help me to find the way to set auto focus in mat-select. ``` @ViewChild("name") nameFiel...
2019/02/08
[ "https://Stackoverflow.com/questions/54593925", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9020593/" ]
As this is the First hit that shows up on Google I'll provide what I found: **Note that I did this specifically for a `mat-select` as there is no *real* inner html element that the reference could be attached to**. What I found works is getting a reference to the element through `view-child` and then calling ``` re...
Try using `MatSelect` on `viewChild` to access focused attribute, then onInit set it to true. ``` <mat-form-field> <mat-select #mySelect [(ngModel)]="nameField"> <mat-option *ngFor="let option of options2" [value]="option.id">{{ option.name }} </mat-option> </mat-select> </mat-form-field> ``` and ts fil...
54,593,925
In my angular project have angular material and use mat-select. Mat-select is the first element for my form in my case set auto focus while page was loaded successfully but I wasn't able to set auto focus on mat-select. Anyone can help me to find the way to set auto focus in mat-select. ``` @ViewChild("name") nameFiel...
2019/02/08
[ "https://Stackoverflow.com/questions/54593925", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9020593/" ]
Try using `MatSelect` on `viewChild` to access focused attribute, then onInit set it to true. ``` <mat-form-field> <mat-select #mySelect [(ngModel)]="nameField"> <mat-option *ngFor="let option of options2" [value]="option.id">{{ option.name }} </mat-option> </mat-select> </mat-form-field> ``` and ts fil...
You can adapt this example to your own project. Clicking on the button becomes focus. [focusing on form elements the Angular way](https://stackblitz.com/edit/form-focus?file=src%2Fapp%2Fapp.component.ts) [show more](https://codeburst.io/focusing-on-form-elements-the-angular-way-e9a78725c04f)
54,593,925
In my angular project have angular material and use mat-select. Mat-select is the first element for my form in my case set auto focus while page was loaded successfully but I wasn't able to set auto focus on mat-select. Anyone can help me to find the way to set auto focus in mat-select. ``` @ViewChild("name") nameFiel...
2019/02/08
[ "https://Stackoverflow.com/questions/54593925", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9020593/" ]
As this is the First hit that shows up on Google I'll provide what I found: **Note that I did this specifically for a `mat-select` as there is no *real* inner html element that the reference could be attached to**. What I found works is getting a reference to the element through `view-child` and then calling ``` re...
First, let’s create the Directive **auto-focus.directive.ts** ``` import { AfterContentInit, Directive, ElementRef, Input } from '@angular/core'; @Directive({ selector: '[autoFocus]' }) export class AutofocusDirective implements AfterContentInit { public constructor(private el: ElementRef) { } ...
54,593,925
In my angular project have angular material and use mat-select. Mat-select is the first element for my form in my case set auto focus while page was loaded successfully but I wasn't able to set auto focus on mat-select. Anyone can help me to find the way to set auto focus in mat-select. ``` @ViewChild("name") nameFiel...
2019/02/08
[ "https://Stackoverflow.com/questions/54593925", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9020593/" ]
First, let’s create the Directive **auto-focus.directive.ts** ``` import { AfterContentInit, Directive, ElementRef, Input } from '@angular/core'; @Directive({ selector: '[autoFocus]' }) export class AutofocusDirective implements AfterContentInit { public constructor(private el: ElementRef) { } ...
You can adapt this example to your own project. Clicking on the button becomes focus. [focusing on form elements the Angular way](https://stackblitz.com/edit/form-focus?file=src%2Fapp%2Fapp.component.ts) [show more](https://codeburst.io/focusing-on-form-elements-the-angular-way-e9a78725c04f)
28,986,491
I have a ListView that is updated from a ASyncTask, The adapter updates the list properly, however my setOnItemClickListener always has the same data in the intent. This is the code for the loop that populates the ListView ``` if (JsonStr != null) { //Get list of courses JSONO...
2015/03/11
[ "https://Stackoverflow.com/questions/28986491", "https://Stackoverflow.com", "https://Stackoverflow.com/users/711697/" ]
'finalUnits' is final value . move listener and data(List Units) to inside adapter. and set listener in bindview method. { Intent i = new Intent(context,CourseActivity.class); i.putExtra("Data",list.get(position).toString()); startActivity(i); }
``` just replace by this code onitemclick lv.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?>parent, View view, int position, long id) { String value = (new ArrayList<String>(ListEntry.va...
592,505
I'm working on a web app that passes data to a custom client app. I'm getting exceptions when the data is over some "small" size. Since the end users will likely be using increasingly larger data sizes, I switched the return from the WCF function to be the ID of the data set. Next, I converted the client to use the I...
2009/02/26
[ "https://Stackoverflow.com/questions/592505", "https://Stackoverflow.com", "https://Stackoverflow.com/users/57582/" ]
See [Large Data and Streaming](http://msdn.microsoft.com/en-us/library/ms733742.aspx).
What's the exception you are seeing? Can you not read the XML because the reader quota is exceeded? If so, I think I know what might fix it. See below for a sample wsHttpBinding. Your exception should help you to determine which parameter needs to be fixed. You can maxReceivedMessageSize and quotas for the reader. Let...
592,505
I'm working on a web app that passes data to a custom client app. I'm getting exceptions when the data is over some "small" size. Since the end users will likely be using increasingly larger data sizes, I switched the return from the WCF function to be the ID of the data set. Next, I converted the client to use the I...
2009/02/26
[ "https://Stackoverflow.com/questions/592505", "https://Stackoverflow.com", "https://Stackoverflow.com/users/57582/" ]
As I understand the [Large Data and Streaming](http://msdn.microsoft.com/en-us/library/ms733742.aspx) article mentioned by @Eugene, one must switch transport mode for all communication, meaning it turns off some integrity checks. Consequently, I ended up with using a semi-custom HTTP client class where: * **Downloads...
What's the exception you are seeing? Can you not read the XML because the reader quota is exceeded? If so, I think I know what might fix it. See below for a sample wsHttpBinding. Your exception should help you to determine which parameter needs to be fixed. You can maxReceivedMessageSize and quotas for the reader. Let...
592,505
I'm working on a web app that passes data to a custom client app. I'm getting exceptions when the data is over some "small" size. Since the end users will likely be using increasingly larger data sizes, I switched the return from the WCF function to be the ID of the data set. Next, I converted the client to use the I...
2009/02/26
[ "https://Stackoverflow.com/questions/592505", "https://Stackoverflow.com", "https://Stackoverflow.com/users/57582/" ]
See [Large Data and Streaming](http://msdn.microsoft.com/en-us/library/ms733742.aspx).
you can go to this address <http://weblogs.asp.net/cibrax/archive/2008/06/10/streaming-large-content-with-wcf-and-deferred-execution.aspx>, I don't it fits to your pb but it's also an idea.
592,505
I'm working on a web app that passes data to a custom client app. I'm getting exceptions when the data is over some "small" size. Since the end users will likely be using increasingly larger data sizes, I switched the return from the WCF function to be the ID of the data set. Next, I converted the client to use the I...
2009/02/26
[ "https://Stackoverflow.com/questions/592505", "https://Stackoverflow.com", "https://Stackoverflow.com/users/57582/" ]
See [Large Data and Streaming](http://msdn.microsoft.com/en-us/library/ms733742.aspx).
As I understand the [Large Data and Streaming](http://msdn.microsoft.com/en-us/library/ms733742.aspx) article mentioned by @Eugene, one must switch transport mode for all communication, meaning it turns off some integrity checks. Consequently, I ended up with using a semi-custom HTTP client class where: * **Downloads...
592,505
I'm working on a web app that passes data to a custom client app. I'm getting exceptions when the data is over some "small" size. Since the end users will likely be using increasingly larger data sizes, I switched the return from the WCF function to be the ID of the data set. Next, I converted the client to use the I...
2009/02/26
[ "https://Stackoverflow.com/questions/592505", "https://Stackoverflow.com", "https://Stackoverflow.com/users/57582/" ]
See [Large Data and Streaming](http://msdn.microsoft.com/en-us/library/ms733742.aspx).
Setting up the maxItemsInObjectGraph in the Client side and Server side worked for me. (Dont forget the client side.) <http://social.msdn.microsoft.com/Forums/en/wcf/thread/0af69654-2d89-44f3-857a-583b57844ca5>
592,505
I'm working on a web app that passes data to a custom client app. I'm getting exceptions when the data is over some "small" size. Since the end users will likely be using increasingly larger data sizes, I switched the return from the WCF function to be the ID of the data set. Next, I converted the client to use the I...
2009/02/26
[ "https://Stackoverflow.com/questions/592505", "https://Stackoverflow.com", "https://Stackoverflow.com/users/57582/" ]
As I understand the [Large Data and Streaming](http://msdn.microsoft.com/en-us/library/ms733742.aspx) article mentioned by @Eugene, one must switch transport mode for all communication, meaning it turns off some integrity checks. Consequently, I ended up with using a semi-custom HTTP client class where: * **Downloads...
you can go to this address <http://weblogs.asp.net/cibrax/archive/2008/06/10/streaming-large-content-with-wcf-and-deferred-execution.aspx>, I don't it fits to your pb but it's also an idea.
592,505
I'm working on a web app that passes data to a custom client app. I'm getting exceptions when the data is over some "small" size. Since the end users will likely be using increasingly larger data sizes, I switched the return from the WCF function to be the ID of the data set. Next, I converted the client to use the I...
2009/02/26
[ "https://Stackoverflow.com/questions/592505", "https://Stackoverflow.com", "https://Stackoverflow.com/users/57582/" ]
As I understand the [Large Data and Streaming](http://msdn.microsoft.com/en-us/library/ms733742.aspx) article mentioned by @Eugene, one must switch transport mode for all communication, meaning it turns off some integrity checks. Consequently, I ended up with using a semi-custom HTTP client class where: * **Downloads...
Setting up the maxItemsInObjectGraph in the Client side and Server side worked for me. (Dont forget the client side.) <http://social.msdn.microsoft.com/Forums/en/wcf/thread/0af69654-2d89-44f3-857a-583b57844ca5>
33,258,498
I have the following python script that reads from a file line by line and executes mysql update queries. It is extremely slow, each query seems to take over 1 second. Any idea why it is so slow? ``` with open(fname) as f: for line in f: line = line.rstrip() email, name = line.split...
2015/10/21
[ "https://Stackoverflow.com/questions/33258498", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5471344/" ]
You should be able to fix the performance problem by using an index: ``` create index idx_user_email on user(email); ``` 1 second for an update is a long time.
You could try using more than one thread. ``` import threading with open(fname) as f: for line in f: line = line.rstrip() email, name = line.split(':')[0], line.split(':')[-1] thread = threading.Thread(target=updateUser, args=[name, email] ) thread.start() def updateUser(name, ...
33,258,498
I have the following python script that reads from a file line by line and executes mysql update queries. It is extremely slow, each query seems to take over 1 second. Any idea why it is so slow? ``` with open(fname) as f: for line in f: line = line.rstrip() email, name = line.split...
2015/10/21
[ "https://Stackoverflow.com/questions/33258498", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5471344/" ]
You should be able to fix the performance problem by using an index: ``` create index idx_user_email on user(email); ``` 1 second for an update is a long time.
If you wanted to be fanatical, you could also turn journaling off: ``` db= sqlite3.connect('database.db') cursor = db.cursor() cursor.execute("PRAGMA synchronous = OFF") cursor.execute("PRAGMA journal_mode = OFF") ```
59,901,415
I have two tables: **Employee** ``` id firstName lastName . . . ``` **Training** ``` id employeeId trainingName trainingSuspsnseDate trainingComplete ``` When I perform a standard SQL query in MySQL Workbench, it looks like this: ``` SELECT e.id, e.firstName, e.lastName, t.trainingName, t.trainingSuspenseDate, ...
2020/01/24
[ "https://Stackoverflow.com/questions/59901415", "https://Stackoverflow.com", "https://Stackoverflow.com/users/319020/" ]
I can figure out that You have a meta-model generated for your query. So the best way will be to extends your entity definition as follow: You have to add mapping in your `Training` class: ``` @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "employeeId") private Employee employee; ``` Then in your `Employee` ...
You can try `cross join`. Native sql is a bit differerent but the result is as axpected ``` CriteriaBuilder builder = entityManager.getCriteriaBuilder(); CriteriaQuery<Employee> employeeQuery = builder.createQuery(Employee.class); Root<Employee> employee = employeeQuery.from(Employee.class); Root<Employee> training= e...
59,901,415
I have two tables: **Employee** ``` id firstName lastName . . . ``` **Training** ``` id employeeId trainingName trainingSuspsnseDate trainingComplete ``` When I perform a standard SQL query in MySQL Workbench, it looks like this: ``` SELECT e.id, e.firstName, e.lastName, t.trainingName, t.trainingSuspenseDate, ...
2020/01/24
[ "https://Stackoverflow.com/questions/59901415", "https://Stackoverflow.com", "https://Stackoverflow.com/users/319020/" ]
I can figure out that You have a meta-model generated for your query. So the best way will be to extends your entity definition as follow: You have to add mapping in your `Training` class: ``` @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "employeeId") private Employee employee; ``` Then in your `Employee` ...
Looking at your model classes, the entities are not related directly (even though the `employeeId` in `Training` is supposed to be a foreign key, it is not defined as such in the entity relationship. So, if you wish to work with the existing entities, without changing them, you would need the following - 1. A POJO (f...
59,901,415
I have two tables: **Employee** ``` id firstName lastName . . . ``` **Training** ``` id employeeId trainingName trainingSuspsnseDate trainingComplete ``` When I perform a standard SQL query in MySQL Workbench, it looks like this: ``` SELECT e.id, e.firstName, e.lastName, t.trainingName, t.trainingSuspenseDate, ...
2020/01/24
[ "https://Stackoverflow.com/questions/59901415", "https://Stackoverflow.com", "https://Stackoverflow.com/users/319020/" ]
I can figure out that You have a meta-model generated for your query. So the best way will be to extends your entity definition as follow: You have to add mapping in your `Training` class: ``` @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "employeeId") private Employee employee; ``` Then in your `Employee` ...
This error message - incompatible types: inference variable Y has incompatible equality constraints - is an indication you need to carefully review DATA TYPES of the columns you are joining. The should be same data types on both sides of the = for performance and high speed comparisons.
51,882,428
I am trying to parse the `response` I get from my `OkHttp3Connection` and it always almost always returns me `String` with value `"true"` which is `names[0]` in this example. Now I try to convert this string to boolean and return `true/false` depending on the response. Now I guess since the `OkHttp3Connection` takes ...
2018/08/16
[ "https://Stackoverflow.com/questions/51882428", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9695530/" ]
You should pass the listener/callback. First create callback interface like below ``` public interface OnQueryResultCallback{ void onQueryResult(String songName, boolean status); } ``` Then pass listener/callback to your method, here is the modified method. ``` public void checkIfSongPurhcased(final String song...
Try to use getBoolean() rather than getString(). For Eg: `names[i] = dataObj.getBoolean(keys.next());`
51,297,207
i am working on program in java, when i clicked Button it will pass string that i get from text field to java class and send it through bluetooth. the problem is when i run my jframe (RegistrasiForm), it seems that my java class(SendtoAndroid.java) didn't run. Can you tell me what's wrong with my program? thanks. this...
2018/07/12
[ "https://Stackoverflow.com/questions/51297207", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9331318/" ]
Try this approach in this way you can handle all possible errors at one place and you also can generate custom response to return e.g if your all requests return JSON data then you can convert response to JSON before returning it. ```js function secureFetch(url, method, data) { return new Promise((resolve, reject) ...
Here you can handle with promise something like this: ```js function status(response) { /*You can handle status here.*/ if (response.status >= 200 && response.status < 300) { return Promise.resolve(response) } else { return Promise.reject(new Error(response.statusText)) } } fun...
10,174,050
``` private void pushButtonActionPerformed(java.awt.event.ActionEvent evt) { final int c=0; final JDialog d=new JDialog(); JLabel l=new JLabel("Enter the Element :"); JButton but1=new JButton("OK"); JButton but2=new JButton("Cancel"); final JTextField f=new JTextField(10); JPanel panel = ne...
2012/04/16
[ "https://Stackoverflow.com/questions/10174050", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1221631/" ]
> > but the line "c=Integer.parseInt(f.getText());" i am getting an error "cannot assign a value to a final variable > > > Right. The whole point of `final` variables is that you can only assign to them once, but you're trying to assign to it twice (once in the initialization setting it to `0`, once in your quoted...
`final` makes the "variable" a constant--you can't change it. As to why the compiler is giving you warnings after you delete the final keyword, we'd need to see the whole code... EDIT: ``` but1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { c=Integer.parseIn...
10,174,050
``` private void pushButtonActionPerformed(java.awt.event.ActionEvent evt) { final int c=0; final JDialog d=new JDialog(); JLabel l=new JLabel("Enter the Element :"); JButton but1=new JButton("OK"); JButton but2=new JButton("Cancel"); final JTextField f=new JTextField(10); JPanel panel = ne...
2012/04/16
[ "https://Stackoverflow.com/questions/10174050", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1221631/" ]
I'll skip the reasons and cut to the solution: use ``` final int[] c = {0}; ... c[0] = Integer.parseInt(f.getText()); ``` For the full story refer to [this post](https://stackoverflow.com/questions/1299837/cannot-refer-to-a-non-final-variable-inside-an-inner-class-defined-in-a-differen)
`final` makes the "variable" a constant--you can't change it. As to why the compiler is giving you warnings after you delete the final keyword, we'd need to see the whole code... EDIT: ``` but1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { c=Integer.parseIn...
10,174,050
``` private void pushButtonActionPerformed(java.awt.event.ActionEvent evt) { final int c=0; final JDialog d=new JDialog(); JLabel l=new JLabel("Enter the Element :"); JButton but1=new JButton("OK"); JButton but2=new JButton("Cancel"); final JTextField f=new JTextField(10); JPanel panel = ne...
2012/04/16
[ "https://Stackoverflow.com/questions/10174050", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1221631/" ]
I'll skip the reasons and cut to the solution: use ``` final int[] c = {0}; ... c[0] = Integer.parseInt(f.getText()); ``` For the full story refer to [this post](https://stackoverflow.com/questions/1299837/cannot-refer-to-a-non-final-variable-inside-an-inner-class-defined-in-a-differen)
> > but the line "c=Integer.parseInt(f.getText());" i am getting an error "cannot assign a value to a final variable > > > Right. The whole point of `final` variables is that you can only assign to them once, but you're trying to assign to it twice (once in the initialization setting it to `0`, once in your quoted...
10,174,050
``` private void pushButtonActionPerformed(java.awt.event.ActionEvent evt) { final int c=0; final JDialog d=new JDialog(); JLabel l=new JLabel("Enter the Element :"); JButton but1=new JButton("OK"); JButton but2=new JButton("Cancel"); final JTextField f=new JTextField(10); JPanel panel = ne...
2012/04/16
[ "https://Stackoverflow.com/questions/10174050", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1221631/" ]
You've got *c* declared in a function, and then you've created an anonymous inner class within that function. This inner class, the ActionListener, persists past the time your function terminates - so it can't assign values to c, because c is local to the function. The warning about "final" is misleading - that's jus...
This is the reason that keyword `final` exists in java. The variable is final, i.e. its value cannot be changed. If you have to change the value do not mark variable as final.
10,174,050
``` private void pushButtonActionPerformed(java.awt.event.ActionEvent evt) { final int c=0; final JDialog d=new JDialog(); JLabel l=new JLabel("Enter the Element :"); JButton but1=new JButton("OK"); JButton but2=new JButton("Cancel"); final JTextField f=new JTextField(10); JPanel panel = ne...
2012/04/16
[ "https://Stackoverflow.com/questions/10174050", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1221631/" ]
I'll skip the reasons and cut to the solution: use ``` final int[] c = {0}; ... c[0] = Integer.parseInt(f.getText()); ``` For the full story refer to [this post](https://stackoverflow.com/questions/1299837/cannot-refer-to-a-non-final-variable-inside-an-inner-class-defined-in-a-differen)
a variable is declared with **final** keyword means its value cannot be changed. final variable are like **constants**
10,174,050
``` private void pushButtonActionPerformed(java.awt.event.ActionEvent evt) { final int c=0; final JDialog d=new JDialog(); JLabel l=new JLabel("Enter the Element :"); JButton but1=new JButton("OK"); JButton but2=new JButton("Cancel"); final JTextField f=new JTextField(10); JPanel panel = ne...
2012/04/16
[ "https://Stackoverflow.com/questions/10174050", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1221631/" ]
> > but the line "c=Integer.parseInt(f.getText());" i am getting an error "cannot assign a value to a final variable > > > Right. The whole point of `final` variables is that you can only assign to them once, but you're trying to assign to it twice (once in the initialization setting it to `0`, once in your quoted...
This is the reason that keyword `final` exists in java. The variable is final, i.e. its value cannot be changed. If you have to change the value do not mark variable as final.
10,174,050
``` private void pushButtonActionPerformed(java.awt.event.ActionEvent evt) { final int c=0; final JDialog d=new JDialog(); JLabel l=new JLabel("Enter the Element :"); JButton but1=new JButton("OK"); JButton but2=new JButton("Cancel"); final JTextField f=new JTextField(10); JPanel panel = ne...
2012/04/16
[ "https://Stackoverflow.com/questions/10174050", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1221631/" ]
`final` makes the "variable" a constant--you can't change it. As to why the compiler is giving you warnings after you delete the final keyword, we'd need to see the whole code... EDIT: ``` but1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { c=Integer.parseIn...
Just remove the `final` keyword from the declaration and continue your program. As `final` keyword means the value is unaltered.
10,174,050
``` private void pushButtonActionPerformed(java.awt.event.ActionEvent evt) { final int c=0; final JDialog d=new JDialog(); JLabel l=new JLabel("Enter the Element :"); JButton but1=new JButton("OK"); JButton but2=new JButton("Cancel"); final JTextField f=new JTextField(10); JPanel panel = ne...
2012/04/16
[ "https://Stackoverflow.com/questions/10174050", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1221631/" ]
You've got *c* declared in a function, and then you've created an anonymous inner class within that function. This inner class, the ActionListener, persists past the time your function terminates - so it can't assign values to c, because c is local to the function. The warning about "final" is misleading - that's jus...
Just remove the `final` keyword from the declaration and continue your program. As `final` keyword means the value is unaltered.
10,174,050
``` private void pushButtonActionPerformed(java.awt.event.ActionEvent evt) { final int c=0; final JDialog d=new JDialog(); JLabel l=new JLabel("Enter the Element :"); JButton but1=new JButton("OK"); JButton but2=new JButton("Cancel"); final JTextField f=new JTextField(10); JPanel panel = ne...
2012/04/16
[ "https://Stackoverflow.com/questions/10174050", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1221631/" ]
> > but the line "c=Integer.parseInt(f.getText());" i am getting an error "cannot assign a value to a final variable > > > Right. The whole point of `final` variables is that you can only assign to them once, but you're trying to assign to it twice (once in the initialization setting it to `0`, once in your quoted...
a variable is declared with **final** keyword means its value cannot be changed. final variable are like **constants**
10,174,050
``` private void pushButtonActionPerformed(java.awt.event.ActionEvent evt) { final int c=0; final JDialog d=new JDialog(); JLabel l=new JLabel("Enter the Element :"); JButton but1=new JButton("OK"); JButton but2=new JButton("Cancel"); final JTextField f=new JTextField(10); JPanel panel = ne...
2012/04/16
[ "https://Stackoverflow.com/questions/10174050", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1221631/" ]
You've got *c* declared in a function, and then you've created an anonymous inner class within that function. This inner class, the ActionListener, persists past the time your function terminates - so it can't assign values to c, because c is local to the function. The warning about "final" is misleading - that's jus...
`final` makes the "variable" a constant--you can't change it. As to why the compiler is giving you warnings after you delete the final keyword, we'd need to see the whole code... EDIT: ``` but1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { c=Integer.parseIn...
797,212
For licensing purposes, I'm interested in knowing what Microsoft Windows OSes and applications allow multiple users to Remote Desktop into a server at the same time (each with a unique instance -- able to use the same applications and data simultaneously). I've found that this is possible on a system running Microsoft...
2016/08/16
[ "https://serverfault.com/questions/797212", "https://serverfault.com", "https://serverfault.com/users/175956/" ]
There are many applications that do an amazing job backing up SQL, file, system state or simple file level backups, especially for Windows. I would recommend utilizing cloudberry or some other software package of your choosing to take the human element out of the backup. Backing up the sql database, system state and se...
The disk image will work *if* all the applications are stopped - otherwise you don't know if you have outstanding transactions pending when you do the dump. It's also a slowwww way to restore if you don't need to restore the whole thing. MySQL dumps are easy, as are the text based files (git with automated git push is...
797,212
For licensing purposes, I'm interested in knowing what Microsoft Windows OSes and applications allow multiple users to Remote Desktop into a server at the same time (each with a unique instance -- able to use the same applications and data simultaneously). I've found that this is possible on a system running Microsoft...
2016/08/16
[ "https://serverfault.com/questions/797212", "https://serverfault.com", "https://serverfault.com/users/175956/" ]
Welcome to backup world Brian! I think I was in your position some time ago when thinking of backups as waste of time and, perhaps, money, but you get into the point once being bitten! I think you need image based backup with VSS integration that guarantees consistency of your data and backups. There are many solutio...
The disk image will work *if* all the applications are stopped - otherwise you don't know if you have outstanding transactions pending when you do the dump. It's also a slowwww way to restore if you don't need to restore the whole thing. MySQL dumps are easy, as are the text based files (git with automated git push is...
797,212
For licensing purposes, I'm interested in knowing what Microsoft Windows OSes and applications allow multiple users to Remote Desktop into a server at the same time (each with a unique instance -- able to use the same applications and data simultaneously). I've found that this is possible on a system running Microsoft...
2016/08/16
[ "https://serverfault.com/questions/797212", "https://serverfault.com", "https://serverfault.com/users/175956/" ]
There are many applications that do an amazing job backing up SQL, file, system state or simple file level backups, especially for Windows. I would recommend utilizing cloudberry or some other software package of your choosing to take the human element out of the backup. Backing up the sql database, system state and se...
I would recommend backing up each item separately. This way, if something goes wrong with only one item, you only need to recover that one item... It sounds like you are on the right track for the web content backup, but for SQL I'd suggest using the job functionality in MSSQL server (as opposed to task scheduler). Th...
797,212
For licensing purposes, I'm interested in knowing what Microsoft Windows OSes and applications allow multiple users to Remote Desktop into a server at the same time (each with a unique instance -- able to use the same applications and data simultaneously). I've found that this is possible on a system running Microsoft...
2016/08/16
[ "https://serverfault.com/questions/797212", "https://serverfault.com", "https://serverfault.com/users/175956/" ]
Welcome to backup world Brian! I think I was in your position some time ago when thinking of backups as waste of time and, perhaps, money, but you get into the point once being bitten! I think you need image based backup with VSS integration that guarantees consistency of your data and backups. There are many solutio...
I would recommend backing up each item separately. This way, if something goes wrong with only one item, you only need to recover that one item... It sounds like you are on the right track for the web content backup, but for SQL I'd suggest using the job functionality in MSSQL server (as opposed to task scheduler). Th...
53,748,348
How can the following function be **efficiently** implemented in tensorflow and/or numpy? ``` add_along_axis(tensor=T, vector=v, axis=k) # T is a tensor of shape (N1,...,Nd) (unknown beforehand) # v is a vector with N components # k is an integer such that Nk=N S = T+v, summed along k return S...
2018/12/12
[ "https://Stackoverflow.com/questions/53748348", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9318372/" ]
I know in Django, another web framework for python, you have to reference the field in the object, not just the object itself. So if you do a Select \*, instead of a Select 'field': ``` @app.route('/update') def update(): c = get_db().cursor() # this just gets the data from the db c.execute('SELECT * FROM FLO...
I'm not sure what exactly might be happening here but since I was in such a situation before I'd suggest you to test whether the data is being obtained from the database first rather than checking it directly for the part where Flask renders it. Ensure existence of data for the query being passed too. Hope this will ...
11,085,236
I'm with a little problem. I have the container div for some elements which are images, inside other divs. Something like: ``` <div id="container"> <div id="draggable"> <img src="something"> </div> </div> ``` I need to center the container verticaly, but i can't use the top: -healfHeight; margin-top...
2012/06/18
[ "https://Stackoverflow.com/questions/11085236", "https://Stackoverflow.com", "https://Stackoverflow.com/users/828315/" ]
``` var wh = $(window).height(); var ch = $('#container').height(); var mt = (wh - ch) / 2; $('#container').css('margin-top', mt) ``` <http://jsfiddle.net/zJrKh/1/>
I'm not sure how jquery positioning works, but if your answer involves only position on these divs with CSS, then: Make the container div position:absolute; top:50%; left:50%; Then your 'draggable' div needs this positioning: position:relative; top:(-half the total height of the div); left:(-half the width of t...
11,085,236
I'm with a little problem. I have the container div for some elements which are images, inside other divs. Something like: ``` <div id="container"> <div id="draggable"> <img src="something"> </div> </div> ``` I need to center the container verticaly, but i can't use the top: -healfHeight; margin-top...
2012/06/18
[ "https://Stackoverflow.com/questions/11085236", "https://Stackoverflow.com", "https://Stackoverflow.com/users/828315/" ]
``` var wh = $(window).height(); var ch = $('#container').height(); var mt = (wh - ch) / 2; $('#container').css('margin-top', mt) ``` <http://jsfiddle.net/zJrKh/1/>
``` <div id="container"> <div id="draggable"> <img src="something"> </div> </div> ``` Marke sure the parent width is wider than the draggable element, then try: ``` #draggable{display:block;margin:0 auto} ``` Edit, sorry, just realised you need it centered vertically. Try: ``` #container{display...
11,085,236
I'm with a little problem. I have the container div for some elements which are images, inside other divs. Something like: ``` <div id="container"> <div id="draggable"> <img src="something"> </div> </div> ``` I need to center the container verticaly, but i can't use the top: -healfHeight; margin-top...
2012/06/18
[ "https://Stackoverflow.com/questions/11085236", "https://Stackoverflow.com", "https://Stackoverflow.com/users/828315/" ]
Try setting the parent container to `position: relative`, and the element you want to center to `margin: auto`.
I'm not sure how jquery positioning works, but if your answer involves only position on these divs with CSS, then: Make the container div position:absolute; top:50%; left:50%; Then your 'draggable' div needs this positioning: position:relative; top:(-half the total height of the div); left:(-half the width of t...
11,085,236
I'm with a little problem. I have the container div for some elements which are images, inside other divs. Something like: ``` <div id="container"> <div id="draggable"> <img src="something"> </div> </div> ``` I need to center the container verticaly, but i can't use the top: -healfHeight; margin-top...
2012/06/18
[ "https://Stackoverflow.com/questions/11085236", "https://Stackoverflow.com", "https://Stackoverflow.com/users/828315/" ]
Try setting the parent container to `position: relative`, and the element you want to center to `margin: auto`.
``` <div id="container"> <div id="draggable"> <img src="something"> </div> </div> ``` Marke sure the parent width is wider than the draggable element, then try: ``` #draggable{display:block;margin:0 auto} ``` Edit, sorry, just realised you need it centered vertically. Try: ``` #container{display...
64,998,076
I'm sending around 7k emails using Laravel and SES. Because I have a limit of 10 emails per second I need to delay when Laravel is sending all the emails in batches of 10 at a time. Controller ``` public function queue(){ $invites = Subscriber::all(); $send_at = now(); foreach ($invites as $i => $invite){ if($...
2020/11/25
[ "https://Stackoverflow.com/questions/64998076", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5301798/" ]
You can loop through your `ul li` using `each` loop then use `$(this)` to check if the radio is checked depending on this `add` or `remove` your class. ***Demo Code*** : ```js $(document).ready(function() { $("ul.options-list li").on("click", function() { //loop through ul li $("ul.options-list li").each(fun...
I am not great with javascript. but maybe give all your radio buttons the same class and add something like this document.getElementByClass("myCheck").checked = true; and then addClass('change\_color') to those selected. <https://www.w3schools.com/jsref/prop_checkbox_checked.asp>
37,713,974
I'm having some difficulties trying to make a laravel migration from SQL database, this is my SQL: ``` CREATE TABLE `customers` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `user_id` int(11) unsigned NOT NULL, `taxtype_id` int(10) NOT NULL, `code` varchar(50) COLLATE utf8_unicode_ci NOT NULL, `name` varc...
2016/06/08
[ "https://Stackoverflow.com/questions/37713974", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2480685/" ]
I am going with ButtonPiglet on this one, Laravel doesn't allow specifying lengths on integer fields. It is causing user\_id, taxtype, and code to be auto\_increment primary keys. I change these three from ``` $table->integer('user_id',11)->unsigned(); $table->integer('taxtype_id',10)->unsigned(); $table->integer('co...
The laravel schema builder doesn't support specifying lengths of integer. Remove the second argument from all your integer fields, or change them to tinyInteger, smallInteger, etc...
37,713,974
I'm having some difficulties trying to make a laravel migration from SQL database, this is my SQL: ``` CREATE TABLE `customers` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `user_id` int(11) unsigned NOT NULL, `taxtype_id` int(10) NOT NULL, `code` varchar(50) COLLATE utf8_unicode_ci NOT NULL, `name` varc...
2016/06/08
[ "https://Stackoverflow.com/questions/37713974", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2480685/" ]
I am going with ButtonPiglet on this one, Laravel doesn't allow specifying lengths on integer fields. It is causing user\_id, taxtype, and code to be auto\_increment primary keys. I change these three from ``` $table->integer('user_id',11)->unsigned(); $table->integer('taxtype_id',10)->unsigned(); $table->integer('co...
Finally I found the solution making use of DB::unprepared to do some RAW sql, now its working good and it looks like this: ``` { Schema::create('customers', function (Blueprint $table) { $table->increments('id'); $table->integer('user_id')->unsigned(); $table->integer('taxtype_id')->unsigne...
3,156,487
This might have been asked before, but certainly I don't find any source. Even in the literature I've consulted, there is no such proof so far. ### Context In the context of the simply typed lambda calculus (say with just one base type $\iota)$ there are judgments of the form $$ \Gamma \vdash t : \sigma $$ denoting...
2019/03/21
[ "https://math.stackexchange.com/questions/3156487", "https://math.stackexchange.com", "https://math.stackexchange.com/users/127196/" ]
You are right in your intuition that proving that a derivation does *not* exist is somewhat cumbersome. Soundness and completeness of formal proof systems provide us with an interesting duality: $\vDash \phi \Leftrightarrow$ *all* models satisfy $\phi$ $\Leftrightarrow$ *there exists no* model that does not satisfy $\...
Gentzen designed his logic to be normalizable. So for example, if a proof has $\land\text{-intro}$ followed by $\land\text{-elim}$ of the same introduced subexpression, then the proof can be simplified by removing those 2 steps. Type theoretic proofs are represented as typed lambda expressions. The normalization corre...
57,587,633
I am removing rows from a fairly large data frame using the following code. ```py try: df = df[~df['Full'].str.contains(myregex, regex=True, case=False)] return df ``` However, instead of decreasing the size of the data frame in memory on each iteration (large amounts of data are removed each time), the task...
2019/08/21
[ "https://Stackoverflow.com/questions/57587633", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11718562/" ]
You could try calling `gc.collect()` after each filtering event. Normally a collection is triggered after a certain amount of allocations and de-allocations. But if you only perform a small number of *huge* de-allocations you might want to trigger it manually. Python itself doesn't seem to release memory back to the O...
Why do you use: try and return? followed by this post: [How to filter rows containing a string pattern from a Pandas dataframe](https://stackoverflow.com/questions/27975069/how-to-filter-rows-containing-a-string-pattern-from-a-pandas-dataframe) ``` df = df[~df['Full'].str.contains(mystr)] ``` In the post are also o...
3,240,704
I'm trying to execute an external program with Java using `ProcessBuilder`, but it expects input from the user. To be more specific, the program is `PGSQL` (Postgres SQL), when it's executed the program prompts the user for a password. The only way to bypass that is to save a file in the user home containing the passw...
2010/07/13
[ "https://Stackoverflow.com/questions/3240704", "https://Stackoverflow.com", "https://Stackoverflow.com/users/390855/" ]
I was able to add by adding javascript on the protected source on fckconfig.js file ``` FCKConfig.ProtectedSource.Add( /<javascript>[\s\S]*?&lt;\/javascript&gt;/g ); ```
Try this, works in the regex tester anyway. ``` FCKConfig.ProtectedSource.Add( /<script>[\s\S]*?<\/script>/g ); ```
14,912,425
I want to make a clone of a model currently being edited. I've found a couple of ways that almost work. But neither are perfect. 1) `model.get('data.attributes')` gets all the attributes except for relationships in camelCase form, generates a new record fine but the relationships are missing of course. 2) `model.ser...
2013/02/16
[ "https://Stackoverflow.com/questions/14912425", "https://Stackoverflow.com", "https://Stackoverflow.com/users/555240/" ]
Now we have a add-on to copy models [ember-cli-copyable](https://www.npmjs.com/package/ember-cli-copyable) With this add on, just add the `Copyable` mix-in to the target model which is to be copied and use the copy method Example from the add-on site ``` import Copyable from 'ember-cli-copyable'; Account = DS.Mode...
Here's an updated answer, it still doesn't handle `hasMany` relationships. ``` cloneBelongsTo: function(fromModel, toModel) { var relationships; relationships = Em.get(fromModel.constructor, 'relationships'); return relationships.forEach(function(relationshipType) { var _relType; _relType = relationships...
14,912,425
I want to make a clone of a model currently being edited. I've found a couple of ways that almost work. But neither are perfect. 1) `model.get('data.attributes')` gets all the attributes except for relationships in camelCase form, generates a new record fine but the relationships are missing of course. 2) `model.ser...
2013/02/16
[ "https://Stackoverflow.com/questions/14912425", "https://Stackoverflow.com", "https://Stackoverflow.com/users/555240/" ]
Most simple way I found: ``` function cloneModel(model) { const root = model._internalModel.modelName; const store = model.get('store'); let attrs = model.toJSON(); attrs.id = `clone-${attrs.id}`; store.pushPayload({ [root]: attrs }); return store.peekRecord(root, attrs.id); } ```
This will also solve my problem ``` Account = DS.Model.extend({ name: DS.attr('string'), playlists: DS.hasMany('playList'), favoriteSong: DS.belongsTo('song') }); Duplicate = Ember.Object.extend({}); TemporaryRoute = Ember.Route.extend({ model : function(){ var model = this.store.findAll('account')...
14,912,425
I want to make a clone of a model currently being edited. I've found a couple of ways that almost work. But neither are perfect. 1) `model.get('data.attributes')` gets all the attributes except for relationships in camelCase form, generates a new record fine but the relationships are missing of course. 2) `model.ser...
2013/02/16
[ "https://Stackoverflow.com/questions/14912425", "https://Stackoverflow.com", "https://Stackoverflow.com/users/555240/" ]
Now we have a add-on to copy models [ember-cli-copyable](https://www.npmjs.com/package/ember-cli-copyable) With this add on, just add the `Copyable` mix-in to the target model which is to be copied and use the copy method Example from the add-on site ``` import Copyable from 'ember-cli-copyable'; Account = DS.Mode...
Here is the simple way to clone your **Ember Model with relationships. working fine.** Create a Copyable mixin like, ``` import Ember from 'ember'; export default Ember.Mixin.create(Ember.Copyable, { copy(deepClone) { var model = this, attrs = model.toJSON(), class_type = model.constructor; var root...
14,912,425
I want to make a clone of a model currently being edited. I've found a couple of ways that almost work. But neither are perfect. 1) `model.get('data.attributes')` gets all the attributes except for relationships in camelCase form, generates a new record fine but the relationships are missing of course. 2) `model.ser...
2013/02/16
[ "https://Stackoverflow.com/questions/14912425", "https://Stackoverflow.com", "https://Stackoverflow.com/users/555240/" ]
How about using toJSON() method instead of serialize() like this `js transaction.createRecord(App.Document, model.toJSON());`
Most simple way I found: ``` function cloneModel(model) { const root = model._internalModel.modelName; const store = model.get('store'); let attrs = model.toJSON(); attrs.id = `clone-${attrs.id}`; store.pushPayload({ [root]: attrs }); return store.peekRecord(root, attrs.id); } ```
14,912,425
I want to make a clone of a model currently being edited. I've found a couple of ways that almost work. But neither are perfect. 1) `model.get('data.attributes')` gets all the attributes except for relationships in camelCase form, generates a new record fine but the relationships are missing of course. 2) `model.ser...
2013/02/16
[ "https://Stackoverflow.com/questions/14912425", "https://Stackoverflow.com", "https://Stackoverflow.com/users/555240/" ]
You can use <https://github.com/offirgolan/ember-data-copyable>. Been using this package for some time now, and it is very much reliable. Some of its features : * Shallow & deep copy an Ember Data model * Shallow & deep copy model relationships * Handles cyclical relationships * Handles custom transforms to create tru...
Here is the simple way to clone your **Ember Model with relationships. working fine.** Create a Copyable mixin like, ``` import Ember from 'ember'; export default Ember.Mixin.create(Ember.Copyable, { copy(deepClone) { var model = this, attrs = model.toJSON(), class_type = model.constructor; var root...
14,912,425
I want to make a clone of a model currently being edited. I've found a couple of ways that almost work. But neither are perfect. 1) `model.get('data.attributes')` gets all the attributes except for relationships in camelCase form, generates a new record fine but the relationships are missing of course. 2) `model.ser...
2013/02/16
[ "https://Stackoverflow.com/questions/14912425", "https://Stackoverflow.com", "https://Stackoverflow.com/users/555240/" ]
How about using toJSON() method instead of serialize() like this `js transaction.createRecord(App.Document, model.toJSON());`
Here is the simple way to clone your **Ember Model with relationships. working fine.** Create a Copyable mixin like, ``` import Ember from 'ember'; export default Ember.Mixin.create(Ember.Copyable, { copy(deepClone) { var model = this, attrs = model.toJSON(), class_type = model.constructor; var root...
14,912,425
I want to make a clone of a model currently being edited. I've found a couple of ways that almost work. But neither are perfect. 1) `model.get('data.attributes')` gets all the attributes except for relationships in camelCase form, generates a new record fine but the relationships are missing of course. 2) `model.ser...
2013/02/16
[ "https://Stackoverflow.com/questions/14912425", "https://Stackoverflow.com", "https://Stackoverflow.com/users/555240/" ]
Now we have a add-on to copy models [ember-cli-copyable](https://www.npmjs.com/package/ember-cli-copyable) With this add on, just add the `Copyable` mix-in to the target model which is to be copied and use the copy method Example from the add-on site ``` import Copyable from 'ember-cli-copyable'; Account = DS.Mode...
This will also solve my problem ``` Account = DS.Model.extend({ name: DS.attr('string'), playlists: DS.hasMany('playList'), favoriteSong: DS.belongsTo('song') }); Duplicate = Ember.Object.extend({}); TemporaryRoute = Ember.Route.extend({ model : function(){ var model = this.store.findAll('account')...
14,912,425
I want to make a clone of a model currently being edited. I've found a couple of ways that almost work. But neither are perfect. 1) `model.get('data.attributes')` gets all the attributes except for relationships in camelCase form, generates a new record fine but the relationships are missing of course. 2) `model.ser...
2013/02/16
[ "https://Stackoverflow.com/questions/14912425", "https://Stackoverflow.com", "https://Stackoverflow.com/users/555240/" ]
You can use <https://github.com/offirgolan/ember-data-copyable>. Been using this package for some time now, and it is very much reliable. Some of its features : * Shallow & deep copy an Ember Data model * Shallow & deep copy model relationships * Handles cyclical relationships * Handles custom transforms to create tru...
This will also solve my problem ``` Account = DS.Model.extend({ name: DS.attr('string'), playlists: DS.hasMany('playList'), favoriteSong: DS.belongsTo('song') }); Duplicate = Ember.Object.extend({}); TemporaryRoute = Ember.Route.extend({ model : function(){ var model = this.store.findAll('account')...
14,912,425
I want to make a clone of a model currently being edited. I've found a couple of ways that almost work. But neither are perfect. 1) `model.get('data.attributes')` gets all the attributes except for relationships in camelCase form, generates a new record fine but the relationships are missing of course. 2) `model.ser...
2013/02/16
[ "https://Stackoverflow.com/questions/14912425", "https://Stackoverflow.com", "https://Stackoverflow.com/users/555240/" ]
Now we have a add-on to copy models [ember-cli-copyable](https://www.npmjs.com/package/ember-cli-copyable) With this add on, just add the `Copyable` mix-in to the target model which is to be copied and use the copy method Example from the add-on site ``` import Copyable from 'ember-cli-copyable'; Account = DS.Mode...
You can use <https://github.com/offirgolan/ember-data-copyable>. Been using this package for some time now, and it is very much reliable. Some of its features : * Shallow & deep copy an Ember Data model * Shallow & deep copy model relationships * Handles cyclical relationships * Handles custom transforms to create tru...
14,912,425
I want to make a clone of a model currently being edited. I've found a couple of ways that almost work. But neither are perfect. 1) `model.get('data.attributes')` gets all the attributes except for relationships in camelCase form, generates a new record fine but the relationships are missing of course. 2) `model.ser...
2013/02/16
[ "https://Stackoverflow.com/questions/14912425", "https://Stackoverflow.com", "https://Stackoverflow.com/users/555240/" ]
Now we have a add-on to copy models [ember-cli-copyable](https://www.npmjs.com/package/ember-cli-copyable) With this add on, just add the `Copyable` mix-in to the target model which is to be copied and use the copy method Example from the add-on site ``` import Copyable from 'ember-cli-copyable'; Account = DS.Mode...
Most simple way I found: ``` function cloneModel(model) { const root = model._internalModel.modelName; const store = model.get('store'); let attrs = model.toJSON(); attrs.id = `clone-${attrs.id}`; store.pushPayload({ [root]: attrs }); return store.peekRecord(root, attrs.id); } ```
8,865,545
I have a local repository that is a full copy of a repository on Github. I made a change that I would like to contribute to the original project. How can I do this without reloading my project on Github? I don't think opening an issue is the right way.. I saw in [How can I contribute a patch to github?](https://stack...
2012/01/14
[ "https://Stackoverflow.com/questions/8865545", "https://Stackoverflow.com", "https://Stackoverflow.com/users/611901/" ]
Yes, you should fork the project, but there's no need to clone/pull/merge anything. After you click the fork button, do ``` git remote add yourfork git@github.com:<yourname>/<project>.git ``` and push your branch to your fork with ``` git push yourfork branchname ``` then issue a pull request. If you delete the ...
You can always send a patch file to the maintainer by e-mail. The Linux kernel has been crafted that way for a very long time.
8,865,545
I have a local repository that is a full copy of a repository on Github. I made a change that I would like to contribute to the original project. How can I do this without reloading my project on Github? I don't think opening an issue is the right way.. I saw in [How can I contribute a patch to github?](https://stack...
2012/01/14
[ "https://Stackoverflow.com/questions/8865545", "https://Stackoverflow.com", "https://Stackoverflow.com/users/611901/" ]
You should fork the project, yes. However, **this does not mean you need to clone the whole stuff again locally**. Explanation: a simple way of looking at a git repository is a graph of commits (it is directed and acyclic but that is irrelevant for this discussion); and all nodes of this graph, ie the commits, have a ...
You can always send a patch file to the maintainer by e-mail. The Linux kernel has been crafted that way for a very long time.
8,865,545
I have a local repository that is a full copy of a repository on Github. I made a change that I would like to contribute to the original project. How can I do this without reloading my project on Github? I don't think opening an issue is the right way.. I saw in [How can I contribute a patch to github?](https://stack...
2012/01/14
[ "https://Stackoverflow.com/questions/8865545", "https://Stackoverflow.com", "https://Stackoverflow.com/users/611901/" ]
You can always send a patch file to the maintainer by e-mail. The Linux kernel has been crafted that way for a very long time.
Without fiddling with your current copy of the repository. * Create the patches with `format-patch`. * Fork upstream and clone it, but don't replace your working copy. * Apply the patches with `git am` to the newly forked project, push them and create the merge request. This is not the nicest solution, but it prevent...
8,865,545
I have a local repository that is a full copy of a repository on Github. I made a change that I would like to contribute to the original project. How can I do this without reloading my project on Github? I don't think opening an issue is the right way.. I saw in [How can I contribute a patch to github?](https://stack...
2012/01/14
[ "https://Stackoverflow.com/questions/8865545", "https://Stackoverflow.com", "https://Stackoverflow.com/users/611901/" ]
You should fork the project, yes. However, **this does not mean you need to clone the whole stuff again locally**. Explanation: a simple way of looking at a git repository is a graph of commits (it is directed and acyclic but that is irrelevant for this discussion); and all nodes of this graph, ie the commits, have a ...
Yes, you should fork the project, but there's no need to clone/pull/merge anything. After you click the fork button, do ``` git remote add yourfork git@github.com:<yourname>/<project>.git ``` and push your branch to your fork with ``` git push yourfork branchname ``` then issue a pull request. If you delete the ...
8,865,545
I have a local repository that is a full copy of a repository on Github. I made a change that I would like to contribute to the original project. How can I do this without reloading my project on Github? I don't think opening an issue is the right way.. I saw in [How can I contribute a patch to github?](https://stack...
2012/01/14
[ "https://Stackoverflow.com/questions/8865545", "https://Stackoverflow.com", "https://Stackoverflow.com/users/611901/" ]
Yes, you should fork the project, but there's no need to clone/pull/merge anything. After you click the fork button, do ``` git remote add yourfork git@github.com:<yourname>/<project>.git ``` and push your branch to your fork with ``` git push yourfork branchname ``` then issue a pull request. If you delete the ...
Without fiddling with your current copy of the repository. * Create the patches with `format-patch`. * Fork upstream and clone it, but don't replace your working copy. * Apply the patches with `git am` to the newly forked project, push them and create the merge request. This is not the nicest solution, but it prevent...
8,865,545
I have a local repository that is a full copy of a repository on Github. I made a change that I would like to contribute to the original project. How can I do this without reloading my project on Github? I don't think opening an issue is the right way.. I saw in [How can I contribute a patch to github?](https://stack...
2012/01/14
[ "https://Stackoverflow.com/questions/8865545", "https://Stackoverflow.com", "https://Stackoverflow.com/users/611901/" ]
You should fork the project, yes. However, **this does not mean you need to clone the whole stuff again locally**. Explanation: a simple way of looking at a git repository is a graph of commits (it is directed and acyclic but that is irrelevant for this discussion); and all nodes of this graph, ie the commits, have a ...
Without fiddling with your current copy of the repository. * Create the patches with `format-patch`. * Fork upstream and clone it, but don't replace your working copy. * Apply the patches with `git am` to the newly forked project, push them and create the merge request. This is not the nicest solution, but it prevent...
70,145,463
I would like to ask you if it is correct way how to use authentication in laravel 8? I want to make web which will be visible just for logeddin users. My solution is here. But I want to know if I will have more routes is there some way how to do it with one command and no need to add for each route? ``` Route::get('...
2021/11/28
[ "https://Stackoverflow.com/questions/70145463", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17064560/" ]
You can use route groups, Laravel's documentation is here; <https://laravel.com/docs/8.x/routing#route-group-middleware> Your example could be updated to: ```php Route::middleware(['auth'])->group(function () { Route::get('/', [PagesController::class,'index']); Route::get('edit/{id}', [PagesController::class...
At **App\Providers\RouteServiceProvider** define ``` public function boot() { Route::pattern('id', '[0-9]+'); } ``` Once the pattern has been defined, it is automatically applied to all routes using that parameter name: ``` Route::get('/user/{id}', function ($id) { // Only executed if {id} is numeric... });...
441
We've got a lot of [quitters.](https://workplace.stackexchange.com/search?q=quit) It's a fact of life that sometimes you do need to resign, and there are real, generally applicable problems around [resignation](https://workplace.stackexchange.com/questions/tagged/resignation "show questions tagged 'resignation'"). The...
2012/09/17
[ "https://workplace.meta.stackexchange.com/questions/441", "https://workplace.meta.stackexchange.com", "https://workplace.meta.stackexchange.com/users/42/" ]
Any question that can be answered with a Yes or No is a bad question for ALL SE's. They invite polling, and opinion sharing. I am opposed to the kind of reworking that questions like these need to become constructive. What should I do questions are usually their end goals. The answer is different for "I need to be away...
I think, your question reveals a bigger problem which applies to many SE sites (except maybe purely scientific ones). **There is a large amount of questions that either can't be answered (polling) or too local (and useless to most visitors)**: * If the question does not contain too much details, it invites various opi...
441
We've got a lot of [quitters.](https://workplace.stackexchange.com/search?q=quit) It's a fact of life that sometimes you do need to resign, and there are real, generally applicable problems around [resignation](https://workplace.stackexchange.com/questions/tagged/resignation "show questions tagged 'resignation'"). The...
2012/09/17
[ "https://workplace.meta.stackexchange.com/questions/441", "https://workplace.meta.stackexchange.com", "https://workplace.meta.stackexchange.com/users/42/" ]
Any question that can be answered with a Yes or No is a bad question for ALL SE's. They invite polling, and opinion sharing. I am opposed to the kind of reworking that questions like these need to become constructive. What should I do questions are usually their end goals. The answer is different for "I need to be away...
There are times when I think "should I quit" could be reworded to "how do I improve X aspect of my working conditions" which may be more directly applicable. Do we have a blog? I rather feel like this could be a blog item about this specific issue - because fixing a common problem at work (which may lead to quitting) ...
11,394,916
I'm fighting with a implementation of a jTable. I created my own TableModel class. And there is the problem. Somehow my tableData array (ArrayList of Obejct[]) is not being written correctly. At the end I get a table where all the rows are having the values. Does anyone see why the ArrayList is not written correctly? ...
2012/07/09
[ "https://Stackoverflow.com/questions/11394916", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1511924/" ]
The parent implementation of `setValueAt()` does nothing. You'll need to implement `setValueAt()` to update your internal data structure, `tableData`, and fire the appropriate `TableModelEvent`, which will update your view. ``` @Override public void setValueAt(Object aValue, int row, int col) { ... //...
Thanks to trashgod I figured it out (see his post). Working code here: ``` class MyTableModel extends AbstractTableModel { private String[] columnNames = {"Auftragsnummer", "Kunde", "Kunden Nr.", "Erfasst", ...
33,563,137
I use a textfield with code: ``` <input type = "text" size = "2" maxlength = "2" name = "myname"> ``` and a button with: ``` <button type = "button" onclick = "alert('Clicked!')">Print</button> ``` Now, as I click on it, a message/alert pops saying `Clicked!`. How can I make it just display whatever value was on ...
2015/11/06
[ "https://Stackoverflow.com/questions/33563137", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4569926/" ]
Try this solution: ``` <input type="text" id="test" size="2" maxlength="2" name="myname"> <button type="button" onclick="alert(document.getElementById('test').value);">Print</button> ``` A working example you can find here: <http://jsfiddle.net/sebastianbrosch/x8zzvd5s/> **Explanation** You have to add a id to y...
if you are doing this to print a person's name or something using PHP then it should be like this: add this in your body of html: ``` <form name="form1" action="registration.php" method="POST" onsubmit="myFunction()" > <input type="text" name="name" id="name"> <input type="submit" value="submit"> </form> ``` y...
35,084,290
I'm working with bit shifting in Java and have the following piece of code that works as expected: ``` final byte value = 1; final int shift = 1; byte result = value << shift; ``` This produces the value `2` as expected. If however I attempt to extract this into a method like so: ``` private void shiftAndCheck(fina...
2016/01/29
[ "https://Stackoverflow.com/questions/35084290", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1943093/" ]
Since the `value` and `shift` are compile-time constants in this snippet: ``` final byte value = 1; final int shift = 1; byte result = value << shift; ``` then the compiler inlines their values (replaces all the occurrences of `value` and `shift` with their actual values of `1`) and can verify before Runtime that th...
By default arithmetic operations on non floating point number produce an `int` result
35,084,290
I'm working with bit shifting in Java and have the following piece of code that works as expected: ``` final byte value = 1; final int shift = 1; byte result = value << shift; ``` This produces the value `2` as expected. If however I attempt to extract this into a method like so: ``` private void shiftAndCheck(fina...
2016/01/29
[ "https://Stackoverflow.com/questions/35084290", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1943093/" ]
Since the `value` and `shift` are compile-time constants in this snippet: ``` final byte value = 1; final int shift = 1; byte result = value << shift; ``` then the compiler inlines their values (replaces all the occurrences of `value` and `shift` with their actual values of `1`) and can verify before Runtime that th...
``` private void shiftAndCheck(final byte value, final int shift) { byte result = (byte) (value << shift); } ``` As @Konstantin already said it returns `int`, so either cast it into byte or use `int result`.
1,182,526
I was curious if a website (which shall remain nameless) supported HTTPS so I added an S to the protocol of the URL ... now if I try and visit the HTTP version of the site in Chrome, it still tries to request the Secure (HTTPS) version of the site. Unfortunately the site isn't set up to use HTTPS so now the page is par...
2017/02/24
[ "https://superuser.com/questions/1182526", "https://superuser.com", "https://superuser.com/users/63049/" ]
Delete the Chrome Omnibox (Address bar) history using Shift + Del Key. Delete the browsing history from Chrome that should fix the problem. If you own the site, you can use a Apache .htaccess to force only http.
If the domain you were visiting had an improperly configured hsts strict headers served from their https site, then you might need to clear the entry for that site. In chrome you would need to visit this URL `chrome://net-internals/#hsts` which permits you to delete entries from. Source: <http://classically.me/blogs/...
66,633,176
I am just now learning list comprehension in my python class and would like to know why the below code returns an invalid syntax error as a result of the "else" clause? ``` allDays=["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"] daysWithPlaydate=[] for days in range(len(allDays)): ...
2021/03/15
[ "https://Stackoverflow.com/questions/66633176", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15397906/" ]
You don't need to loop twice. Also, the conditional statement is invalid and should be as: ``` outputs=["Weekday Playdate: " + weekdays if weekdays not in ["Friday", "Saturday", "Sunday"] else "Weekend Playdate: " + weekdays for weekdays in daysWithPlaydate] ``` I have also made use of `in` keyword to further simp...
Valid Santax for list comprehension involve IF-ELSE is : ``` list_ = [statment1_ If cond1_ else statment2_ for i in iterable_] ```
66,633,176
I am just now learning list comprehension in my python class and would like to know why the below code returns an invalid syntax error as a result of the "else" clause? ``` allDays=["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"] daysWithPlaydate=[] for days in range(len(allDays)): ...
2021/03/15
[ "https://Stackoverflow.com/questions/66633176", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15397906/" ]
Valid Santax for list comprehension involve IF-ELSE is : ``` list_ = [statment1_ If cond1_ else statment2_ for i in iterable_] ```
Krishna's answer should solve your list comprehension problem. With regard to your question about comma at the end, if you want them in a line separated only by a comma, and no comma at the end, then you could just print the unpacked list, and use the seperator keyword instead of end for the print function. i.e. ```p...
66,633,176
I am just now learning list comprehension in my python class and would like to know why the below code returns an invalid syntax error as a result of the "else" clause? ``` allDays=["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"] daysWithPlaydate=[] for days in range(len(allDays)): ...
2021/03/15
[ "https://Stackoverflow.com/questions/66633176", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15397906/" ]
You don't need to loop twice. Also, the conditional statement is invalid and should be as: ``` outputs=["Weekday Playdate: " + weekdays if weekdays not in ["Friday", "Saturday", "Sunday"] else "Weekend Playdate: " + weekdays for weekdays in daysWithPlaydate] ``` I have also made use of `in` keyword to further simp...
Krishna's answer should solve your list comprehension problem. With regard to your question about comma at the end, if you want them in a line separated only by a comma, and no comma at the end, then you could just print the unpacked list, and use the seperator keyword instead of end for the print function. i.e. ```p...
15,763,044
I have a simple bash script, simple.sh, as follows: ``` #/usr/local/bin/bash for i in $1 do echo The current file is $i done ``` When I run it with the following argument: ``` ./simple.sh /home/test/* ``` it would only print and list out the first file located in the directory. However, if I change...
2013/04/02
[ "https://Stackoverflow.com/questions/15763044", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1835622/" ]
If you take "$1", it is the first file/directory, which is possible! You should do it in this way: ``` for i in "$@" do echo The current file is ${i} done ``` If you execute it with: ``` ./simple.sh * ``` They list you all files of the actual dictionary "$1" is alphabetical the first file/directory of your cur...
How about list the file manully instead of using \*: ``` #/usr/local/bin/bash for i in $(ls $1) do echo The current file is $i done ``` and type ``` ./simple.sh /home/test/ ```
15,763,044
I have a simple bash script, simple.sh, as follows: ``` #/usr/local/bin/bash for i in $1 do echo The current file is $i done ``` When I run it with the following argument: ``` ./simple.sh /home/test/* ``` it would only print and list out the first file located in the directory. However, if I change...
2013/04/02
[ "https://Stackoverflow.com/questions/15763044", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1835622/" ]
If you take "$1", it is the first file/directory, which is possible! You should do it in this way: ``` for i in "$@" do echo The current file is ${i} done ``` If you execute it with: ``` ./simple.sh * ``` They list you all files of the actual dictionary "$1" is alphabetical the first file/directory of your cur...
This is as portable as it gets, has no useless forks to ls and runs with a minimum of CPU cycles wasted: ``` #!/bin/sh cd $1 for i in *; do echo The current file is "$i" done ``` Run as `./simple.sh /home/test`
15,763,044
I have a simple bash script, simple.sh, as follows: ``` #/usr/local/bin/bash for i in $1 do echo The current file is $i done ``` When I run it with the following argument: ``` ./simple.sh /home/test/* ``` it would only print and list out the first file located in the directory. However, if I change...
2013/04/02
[ "https://Stackoverflow.com/questions/15763044", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1835622/" ]
If you take "$1", it is the first file/directory, which is possible! You should do it in this way: ``` for i in "$@" do echo The current file is ${i} done ``` If you execute it with: ``` ./simple.sh * ``` They list you all files of the actual dictionary "$1" is alphabetical the first file/directory of your cur...
Your script does not receive "/home/test/\*" as an argument; the shell expands the patter to the list of files that match, and your shell receives multiple arguments, one per matching file. Quoting the argument will work: ``` ./simple.sh "/home/test/*" ``` Your change to using `DIR=/home/test/*` did what you expecte...
15,763,044
I have a simple bash script, simple.sh, as follows: ``` #/usr/local/bin/bash for i in $1 do echo The current file is $i done ``` When I run it with the following argument: ``` ./simple.sh /home/test/* ``` it would only print and list out the first file located in the directory. However, if I change...
2013/04/02
[ "https://Stackoverflow.com/questions/15763044", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1835622/" ]
This is as portable as it gets, has no useless forks to ls and runs with a minimum of CPU cycles wasted: ``` #!/bin/sh cd $1 for i in *; do echo The current file is "$i" done ``` Run as `./simple.sh /home/test`
How about list the file manully instead of using \*: ``` #/usr/local/bin/bash for i in $(ls $1) do echo The current file is $i done ``` and type ``` ./simple.sh /home/test/ ```
15,763,044
I have a simple bash script, simple.sh, as follows: ``` #/usr/local/bin/bash for i in $1 do echo The current file is $i done ``` When I run it with the following argument: ``` ./simple.sh /home/test/* ``` it would only print and list out the first file located in the directory. However, if I change...
2013/04/02
[ "https://Stackoverflow.com/questions/15763044", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1835622/" ]
Your script does not receive "/home/test/\*" as an argument; the shell expands the patter to the list of files that match, and your shell receives multiple arguments, one per matching file. Quoting the argument will work: ``` ./simple.sh "/home/test/*" ``` Your change to using `DIR=/home/test/*` did what you expecte...
How about list the file manully instead of using \*: ``` #/usr/local/bin/bash for i in $(ls $1) do echo The current file is $i done ``` and type ``` ./simple.sh /home/test/ ```
15,763,044
I have a simple bash script, simple.sh, as follows: ``` #/usr/local/bin/bash for i in $1 do echo The current file is $i done ``` When I run it with the following argument: ``` ./simple.sh /home/test/* ``` it would only print and list out the first file located in the directory. However, if I change...
2013/04/02
[ "https://Stackoverflow.com/questions/15763044", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1835622/" ]
This is as portable as it gets, has no useless forks to ls and runs with a minimum of CPU cycles wasted: ``` #!/bin/sh cd $1 for i in *; do echo The current file is "$i" done ``` Run as `./simple.sh /home/test`
Your script does not receive "/home/test/\*" as an argument; the shell expands the patter to the list of files that match, and your shell receives multiple arguments, one per matching file. Quoting the argument will work: ``` ./simple.sh "/home/test/*" ``` Your change to using `DIR=/home/test/*` did what you expecte...
961,140
These four groups: Klein V, $Z\_4$, $S\_3$, $D\_4$ were probably the most interesting examples used to solve for counterexamples so far. They're so useful that I can most likely guess that one of the four would be the answer on any homework problem. However I cannot but wonder, what are the unique properties for every ...
2014/10/06
[ "https://math.stackexchange.com/questions/961140", "https://math.stackexchange.com", "https://math.stackexchange.com/users/142647/" ]
Each of these groups can be characterized as being smallest with respect to some interesting property, where smallest in this answer means by order: $V\_4$: smallest non-cyclic group, smallest split extension of nontrivial groups (namely $\mathbb{Z}\_2$ by $\mathbb{Z}\_2$), smallest group with exponent strictly smalle...
More particularly, $D\_4$ describes the symmetries of a square. Klein-4 is a good example of a non-cyclic abelian group isomorphic to $\mathbb{Z}\_2 \times \mathbb{Z}\_2$. $S\_3$ is isomorphic $D\_3$ which is the group of symmetries of an equilateral triangle. $S\_3$ is the set of permutations on { 1, 2, 3 }
3,495,344
Let $[0,1]^3$ denote the unit cube in $\mathbb{R}^3$. Let $L : \mathbb{R}^3 \to \mathbb{R}^2$ be a surjective linear map, and let $H := L([0,1]^3)$ (which is generically a hexagon). Can you provide a proof of this statement ? If $w\_1$, $w\_2$, and $w\_1 + w\_2$ are all in $H$, then there exist $v\_1$, $v\_2 \in [0,1...
2020/01/02
[ "https://math.stackexchange.com/questions/3495344", "https://math.stackexchange.com", "https://math.stackexchange.com/users/171444/" ]
The answer to your question is NO, and here is a counterexample. Let $L(x,y,z)=(x-z,y-z)$, $w\_1=(1,1)$, $w\_2=(-\frac{1}{2},0)$, $v\_1=(x\_1,y\_1,z\_1)$, $v\_2=(x\_2,y\_2,z\_2)$. Clearly $L(v\_1)=w\_1$ iff $v\_1$ is of the form $v\_1=F\_1(z\_1)=(1+z\_1,1+z\_1,z\_1)$, and this $F\_1(z\_1)$ is in $[0,1]^3$ iff $z\_1=0...
Incorrect answer, affine but not linear ======================================= I think I can provide a counter example. Suppose the mapping is such that $(x,y,1)$ maps to $(x,y)$, and $(x,y,0)$ maps to $(x-1000,y-1000)$. Then $w\_1 = (0.1,0.2)$, $w\_2 = (0.2,0.1)$ and $w\_1+w\_2 = (0.3,0.3)$. This gives us $v\_1 = ...
37,781,098
I have a Lua interpreter that whenever I make a syntax error in my code, the error message returned is simply `attempted to call a string value`, instead of a meaningful error message. For example if I run this lua code: ``` for a= 1,10 print(a) end ``` Instead of returning a meaningful `'do' expected near 'print...
2016/06/13
[ "https://Stackoverflow.com/questions/37781098", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5624167/" ]
Your problem is that `luaL_loadstring` fails to load the string, since it is not valid Lua code. But you never bother to check its return value to find this out. And therefore, you wind up trying to execute the *compile error* that it pushed onto the stack as though it were a valid Lua function. The correct way to use...
I was able to fix the issue by replacing ``` luaL_loadstring(m_mainState, script.c_str()); // Calls the script int error =lua_pcall(m_mainState, 0, 0, 0); ``` with the code ``` int error = luaL_dostring(m_mainState, script.c_str()); ```
104,839
In Parashat Bealotchah, when the people asked for meat Moses' reaction went eccentric ([Num. 11:10](https://www.sefaria.org.il/Numbers.11.13?vhe=Tanach_with_Ta%27amei_Hamikra&lang=he)): > > מֵאַיִן לִי בָּשָׂר לָתֵת לְכָל־הָעָם הַזֶּה כִּי־יִבְכּוּ עָלַי לֵאמֹר תְּנָה־לָּנוּ בָשָׂר וְנֹאכֵלָה׃ > > לֹא־אוּכַל אָנֹ...
2019/06/15
[ "https://judaism.stackexchange.com/questions/104839", "https://judaism.stackexchange.com", "https://judaism.stackexchange.com/users/15579/" ]
Rav Hirsch says that Moshe Rabbeinu felt that the people were demanding something of him (and not Hashem) that they knew that he could not give them. It was something that they were demanding to be given in a natural and not miraculous manner. In his eyes, this shows that they knew that he was unqualified to be their l...
Perhaps it was [the straw that broke the camel's back](https://en.m.wikipedia.org/wiki/Straw_that_broke_the_camel%27s_back).
104,839
In Parashat Bealotchah, when the people asked for meat Moses' reaction went eccentric ([Num. 11:10](https://www.sefaria.org.il/Numbers.11.13?vhe=Tanach_with_Ta%27amei_Hamikra&lang=he)): > > מֵאַיִן לִי בָּשָׂר לָתֵת לְכָל־הָעָם הַזֶּה כִּי־יִבְכּוּ עָלַי לֵאמֹר תְּנָה־לָּנוּ בָשָׂר וְנֹאכֵלָה׃ > > לֹא־אוּכַל אָנֹ...
2019/06/15
[ "https://judaism.stackexchange.com/questions/104839", "https://judaism.stackexchange.com", "https://judaism.stackexchange.com/users/15579/" ]
[R'Immanuel Bernstien](https://www.journeysintorah.com/about/) asks your question in a beautiful dvar torah over [here](https://www.journeysintorah.com/wp-content/uploads/dimensions_behaalosecha_2021.pdf) I will quote a part of his answer: > > The [Talmud](https://www.sefaria.org/Taanit.9a.9?lang=bi) informs us that...
Perhaps it was [the straw that broke the camel's back](https://en.m.wikipedia.org/wiki/Straw_that_broke_the_camel%27s_back).
23,853,332
In **VS2010**, I wrote the following variadic macros to dump out information to files. ``` #define INDENT(fp, indent) for(size_t __i = 0; __i < (indent); ++__i) fprintf((fp), " ") // IND_FP = indented fprintf. // This macro uses two IMPLICIT parameters. // 1. (FILE *)fp is a pointer to the output file. // 2. (size_t)...
2014/05/25
[ "https://Stackoverflow.com/questions/23853332", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3127828/" ]
``` #define IND_FP Logger(indent) class Logger { public: Logger(int indent); int operator()(FILE* fp, char* format, ...); private: // an exercise for the reader }; ```
``` FILE *g_fp; size_t g_indent; void ind_fp(char *format, ...){ INDENT(g_fp, g_indent); va_list arg_ptr; va_start(arg_ptr, format); vfprintf(g_fp, format, arg_ptr); va_end(arg_ptr); } #define IND_FP (g_fp = fp, g_indent = indent, &ind_fp) ``` This might work for your situation.
23,853,332
In **VS2010**, I wrote the following variadic macros to dump out information to files. ``` #define INDENT(fp, indent) for(size_t __i = 0; __i < (indent); ++__i) fprintf((fp), " ") // IND_FP = indented fprintf. // This macro uses two IMPLICIT parameters. // 1. (FILE *)fp is a pointer to the output file. // 2. (size_t)...
2014/05/25
[ "https://Stackoverflow.com/questions/23853332", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3127828/" ]
You could get round variadics by not using them. Use ofstream instead of FILE\*. Something like this ``` #define LOGGER(logfile,loginfo) logfile << loginfo << std::endl ``` Say you've declared an ofstream called logfile. For simple things, you can use ``` LOGGER(logfile, x); ``` If you wish to get more complex, ...
``` FILE *g_fp; size_t g_indent; void ind_fp(char *format, ...){ INDENT(g_fp, g_indent); va_list arg_ptr; va_start(arg_ptr, format); vfprintf(g_fp, format, arg_ptr); va_end(arg_ptr); } #define IND_FP (g_fp = fp, g_indent = indent, &ind_fp) ``` This might work for your situation.