qid
int64
1
74.7M
question
stringlengths
15
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
4
30.2k
response_k
stringlengths
11
36.5k
55,219,542
I want to make a container which can be dragged around, zoom and rotate. I am able to achieve a zoom. Below is my code: ``` //variable declaration double _scale = 1.0; double _previousScale; var yOffset = 400.0; var xOffset = 50.0; var rotation = 0.0; var lastRotation = 0.0; ``` //build method ``` @over...
2019/03/18
[ "https://Stackoverflow.com/questions/55219542", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2644723/" ]
use [Matrix Gesture Detector package](https://pub.dev/packages/matrix_gesture_detector)[1](https://pub.dartlang.org/packages/matrix_gesture_detecto) package, here you have the basic sample: ``` MatrixGestureDetector( onMatrixUpdate: (m, tm, sm, rm) { setState(() { matrix = n; }); }, child: Transfor...
You can also use photo\_viewer instead of matrix\_gesture\_detector. More info in this answer: <https://stackoverflow.com/a/62426232/2942294>
55,219,542
I want to make a container which can be dragged around, zoom and rotate. I am able to achieve a zoom. Below is my code: ``` //variable declaration double _scale = 1.0; double _previousScale; var yOffset = 400.0; var xOffset = 50.0; var rotation = 0.0; var lastRotation = 0.0; ``` //build method ``` @over...
2019/03/18
[ "https://Stackoverflow.com/questions/55219542", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2644723/" ]
use [Matrix Gesture Detector package](https://pub.dev/packages/matrix_gesture_detector)[1](https://pub.dartlang.org/packages/matrix_gesture_detecto) package, here you have the basic sample: ``` MatrixGestureDetector( onMatrixUpdate: (m, tm, sm, rm) { setState(() { matrix = n; }); }, child: Transfor...
You can use **RotatedBox** widget (for rotation) along with **InteractiveViewer** widget(for zoom in and zoom out). > > panEnabled property in InteractiveViewer widget used for moving the container > > > ``` Scaffold( backgroundColor: Colors.black, body: Center( child: RotatedBox( quarterTur...
55,219,542
I want to make a container which can be dragged around, zoom and rotate. I am able to achieve a zoom. Below is my code: ``` //variable declaration double _scale = 1.0; double _previousScale; var yOffset = 400.0; var xOffset = 50.0; var rotation = 0.0; var lastRotation = 0.0; ``` //build method ``` @over...
2019/03/18
[ "https://Stackoverflow.com/questions/55219542", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2644723/" ]
use [Matrix Gesture Detector package](https://pub.dev/packages/matrix_gesture_detector)[1](https://pub.dartlang.org/packages/matrix_gesture_detecto) package, here you have the basic sample: ``` MatrixGestureDetector( onMatrixUpdate: (m, tm, sm, rm) { setState(() { matrix = n; }); }, child: Transfor...
i had same issue. the problem is solved by Matrix gesture detetctor package. but i have solved this by another case:- the whole code is here. ```html // @dart=2.9 import 'package:flutter/material.dart'; void main() { runApp(MyApp()); } class MyApp extends StatefulWidget { const MyApp({Key key}) : super(key: key)...
55,219,542
I want to make a container which can be dragged around, zoom and rotate. I am able to achieve a zoom. Below is my code: ``` //variable declaration double _scale = 1.0; double _previousScale; var yOffset = 400.0; var xOffset = 50.0; var rotation = 0.0; var lastRotation = 0.0; ``` //build method ``` @over...
2019/03/18
[ "https://Stackoverflow.com/questions/55219542", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2644723/" ]
use [Matrix Gesture Detector package](https://pub.dev/packages/matrix_gesture_detector)[1](https://pub.dartlang.org/packages/matrix_gesture_detecto) package, here you have the basic sample: ``` MatrixGestureDetector( onMatrixUpdate: (m, tm, sm, rm) { setState(() { matrix = n; }); }, child: Transfor...
Had the same problem, here is my solution: <https://stackoverflow.com/a/74165192/12098106> ```dart import 'package:flutter/material.dart'; // ------------------------------------------------------------------- // THE ITEM TO BE DRAWN // ------------------------------------------------------------------- class DrawC...
5,029,176
I'm trying to implement a switch case statement like this: ``` switch (active.attr('class')){ case "video": ... case "slideshow": ... ... ``` The problem is, that "video" and "slideshow" each are one of three classes the div I'm trying to target has, therefor it doesn't match the case... How would I ...
2011/02/17
[ "https://Stackoverflow.com/questions/5029176", "https://Stackoverflow.com", "https://Stackoverflow.com/users/621408/" ]
You can use `hasClass` [See this related post.](https://stackoverflow.com/questions/1617009/jquery-switch-case-plugin) I think it does what you're looking to do.
Use if and the [hasClass](http://api.jquery.com/hasclass/) method: ``` if (active.hasClass('video')) { } else if {active.hasClass('slideshow')) { } ``` If you need to do both (fall-through on the switch), remove the else so the if statements are independent.
5,029,176
I'm trying to implement a switch case statement like this: ``` switch (active.attr('class')){ case "video": ... case "slideshow": ... ... ``` The problem is, that "video" and "slideshow" each are one of three classes the div I'm trying to target has, therefor it doesn't match the case... How would I ...
2011/02/17
[ "https://Stackoverflow.com/questions/5029176", "https://Stackoverflow.com", "https://Stackoverflow.com/users/621408/" ]
It looks like you're using `jQuery`, which offers two methods for that: * [`.is()`help](http://api.jquery.com/is/) * [`.hasClass()`help](http://api.jquery.com/hasClass/) So you can either call: ``` if( active.hasClass('video') ) { } ``` or ``` if( active.is('.video') ) { } ``` Notice that `.is()` requires a mor...
You can use `hasClass` [See this related post.](https://stackoverflow.com/questions/1617009/jquery-switch-case-plugin) I think it does what you're looking to do.
5,029,176
I'm trying to implement a switch case statement like this: ``` switch (active.attr('class')){ case "video": ... case "slideshow": ... ... ``` The problem is, that "video" and "slideshow" each are one of three classes the div I'm trying to target has, therefor it doesn't match the case... How would I ...
2011/02/17
[ "https://Stackoverflow.com/questions/5029176", "https://Stackoverflow.com", "https://Stackoverflow.com/users/621408/" ]
It looks like you're using `jQuery`, which offers two methods for that: * [`.is()`help](http://api.jquery.com/is/) * [`.hasClass()`help](http://api.jquery.com/hasClass/) So you can either call: ``` if( active.hasClass('video') ) { } ``` or ``` if( active.is('.video') ) { } ``` Notice that `.is()` requires a mor...
Use if and the [hasClass](http://api.jquery.com/hasclass/) method: ``` if (active.hasClass('video')) { } else if {active.hasClass('slideshow')) { } ``` If you need to do both (fall-through on the switch), remove the else so the if statements are independent.
5,029,176
I'm trying to implement a switch case statement like this: ``` switch (active.attr('class')){ case "video": ... case "slideshow": ... ... ``` The problem is, that "video" and "slideshow" each are one of three classes the div I'm trying to target has, therefor it doesn't match the case... How would I ...
2011/02/17
[ "https://Stackoverflow.com/questions/5029176", "https://Stackoverflow.com", "https://Stackoverflow.com/users/621408/" ]
You could perhaps try and split the string. From the top of my head: ``` var classes = active.attr('class').split(' '); foreach(var c in classes) { switch(c) { case 'video' ... case 'slideshow' ... } } ``` Just an idea. The above answers might do the same in other ways :) Edi...
Use if and the [hasClass](http://api.jquery.com/hasclass/) method: ``` if (active.hasClass('video')) { } else if {active.hasClass('slideshow')) { } ``` If you need to do both (fall-through on the switch), remove the else so the if statements are independent.
5,029,176
I'm trying to implement a switch case statement like this: ``` switch (active.attr('class')){ case "video": ... case "slideshow": ... ... ``` The problem is, that "video" and "slideshow" each are one of three classes the div I'm trying to target has, therefor it doesn't match the case... How would I ...
2011/02/17
[ "https://Stackoverflow.com/questions/5029176", "https://Stackoverflow.com", "https://Stackoverflow.com/users/621408/" ]
It looks like you're using `jQuery`, which offers two methods for that: * [`.is()`help](http://api.jquery.com/is/) * [`.hasClass()`help](http://api.jquery.com/hasClass/) So you can either call: ``` if( active.hasClass('video') ) { } ``` or ``` if( active.is('.video') ) { } ``` Notice that `.is()` requires a mor...
You could perhaps try and split the string. From the top of my head: ``` var classes = active.attr('class').split(' '); foreach(var c in classes) { switch(c) { case 'video' ... case 'slideshow' ... } } ``` Just an idea. The above answers might do the same in other ways :) Edi...
39,694,158
I am new to android and was playing around with the `makeText` method of `Toast` class. I noticed that when calling makeText, I could not pass an integer for the duration parameter other than `TOAST.LENGTH_LONG` and `TOAST.LENGTH_SHORT`. Android studio warned that it has been annotated with `@intDef` but when I opened ...
2016/09/26
[ "https://Stackoverflow.com/questions/39694158", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2364403/" ]
Pretty complicated given there's no negative look-behind assertions in JavaScript RegExp, and Unicode support is not official yet (only supported in Firefox by a flag at the moment). This uses a library (XRegExp) to handle the unicode classes. If you need the full normal regular expression, ***it's huge***. Just commen...
I found the answer but is is complex. Does anyone have another simple answer for this ``` module.exports = (string) => { const segs = string.split(/(\.{2,}|!|"|#|$|%|&|'|\(|\)|\*|\+|,|-|\.|\/|:|;|<|=|>|\?|¿|@|[|]|\\|^|_|`|{|\||}|~| )/); return segs.filter((seg) => seg.trim() !== ""); }; ```
22,243,583
I'm looking for a solution to my problem. I'm not understanding why I'm not getting the result that I need. I am having trouble with visualizing and understanding the opacity - which is where the problem lays **I need:** When a mouse hovers over an image, it tints black (off black). I'm running into a problem with...
2014/03/07
[ "https://Stackoverflow.com/questions/22243583", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2303392/" ]
Try this code.. Only Remove the background-color: pink; ``` .portfolio-item1, .bg1 { height: 200px; width: 200px; position: absolute; border-radius:25px; } ```
The solution would be just to remove the background-color: pink; But, as Mr.Alien suggested this can be done with pure css. Mr\_Green suggested an elegant solution using the psuedo links. Bu, I see a lot of repetitive code in css. You can change that as well like below. **HTML CODE** ``` <a class="bg" href=""><img c...
22,243,583
I'm looking for a solution to my problem. I'm not understanding why I'm not getting the result that I need. I am having trouble with visualizing and understanding the opacity - which is where the problem lays **I need:** When a mouse hovers over an image, it tints black (off black). I'm running into a problem with...
2014/03/07
[ "https://Stackoverflow.com/questions/22243583", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2303392/" ]
remove the line background-color: pink; ``` .portfolio-item1, .bg1 { height: 200px; width: 200px; position: absolute; border-radius:25px; } ```
The solution would be just to remove the background-color: pink; But, as Mr.Alien suggested this can be done with pure css. Mr\_Green suggested an elegant solution using the psuedo links. Bu, I see a lot of repetitive code in css. You can change that as well like below. **HTML CODE** ``` <a class="bg" href=""><img c...
22,243,583
I'm looking for a solution to my problem. I'm not understanding why I'm not getting the result that I need. I am having trouble with visualizing and understanding the opacity - which is where the problem lays **I need:** When a mouse hovers over an image, it tints black (off black). I'm running into a problem with...
2014/03/07
[ "https://Stackoverflow.com/questions/22243583", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2303392/" ]
Remove the `background-color: pink;` in .portfolio-item1, .bg1 ``` .portfolio-item1, .bg1 { height: 200px; width: 200px; position: absolute; border-radius:25px; /*background-color: pink;*/ } ``` [Demo Fiddle](http://jsfiddle.net/Vinay199129/FsuKj/4/) =============================================...
remove this line from css `background-color: pink;` ``` .portfolio-item1, .bg1 { height: 200px; width: 200px; position: absolute; border-radius:25px; } ```
22,243,583
I'm looking for a solution to my problem. I'm not understanding why I'm not getting the result that I need. I am having trouble with visualizing and understanding the opacity - which is where the problem lays **I need:** When a mouse hovers over an image, it tints black (off black). I'm running into a problem with...
2014/03/07
[ "https://Stackoverflow.com/questions/22243583", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2303392/" ]
remove this line from css `background-color: pink;` ``` .portfolio-item1, .bg1 { height: 200px; width: 200px; position: absolute; border-radius:25px; } ```
The solution would be just to remove the background-color: pink; But, as Mr.Alien suggested this can be done with pure css. Mr\_Green suggested an elegant solution using the psuedo links. Bu, I see a lot of repetitive code in css. You can change that as well like below. **HTML CODE** ``` <a class="bg" href=""><img c...
22,243,583
I'm looking for a solution to my problem. I'm not understanding why I'm not getting the result that I need. I am having trouble with visualizing and understanding the opacity - which is where the problem lays **I need:** When a mouse hovers over an image, it tints black (off black). I'm running into a problem with...
2014/03/07
[ "https://Stackoverflow.com/questions/22243583", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2303392/" ]
As Mr. Alien suggested in above comments, you can do this hovering using just css. Just change your `.hover` css to `.portfolio-item:hover, .portfolio-item1:hover` So, this code: ``` .hover { overflow: hidden; z-index: 1; opacity:0.1; } ``` will become: ``` .portfolio-item:hover, .portfolio-item1:hov...
The solution would be just to remove the background-color: pink; But, as Mr.Alien suggested this can be done with pure css. Mr\_Green suggested an elegant solution using the psuedo links. Bu, I see a lot of repetitive code in css. You can change that as well like below. **HTML CODE** ``` <a class="bg" href=""><img c...
22,243,583
I'm looking for a solution to my problem. I'm not understanding why I'm not getting the result that I need. I am having trouble with visualizing and understanding the opacity - which is where the problem lays **I need:** When a mouse hovers over an image, it tints black (off black). I'm running into a problem with...
2014/03/07
[ "https://Stackoverflow.com/questions/22243583", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2303392/" ]
[Working Fiddle](http://jsfiddle.net/FsuKj/1/) ``` .portfolio-item1, .bg1 { height: 200px; width: 200px; position: absolute; border-radius:25px; } ```
The solution would be just to remove the background-color: pink; But, as Mr.Alien suggested this can be done with pure css. Mr\_Green suggested an elegant solution using the psuedo links. Bu, I see a lot of repetitive code in css. You can change that as well like below. **HTML CODE** ``` <a class="bg" href=""><img c...
22,243,583
I'm looking for a solution to my problem. I'm not understanding why I'm not getting the result that I need. I am having trouble with visualizing and understanding the opacity - which is where the problem lays **I need:** When a mouse hovers over an image, it tints black (off black). I'm running into a problem with...
2014/03/07
[ "https://Stackoverflow.com/questions/22243583", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2303392/" ]
Remove the `background-color: pink;` in .portfolio-item1, .bg1 ``` .portfolio-item1, .bg1 { height: 200px; width: 200px; position: absolute; border-radius:25px; /*background-color: pink;*/ } ``` [Demo Fiddle](http://jsfiddle.net/Vinay199129/FsuKj/4/) =============================================...
As Mr. Alien suggested in above comments, you can do this hovering using just css. Just change your `.hover` css to `.portfolio-item:hover, .portfolio-item1:hover` So, this code: ``` .hover { overflow: hidden; z-index: 1; opacity:0.1; } ``` will become: ``` .portfolio-item:hover, .portfolio-item1:hov...
22,243,583
I'm looking for a solution to my problem. I'm not understanding why I'm not getting the result that I need. I am having trouble with visualizing and understanding the opacity - which is where the problem lays **I need:** When a mouse hovers over an image, it tints black (off black). I'm running into a problem with...
2014/03/07
[ "https://Stackoverflow.com/questions/22243583", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2303392/" ]
[Working Fiddle](http://jsfiddle.net/FsuKj/1/) ``` .portfolio-item1, .bg1 { height: 200px; width: 200px; position: absolute; border-radius:25px; } ```
As Mr. Alien suggested in above comments, you can do this hovering using just css. Just change your `.hover` css to `.portfolio-item:hover, .portfolio-item1:hover` So, this code: ``` .hover { overflow: hidden; z-index: 1; opacity:0.1; } ``` will become: ``` .portfolio-item:hover, .portfolio-item1:hov...
22,243,583
I'm looking for a solution to my problem. I'm not understanding why I'm not getting the result that I need. I am having trouble with visualizing and understanding the opacity - which is where the problem lays **I need:** When a mouse hovers over an image, it tints black (off black). I'm running into a problem with...
2014/03/07
[ "https://Stackoverflow.com/questions/22243583", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2303392/" ]
[Working Fiddle](http://jsfiddle.net/FsuKj/1/) ``` .portfolio-item1, .bg1 { height: 200px; width: 200px; position: absolute; border-radius:25px; } ```
Try this code.. Only Remove the background-color: pink; ``` .portfolio-item1, .bg1 { height: 200px; width: 200px; position: absolute; border-radius:25px; } ```
22,243,583
I'm looking for a solution to my problem. I'm not understanding why I'm not getting the result that I need. I am having trouble with visualizing and understanding the opacity - which is where the problem lays **I need:** When a mouse hovers over an image, it tints black (off black). I'm running into a problem with...
2014/03/07
[ "https://Stackoverflow.com/questions/22243583", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2303392/" ]
Remove the `background-color: pink;` in .portfolio-item1, .bg1 ``` .portfolio-item1, .bg1 { height: 200px; width: 200px; position: absolute; border-radius:25px; /*background-color: pink;*/ } ``` [Demo Fiddle](http://jsfiddle.net/Vinay199129/FsuKj/4/) =============================================...
Try this code.. Only Remove the background-color: pink; ``` .portfolio-item1, .bg1 { height: 200px; width: 200px; position: absolute; border-radius:25px; } ```
20,553,311
I'm sure one of you experts can either answer this or point me to an explanation. Lets say I have a list of 300 cars from which I want the user to choose. Each of these Java objects has 10 properties (e.g. model, manufacturer, color, age...). The question is, is it more efficient to pass all 300 in JSON format in the...
2013/12/12
[ "https://Stackoverflow.com/questions/20553311", "https://Stackoverflow.com", "https://Stackoverflow.com/users/695487/" ]
JSON would be a more neutral technology than Java objects, serialized or not, and would leave you more options down the road. It's just text, so you are no longer bound to using Java. You could still use any server side templating engine, or you could send it to the browser and let JQuery or AngularJS iterate it for ex...
If you are in single application just stick to java. If you are in distributed system in which modules can be written in different languages use JSON/XML
17,252,347
I want to do something like this. Do you have ideas for this? ``` === a === if( Something ){ === b === { else { go back to === a === } Thanks. ```
2013/06/22
[ "https://Stackoverflow.com/questions/17252347", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2500360/" ]
I don't think there is anything built in to SVN that will do this for you. This isn't a common use case because concurrent editing is handled [gracefully](https://stackoverflow.com/questions/14131241/large-parallel-commits/14131991#14131991) by SVN, and therefore isn't considered to be a problem worth notifying other d...
SVN has the needs-lock property that you can set on a file that means a user must 'lock' the file for editing, and only one lock can exist at a time. This is essentially for binary and other non-mergable files to prevent nasty conflicts. Its not quite what you want though, as it prevents more than 1 user from editing...
1,088,381
I have a ThinkPad T420 laptop, with two disks. * SSD: 128GB, GPT (disk1) * HDD: 5400 rpm, 500GB, MBR (disk2) I need to run 2 OSs on this laptop: Windows 10 + Ubuntu 16.04, so I decided to: 1. Install both, Windows 10 and Ubuntu 16.04 in the SSD disk (disk1). It's a GPT disk, and contains partitions for both OSs. It'...
2016/06/12
[ "https://superuser.com/questions/1088381", "https://superuser.com", "https://superuser.com/users/220359/" ]
You can download various drivers for Windows 7 here > <http://support.hp.com/us-en/drivers/selfservice/compaq-15-s100-notebook-pc-series/7234969/model/7485838> Look under Driver-Chipset for "Intel USB 3.0 Host Controller Driver"
Go to this [link](http://support.hp.com/us-en/drivers/selfservice/Compaq-15-Notebook-PC-series/7234969/model/7485838). Click on Driver-Chipset. There are 2 Drivers that are related to USB 3.0. They are both labeled Intel USB 3.0 Host Controller Driver. I would install one of them and if it doesn't work then try the...
41,037,921
In Xcode 8, When any break point is hit, and I try to print any object in the Xcode debugger, it always prints **"Could not resolve type"**. I have searched enough on the internet. I have checked if EditScheme->Run->Info->BuildConfiguration is set to 'Debug'. Build setting->Optimisation level is set to 'None'. But no c...
2016/12/08
[ "https://Stackoverflow.com/questions/41037921", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2066999/" ]
I encountered a similar issue with a pure swift framework that doesn't have any bridging headers but non the less had `SWIFT_INSTALL_OBJC_HEADER` set to `YES` It is described in more detail at <https://stackoverflow.com/a/51186560/385307> After changing the setting to `NO` debugging works again.
I had a similar issue with a Swift project which included an Obj-C framework. I had imported the framework in my Swift project using ``` import Obj-C-Framework ``` Additionally, I had also created a Bridging-Header file in the Swift project and included the Obj-C-Framework header using ``` #include <Obj-C-Framework...
41,037,921
In Xcode 8, When any break point is hit, and I try to print any object in the Xcode debugger, it always prints **"Could not resolve type"**. I have searched enough on the internet. I have checked if EditScheme->Run->Info->BuildConfiguration is set to 'Debug'. Build setting->Optimisation level is set to 'None'. But no c...
2016/12/08
[ "https://Stackoverflow.com/questions/41037921", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2066999/" ]
I encountered a similar issue with a pure swift framework that doesn't have any bridging headers but non the less had `SWIFT_INSTALL_OBJC_HEADER` set to `YES` It is described in more detail at <https://stackoverflow.com/a/51186560/385307> After changing the setting to `NO` debugging works again.
I just had the same problem and it had been solved.My project is a Mixed project with both OC and Swift. I found that some .h file import in my Bridging Header file that caused the problem. Definitely, an enum declared in the .h file cause the problem, like this: ``` typedef NS_ENUM(NSInteger,BadgeAlignment) { Ali...
5,320,036
I have the following Linq query. transactionData is an IEnumerable. ``` var totalTransactions = 0; viewModel.GroupedTransactions = transactionData .GroupBy(x => new { DocumentId = x.DocumentId ?? "Un Documented" }) .Select(x => new GroupedTransaction { DocumentId = x.Key.DocumentId, Transac...
2011/03/16
[ "https://Stackoverflow.com/questions/5320036", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29376/" ]
Or you could use [prepared statements](http://php.net/manual/en/pdo.prepared-statements.php) and not mangle your data: ``` <?php $stmt = $dbh->prepare("SELECT * FROM REGISTRY where name = ?"); if ($stmt->execute(array($_GET['name']))) { while ($row = $stmt->fetch()) { print_r($row); } } ?> ```
The simple answer here is that stripslahes is in fact circumventing the mysql\_real\_escape\_string. ``` $num_of_badges = trim(stripslashes($_Post['num_of_badges'])); $query_part = mysql_real_escape_string($_Post['num_of_badges']); // Or whatever... ``` Is probably how you're going to have to do it, remember you don...
5,320,036
I have the following Linq query. transactionData is an IEnumerable. ``` var totalTransactions = 0; viewModel.GroupedTransactions = transactionData .GroupBy(x => new { DocumentId = x.DocumentId ?? "Un Documented" }) .Select(x => new GroupedTransaction { DocumentId = x.Key.DocumentId, Transac...
2011/03/16
[ "https://Stackoverflow.com/questions/5320036", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29376/" ]
Or you could use [prepared statements](http://php.net/manual/en/pdo.prepared-statements.php) and not mangle your data: ``` <?php $stmt = $dbh->prepare("SELECT * FROM REGISTRY where name = ?"); if ($stmt->execute(array($_GET['name']))) { while ($row = $stmt->fetch()) { print_r($row); } } ?> ```
> > need to submit to my table and also echo out the data to the screen > > > this statement is a key of all your problems. while `trim()` and **conditional** `stripslashes()` are "submissions" related, mysql\_real\_escape\_string is **completely different matter,** it has nothing to do with submissions, input, ...
5,320,036
I have the following Linq query. transactionData is an IEnumerable. ``` var totalTransactions = 0; viewModel.GroupedTransactions = transactionData .GroupBy(x => new { DocumentId = x.DocumentId ?? "Un Documented" }) .Select(x => new GroupedTransaction { DocumentId = x.Key.DocumentId, Transac...
2011/03/16
[ "https://Stackoverflow.com/questions/5320036", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29376/" ]
> > need to submit to my table and also echo out the data to the screen > > > this statement is a key of all your problems. while `trim()` and **conditional** `stripslashes()` are "submissions" related, mysql\_real\_escape\_string is **completely different matter,** it has nothing to do with submissions, input, ...
The simple answer here is that stripslahes is in fact circumventing the mysql\_real\_escape\_string. ``` $num_of_badges = trim(stripslashes($_Post['num_of_badges'])); $query_part = mysql_real_escape_string($_Post['num_of_badges']); // Or whatever... ``` Is probably how you're going to have to do it, remember you don...
55,304,463
i have a database ready using postgresgl and i am using loopback 4 as framework and i want to create automatically my models by reading them from the database. i created a connection between loopback and postgresql using a connector but couldn't import anything from the database. Every timme i create a table in the dat...
2019/03/22
[ "https://Stackoverflow.com/questions/55304463", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3010971/" ]
Model discovery is a feature that's under active development right now, see the pull request <https://github.com/strongloop/loopback-next/pull/2245> You can check out the development version and let us know how it works for you. Cross-posting the instructions from <https://github.com/strongloop/loopback-next/pull/224...
just use database name after --schema key like this ``` lb4 discover --schema [DB_NAME_HERE] ```
3,815,327
Here is a synopsis of my code which is a moderately complex WinForms GUI. The context of the dependencies is the model view presenter pattern. ``` public class StatSyncherFormView : Form, IView { ... } public class Presenter { // Here is the member I made public public readonly IView view; public Present...
2010/09/28
[ "https://Stackoverflow.com/questions/3815327", "https://Stackoverflow.com", "https://Stackoverflow.com/users/398546/" ]
Just give the Presenter a Run() method.
The benefits of your third approach (which I like most) include: * You may add logic to the getter later without the need of recompiling calling code * Encapsulation: you have exactly one place in your code that gets the value from the actual field, allowing you to add logging or use any other debugging mechanism to t...
3,815,327
Here is a synopsis of my code which is a moderately complex WinForms GUI. The context of the dependencies is the model view presenter pattern. ``` public class StatSyncherFormView : Form, IView { ... } public class Presenter { // Here is the member I made public public readonly IView view; public Present...
2010/09/28
[ "https://Stackoverflow.com/questions/3815327", "https://Stackoverflow.com", "https://Stackoverflow.com/users/398546/" ]
This is really just a variant on the publicly-visible fields vs properties debate. Following the standard guidelines (your option 3) is what most people will recommend, despite what you call "redundancy". BTW I'm not sure which of the following you mean by redundancy * a few extra characters to type, or * an extra ge...
The benefits of your third approach (which I like most) include: * You may add logic to the getter later without the need of recompiling calling code * Encapsulation: you have exactly one place in your code that gets the value from the actual field, allowing you to add logging or use any other debugging mechanism to t...
3,815,327
Here is a synopsis of my code which is a moderately complex WinForms GUI. The context of the dependencies is the model view presenter pattern. ``` public class StatSyncherFormView : Form, IView { ... } public class Presenter { // Here is the member I made public public readonly IView view; public Present...
2010/09/28
[ "https://Stackoverflow.com/questions/3815327", "https://Stackoverflow.com", "https://Stackoverflow.com/users/398546/" ]
The benefits of your third approach (which I like most) include: * You may add logic to the getter later without the need of recompiling calling code * Encapsulation: you have exactly one place in your code that gets the value from the actual field, allowing you to add logging or use any other debugging mechanism to t...
If you use public field, you cannot change it to property later without recompiling your assembly. So I think it is better to do it right at the first place by using property.
3,815,327
Here is a synopsis of my code which is a moderately complex WinForms GUI. The context of the dependencies is the model view presenter pattern. ``` public class StatSyncherFormView : Form, IView { ... } public class Presenter { // Here is the member I made public public readonly IView view; public Present...
2010/09/28
[ "https://Stackoverflow.com/questions/3815327", "https://Stackoverflow.com", "https://Stackoverflow.com/users/398546/" ]
Just give the Presenter a Run() method.
If you use public field, you cannot change it to property later without recompiling your assembly. So I think it is better to do it right at the first place by using property.
3,815,327
Here is a synopsis of my code which is a moderately complex WinForms GUI. The context of the dependencies is the model view presenter pattern. ``` public class StatSyncherFormView : Form, IView { ... } public class Presenter { // Here is the member I made public public readonly IView view; public Present...
2010/09/28
[ "https://Stackoverflow.com/questions/3815327", "https://Stackoverflow.com", "https://Stackoverflow.com/users/398546/" ]
This is really just a variant on the publicly-visible fields vs properties debate. Following the standard guidelines (your option 3) is what most people will recommend, despite what you call "redundancy". BTW I'm not sure which of the following you mean by redundancy * a few extra characters to type, or * an extra ge...
If you use public field, you cannot change it to property later without recompiling your assembly. So I think it is better to do it right at the first place by using property.
29,803,744
I'm loading in high-dimensional parquet files but only need a few columns. My current code looks like: ``` dat = sqc.parquetFile(path) \ .filter(lambda r: len(r.a)>0) \ .map(lambda r: (r.a, r.b, r.c)) ``` My mental model of what's happening is that it's loading in all the data, then throwing out...
2015/04/22
[ "https://Stackoverflow.com/questions/29803744", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3011972/" ]
You should use Spark DataFrame API: <https://spark.apache.org/docs/1.3.0/sql-programming-guide.html#dataframe-operations> Something like ``` dat.select("a", "b", "c").filter(lambda r: len(r.a)>0) ``` Or you can use Spark SQL: ``` dat.regiserTempTable("dat") sqc.sql("select a, b, c from dat where length(a) > 0") ...
Spark always do things in a lazy way, using a native scala feature. The scala code is already compiled, and it make runtime smart, I mean lazy, decisions. With parquet, it should only read the necessary data, referenced by the code. Of course that depends on the structure of the particular parquet file. The point is th...
29,803,744
I'm loading in high-dimensional parquet files but only need a few columns. My current code looks like: ``` dat = sqc.parquetFile(path) \ .filter(lambda r: len(r.a)>0) \ .map(lambda r: (r.a, r.b, r.c)) ``` My mental model of what's happening is that it's loading in all the data, then throwing out...
2015/04/22
[ "https://Stackoverflow.com/questions/29803744", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3011972/" ]
You should use Spark DataFrame API: <https://spark.apache.org/docs/1.3.0/sql-programming-guide.html#dataframe-operations> Something like ``` dat.select("a", "b", "c").filter(lambda r: len(r.a)>0) ``` Or you can use Spark SQL: ``` dat.regiserTempTable("dat") sqc.sql("select a, b, c from dat where length(a) > 0") ...
Yes it will only selected fields from Disk. " opens all the data files, but only reads the portion of each file containing the values for that column. The column values are stored consecutively, minimizing the I/O required to process the values within a single column." This documentation is for impala, i think readin...
24,984,231
**Problem** I have been unable to expose a WCF Service via an end point specified address. Example my end point address is: `http://localhost:36793/services/main` When I host the WCF Service with Visual Studio and try to access the address I get a http 404 Error (Not Found). What I would expect is to be able to vi...
2014/07/27
[ "https://Stackoverflow.com/questions/24984231", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3882026/" ]
Qt does not support creation of widgets in non-gui threads. The reason is simple: widget constructors are free to access thread-unsafe APIs that can be used by the main thread at any time. Thus even if it might appear to work, it's really a bug in your code if you do it. Generally speaking, in your heavyweight widget ...
First of all Qt and pretty much every other framework (at last those that I know) that deals with UI elements have very specifics requirements for multi-thread support. Qt needs every `QObject` descendant (like `QWidget`) to be assigned to a thread (see [QObject::thread()](http://qt-project.org/doc/qt-5/qobject.html#t...
33,187,430
I've created (copied and edited from online tool) a little box with a text [here on the botton right corner](http://www.lopsicoterapeuta.it) I would like to change also the color of the text in the box. But there's the command a:link, a:visited. How could I bypass these commands and giving the color I would like to t...
2015/10/17
[ "https://Stackoverflow.com/questions/33187430", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1939732/" ]
You had double declarations. I mean, `x` was alreaday declared in the signature and you re-declared it in the function body. So this will work: ```vb Public Function myaverage(x As Double, y As Double, z As Double) As Double myaverage = 0.4 * x + 0.5 * y + 0.1 * z End Function ``` * Do not forget the function mu...
If you want to use range `A1:C1` as the input argument then UDF has to be written accordingly: ``` Public Function RangeAverage(rRef As Range) As Double With rRef RangeAverage = 0.4 * .Cells(1).Value2 + 0.5 * .Cells(2).Value2 + 0.1 * .Cells(3).Value2 End With End Function ```
33,187,430
I've created (copied and edited from online tool) a little box with a text [here on the botton right corner](http://www.lopsicoterapeuta.it) I would like to change also the color of the text in the box. But there's the command a:link, a:visited. How could I bypass these commands and giving the color I would like to t...
2015/10/17
[ "https://Stackoverflow.com/questions/33187430", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1939732/" ]
Simplify your function to something like this: ``` Function myaverage(x As Double, y As Double, z As Double) As Double myaverage = 0.4 * x + 0.5 * y + 0.1 * z End Function ``` In Excel cell, use this: ``` = myaverage(A1, B1, C1) ```
If you want to use range `A1:C1` as the input argument then UDF has to be written accordingly: ``` Public Function RangeAverage(rRef As Range) As Double With rRef RangeAverage = 0.4 * .Cells(1).Value2 + 0.5 * .Cells(2).Value2 + 0.1 * .Cells(3).Value2 End With End Function ```
10,919,625
I've written an application with a CouchDB backend. I have invested a lot of time into CouchDB and so I'm reluctant to move everything over to a different NoSQL database (like Redis). The problem is that I now need to implement a rate limiting (based on IP address) feature. There are [plenty of examples](http://chris...
2012/06/06
[ "https://Stackoverflow.com/questions/10919625", "https://Stackoverflow.com", "https://Stackoverflow.com/users/431880/" ]
**Is running CouchDB in tandem with Redis unheard of?** Redis is commonly used in complement with other storage solutions (MySQL, PostgreSQL, MongoDB, CouchDB, etc ...). Like many other NoSQL solutions, Redis is not adapted to *all* kind of workloads or situations. The authors of Redis are pragmatic and open people, a...
You can do rate limiting with Memcached - it has a nice counter increment command as you mention, plus obsolete data is automatically purged from the cache in due course, so it has all the benefits of Redis for this application without the annoying duplication of capability (and complexity) that running Redis on top of...
11,639,187
I'm creating an Employee class containing three fields: name, age, and gender. I need to create a gender field but the user can only choose male or female. I guess I have to do this in a boolean form but I don't know how I'm going to do that. Can anyone help me out? So far I have: ``` public class Employee { private...
2012/07/24
[ "https://Stackoverflow.com/questions/11639187", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Since Java 1.5, the language supports enumeration types (`enum`), which are perfect for this kind of problems. Simple Gender enum: ``` public enum Gender { M, F, UNKNOWN } ``` Sophisticated Gender enum: ``` /** * Enumeration for reflecting user's gender. * @author naXa! */ public enum Gender { /** Male....
Two ideas: 1) Make a boolean like `isMale` or `isFemale` 2) Make a `Gender` Enum that only has `Gender.MALE` and `Gender.FEMALE`
11,639,187
I'm creating an Employee class containing three fields: name, age, and gender. I need to create a gender field but the user can only choose male or female. I guess I have to do this in a boolean form but I don't know how I'm going to do that. Can anyone help me out? So far I have: ``` public class Employee { private...
2012/07/24
[ "https://Stackoverflow.com/questions/11639187", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You can use a `boolean` or else you can create a `Gender` enum: In Gender.java: ``` public enum Gender { MALE, FEMALE } ``` In Employee.java: ``` public class Employee { private String name; private int age; private Gender gender; public Employee(String name, int age, Gender gender) ...
**boolean approach is useless** for one of many reasons: > > The distinction between sex and gender differentiates sex (the anatomy > of an individual's reproductive system, and secondary sex > characteristics) from gender (social roles based on the sex of the > person, usually culturally learned), or personal ide...
11,639,187
I'm creating an Employee class containing three fields: name, age, and gender. I need to create a gender field but the user can only choose male or female. I guess I have to do this in a boolean form but I don't know how I'm going to do that. Can anyone help me out? So far I have: ``` public class Employee { private...
2012/07/24
[ "https://Stackoverflow.com/questions/11639187", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
If you are going to use a boolean, it should be called `isMale` or `isFemale`, and not `isGender`. Note that whichever you pick, someone will probably complain that their gender is regarded as `false`. This is a reason why an enum might be a better option. Another reason a boolean might be inappropriate is that in som...
There are a couple things wrong here. First of all, in your if statements, you're assigning the value of `f` and `m` to gender with a single `=` operator. You need to do if (gender == true) or if (gender == false). Also, I recommend having true represent male or female and false represent the other gender.
11,639,187
I'm creating an Employee class containing three fields: name, age, and gender. I need to create a gender field but the user can only choose male or female. I guess I have to do this in a boolean form but I don't know how I'm going to do that. Can anyone help me out? So far I have: ``` public class Employee { private...
2012/07/24
[ "https://Stackoverflow.com/questions/11639187", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Specifying the gender as an `enum`, has its limitations: Only 65535 attributes (and methods) can be set in a single java class, which in todays diverse world is unaccaptable. I suggest using BigInteger, which has its maximum value as high as `(2 ^ 32) ^ 2147483647`.
There is a few things wrong with the code in the question. **First.** A constructor is supposed to set the values of the variables of the Employee class. The male and female boolean variables must be assigned before being used. ``` public class Employee { // other vars private boolean male; private boo...
11,639,187
I'm creating an Employee class containing three fields: name, age, and gender. I need to create a gender field but the user can only choose male or female. I guess I have to do this in a boolean form but I don't know how I'm going to do that. Can anyone help me out? So far I have: ``` public class Employee { private...
2012/07/24
[ "https://Stackoverflow.com/questions/11639187", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
If you are going to use a boolean, it should be called `isMale` or `isFemale`, and not `isGender`. Note that whichever you pick, someone will probably complain that their gender is regarded as `false`. This is a reason why an enum might be a better option. Another reason a boolean might be inappropriate is that in som...
**boolean approach is useless** for one of many reasons: > > The distinction between sex and gender differentiates sex (the anatomy > of an individual's reproductive system, and secondary sex > characteristics) from gender (social roles based on the sex of the > person, usually culturally learned), or personal ide...
11,639,187
I'm creating an Employee class containing three fields: name, age, and gender. I need to create a gender field but the user can only choose male or female. I guess I have to do this in a boolean form but I don't know how I'm going to do that. Can anyone help me out? So far I have: ``` public class Employee { private...
2012/07/24
[ "https://Stackoverflow.com/questions/11639187", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
**boolean approach is useless** for one of many reasons: > > The distinction between sex and gender differentiates sex (the anatomy > of an individual's reproductive system, and secondary sex > characteristics) from gender (social roles based on the sex of the > person, usually culturally learned), or personal ide...
There is a few things wrong with the code in the question. **First.** A constructor is supposed to set the values of the variables of the Employee class. The male and female boolean variables must be assigned before being used. ``` public class Employee { // other vars private boolean male; private boo...
11,639,187
I'm creating an Employee class containing three fields: name, age, and gender. I need to create a gender field but the user can only choose male or female. I guess I have to do this in a boolean form but I don't know how I'm going to do that. Can anyone help me out? So far I have: ``` public class Employee { private...
2012/07/24
[ "https://Stackoverflow.com/questions/11639187", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Since Java 1.5, the language supports enumeration types (`enum`), which are perfect for this kind of problems. Simple Gender enum: ``` public enum Gender { M, F, UNKNOWN } ``` Sophisticated Gender enum: ``` /** * Enumeration for reflecting user's gender. * @author naXa! */ public enum Gender { /** Male....
There are a couple things wrong here. First of all, in your if statements, you're assigning the value of `f` and `m` to gender with a single `=` operator. You need to do if (gender == true) or if (gender == false). Also, I recommend having true represent male or female and false represent the other gender.
11,639,187
I'm creating an Employee class containing three fields: name, age, and gender. I need to create a gender field but the user can only choose male or female. I guess I have to do this in a boolean form but I don't know how I'm going to do that. Can anyone help me out? So far I have: ``` public class Employee { private...
2012/07/24
[ "https://Stackoverflow.com/questions/11639187", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You can use a `boolean` or else you can create a `Gender` enum: In Gender.java: ``` public enum Gender { MALE, FEMALE } ``` In Employee.java: ``` public class Employee { private String name; private int age; private Gender gender; public Employee(String name, int age, Gender gender) ...
Two ideas: 1) Make a boolean like `isMale` or `isFemale` 2) Make a `Gender` Enum that only has `Gender.MALE` and `Gender.FEMALE`
11,639,187
I'm creating an Employee class containing three fields: name, age, and gender. I need to create a gender field but the user can only choose male or female. I guess I have to do this in a boolean form but I don't know how I'm going to do that. Can anyone help me out? So far I have: ``` public class Employee { private...
2012/07/24
[ "https://Stackoverflow.com/questions/11639187", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You can use a `boolean` or else you can create a `Gender` enum: In Gender.java: ``` public enum Gender { MALE, FEMALE } ``` In Employee.java: ``` public class Employee { private String name; private int age; private Gender gender; public Employee(String name, int age, Gender gender) ...
There are a couple things wrong here. First of all, in your if statements, you're assigning the value of `f` and `m` to gender with a single `=` operator. You need to do if (gender == true) or if (gender == false). Also, I recommend having true represent male or female and false represent the other gender.
11,639,187
I'm creating an Employee class containing three fields: name, age, and gender. I need to create a gender field but the user can only choose male or female. I guess I have to do this in a boolean form but I don't know how I'm going to do that. Can anyone help me out? So far I have: ``` public class Employee { private...
2012/07/24
[ "https://Stackoverflow.com/questions/11639187", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Better to use an enum for Gender: ``` public enum Gender { MALE, FEMALE } ```
There is a few things wrong with the code in the question. **First.** A constructor is supposed to set the values of the variables of the Employee class. The male and female boolean variables must be assigned before being used. ``` public class Employee { // other vars private boolean male; private boo...
8,829,011
I want to pass an array of key-value pairs as an argument to a PostgreSQL function using Npgsql. I have the following type defined: ``` drop type if exists key_value_pair create type key_value_pair as ( k varchar(250), v text ); ``` I want to write a function like so: ``` create or replace function pers...
2012/01/12
[ "https://Stackoverflow.com/questions/8829011", "https://Stackoverflow.com", "https://Stackoverflow.com/users/610217/" ]
Jeremy! Unfortunately, Npgsql doesn't support custom datatypes yet. I have intention to add support for that. This would mean to add some type of "registering" of types converters with Npgsql. This way your application would register a converter for your custom type and Npgsql would use it to send data back and forth...
I convert IDictionary to 2 dimensional array and pass this array to stored procedure via Npgsql - works fine as Npgsql [supports](http://npgsql.projects.postgresql.org/docs/manual/UserManual.html) arrays as parameters. Convert like this: ``` string[][] columnsArray = new string[2][]; Di...
8,829,011
I want to pass an array of key-value pairs as an argument to a PostgreSQL function using Npgsql. I have the following type defined: ``` drop type if exists key_value_pair create type key_value_pair as ( k varchar(250), v text ); ``` I want to write a function like so: ``` create or replace function pers...
2012/01/12
[ "https://Stackoverflow.com/questions/8829011", "https://Stackoverflow.com", "https://Stackoverflow.com/users/610217/" ]
Jeremy! Unfortunately, Npgsql doesn't support custom datatypes yet. I have intention to add support for that. This would mean to add some type of "registering" of types converters with Npgsql. This way your application would register a converter for your custom type and Npgsql would use it to send data back and forth...
Seems it still doesn't support user defined object types. Alternative way is serialize object to XML and pass as parameter and parse and execute it in stored procedure. Is there any change at support status for user defined objects?
8,829,011
I want to pass an array of key-value pairs as an argument to a PostgreSQL function using Npgsql. I have the following type defined: ``` drop type if exists key_value_pair create type key_value_pair as ( k varchar(250), v text ); ``` I want to write a function like so: ``` create or replace function pers...
2012/01/12
[ "https://Stackoverflow.com/questions/8829011", "https://Stackoverflow.com", "https://Stackoverflow.com/users/610217/" ]
Jeremy! Unfortunately, Npgsql doesn't support custom datatypes yet. I have intention to add support for that. This would mean to add some type of "registering" of types converters with Npgsql. This way your application would register a converter for your custom type and Npgsql would use it to send data back and forth...
Npg does support it (at least in 3.1.7) Say you're executing something like ``` INSERT INTO some_table (key, value) SELECT key, value FROM UNNEST(@key_value_pairs); ``` where `key_value_pairs` is an array of your `key_value_pair` type, and you have a class like ``` class key_value_pair { string key; string...
8,829,011
I want to pass an array of key-value pairs as an argument to a PostgreSQL function using Npgsql. I have the following type defined: ``` drop type if exists key_value_pair create type key_value_pair as ( k varchar(250), v text ); ``` I want to write a function like so: ``` create or replace function pers...
2012/01/12
[ "https://Stackoverflow.com/questions/8829011", "https://Stackoverflow.com", "https://Stackoverflow.com/users/610217/" ]
Jeremy! Unfortunately, Npgsql doesn't support custom datatypes yet. I have intention to add support for that. This would mean to add some type of "registering" of types converters with Npgsql. This way your application would register a converter for your custom type and Npgsql would use it to send data back and forth...
Pleasingly this feature has now been implemented, the documentation can be found at: <https://www.npgsql.org/doc/types/enums_and_composites.html> As the documentation states, you need to create the type in dotnet and in postgres, then map one to the other, before you open the connection for example: ``` NpgsqlConnect...
8,829,011
I want to pass an array of key-value pairs as an argument to a PostgreSQL function using Npgsql. I have the following type defined: ``` drop type if exists key_value_pair create type key_value_pair as ( k varchar(250), v text ); ``` I want to write a function like so: ``` create or replace function pers...
2012/01/12
[ "https://Stackoverflow.com/questions/8829011", "https://Stackoverflow.com", "https://Stackoverflow.com/users/610217/" ]
I convert IDictionary to 2 dimensional array and pass this array to stored procedure via Npgsql - works fine as Npgsql [supports](http://npgsql.projects.postgresql.org/docs/manual/UserManual.html) arrays as parameters. Convert like this: ``` string[][] columnsArray = new string[2][]; Di...
Seems it still doesn't support user defined object types. Alternative way is serialize object to XML and pass as parameter and parse and execute it in stored procedure. Is there any change at support status for user defined objects?
8,829,011
I want to pass an array of key-value pairs as an argument to a PostgreSQL function using Npgsql. I have the following type defined: ``` drop type if exists key_value_pair create type key_value_pair as ( k varchar(250), v text ); ``` I want to write a function like so: ``` create or replace function pers...
2012/01/12
[ "https://Stackoverflow.com/questions/8829011", "https://Stackoverflow.com", "https://Stackoverflow.com/users/610217/" ]
I convert IDictionary to 2 dimensional array and pass this array to stored procedure via Npgsql - works fine as Npgsql [supports](http://npgsql.projects.postgresql.org/docs/manual/UserManual.html) arrays as parameters. Convert like this: ``` string[][] columnsArray = new string[2][]; Di...
Npg does support it (at least in 3.1.7) Say you're executing something like ``` INSERT INTO some_table (key, value) SELECT key, value FROM UNNEST(@key_value_pairs); ``` where `key_value_pairs` is an array of your `key_value_pair` type, and you have a class like ``` class key_value_pair { string key; string...
8,829,011
I want to pass an array of key-value pairs as an argument to a PostgreSQL function using Npgsql. I have the following type defined: ``` drop type if exists key_value_pair create type key_value_pair as ( k varchar(250), v text ); ``` I want to write a function like so: ``` create or replace function pers...
2012/01/12
[ "https://Stackoverflow.com/questions/8829011", "https://Stackoverflow.com", "https://Stackoverflow.com/users/610217/" ]
I convert IDictionary to 2 dimensional array and pass this array to stored procedure via Npgsql - works fine as Npgsql [supports](http://npgsql.projects.postgresql.org/docs/manual/UserManual.html) arrays as parameters. Convert like this: ``` string[][] columnsArray = new string[2][]; Di...
Pleasingly this feature has now been implemented, the documentation can be found at: <https://www.npgsql.org/doc/types/enums_and_composites.html> As the documentation states, you need to create the type in dotnet and in postgres, then map one to the other, before you open the connection for example: ``` NpgsqlConnect...
8,829,011
I want to pass an array of key-value pairs as an argument to a PostgreSQL function using Npgsql. I have the following type defined: ``` drop type if exists key_value_pair create type key_value_pair as ( k varchar(250), v text ); ``` I want to write a function like so: ``` create or replace function pers...
2012/01/12
[ "https://Stackoverflow.com/questions/8829011", "https://Stackoverflow.com", "https://Stackoverflow.com/users/610217/" ]
Seems it still doesn't support user defined object types. Alternative way is serialize object to XML and pass as parameter and parse and execute it in stored procedure. Is there any change at support status for user defined objects?
Npg does support it (at least in 3.1.7) Say you're executing something like ``` INSERT INTO some_table (key, value) SELECT key, value FROM UNNEST(@key_value_pairs); ``` where `key_value_pairs` is an array of your `key_value_pair` type, and you have a class like ``` class key_value_pair { string key; string...
8,829,011
I want to pass an array of key-value pairs as an argument to a PostgreSQL function using Npgsql. I have the following type defined: ``` drop type if exists key_value_pair create type key_value_pair as ( k varchar(250), v text ); ``` I want to write a function like so: ``` create or replace function pers...
2012/01/12
[ "https://Stackoverflow.com/questions/8829011", "https://Stackoverflow.com", "https://Stackoverflow.com/users/610217/" ]
Pleasingly this feature has now been implemented, the documentation can be found at: <https://www.npgsql.org/doc/types/enums_and_composites.html> As the documentation states, you need to create the type in dotnet and in postgres, then map one to the other, before you open the connection for example: ``` NpgsqlConnect...
Npg does support it (at least in 3.1.7) Say you're executing something like ``` INSERT INTO some_table (key, value) SELECT key, value FROM UNNEST(@key_value_pairs); ``` where `key_value_pairs` is an array of your `key_value_pair` type, and you have a class like ``` class key_value_pair { string key; string...
21,498,637
I have a repository which contains a node called *code*, which I want to remove. ![Actual root](https://i.stack.imgur.com/8VGgH.png) I want to have the following as root, without the parent node *code*. ![This should be root](https://i.stack.imgur.com/M3WGN.png) Is there a way to change it? My thought is too use...
2014/02/01
[ "https://Stackoverflow.com/questions/21498637", "https://Stackoverflow.com", "https://Stackoverflow.com/users/390177/" ]
You should use **svn copy** command to copy those 3 folders from code to root and then **svn remove** to delete the code. Using **svn copy** would prevent your commit history and you don't have to bother with **svn:mergeinfo**. It's never a good idea to manually change **svn:mergeinfo**.
I found a suitable way for me. I am using the **dump** and **load** functionality from svn. *code* is in this case the first node in the folder structure, which should be removed. After dumping I change the dump file with sed: ``` sed -i -r 's/(Node-[a-z-]+): code\//\1: /' ``` Furthermore the pathes in the **svn...
21,498,637
I have a repository which contains a node called *code*, which I want to remove. ![Actual root](https://i.stack.imgur.com/8VGgH.png) I want to have the following as root, without the parent node *code*. ![This should be root](https://i.stack.imgur.com/M3WGN.png) Is there a way to change it? My thought is too use...
2014/02/01
[ "https://Stackoverflow.com/questions/21498637", "https://Stackoverflow.com", "https://Stackoverflow.com/users/390177/" ]
Just move them to the root. Substitute the full URLs to your directories below. ``` svn mv /code/branches /branches svn mv /code/trunk /trunk svn mv /code/tags /tags svn rm /code ```
I found a suitable way for me. I am using the **dump** and **load** functionality from svn. *code* is in this case the first node in the folder structure, which should be removed. After dumping I change the dump file with sed: ``` sed -i -r 's/(Node-[a-z-]+): code\//\1: /' ``` Furthermore the pathes in the **svn...
2,006,035
I would like to create a process in my application. But after looking around and from Java's API I still don't quite get it. Basically I want to create a multi process application. But the new process is a class in my application. I know some of you might ask why not create a thread? Because the class is calling a ma...
2010/01/05
[ "https://Stackoverflow.com/questions/2006035", "https://Stackoverflow.com", "https://Stackoverflow.com/users/184777/" ]
There is only one way to create processes in Java, [`Runtime.exec()`](http://java.sun.com/javase/6/docs/api/java/lang/Runtime.html#exec(java.lang.String[])) - basically it allows you to start a new JVM just as you would via the command line interface.
I guess you know how to create a new process. If not, see [here](https://stackoverflow.com/questions/193166/good-java-process-control-library) or [here](https://stackoverflow.com/questions/464471/external-program-from-our-java-program). Now you need to run `java.exe` with your current classpath. You can find this clas...
2,006,035
I would like to create a process in my application. But after looking around and from Java's API I still don't quite get it. Basically I want to create a multi process application. But the new process is a class in my application. I know some of you might ask why not create a thread? Because the class is calling a ma...
2010/01/05
[ "https://Stackoverflow.com/questions/2006035", "https://Stackoverflow.com", "https://Stackoverflow.com/users/184777/" ]
There is only one way to create processes in Java, [`Runtime.exec()`](http://java.sun.com/javase/6/docs/api/java/lang/Runtime.html#exec(java.lang.String[])) - basically it allows you to start a new JVM just as you would via the command line interface.
If you want more fine-grained control, you could use [`ProcessBuilder`](http://docs.oracle.com/javase/7/docs/api/java/lang/ProcessBuilder.html) - this class allows you to set environment variables and configure the project's pipes (`stdout`, `in`, `err`). Once you've configured it, you can call `ProcessBuilder#start()...
2,006,035
I would like to create a process in my application. But after looking around and from Java's API I still don't quite get it. Basically I want to create a multi process application. But the new process is a class in my application. I know some of you might ask why not create a thread? Because the class is calling a ma...
2010/01/05
[ "https://Stackoverflow.com/questions/2006035", "https://Stackoverflow.com", "https://Stackoverflow.com/users/184777/" ]
There is only one way to create processes in Java, [`Runtime.exec()`](http://java.sun.com/javase/6/docs/api/java/lang/Runtime.html#exec(java.lang.String[])) - basically it allows you to start a new JVM just as you would via the command line interface.
My recommendation is to take a look at zt-exec: <https://github.com/zeroturnaround/zt-exec> It wrapped java.lang.ProcessBuilder and and Apache Commons Exec, and could manage process life cycle easily.
2,006,035
I would like to create a process in my application. But after looking around and from Java's API I still don't quite get it. Basically I want to create a multi process application. But the new process is a class in my application. I know some of you might ask why not create a thread? Because the class is calling a ma...
2010/01/05
[ "https://Stackoverflow.com/questions/2006035", "https://Stackoverflow.com", "https://Stackoverflow.com/users/184777/" ]
Maybe [java.lang.Process](http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Process.html) could help here .. > > The `ProcessBuilder.start()` and `Runtime.exec` methods create a native process and return an instance of a subclass of Process that can be used to control the process and obtain information about it. The ...
I guess you know how to create a new process. If not, see [here](https://stackoverflow.com/questions/193166/good-java-process-control-library) or [here](https://stackoverflow.com/questions/464471/external-program-from-our-java-program). Now you need to run `java.exe` with your current classpath. You can find this clas...
2,006,035
I would like to create a process in my application. But after looking around and from Java's API I still don't quite get it. Basically I want to create a multi process application. But the new process is a class in my application. I know some of you might ask why not create a thread? Because the class is calling a ma...
2010/01/05
[ "https://Stackoverflow.com/questions/2006035", "https://Stackoverflow.com", "https://Stackoverflow.com/users/184777/" ]
Maybe [java.lang.Process](http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Process.html) could help here .. > > The `ProcessBuilder.start()` and `Runtime.exec` methods create a native process and return an instance of a subclass of Process that can be used to control the process and obtain information about it. The ...
If you want more fine-grained control, you could use [`ProcessBuilder`](http://docs.oracle.com/javase/7/docs/api/java/lang/ProcessBuilder.html) - this class allows you to set environment variables and configure the project's pipes (`stdout`, `in`, `err`). Once you've configured it, you can call `ProcessBuilder#start()...
2,006,035
I would like to create a process in my application. But after looking around and from Java's API I still don't quite get it. Basically I want to create a multi process application. But the new process is a class in my application. I know some of you might ask why not create a thread? Because the class is calling a ma...
2010/01/05
[ "https://Stackoverflow.com/questions/2006035", "https://Stackoverflow.com", "https://Stackoverflow.com/users/184777/" ]
Maybe [java.lang.Process](http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Process.html) could help here .. > > The `ProcessBuilder.start()` and `Runtime.exec` methods create a native process and return an instance of a subclass of Process that can be used to control the process and obtain information about it. The ...
My recommendation is to take a look at zt-exec: <https://github.com/zeroturnaround/zt-exec> It wrapped java.lang.ProcessBuilder and and Apache Commons Exec, and could manage process life cycle easily.
2,006,035
I would like to create a process in my application. But after looking around and from Java's API I still don't quite get it. Basically I want to create a multi process application. But the new process is a class in my application. I know some of you might ask why not create a thread? Because the class is calling a ma...
2010/01/05
[ "https://Stackoverflow.com/questions/2006035", "https://Stackoverflow.com", "https://Stackoverflow.com/users/184777/" ]
I guess you know how to create a new process. If not, see [here](https://stackoverflow.com/questions/193166/good-java-process-control-library) or [here](https://stackoverflow.com/questions/464471/external-program-from-our-java-program). Now you need to run `java.exe` with your current classpath. You can find this clas...
My recommendation is to take a look at zt-exec: <https://github.com/zeroturnaround/zt-exec> It wrapped java.lang.ProcessBuilder and and Apache Commons Exec, and could manage process life cycle easily.
2,006,035
I would like to create a process in my application. But after looking around and from Java's API I still don't quite get it. Basically I want to create a multi process application. But the new process is a class in my application. I know some of you might ask why not create a thread? Because the class is calling a ma...
2010/01/05
[ "https://Stackoverflow.com/questions/2006035", "https://Stackoverflow.com", "https://Stackoverflow.com/users/184777/" ]
If you want more fine-grained control, you could use [`ProcessBuilder`](http://docs.oracle.com/javase/7/docs/api/java/lang/ProcessBuilder.html) - this class allows you to set environment variables and configure the project's pipes (`stdout`, `in`, `err`). Once you've configured it, you can call `ProcessBuilder#start()...
My recommendation is to take a look at zt-exec: <https://github.com/zeroturnaround/zt-exec> It wrapped java.lang.ProcessBuilder and and Apache Commons Exec, and could manage process life cycle easily.
53,649,984
Despite of numerous thread on the subject I didn't manage to remove an item of a string based Array using `Array.filter` method. Here is the filter method in a context of a mutation of a Vuex store. ``` UPDATE_FILTERS_GEOLOGIES: (state, payload) => { if (state.filters.geologies.some(elem => elem === payload)) { ...
2018/12/06
[ "https://Stackoverflow.com/questions/53649984", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9731186/" ]
`list` is a `type`, which means it is defined somewhere as a class, just like `int` and `float`. ``` >> type(list) <class 'type'> ``` If you check its definition in `builtins.py` (the actual code is implemented in C): ``` class list(object): """ Built-in mutable sequence. If no argument is given, the c...
When you call `list()`, you're invoking the constructor of the `list` class (`list.__init__`). If you have any doubt about the use of the term "constructor" in Python, this is the exact word that the implementers of `list` chose to refer to `__init__`: <https://github.com/python/cpython/blob/master/Objects/listobject...
38,226,569
So here's the issue, I made a whole slew of changes to a Rails app in the `app/views` folder and I pushed up the changes. I could look at the Github UI and revert these changes back line by line, but there must be an easier way. These changes were made 2 commits ago. Is there a way to change the contents of everything ...
2016/07/06
[ "https://Stackoverflow.com/questions/38226569", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2714301/" ]
I think what you are after is ``` git checkout <branch-name> git checkout <commit that you want> -- folder/that/you/want git add folder/that/you/want git commit -m "revert bad changes" git push origin ``` This should be done with a clean workspace, at least within `folder/that/you/want`
Use `git rebase -i`, change every line to `edit`, then use `git checkout goodcommit dirtoreset`.
72,245
Given the Naive Bayes graphical representation below, I want to calculate $P(X|Y\_1,Y\_2)$. Are the calculations below correct? ![enter image description here](https://i.stack.imgur.com/xWOqG.png) The factored joint distribution regarding the system is: $$P(X,Y\_1,Y\_2)=P(X) \cdot P(Y\_1|X) \cdot P(Y\_2|X)$$ $$\fr...
2013/10/08
[ "https://stats.stackexchange.com/questions/72245", "https://stats.stackexchange.com", "https://stats.stackexchange.com/users/31230/" ]
No, the move from your penultimate equation to the final equation has an error. In general you should not say $P(Y\_1,Y\_2)= P(Y\_1)P(Y\_2)$.
According to the Naive Bayesian graph, the covariate $Y\_1$ is **independent** of the covariate $Y\_2$. Therefore $P(Y\_1|X) \cdot P(Y\_2|X)=P(Y\_1,Y\_2|X)$ and $P(Y\_1,Y\_2) = P(Y\_1) \cdot P(Y\_2) $ Implementing these into your last equation, you can see that: $$P(X|Y\_1,Y\_2) = \frac{P(Y\_1,Y\_2|X) \cdot P(X)}{P...
72,245
Given the Naive Bayes graphical representation below, I want to calculate $P(X|Y\_1,Y\_2)$. Are the calculations below correct? ![enter image description here](https://i.stack.imgur.com/xWOqG.png) The factored joint distribution regarding the system is: $$P(X,Y\_1,Y\_2)=P(X) \cdot P(Y\_1|X) \cdot P(Y\_2|X)$$ $$\fr...
2013/10/08
[ "https://stats.stackexchange.com/questions/72245", "https://stats.stackexchange.com", "https://stats.stackexchange.com/users/31230/" ]
Up to the last line, like [Henry](https://stats.stackexchange.com/users/2958/henry) already pointed out, is all correct. What you could write is, $$ P(X|Y\_{1},Y\_{2}) = \frac{P(Y\_{1},Y\_{2}|X)P(X)}{\sum\_{X}P(Y\_{1},Y\_{2}|X)P(X)} = \frac{P(Y\_{1},|X)P(Y\_{2},|X)P(X)}{\sum\_{X}P(Y\_{1},|X)P(Y\_{2},|X)P(X)} $$ $Y\_{...
According to the Naive Bayesian graph, the covariate $Y\_1$ is **independent** of the covariate $Y\_2$. Therefore $P(Y\_1|X) \cdot P(Y\_2|X)=P(Y\_1,Y\_2|X)$ and $P(Y\_1,Y\_2) = P(Y\_1) \cdot P(Y\_2) $ Implementing these into your last equation, you can see that: $$P(X|Y\_1,Y\_2) = \frac{P(Y\_1,Y\_2|X) \cdot P(X)}{P...
72,245
Given the Naive Bayes graphical representation below, I want to calculate $P(X|Y\_1,Y\_2)$. Are the calculations below correct? ![enter image description here](https://i.stack.imgur.com/xWOqG.png) The factored joint distribution regarding the system is: $$P(X,Y\_1,Y\_2)=P(X) \cdot P(Y\_1|X) \cdot P(Y\_2|X)$$ $$\fr...
2013/10/08
[ "https://stats.stackexchange.com/questions/72245", "https://stats.stackexchange.com", "https://stats.stackexchange.com/users/31230/" ]
Up to the last line, like [Henry](https://stats.stackexchange.com/users/2958/henry) already pointed out, is all correct. What you could write is, $$ P(X|Y\_{1},Y\_{2}) = \frac{P(Y\_{1},Y\_{2}|X)P(X)}{\sum\_{X}P(Y\_{1},Y\_{2}|X)P(X)} = \frac{P(Y\_{1},|X)P(Y\_{2},|X)P(X)}{\sum\_{X}P(Y\_{1},|X)P(Y\_{2},|X)P(X)} $$ $Y\_{...
No, the move from your penultimate equation to the final equation has an error. In general you should not say $P(Y\_1,Y\_2)= P(Y\_1)P(Y\_2)$.
69,185
I've used polygon neighbors to find all neighbors of a polygon layer, which I then use to look up all possible neighbor combinations and dissolve the polygons into all possible combinations of two polygons. I'd then like to run this again and build all possible three-polygon combinations. However, when I run the tool...
2013/08/20
[ "https://gis.stackexchange.com/questions/69185", "https://gis.stackexchange.com", "https://gis.stackexchange.com/users/21048/" ]
A few notes.... 1. You shouldn't have to use both MakeFeatureLayer() and SelectLayerByAttribute(). You can pass a third, optional parameter to MakeFeatureLayer() that uses a SQL statement to select a subset. See the [help](http://resources.arcgis.com/en/help/main/10.1/index.html#//00170000006p000000). 2. You should de...
Adding the Report By fields as below worked: ``` arcpy.PolygonNeighbors_analysis(r"Sites", "Sites_Neighbors", [r"OBJECTID", r"BLPUCount"]) ```
44,474
I've fit a non-linear mixed effects model with a four parameter logistic function. My specific interest is in characterizing the point on the curve at which the horizontal component of the curve meets the oblique component. For instance, in the following fixed effects plot I've indicated with blue arrows the region on ...
2012/11/27
[ "https://stats.stackexchange.com/questions/44474", "https://stats.stackexchange.com", "https://stats.stackexchange.com/users/44995/" ]
If we approximate the log-scale logistic function $1/(1 + \exp(-B(t - \log C))$ with the linear function $1/2 + (t - \log C)B/4$, the approximation intersects the asymptotes at $t = \log C \pm 2/B$. Translating that to the $x$-scale puts the "corners" of the function at $x = C \exp(\pm2/B)$.
Are you trying to compare both curves? Well, if I am correct A and D represent the upper and lower asymptotes, C is a scaling coefficient and B is a rate parameter. A simple, "quick and dirty" way to compare the curves for the points you highlight is to solve your function for x, and plug in your solved parameter value...
44,474
I've fit a non-linear mixed effects model with a four parameter logistic function. My specific interest is in characterizing the point on the curve at which the horizontal component of the curve meets the oblique component. For instance, in the following fixed effects plot I've indicated with blue arrows the region on ...
2012/11/27
[ "https://stats.stackexchange.com/questions/44474", "https://stats.stackexchange.com", "https://stats.stackexchange.com/users/44995/" ]
I think your question is based on a flaw. You ask where is "the point on the curve at which the horizontal component of the curve meets the oblique component"? But there are no "components". It is one curve. Asking where two components intersect is a meaningless question when there are no such components. Here are so...
Are you trying to compare both curves? Well, if I am correct A and D represent the upper and lower asymptotes, C is a scaling coefficient and B is a rate parameter. A simple, "quick and dirty" way to compare the curves for the points you highlight is to solve your function for x, and plug in your solved parameter value...
10,880,809
I want to upload large file (any format) more than 1GB. what technique I will use FTP or HTTP. And I want to add stop and resume feature to file i am uploading. How can I do that? Any example or API or library?
2012/06/04
[ "https://Stackoverflow.com/questions/10880809", "https://Stackoverflow.com", "https://Stackoverflow.com/users/585387/" ]
Apache commons net has an FTP-client. And some other protocol implementations. <http://commons.apache.org/net/>
You can try the default HttpUrlConnection or Apache HttpClient.
10,880,809
I want to upload large file (any format) more than 1GB. what technique I will use FTP or HTTP. And I want to add stop and resume feature to file i am uploading. How can I do that? Any example or API or library?
2012/06/04
[ "https://Stackoverflow.com/questions/10880809", "https://Stackoverflow.com", "https://Stackoverflow.com/users/585387/" ]
Apache commons net has an FTP-client. And some other protocol implementations. <http://commons.apache.org/net/>
Try this library, it contains all your desired features: <http://www.sauronsoftware.it/projects/ftp4j/>
10,880,809
I want to upload large file (any format) more than 1GB. what technique I will use FTP or HTTP. And I want to add stop and resume feature to file i am uploading. How can I do that? Any example or API or library?
2012/06/04
[ "https://Stackoverflow.com/questions/10880809", "https://Stackoverflow.com", "https://Stackoverflow.com/users/585387/" ]
Apache commons net has an FTP-client. And some other protocol implementations. <http://commons.apache.org/net/>
Refer [here](https://stackoverflow.com/questions/6074516/how-could-i-upload-a-large-file-in-chunks-using-java?s=2%7C1.7848) I have done it using plupload. Hope it helps you. Any number of files of any sizes can be uploaded using it..
69,335,889
The following code is supposed to convert or transpose data from multiple rows to lesser rows by IDs Here's sample of data in Sheet1 [![enter image description here](https://i.stack.imgur.com/SL1dV.png)](https://i.stack.imgur.com/SL1dV.png) And this is the desired output [![enter image description here](https://i.stac...
2021/09/26
[ "https://Stackoverflow.com/questions/69335889", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7657180/" ]
Using Collections ```vb Sub Test2() Dim ar, dict As Object, k Dim t As Long, i As Long, r As Long ar = Sheets("Sheet1").Range("A1").CurrentRegion.Resize(, 3).Value Set dict = CreateObject("Scripting.Dictionary") For i = 2 To UBound(ar) k = ar(i, 1) If Not dict.exists(k) Then ...
I have played around the code and could adust the output but I welcome any other solutions ``` Sub Test() Dim a, tmp, i As Long, ii As Long, t As Long a = Sheets("Sheet1").Range("A1").CurrentRegion.Resize(, 3).Value a(1, 3) = a(1, 2) & " 1" With CreateObject("Scripting.Dictionary") For i = 2 To...
22,823,304
I just tried to execute a java command using runtime like this: ``` Runtime.getRuntime().exec("shutdown -s"); ``` to shutdown the computer, but I am training on a project that will get both my electronics and computer skills so I want to execute an avrdude command to program the mcu from Java and make a GUI program...
2014/04/02
[ "https://Stackoverflow.com/questions/22823304", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3407319/" ]
If type of your input is a string, you can use `Join`, `Split` and `Distinct` like this, split the input by *white-space* get unique items then concatenate them again using `Join` method: ``` var input = "12345 12345 12345 12346 12346 12346 12347 12347 12347"; var output = string.Join(" ", input.Split().Distinct()); ...
Assuming you have an `IEnumerable<T>` collection as input, use `Distinct` method from LINQ: ``` var result = source.Distinct(); ```
22,823,304
I just tried to execute a java command using runtime like this: ``` Runtime.getRuntime().exec("shutdown -s"); ``` to shutdown the computer, but I am training on a project that will get both my electronics and computer skills so I want to execute an avrdude command to program the mcu from Java and make a GUI program...
2014/04/02
[ "https://Stackoverflow.com/questions/22823304", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3407319/" ]
If type of your input is a string, you can use `Join`, `Split` and `Distinct` like this, split the input by *white-space* get unique items then concatenate them again using `Join` method: ``` var input = "12345 12345 12345 12346 12346 12346 12347 12347 12347"; var output = string.Join(" ", input.Split().Distinct()); ...
If you already have a collection on numbers you can just do: ``` list.Distinct(); ``` to convert to a `List` just add `ToList()`
22,823,304
I just tried to execute a java command using runtime like this: ``` Runtime.getRuntime().exec("shutdown -s"); ``` to shutdown the computer, but I am training on a project that will get both my electronics and computer skills so I want to execute an avrdude command to program the mcu from Java and make a GUI program...
2014/04/02
[ "https://Stackoverflow.com/questions/22823304", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3407319/" ]
If type of your input is a string, you can use `Join`, `Split` and `Distinct` like this, split the input by *white-space* get unique items then concatenate them again using `Join` method: ``` var input = "12345 12345 12345 12346 12346 12346 12347 12347 12347"; var output = string.Join(" ", input.Split().Distinct()); ...
``` var input = "12345 12345 12345 12346 12346 12346 12347 12347 12347"; var output = string.Join(" ", input.Split(' ').Distinct()); ```
22,823,304
I just tried to execute a java command using runtime like this: ``` Runtime.getRuntime().exec("shutdown -s"); ``` to shutdown the computer, but I am training on a project that will get both my electronics and computer skills so I want to execute an avrdude command to program the mcu from Java and make a GUI program...
2014/04/02
[ "https://Stackoverflow.com/questions/22823304", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3407319/" ]
Assuming you have an `IEnumerable<T>` collection as input, use `Distinct` method from LINQ: ``` var result = source.Distinct(); ```
``` var input = "12345 12345 12345 12346 12346 12346 12347 12347 12347"; var output = string.Join(" ", input.Split(' ').Distinct()); ```
22,823,304
I just tried to execute a java command using runtime like this: ``` Runtime.getRuntime().exec("shutdown -s"); ``` to shutdown the computer, but I am training on a project that will get both my electronics and computer skills so I want to execute an avrdude command to program the mcu from Java and make a GUI program...
2014/04/02
[ "https://Stackoverflow.com/questions/22823304", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3407319/" ]
If you already have a collection on numbers you can just do: ``` list.Distinct(); ``` to convert to a `List` just add `ToList()`
``` var input = "12345 12345 12345 12346 12346 12346 12347 12347 12347"; var output = string.Join(" ", input.Split(' ').Distinct()); ```
20,596,045
``` suffixes = { 1: ["ो", "े", "ू", "ु", "ी", "ि", "ा"]} ``` When I done message given by IDLE is ``` Unsupported characters in input ``` Also not see the proper font in MS-DOS.
2013/12/15
[ "https://Stackoverflow.com/questions/20596045", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3104685/" ]
What encoding is your source file in? If it is UTF8, put the comment ``` # -*- coding: utf-8 -*- ``` at the top of the file.
If you don't declare encoding in your first or second line in your python source file, then the python interpreter will use ASCII encoding system to decode the characters in the file. As these characters you used couldn't be decoded by ASCII encoding system, errors happended. The solution is as @RemcoGerlich said. Her...
20,596,045
``` suffixes = { 1: ["ो", "े", "ू", "ु", "ी", "ि", "ा"]} ``` When I done message given by IDLE is ``` Unsupported characters in input ``` Also not see the proper font in MS-DOS.
2013/12/15
[ "https://Stackoverflow.com/questions/20596045", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3104685/" ]
What encoding is your source file in? If it is UTF8, put the comment ``` # -*- coding: utf-8 -*- ``` at the top of the file.
This seems to be a known bug in the 2.x IDLE console: <http://bugs.python.org/issue15809>. A fix was made for Python 3.x, but doesn't appear to be backported. Instead, use an alternative console, such as iPython/Jupyter, or a fully-fledged IDE, such as PyCharm.
16,114,773
that might be something strange when I say that I want to encode a URL partially, But I am caught in this situation and it seems that I got no other solution... here is my code snippet ``` $url = isset($_GET['u']) ? esc_url($_GET['u']) : ''; $image = isset($_GET['i']) ? $_GET['i'] : ''; maybeappend = ...
2013/04/19
[ "https://Stackoverflow.com/questions/16114773", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1090463/" ]
used JitBit Macro Recorder with this script Thanks anyways =) ``` WAIT FOR USER : 192 : 2 : 0 : 0 Keyboard : ShiftLeft : KeyDown DELAY : 10 Keyboard : Down : KeyDown DELAY : 10 Keyboard : Down : KeyUp DELAY : 10 Keyboard : Down : KeyDown DELAY : 10 Keyboard : Down : KeyUp DELAY : 10 Keyboard : Down : KeyDown DELAY...
Maybe something like this? ``` Option Explicit Sub LongRowImport() With ActiveSheet.QueryTables.Add(Connection:= _ "TEXT;C:\pathname\long_text_row.txt", _ Destination:=Range("A1")) .Name = "long_text_row" .FieldNames = True .RowNumbers = False ...
16,114,773
that might be something strange when I say that I want to encode a URL partially, But I am caught in this situation and it seems that I got no other solution... here is my code snippet ``` $url = isset($_GET['u']) ? esc_url($_GET['u']) : ''; $image = isset($_GET['i']) ? $_GET['i'] : ''; maybeappend = ...
2013/04/19
[ "https://Stackoverflow.com/questions/16114773", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1090463/" ]
Actually, this is the best method to do what you were asking! Enjoy ``` http://www.softpedia.com/get/System/File-Management/Text-File-Splitter.shtml ``` It's called Text File Splitter 2.0.4
used JitBit Macro Recorder with this script Thanks anyways =) ``` WAIT FOR USER : 192 : 2 : 0 : 0 Keyboard : ShiftLeft : KeyDown DELAY : 10 Keyboard : Down : KeyDown DELAY : 10 Keyboard : Down : KeyUp DELAY : 10 Keyboard : Down : KeyDown DELAY : 10 Keyboard : Down : KeyUp DELAY : 10 Keyboard : Down : KeyDown DELAY...
16,114,773
that might be something strange when I say that I want to encode a URL partially, But I am caught in this situation and it seems that I got no other solution... here is my code snippet ``` $url = isset($_GET['u']) ? esc_url($_GET['u']) : ''; $image = isset($_GET['i']) ? $_GET['i'] : ''; maybeappend = ...
2013/04/19
[ "https://Stackoverflow.com/questions/16114773", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1090463/" ]
Actually, this is the best method to do what you were asking! Enjoy ``` http://www.softpedia.com/get/System/File-Management/Text-File-Splitter.shtml ``` It's called Text File Splitter 2.0.4
Maybe something like this? ``` Option Explicit Sub LongRowImport() With ActiveSheet.QueryTables.Add(Connection:= _ "TEXT;C:\pathname\long_text_row.txt", _ Destination:=Range("A1")) .Name = "long_text_row" .FieldNames = True .RowNumbers = False ...
41,739,752
``` class Button(): def __init__(self, x , y, height, width, color): self.X = x self.Y = y self. Height = height self.Width = width self.Color = color self.Pressed = False def draw(self, surface): pygame.draw.rect(surface, self.Color, (self.X, self.Y, self...
2017/01/19
[ "https://Stackoverflow.com/questions/41739752", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You just need to do an else statement in your co ``` if click[0] == 1: self.Pressed = True else: self.Pressed = False ``` So if not clicked, it will set to False.
You can do ``` self.Pressed = (clik[0] == 1) ``` or ``` self.Pressed = bool(click[0]) ``` but as I remeber `click` has boolean values so you need only ``` self.Pressed = click[0] ``` --- BTW: to make code more readable we use `CamelCase` names only for classes. For variables, functions, methods we use `lower...
262,200
A lot of tools allow us to view HTTPS traffic. Is there any tool out there which will decrypt TLS and allow me to see the network traffic for applications like Gtalk?
2011/04/14
[ "https://serverfault.com/questions/262200", "https://serverfault.com", "https://serverfault.com/users/38876/" ]
The standard way to do this is to use a proxy that will offer its own TLS certificate to your browser in place of the legitimate one (Google in this case). If your browser trusts that cert, then the website should function normally; however, the proxy will be transparently decrypting the traffic from the browser, displ...
you can do this with wireshark (<http://wiki.wireshark.org/SSL>) but it relies on you having access to the browser and server keys.
3,464,245
Is there a way I can order a group of users by first name and if a user didn't enter a first name order that user by last name or if they didn't enter a last name order them by middle name?
2010/08/12
[ "https://Stackoverflow.com/questions/3464245", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You could do something like this: ``` SELECT fields FROM table WHERE condition ORDER BY first_name, last_name, middle_name ASC ```
I'm assuming 'didn't enter' equates to a null field. ``` SELECT fields FROM table WHERE condition ORDER BY COALESCE(first_name, last_name, middle_name) ```
51,421,469
Here is my example - the css is what I tried. ```css .active::before li { background: yellow !important; } ``` ```html <div ng-app="myApp" ng-controller="myCtrl"> <div class="breadcrumb"> <ul class="nav nav-tabs"> <li class="active"><a href="#submitted" data-toggle="tab">Submitted</a></li> <...
2018/07/19
[ "https://Stackoverflow.com/questions/51421469", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7378551/" ]
*Solution is here* ``` Just add this css in your code. .nav-tabs > li:not(.active) a { background: yellow; } ```
Try this instead in your css. ``` li.active>a{ background:yellow; } ```
13,210,510
So as i say , is possible copy each row and put it on the row below or as the same move field rows to the fields below? ( have and index auto increment of course ).The result should be the old row 40 content (fields) in the row 41 and so. ``` REPLACE table SET column1 = previuos(column1), column2= previous(column2), ...
2012/11/03
[ "https://Stackoverflow.com/questions/13210510", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1478483/" ]
Your question is kind of hard to understand, but if you want to duplicate the last inserted row, you could do something like that : ``` INSERT INTO your_table ( SELECT NULL, column_1, column_2, column_etc FROM your_table ORDER BY your_id DESC LIMIT 1 ); ```
Remember that a database table is not a spreadsheet. However this will do what you seem to want: ``` UPDATE mytable SET id = id + 9 WHERE id BETWEEN 21 AND 199; ```
2,178,106
I know this is a basic question so it should be a basic answer. I have always done a user login system using sessions only, I would like to now make it an option for a user to stay logged in when they come back to my site if they choose to by using cookies. I am not sure the best way of doing this but I have a small mo...
2010/02/01
[ "https://Stackoverflow.com/questions/2178106", "https://Stackoverflow.com", "https://Stackoverflow.com/users/143030/" ]
What I have used in the past is setting two cookies, one storing the userid and one containing a checksum that validates the userid. Here is an example: ``` //store website user id setcookie('userid', $userid, time() + 2592000, "/"); //store checksum setcookie('checksum', md5($userid."F%^WD&*^("), time() + 2592000, "/...
You're on the right track; this is how most "remember me" implementations work.
65,118,106
If I have an array such as: ``` let arr = ["So 2545", "Cool 1123", "Mos 1999"] ``` that is a subset of a larger array: ``` let largerArr = ["So 2545", "Fun 1023", "Loss 2009", "Cool 1123", "Mos 1999"] ``` How can I determine the index of each matching element in the larger array so the output would be another ar...
2020/12/03
[ "https://Stackoverflow.com/questions/65118106", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14597993/" ]
You can use [`map()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map) with [`indexOf()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf): ```js const part = ["So 2545", "Cool 1123", "Mos 1999"]; const full = ["So 2545", "Fun 10...
You could use [`.reduceRight()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduceRight) to make a look-up table of indexes, and then you [`.map()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) on your `arr` to map each element to an i...
32,925
There is a rumour which states that chefs increase their likelihood of developing lung cancer if they work for long periods of time in the kitchen with oily steam. Does anybody here have such evidence?
2016/05/16
[ "https://skeptics.stackexchange.com/questions/32925", "https://skeptics.stackexchange.com", "https://skeptics.stackexchange.com/users/3086/" ]
There have been a number of case-control studies on Chinese women. Here are three open-access papers: * Ko et al. (2000). "[Chinese Food Cooking and Lung Cancer in Women Nonsmokers](http://aje.oxfordjournals.org/content/151/2/140.full.pdf)". *Amer. J. Epidemiology* 151(2) pp. 140–147. > > The subjects were 131 nonsm...
I haven't found a study that specifically mentions chefs, but here is a study about Chinese women and lung cancer: **[Fumes from meat cooking and lung cancer risk in Chinese women](http://www.ncbi.nlm.nih.gov/pubmed/11097230)** > > Chinese women are recognized to have a high incidence of lung cancer despite a low sm...
32,925
There is a rumour which states that chefs increase their likelihood of developing lung cancer if they work for long periods of time in the kitchen with oily steam. Does anybody here have such evidence?
2016/05/16
[ "https://skeptics.stackexchange.com/questions/32925", "https://skeptics.stackexchange.com", "https://skeptics.stackexchange.com/users/3086/" ]
There have been a number of case-control studies on Chinese women. Here are three open-access papers: * Ko et al. (2000). "[Chinese Food Cooking and Lung Cancer in Women Nonsmokers](http://aje.oxfordjournals.org/content/151/2/140.full.pdf)". *Amer. J. Epidemiology* 151(2) pp. 140–147. > > The subjects were 131 nonsm...
Two further points Smoke from burning solid fuel is known to cause lung cancer, so many studies in the developing world are looking at smoke exposure from fires (1). There is a little bit of toxicology data (2) for mineral oils suggesting that occupational exposure to pure oils might not be harmful, but it is also we...