qid
int64
1
74.7M
question
stringlengths
0
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
2
48.3k
response_k
stringlengths
2
40.5k
155,797
Given a list of positive integers determine if there is an element that is either greater than its two neighbors or less than its two neighbors (a "bump"). To be clear a bump can never be the first or last item of the list because they only have one neighbor. Your program should output one of two consistent values eac...
2018/02/14
[ "https://codegolf.stackexchange.com/questions/155797", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/56656/" ]
[MATL](https://github.com/lmendo/MATL), 8 bytes =============================================== ``` dZSd|1>a ``` [Try it online!](https://tio.run/##y00syfn/PyUqOKXG0C7xv716SFFpqnqtultiTnGq@v9oQx1jIDTUMdAxjAUA "MATL – Try It Online")
C (gcc), 78 bytes ================= *Variant: loop* ``` r,i;f(a,n)int*a;{for(r=n>2,i=0;i<n-2;)r=(a[i++]-a[i])*(a[i]-a[i+1])<0&&r;i=r;} ``` [Try it online!](https://tio.run/##jdPdboIwFAfwe57ihETTakloAT9S2Ys4LoiOpclWFyS7ITw7ayvooE2oN8ih/Z0/R3uJPi@Xvq@J4BUqicRCNpuSt9WtRnUu3xgReczFSUaM4zpH5Vlst0WkLgXe6DvzfUsLfIrX65qLvO...
155,797
Given a list of positive integers determine if there is an element that is either greater than its two neighbors or less than its two neighbors (a "bump"). To be clear a bump can never be the first or last item of the list because they only have one neighbor. Your program should output one of two consistent values eac...
2018/02/14
[ "https://codegolf.stackexchange.com/questions/155797", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/56656/" ]
[J](http://jsoftware.com/), 16 15 bytes ======================================= -1 byte thanks to FrownyFrog ``` 1 e.0>2*/\2-/\] ``` [Try it online!](https://tio.run/##y/qvpKeepmBrpaCuoKNgoGAFxLp6Cs5BPm7/DRVS9QzsjLT0Y4x09WNi/2tyKXClJmfkK6QpGKgYwJiGcIaCERITRRxVxhhFBk0hqiyKmcYIjjGyDEiX0X8A "J – Try It Online") Origi...
[Husk](https://github.com/barbuz/Husk), 9 bytes =============================================== ``` ▼mεẊ-Ẋo±- ``` [Try it online!](https://tio.run/##yygtzv7//9G0Pbnntj7c1aULxPmHNur@//8/2kgHCGMB "Husk – Try It Online") Uses Dennis's algorithm.
155,797
Given a list of positive integers determine if there is an element that is either greater than its two neighbors or less than its two neighbors (a "bump"). To be clear a bump can never be the first or last item of the list because they only have one neighbor. Your program should output one of two consistent values eac...
2018/02/14
[ "https://codegolf.stackexchange.com/questions/155797", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/56656/" ]
[Python 2](https://docs.python.org/2/), 43 bytes ================================================ ```python f=lambda x,y,z,*t:0>(y-x)*(z-y)or f(y,z,*t) ``` Returns *True* if there's a bump, errors if there isn't. ([allowed by default](https://codegolf.meta.stackexchange.com/a/11908/12012)) [Try it online!](https://...
[APL (Dyalog Classic)](https://www.dyalog.com/), 15 bytes ========================================================= ```apl 0∨.>2×/2-/⊃,⊃,⊢ ``` [Try it online!](https://tio.run/##SyzI0U2pTMzJT9dNzkksLs5M/v@ob2pm/qO2CQb/00Dko44VenZGh6frG@nqP@pq1oHgRf//lwBlqx/1bn3UuagIyEx71LvLSj0tMTNHHcgCihc96m5Rz89Wr@V61LtGAQJKFAy4NHQ...
155,797
Given a list of positive integers determine if there is an element that is either greater than its two neighbors or less than its two neighbors (a "bump"). To be clear a bump can never be the first or last item of the list because they only have one neighbor. Your program should output one of two consistent values eac...
2018/02/14
[ "https://codegolf.stackexchange.com/questions/155797", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/56656/" ]
[MATL](https://github.com/lmendo/MATL), 8 bytes =============================================== ``` dZSd|1>a ``` [Try it online!](https://tio.run/##y00syfn/PyUqOKXG0C7xv716SFFpqnqtultiTnGq@v9oQx1jIDTUMdAxjAUA "MATL – Try It Online")
[Julia 0.6](http://julialang.org/), 57 56 bytes =============================================== ```julia l->any(p>c<n||p<c>n for(p,c,n)=zip(l,l[2:end],l[3:end])) ``` Basically just totallyhuman's python answer. -1 byte from user71546 [Try it online!](https://tio.run/##yyrNyUw0@59mm5Sanpn3P0fXLjGvUqPALtkmr6amwCbZLk8...
40,917,189
I want to use WhereIn and Groupby in the same query to fetch Result. I've tried this: ``` $loadids=explode("#@*",$reciptdet->loading_id); $loadingdatas=DB::table('loading')->groupBy('vehicle_no')->whereIn('id',$loadids)->get(); ``` But I got this error message: > > SQLSTATE[42000]: Syntax error or access violatio...
2016/12/01
[ "https://Stackoverflow.com/questions/40917189", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5829419/" ]
You can leave `'strict' => true` and add modes to "mysql" option in. ``` 'mysql' => [ ... .... 'strict' => true, 'modes' => [ //'ONLY_FULL_GROUP_BY', // Disable this to allow grouping by one column 'STRICT_TRANS_TABLES', 'NO_ZERO_IN_DATE', 'NO_ZERO_DATE', 'ERROR_FOR_...
This is on laravel doc 8.x , it works well ``` $users = DB::table('users') ->select(DB::raw('count(*) as user_count, status')) ->where('status', '<>', 1) ->groupBy('status') ->get(); ```
40,917,189
I want to use WhereIn and Groupby in the same query to fetch Result. I've tried this: ``` $loadids=explode("#@*",$reciptdet->loading_id); $loadingdatas=DB::table('loading')->groupBy('vehicle_no')->whereIn('id',$loadids)->get(); ``` But I got this error message: > > SQLSTATE[42000]: Syntax error or access violatio...
2016/12/01
[ "https://Stackoverflow.com/questions/40917189", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5829419/" ]
Without modifiying `config\database.php` file ============================================= **Set `'strict' => false`** in the `config\database.php` could be a **security issue**. So, a simple Laravel solution could be **first call `get()` and then `groupBy('vehicle_no)`**: ``` $loadids = explode("#@*", $reciptdet->l...
update `config/database.php` set: ``` 'mysql' => [ 'strict' => false, ], ``` instead of: ``` 'mysql' => [ 'strict' => true, ], ``` and don't forget to clear cache: ``` php artisan config:cache ```
40,917,189
I want to use WhereIn and Groupby in the same query to fetch Result. I've tried this: ``` $loadids=explode("#@*",$reciptdet->loading_id); $loadingdatas=DB::table('loading')->groupBy('vehicle_no')->whereIn('id',$loadids)->get(); ``` But I got this error message: > > SQLSTATE[42000]: Syntax error or access violatio...
2016/12/01
[ "https://Stackoverflow.com/questions/40917189", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5829419/" ]
Without modifiying `config\database.php` file ============================================= **Set `'strict' => false`** in the `config\database.php` could be a **security issue**. So, a simple Laravel solution could be **first call `get()` and then `groupBy('vehicle_no)`**: ``` $loadids = explode("#@*", $reciptdet->l...
This restriction makes sense as when you use `GROUP BY` in MySQL, it returns one row for each value in the columns used in `GROUP BY`. So, the values of other columns in the selected rows do not make sense to use anywhere. So, it's always recommended to use the best practice and I would recommend not to disable MySQL S...
40,917,189
I want to use WhereIn and Groupby in the same query to fetch Result. I've tried this: ``` $loadids=explode("#@*",$reciptdet->loading_id); $loadingdatas=DB::table('loading')->groupBy('vehicle_no')->whereIn('id',$loadids)->get(); ``` But I got this error message: > > SQLSTATE[42000]: Syntax error or access violatio...
2016/12/01
[ "https://Stackoverflow.com/questions/40917189", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5829419/" ]
Without modifiying `config\database.php` file ============================================= **Set `'strict' => false`** in the `config\database.php` could be a **security issue**. So, a simple Laravel solution could be **first call `get()` and then `groupBy('vehicle_no)`**: ``` $loadids = explode("#@*", $reciptdet->l...
Later, after googling for a while, I learnt that the problem was caused by the `sql_mode` setting, and modified the configuration of **config/database.php** as `strict => false`. Refer to: <https://stdworkflow.com/147/laravel-syntax-error-or-access-violation-1055-error>
40,917,189
I want to use WhereIn and Groupby in the same query to fetch Result. I've tried this: ``` $loadids=explode("#@*",$reciptdet->loading_id); $loadingdatas=DB::table('loading')->groupBy('vehicle_no')->whereIn('id',$loadids)->get(); ``` But I got this error message: > > SQLSTATE[42000]: Syntax error or access violatio...
2016/12/01
[ "https://Stackoverflow.com/questions/40917189", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5829419/" ]
update `config/database.php` set: ``` 'mysql' => [ 'strict' => false, ], ``` instead of: ``` 'mysql' => [ 'strict' => true, ], ``` and don't forget to clear cache: ``` php artisan config:cache ```
This restriction makes sense as when you use `GROUP BY` in MySQL, it returns one row for each value in the columns used in `GROUP BY`. So, the values of other columns in the selected rows do not make sense to use anywhere. So, it's always recommended to use the best practice and I would recommend not to disable MySQL S...
40,917,189
I want to use WhereIn and Groupby in the same query to fetch Result. I've tried this: ``` $loadids=explode("#@*",$reciptdet->loading_id); $loadingdatas=DB::table('loading')->groupBy('vehicle_no')->whereIn('id',$loadids)->get(); ``` But I got this error message: > > SQLSTATE[42000]: Syntax error or access violatio...
2016/12/01
[ "https://Stackoverflow.com/questions/40917189", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5829419/" ]
No need to change any where in your System jut use code like in laravel ``` \DB::statement("SET SQL_MODE=''");//this is the trick use it just before your query $data=Task::where('user_id', Auth::user()->id)->where('status', 0)->groupBy('task_code')->get(['id','task_code', 'title']); ```
Later, after googling for a while, I learnt that the problem was caused by the `sql_mode` setting, and modified the configuration of **config/database.php** as `strict => false`. Refer to: <https://stdworkflow.com/147/laravel-syntax-error-or-access-violation-1055-error>
40,917,189
I want to use WhereIn and Groupby in the same query to fetch Result. I've tried this: ``` $loadids=explode("#@*",$reciptdet->loading_id); $loadingdatas=DB::table('loading')->groupBy('vehicle_no')->whereIn('id',$loadids)->get(); ``` But I got this error message: > > SQLSTATE[42000]: Syntax error or access violatio...
2016/12/01
[ "https://Stackoverflow.com/questions/40917189", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5829419/" ]
I was having this problem also but after changing `'strict' => true`, to `'strict' => false`, the error disappeared. You can find this setting in: **config\database.php** ``` 'mysql' => [ ... 'strict' => false, ... ] ```
You might as well use: **distinct('vehicle\_no')** instead of groupBy('vehicle\_no') each case scenario is different, but looking at your query, distinct might be the way to go since you're not aggregating data.
40,917,189
I want to use WhereIn and Groupby in the same query to fetch Result. I've tried this: ``` $loadids=explode("#@*",$reciptdet->loading_id); $loadingdatas=DB::table('loading')->groupBy('vehicle_no')->whereIn('id',$loadids)->get(); ``` But I got this error message: > > SQLSTATE[42000]: Syntax error or access violatio...
2016/12/01
[ "https://Stackoverflow.com/questions/40917189", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5829419/" ]
No need to change any where in your System jut use code like in laravel ``` \DB::statement("SET SQL_MODE=''");//this is the trick use it just before your query $data=Task::where('user_id', Auth::user()->id)->where('status', 0)->groupBy('task_code')->get(['id','task_code', 'title']); ```
Without modifiying `config\database.php` file ============================================= **Set `'strict' => false`** in the `config\database.php` could be a **security issue**. So, a simple Laravel solution could be **first call `get()` and then `groupBy('vehicle_no)`**: ``` $loadids = explode("#@*", $reciptdet->l...
40,917,189
I want to use WhereIn and Groupby in the same query to fetch Result. I've tried this: ``` $loadids=explode("#@*",$reciptdet->loading_id); $loadingdatas=DB::table('loading')->groupBy('vehicle_no')->whereIn('id',$loadids)->get(); ``` But I got this error message: > > SQLSTATE[42000]: Syntax error or access violatio...
2016/12/01
[ "https://Stackoverflow.com/questions/40917189", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5829419/" ]
Short answer ------------ In `config\database.php` --> `"mysql"` array Set `'strict' => false` to disable all. .... or ------- You can leave `'strict' => true` and add modes to `"mysql"` option in ``` 'mysql' => [ ... .... 'strict' => true, 'modes' => [ //'ONLY_FULL_GROUP_B...
Without modifiying `config\database.php` file ============================================= **Set `'strict' => false`** in the `config\database.php` could be a **security issue**. So, a simple Laravel solution could be **first call `get()` and then `groupBy('vehicle_no)`**: ``` $loadids = explode("#@*", $reciptdet->l...
40,917,189
I want to use WhereIn and Groupby in the same query to fetch Result. I've tried this: ``` $loadids=explode("#@*",$reciptdet->loading_id); $loadingdatas=DB::table('loading')->groupBy('vehicle_no')->whereIn('id',$loadids)->get(); ``` But I got this error message: > > SQLSTATE[42000]: Syntax error or access violatio...
2016/12/01
[ "https://Stackoverflow.com/questions/40917189", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5829419/" ]
I was having this problem also but after changing `'strict' => true`, to `'strict' => false`, the error disappeared. You can find this setting in: **config\database.php** ``` 'mysql' => [ ... 'strict' => false, ... ] ```
I solve a similar issue with using group by by first getting the columns i needed to sort then use the group by. ``` $SampleData= DB::table('tableExampleName')->get(['col1','col2'])->groupBy('col3'); ``` then you can dd() the values and check if they are the right grouping. You can all assign it and pass it into you...
16,761,854
I have found different behavior of code when function is called / returned in different ways. It is quite confusing. So to clear my doubts I have stripped down the whole code to minumum: Let us consider a simple function: ``` function f() { //some code } var objf = f(); ``` **Q1. Now `objf` is undefined. Why? W...
2013/05/26
[ "https://Stackoverflow.com/questions/16761854", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1317018/" ]
Q1. Functions in javascript always return values. The default value is `undefined`, except for constructors, where the default return value is `this`. Since no return value is specified in your Q1 example, the interpreter returns the default value, `undefined`. Q2. `this` is a javascript keyword that gets updated by t...
In the first case, `objf` will indeed be undefined. As the function doesn't return anything, it wouldn't be sensible to just invent something and return that. In the second case, `objf` will be the `Window` object.
16,761,854
I have found different behavior of code when function is called / returned in different ways. It is quite confusing. So to clear my doubts I have stripped down the whole code to minumum: Let us consider a simple function: ``` function f() { //some code } var objf = f(); ``` **Q1. Now `objf` is undefined. Why? W...
2013/05/26
[ "https://Stackoverflow.com/questions/16761854", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1317018/" ]
When you do... ``` function f() { //some code } var objf = f(); ``` ...you're getting the return value of the "f" function, which in this case is undefined, once there's no "return something" statement. If you do... ``` function f() { //some code } var objf = new f(); ``` ...you'll instance a new object ...
In the first case, `objf` will indeed be undefined. As the function doesn't return anything, it wouldn't be sensible to just invent something and return that. In the second case, `objf` will be the `Window` object.
16,761,854
I have found different behavior of code when function is called / returned in different ways. It is quite confusing. So to clear my doubts I have stripped down the whole code to minumum: Let us consider a simple function: ``` function f() { //some code } var objf = f(); ``` **Q1. Now `objf` is undefined. Why? W...
2013/05/26
[ "https://Stackoverflow.com/questions/16761854", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1317018/" ]
Q1. Functions in javascript always return values. The default value is `undefined`, except for constructors, where the default return value is `this`. Since no return value is specified in your Q1 example, the interpreter returns the default value, `undefined`. Q2. `this` is a javascript keyword that gets updated by t...
When you do... ``` function f() { //some code } var objf = f(); ``` ...you're getting the return value of the "f" function, which in this case is undefined, once there's no "return something" statement. If you do... ``` function f() { //some code } var objf = new f(); ``` ...you'll instance a new object ...
12,557,589
I am wondering if it's possible to post something on a user's facebook wall using SLComposeViewController but without showing the share sheet/dialog? Following is the code I am using: ``` if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) { SLComposeViewController *controller = [SL...
2012/09/24
[ "https://Stackoverflow.com/questions/12557589", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1693199/" ]
Import the Social Framework: ``` #import <Social/Social.h> ``` - ``` if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) { SLComposeViewController *controller = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook]; SLComposeViewControllerCom...
this is possible in facebook-ios-sdk 3.0. [here](https://developers.facebook.com/ios/) i am making the share with this code. ``` [FBRequestConnection startWithGraphPath:@"me/feed" parameters:params HTTPMethod:@"POST" completionHandler:^(...
12,557,589
I am wondering if it's possible to post something on a user's facebook wall using SLComposeViewController but without showing the share sheet/dialog? Following is the code I am using: ``` if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) { SLComposeViewController *controller = [SL...
2012/09/24
[ "https://Stackoverflow.com/questions/12557589", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1693199/" ]
Here I got the answer, for posting `image data` and `url` together we need to add Social.framework, this framework is available in iOS6. Just add the `Social.framework` in your project and add the blew code. ``` if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) { SLComposeViewControl...
this is possible in facebook-ios-sdk 3.0. [here](https://developers.facebook.com/ios/) i am making the share with this code. ``` [FBRequestConnection startWithGraphPath:@"me/feed" parameters:params HTTPMethod:@"POST" completionHandler:^(...
12,557,589
I am wondering if it's possible to post something on a user's facebook wall using SLComposeViewController but without showing the share sheet/dialog? Following is the code I am using: ``` if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) { SLComposeViewController *controller = [SL...
2012/09/24
[ "https://Stackoverflow.com/questions/12557589", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1693199/" ]
Add below Code in your ViewController and import below framework. ``` import FBSDKCoreKit import FBSDKLoginKit import FBSDKShareKit @IBAction func btnPostClick(_ sender: Any) { if (FBSDKAccessToken.current() != nil) { if FBSDKAccessToken.current().hasGranted("publish_actions"){ ...
this is possible in facebook-ios-sdk 3.0. [here](https://developers.facebook.com/ios/) i am making the share with this code. ``` [FBRequestConnection startWithGraphPath:@"me/feed" parameters:params HTTPMethod:@"POST" completionHandler:^(...
12,557,589
I am wondering if it's possible to post something on a user's facebook wall using SLComposeViewController but without showing the share sheet/dialog? Following is the code I am using: ``` if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) { SLComposeViewController *controller = [SL...
2012/09/24
[ "https://Stackoverflow.com/questions/12557589", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1693199/" ]
Import the Social Framework: ``` #import <Social/Social.h> ``` - ``` if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) { SLComposeViewController *controller = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook]; SLComposeViewControllerCom...
Here I got the answer, for posting `image data` and `url` together we need to add Social.framework, this framework is available in iOS6. Just add the `Social.framework` in your project and add the blew code. ``` if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) { SLComposeViewControl...
12,557,589
I am wondering if it's possible to post something on a user's facebook wall using SLComposeViewController but without showing the share sheet/dialog? Following is the code I am using: ``` if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) { SLComposeViewController *controller = [SL...
2012/09/24
[ "https://Stackoverflow.com/questions/12557589", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1693199/" ]
Import the Social Framework: ``` #import <Social/Social.h> ``` - ``` if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) { SLComposeViewController *controller = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook]; SLComposeViewControllerCom...
Add below Code in your ViewController and import below framework. ``` import FBSDKCoreKit import FBSDKLoginKit import FBSDKShareKit @IBAction func btnPostClick(_ sender: Any) { if (FBSDKAccessToken.current() != nil) { if FBSDKAccessToken.current().hasGranted("publish_actions"){ ...
54,972
I bought a tablet Samsung Nexus 10, it came with latest Android 4.3 installed. Android 4.2 and higher supports multiple user accounts which is awesome. My question is, if let's say I have Facebook application installed on two accounts, does it install it two times (taking 2x place necessary) or is it efficient and it ...
2013/10/12
[ "https://android.stackexchange.com/questions/54972", "https://android.stackexchange.com", "https://android.stackexchange.com/users/43182/" ]
The second user will have to explicitly install the wanted app (in your example: Facebook) – as otherwise all accounts' app drawers would be cluttered with a bunch of apps not wanted by everybody, except for those who installed them. But if the app already had been installed before by another account, it will rather be...
You can install facebook once and log in with different user/pwd to have different setting for different account
54,972
I bought a tablet Samsung Nexus 10, it came with latest Android 4.3 installed. Android 4.2 and higher supports multiple user accounts which is awesome. My question is, if let's say I have Facebook application installed on two accounts, does it install it two times (taking 2x place necessary) or is it efficient and it ...
2013/10/12
[ "https://android.stackexchange.com/questions/54972", "https://android.stackexchange.com", "https://android.stackexchange.com/users/43182/" ]
The second user will have to explicitly install the wanted app (in your example: Facebook) – as otherwise all accounts' app drawers would be cluttered with a bunch of apps not wanted by everybody, except for those who installed them. But if the app already had been installed before by another account, it will rather be...
A couple of points for those swinging in from Google.. Uninstalling an app in one user account doesn't remove it from the other, unless you use Titanium or similar, in which case it is GONE. If you install an app at the Play Store web site, it installs into the *primary* user "desktop", even if you are logged into an...
14,790,137
I'd really like to use case classes' copy feature in my project, but unfortunately I also need inheritance, which doesn't work well with case classes. So, I'm wondering if it's possible to write a macro which will generate a method for creating copy-with-changes object for an arbitrary class. What stops me there at ...
2013/02/09
[ "https://Stackoverflow.com/questions/14790137", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2052791/" ]
That will be possible with type macros and/or annotation macros. The current macros do not support this. Do look at lenses work, though. There's quite a few macro-based versions around, such as Shapeless.
You could also take a look at <https://github.com/dicarlo2/ScalaEquals>
8,113,701
I have an Android app, in which Activities fire long running operations that run in the background. These operations interact with the Activities when done. I'm developing a component that handles the Activity/Long-Running-Task coupling, taking care of activities being destroyed and recreated. Right now that component...
2011/11/13
[ "https://Stackoverflow.com/questions/8113701", "https://Stackoverflow.com", "https://Stackoverflow.com/users/871910/" ]
Call startService and in onStartCommand return START\_STICKY. It should keep the service going. You may also want to look into foreground services: <http://developer.android.com/reference/android/app/Service.html#startForeground(int>, android.app.Notification)
Yo have to create persistent service. Refer to [this manual](http://developer.android.com/reference/android/content/Context.html#startService%28android.content.Intent%29). In a few words - don't call `bindService`, call `startService`.
8,113,701
I have an Android app, in which Activities fire long running operations that run in the background. These operations interact with the Activities when done. I'm developing a component that handles the Activity/Long-Running-Task coupling, taking care of activities being destroyed and recreated. Right now that component...
2011/11/13
[ "https://Stackoverflow.com/questions/8113701", "https://Stackoverflow.com", "https://Stackoverflow.com/users/871910/" ]
> > Even if I call startService and then bind to it, nothing guarantees that the service instance will exist as long as the application is running. > > > Correct. > > Android can kill sticky services if resources are low. > > > Also correct. All "sticky" means is that Android might restart the service. > >...
Yo have to create persistent service. Refer to [this manual](http://developer.android.com/reference/android/content/Context.html#startService%28android.content.Intent%29). In a few words - don't call `bindService`, call `startService`.
8,113,701
I have an Android app, in which Activities fire long running operations that run in the background. These operations interact with the Activities when done. I'm developing a component that handles the Activity/Long-Running-Task coupling, taking care of activities being destroyed and recreated. Right now that component...
2011/11/13
[ "https://Stackoverflow.com/questions/8113701", "https://Stackoverflow.com", "https://Stackoverflow.com/users/871910/" ]
> > Even if I call startService and then bind to it, nothing guarantees that the service instance will exist as long as the application is running. > > > Correct. > > Android can kill sticky services if resources are low. > > > Also correct. All "sticky" means is that Android might restart the service. > >...
Call startService and in onStartCommand return START\_STICKY. It should keep the service going. You may also want to look into foreground services: <http://developer.android.com/reference/android/app/Service.html#startForeground(int>, android.app.Notification)
1,421,538
I have two points on a map, I want to create a rectangle where the two points are the line that intersect the rectangle. I understand that there is no true rectangle on a sphere, but the areas I am dealing with are small, the length of the rectangles are no more than a few km and the heights a few hundred meters. So if...
2015/09/04
[ "https://math.stackexchange.com/questions/1421538", "https://math.stackexchange.com", "https://math.stackexchange.com/users/267807/" ]
The simplest case: Let the two points be $(x\_1,y\_1)$ and $(x\_2,y\_1)$ and the thickness of rectangle is $t$. The coordinates of the rectangle are: $(x\_1,y\_1+t/2),(x\_1,y\_1-t/2),(x\_2,y\_1-t/2),(x\_2,y\_1+t/2)$
My algorithm/calculation almost works, however in some directions the rectangles aren't right angled. I want to know why, there is a fair amount of approximation in my code, which should be fine based on the scales I use (a few km). I shouldn't have to worry about the curvature of the earth. Anybody know how I can imp...
52,358,998
Before upgrading to `android 3.1`.I usually just change the theme to a theme. app compact. `NoTitleBar` but the new version of `android studio` is having errors recognizing it.I solved this problem by adding base to the beginning. But I can seem to find any answer regarding a style theme that supports removing the cust...
2018/09/16
[ "https://Stackoverflow.com/questions/52358998", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10372416/" ]
In your `res/values/styles.xml` you have this similar block of code. Ensure that you use `Theme.AppCompat.Light.NoActionBar` as `parent` of your theme ``` <!-- Base application theme. --> <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> <!-- Customize your theme here. --> <item name="colorPr...
In my case, i had to change parent theme in res/values/themes.xml [![enter image description here](https://i.stack.imgur.com/Jbc7L.png)](https://i.stack.imgur.com/Jbc7L.png)
52,358,998
Before upgrading to `android 3.1`.I usually just change the theme to a theme. app compact. `NoTitleBar` but the new version of `android studio` is having errors recognizing it.I solved this problem by adding base to the beginning. But I can seem to find any answer regarding a style theme that supports removing the cust...
2018/09/16
[ "https://Stackoverflow.com/questions/52358998", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10372416/" ]
``` Add this style in style file . where other styles are mentioned . <!-- Base application theme. --> <style name="AppThemeNoActionBar" parent="Theme.AppCompat.Light.NoActionBar"> <item name="colorPrimary">@color/colorPrimaryDark</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item n...
In my case, i had to change parent theme in res/values/themes.xml [![enter image description here](https://i.stack.imgur.com/Jbc7L.png)](https://i.stack.imgur.com/Jbc7L.png)
58,301,330
I'm trying to implement the default window with the default trigger to evaluate the behavior but it's not emitting any result. According to Apache Beam: > > The default trigger for a PCollection is based on event time, and > emits the results of the window when the Beam’s watermark passes the > end of the window...
2019/10/09
[ "https://Stackoverflow.com/questions/58301330", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8248386/" ]
The current issue is that the watermark never reaches the end of the `GlobalWindow`. To have a default trigger, you can use any other window where the watermark can reach the end, e.g.: `'window' >> beam.WindowInto(window.FixedWindows(10))` As Guillaume rightly asks, if you're running on Batch, triggers are basically ...
See Sources Below: <https://github.com/apache/beam/blob/828b897a2439437d483b1bd7f2a04871f077bde0/examples/java/src/main/java/org/apache/beam/examples/complete/game/LeaderBoard.java#L274> For more information regarding Google Cloud Dataflow <https://stackoverflow.com/a/54151029/12149235>
18,472
How do you translate the adjective ‘pacifist’ into Latin? ‘pacifistus, a, um’ seems incorrect to me since all the words I’ve found with the suffix *-ista* are nouns, not adjectives. > > **alchemist:** \*alchĕmista or alcumista, ae, m.: Erasm.: Bacon. > (Smith & Hall) > > > > > † **ēvangĕlista (eua-),** ae, m., ...
2022/07/10
[ "https://latin.stackexchange.com/questions/18472", "https://latin.stackexchange.com", "https://latin.stackexchange.com/users/-1/" ]
*Pacifista* and *pacifismus* (both employed by [Vicipaedia](https://la.wikipedia.org/wiki/Pacifismus), by the way) are not exactly the sort of coinage that pleases *Latini* of the old school in the first place. Too literal, unclassical, would stick out like a sore thumb in a letter of Cicero's. Now if a revolutionary ...
The suffix *-isticus* seems quite productive in neo-Latin, and even in classical Latin we have *sophisticus* and *syllogisticus*. If you aren't looking for something fancier, I'd go with that.
238,129
So I have done some googling and experimenting to change the GDM icon (Ubuntu 10.04) and have found the following ways: 1. UbuntTweak 2. Replace `/usr/share/icons/LoginIcons/apps/64/computer.svg` with your own svg 3. Change the gconf config setting `/apps/gdm/simple-greeter/logo_icon_name` to be the name of your icon ...
2011/01/26
[ "https://superuser.com/questions/238129", "https://superuser.com", "https://superuser.com/users/4754/" ]
``` update-icon-caches /usr/share/icons/LoginIcons/apps/64/ ``` or wherever your icon is placed
According to the official GDM Doc for GDM 2.32, the Gconf value edition only works if the user "gdm" has a $HOME directory to write and read theses parameters : <http://library.gnome.org/admin/gdm/2.32/gdm.html#greeterconfiguration>
26,144,013
I have a simple blog, and each blog post has a number of images ranging from 1 to 10. If you click on any of the images in the post, it should scroll you down to the next post. I thought something as simple as this would've worked: ``` $('.each-journal-entry .slider-container .journal-slider .each-slide img').on('clic...
2014/10/01
[ "https://Stackoverflow.com/questions/26144013", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1043706/" ]
jQuery adjusts `offset().top()` based on the current scroll position. Using JavaScript's `offsetTop` property should fix the problem: ``` scrollTop: $this.closest('.each-journal-entry').next()[0].offsetTop ``` Fiddle: **<http://jsfiddle.net/m7cm5oL6/>**
You may want to look at [Ariel Flesler's jQuery `scrollTo` plugin](http://demos.flesler.com/jquery/scrollTo/), I had the same issue and using this saved me hours of debugging.
26,144,013
I have a simple blog, and each blog post has a number of images ranging from 1 to 10. If you click on any of the images in the post, it should scroll you down to the next post. I thought something as simple as this would've worked: ``` $('.each-journal-entry .slider-container .journal-slider .each-slide img').on('clic...
2014/10/01
[ "https://Stackoverflow.com/questions/26144013", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1043706/" ]
jQuery adjusts `offset().top()` based on the current scroll position. Using JavaScript's `offsetTop` property should fix the problem: ``` scrollTop: $this.closest('.each-journal-entry').next()[0].offsetTop ``` Fiddle: **<http://jsfiddle.net/m7cm5oL6/>**
So I think you were trying to use the wrong height. Here I set a variable of height and set it to the height of the current journal/blog object. This allows me to scroll my height all the way down to the next available blog object. <http://jsfiddle.net/w7rtcmp0/24/> ``` $('.each-journal-entry .slider-container .jour...
49,145,372
My continuing saga: I have *Artifactory Pro 5.8.4* running on a *CentOS 7.4* system that uses Artifactory's built-in *Nginx* service as a reverse proxy. Most of the time, during download of a large object, **the connection fails**. Additionally, the last few kilobytes of data that are transferred in the failed connect...
2018/03/07
[ "https://Stackoverflow.com/questions/49145372", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5905820/" ]
The issue could be due to ​[proxy\_max\_temp\_file\_size](http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_max_temp_file_size). The default value is 1GB. Check if `proxy_max_temp_file_size 0` helps.
By the error message, it seems that the issue is the 'Socket Timeout (MS)' parameter on your remote repository (as you mentioned in your comment). In order to resolve the issue go to Artifactory UI --> Remote repositories --> Edit the repository that is having the issue --> Go to Advanced Tab --> Edit the 'Socket Time...
1,711,170
What is the best way for unit testing code paths involving a failed `malloc()`? In most instances, it probably doesn't matter because you're doing something like ``` thingy *my_thingy = malloc(sizeof(thingy)); if (my_thingy == NULL) { fprintf(stderr, "We're so screwed!\n"); exit(EXIT_FAILURE); } ``` but in som...
2009/11/10
[ "https://Stackoverflow.com/questions/1711170", "https://Stackoverflow.com", "https://Stackoverflow.com/users/85467/" ]
I saw a cool solution to this problem which was presented to me by S. Paavolainen. The idea is to override the standard `malloc()`, which you can do just in the linker, by a custom allocator which 1. reads the current execution stack of the thread calling `malloc()` 2. checks if the stack exists in a database that is ...
I suggest creating a specific function for your special malloc code that you expect could fail and you could handle gracefully. For example: ``` void* special_malloc(size_t bytes) { void* ptr = malloc(bytes); if(ptr == NULL) { /* Do something crafty */ } else { return ptr; } } ``` Then you could unit...
1,711,170
What is the best way for unit testing code paths involving a failed `malloc()`? In most instances, it probably doesn't matter because you're doing something like ``` thingy *my_thingy = malloc(sizeof(thingy)); if (my_thingy == NULL) { fprintf(stderr, "We're so screwed!\n"); exit(EXIT_FAILURE); } ``` but in som...
2009/11/10
[ "https://Stackoverflow.com/questions/1711170", "https://Stackoverflow.com", "https://Stackoverflow.com/users/85467/" ]
write your own library that implements malloc by randomly failing or calling the real malloc (either staticly linked or explicitly dlopened) then LD\_PRELOAD it
In FreeBSD I once simply overloaded C library malloc.o module (symbols there were weak) and replaced malloc() implementation with one which had controlled probability to fail. So I linked statically and started to perform testing. srandom() finished the picture with controlled pseudo-random sequence. Also look [here](...
1,711,170
What is the best way for unit testing code paths involving a failed `malloc()`? In most instances, it probably doesn't matter because you're doing something like ``` thingy *my_thingy = malloc(sizeof(thingy)); if (my_thingy == NULL) { fprintf(stderr, "We're so screwed!\n"); exit(EXIT_FAILURE); } ``` but in som...
2009/11/10
[ "https://Stackoverflow.com/questions/1711170", "https://Stackoverflow.com", "https://Stackoverflow.com/users/85467/" ]
I suggest creating a specific function for your special malloc code that you expect could fail and you could handle gracefully. For example: ``` void* special_malloc(size_t bytes) { void* ptr = malloc(bytes); if(ptr == NULL) { /* Do something crafty */ } else { return ptr; } } ``` Then you could unit...
You could hijack malloc by using some defines and global parameter to control it... It's a bit hackish but seems to work. ``` #include <stdio.h> #include <stdlib.h> #define malloc(x) fake_malloc(x) struct { size_t last_request; int should_fail; void *(*real_malloc)(size_t); } fake_malloc_params; void *fake_ma...
1,711,170
What is the best way for unit testing code paths involving a failed `malloc()`? In most instances, it probably doesn't matter because you're doing something like ``` thingy *my_thingy = malloc(sizeof(thingy)); if (my_thingy == NULL) { fprintf(stderr, "We're so screwed!\n"); exit(EXIT_FAILURE); } ``` but in som...
2009/11/10
[ "https://Stackoverflow.com/questions/1711170", "https://Stackoverflow.com", "https://Stackoverflow.com/users/85467/" ]
I saw a cool solution to this problem which was presented to me by S. Paavolainen. The idea is to override the standard `malloc()`, which you can do just in the linker, by a custom allocator which 1. reads the current execution stack of the thread calling `malloc()` 2. checks if the stack exists in a database that is ...
This is a kinda gross, but if you really want unit testing, you could do it with #ifdefs: ``` thingy *my_thingy = malloc(sizeof(thingy)); #ifdef MALLOC_UNIT_TEST_1 my_thingy = NULL; #endif if (my_thingy == NULL) { fprintf(stderr, "We're so screwed!\n"); exit(EXIT_FAILURE); } ``` Unfortunately, you'd have to reco...
1,711,170
What is the best way for unit testing code paths involving a failed `malloc()`? In most instances, it probably doesn't matter because you're doing something like ``` thingy *my_thingy = malloc(sizeof(thingy)); if (my_thingy == NULL) { fprintf(stderr, "We're so screwed!\n"); exit(EXIT_FAILURE); } ``` but in som...
2009/11/10
[ "https://Stackoverflow.com/questions/1711170", "https://Stackoverflow.com", "https://Stackoverflow.com/users/85467/" ]
This is a kinda gross, but if you really want unit testing, you could do it with #ifdefs: ``` thingy *my_thingy = malloc(sizeof(thingy)); #ifdef MALLOC_UNIT_TEST_1 my_thingy = NULL; #endif if (my_thingy == NULL) { fprintf(stderr, "We're so screwed!\n"); exit(EXIT_FAILURE); } ``` Unfortunately, you'd have to reco...
In FreeBSD I once simply overloaded C library malloc.o module (symbols there were weak) and replaced malloc() implementation with one which had controlled probability to fail. So I linked statically and started to perform testing. srandom() finished the picture with controlled pseudo-random sequence. Also look [here](...
1,711,170
What is the best way for unit testing code paths involving a failed `malloc()`? In most instances, it probably doesn't matter because you're doing something like ``` thingy *my_thingy = malloc(sizeof(thingy)); if (my_thingy == NULL) { fprintf(stderr, "We're so screwed!\n"); exit(EXIT_FAILURE); } ``` but in som...
2009/11/10
[ "https://Stackoverflow.com/questions/1711170", "https://Stackoverflow.com", "https://Stackoverflow.com/users/85467/" ]
This is a kinda gross, but if you really want unit testing, you could do it with #ifdefs: ``` thingy *my_thingy = malloc(sizeof(thingy)); #ifdef MALLOC_UNIT_TEST_1 my_thingy = NULL; #endif if (my_thingy == NULL) { fprintf(stderr, "We're so screwed!\n"); exit(EXIT_FAILURE); } ``` Unfortunately, you'd have to reco...
You could hijack malloc by using some defines and global parameter to control it... It's a bit hackish but seems to work. ``` #include <stdio.h> #include <stdlib.h> #define malloc(x) fake_malloc(x) struct { size_t last_request; int should_fail; void *(*real_malloc)(size_t); } fake_malloc_params; void *fake_ma...
1,711,170
What is the best way for unit testing code paths involving a failed `malloc()`? In most instances, it probably doesn't matter because you're doing something like ``` thingy *my_thingy = malloc(sizeof(thingy)); if (my_thingy == NULL) { fprintf(stderr, "We're so screwed!\n"); exit(EXIT_FAILURE); } ``` but in som...
2009/11/10
[ "https://Stackoverflow.com/questions/1711170", "https://Stackoverflow.com", "https://Stackoverflow.com/users/85467/" ]
I suggest creating a specific function for your special malloc code that you expect could fail and you could handle gracefully. For example: ``` void* special_malloc(size_t bytes) { void* ptr = malloc(bytes); if(ptr == NULL) { /* Do something crafty */ } else { return ptr; } } ``` Then you could unit...
In FreeBSD I once simply overloaded C library malloc.o module (symbols there were weak) and replaced malloc() implementation with one which had controlled probability to fail. So I linked statically and started to perform testing. srandom() finished the picture with controlled pseudo-random sequence. Also look [here](...
1,711,170
What is the best way for unit testing code paths involving a failed `malloc()`? In most instances, it probably doesn't matter because you're doing something like ``` thingy *my_thingy = malloc(sizeof(thingy)); if (my_thingy == NULL) { fprintf(stderr, "We're so screwed!\n"); exit(EXIT_FAILURE); } ``` but in som...
2009/11/10
[ "https://Stackoverflow.com/questions/1711170", "https://Stackoverflow.com", "https://Stackoverflow.com/users/85467/" ]
I saw a cool solution to this problem which was presented to me by S. Paavolainen. The idea is to override the standard `malloc()`, which you can do just in the linker, by a custom allocator which 1. reads the current execution stack of the thread calling `malloc()` 2. checks if the stack exists in a database that is ...
write your own library that implements malloc by randomly failing or calling the real malloc (either staticly linked or explicitly dlopened) then LD\_PRELOAD it
1,711,170
What is the best way for unit testing code paths involving a failed `malloc()`? In most instances, it probably doesn't matter because you're doing something like ``` thingy *my_thingy = malloc(sizeof(thingy)); if (my_thingy == NULL) { fprintf(stderr, "We're so screwed!\n"); exit(EXIT_FAILURE); } ``` but in som...
2009/11/10
[ "https://Stackoverflow.com/questions/1711170", "https://Stackoverflow.com", "https://Stackoverflow.com/users/85467/" ]
write your own library that implements malloc by randomly failing or calling the real malloc (either staticly linked or explicitly dlopened) then LD\_PRELOAD it
You could hijack malloc by using some defines and global parameter to control it... It's a bit hackish but seems to work. ``` #include <stdio.h> #include <stdlib.h> #define malloc(x) fake_malloc(x) struct { size_t last_request; int should_fail; void *(*real_malloc)(size_t); } fake_malloc_params; void *fake_ma...
1,711,170
What is the best way for unit testing code paths involving a failed `malloc()`? In most instances, it probably doesn't matter because you're doing something like ``` thingy *my_thingy = malloc(sizeof(thingy)); if (my_thingy == NULL) { fprintf(stderr, "We're so screwed!\n"); exit(EXIT_FAILURE); } ``` but in som...
2009/11/10
[ "https://Stackoverflow.com/questions/1711170", "https://Stackoverflow.com", "https://Stackoverflow.com/users/85467/" ]
I saw a cool solution to this problem which was presented to me by S. Paavolainen. The idea is to override the standard `malloc()`, which you can do just in the linker, by a custom allocator which 1. reads the current execution stack of the thread calling `malloc()` 2. checks if the stack exists in a database that is ...
You could hijack malloc by using some defines and global parameter to control it... It's a bit hackish but seems to work. ``` #include <stdio.h> #include <stdlib.h> #define malloc(x) fake_malloc(x) struct { size_t last_request; int should_fail; void *(*real_malloc)(size_t); } fake_malloc_params; void *fake_ma...
21,948,545
I want to iterate the entries above the main diagonal of a square matrix of size n without using nested loops. For example if the matrix M is of size n=3, then there are choose(3,2)=3 entries above the diagonal. where choose is the binomial coefficient. ``` for(i=1 to choose(n,2)) row = getRow(i) col = getCol(i) ...
2014/02/22
[ "https://Stackoverflow.com/questions/21948545", "https://Stackoverflow.com", "https://Stackoverflow.com/users/176291/" ]
You can use `triu` command of MATLAB as follows: ``` n=5; %user input mat=magic(n); nRows=size(mat,1); nCols=size(mat,2); %extract the elements above the main diagonal u=triu(mat).*(~eye(n)); uT=u.'; %transpose to get the indices in the order you mentioned %arrange it in a vector u_ind=uT(uT~=0); ``` `u_ind` ...
You can try: ``` n = 3; for(int i = 1; i <= n; i++) { for(int j=i+1; j<=n; j++) { row = i; col = j; } } ``` result: 1,2 1,3 2,3
21,948,545
I want to iterate the entries above the main diagonal of a square matrix of size n without using nested loops. For example if the matrix M is of size n=3, then there are choose(3,2)=3 entries above the diagonal. where choose is the binomial coefficient. ``` for(i=1 to choose(n,2)) row = getRow(i) col = getCol(i) ...
2014/02/22
[ "https://Stackoverflow.com/questions/21948545", "https://Stackoverflow.com", "https://Stackoverflow.com/users/176291/" ]
So *you* want a formula ! Ok ! Lets go for some simple maths: The number of entry of the r first rows is `r*(r+1)/2`. Therefore `row` is the largest integer number such that `row*(row+1)/2 <= i`. So row is the integer part of the positive solution of the equation ``` row*(row+1)/2 = i ``` it rewrites as ``` row^2 ...
You can try: ``` n = 3; for(int i = 1; i <= n; i++) { for(int j=i+1; j<=n; j++) { row = i; col = j; } } ``` result: 1,2 1,3 2,3
21,948,545
I want to iterate the entries above the main diagonal of a square matrix of size n without using nested loops. For example if the matrix M is of size n=3, then there are choose(3,2)=3 entries above the diagonal. where choose is the binomial coefficient. ``` for(i=1 to choose(n,2)) row = getRow(i) col = getCol(i) ...
2014/02/22
[ "https://Stackoverflow.com/questions/21948545", "https://Stackoverflow.com", "https://Stackoverflow.com/users/176291/" ]
You can use `triu` command of MATLAB as follows: ``` n=5; %user input mat=magic(n); nRows=size(mat,1); nCols=size(mat,2); %extract the elements above the main diagonal u=triu(mat).*(~eye(n)); uT=u.'; %transpose to get the indices in the order you mentioned %arrange it in a vector u_ind=uT(uT~=0); ``` `u_ind` ...
So *you* want a formula ! Ok ! Lets go for some simple maths: The number of entry of the r first rows is `r*(r+1)/2`. Therefore `row` is the largest integer number such that `row*(row+1)/2 <= i`. So row is the integer part of the positive solution of the equation ``` row*(row+1)/2 = i ``` it rewrites as ``` row^2 ...
72,832,063
I'm trying to create a new column in the below sample data frame that combines the data from the customer\_response and the bot\_response into a list shown in the combined column of the second table shown below. One thing to note is that there will always be the same number of delimiters for the customer and bot colum...
2022/07/01
[ "https://Stackoverflow.com/questions/72832063", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7572119/" ]
When you want to create a column whose value depends on more than one other column, `DataFrame.apply` is a good way to do it. You might try something like this ``` def combine_responses(row): cust_dil = [x for x in row.customer_response.str.split(';')] bot_dil = [x for x in row.bot_response.str.split(';')] ...
Here is a more `pandaic` approach to your problem with no `loops`, `comprehension list` and `apply` logic. ``` import pandas as pd import numpy as np data_dict= { 'conv_id': [1, 2, 3], 'customer_response': ['Make a payment; Credit Card; $1000; Thanks!', 'Replace a card; Ending in 4352; overnight; thanks', 'Wh...
1,782,044
How can I use linqpad with code only in ef 4. I mean how to reference metadata when there is no edmx file?
2009/11/23
[ "https://Stackoverflow.com/questions/1782044", "https://Stackoverflow.com", "https://Stackoverflow.com/users/216874/" ]
I believe you want to `unset($arr['addtocart']);`
``` $vars = array('name' => super, 'price' => 65.87, 'quantity' => 25, 'addtocart' => 1); unset($vars['addtocart']); ```
59,671,638
I am trying to assert a text that's seen on a media gallery overlay page. All I want is for the code to verify if the text is present and if so, assets it matches the expected text. For some reason, I keep getting failed tests. Below is the code I have written in Visual Code: ``` let expSuccessARMessage = "See it in...
2020/01/09
[ "https://Stackoverflow.com/questions/59671638", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7437599/" ]
Not a magician, but you should be getting `browser.getText is not a function` error in the console, because the `getText()` method is defined inside the `element` object, not the `browser` object. Read the complete API log **[here](https://webdriver.io/docs/api/element/getText.html)**. So your code should be: ``` let...
If you defined the element into object repository like: ``` get OtpDescriptionText () { return '//div[@class="otp-description"]'; } ``` In order to **console** or **assert/expect** that element you need to use like: ``` let elem1 = await $(RegistratonPage.OtpDescriptionText); console.log(await elem1.getText()); ``...
72,849
Kann man Absendeadresse sagen? Wenn ich nach "Absendeadresse vs Absenderadresse" [google](https://www.google.com/search?q=Absendeadresse%20vs%20Absenderadresse), bekomme ich Ergebnisse für "Absenderadresse vs Absenderadresse" vorgeschlagen, woraus ich schließe, dass Google meint, "Absendeadresse" sei kein richtiges de...
2023/01/28
[ "https://german.stackexchange.com/questions/72849", "https://german.stackexchange.com", "https://german.stackexchange.com/users/536/" ]
Du kannst im Deutschen Wörter zusammensetzen, wie es dir gefällt, die Frage ist eigentlich nur, ob das Ergebnis für andere verständlich ist. Das ist bei "Absendeadresse" sicherlich der Fall. Etablierte gegenderte Formen existieren für sehr viele Wörter (noch?) nicht, und es gibt auch keine Instanz, die diese festlegen ...
Ein richtiges (wenn auch nicht notwendigerweise gängiges) deutsches Wort ist "Absendeadresse" durchaus. Neben der hohen Wahrscheinlichkeit, dass man es als unbeabsichtigtes Resultat aus einem Tippfehler einstuft, da es sehr nahe an einem tatsächlich gängigen Wort ("Absenderadresse") liegt, sehe ich das Hauptproblem da...
63,984,884
I have a text string, and have identified a set of words which I want to wrap with []. I have stored these words in an array, and have also stored the index position of their first and last characters in each object as well. How can I append [] to either side of these words in Python? Here is an example of a text str...
2020/09/21
[ "https://Stackoverflow.com/questions/63984884", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13444628/" ]
If you sort your list of phrases (I've called it `words`) in reverse order, you can insert the `[` and `]` around each phrase in a loop. The reason you need to do it backwards is because the insertion will change the indexes of subsequent characters in the string: ``` for w in sorted(words, key=lambda x:-x[1]): te...
The following should work: l is your original list and t is yout text: ``` l=[list(i) for i in l] for i in range(len(l)): x1, x2=l[i][1], l[i][2] t=t[:x1]+ '[' + t[x1:x2] + ']' +t[x2:] for k in range(i+1, len(l)): l[k][1]+=2 l[k][2]+=2 ``` This gives the following Output: ``` "The SARs w...
63,984,884
I have a text string, and have identified a set of words which I want to wrap with []. I have stored these words in an array, and have also stored the index position of their first and last characters in each object as well. How can I append [] to either side of these words in Python? Here is an example of a text str...
2020/09/21
[ "https://Stackoverflow.com/questions/63984884", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13444628/" ]
If you sort your list of phrases (I've called it `words`) in reverse order, you can insert the `[` and `]` around each phrase in a loop. The reason you need to do it backwards is because the insertion will change the indexes of subsequent characters in the string: ``` for w in sorted(words, key=lambda x:-x[1]): te...
If you can make certain assumptions about your data, then here's a very simple version which is probably what my first attempt would look like: ``` text = "The SARs were leaked..." keywords_indexed = [('Buzzfeed', 28, 36, 'ORG'), ...] # Construct a set of keywords that we want to bracket words_to_bracket = set(k[0] f...
17,684,201
I am a beginner of JavaScript and want to display an array of objects in HTML. The format of the data is like this: ``` [ {"key":"apple","value":1.90}, {"key":"berry","value":1.7}, {"key":"banana","value":1.5}, {"key":"cherry","value":1.2} ] ``` I want to use a list with three columns (id, name, relevance) ...
2013/07/16
[ "https://Stackoverflow.com/questions/17684201", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2557815/" ]
Explanation ----------- What you want is to fill a table (or another DOMElement) in HTML, with your JavaScript, which is executed dynamically once the page is loaded and your JSON object is received. You want to loop through the object. The best way to do so would be with a `for` loop, and making sure our *looping va...
I am not totally sure what you are asking for. The title of you post seems like you are looking for JSON.stringfy like mentioned in the previous answer but apparently you are not. Are you trying to create and HTML list, ? Can you please try to explain your need again? I doubt what you are trying to do is complicated ...
17,684,201
I am a beginner of JavaScript and want to display an array of objects in HTML. The format of the data is like this: ``` [ {"key":"apple","value":1.90}, {"key":"berry","value":1.7}, {"key":"banana","value":1.5}, {"key":"cherry","value":1.2} ] ``` I want to use a list with three columns (id, name, relevance) ...
2013/07/16
[ "https://Stackoverflow.com/questions/17684201", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2557815/" ]
You can do something like this: ``` var table = document.createElement("table"); //Add a header var header = document.createElement("tr"); var idHeaderCell = document.createElement("th"); var nameHeaderCell = document.createElement("th"); var relevanceHeaderCell = document.createElement("th"); header.appendChild(id...
Maybe like this: ``` function obj2htmltable(obj) { var html = '<table>'; for (var key in obj) { var value = obj[key].toString(); html += '<tr><td>' + key + '</td><td>' + value + '</tr>'; } html += '</table>'; return html; } ``` If case of nested structure (objects inside object) o...
17,684,201
I am a beginner of JavaScript and want to display an array of objects in HTML. The format of the data is like this: ``` [ {"key":"apple","value":1.90}, {"key":"berry","value":1.7}, {"key":"banana","value":1.5}, {"key":"cherry","value":1.2} ] ``` I want to use a list with three columns (id, name, relevance) ...
2013/07/16
[ "https://Stackoverflow.com/questions/17684201", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2557815/" ]
Explanation ----------- What you want is to fill a table (or another DOMElement) in HTML, with your JavaScript, which is executed dynamically once the page is loaded and your JSON object is received. You want to loop through the object. The best way to do so would be with a `for` loop, and making sure our *looping va...
Iterate through the list and retrieve the data for each item this way (assuming your data is in a var called data): ``` for (var i = 0; i < data.length; i++) { var id = i + 1; var name = data[i].key; var relevance = data[i].value; } ``` Then, do something with the variables in each loop, print them out however...
17,684,201
I am a beginner of JavaScript and want to display an array of objects in HTML. The format of the data is like this: ``` [ {"key":"apple","value":1.90}, {"key":"berry","value":1.7}, {"key":"banana","value":1.5}, {"key":"cherry","value":1.2} ] ``` I want to use a list with three columns (id, name, relevance) ...
2013/07/16
[ "https://Stackoverflow.com/questions/17684201", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2557815/" ]
It can be simply done by a small & smart process: ``` <table cellpadding="2" cellspacing="2" border="0" bgcolor="#dfdfdf" width="40%" align="center"> <thead> <tr> <th>Name</th> <th width="20%">Age</th> <th width="12%">Status</th> </tr> </thead> <tbody id="tableData"></tbody> </table...
Array.map() combined with template literals comes in really handy for rendering HTML markup within Javascript for large objects in a scalable manner: ``` function tableMarkupFromObjectArray(obj) { let headers = ` <th>Index</th> ${Object.keys(obj[0]).map((col) =>` <th>${col}</th>` ).join('')}` let content...
17,684,201
I am a beginner of JavaScript and want to display an array of objects in HTML. The format of the data is like this: ``` [ {"key":"apple","value":1.90}, {"key":"berry","value":1.7}, {"key":"banana","value":1.5}, {"key":"cherry","value":1.2} ] ``` I want to use a list with three columns (id, name, relevance) ...
2013/07/16
[ "https://Stackoverflow.com/questions/17684201", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2557815/" ]
It can be simply done by a small & smart process: ``` <table cellpadding="2" cellspacing="2" border="0" bgcolor="#dfdfdf" width="40%" align="center"> <thead> <tr> <th>Name</th> <th width="20%">Age</th> <th width="12%">Status</th> </tr> </thead> <tbody id="tableData"></tbody> </table...
Here a function for build a table from any collection (array of objects) [Table creator](https://codepen.io/anon/pen/KZjVaZ?editors=0010) ``` const data=[ { name: "Kapil", age: 21, status: "Active" }, { name: "John", age: 28, status: "Inactive" }, ...
17,684,201
I am a beginner of JavaScript and want to display an array of objects in HTML. The format of the data is like this: ``` [ {"key":"apple","value":1.90}, {"key":"berry","value":1.7}, {"key":"banana","value":1.5}, {"key":"cherry","value":1.2} ] ``` I want to use a list with three columns (id, name, relevance) ...
2013/07/16
[ "https://Stackoverflow.com/questions/17684201", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2557815/" ]
Array.map() combined with template literals comes in really handy for rendering HTML markup within Javascript for large objects in a scalable manner: ``` function tableMarkupFromObjectArray(obj) { let headers = ` <th>Index</th> ${Object.keys(obj[0]).map((col) =>` <th>${col}</th>` ).join('')}` let content...
Maybe like this: ``` function obj2htmltable(obj) { var html = '<table>'; for (var key in obj) { var value = obj[key].toString(); html += '<tr><td>' + key + '</td><td>' + value + '</tr>'; } html += '</table>'; return html; } ``` If case of nested structure (objects inside object) o...
17,684,201
I am a beginner of JavaScript and want to display an array of objects in HTML. The format of the data is like this: ``` [ {"key":"apple","value":1.90}, {"key":"berry","value":1.7}, {"key":"banana","value":1.5}, {"key":"cherry","value":1.2} ] ``` I want to use a list with three columns (id, name, relevance) ...
2013/07/16
[ "https://Stackoverflow.com/questions/17684201", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2557815/" ]
It can be simply done by a small & smart process: ``` <table cellpadding="2" cellspacing="2" border="0" bgcolor="#dfdfdf" width="40%" align="center"> <thead> <tr> <th>Name</th> <th width="20%">Age</th> <th width="12%">Status</th> </tr> </thead> <tbody id="tableData"></tbody> </table...
Maybe like this: ``` function obj2htmltable(obj) { var html = '<table>'; for (var key in obj) { var value = obj[key].toString(); html += '<tr><td>' + key + '</td><td>' + value + '</tr>'; } html += '</table>'; return html; } ``` If case of nested structure (objects inside object) o...
17,684,201
I am a beginner of JavaScript and want to display an array of objects in HTML. The format of the data is like this: ``` [ {"key":"apple","value":1.90}, {"key":"berry","value":1.7}, {"key":"banana","value":1.5}, {"key":"cherry","value":1.2} ] ``` I want to use a list with three columns (id, name, relevance) ...
2013/07/16
[ "https://Stackoverflow.com/questions/17684201", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2557815/" ]
It can be simply done by a small & smart process: ``` <table cellpadding="2" cellspacing="2" border="0" bgcolor="#dfdfdf" width="40%" align="center"> <thead> <tr> <th>Name</th> <th width="20%">Age</th> <th width="12%">Status</th> </tr> </thead> <tbody id="tableData"></tbody> </table...
I am not totally sure what you are asking for. The title of you post seems like you are looking for JSON.stringfy like mentioned in the previous answer but apparently you are not. Are you trying to create and HTML list, ? Can you please try to explain your need again? I doubt what you are trying to do is complicated ...
17,684,201
I am a beginner of JavaScript and want to display an array of objects in HTML. The format of the data is like this: ``` [ {"key":"apple","value":1.90}, {"key":"berry","value":1.7}, {"key":"banana","value":1.5}, {"key":"cherry","value":1.2} ] ``` I want to use a list with three columns (id, name, relevance) ...
2013/07/16
[ "https://Stackoverflow.com/questions/17684201", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2557815/" ]
Explanation ----------- What you want is to fill a table (or another DOMElement) in HTML, with your JavaScript, which is executed dynamically once the page is loaded and your JSON object is received. You want to loop through the object. The best way to do so would be with a `for` loop, and making sure our *looping va...
You can do something like this: ``` var table = document.createElement("table"); //Add a header var header = document.createElement("tr"); var idHeaderCell = document.createElement("th"); var nameHeaderCell = document.createElement("th"); var relevanceHeaderCell = document.createElement("th"); header.appendChild(id...
17,684,201
I am a beginner of JavaScript and want to display an array of objects in HTML. The format of the data is like this: ``` [ {"key":"apple","value":1.90}, {"key":"berry","value":1.7}, {"key":"banana","value":1.5}, {"key":"cherry","value":1.2} ] ``` I want to use a list with three columns (id, name, relevance) ...
2013/07/16
[ "https://Stackoverflow.com/questions/17684201", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2557815/" ]
It can be simply done by a small & smart process: ``` <table cellpadding="2" cellspacing="2" border="0" bgcolor="#dfdfdf" width="40%" align="center"> <thead> <tr> <th>Name</th> <th width="20%">Age</th> <th width="12%">Status</th> </tr> </thead> <tbody id="tableData"></tbody> </table...
Here is my ES6 solution. I have used the `reduce` operation to construct a `Set` storing the keys from all objects in the array: ``` function arrayToTable(data) { const keys = [...data.reduce((all, obj)=>{ Object.keys(obj).forEach(key => all.add(key)); return all; }, new Set...
70,114,905
I currently have a JSON string I am deserializing with `serde_json`. ``` { "foo": "<val>" // val can contain "SI" or "NO" } ``` I would like to deserialize this to a bool using `serde` and a custom lookup that turns "SI" -> true and vice-versa. ``` #[derive(Deserialize)] pub struct Entry { pub foo: bool, // Ho...
2021/11/25
[ "https://Stackoverflow.com/questions/70114905", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4218017/" ]
You could use `deserialize_with` like so: ```rust #[derive(Deserialize)] pub struct Entry { #[serde(deserialize_with = "deserialize_bool")] pub foo: bool, } fn deserialize_bool<'de, D>(deserializer: D) -> Result<bool, D::Error> where D: de::Deserializer<'de>, { let s: &str = de::Deserialize::deseriali...
I would use a custom deserializer with ability to convert from different concrete types. ```rust use serde::{de, Deserialize, Deserializer}; use serde_json::Value; #[derive(Deserialize)] pub struct Entry { #[serde(deserialize_with = "boolean")] pub foo: bool, } fn boolean<'de, D: Deserializer<'de>>(deserializer:...
20,735,389
My JLabel and JTextField are not appearing overtop the image and I'm not sure why. I've put the image on a JLabel and setOpaque(false) but no luck. Any advice? Thanks for the help in advance. ``` private JTextField tf; private JLabel jl2; private JLabel jl3; public void window() { ...
2013/12/22
[ "https://Stackoverflow.com/questions/20735389", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3123422/" ]
It's slightly annoying when you're just trying to build something quickly, but in the long run it forces good code organization practice (by making it harder to shove all business logic into a controller).
You can do something like this: ``` //ArticleController module.exports = { findStore: async () => { return await findStoreFunc(req.param('id')); }, index: async () => { ... return await findStoreFunc(id); } }; const findStoreFunc = async (id) => {...} ``` And to use the function from another con...
20,735,389
My JLabel and JTextField are not appearing overtop the image and I'm not sure why. I've put the image on a JLabel and setOpaque(false) but no luck. Any advice? Thanks for the help in advance. ``` private JTextField tf; private JLabel jl2; private JLabel jl3; public void window() { ...
2013/12/22
[ "https://Stackoverflow.com/questions/20735389", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3123422/" ]
You can use `sails.controllers.yourControllerName.findStore()` the `sails` global object has references to almost everything.
I would like to suggest a solution that works but not the best possible way to do it. We can use bind function to bind the context with the calling source as shown below : generateUrl is present in the Controller A ``` function generateUrl(){ return 'www.google.com'; } ``` get URL is another method in Controller ...
20,735,389
My JLabel and JTextField are not appearing overtop the image and I'm not sure why. I've put the image on a JLabel and setOpaque(false) but no luck. Any advice? Thanks for the help in advance. ``` private JTextField tf; private JLabel jl2; private JLabel jl3; public void window() { ...
2013/12/22
[ "https://Stackoverflow.com/questions/20735389", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3123422/" ]
You can use `sails.controllers.yourControllerName.findStore()` the `sails` global object has references to almost everything.
One of the best ways to organize your code in Sails, at least for me and my team, has been to have all the real business logic in Services (/api/services). Those objects can be accessed globally from any controller. Also, a good practice is working with promises in services (as Sails use them on the model methods) Ju...
20,735,389
My JLabel and JTextField are not appearing overtop the image and I'm not sure why. I've put the image on a JLabel and setOpaque(false) but no luck. Any advice? Thanks for the help in advance. ``` private JTextField tf; private JLabel jl2; private JLabel jl3; public void window() { ...
2013/12/22
[ "https://Stackoverflow.com/questions/20735389", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3123422/" ]
You can use `sails.controllers.yourControllerName.findStore()` the `sails` global object has references to almost everything.
Having the same problem for last few hours. I used the api/services folder. It may not be exactly what you need but it is an option. A good explanation is here. [What services would one add to the api/services folder in sails.js](https://stackoverflow.com/questions/18447434/what-services-would-one-add-to-the-api-servi...
20,735,389
My JLabel and JTextField are not appearing overtop the image and I'm not sure why. I've put the image on a JLabel and setOpaque(false) but no luck. Any advice? Thanks for the help in advance. ``` private JTextField tf; private JLabel jl2; private JLabel jl3; public void window() { ...
2013/12/22
[ "https://Stackoverflow.com/questions/20735389", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3123422/" ]
Having the same problem for last few hours. I used the api/services folder. It may not be exactly what you need but it is an option. A good explanation is here. [What services would one add to the api/services folder in sails.js](https://stackoverflow.com/questions/18447434/what-services-would-one-add-to-the-api-servi...
A more elegant way to solve this problem is using the keyword `this` before the function name. Example: ``` one: function() { console.log('First Function'); }, two: function() { // call the function one in the same controller this.one(); } ```
20,735,389
My JLabel and JTextField are not appearing overtop the image and I'm not sure why. I've put the image on a JLabel and setOpaque(false) but no luck. Any advice? Thanks for the help in advance. ``` private JTextField tf; private JLabel jl2; private JLabel jl3; public void window() { ...
2013/12/22
[ "https://Stackoverflow.com/questions/20735389", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3123422/" ]
I would like to suggest a solution that works but not the best possible way to do it. We can use bind function to bind the context with the calling source as shown below : generateUrl is present in the Controller A ``` function generateUrl(){ return 'www.google.com'; } ``` get URL is another method in Controller ...
A more elegant way to solve this problem is using the keyword `this` before the function name. Example: ``` one: function() { console.log('First Function'); }, two: function() { // call the function one in the same controller this.one(); } ```
20,735,389
My JLabel and JTextField are not appearing overtop the image and I'm not sure why. I've put the image on a JLabel and setOpaque(false) but no luck. Any advice? Thanks for the help in advance. ``` private JTextField tf; private JLabel jl2; private JLabel jl3; public void window() { ...
2013/12/22
[ "https://Stackoverflow.com/questions/20735389", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3123422/" ]
You can use `sails.controllers.yourControllerName.findStore()` the `sails` global object has references to almost everything.
You can do something like this: ``` //ArticleController module.exports = { findStore: async () => { return await findStoreFunc(req.param('id')); }, index: async () => { ... return await findStoreFunc(id); } }; const findStoreFunc = async (id) => {...} ``` And to use the function from another con...
20,735,389
My JLabel and JTextField are not appearing overtop the image and I'm not sure why. I've put the image on a JLabel and setOpaque(false) but no luck. Any advice? Thanks for the help in advance. ``` private JTextField tf; private JLabel jl2; private JLabel jl3; public void window() { ...
2013/12/22
[ "https://Stackoverflow.com/questions/20735389", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3123422/" ]
I would like to suggest a solution that works but not the best possible way to do it. We can use bind function to bind the context with the calling source as shown below : generateUrl is present in the Controller A ``` function generateUrl(){ return 'www.google.com'; } ``` get URL is another method in Controller ...
You can do something like this: ``` //ArticleController module.exports = { findStore: async () => { return await findStoreFunc(req.param('id')); }, index: async () => { ... return await findStoreFunc(id); } }; const findStoreFunc = async (id) => {...} ``` And to use the function from another con...
20,735,389
My JLabel and JTextField are not appearing overtop the image and I'm not sure why. I've put the image on a JLabel and setOpaque(false) but no luck. Any advice? Thanks for the help in advance. ``` private JTextField tf; private JLabel jl2; private JLabel jl3; public void window() { ...
2013/12/22
[ "https://Stackoverflow.com/questions/20735389", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3123422/" ]
It's slightly annoying when you're just trying to build something quickly, but in the long run it forces good code organization practice (by making it harder to shove all business logic into a controller).
I would like to suggest a solution that works but not the best possible way to do it. We can use bind function to bind the context with the calling source as shown below : generateUrl is present in the Controller A ``` function generateUrl(){ return 'www.google.com'; } ``` get URL is another method in Controller ...
20,735,389
My JLabel and JTextField are not appearing overtop the image and I'm not sure why. I've put the image on a JLabel and setOpaque(false) but no luck. Any advice? Thanks for the help in advance. ``` private JTextField tf; private JLabel jl2; private JLabel jl3; public void window() { ...
2013/12/22
[ "https://Stackoverflow.com/questions/20735389", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3123422/" ]
Having the same problem for last few hours. I used the api/services folder. It may not be exactly what you need but it is an option. A good explanation is here. [What services would one add to the api/services folder in sails.js](https://stackoverflow.com/questions/18447434/what-services-would-one-add-to-the-api-servi...
I would like to suggest a solution that works but not the best possible way to do it. We can use bind function to bind the context with the calling source as shown below : generateUrl is present in the Controller A ``` function generateUrl(){ return 'www.google.com'; } ``` get URL is another method in Controller ...
22,536,630
I'm having the following table layout: four different tables, each containing around 10 to 15 million entries. Three string attributes of each table are the same (let's call them Id, Name1, Name2). Now we want to read all entries having the same Id column but different (Name1,Name2) tuples. It is estimated that less th...
2014/03/20
[ "https://Stackoverflow.com/questions/22536630", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1400869/" ]
`count(distinct)` is more resource intensive than other aggregation functions. You could try: ``` SELECT * FROM AllEntries GROUP BY Id HAVING min(Name1) <> max(Name1) or min(Name2) <> max(Name2); ``` If you build indexes on `id, Name1` and `id, Name2` in each of the subtables, the following should show a significant...
This will largely depend on your indices, but the last statement with the OR condition is certainly not ideal for a table of this size. Also, I'm not sure why you need a SELECT \* for this... extra IO. Avoid it if you can. Try something like this.... ``` SELECT id, COUNT(name1) FROM {table} GROUP BY id HAVING COUNT(*...
22,536,630
I'm having the following table layout: four different tables, each containing around 10 to 15 million entries. Three string attributes of each table are the same (let's call them Id, Name1, Name2). Now we want to read all entries having the same Id column but different (Name1,Name2) tuples. It is estimated that less th...
2014/03/20
[ "https://Stackoverflow.com/questions/22536630", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1400869/" ]
Try a CTE with `ROW_NUMBER()` instead of the traditional `GROUP BY/HAVING` approach: ``` ;with cteDups as ( Select * ,ROW_NUMBER() Over(Partition By Name1 Order By Id) rn1 ,ROW_NUMBER() Over(Partition By Name2 Order By Id) rn2 From AllEntries ) Select * From cteDups Where rn1 ...
`count(distinct)` is more resource intensive than other aggregation functions. You could try: ``` SELECT * FROM AllEntries GROUP BY Id HAVING min(Name1) <> max(Name1) or min(Name2) <> max(Name2); ``` If you build indexes on `id, Name1` and `id, Name2` in each of the subtables, the following should show a significant...
22,536,630
I'm having the following table layout: four different tables, each containing around 10 to 15 million entries. Three string attributes of each table are the same (let's call them Id, Name1, Name2). Now we want to read all entries having the same Id column but different (Name1,Name2) tuples. It is estimated that less th...
2014/03/20
[ "https://Stackoverflow.com/questions/22536630", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1400869/" ]
`count(distinct)` is more resource intensive than other aggregation functions. You could try: ``` SELECT * FROM AllEntries GROUP BY Id HAVING min(Name1) <> max(Name1) or min(Name2) <> max(Name2); ``` If you build indexes on `id, Name1` and `id, Name2` in each of the subtables, the following should show a significant...
That UNION is killing it There is no use of indexes on name1 or name2 after a union Cannot create an index on a view with UNION You are going to think this is whacked out but give it a try It uses indexes and favors a small number of matches If you don't have indexes on word1 and word2 then do so ``` se...
22,536,630
I'm having the following table layout: four different tables, each containing around 10 to 15 million entries. Three string attributes of each table are the same (let's call them Id, Name1, Name2). Now we want to read all entries having the same Id column but different (Name1,Name2) tuples. It is estimated that less th...
2014/03/20
[ "https://Stackoverflow.com/questions/22536630", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1400869/" ]
Try a CTE with `ROW_NUMBER()` instead of the traditional `GROUP BY/HAVING` approach: ``` ;with cteDups as ( Select * ,ROW_NUMBER() Over(Partition By Name1 Order By Id) rn1 ,ROW_NUMBER() Over(Partition By Name2 Order By Id) rn2 From AllEntries ) Select * From cteDups Where rn1 ...
This will largely depend on your indices, but the last statement with the OR condition is certainly not ideal for a table of this size. Also, I'm not sure why you need a SELECT \* for this... extra IO. Avoid it if you can. Try something like this.... ``` SELECT id, COUNT(name1) FROM {table} GROUP BY id HAVING COUNT(*...
22,536,630
I'm having the following table layout: four different tables, each containing around 10 to 15 million entries. Three string attributes of each table are the same (let's call them Id, Name1, Name2). Now we want to read all entries having the same Id column but different (Name1,Name2) tuples. It is estimated that less th...
2014/03/20
[ "https://Stackoverflow.com/questions/22536630", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1400869/" ]
Try a CTE with `ROW_NUMBER()` instead of the traditional `GROUP BY/HAVING` approach: ``` ;with cteDups as ( Select * ,ROW_NUMBER() Over(Partition By Name1 Order By Id) rn1 ,ROW_NUMBER() Over(Partition By Name2 Order By Id) rn2 From AllEntries ) Select * From cteDups Where rn1 ...
That UNION is killing it There is no use of indexes on name1 or name2 after a union Cannot create an index on a view with UNION You are going to think this is whacked out but give it a try It uses indexes and favors a small number of matches If you don't have indexes on word1 and word2 then do so ``` se...
31,795,169
I am making an ajax call for a like/dislike on a video and I found out that I need to pass the CSRF token when I submit the data. I have to calls one to when the user clicks like and one when the user clicks dislike. My issue is if the user clicks like and realizes they made a mistake and click on dislike they will re...
2015/08/03
[ "https://Stackoverflow.com/questions/31795169", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1739465/" ]
So I copied this paragraph from the user guide. "Tokens may be either regenerated on every submission (default) or kept the same throughout the life of the CSRF cookie. The default regeneration of tokens provides stricter security, but may result in usability concerns as other tokens become invalid (back/forward navi...
There's another way to do this that doesn't require disabling csrf regeneration. you can send the new csrf token back to the calling ajax script. In your CodeIgniter Controller: ``` $data = array('data'=> 'data to send back to browser'); $csrf = $this->security->get_csrf_hash(); $this->output ->set_content_type(...
35,333,630
i'm learning and trying to use laravel 5.2, i'm confusing how to add field in a table. I create a migration file called 2016\_01\_29\_093417\_create\_thread\_table.php, everytime i want to add a field, i add a code inside the file e.g ``` $table->string('content'); ``` and then run the command ``` php artisan...
2016/02/11
[ "https://Stackoverflow.com/questions/35333630", "https://Stackoverflow.com", "https://Stackoverflow.com/users/925552/" ]
There are two ways to do this. **Your application is already live** with people using it and you don't want to lose their data: you simply make a new migration and supply `up()` and `down()` with corresponding operations. For example: ``` <?php use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrat...
well you need to create a new migration for each column changes you need to use `migrate` `migration:refresh` will reset and seed the database again I would suggest make use of seeders and model factories if you wish to preserve your testing data and save time entering data again <https://laravel.com/docs/5.1/seedi...
88,777
I can't seem to get into the Views administration panel from any place in Commerce Kickstart 7.x-2.9. There is no menu entry even with Administration menu installed. Trying to configure via the link for Views on the modules admin page simply sends the page to the Administration menu with no "Views" option. Likewise dir...
2013/10/13
[ "https://drupal.stackexchange.com/questions/88777", "https://drupal.stackexchange.com", "https://drupal.stackexchange.com/users/19314/" ]
I eventually figured this out. With Administration Menu Module installed, views is not available - it seems like the menu links do not get built. There is a big problem with simply uninstalling the Administration Menu and re-enabling the Commerce Kickstart Menu module. According to <https://drupal.org/node/1877594#com...
If you have not made any changes and are logged in as admin then the menu link should be under `Site Settings -> Visual and Layout -> Views` ![enter image description here](https://i.stack.imgur.com/x7kVo.png)
88,777
I can't seem to get into the Views administration panel from any place in Commerce Kickstart 7.x-2.9. There is no menu entry even with Administration menu installed. Trying to configure via the link for Views on the modules admin page simply sends the page to the Administration menu with no "Views" option. Likewise dir...
2013/10/13
[ "https://drupal.stackexchange.com/questions/88777", "https://drupal.stackexchange.com", "https://drupal.stackexchange.com/users/19314/" ]
If you have not made any changes and are logged in as admin then the menu link should be under `Site Settings -> Visual and Layout -> Views` ![enter image description here](https://i.stack.imgur.com/x7kVo.png)
The original chosen solution is old and now outdated it seems. All I had to do was go to modules page and disable Commerce Kickstart Menus (if not already disabled) then go to modules uninstall page and uninstall Commerce Kickstart Menus. Now from the `/admin/structure/menu/manage/management` I can just re-adjust any m...
88,777
I can't seem to get into the Views administration panel from any place in Commerce Kickstart 7.x-2.9. There is no menu entry even with Administration menu installed. Trying to configure via the link for Views on the modules admin page simply sends the page to the Administration menu with no "Views" option. Likewise dir...
2013/10/13
[ "https://drupal.stackexchange.com/questions/88777", "https://drupal.stackexchange.com", "https://drupal.stackexchange.com/users/19314/" ]
I eventually figured this out. With Administration Menu Module installed, views is not available - it seems like the menu links do not get built. There is a big problem with simply uninstalling the Administration Menu and re-enabling the Commerce Kickstart Menu module. According to <https://drupal.org/node/1877594#com...
The original chosen solution is old and now outdated it seems. All I had to do was go to modules page and disable Commerce Kickstart Menus (if not already disabled) then go to modules uninstall page and uninstall Commerce Kickstart Menus. Now from the `/admin/structure/menu/manage/management` I can just re-adjust any m...
52,305,586
I am new to MySQL trigger. I want to make a trigger that before the update is made from my `emp_audit` table will check first if the `empno` from my employees table already exists. If it exists then do the update otherwise do nothing. I encounter the following error: > > Error 1064 > > > The code is: ``` DELIMI...
2018/09/13
[ "https://Stackoverflow.com/questions/52305586", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10356066/" ]
I had the same problem. It seems that SIRF and SURF are [no longer available in opencv > 3.4.2.16](https://github.com/DynaSlum/satsense/issues/13). I chose an older opencv-python and opencv-contrib-python versions and solved this problem. Here is the [history version](https://pypi.org/project/opencv-python/#history) ab...
It may be due to a mismatch of opencv version and opencv-contrib version. If you installed opencv from the source using CMake, and the source version is different from the version of opencv-contrib-python, uninstall the current opencv-contrib-python and do `pip install opencv-contrib-python==<version of the source>.X` ...
52,305,586
I am new to MySQL trigger. I want to make a trigger that before the update is made from my `emp_audit` table will check first if the `empno` from my employees table already exists. If it exists then do the update otherwise do nothing. I encounter the following error: > > Error 1064 > > > The code is: ``` DELIMI...
2018/09/13
[ "https://Stackoverflow.com/questions/52305586", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10356066/" ]
Edit: The `opencv-contrib-python-nonfree` was removed from pypi. **On Linux/ MacOS**, I've found a better solution! To access nonfree detectors use: `pip install opencv-contrib-python-nonfree`
It may be due to a mismatch of opencv version and opencv-contrib version. If you installed opencv from the source using CMake, and the source version is different from the version of opencv-contrib-python, uninstall the current opencv-contrib-python and do `pip install opencv-contrib-python==<version of the source>.X` ...
52,305,586
I am new to MySQL trigger. I want to make a trigger that before the update is made from my `emp_audit` table will check first if the `empno` from my employees table already exists. If it exists then do the update otherwise do nothing. I encounter the following error: > > Error 1064 > > > The code is: ``` DELIMI...
2018/09/13
[ "https://Stackoverflow.com/questions/52305586", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10356066/" ]
Since SIFT patent expired, SIFT has been moved to the main repo. To use SIFT in Opencv, You should use cv2.SIFT\_create() instead of cv2.xfeatures2d.SIFT\_create() now. (xfeatures2d only exists in the contrib package, but sift is part of the main package now.) Below link will be helpful. <https://github.com/opencv/ope...
It may be due to a mismatch of opencv version and opencv-contrib version. If you installed opencv from the source using CMake, and the source version is different from the version of opencv-contrib-python, uninstall the current opencv-contrib-python and do `pip install opencv-contrib-python==<version of the source>.X` ...
52,305,586
I am new to MySQL trigger. I want to make a trigger that before the update is made from my `emp_audit` table will check first if the `empno` from my employees table already exists. If it exists then do the update otherwise do nothing. I encounter the following error: > > Error 1064 > > > The code is: ``` DELIMI...
2018/09/13
[ "https://Stackoverflow.com/questions/52305586", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10356066/" ]
I had the same problem. It seems that SIRF and SURF are [no longer available in opencv > 3.4.2.16](https://github.com/DynaSlum/satsense/issues/13). I chose an older opencv-python and opencv-contrib-python versions and solved this problem. Here is the [history version](https://pypi.org/project/opencv-python/#history) ab...
Edit: The `opencv-contrib-python-nonfree` was removed from pypi. **On Linux/ MacOS**, I've found a better solution! To access nonfree detectors use: `pip install opencv-contrib-python-nonfree`
52,305,586
I am new to MySQL trigger. I want to make a trigger that before the update is made from my `emp_audit` table will check first if the `empno` from my employees table already exists. If it exists then do the update otherwise do nothing. I encounter the following error: > > Error 1064 > > > The code is: ``` DELIMI...
2018/09/13
[ "https://Stackoverflow.com/questions/52305586", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10356066/" ]
I had the same problem. It seems that SIRF and SURF are [no longer available in opencv > 3.4.2.16](https://github.com/DynaSlum/satsense/issues/13). I chose an older opencv-python and opencv-contrib-python versions and solved this problem. Here is the [history version](https://pypi.org/project/opencv-python/#history) ab...
Since SIFT patent expired, SIFT has been moved to the main repo. To use SIFT in Opencv, You should use cv2.SIFT\_create() instead of cv2.xfeatures2d.SIFT\_create() now. (xfeatures2d only exists in the contrib package, but sift is part of the main package now.) Below link will be helpful. <https://github.com/opencv/ope...
7,852,466
How do I change `width` value assigned in `#center`? (I don't want to switch between CSS files just because 1 changed `width` value.) How do I dynamically change the value using Javascript? ```html <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <style type="text/css"> #main #center { ...
2011/10/21
[ "https://Stackoverflow.com/questions/7852466", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1007481/" ]
Two possible ways: 1. Give the element "center" a class value that matches another CSS rule 2. Alter the "style" property of the element
Call a javascript function in the onclick which takes the dom element and sets the new width OR changes the class of the element ``` function changeWidth(){ document.getElementById('center'); div.style.width="1270px"; } ```
7,852,466
How do I change `width` value assigned in `#center`? (I don't want to switch between CSS files just because 1 changed `width` value.) How do I dynamically change the value using Javascript? ```html <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <style type="text/css"> #main #center { ...
2011/10/21
[ "https://Stackoverflow.com/questions/7852466", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1007481/" ]
``` document.getElementById('center').style.width = "599px"; ```
Two possible ways: 1. Give the element "center" a class value that matches another CSS rule 2. Alter the "style" property of the element
7,852,466
How do I change `width` value assigned in `#center`? (I don't want to switch between CSS files just because 1 changed `width` value.) How do I dynamically change the value using Javascript? ```html <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <style type="text/css"> #main #center { ...
2011/10/21
[ "https://Stackoverflow.com/questions/7852466", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1007481/" ]
Two possible ways: 1. Give the element "center" a class value that matches another CSS rule 2. Alter the "style" property of the element
``` <div onclick="changeWidth()" id="main"> Stuff </div> <div onclick="changeWidth()" id="center"> More Stuff </div> function changeWidth(){ this.style.width = "700px"; } ```
7,852,466
How do I change `width` value assigned in `#center`? (I don't want to switch between CSS files just because 1 changed `width` value.) How do I dynamically change the value using Javascript? ```html <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <style type="text/css"> #main #center { ...
2011/10/21
[ "https://Stackoverflow.com/questions/7852466", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1007481/" ]
Two possible ways: 1. Give the element "center" a class value that matches another CSS rule 2. Alter the "style" property of the element
``` document.getElementById( 'center' ).style.width = "700px"; ```
7,852,466
How do I change `width` value assigned in `#center`? (I don't want to switch between CSS files just because 1 changed `width` value.) How do I dynamically change the value using Javascript? ```html <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <style type="text/css"> #main #center { ...
2011/10/21
[ "https://Stackoverflow.com/questions/7852466", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1007481/" ]
``` document.getElementById('center').style.width = "599px"; ```
Call a javascript function in the onclick which takes the dom element and sets the new width OR changes the class of the element ``` function changeWidth(){ document.getElementById('center'); div.style.width="1270px"; } ```
7,852,466
How do I change `width` value assigned in `#center`? (I don't want to switch between CSS files just because 1 changed `width` value.) How do I dynamically change the value using Javascript? ```html <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <style type="text/css"> #main #center { ...
2011/10/21
[ "https://Stackoverflow.com/questions/7852466", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1007481/" ]
``` document.getElementById( 'center' ).style.width = "700px"; ```
Call a javascript function in the onclick which takes the dom element and sets the new width OR changes the class of the element ``` function changeWidth(){ document.getElementById('center'); div.style.width="1270px"; } ```
7,852,466
How do I change `width` value assigned in `#center`? (I don't want to switch between CSS files just because 1 changed `width` value.) How do I dynamically change the value using Javascript? ```html <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <style type="text/css"> #main #center { ...
2011/10/21
[ "https://Stackoverflow.com/questions/7852466", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1007481/" ]
``` document.getElementById('center').style.width = "599px"; ```
``` <div onclick="changeWidth()" id="main"> Stuff </div> <div onclick="changeWidth()" id="center"> More Stuff </div> function changeWidth(){ this.style.width = "700px"; } ```
7,852,466
How do I change `width` value assigned in `#center`? (I don't want to switch between CSS files just because 1 changed `width` value.) How do I dynamically change the value using Javascript? ```html <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <style type="text/css"> #main #center { ...
2011/10/21
[ "https://Stackoverflow.com/questions/7852466", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1007481/" ]
``` document.getElementById('center').style.width = "599px"; ```
``` document.getElementById( 'center' ).style.width = "700px"; ```