qid
int64
1
74.7M
question
stringlengths
0
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
2
48.3k
response_k
stringlengths
2
40.5k
60,118,300
How can I optimize the processing of strings?
2020/02/07
[ "https://Stackoverflow.com/questions/60118300", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3931559/" ]
Your problem is you are making n copies of t and concatenating them. This is a simple approach, but quite expensive - it turns what could be an O(n) solution into an O(n2) one. Instead, just check each char of s: ``` for (int i = 0; i < s.length(); i++) { if (s.charAt(i) != t.charAt(i % t.length())) { ret...
Just a remark: in general working with char[] is much faster than working with String. (but nowhere near as convenient) And make your variables `final` when they are final. (it makes no difference to performance, but aids understanding) Anyway, this might do it: ``` import java.util.Arrays; class Result { ...
60,118,300
How can I optimize the processing of strings?
2020/02/07
[ "https://Stackoverflow.com/questions/60118300", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3931559/" ]
Your problem is you are making n copies of t and concatenating them. This is a simple approach, but quite expensive - it turns what could be an O(n) solution into an O(n2) one. Instead, just check each char of s: ``` for (int i = 0; i < s.length(); i++) { if (s.charAt(i) != t.charAt(i % t.length())) { ret...
* Do not make new strings, but use String.regionMatches. * Use String.length and modulo % == 0. * The smallest substring of t can be done using the same method. Coding: * new String(string) ist **never** needed. * String += is slow. Better use StringBuilder. No code to not spoil your coding.
30,802,667
I have several documents, that have a title: 1. -> "Just some Word 13 from year 2015" 2. -> "Just some Word 13 from year 2011" 3. -> "Just some Word 13 from year 2012" 4. -> "Just some Word 13 from year 2014" 5. -> "Just some Word 13 from year 2013" When searching for 13 i'm expecting number 5 to be the first result ...
2015/06/12
[ "https://Stackoverflow.com/questions/30802667", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3153948/" ]
It doesn't sound quite right to have one test depending on an another test to define and export a variable. Set the global variable inside `onPrepare()` using `global`: ``` onPrepare: function() { global.caseNumber = moment().format('YYYYMMDD-HHmmss-SS'); }, ``` Then, you'll have `caseNumber` as a global variabl...
There's no need to use globals. You can make it more readable by creating your own module and requiring it: ``` //test/lib/homepage.js var moment = require('moment'); module.exports = { caseNumber: moment().format('YYYYMMDD-HHmmss-SS'), getContent: function () { //another example of reuse return element(by.c...
41,202,508
I've tried every option explained step by step [here](https://stackoverflow.com/questions/6760115/importing-a-github-project-into-eclipse) [and here:](https://stackoverflow.com/questions/29245924/import-java-project-from-github-to-eclipse) [and here](https://stackoverflow.com/questions/8070017/how-to-import-a-git-non-e...
2016/12/17
[ "https://Stackoverflow.com/questions/41202508", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2204260/" ]
Yes, I found the similar issue, it seems to me `react-addons-perf` only work on `react`, for `react native` project, you can use `RCTRenderingPerf` which is a built-in tool in `react native` lib. My react native version is `"react-native": "^0.45.1"` `import PerfMonitor from 'react-native/Libraries/Performance/RCTRend...
Did you try enabling the performance monitor in the dev menu by clicking on Show Perf Monitor? [Example](https://imgur.com/a/al87N)
55,594,929
It is only a simple question but shouldn't a label stay inside of it's nested frame when you use sticky ? In my code it only stays in the parent frame. If it is normal do you have a solution ? I have tried looking the documentation but I didn't find anything which could help. ``` from tkinter import * from tkinter im...
2019/04/09
[ "https://Stackoverflow.com/questions/55594929", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10695357/" ]
The `.grid(...)` function returns `None`. Therefore, when you do ``` frame_1 = ttk.Frame(root, relief="sunken", height="400", width="400").grid(row=0, column=0, rowspan=1, columnspan=1) ``` you assign `None` to `frame_1`. And the same goes for `frame_2` and `label_1`. Because `frame_1 == None`, calling `ttk.Frame(f...
add .pack() at the end of each line where you define frame\_1, frame\_2 and label\_1
5,377,732
After reading [an article on REST](http://www.ibm.com/developerworks/java/library/j-grails09168/index.html) ("Restful Grails"), I have gotten the impression that it is not possible to truly conform to a REST style in a service that demands a lot of parameters. Is this so? All the examples I have seen so far seem to imp...
2011/03/21
[ "https://Stackoverflow.com/questions/5377732", "https://Stackoverflow.com", "https://Stackoverflow.com/users/200987/" ]
Feel free to use as many parameters as you need to identify the resource you wish to access. REST doesn't care.
Why would you think it is not possible? Google uses REST for their charts api, and they take alot of params: <http://chart.apis.google.com/chart?cht=bvg&chs=350x300&chd=t:20,35,10&chxr=1,0,40&chds=0,40&chco=FF0000|FFA000|00FF00&chbh=65,0,35&chxt=x,y,x&chxl=0:|High|Medium|Low|2:||Task+Priority||&chxs=2,000000,12&chtt=...
5,377,732
After reading [an article on REST](http://www.ibm.com/developerworks/java/library/j-grails09168/index.html) ("Restful Grails"), I have gotten the impression that it is not possible to truly conform to a REST style in a service that demands a lot of parameters. Is this so? All the examples I have seen so far seem to imp...
2011/03/21
[ "https://Stackoverflow.com/questions/5377732", "https://Stackoverflow.com", "https://Stackoverflow.com/users/200987/" ]
You can see the querystring as a filter on the resource you are GETing. Here, your resource is the stock prices of yahoo. Doing a GET on that resource give you all the available data, or the most recents. The query string filter the prices you want. Content negociation allow you to change the representation, e.g. a png...
Why would you think it is not possible? Google uses REST for their charts api, and they take alot of params: <http://chart.apis.google.com/chart?cht=bvg&chs=350x300&chd=t:20,35,10&chxr=1,0,40&chds=0,40&chco=FF0000|FFA000|00FF00&chbh=65,0,35&chxt=x,y,x&chxl=0:|High|Medium|Low|2:||Task+Priority||&chxs=2,000000,12&chtt=...
5,377,732
After reading [an article on REST](http://www.ibm.com/developerworks/java/library/j-grails09168/index.html) ("Restful Grails"), I have gotten the impression that it is not possible to truly conform to a REST style in a service that demands a lot of parameters. Is this so? All the examples I have seen so far seem to imp...
2011/03/21
[ "https://Stackoverflow.com/questions/5377732", "https://Stackoverflow.com", "https://Stackoverflow.com/users/200987/" ]
You can see the querystring as a filter on the resource you are GETing. Here, your resource is the stock prices of yahoo. Doing a GET on that resource give you all the available data, or the most recents. The query string filter the prices you want. Content negociation allow you to change the representation, e.g. a png...
Feel free to use as many parameters as you need to identify the resource you wish to access. REST doesn't care.
9,687,883
I have a simple spring web application that only has spring mvc and spring roo setup. For some reason on all of my old app instances, when I uploaded this sample application, it always gets a "hanging/exceeded time" error in the logs. Even in the case of basic spring mvc setup. The logs I've seen are below. I am a bit ...
2012/03/13
[ "https://Stackoverflow.com/questions/9687883", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1266930/" ]
If you don't want two view controllers, just create a separate delegate for each scroll view. Make it an `NSObject` which conforms to `UIScrollViewDelegate` and create it at the same time as the scroll view. Seems to combine the results you seek: one view controller, but encapsulated scroll view code.
You could have a base controller class that handles the common functionality. Each different controller can inherit from this and override with their specific functionality as required. Aka [the template pattern](http://en.wikipedia.org/wiki/Template_method_pattern) **Edit** To expand. You say you want only one view...
347,170
Unfortunately the printer being used to print envelopes uses a LPR port which can only be attached to an old machine running Windows 98. The rest of the systems in the network are running Windows 7 and need to have the ability to send print jobs to Windows 98 print server. Are there any alternatives? Unfortunately Lin...
2011/10/16
[ "https://superuser.com/questions/347170", "https://superuser.com", "https://superuser.com/users/79947/" ]
Get a [USB-to-parallel](http://www.google.com/search?q=usb%20to%20parallel%20adapter) adapter, it's around $7. Connect this printer with this adapter to any computer running Windows. HP LaserJet drivers are available for modern Windows versions too. ![USB to Parallel](https://i.stack.imgur.com/W9JOk.jpg) This is what...
D-Link makes a parallel print server that plugs directly into the parallel port on the printer. You plug a network cable into it, and access it as a standard TCP/IP LPR port. We've been using one on our old hp LaserJet 4100 series printer that was used as the mainline printer back when printer built-in networking was a...
2,352,890
If $\dim E = n$ and the normal operator $A\colon E \rightarrow E$ has $n$ distinct eigenvalues, how do I show that $A$ is self adjoint?
2017/07/09
[ "https://math.stackexchange.com/questions/2352890", "https://math.stackexchange.com", "https://math.stackexchange.com/users/462216/" ]
This is asking you to prove that a normal operator with $n$ distinct realeigenvalues over a vector space of dimension $n$ is self-adjoint. $A = EDE^\*$ Therefore $A^\* = (EDE^\*)\* = (E^\*)^\*(D^\*)E^\*= ED^\*E^\*$. $\bar{D} = D^\*$ and as $D$ is real $\bar{D} = D$. So $A^\* = EDE^\* = A$.
Since $A$ has all distinct eigenvalues, if some other operator $S$ commutes with it, then it's a polynomial of it. Choose an basis such that the matrix $M$ of $A$ is diagonal, and define an operator $U\_M$ on the space of matrices where $U\_M(B) = MB - BM$. Letting $E\_{ij}$ be a unit matrix ($1$ in the $(i,j)$ slot ...
25,980,263
Basically im a xlst newbie and have been tasked with working on some changes to a large xls file that handles the transformation of movies metadata for the german market. The xls file looks something like this: ``` <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:str="http://exslt.org/strings" xmlns:xsl...
2014/09/22
[ "https://Stackoverflow.com/questions/25980263", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4051655/" ]
Header: ``` #define LITERAL "Hello, world" extern char const literal[sizeof LITERAL]; ``` One source file: ``` char const literal[] = LITERAL; ``` There's still no guarantee that any particular compiler/linker only make one copy of the string literal (but it does guarantee the requirement that `&literal[0]` is th...
don't u want ``` const char * const LITERAL="foo"; ```
25,980,263
Basically im a xlst newbie and have been tasked with working on some changes to a large xls file that handles the transformation of movies metadata for the german market. The xls file looks something like this: ``` <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:str="http://exslt.org/strings" xmlns:xsl...
2014/09/22
[ "https://Stackoverflow.com/questions/25980263", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4051655/" ]
Since C++17 you can write in the header: ``` inline char const thing[] = "foo"; ``` which meets all the criteria. *Note:* `inline` variables have external linkage unless explicitly declared as `static`. The rule about `const` variables defaulting to internal linkage only applies to non-inline variables.
don't u want ``` const char * const LITERAL="foo"; ```
25,980,263
Basically im a xlst newbie and have been tasked with working on some changes to a large xls file that handles the transformation of movies metadata for the german market. The xls file looks something like this: ``` <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:str="http://exslt.org/strings" xmlns:xsl...
2014/09/22
[ "https://Stackoverflow.com/questions/25980263", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4051655/" ]
Header: ``` #define LITERAL "Hello, world" extern char const literal[sizeof LITERAL]; ``` One source file: ``` char const literal[] = LITERAL; ``` There's still no guarantee that any particular compiler/linker only make one copy of the string literal (but it does guarantee the requirement that `&literal[0]` is th...
Since C++17 you can write in the header: ``` inline char const thing[] = "foo"; ``` which meets all the criteria. *Note:* `inline` variables have external linkage unless explicitly declared as `static`. The rule about `const` variables defaulting to internal linkage only applies to non-inline variables.
63,870,080
I was trying to use the top level in the project and saw that it was necessary to change the module from tscofnig to esnext or system, but for some reason my ts-node's error. And I already put the type: module I tried to use the flag: --experimental-modules but the error still does not know how to solve. package.json:...
2020/09/13
[ "https://Stackoverflow.com/questions/63870080", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13102905/" ]
To run ts-node (or plain node for that matter) you need to use `"module": "commonjs", "target": "ES2017"`, otherwise the `import`/`export` statements are illegally placed in an IIFE. So I would suggest using another file called *node.tsconfig.json* with the following contents: ```json { "extends": "./tsconfig.jso...
I had the same issue and I fixed it by changing the `module` in `tsconfig.json` to `commonjs` and removing the `module` key in `package.json`: ```js // tsconfig.json { "module": "CommonJS", } ```
63,870,080
I was trying to use the top level in the project and saw that it was necessary to change the module from tscofnig to esnext or system, but for some reason my ts-node's error. And I already put the type: module I tried to use the flag: --experimental-modules but the error still does not know how to solve. package.json:...
2020/09/13
[ "https://Stackoverflow.com/questions/63870080", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13102905/" ]
To run ts-node (or plain node for that matter) you need to use `"module": "commonjs", "target": "ES2017"`, otherwise the `import`/`export` statements are illegally placed in an IIFE. So I would suggest using another file called *node.tsconfig.json* with the following contents: ```json { "extends": "./tsconfig.jso...
If you are using `React`, "commonjs" can not be set for TypeScript. **tsconfig.json** ``` { "compilerOptions": { "module": "esnext" } } ``` **package.json** ``` { "type": "module", "scripts": { "tsnode": "node --loader ts-node/esm --no-warnings" }, "dependencies": { ...
63,870,080
I was trying to use the top level in the project and saw that it was necessary to change the module from tscofnig to esnext or system, but for some reason my ts-node's error. And I already put the type: module I tried to use the flag: --experimental-modules but the error still does not know how to solve. package.json:...
2020/09/13
[ "https://Stackoverflow.com/questions/63870080", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13102905/" ]
To run ts-node (or plain node for that matter) you need to use `"module": "commonjs", "target": "ES2017"`, otherwise the `import`/`export` statements are illegally placed in an IIFE. So I would suggest using another file called *node.tsconfig.json* with the following contents: ```json { "extends": "./tsconfig.jso...
After a lot of searching, I found this solution works perfect: <https://github.com/TypeStrong/ts-node/issues/922#issuecomment-673155000> Just add a `"ts-node"` block to your `tsconfig.json` file as below: > > > ``` > { > "ts-node": { > "compilerOptions": { > "module": "commonjs" > } > }, > "com...
63,870,080
I was trying to use the top level in the project and saw that it was necessary to change the module from tscofnig to esnext or system, but for some reason my ts-node's error. And I already put the type: module I tried to use the flag: --experimental-modules but the error still does not know how to solve. package.json:...
2020/09/13
[ "https://Stackoverflow.com/questions/63870080", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13102905/" ]
After a lot of searching, I found this solution works perfect: <https://github.com/TypeStrong/ts-node/issues/922#issuecomment-673155000> Just add a `"ts-node"` block to your `tsconfig.json` file as below: > > > ``` > { > "ts-node": { > "compilerOptions": { > "module": "commonjs" > } > }, > "com...
I had the same issue and I fixed it by changing the `module` in `tsconfig.json` to `commonjs` and removing the `module` key in `package.json`: ```js // tsconfig.json { "module": "CommonJS", } ```
63,870,080
I was trying to use the top level in the project and saw that it was necessary to change the module from tscofnig to esnext or system, but for some reason my ts-node's error. And I already put the type: module I tried to use the flag: --experimental-modules but the error still does not know how to solve. package.json:...
2020/09/13
[ "https://Stackoverflow.com/questions/63870080", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13102905/" ]
After a lot of searching, I found this solution works perfect: <https://github.com/TypeStrong/ts-node/issues/922#issuecomment-673155000> Just add a `"ts-node"` block to your `tsconfig.json` file as below: > > > ``` > { > "ts-node": { > "compilerOptions": { > "module": "commonjs" > } > }, > "com...
If you are using `React`, "commonjs" can not be set for TypeScript. **tsconfig.json** ``` { "compilerOptions": { "module": "esnext" } } ``` **package.json** ``` { "type": "module", "scripts": { "tsnode": "node --loader ts-node/esm --no-warnings" }, "dependencies": { ...
115,602
Context ======= I'm working on very complex enterprise solution. We have this table that shows list of let's call them contracts. Every contract (row) can contain one or more customers (and one or more products). Problem ======= I need to think of these use cases: 1. People want to copy & paste customer IDs. 2. P...
2018/02/06
[ "https://ux.stackexchange.com/questions/115602", "https://ux.stackexchange.com", "https://ux.stackexchange.com/users/108493/" ]
1. You can add a copy link in front of each customer ID on hover. [![enter image description here](https://i.stack.imgur.com/LMt7G.jpg)](https://i.stack.imgur.com/LMt7G.jpg) 2. Add filters on table headers 3. Highlight the selected rows or make customer ID a badge when selected 4. Making customer ID badge would make ...
Why don't you add a context menu (invoked by right mouse click) containing "Copy" and "Copy all" items? To know which customer ID you are about to copy a hover (on mouse over above each ID) helps. The balloon closes on mouse out event. It can be programmatically challenging to add a context menu on a balloon but on...
115,602
Context ======= I'm working on very complex enterprise solution. We have this table that shows list of let's call them contracts. Every contract (row) can contain one or more customers (and one or more products). Problem ======= I need to think of these use cases: 1. People want to copy & paste customer IDs. 2. P...
2018/02/06
[ "https://ux.stackexchange.com/questions/115602", "https://ux.stackexchange.com", "https://ux.stackexchange.com/users/108493/" ]
1. You can add a copy link in front of each customer ID on hover. [![enter image description here](https://i.stack.imgur.com/LMt7G.jpg)](https://i.stack.imgur.com/LMt7G.jpg) 2. Add filters on table headers 3. Highlight the selected rows or make customer ID a badge when selected 4. Making customer ID badge would make ...
Usman Mani already proposed an elegant solution, however for anyone seeing this after... I had similar questions and stumbled upon a very useful article about building tables for reusability. <https://uxdesign.cc/designing-tables-for-reusability-490a3760533> TLDR: It's ok to not show all of the information in a row, ...
115,602
Context ======= I'm working on very complex enterprise solution. We have this table that shows list of let's call them contracts. Every contract (row) can contain one or more customers (and one or more products). Problem ======= I need to think of these use cases: 1. People want to copy & paste customer IDs. 2. P...
2018/02/06
[ "https://ux.stackexchange.com/questions/115602", "https://ux.stackexchange.com", "https://ux.stackexchange.com/users/108493/" ]
1. You can add a copy link in front of each customer ID on hover. [![enter image description here](https://i.stack.imgur.com/LMt7G.jpg)](https://i.stack.imgur.com/LMt7G.jpg) 2. Add filters on table headers 3. Highlight the selected rows or make customer ID a badge when selected 4. Making customer ID badge would make ...
An easier and cleaner way would be to provide an Edit icon for each Contract row and open the whole thing in a modal overlay, provided the form does not run too long.
6,887,091
I am a new user of git and can't figure out how to get around this. I have had some experience with SVN and am going by SVN behavior. Any time I pull files from remote repository, and the file I have modified are also modified remotely, it needs merging. I can understand merge conflicts for complex changes, but I am s...
2011/07/31
[ "https://Stackoverflow.com/questions/6887091", "https://Stackoverflow.com", "https://Stackoverflow.com/users/871199/" ]
A common cause of this is differing line endings. Are you sharing a repo with someone else using a different OS? SVN does some munging of line endings. Git, on the other hand, stores files byte-for-byte exactly as they are by default. That means that when a Windows user saves a file with \r\n line endings and a Linux u...
From the manual: > > <https://book.git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging> > > > git commit -a > > > At this point the two branches have diverged, with different changes > made in each. To merge the changes made in experimental into master, > run > > > git merge experimental > > > ...
694,274
I am really confused with expressions under Lorentz transformation. I will try to showcase my confusion via an easy and very popular example: If we have two inertial systems $S$ and $S'$, and $S'$ is moving relative to S with velocity $v$. A point charge is in the origin of $S'$. Initially at $t=t'=0$ their origins ar...
2022/02/13
[ "https://physics.stackexchange.com/questions/694274", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/275029/" ]
The radius of the first maximum is approximately $$\frac{\lambda l}{d}\sim\frac{0.5\cdot 10^{-6}m\cdot0.3 m}{0.2\cdot 10^{-3}m}\sim 1mm.$$ As "The 'cloud' is about 8cm in radius", you are probably looking for the rings in wrong places. It is possible that even minimums of the "ring" diffraction picture look very bright...
Even though there is already a good answer that has been upvoted (and I will upvote right after this is posted) and accepted, this looked like a fun one to try, given that I have all the necessary components. So here is the setup I put together an hour ago: [![Setup photo 1](https://i.stack.imgur.com/yDuDd.jpg)](https...
6,666
My wife doesn't work anymore and she has a 401(k) of about $80,000 from an old job. I have been kicking around the idea of taking that money out or rolling into an IRA so that I can have better access to this money. Given the interest rates I want to purchase a new home and would like to leverage this money as a down p...
2011/03/04
[ "https://money.stackexchange.com/questions/6666", "https://money.stackexchange.com", "https://money.stackexchange.com/users/-1/" ]
Unless that 401K has very low [expense ratios](http://www.investopedia.com/terms/e/expenseratio.asp) on its funds, you should roll it into an IRA and choose funds with low expense ratios. After rolling it over you should *not* take the 10% penalty and use it to purchase a home. Unless you use that home as an income pr...
It's not your money. What does your wife think of this? You know, the withdrawal is subject to full tax at your marginal rate as well as a 10% penalty. That's quite a price to pay, don't do it.
6,666
My wife doesn't work anymore and she has a 401(k) of about $80,000 from an old job. I have been kicking around the idea of taking that money out or rolling into an IRA so that I can have better access to this money. Given the interest rates I want to purchase a new home and would like to leverage this money as a down p...
2011/03/04
[ "https://money.stackexchange.com/questions/6666", "https://money.stackexchange.com", "https://money.stackexchange.com/users/-1/" ]
Don't borrow from your future to live in the present.
It's not your money. What does your wife think of this? You know, the withdrawal is subject to full tax at your marginal rate as well as a 10% penalty. That's quite a price to pay, don't do it.
13,629,483
I have a list of list, such as ``` T =[[0.10113], [0.56325], [0.02563], [0.09602], [0.06406], [0.04807]] ``` I would like to find the total sum of these numbers. I am new to python programming, when I try a simple `int(T[1])` conversion, I get error ``` TypeError: int() argument must be a string or a number, not ...
2012/11/29
[ "https://Stackoverflow.com/questions/13629483", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1863596/" ]
easy: ``` sum(x[0] for x in T) ``` You're done :) --- Of course, you could use ``` import itertools sum(itertools.chain.from_iterable(T)) ``` too. This would work if your sublists had more than 1 element each.
``` In [31]: T =[[0.10113], [0.56325], [0.02563], [0.09602], [0.06406], [0.04807]] In [32]: sum(t[0] for t in T) Out[32]: 0.8981600000000001 ```
13,629,483
I have a list of list, such as ``` T =[[0.10113], [0.56325], [0.02563], [0.09602], [0.06406], [0.04807]] ``` I would like to find the total sum of these numbers. I am new to python programming, when I try a simple `int(T[1])` conversion, I get error ``` TypeError: int() argument must be a string or a number, not ...
2012/11/29
[ "https://Stackoverflow.com/questions/13629483", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1863596/" ]
easy: ``` sum(x[0] for x in T) ``` You're done :) --- Of course, you could use ``` import itertools sum(itertools.chain.from_iterable(T)) ``` too. This would work if your sublists had more than 1 element each.
``` >>> T =[[0.10113], [0.56325], [0.02563], [0.09602], [0.06406], [0.04807]] >>> sum(x[0] for x in T) 0.8981600000000001 ```
13,629,483
I have a list of list, such as ``` T =[[0.10113], [0.56325], [0.02563], [0.09602], [0.06406], [0.04807]] ``` I would like to find the total sum of these numbers. I am new to python programming, when I try a simple `int(T[1])` conversion, I get error ``` TypeError: int() argument must be a string or a number, not ...
2012/11/29
[ "https://Stackoverflow.com/questions/13629483", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1863596/" ]
easy: ``` sum(x[0] for x in T) ``` You're done :) --- Of course, you could use ``` import itertools sum(itertools.chain.from_iterable(T)) ``` too. This would work if your sublists had more than 1 element each.
You can use numpy sum module ``` import numpy as np result = int(np.sum(T, axis=0)) ``` or a inbuilt map function ``` result = int(sum(map(sum, T))) ```
13,629,483
I have a list of list, such as ``` T =[[0.10113], [0.56325], [0.02563], [0.09602], [0.06406], [0.04807]] ``` I would like to find the total sum of these numbers. I am new to python programming, when I try a simple `int(T[1])` conversion, I get error ``` TypeError: int() argument must be a string or a number, not ...
2012/11/29
[ "https://Stackoverflow.com/questions/13629483", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1863596/" ]
You can use [`map`](http://docs.python.org/2/library/functions.html#map) for this: ``` sum(map(sum, T)) ``` ``` >>> sum(map(sum, T)) 0.89816000000000007 ``` From the documentation for `map`: > > **map**(function, iterable, ...) > > > Apply function to every item of iterable and return a list of the results. >...
``` In [31]: T =[[0.10113], [0.56325], [0.02563], [0.09602], [0.06406], [0.04807]] In [32]: sum(t[0] for t in T) Out[32]: 0.8981600000000001 ```
13,629,483
I have a list of list, such as ``` T =[[0.10113], [0.56325], [0.02563], [0.09602], [0.06406], [0.04807]] ``` I would like to find the total sum of these numbers. I am new to python programming, when I try a simple `int(T[1])` conversion, I get error ``` TypeError: int() argument must be a string or a number, not ...
2012/11/29
[ "https://Stackoverflow.com/questions/13629483", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1863596/" ]
You can use [`map`](http://docs.python.org/2/library/functions.html#map) for this: ``` sum(map(sum, T)) ``` ``` >>> sum(map(sum, T)) 0.89816000000000007 ``` From the documentation for `map`: > > **map**(function, iterable, ...) > > > Apply function to every item of iterable and return a list of the results. >...
``` >>> T =[[0.10113], [0.56325], [0.02563], [0.09602], [0.06406], [0.04807]] >>> sum(x[0] for x in T) 0.8981600000000001 ```
13,629,483
I have a list of list, such as ``` T =[[0.10113], [0.56325], [0.02563], [0.09602], [0.06406], [0.04807]] ``` I would like to find the total sum of these numbers. I am new to python programming, when I try a simple `int(T[1])` conversion, I get error ``` TypeError: int() argument must be a string or a number, not ...
2012/11/29
[ "https://Stackoverflow.com/questions/13629483", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1863596/" ]
You can use [`map`](http://docs.python.org/2/library/functions.html#map) for this: ``` sum(map(sum, T)) ``` ``` >>> sum(map(sum, T)) 0.89816000000000007 ``` From the documentation for `map`: > > **map**(function, iterable, ...) > > > Apply function to every item of iterable and return a list of the results. >...
You can use numpy sum module ``` import numpy as np result = int(np.sum(T, axis=0)) ``` or a inbuilt map function ``` result = int(sum(map(sum, T))) ```
42,569
From random Internet sites, we can see many examples of the grammar structures: > > [verb] + 在了 > > > > > 手机**忘在了**出租车上。 > > 我**站在了**舞台上。 > > 因为人不在,快递员就**放在了**门口。 > > 小男孩被父亲故意**丢在了**超市。 > > 闺蜜和男友**睡在了**一起。 > > (Google the quotes surrounded by quotation marks to see the source(s).) > > > I thin...
2021/01/10
[ "https://chinese.stackexchange.com/questions/42569", "https://chinese.stackexchange.com", "https://chinese.stackexchange.com/users/8099/" ]
在了 is very common, even colloquially, but it'd be better to see it as separate 在 and 了. The usage of 了 and its position in a sentence is complex. In the example sentence > > 手机忘在了出租车上, > > > 1. 忘 here can be understood as a [labile verb](https://en.wikipedia.org/wiki/Labile_verb) (perhaps?), meaning "be forgotte...
在... is prep phrase working as a compliment. E.g. 放[在门口]了. 了 is for completion. 放在了门口 is a variant of 放在门口了. I think it might be because we say 放在 so often that we take it as a verb as a whole. So both 放在哪里了 and 放在了哪里 are correct. So, 手机忘在了出租车上 = 手机忘在出租车上了. 小男孩被父亲故意丢在了超市 =小男孩被父亲故意丢在超市了. etc.
18,667,032
I found this answer here regarding graphic design: <https://graphicdesign.stackexchange.com/questions/265/font-face-loaded-on-windows-look-really-bad-which-fonts-are-you-using-that-rend> This is exactly what my fonts are doing, but I'm trying to find out if there's a way to prevent this using html or css or anything we...
2013/09/06
[ "https://Stackoverflow.com/questions/18667032", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2666084/" ]
An answer from [this similar question](https://stackoverflow.com/questions/11225654/xcode-how-to-connect-xib-to-viewcontroller-class/18003928#18003928): "Here's a more step-by-step way to associate your new UIViewController and .xib. Select File's Owner under Placeholders on the left pane of IB. In the Property Inspe...
If it's a UITableViewController, simply create a new XIB file via Xcode (File -> New -> iOS -> UserInterface -> View) and then add set the file's owner to your subclassed UITableViewController. You'll likely want to re-do how the user interface looks -- in terms of dropping objects like the table view and buttons or w...
21,211,502
I understand how mostly everything works in a loop in Java but I came to a realization that I am failing to understand one thing which is The Order a Loop Operates. Basically I am failing to understand this because of this simple but boggling piece of code that was displayed in my class, the code is displayed below. ...
2014/01/19
[ "https://Stackoverflow.com/questions/21211502", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2966385/" ]
Let's step through your code: 1. We setup an `int` with initial value of `0` and assign it to `sum`. 2. We setup a `for` loop, setting `int k = 1`, and we will loop while `k` is less than 10, and after each iteration, 2 will be added to `k`. So, the first iteration, `k = 1`. `sum` currently equals 0, so `sum += k` is...
Let's break up your code. The keyword for just means loop. It will start @ 1 and continue as long as k is less than 10. It will also increase by `k+=2`. To translate, it means `k = k +2` Inside the loop `sum = sum + k`. It will then print the value that sum has plus a space. ``` k = 1, sum = 1 k = 3, sum = 4 k = 5, s...
21,211,502
I understand how mostly everything works in a loop in Java but I came to a realization that I am failing to understand one thing which is The Order a Loop Operates. Basically I am failing to understand this because of this simple but boggling piece of code that was displayed in my class, the code is displayed below. ...
2014/01/19
[ "https://Stackoverflow.com/questions/21211502", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2966385/" ]
The sections of the for loop are run at different times. 1. The first section is run once at the start to initialize the variables. 2. The second is run each time around the loop at the START of the loop to say whether to exit or not. 3. The final section is run each time around the loop at the END of the loop. All s...
It goes like this: 1. Initialize (k = 1) 2. Check condition (k < 10) (stop if false) 3. Run the code in the loop (sum += k and print) 4. Increment (k += 2) 5. Repeat from step 2 Following this logic, you get that 1 is printed first.
21,211,502
I understand how mostly everything works in a loop in Java but I came to a realization that I am failing to understand one thing which is The Order a Loop Operates. Basically I am failing to understand this because of this simple but boggling piece of code that was displayed in my class, the code is displayed below. ...
2014/01/19
[ "https://Stackoverflow.com/questions/21211502", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2966385/" ]
It goes like this: 1. Initialize (k = 1) 2. Check condition (k < 10) (stop if false) 3. Run the code in the loop (sum += k and print) 4. Increment (k += 2) 5. Repeat from step 2 Following this logic, you get that 1 is printed first.
Let's break up your code. The keyword for just means loop. It will start @ 1 and continue as long as k is less than 10. It will also increase by `k+=2`. To translate, it means `k = k +2` Inside the loop `sum = sum + k`. It will then print the value that sum has plus a space. ``` k = 1, sum = 1 k = 3, sum = 4 k = 5, s...
21,211,502
I understand how mostly everything works in a loop in Java but I came to a realization that I am failing to understand one thing which is The Order a Loop Operates. Basically I am failing to understand this because of this simple but boggling piece of code that was displayed in my class, the code is displayed below. ...
2014/01/19
[ "https://Stackoverflow.com/questions/21211502", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2966385/" ]
Let's step through your code: 1. We setup an `int` with initial value of `0` and assign it to `sum`. 2. We setup a `for` loop, setting `int k = 1`, and we will loop while `k` is less than 10, and after each iteration, 2 will be added to `k`. So, the first iteration, `k = 1`. `sum` currently equals 0, so `sum += k` is...
Oh believe I had same problem. And you have to understand this quickly because when you are going to start doing bubble sort it will confuse you even more. The thing you need to understand is that, its that it doesnt actually add +2 to 'k' until its done reading whats inside your 'for loop' So this is how it starts, ...
21,211,502
I understand how mostly everything works in a loop in Java but I came to a realization that I am failing to understand one thing which is The Order a Loop Operates. Basically I am failing to understand this because of this simple but boggling piece of code that was displayed in my class, the code is displayed below. ...
2014/01/19
[ "https://Stackoverflow.com/questions/21211502", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2966385/" ]
The last condition, `k += 2` occurs *after* the first iteration of the loop. So it's ```none k = 1, sum = 1 k = 3, sum = 4 k = 5, sum = 9 k = 7, sum = 16 k = 9, sum = 25 ```
Oh believe I had same problem. And you have to understand this quickly because when you are going to start doing bubble sort it will confuse you even more. The thing you need to understand is that, its that it doesnt actually add +2 to 'k' until its done reading whats inside your 'for loop' So this is how it starts, ...
21,211,502
I understand how mostly everything works in a loop in Java but I came to a realization that I am failing to understand one thing which is The Order a Loop Operates. Basically I am failing to understand this because of this simple but boggling piece of code that was displayed in my class, the code is displayed below. ...
2014/01/19
[ "https://Stackoverflow.com/questions/21211502", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2966385/" ]
In the first iteration of the loop, `k=1`. The `k+=2` is only run at the beginning of the next iteration of the loop. The loop variable update condition (the last part of the for loop - i.e. the `k+=2` part) never runs on the first iteration but does run on every other one, at the start. Therefore what you have is: It...
Let's break up your code. The keyword for just means loop. It will start @ 1 and continue as long as k is less than 10. It will also increase by `k+=2`. To translate, it means `k = k +2` Inside the loop `sum = sum + k`. It will then print the value that sum has plus a space. ``` k = 1, sum = 1 k = 3, sum = 4 k = 5, s...
21,211,502
I understand how mostly everything works in a loop in Java but I came to a realization that I am failing to understand one thing which is The Order a Loop Operates. Basically I am failing to understand this because of this simple but boggling piece of code that was displayed in my class, the code is displayed below. ...
2014/01/19
[ "https://Stackoverflow.com/questions/21211502", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2966385/" ]
The sections of the for loop are run at different times. 1. The first section is run once at the start to initialize the variables. 2. The second is run each time around the loop at the START of the loop to say whether to exit or not. 3. The final section is run each time around the loop at the END of the loop. All s...
Oh believe I had same problem. And you have to understand this quickly because when you are going to start doing bubble sort it will confuse you even more. The thing you need to understand is that, its that it doesnt actually add +2 to 'k' until its done reading whats inside your 'for loop' So this is how it starts, ...
21,211,502
I understand how mostly everything works in a loop in Java but I came to a realization that I am failing to understand one thing which is The Order a Loop Operates. Basically I am failing to understand this because of this simple but boggling piece of code that was displayed in my class, the code is displayed below. ...
2014/01/19
[ "https://Stackoverflow.com/questions/21211502", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2966385/" ]
The last condition, `k += 2` occurs *after* the first iteration of the loop. So it's ```none k = 1, sum = 1 k = 3, sum = 4 k = 5, sum = 9 k = 7, sum = 16 k = 9, sum = 25 ```
Let's break up your code. The keyword for just means loop. It will start @ 1 and continue as long as k is less than 10. It will also increase by `k+=2`. To translate, it means `k = k +2` Inside the loop `sum = sum + k`. It will then print the value that sum has plus a space. ``` k = 1, sum = 1 k = 3, sum = 4 k = 5, s...
21,211,502
I understand how mostly everything works in a loop in Java but I came to a realization that I am failing to understand one thing which is The Order a Loop Operates. Basically I am failing to understand this because of this simple but boggling piece of code that was displayed in my class, the code is displayed below. ...
2014/01/19
[ "https://Stackoverflow.com/questions/21211502", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2966385/" ]
The sections of the for loop are run at different times. 1. The first section is run once at the start to initialize the variables. 2. The second is run each time around the loop at the START of the loop to say whether to exit or not. 3. The final section is run each time around the loop at the END of the loop. All s...
Let's break up your code. The keyword for just means loop. It will start @ 1 and continue as long as k is less than 10. It will also increase by `k+=2`. To translate, it means `k = k +2` Inside the loop `sum = sum + k`. It will then print the value that sum has plus a space. ``` k = 1, sum = 1 k = 3, sum = 4 k = 5, s...
21,211,502
I understand how mostly everything works in a loop in Java but I came to a realization that I am failing to understand one thing which is The Order a Loop Operates. Basically I am failing to understand this because of this simple but boggling piece of code that was displayed in my class, the code is displayed below. ...
2014/01/19
[ "https://Stackoverflow.com/questions/21211502", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2966385/" ]
k is only incremented after the loop iteration. In general for any loop the values are updated after a loop iteration so k goes 1,3,5,7,9 and so the sum is correct.
Let's break up your code. The keyword for just means loop. It will start @ 1 and continue as long as k is less than 10. It will also increase by `k+=2`. To translate, it means `k = k +2` Inside the loop `sum = sum + k`. It will then print the value that sum has plus a space. ``` k = 1, sum = 1 k = 3, sum = 4 k = 5, s...
26,337,469
So that is the question: how to revert to specific commit in history while saving current work to another branch? I've tried checking out to another branch and then `git reset --hard commit_hash` but the other branch was reverted too and i don't want this.
2014/10/13
[ "https://Stackoverflow.com/questions/26337469", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1491475/" ]
That seems to happen because you are using `mysqldump` 5.5 or prior with a MySQL 5.6 database. The `SET OPTION` syntax was removed (see discussion in [this bug report](http://bugs.mysql.com/bug.php?id=66765)), causing this tool to stop working. You will need to update your version of `mysqldump`. More info about it in...
You might need a space between `-p` and `DB_USER_PASSWORD`. ``` dumpcmd = "mysqldump -u " + DB_USER + " -p " + DB_USER_PASSWORD + " " + db + " > " + TODAYBACKUPPATH + "/" + db + ".sql" ```
26,337,469
So that is the question: how to revert to specific commit in history while saving current work to another branch? I've tried checking out to another branch and then `git reset --hard commit_hash` but the other branch was reverted too and i don't want this.
2014/10/13
[ "https://Stackoverflow.com/questions/26337469", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1491475/" ]
That seems to happen because you are using `mysqldump` 5.5 or prior with a MySQL 5.6 database. The `SET OPTION` syntax was removed (see discussion in [this bug report](http://bugs.mysql.com/bug.php?id=66765)), causing this tool to stop working. You will need to update your version of `mysqldump`. More info about it in...
Thanks to the answer from javidcf, I found the answer to my question. The solution is to use a command-line mysqldump version that supports MySQL 5.6.
52,773,492
I have the following data set: ``` column1 HL111 PG3939HL11 HL339PG RC--HL--PG ``` I am attempting to write a function that does the following: 1. Loop through each row of column1 2. Pull only the alphabet and put into an array 3. If the array has "HL" in it, remove it from the array UNLESS HL is the only word in ...
2018/10/12
[ "https://Stackoverflow.com/questions/52773492", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6365890/" ]
You may achieve what you need by replacing all non-letters first, then extracting pairs of letters and then applying some custom logic to extract the necessary value from the array: ``` >>> df['array_column'].str.replace('[^A-Z]+', '').str.findall('([A-Z]{2})').apply(lambda d: [''] if len(d) == 0 else d).apply(lambda ...
This is one approach using `apply` **Demo:** ``` import re import pandas as pd def checkValue(value): value = re.findall(r"[A-Z]{2}", value) if (len(value) > 1) and ("HL" in value): return [i for i in value if i != "HL"][0] else: return value[0] df = pd.DataFrame({"column1": ["HL111"...
52,773,492
I have the following data set: ``` column1 HL111 PG3939HL11 HL339PG RC--HL--PG ``` I am attempting to write a function that does the following: 1. Loop through each row of column1 2. Pull only the alphabet and put into an array 3. If the array has "HL" in it, remove it from the array UNLESS HL is the only word in ...
2018/10/12
[ "https://Stackoverflow.com/questions/52773492", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6365890/" ]
You may achieve what you need by replacing all non-letters first, then extracting pairs of letters and then applying some custom logic to extract the necessary value from the array: ``` >>> df['array_column'].str.replace('[^A-Z]+', '').str.findall('([A-Z]{2})').apply(lambda d: [''] if len(d) == 0 else d).apply(lambda ...
You can do something like this (or probably something more elegant), what you had already gets you to a fairly nice structure where you can use groupby to complete your solution ``` def extract_relevant_str(grp): ret_val = None if "HL" in grp[0].tolist() and len(grp) == 1: ret_val = "HL" elif len(g...
40,810,736
I'm trying to get different audio files to play depending on what "region" of my `Processing` sketch is clicked. I'm having issues with the `soundFile` to get even just one file playing when clicking the first region. I have imported the `sound library` but I must have a syntax or directory error. This is the message ...
2016/11/25
[ "https://Stackoverflow.com/questions/40810736", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7186847/" ]
**Here's how I finally managed to resolve this issue in 5 steps, I hope it helps:** 1. Click `"Toggle device toolbar"` to bring the toolbar up ![image of toggle device toolbar icon](https://i.stack.imgur.com/ggVMe.png) 2. Click the 3 dots on the right hand side of the device toolbar ![image of location of 3 dots](htt...
under zoom menu in responsive window > auto adjust zoom must get disabled
40,810,736
I'm trying to get different audio files to play depending on what "region" of my `Processing` sketch is clicked. I'm having issues with the `soundFile` to get even just one file playing when clicking the first region. I have imported the `sound library` but I must have a syntax or directory error. This is the message ...
2016/11/25
[ "https://Stackoverflow.com/questions/40810736", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7186847/" ]
I have had this issue a few times now. I'm unsure what causes it, but i've found that you can fix it by selecting `"Restore to defaults"` in the `Toggle device toolbar` menu. [![Screenshot here](https://i.stack.imgur.com/WSPye.png)](https://i.stack.imgur.com/WSPye.png)
As of now you can go to device toolbar then click **Responsive** here: [![enter image description here](https://i.stack.imgur.com/O7grU.png)](https://i.stack.imgur.com/O7grU.png) Then in the **Responsive** dropdown go to **Edit ...** and add the resolution you want. [![enter image description here](https://i.stack.im...
40,810,736
I'm trying to get different audio files to play depending on what "region" of my `Processing` sketch is clicked. I'm having issues with the `soundFile` to get even just one file playing when clicking the first region. I have imported the `sound library` but I must have a syntax or directory error. This is the message ...
2016/11/25
[ "https://Stackoverflow.com/questions/40810736", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7186847/" ]
To disable scaling and zooming you must add this inside the `<head>` tag: ```html <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" /> ``` The minimal `<meta>` tag (which doesn’t disable user-con...
Chrome is definitely doing something 'heuristically' and I'm pretty sure there are some bugs. When using the 'responsive mode' (so I can drag the width back and forth) below around 320px the whole page starts scaling down. This makes sense as a default since there are basically no devices below that width and most con...
40,810,736
I'm trying to get different audio files to play depending on what "region" of my `Processing` sketch is clicked. I'm having issues with the `soundFile` to get even just one file playing when clicking the first region. I have imported the `sound library` but I must have a syntax or directory error. This is the message ...
2016/11/25
[ "https://Stackoverflow.com/questions/40810736", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7186847/" ]
I asked this question a long time ago, and today I noticed a change in Chrome. I am not sure when this was introduced, since I haven't used the responsive options as much, but on Version 73.0.3683.86 (Official Build) (64-bit) there's now an option called "Auto-adjust zoom", and it was checked (enabled) by default. I un...
under zoom menu in responsive window > auto adjust zoom must get disabled
40,810,736
I'm trying to get different audio files to play depending on what "region" of my `Processing` sketch is clicked. I'm having issues with the `soundFile` to get even just one file playing when clicking the first region. I have imported the `sound library` but I must have a syntax or directory error. This is the message ...
2016/11/25
[ "https://Stackoverflow.com/questions/40810736", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7186847/" ]
I've reported this bug to Chromium. Here's the link: <https://bugs.chromium.org/p/chromium/issues/detail?id=1129880#c2> I've found the reason why this happens as well as a "mitigation": set the height to empty string: ""
under zoom menu in responsive window > auto adjust zoom must get disabled
40,810,736
I'm trying to get different audio files to play depending on what "region" of my `Processing` sketch is clicked. I'm having issues with the `soundFile` to get even just one file playing when clicking the first region. I have imported the `sound library` but I must have a syntax or directory error. This is the message ...
2016/11/25
[ "https://Stackoverflow.com/questions/40810736", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7186847/" ]
As of now you can go to device toolbar then click **Responsive** here: [![enter image description here](https://i.stack.imgur.com/O7grU.png)](https://i.stack.imgur.com/O7grU.png) Then in the **Responsive** dropdown go to **Edit ...** and add the resolution you want. [![enter image description here](https://i.stack.im...
1. Click F12 2. In the right, top corner, near to chrome cross sign click on "Customize and control DevTools" kebab menu. 3. Click settings 4. Click Preferences 5. At the bottom, Click Restore defaults and reload 6. Make sure that you extensions will be removed.
40,810,736
I'm trying to get different audio files to play depending on what "region" of my `Processing` sketch is clicked. I'm having issues with the `soundFile` to get even just one file playing when clicking the first region. I have imported the `sound library` but I must have a syntax or directory error. This is the message ...
2016/11/25
[ "https://Stackoverflow.com/questions/40810736", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7186847/" ]
**Here's how I finally managed to resolve this issue in 5 steps, I hope it helps:** 1. Click `"Toggle device toolbar"` to bring the toolbar up ![image of toggle device toolbar icon](https://i.stack.imgur.com/ggVMe.png) 2. Click the 3 dots on the right hand side of the device toolbar ![image of location of 3 dots](htt...
Change Dock side to **Undock into separate window** as shown in the picture below: ![enter image description here](https://i.stack.imgur.com/YIIUg.png)
40,810,736
I'm trying to get different audio files to play depending on what "region" of my `Processing` sketch is clicked. I'm having issues with the `soundFile` to get even just one file playing when clicking the first region. I have imported the `sound library` but I must have a syntax or directory error. This is the message ...
2016/11/25
[ "https://Stackoverflow.com/questions/40810736", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7186847/" ]
Chrome is definitely doing something 'heuristically' and I'm pretty sure there are some bugs. When using the 'responsive mode' (so I can drag the width back and forth) below around 320px the whole page starts scaling down. This makes sense as a default since there are basically no devices below that width and most con...
Here is what worked for me: 1. F12 (open developer tools) 2. Ctrl + Shift + M (toggle device toolbar) 3. Click the top right three dot menu 4. Click Add Device Type 5. On the top bar, A "Mobile" or "Desktop" dropdown list should appear 6. Chances are "Mobile" is selected, switch it to "Desktop" The auto-zoom should n...
40,810,736
I'm trying to get different audio files to play depending on what "region" of my `Processing` sketch is clicked. I'm having issues with the `soundFile` to get even just one file playing when clicking the first region. I have imported the `sound library` but I must have a syntax or directory error. This is the message ...
2016/11/25
[ "https://Stackoverflow.com/questions/40810736", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7186847/" ]
I've reported this bug to Chromium. Here's the link: <https://bugs.chromium.org/p/chromium/issues/detail?id=1129880#c2> I've found the reason why this happens as well as a "mitigation": set the height to empty string: ""
As of now you can go to device toolbar then click **Responsive** here: [![enter image description here](https://i.stack.imgur.com/O7grU.png)](https://i.stack.imgur.com/O7grU.png) Then in the **Responsive** dropdown go to **Edit ...** and add the resolution you want. [![enter image description here](https://i.stack.im...
40,810,736
I'm trying to get different audio files to play depending on what "region" of my `Processing` sketch is clicked. I'm having issues with the `soundFile` to get even just one file playing when clicking the first region. I have imported the `sound library` but I must have a syntax or directory error. This is the message ...
2016/11/25
[ "https://Stackoverflow.com/questions/40810736", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7186847/" ]
**Here's how I finally managed to resolve this issue in 5 steps, I hope it helps:** 1. Click `"Toggle device toolbar"` to bring the toolbar up ![image of toggle device toolbar icon](https://i.stack.imgur.com/ggVMe.png) 2. Click the 3 dots on the right hand side of the device toolbar ![image of location of 3 dots](htt...
1. Click F12 2. In the right, top corner, near to chrome cross sign click on "Customize and control DevTools" kebab menu. 3. Click settings 4. Click Preferences 5. At the bottom, Click Restore defaults and reload 6. Make sure that you extensions will be removed.
10,875,055
Do I put it in each model, right before, `multisearchable :against => [ ... ]` or should this be in a separate file? Thanks.
2012/06/04
[ "https://Stackoverflow.com/questions/10875055", "https://Stackoverflow.com", "https://Stackoverflow.com/users/156125/" ]
I had similar questions about how to implement PgSearch.multisearch\_options. This is what worked for me. Hopefully it will help someone else out. I created the Initializer `config/initializers/pg_search.rb` ``` PgSearch.multisearch_options = { :using => { :tsearch => { :dictionary => "english" } }...
Okay found the answer, so I'll post it below. I created a file called `config/initializers/pg_search.rb` which looks like: ``` PgSearch.multisearch_options = { :using => { :tsearch => { :prefix => true }, :trigram => {}, :dmetap...
71,616,876
I am trying to do this that strips "['" or "']" in the string. For Example, if we have ['Customer Name'] it should be "Customer Name" ``` select regexp_replace("['Customers NY']","\\['|\\']","") as customername; ``` > > I am getting this error-- > SQL compilation error: error line 1 at position 22 invalid identifie...
2022/03/25
[ "https://Stackoverflow.com/questions/71616876", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18408875/" ]
I managed to make it using *positions*. I assume this would give a better understanding on how to make these kind of shapes. ```css #cont { background: -webkit-linear-gradient(green -50%, #fff); width: 300px; height: 300px; border-radius: 100%; padding: 10px; position: relative; top: 0; left: 0; } #bo...
You can use `:after` as below. ```css /*#cont{ background: -webkit-linear-gradient(green, #fff); width: 300px; height: 300px; border-radius: 1000px; padding: 10px; }*/ #box{ background: black; width: 300px; height: 300px; border-radius: 1000px; position: relative; } #box:after{ content: ''; ...
19,786,196
First of all, sorry for bad english. Well, I need to change the color property of all parragraphs, using javascript, here's my html&JS code: ``` <body> <p>Parragraph one</p> <p>Parragraph two</p> <button onclick="CE()">change style</button> </body> for (var j=0;j<document.styleSheets[0].cssRules.length;j++) { if(d...
2013/11/05
[ "https://Stackoverflow.com/questions/19786196", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2382353/" ]
Try this ``` $(window).resize(function() { var bodyheight = $(document).height(); var divHeight = (bodyheight-10)/2; $('.grow').css("height", divHeight+"px");; }); ```
Try this ``` var width = (+$(window).width()); var divHeight = (width-10)/2; $(".grow").height(divHeight); ```
19,786,196
First of all, sorry for bad english. Well, I need to change the color property of all parragraphs, using javascript, here's my html&JS code: ``` <body> <p>Parragraph one</p> <p>Parragraph two</p> <button onclick="CE()">change style</button> </body> for (var j=0;j<document.styleSheets[0].cssRules.length;j++) { if(d...
2013/11/05
[ "https://Stackoverflow.com/questions/19786196", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2382353/" ]
here you go [http://jsfiddle.net/6KfHy/1/] ``` var baseWidth = 90; var stepWidth = 4; var baseHeight = 20; var growHeightPerStep = 1; function changeHeight() { var windowW = $(window).width(); var diffWidth = windowW - baseWidth; var diffHeight = parseInt(diffWidth / 4, 10); $('.grow').css('height', ...
Try this ``` var width = (+$(window).width()); var divHeight = (width-10)/2; $(".grow").height(divHeight); ```
19,786,196
First of all, sorry for bad english. Well, I need to change the color property of all parragraphs, using javascript, here's my html&JS code: ``` <body> <p>Parragraph one</p> <p>Parragraph two</p> <button onclick="CE()">change style</button> </body> for (var j=0;j<document.styleSheets[0].cssRules.length;j++) { if(d...
2013/11/05
[ "https://Stackoverflow.com/questions/19786196", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2382353/" ]
Try this ``` $(window).resize(function() { var bodyheight = $(document).height(); var divHeight = (bodyheight-10)/2; $('.grow').css("height", divHeight+"px");; }); ```
``` var $grow = $('.grow'), $window = $(window); $(window) .resize(function () { var windowWidth = $window.width(); if (windowWidth > 90) { $grow.height(~~ (windowWidth / 4)); } }) .resize(); ``` Trigger it the first time on dom ready. <http://jsfiddle.net/techunte...
19,786,196
First of all, sorry for bad english. Well, I need to change the color property of all parragraphs, using javascript, here's my html&JS code: ``` <body> <p>Parragraph one</p> <p>Parragraph two</p> <button onclick="CE()">change style</button> </body> for (var j=0;j<document.styleSheets[0].cssRules.length;j++) { if(d...
2013/11/05
[ "https://Stackoverflow.com/questions/19786196", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2382353/" ]
here you go [http://jsfiddle.net/6KfHy/1/] ``` var baseWidth = 90; var stepWidth = 4; var baseHeight = 20; var growHeightPerStep = 1; function changeHeight() { var windowW = $(window).width(); var diffWidth = windowW - baseWidth; var diffHeight = parseInt(diffWidth / 4, 10); $('.grow').css('height', ...
Try this ``` $(window).resize(function() { var bodyheight = $(document).height(); var divHeight = (bodyheight-10)/2; $('.grow').css("height", divHeight+"px");; }); ```
19,786,196
First of all, sorry for bad english. Well, I need to change the color property of all parragraphs, using javascript, here's my html&JS code: ``` <body> <p>Parragraph one</p> <p>Parragraph two</p> <button onclick="CE()">change style</button> </body> for (var j=0;j<document.styleSheets[0].cssRules.length;j++) { if(d...
2013/11/05
[ "https://Stackoverflow.com/questions/19786196", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2382353/" ]
here you go [http://jsfiddle.net/6KfHy/1/] ``` var baseWidth = 90; var stepWidth = 4; var baseHeight = 20; var growHeightPerStep = 1; function changeHeight() { var windowW = $(window).width(); var diffWidth = windowW - baseWidth; var diffHeight = parseInt(diffWidth / 4, 10); $('.grow').css('height', ...
``` var $grow = $('.grow'), $window = $(window); $(window) .resize(function () { var windowWidth = $window.width(); if (windowWidth > 90) { $grow.height(~~ (windowWidth / 4)); } }) .resize(); ``` Trigger it the first time on dom ready. <http://jsfiddle.net/techunte...
38,291
![enter image description here](https://i.stack.imgur.com/6EXpa.png) Why does the object not go inward, into the circle if the acceleration is inward? I think its because the velocity to outward? So they sort of cancel each other out? But if the speed is kept constant and the acceleration is inward, won't the object e...
2012/09/25
[ "https://physics.stackexchange.com/questions/38291", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/12035/" ]
I suspect Luboš's answer may be a bit complex for you so I'll attempt a simpler explanation (if I'm wrong just ignore this answer). When you say "I think its because the velocity to outward" you're getting close. To show what's going on I've zoomed in on the diagram you posted in your question. ![Acceleration](https:...
No, a uniform circular motion has both constant speed and constant acceleration and it will continue indefinitely, never going inwards. If there were no inward acceleration, the object would move along the straight line in the direction of $\vec v$, and therefore away from the circle. To keep the object on the circle,...
38,291
![enter image description here](https://i.stack.imgur.com/6EXpa.png) Why does the object not go inward, into the circle if the acceleration is inward? I think its because the velocity to outward? So they sort of cancel each other out? But if the speed is kept constant and the acceleration is inward, won't the object e...
2012/09/25
[ "https://physics.stackexchange.com/questions/38291", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/12035/" ]
No, a uniform circular motion has both constant speed and constant acceleration and it will continue indefinitely, never going inwards. If there were no inward acceleration, the object would move along the straight line in the direction of $\vec v$, and therefore away from the circle. To keep the object on the circle,...
> > Why does the object not go inward, into the circle if the acceleration is inward? I think its because the velocity to outward? So they sort of cancel each other out? > > > No, the velocity on the object is not outwards, which you can see if you recall that the velocity of an object is $\vec {v} = \frac d {dt} ...
38,291
![enter image description here](https://i.stack.imgur.com/6EXpa.png) Why does the object not go inward, into the circle if the acceleration is inward? I think its because the velocity to outward? So they sort of cancel each other out? But if the speed is kept constant and the acceleration is inward, won't the object e...
2012/09/25
[ "https://physics.stackexchange.com/questions/38291", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/12035/" ]
I suspect Luboš's answer may be a bit complex for you so I'll attempt a simpler explanation (if I'm wrong just ignore this answer). When you say "I think its because the velocity to outward" you're getting close. To show what's going on I've zoomed in on the diagram you posted in your question. ![Acceleration](https:...
> > Why does the object not go inward, into the circle if the acceleration is inward? I think its because the velocity to outward? So they sort of cancel each other out? > > > No, the velocity on the object is not outwards, which you can see if you recall that the velocity of an object is $\vec {v} = \frac d {dt} ...
10,943
I'm doing a total kitchen renovation with solid hardwood flooring. Do I go hardwood all the way under the cabinets to the wall or stop just past the toe kick and finish the rest with ply of the same thickness?
2011/12/27
[ "https://diy.stackexchange.com/questions/10943", "https://diy.stackexchange.com", "https://diy.stackexchange.com/users/4711/" ]
You can do either, but in my opinion it's better to use plywood as the base because: * it's a lot cheaper than hardwood flooring. * if you need to replace the hardwood flooring at some point in the future, it will be a lot easier to remove just the hardwoods: if you run planks under the cabinets, you'll have to cut th...
I ran mine all the way to the wall. Turned out to be a good thing because I made a cabinet change which pushed everything down six inches.
10,943
I'm doing a total kitchen renovation with solid hardwood flooring. Do I go hardwood all the way under the cabinets to the wall or stop just past the toe kick and finish the rest with ply of the same thickness?
2011/12/27
[ "https://diy.stackexchange.com/questions/10943", "https://diy.stackexchange.com", "https://diy.stackexchange.com/users/4711/" ]
In your situation, using real 3/4" hardwood flooring should be a lifetime floor. I cannot see any reason to remove it as any other type of flooring in the future could be installed right over it. Since it is much more likely to have some type of cabinet upgrade rather than actually needing to remove the hardwood, I wou...
I ran mine all the way to the wall. Turned out to be a good thing because I made a cabinet change which pushed everything down six inches.
29,145,564
I have created two classes, StepsCell and WeightCell ``` import UIKit class StepsCell { let name = "Steps" let count = 2000 } import UIKit class WeightCell { let name = "Weight" let kiloWeight = 90 } ``` In my VC I attempt to create an array, cellArray, to hold the objects. ``` import UIKit cla...
2015/03/19
[ "https://Stackoverflow.com/questions/29145564", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4051036/" ]
The problem is that you create an array with mixed types. Because of this, the compiler doesn't know the type of the object returned by `cellArray[0]`. It infers that this object must be of type `AnyObject`. Apparently this has a property named `name`, which returns nil. The solution is to either cast it `println((cel...
As @Rengers said in his answer you may use the approach, To drill down to your code you can solve it like this, ``` class StepsCell { let name = "Steps" let cellCount = 2000 } class WeightCell { let name = "Weight" let weightCount = 90 } var stepcell = StepsCell() // creating the object var weightcell = WeightCell(...
21,517,685
I'm making an application to scan multiple page pdf files. I have a `PDFView` and a `PDFThumbnailView` that are linked. The first time a scan is completed, I create a new `PDFDocument` and set it to `PDFView`. Then whenever another scan is completed I add a `PDFPage` to `[pdfView document]`. Now the problem is wheneve...
2014/02/02
[ "https://Stackoverflow.com/questions/21517685", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1640293/" ]
You need to manually call: ``` - (void)layoutDocumentView ``` I imagine the reason that this is not called manually is to allow coalescing of multiple changes into one update. This is documented: > > The PDFView actually contains several subviews, such as the document > view (where the PDF is actually drawn) and...
The best solution I got so far to refresh manually the PDFView with annotation was to move the PDFView to another page and come back to the page you need to refresh because: `- (void)layoutDocumentView` didn't work for me in my case. Then: ``` [self.pdfView goToLastPage:nil]; [self.pdfView goToPage:destinationPage];...
46,435,623
Hi the custom policy gets called with the client id of the B2C app <https://login.microsoftonline.com/TENANT/oauth2/v2.0/authorize?p=B2C_1A_POLICY&client_id=THE-CLIENT-ID-I-WANT> How can I access this in the policy, i thought this would be hard coded to the client\_id claim but I dont think it is Its only returned...
2017/09/26
[ "https://Stackoverflow.com/questions/46435623", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1197563/" ]
Ok its a bit of a work around but I tried with a standard UserJourneyContextProvider technical profile and this didnt work so to get the client id as a claim I did the following Create an orchestration step ``` <OrchestrationStep Order="2" Type="ClaimsExchange"> <ClaimsExchanges> <ClaimsExchange Id="...
**You need to add the following into the metadata tag of technical profile:** `<Item Key="IncludeClaimResolvingInClaimsHandling">true</Item>` For more on this. See here: [OAUTH-KV Claims Resolver in AAD B2C does not work](https://stackoverflow.com/questions/53008134/oauth-kv-claims-resolver-in-aad-b2c-does-not-work) ...
71,096,453
I want to convert a certain list of strings into separated lists inside another list, which will contain strings and floats. I've tried to use the `append` method to get the result, but I'm having trouble on making the nested list. Is there a way to get only the last line of my `output` as the result? This is my code: ...
2022/02/12
[ "https://Stackoverflow.com/questions/71096453", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You can combine your two approaches: ``` df %>% split(~test_nr) %>% map_dfr(~ .x %>% add_row(test_id = .$test_id[1], test_nr = .$test_nr[1], region = "mean", test_value = mean(.$test_value))) ```
You could achieve your target with this Base R one-liner: ``` merge( df, aggregate( df, by = list( df$test_nr ), FUN = mean ), all = TRUE )[ , 1:4 ] ``` `aggregate` provides you with the lines you need, and `merge` inserts them into the right places of your dataframe. You don't need the last column of the combined d...
71,096,453
I want to convert a certain list of strings into separated lists inside another list, which will contain strings and floats. I've tried to use the `append` method to get the result, but I'm having trouble on making the nested list. Is there a way to get only the last line of my `output` as the result? This is my code: ...
2022/02/12
[ "https://Stackoverflow.com/questions/71096453", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I actually recently made a little helper function for exactly this. The idea is to use `group_modify()` to take the group data, and `bind_rows()` the summary statistics calculated with `summarise()`. This is what it looks like in code: ```r add_summary_rows <- function(.data, ...) { group_modify(.data, function(x, ...
You can combine your two approaches: ``` df %>% split(~test_nr) %>% map_dfr(~ .x %>% add_row(test_id = .$test_id[1], test_nr = .$test_nr[1], region = "mean", test_value = mean(.$test_value))) ```
71,096,453
I want to convert a certain list of strings into separated lists inside another list, which will contain strings and floats. I've tried to use the `append` method to get the result, but I'm having trouble on making the nested list. Is there a way to get only the last line of my `output` as the result? This is my code: ...
2022/02/12
[ "https://Stackoverflow.com/questions/71096453", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I actually recently made a little helper function for exactly this. The idea is to use `group_modify()` to take the group data, and `bind_rows()` the summary statistics calculated with `summarise()`. This is what it looks like in code: ```r add_summary_rows <- function(.data, ...) { group_modify(.data, function(x, ...
You could achieve your target with this Base R one-liner: ``` merge( df, aggregate( df, by = list( df$test_nr ), FUN = mean ), all = TRUE )[ , 1:4 ] ``` `aggregate` provides you with the lines you need, and `merge` inserts them into the right places of your dataframe. You don't need the last column of the combined d...
59,439,204
I've seen some usage of `self.destroy()` within classes but I couldn't get it working with what I wanted it to do. I have the class `resultsPage` that shows results obtained on another page. I have made the `displayResults(pageNo)` function to show these when `resultsPage` is visible. The problem arises with the back ...
2019/12/21
[ "https://Stackoverflow.com/questions/59439204", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11204185/" ]
The problem comes from the line: ``` tempArray = finalValues[-1] ``` You don't create a copy of the previous list, but only a new name to refer to it. After that, all changes you make to `tempArray` are actually changes to this list, and when you finally do: ``` finalValues.append(tempArray) ``` you just add anot...
Thierry has provided a very comprehensive explanation of why your code doesn't work as you expect. As such it is the best answer to your question.I have added my answer just as an example of you you can code this in a less complex way . create the 2d list with the first index as list of numbers. for each iteration tak...
59,439,204
I've seen some usage of `self.destroy()` within classes but I couldn't get it working with what I wanted it to do. I have the class `resultsPage` that shows results obtained on another page. I have made the `displayResults(pageNo)` function to show these when `resultsPage` is visible. The problem arises with the back ...
2019/12/21
[ "https://Stackoverflow.com/questions/59439204", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11204185/" ]
The problem comes from the line: ``` tempArray = finalValues[-1] ``` You don't create a copy of the previous list, but only a new name to refer to it. After that, all changes you make to `tempArray` are actually changes to this list, and when you finally do: ``` finalValues.append(tempArray) ``` you just add anot...
The problems is in `shallow` assignment of arrays. You should make `deep` copy, to really clone arrays, to make them independent. I did it in your own code. There are a few changes of your code: 1. `import copy` that it have been added to first row. 2. Three usages of `copy.deepcopy` function instead of `=`(simple a...
59,439,204
I've seen some usage of `self.destroy()` within classes but I couldn't get it working with what I wanted it to do. I have the class `resultsPage` that shows results obtained on another page. I have made the `displayResults(pageNo)` function to show these when `resultsPage` is visible. The problem arises with the back ...
2019/12/21
[ "https://Stackoverflow.com/questions/59439204", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11204185/" ]
Thierry has provided a very comprehensive explanation of why your code doesn't work as you expect. As such it is the best answer to your question.I have added my answer just as an example of you you can code this in a less complex way . create the 2d list with the first index as list of numbers. for each iteration tak...
The problems is in `shallow` assignment of arrays. You should make `deep` copy, to really clone arrays, to make them independent. I did it in your own code. There are a few changes of your code: 1. `import copy` that it have been added to first row. 2. Three usages of `copy.deepcopy` function instead of `=`(simple a...
20,572,423
I have a PNG file which is a one-pixel-wide, 283-pixel-tall gradient image, which I need to stretch across the background of an ImageView, stretching only horizontally. I attempted to set the asset as a background to an ImageView like this: ``` <ImageView android:layout_width="fill_parent" android:layo...
2013/12/13
[ "https://Stackoverflow.com/questions/20572423", "https://Stackoverflow.com", "https://Stackoverflow.com/users/239318/" ]
Because you're doing nothing with that function in the parameter. You can do this: ``` function mySecondFunction(func) { alert("Second Function"); func(); } ```
You are passing anonymous function `function () { alert("Third Function"); }` as a parameter to `mySecondFunction()`, but you're not calling this anonymous function anywhere inside `mySecondFunction()`. This would work: ``` function mySecondFunction(callback) { alert("Second Function"); callback(); } ```
3,963,664
**Problem:** Let $g\_t(x)=\frac{1}{\sqrt{2\pi}} e^{ \frac{- (x-t)^2}{2}}$ be the Gaussian function centered at $t\in \mathbb R$. Let $I$ be a subset of $\mathbb R$. Consider the "convolution operator" \begin{align} \mathcal A: L^1(I) & \longrightarrow L^2(I)\\ f & \longmapsto \left(x\longmapsto \int\_{I} g\_t(x)f(t) dt...
2020/12/27
[ "https://math.stackexchange.com/questions/3963664", "https://math.stackexchange.com", "https://math.stackexchange.com/users/818617/" ]
I'm going to unclutter the situation and leave out some constants. If it works in the simplified case, you can throw constants at it later. Suppose $f\in L^1(\mathbb R)$ and $g(t) = e^{-t^2}.$ For $x\in \mathbb R,$ define $$(g\*f)(x) = \int\_{\mathbb R}g(x-t)f(t)\,dt.$$ That is certainly well defined for any $x,$ si...
\begin{align\*} \left|\int\_I \left(\int\_I e^{-(x-t)^2}f(t)dt\right)^2dx\right| &= \left|\int\_I \int\_I \int\_I e^{-(x-t)^2}f(t)e^{-(x-s)^2}f(s)dsdtdx\right| \\ &= \left|\int\_I \int\_I f(t)f(s)\left(\int\_I e^{-(x-t)^2}e^{-(x-s)^2}dx\right)dsdt\right| \\ &\le \int\_I\int\_I |f(t)|\hspace{1mm}|f(s)| \left(\int\_\math...
32,107,344
Can some one explain what is the difference between these two code blocks? Why would we ever need the first type when second one is more concise. First ``` var Utility; (function (Utility) { var Func = (function () { function Func(param1, param2) { var self = this; this.Owner = par...
2015/08/19
[ "https://Stackoverflow.com/questions/32107344", "https://Stackoverflow.com", "https://Stackoverflow.com/users/322933/" ]
The only difference between the code blocks is that the first has a function scope around the code that creates the `Func` function. The only reason to do that would be to create a scope where you can declare variables that would not be available in the outer scope: ``` var Utility; (function (Utility) { var Func ...
from what I see they are the same, in both cases you are defining the function and making it as a member of Utility, the calling it. Add to it, no scope differences, no context differences, no difference really. I think it's a matter of preference nothing more. But, I can see one potential difference, in case the very...
68,454,237
I'm trying to retrieve some data from a dummy function declared in an Oracle DB. The function was created like this in SQL Developer: ```sql create or replace NONEDITIONABLE FUNCTION hello RETURN varchar2 is BEGIN return 'Voici les caractères accentués : àéôï etc...' || chr(10) || 'ça marche ?'; END; ``` My Java ...
2021/07/20
[ "https://Stackoverflow.com/questions/68454237", "https://Stackoverflow.com", "https://Stackoverflow.com/users/894876/" ]
Well, I also raised a defect to spring-data-redis repository on GitHub for the same but the defect got closed by one of the maintainers of this repository without even posting any proper solution. He just gave a reference to an existing issue that was even closed without posting any solution. Here is the link to that i...
You need to have the same package for your entities , I resolved the problem by extracting a lib and putting my entities there You would find an explication here : <https://github.com/spring-projects/spring-data-redis/issues/2114>
30,697
I am trying to implement an algorithm where given an image with several objects on a plane table, desired is the output of segmentation masks for each object. Unlike in CNN's, the objective here is to detect objects in an unfamiliar environment. What are the best approaches to this problem? Also, are there any implemen...
2018/04/23
[ "https://datascience.stackexchange.com/questions/30697", "https://datascience.stackexchange.com", "https://datascience.stackexchange.com/users/50956/" ]
Fast answear ============ [Mean Shift LSH](https://github.com/beckgael/Mean-Shift-LSH) which is an upgrade in **$O(n)$** of the famous Mean Shift algorithm in $O(n^2)$ well know for its image segmentation ability Some explanations ================= If you desire a true **unsupervised** approach to segment images, us...
Actually, your task is supervised. [`Segnet`](https://arxiv.org/abs/1511.00561) can be good architecture for your purpose which one of its implementations can be accessed [here](https://github.com/alexgkendall/caffe-segnet). *SegNet learns to predict pixel-wise class labels from supervised learning. Therefore we requir...
30,697
I am trying to implement an algorithm where given an image with several objects on a plane table, desired is the output of segmentation masks for each object. Unlike in CNN's, the objective here is to detect objects in an unfamiliar environment. What are the best approaches to this problem? Also, are there any implemen...
2018/04/23
[ "https://datascience.stackexchange.com/questions/30697", "https://datascience.stackexchange.com", "https://datascience.stackexchange.com/users/50956/" ]
Actually, your task is supervised. [`Segnet`](https://arxiv.org/abs/1511.00561) can be good architecture for your purpose which one of its implementations can be accessed [here](https://github.com/alexgkendall/caffe-segnet). *SegNet learns to predict pixel-wise class labels from supervised learning. Therefore we requir...
This might be something that you are looking for. Since you ask for image segmentation and not `semantic / instance` segmentation, I presume you don't require the labelling for each segment in the image. The method is called `scene-cut` which segments an image into class-agnostic regions in an unsupervised fashion. Th...
30,697
I am trying to implement an algorithm where given an image with several objects on a plane table, desired is the output of segmentation masks for each object. Unlike in CNN's, the objective here is to detect objects in an unfamiliar environment. What are the best approaches to this problem? Also, are there any implemen...
2018/04/23
[ "https://datascience.stackexchange.com/questions/30697", "https://datascience.stackexchange.com", "https://datascience.stackexchange.com/users/50956/" ]
Fast answear ============ [Mean Shift LSH](https://github.com/beckgael/Mean-Shift-LSH) which is an upgrade in **$O(n)$** of the famous Mean Shift algorithm in $O(n^2)$ well know for its image segmentation ability Some explanations ================= If you desire a true **unsupervised** approach to segment images, us...
The state-of-the-art (SOTA) for image segmentation would be Facebook's [Mask-RCNN](https://arxiv.org/abs/1703.06870). While it is usually trained on dataset such like [COCO](http://cocodataset.org/#home) or [Pascal](http://host.robots.ox.ac.uk/pascal/VOC/) which feature real-life objects, you can re-trained it on a da...
30,697
I am trying to implement an algorithm where given an image with several objects on a plane table, desired is the output of segmentation masks for each object. Unlike in CNN's, the objective here is to detect objects in an unfamiliar environment. What are the best approaches to this problem? Also, are there any implemen...
2018/04/23
[ "https://datascience.stackexchange.com/questions/30697", "https://datascience.stackexchange.com", "https://datascience.stackexchange.com/users/50956/" ]
The state-of-the-art (SOTA) for image segmentation would be Facebook's [Mask-RCNN](https://arxiv.org/abs/1703.06870). While it is usually trained on dataset such like [COCO](http://cocodataset.org/#home) or [Pascal](http://host.robots.ox.ac.uk/pascal/VOC/) which feature real-life objects, you can re-trained it on a da...
This might be something that you are looking for. Since you ask for image segmentation and not `semantic / instance` segmentation, I presume you don't require the labelling for each segment in the image. The method is called `scene-cut` which segments an image into class-agnostic regions in an unsupervised fashion. Th...
30,697
I am trying to implement an algorithm where given an image with several objects on a plane table, desired is the output of segmentation masks for each object. Unlike in CNN's, the objective here is to detect objects in an unfamiliar environment. What are the best approaches to this problem? Also, are there any implemen...
2018/04/23
[ "https://datascience.stackexchange.com/questions/30697", "https://datascience.stackexchange.com", "https://datascience.stackexchange.com/users/50956/" ]
Fast answear ============ [Mean Shift LSH](https://github.com/beckgael/Mean-Shift-LSH) which is an upgrade in **$O(n)$** of the famous Mean Shift algorithm in $O(n^2)$ well know for its image segmentation ability Some explanations ================= If you desire a true **unsupervised** approach to segment images, us...
You may need to take a look at this work submitted and accepted for CVPR 2018 : **[Learning to Segment Every Thing](https://arxiv.org/abs/1711.10370)** In this work, they try to segment everything, even objects not known to the network. Mask R-CNN has been used, combined with a transfer learning sub-network, they get ...
30,697
I am trying to implement an algorithm where given an image with several objects on a plane table, desired is the output of segmentation masks for each object. Unlike in CNN's, the objective here is to detect objects in an unfamiliar environment. What are the best approaches to this problem? Also, are there any implemen...
2018/04/23
[ "https://datascience.stackexchange.com/questions/30697", "https://datascience.stackexchange.com", "https://datascience.stackexchange.com/users/50956/" ]
You may need to take a look at this work submitted and accepted for CVPR 2018 : **[Learning to Segment Every Thing](https://arxiv.org/abs/1711.10370)** In this work, they try to segment everything, even objects not known to the network. Mask R-CNN has been used, combined with a transfer learning sub-network, they get ...
This might be something that you are looking for. Since you ask for image segmentation and not `semantic / instance` segmentation, I presume you don't require the labelling for each segment in the image. The method is called `scene-cut` which segments an image into class-agnostic regions in an unsupervised fashion. Th...
30,697
I am trying to implement an algorithm where given an image with several objects on a plane table, desired is the output of segmentation masks for each object. Unlike in CNN's, the objective here is to detect objects in an unfamiliar environment. What are the best approaches to this problem? Also, are there any implemen...
2018/04/23
[ "https://datascience.stackexchange.com/questions/30697", "https://datascience.stackexchange.com", "https://datascience.stackexchange.com/users/50956/" ]
Fast answear ============ [Mean Shift LSH](https://github.com/beckgael/Mean-Shift-LSH) which is an upgrade in **$O(n)$** of the famous Mean Shift algorithm in $O(n^2)$ well know for its image segmentation ability Some explanations ================= If you desire a true **unsupervised** approach to segment images, us...
This might be something that you are looking for. Since you ask for image segmentation and not `semantic / instance` segmentation, I presume you don't require the labelling for each segment in the image. The method is called `scene-cut` which segments an image into class-agnostic regions in an unsupervised fashion. Th...
7,570,496
I'm trying to get the document object of an iframe, but none of the examples I've googled seem to help. My code looks like this: ``` <html> <head> <script> function myFunc(){ alert("I'm getting this far"); var doc=document.getElementById("frame").document; ...
2011/09/27
[ "https://Stackoverflow.com/questions/7570496", "https://Stackoverflow.com", "https://Stackoverflow.com/users/821562/" ]
Try the following ``` var doc=document.getElementById("frame").contentDocument; // Earlier versions of IE or IE8+ where !DOCTYPE is not specified var doc=document.getElementById("frame").contentWindow.document; ``` Note: AndyE pointed out that `contentWindow` is supported by all major browsers so this may be the b...
This is the code I use: ``` var ifrm = document.getElementById('myFrame'); ifrm = (ifrm.contentWindow) ? ifrm.contentWindow : (ifrm.contentDocument.document) ? ifrm.contentDocument.document : ifrm.contentDocument; ifrm.document.open(); ifrm.document.write('Hello World!'); ifrm.document.close(); ``` > > **contentWin...
7,570,496
I'm trying to get the document object of an iframe, but none of the examples I've googled seem to help. My code looks like this: ``` <html> <head> <script> function myFunc(){ alert("I'm getting this far"); var doc=document.getElementById("frame").document; ...
2011/09/27
[ "https://Stackoverflow.com/questions/7570496", "https://Stackoverflow.com", "https://Stackoverflow.com/users/821562/" ]
Try the following ``` var doc=document.getElementById("frame").contentDocument; // Earlier versions of IE or IE8+ where !DOCTYPE is not specified var doc=document.getElementById("frame").contentWindow.document; ``` Note: AndyE pointed out that `contentWindow` is supported by all major browsers so this may be the b...
For even more robustness: ``` function getIframeWindow(iframe_object) { var doc; if (iframe_object.contentWindow) { return iframe_object.contentWindow; } if (iframe_object.window) { return iframe_object.window; } if (!doc && iframe_object.contentDocument) { doc = iframe_object.contentDocume...
7,570,496
I'm trying to get the document object of an iframe, but none of the examples I've googled seem to help. My code looks like this: ``` <html> <head> <script> function myFunc(){ alert("I'm getting this far"); var doc=document.getElementById("frame").document; ...
2011/09/27
[ "https://Stackoverflow.com/questions/7570496", "https://Stackoverflow.com", "https://Stackoverflow.com/users/821562/" ]
Try the following ``` var doc=document.getElementById("frame").contentDocument; // Earlier versions of IE or IE8+ where !DOCTYPE is not specified var doc=document.getElementById("frame").contentWindow.document; ``` Note: AndyE pointed out that `contentWindow` is supported by all major browsers so this may be the b...
In my case, it was due to Same Origin policies. To explain it further, [MDN](https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/contentDocument) states the following: > > If the iframe and the iframe's parent document are Same Origin, returns a Document (that is, the active document in the inline fram...
7,570,496
I'm trying to get the document object of an iframe, but none of the examples I've googled seem to help. My code looks like this: ``` <html> <head> <script> function myFunc(){ alert("I'm getting this far"); var doc=document.getElementById("frame").document; ...
2011/09/27
[ "https://Stackoverflow.com/questions/7570496", "https://Stackoverflow.com", "https://Stackoverflow.com/users/821562/" ]
This is the code I use: ``` var ifrm = document.getElementById('myFrame'); ifrm = (ifrm.contentWindow) ? ifrm.contentWindow : (ifrm.contentDocument.document) ? ifrm.contentDocument.document : ifrm.contentDocument; ifrm.document.open(); ifrm.document.write('Hello World!'); ifrm.document.close(); ``` > > **contentWin...
In my case, it was due to Same Origin policies. To explain it further, [MDN](https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/contentDocument) states the following: > > If the iframe and the iframe's parent document are Same Origin, returns a Document (that is, the active document in the inline fram...
7,570,496
I'm trying to get the document object of an iframe, but none of the examples I've googled seem to help. My code looks like this: ``` <html> <head> <script> function myFunc(){ alert("I'm getting this far"); var doc=document.getElementById("frame").document; ...
2011/09/27
[ "https://Stackoverflow.com/questions/7570496", "https://Stackoverflow.com", "https://Stackoverflow.com/users/821562/" ]
For even more robustness: ``` function getIframeWindow(iframe_object) { var doc; if (iframe_object.contentWindow) { return iframe_object.contentWindow; } if (iframe_object.window) { return iframe_object.window; } if (!doc && iframe_object.contentDocument) { doc = iframe_object.contentDocume...
In my case, it was due to Same Origin policies. To explain it further, [MDN](https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/contentDocument) states the following: > > If the iframe and the iframe's parent document are Same Origin, returns a Document (that is, the active document in the inline fram...
52,784,794
I'm working through TestDome.com and ran into this question. > > Implement the removeProperty function which takes an object and > property name, and does the following: > > > If the object obj has a property prop, the function removes the > property from the object and returns true; in all other cases it > ret...
2018/10/12
[ "https://Stackoverflow.com/questions/52784794", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3792201/" ]
The difference is the following: ```js obj = { prop: 1 }; // retrieves the property from the object console.log(obj['prop']); // 1 // checks if prop is in obj object console.log('prop' in obj); // true ``` In the case of an if statement, both will evaluate to true. However, if the value retrieved fro...
let's say you have an object ``` const a = {apple: 0} ``` In this case, `a['apple']` would be falsy, where as `"apple" in a` would be truthy. Therefore, if you want to delete some key, just delete the key directly. I believe you do not even need to check for it before deleting it.
13,676,616
I made a implementation of the KMP algorithm's fail table. ``` kmp s = b where a = listArray (0,length s-1) s b = 0:list 0 (tail s) list _ [] = [] list n (x:xs) | x==a!n = (n+1):list (n+1) xs | n > 0 = list (b!!(n-1)) (x:xs) | otherwise = 0...
2012/12/03
[ "https://Stackoverflow.com/questions/13676616", "https://Stackoverflow.com", "https://Stackoverflow.com/users/303863/" ]
Your problem is that the list `b` needs the array `t` to determine its structure (length). But the array `t` needs the length of the list before it exists: ``` listArray :: Ix i => (i,i) -> [e] -> Array i e listArray (l,u) es = runST (ST $ \s1# -> case safeRangeSize (l,u) of { n@(I# n#) -> case newA...
This doesn't directly answer your question, but gives a simpler fix than the proposed version using `STArray`s. The imperative version of the algorithm translates directly into a version that doesn't use repeated list indexing or state, just lazy array construction: ``` import Data.Array.IArray kmp :: String -> Arra...
35,214,094
I tried setting the following: set ftp:initial-prot "" set ftp:ssl-force true set ftp:ssl-protect-data true set ftp:ssl-auth TLS and am on RHEL4 trying to lftp to a 2010 Windows server but I am getting Fatal error: gnutls\_handshake: A TLS packet with unexpected length was received. Can you please let me know what...
2016/02/05
[ "https://Stackoverflow.com/questions/35214094", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4249798/" ]
Let does not create local "variables", it gives names to values, and does not let you change them after giving them the name. So introducing a let is more like defining a local constant. First I'll just add another item into the `loop` expression to store the value so far. Each time through the loop we will update th...
Here's a simple, functional solution that replicates the behavior of the standard `reduce`: ``` (defn reduce ([f [head & tail :as coll]] (if (empty? coll) (f) (reduce f head tail))) ([f init [head & tail :as coll]] (cond (reduced? init) @init (empty? coll) init :else (recur f (f init...
52,023,130
What i'm trying to do is to read big file 5.6GB have approximately 600Million lines and the second is 16MB have 2M lines. I want to check the duplicate lines in these two files. ``` $wordlist = array_unique(array_filter(file('small.txt', FILE_IGNORE_NEW_LINES))); $duplicate = array(); if($file = fopen('big.txt', 'r')...
2018/08/26
[ "https://Stackoverflow.com/questions/52023130", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8966922/" ]
You won't need to call `array_filter()` or `array_unique()` if you are going to call `array_flip()` -- it will eliminate the duplicates for you because you can't have duplicate keys in the same level of an array. Furthermore: 1. `array_unique()` is stated to be slower than `array_flip()` (and there are times when it ...
i think ``` $wordlist=array_flip(array_unique(array_filter(file('small.txt', FILE_IGNORE_NEW_LINES)))); ``` which you actually use in your code,slows it.It may be better to build the wordslist once and foverer yourself: ``` if($file1 = fopen('big.txt', 'r')){ if($file = fopen('small.txt', 'r')){ while(...
71,621,056
I have an app that I need to clean up some resources before it shuts down. I've got it handling the event using: `AppDomain.CurrentDomain.ProcessExit += OnProcessExit;` ``` private static async void OnProcessExit(object? sender, EventArgs e) { Console.WriteLine("We"); Thread.Sleep(1000); Console.WriteLine(...
2022/03/25
[ "https://Stackoverflow.com/questions/71621056", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18571693/" ]
While you might see it as overkill in the beginning, I can recommend wrapping your console app in .NET Generic Host. This enables you to easily handle resource initialisation and cleanup, it also encapsulates logging and DI and nested services if available. The console app becomes easy to startup in an integration test...
Normally you should use [`AppDomain.ProcessExit`](https://learn.microsoft.com/en-us/dotnet/api/system.appdomain.processexit?view=net-6.0) rather than `AppDomain.CurrentDomain.ProcessExit`. Is there a specific reason why you're using the second form? How is your console app closing? Is it a normal exit after finishing ...