qid
int64
1
74.7M
question
stringlengths
15
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
4
30.2k
response_k
stringlengths
11
36.5k
25,164,869
I have a requirement to be able to dynamically add/remove rows to a Tabel in an MVC 5 Application I am working on. I have also included knockout in my project as I use it to post back to preform calculation on my viewModel. What I have done so far is created a List on my User Model to hold the details of the Additiona...
2014/08/06
[ "https://Stackoverflow.com/questions/25164869", "https://Stackoverflow.com", "https://Stackoverflow.com/users/846565/" ]
Your editor template is named incorrectly. There are two ways for MVC to pick it up: **By Name** Name the template with the exact same name as the data type: ``` DateTime.cshtml String.cshtml AdditionalUser.cshtml ``` **Explicitly** In the property of your model, use the `UIHint` attribute: ``` public class MyMo...
In your GET action method, you need to return some item in the `AdditionalUsers` collection. Try this. ``` var yourViewModel=new YourViewModel(); var userList = new List<AdditionalUser>(); userList.Add(new AdditionalUser { FirstName ="A"} ); userList.Add(new AdditionalUser{ FirstName ="B"}); yourViewModel.Additiona...
25,164,869
I have a requirement to be able to dynamically add/remove rows to a Tabel in an MVC 5 Application I am working on. I have also included knockout in my project as I use it to post back to preform calculation on my viewModel. What I have done so far is created a List on my User Model to hold the details of the Additiona...
2014/08/06
[ "https://Stackoverflow.com/questions/25164869", "https://Stackoverflow.com", "https://Stackoverflow.com/users/846565/" ]
Your editor template is named incorrectly. There are two ways for MVC to pick it up: **By Name** Name the template with the exact same name as the data type: ``` DateTime.cshtml String.cshtml AdditionalUser.cshtml ``` **Explicitly** In the property of your model, use the `UIHint` attribute: ``` public class MyMo...
here is the rules 1- the name of the template must be same. in your case it must be AdditionalUser.cshtml 2- MVC first looks if a folder **EditorTemplates** exists in the parent folder of the view (which has controller name) then looks at Shared folder. But in your case `@Html.EditorFor(model => model.AdditionalUsers...
25,164,869
I have a requirement to be able to dynamically add/remove rows to a Tabel in an MVC 5 Application I am working on. I have also included knockout in my project as I use it to post back to preform calculation on my viewModel. What I have done so far is created a List on my User Model to hold the details of the Additiona...
2014/08/06
[ "https://Stackoverflow.com/questions/25164869", "https://Stackoverflow.com", "https://Stackoverflow.com/users/846565/" ]
Your editor template is named incorrectly. There are two ways for MVC to pick it up: **By Name** Name the template with the exact same name as the data type: ``` DateTime.cshtml String.cshtml AdditionalUser.cshtml ``` **Explicitly** In the property of your model, use the `UIHint` attribute: ``` public class MyMo...
You can drop the "\_" character from the name, or there is an overload, that takes a template name as the second argument. ``` @Html.EditorFor(model => model.AdditionalUsers, "_AdditionalUsers") ```
25,164,869
I have a requirement to be able to dynamically add/remove rows to a Tabel in an MVC 5 Application I am working on. I have also included knockout in my project as I use it to post back to preform calculation on my viewModel. What I have done so far is created a List on my User Model to hold the details of the Additiona...
2014/08/06
[ "https://Stackoverflow.com/questions/25164869", "https://Stackoverflow.com", "https://Stackoverflow.com/users/846565/" ]
You can drop the "\_" character from the name, or there is an overload, that takes a template name as the second argument. ``` @Html.EditorFor(model => model.AdditionalUsers, "_AdditionalUsers") ```
In your GET action method, you need to return some item in the `AdditionalUsers` collection. Try this. ``` var yourViewModel=new YourViewModel(); var userList = new List<AdditionalUser>(); userList.Add(new AdditionalUser { FirstName ="A"} ); userList.Add(new AdditionalUser{ FirstName ="B"}); yourViewModel.Additiona...
25,164,869
I have a requirement to be able to dynamically add/remove rows to a Tabel in an MVC 5 Application I am working on. I have also included knockout in my project as I use it to post back to preform calculation on my viewModel. What I have done so far is created a List on my User Model to hold the details of the Additiona...
2014/08/06
[ "https://Stackoverflow.com/questions/25164869", "https://Stackoverflow.com", "https://Stackoverflow.com/users/846565/" ]
You can drop the "\_" character from the name, or there is an overload, that takes a template name as the second argument. ``` @Html.EditorFor(model => model.AdditionalUsers, "_AdditionalUsers") ```
here is the rules 1- the name of the template must be same. in your case it must be AdditionalUser.cshtml 2- MVC first looks if a folder **EditorTemplates** exists in the parent folder of the view (which has controller name) then looks at Shared folder. But in your case `@Html.EditorFor(model => model.AdditionalUsers...
8,514,067
Just for instance, this code is working ``` import urllib image = urllib.URLopener() file_ = 1 name = 1 for i in range(1,1000): try: image.retrieve("http://mangawriter.com/pics/pic"+str(file_)+".jpeg","pic"+str(name)+".jpeg") print "save file %s" %file_ name += 1 file_ += 1 ex...
2011/12/15
[ "https://Stackoverflow.com/questions/8514067", "https://Stackoverflow.com", "https://Stackoverflow.com/users/981877/" ]
I would use the [`multiprocessing`](http://docs.python.org/dev/library/multiprocessing) module, which generates new processes (not threads) for parallelizing tasks. How to do it? First, the actual download code should be put in a function: ``` import urllib import multiprocessing import time def download_images(): ...
Not the best but a usable way: You can spawn a child thread using `threading` module to do this, and, set an time.sleep in your main thread, so when time is out, you can kill the child thread. **EDIT**: just something like this: ``` import threading import urllib def child(file_, name): try: image = url...
8,514,067
Just for instance, this code is working ``` import urllib image = urllib.URLopener() file_ = 1 name = 1 for i in range(1,1000): try: image.retrieve("http://mangawriter.com/pics/pic"+str(file_)+".jpeg","pic"+str(name)+".jpeg") print "save file %s" %file_ name += 1 file_ += 1 ex...
2011/12/15
[ "https://Stackoverflow.com/questions/8514067", "https://Stackoverflow.com", "https://Stackoverflow.com/users/981877/" ]
I would use the [`multiprocessing`](http://docs.python.org/dev/library/multiprocessing) module, which generates new processes (not threads) for parallelizing tasks. How to do it? First, the actual download code should be put in a function: ``` import urllib import multiprocessing import time def download_images(): ...
This one really works for me and it is very simple. Suppose that we want stop after 25 seconds. ``` import timeit #we will need the command default_timer() that checks the actual time start = timeit.default_timer() while timeit.default_timer()-start<=25: "you code here" ```
226,456
The following ``` SELECT ARRAY[a,b,c,d] FROM ( VALUES ('foo', 'bar', 'foo', 'baz' ) ) AS t(a,b,c,d); ``` Returns `{foo,bar,foo,baz}` of type `text[]`. I would like to get `{foo,bar,baz}` of type `text[]` **with one of the duplicate `foo` elements removed**? Does PostgreSQL have a unique function that works on a te...
2019/01/06
[ "https://dba.stackexchange.com/questions/226456", "https://dba.stackexchange.com", "https://dba.stackexchange.com/users/2639/" ]
While there is no function to accomplish that, you can use 1. `unnest()` to convert an array of elements, to a table of rows of one-column, 2. `DISTINCT` to remove duplicates 3. `ARRAY(query)` to recreate the row. That idiom looks like, ``` ARRAY( SELECT DISTINCT ... FROM unnest(arr) ) ``` And in practice is appl...
Perhaps more of a question / comment. This code below preserves the original ordering. How can it be improved / made more efficient. In essence, I believe it will also accomplish the set task. ``` select e from ( select array_agg(e) over (order by wf_rn) as e, row_number() over (order by wf_rn DESC) as wf_rn ...
226,456
The following ``` SELECT ARRAY[a,b,c,d] FROM ( VALUES ('foo', 'bar', 'foo', 'baz' ) ) AS t(a,b,c,d); ``` Returns `{foo,bar,foo,baz}` of type `text[]`. I would like to get `{foo,bar,baz}` of type `text[]` **with one of the duplicate `foo` elements removed**? Does PostgreSQL have a unique function that works on a te...
2019/01/06
[ "https://dba.stackexchange.com/questions/226456", "https://dba.stackexchange.com", "https://dba.stackexchange.com/users/2639/" ]
While there is no function to accomplish that, you can use 1. `unnest()` to convert an array of elements, to a table of rows of one-column, 2. `DISTINCT` to remove duplicates 3. `ARRAY(query)` to recreate the row. That idiom looks like, ``` ARRAY( SELECT DISTINCT ... FROM unnest(arr) ) ``` And in practice is appl...
If the input values are in one column (essentially an array in relational terms), then the unique array can also be obtained using the stock `array_agg()` function with a `DISTINCT` keyword: ```sql SELECT array_agg(DISTINCT v) FROM ( VALUES ('foo'), ('bar'), ('foo'), ('baz') ) AS t(v); ``` Output: ``` array_ag...
226,456
The following ``` SELECT ARRAY[a,b,c,d] FROM ( VALUES ('foo', 'bar', 'foo', 'baz' ) ) AS t(a,b,c,d); ``` Returns `{foo,bar,foo,baz}` of type `text[]`. I would like to get `{foo,bar,baz}` of type `text[]` **with one of the duplicate `foo` elements removed**? Does PostgreSQL have a unique function that works on a te...
2019/01/06
[ "https://dba.stackexchange.com/questions/226456", "https://dba.stackexchange.com", "https://dba.stackexchange.com/users/2639/" ]
While there is no function to accomplish that, you can use 1. `unnest()` to convert an array of elements, to a table of rows of one-column, 2. `DISTINCT` to remove duplicates 3. `ARRAY(query)` to recreate the row. That idiom looks like, ``` ARRAY( SELECT DISTINCT ... FROM unnest(arr) ) ``` And in practice is appl...
A simple function based on @Evan Carroll's answer ```sql create or replace function array_unique (a text[]) returns text[] as $$ select array ( select distinct v from unnest(a) as b(v) ) $$ language sql; ``` with that in place you can ``` select internal.array_unique(array['foo','bar'] || array['foo']) => ...
226,456
The following ``` SELECT ARRAY[a,b,c,d] FROM ( VALUES ('foo', 'bar', 'foo', 'baz' ) ) AS t(a,b,c,d); ``` Returns `{foo,bar,foo,baz}` of type `text[]`. I would like to get `{foo,bar,baz}` of type `text[]` **with one of the duplicate `foo` elements removed**? Does PostgreSQL have a unique function that works on a te...
2019/01/06
[ "https://dba.stackexchange.com/questions/226456", "https://dba.stackexchange.com", "https://dba.stackexchange.com/users/2639/" ]
If the input values are in one column (essentially an array in relational terms), then the unique array can also be obtained using the stock `array_agg()` function with a `DISTINCT` keyword: ```sql SELECT array_agg(DISTINCT v) FROM ( VALUES ('foo'), ('bar'), ('foo'), ('baz') ) AS t(v); ``` Output: ``` array_ag...
Perhaps more of a question / comment. This code below preserves the original ordering. How can it be improved / made more efficient. In essence, I believe it will also accomplish the set task. ``` select e from ( select array_agg(e) over (order by wf_rn) as e, row_number() over (order by wf_rn DESC) as wf_rn ...
226,456
The following ``` SELECT ARRAY[a,b,c,d] FROM ( VALUES ('foo', 'bar', 'foo', 'baz' ) ) AS t(a,b,c,d); ``` Returns `{foo,bar,foo,baz}` of type `text[]`. I would like to get `{foo,bar,baz}` of type `text[]` **with one of the duplicate `foo` elements removed**? Does PostgreSQL have a unique function that works on a te...
2019/01/06
[ "https://dba.stackexchange.com/questions/226456", "https://dba.stackexchange.com", "https://dba.stackexchange.com/users/2639/" ]
A simple function based on @Evan Carroll's answer ```sql create or replace function array_unique (a text[]) returns text[] as $$ select array ( select distinct v from unnest(a) as b(v) ) $$ language sql; ``` with that in place you can ``` select internal.array_unique(array['foo','bar'] || array['foo']) => ...
Perhaps more of a question / comment. This code below preserves the original ordering. How can it be improved / made more efficient. In essence, I believe it will also accomplish the set task. ``` select e from ( select array_agg(e) over (order by wf_rn) as e, row_number() over (order by wf_rn DESC) as wf_rn ...
226,456
The following ``` SELECT ARRAY[a,b,c,d] FROM ( VALUES ('foo', 'bar', 'foo', 'baz' ) ) AS t(a,b,c,d); ``` Returns `{foo,bar,foo,baz}` of type `text[]`. I would like to get `{foo,bar,baz}` of type `text[]` **with one of the duplicate `foo` elements removed**? Does PostgreSQL have a unique function that works on a te...
2019/01/06
[ "https://dba.stackexchange.com/questions/226456", "https://dba.stackexchange.com", "https://dba.stackexchange.com/users/2639/" ]
A simple function based on @Evan Carroll's answer ```sql create or replace function array_unique (a text[]) returns text[] as $$ select array ( select distinct v from unnest(a) as b(v) ) $$ language sql; ``` with that in place you can ``` select internal.array_unique(array['foo','bar'] || array['foo']) => ...
If the input values are in one column (essentially an array in relational terms), then the unique array can also be obtained using the stock `array_agg()` function with a `DISTINCT` keyword: ```sql SELECT array_agg(DISTINCT v) FROM ( VALUES ('foo'), ('bar'), ('foo'), ('baz') ) AS t(v); ``` Output: ``` array_ag...
259,071
Can anyone explain to me the difference between *content type* and *custom content type*?
2018/04/03
[ "https://drupal.stackexchange.com/questions/259071", "https://drupal.stackexchange.com", "https://drupal.stackexchange.com/users/84216/" ]
*Custom content type* can be used with two different meanings: * Any node type ([bundle](https://www.drupal.org/docs/8/api/entity-api/bundles), or entity bundle, in Drupal 8 terminology) created from the user interface (admin/structure/types/add in Drupal 7 and Drupal 8) from users with the right permissions * Any nod...
A content type is a type of node. Node types (aka content types) are generally created through the browser UI. However, they can also be created through code, which people refer generally refer to as a custom content type.
61,972,632
Currently I am trying to have volume persistence for my MYSQL database using Kubernetes with Kubeadm. The environment is based on an amazon EC2 instance using EBS storage disks. As you can see below a storage class, a persistent volume as well as a persistent volume claim have been implemented in order to have a mysql...
2020/05/23
[ "https://Stackoverflow.com/questions/61972632", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13289397/" ]
Check for the state of PV and PVC if the PVC is in bounded state or not. `kubectl describe pvc mysql-pv-claim` `kubectl describe pv mysql-pv` Do you have the [EBS CSI driver](https://docs.aws.amazon.com/eks/latest/userguide/ebs-csi.html) installed? Other reason can be, I think you missed adding the option of **--clou...
Here is some additional information: **kubectl describe pvc mysql-pv-claim** : ``` Name: mysql-pv-claim Namespace: default StorageClass: standard Status: Bound Volume: mysql-pv Labels: <none> Annotations: pv.kubernetes.io/bind-completed: yes pv.kubernetes.io/bound-by-c...
6,524,703
I am wondering if I am using blocks as shown in the code below ``` __block Loader *loader = [[Loader alloc]initWithResourcePath:self.resourcePath]; [loader setCompletionHandler:^(NSArray *anArray){ self.answerArray=anArray; [self reloadData]; }]; [loader getObjects]; ``` My question is with regards to me...
2011/06/29
[ "https://Stackoverflow.com/questions/6524703", "https://Stackoverflow.com", "https://Stackoverflow.com/users/683898/" ]
Several issues: * there is no reason for `loader` to be declared `__block`; you aren't re-assigning in the block and, thus, the `__block` is pointless. * the leak is because you `alloc/init` the loader, but never release it * do not name methods `getSomething`; the `get` prefix is reserved for methods that return stuf...
If you plan to use `loader` outside of the function calling your block, it is highly possible that you need to store it in a ivar of your controller (I guess, it is a controller, but I don't know what kind of class owns the code you shows). Once you do that, you can release it in your `dealloc`. The reasoning is that ...
6,524,703
I am wondering if I am using blocks as shown in the code below ``` __block Loader *loader = [[Loader alloc]initWithResourcePath:self.resourcePath]; [loader setCompletionHandler:^(NSArray *anArray){ self.answerArray=anArray; [self reloadData]; }]; [loader getObjects]; ``` My question is with regards to me...
2011/06/29
[ "https://Stackoverflow.com/questions/6524703", "https://Stackoverflow.com", "https://Stackoverflow.com/users/683898/" ]
Several issues: * there is no reason for `loader` to be declared `__block`; you aren't re-assigning in the block and, thus, the `__block` is pointless. * the leak is because you `alloc/init` the loader, but never release it * do not name methods `getSomething`; the `get` prefix is reserved for methods that return stuf...
I'm going to make some assumptions: 1) The completion handler (block) is used by method getObjects. 2) getObjects is asynchronous (it returns to the caller right away though it continues to process). With these assumptions you can't send release after sending getObjects because getObjects is still using the completion...
41,795
I was reading [Do Stars Vanish Into a Black Hole or Crash Against a Surface? A New Test Answers](https://www.space.com/37075-how-stars-fall-into-black-holes.html) on space.com. It says the following: > > Another proposed alternative to event horizons is the "hard surface > theory," which suggests that matter within ...
2021/03/04
[ "https://astronomy.stackexchange.com/questions/41795", "https://astronomy.stackexchange.com", "https://astronomy.stackexchange.com/users/33956/" ]
The idea of a hard surface on a black hole is very much a minority theory, bordering on a fringe theory. The reason is that general relativity is fairly well tested, and does not just predict event horizons around black holes but also the [Buchdahl bound](https://en.wikipedia.org/wiki/Buchdahl%27s_theorem) on how small...
To answer your questions: citing the same article you refer to: > > But if event horizons do exist, there wouldn't be flash of light. Instead, matter would just completely vanish when pulled in. > > > So, the existence of an event horizon (where even light can not escape the gravitational pull) would avoid seeing...
41,795
I was reading [Do Stars Vanish Into a Black Hole or Crash Against a Surface? A New Test Answers](https://www.space.com/37075-how-stars-fall-into-black-holes.html) on space.com. It says the following: > > Another proposed alternative to event horizons is the "hard surface > theory," which suggests that matter within ...
2021/03/04
[ "https://astronomy.stackexchange.com/questions/41795", "https://astronomy.stackexchange.com", "https://astronomy.stackexchange.com/users/33956/" ]
This seems to be a fringe idea that appears inconsistent with General Relativity. For a spherically symmetric mass distribution it is easy to show, from the Schwarzschild metric, that it is impossible for anything (with or without mass) to avoid moving towards smaller values of $r$ if $r$ is less than the Schwarzschild...
To answer your questions: citing the same article you refer to: > > But if event horizons do exist, there wouldn't be flash of light. Instead, matter would just completely vanish when pulled in. > > > So, the existence of an event horizon (where even light can not escape the gravitational pull) would avoid seeing...
1,457,884
Original equation $$y^4=Cx^5$$ Ok my issue is that i am not sure how I would continue after taking the derivative. $$\frac{y^4}{x^5}=C$$ $$\frac{4y^3x^5\frac{dy}{dx}-5y^4x^4}{x^{10}}dx$$ I am not sure how I would continue to seperate the variable to be able to take the integral to the find the orthogonal trjectory.
2015/09/30
[ "https://math.stackexchange.com/questions/1457884", "https://math.stackexchange.com", "https://math.stackexchange.com/users/272342/" ]
For the family of curves $y(x, C)$ where $$ y^4 = C \, x^5 $$ and $C$ is a constant, we want to find the orthogonal curves $z(x, C)$. $y$ and $z$ should intersect at $x\_0$, thus $$ y(x\_0) = z(x\_0) \quad (\*) $$ and if $y$ has the tangent $$ T(x) = y(x\_0) + y'(x\_0)\, x $$ at the point $x\_0$ then $z$ should have...
You have $\frac{4y^3x^5\frac{dy}{dx}- 5y^4x^4}{x^{10}}dx$. This is wrong. There should be no "dx" at the end and it should be an equation, equal to 0: $\frac{4y^3x^5\frac{dy}{dx}- 5y^4x^4}{x^{10}}= 0$ Multiplying both sides by the $x^{10}$, $4y^3x^5\frac{dy}{dx}- 5y^4x^4= 0$ so $4y^3x^5\frac{dy}{dx}= 5y^4x^4$ and $\fr...
1,457,884
Original equation $$y^4=Cx^5$$ Ok my issue is that i am not sure how I would continue after taking the derivative. $$\frac{y^4}{x^5}=C$$ $$\frac{4y^3x^5\frac{dy}{dx}-5y^4x^4}{x^{10}}dx$$ I am not sure how I would continue to seperate the variable to be able to take the integral to the find the orthogonal trjectory.
2015/09/30
[ "https://math.stackexchange.com/questions/1457884", "https://math.stackexchange.com", "https://math.stackexchange.com/users/272342/" ]
For the family of curves $y(x, C)$ where $$ y^4 = C \, x^5 $$ and $C$ is a constant, we want to find the orthogonal curves $z(x, C)$. $y$ and $z$ should intersect at $x\_0$, thus $$ y(x\_0) = z(x\_0) \quad (\*) $$ and if $y$ has the tangent $$ T(x) = y(x\_0) + y'(x\_0)\, x $$ at the point $x\_0$ then $z$ should have...
Using Quotient Rule to benefit $$ \dfrac{y^4}{x^5} = \dfrac{4 y^3 y^{'}}{5 x^4} \rightarrow \dfrac{y}{x} = \dfrac{4 y^{'}}{5} $$ To obtain orthogonal trajectory differential equation we replace the derivative by its negative reciprocal $$ \dfrac{y}{x} = \dfrac{-4 }{5y^{'}} $$ Re-arrange $$ 5 \,y\, dy + 4\ x \,dx =...
28,164,626
How layout of a data in memory effects on algorithm performance? For example merge sort is know for it computational complexity of O(n log n). But in real world machine that processing algorithm will load/unload blocks of memory into CPU caches / CPU registers and spend auxiliary time on it. Elements of collection to b...
2015/01/27
[ "https://Stackoverflow.com/questions/28164626", "https://Stackoverflow.com", "https://Stackoverflow.com/users/675096/" ]
1. In terms of big O notation - no. The time you read each block from RAM to cpu cache is bounded by some constant, let it be `C`, so even if you need to load each element in every iteration from RAM to cache, you are going to need `O(C*nlogn)` time, but since `C` is constant - it remains `O(nlogn)` time complexity. 2....
Profiling, profiling, profiling. Modern computer architectures have become so complicated that accurate predictions on the running time have become impossible. You should prefer an experimental approach. Also note that running times are no more deterministic and you should resort to statistical methods. Architecture...
28,164,626
How layout of a data in memory effects on algorithm performance? For example merge sort is know for it computational complexity of O(n log n). But in real world machine that processing algorithm will load/unload blocks of memory into CPU caches / CPU registers and spend auxiliary time on it. Elements of collection to b...
2015/01/27
[ "https://Stackoverflow.com/questions/28164626", "https://Stackoverflow.com", "https://Stackoverflow.com/users/675096/" ]
1. In terms of big O notation - no. The time you read each block from RAM to cpu cache is bounded by some constant, let it be `C`, so even if you need to load each element in every iteration from RAM to cache, you are going to need `O(C*nlogn)` time, but since `C` is constant - it remains `O(nlogn)` time complexity. 2....
> > How layout of a data in memory effects on algorithm performance? > > > Layout is very important especially for large amount of data because access to the main memory is still expensive even for modern CPU: <http://mechanical-sympathy.blogspot.ru/2013/02/cpu-cache-flushing-fallacy.html> And your algo may spen...
28,164,626
How layout of a data in memory effects on algorithm performance? For example merge sort is know for it computational complexity of O(n log n). But in real world machine that processing algorithm will load/unload blocks of memory into CPU caches / CPU registers and spend auxiliary time on it. Elements of collection to b...
2015/01/27
[ "https://Stackoverflow.com/questions/28164626", "https://Stackoverflow.com", "https://Stackoverflow.com/users/675096/" ]
Profiling, profiling, profiling. Modern computer architectures have become so complicated that accurate predictions on the running time have become impossible. You should prefer an experimental approach. Also note that running times are no more deterministic and you should resort to statistical methods. Architecture...
> > How layout of a data in memory effects on algorithm performance? > > > Layout is very important especially for large amount of data because access to the main memory is still expensive even for modern CPU: <http://mechanical-sympathy.blogspot.ru/2013/02/cpu-cache-flushing-fallacy.html> And your algo may spen...
2,515,706
I'm trying to solve this problem: You have two urns. The first urn contains a red ball and two white balls. The second urn contains five white balls. We draw one ball from each urn and exchange them. What is the probability that the red ball is in the first urn after $n$ times? I think that I have to use the law of t...
2017/11/11
[ "https://math.stackexchange.com/questions/2515706", "https://math.stackexchange.com", "https://math.stackexchange.com/users/501853/" ]
\begin{align} \lim\_{x\to\infty}\frac{(x^{\sqrt 2}+1)^{\sqrt 2}}{x^2+1} &=\lim\_{x\to\infty}\frac{x^2\left(1+x^{-\sqrt 2}\right)^{\sqrt 2}}{x^2 \left(1+\frac{1}{x^2}\right)}\\ & =\lim\_{x\to\infty}\frac{\left(1+\frac 1{x^{\sqrt 2}}\right)^{\sqrt 2}}{\left(1+\frac{1}{x^2}\right)}\\ &=1 \end{align} Can you see how?
You shouldn't need to apply L'hopital's 4 times; after two applications the denominator will be a constant function and it should be easy to evaluate.
2,515,706
I'm trying to solve this problem: You have two urns. The first urn contains a red ball and two white balls. The second urn contains five white balls. We draw one ball from each urn and exchange them. What is the probability that the red ball is in the first urn after $n$ times? I think that I have to use the law of t...
2017/11/11
[ "https://math.stackexchange.com/questions/2515706", "https://math.stackexchange.com", "https://math.stackexchange.com/users/501853/" ]
\begin{align} \lim\_{x\to\infty}\frac{(x^{\sqrt 2}+1)^{\sqrt 2}}{x^2+1} &=\lim\_{x\to\infty}\frac{x^2\left(1+x^{-\sqrt 2}\right)^{\sqrt 2}}{x^2 \left(1+\frac{1}{x^2}\right)}\\ & =\lim\_{x\to\infty}\frac{\left(1+\frac 1{x^{\sqrt 2}}\right)^{\sqrt 2}}{\left(1+\frac{1}{x^2}\right)}\\ &=1 \end{align} Can you see how?
Set $x=1/t$ and compute instead $$ \lim\_{t\to0^+} \frac{\left(\dfrac{1}{\mathstrut t^{\sqrt{2}}}+1\right)^{\!\sqrt{2}}}{\dfrac{1}{t^2}+1} =\lim\_{t\to0^+}\frac{(1+t^{\sqrt{2}})^{\sqrt{2}}}{1+t^2} $$
73,415,016
Suppose I have the following function that asks for 2 numbers and adds them. ``` def sum(): a = int(input('Enter the first number: ')) b = int(input('Enter the second number: ')) return a + b ``` Also I have two variables: ``` first_number = 2 second_number = 4 ``` Considering that I can't copy paste the va...
2022/08/19
[ "https://Stackoverflow.com/questions/73415016", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17040733/" ]
Solution: ``` from bs4 import BeautifulSoup html = """<h1 onclick="alert('Hello')">Click</h1>""" a = BeautifulSoup(html,'html.parser') for tag in a.find_all(): if 'onclick' in tag.attrs: tag.attrs.pop('onclick') print(a) #<h1>Click</h1> ```
I think you want something as follows: ``` from bs4 import BeautifulSoup html = '<h1 onclick="alert(\'Hello\')">Click</h1>' soup = BeautifulSoup(html) print(soup) # <html><body><h1 onclick="alert('Hello')">Click</h1></body></html> # get h1 h1 = soup.h1 print(h1.attrs) # {'onclick': "alert('Hello')"} # so, we simpl...
25,918,932
I have a line that looks like the following, which I am viewing in vim. ``` 0,0,0,1.791759,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5.278115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, ``` It is from a feature vector file...
2014/09/18
[ "https://Stackoverflow.com/questions/25918932", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2816571/" ]
``` s/,\ze.*5\.27//gn ``` The interesting part is the `\ze` which sets the end of the match. See `:h /\ze` for more information
try this ``` s/,.\{-}5.27//gn ``` it should work.
25,918,932
I have a line that looks like the following, which I am viewing in vim. ``` 0,0,0,1.791759,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5.278115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, ``` It is from a feature vector file...
2014/09/18
[ "https://Stackoverflow.com/questions/25918932", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2816571/" ]
Select the wanted area with visual mode and do ``` :s/\v%V%(,)//gn ``` `\v` enables us to escape less operators with `\` `%V` limits the search to matches that start inside the visual selection `%()` keeps the search together if you include alternations with `|` It's not pretty but it works. See help files for `/...
try this ``` s/,.\{-}5.27//gn ``` it should work.
25,918,932
I have a line that looks like the following, which I am viewing in vim. ``` 0,0,0,1.791759,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5.278115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, ``` It is from a feature vector file...
2014/09/18
[ "https://Stackoverflow.com/questions/25918932", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2816571/" ]
``` s/,\ze.*5\.27//gn ``` The interesting part is the `\ze` which sets the end of the match. See `:h /\ze` for more information
Select the wanted area with visual mode and do ``` :s/\v%V%(,)//gn ``` `\v` enables us to escape less operators with `\` `%V` limits the search to matches that start inside the visual selection `%()` keeps the search together if you include alternations with `|` It's not pretty but it works. See help files for `/...
4,104,838
Are there any guidelines to return an object of a class? I have a class which has a List and a method which do something with the list and returns that list: ``` public class Foo { private List<Bar> _myList = new List<Bar>(); public List<Bar> DoSomething() { // Add items to the list return _myList; } ...
2010/11/05
[ "https://Stackoverflow.com/questions/4104838", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40676/" ]
Return a new [`ReadOnlyCollection`](http://msdn.microsoft.com/en-us/library/ms132474.aspx): ``` public ReadOnlyCollection<Bar> DoSomething() { // Add items to the list return new ReadOnlyCollection<Bar>(_myList); } ``` This is a wrapper for the list and the type is explicitly a read only type. As @Freed notes, ...
how about ``` return new List<Bar>(_myList); ``` would that work? **Sorry - too slow ;)**
4,104,838
Are there any guidelines to return an object of a class? I have a class which has a List and a method which do something with the list and returns that list: ``` public class Foo { private List<Bar> _myList = new List<Bar>(); public List<Bar> DoSomething() { // Add items to the list return _myList; } ...
2010/11/05
[ "https://Stackoverflow.com/questions/4104838", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40676/" ]
If you want to make sure that a collection of elements cannot be modified, use a `ReadOnlyCollection` to communicate this intent. Alternatively, you could instance a new list and return the elements in that new list. Then, your class does not have to care whether that list is modified or not.
You might want to consider `ReadOnlyCollection<T>` - see the answers to [Best practice when returning an array of values (.NET)](https://stackoverflow.com/questions/570083/best-practice-when-returning-an-array-of-values-net)
4,104,838
Are there any guidelines to return an object of a class? I have a class which has a List and a method which do something with the list and returns that list: ``` public class Foo { private List<Bar> _myList = new List<Bar>(); public List<Bar> DoSomething() { // Add items to the list return _myList; } ...
2010/11/05
[ "https://Stackoverflow.com/questions/4104838", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40676/" ]
Return a new [`ReadOnlyCollection`](http://msdn.microsoft.com/en-us/library/ms132474.aspx): ``` public ReadOnlyCollection<Bar> DoSomething() { // Add items to the list return new ReadOnlyCollection<Bar>(_myList); } ``` This is a wrapper for the list and the type is explicitly a read only type. As @Freed notes, ...
You might want to consider `ReadOnlyCollection<T>` - see the answers to [Best practice when returning an array of values (.NET)](https://stackoverflow.com/questions/570083/best-practice-when-returning-an-array-of-values-net)
4,104,838
Are there any guidelines to return an object of a class? I have a class which has a List and a method which do something with the list and returns that list: ``` public class Foo { private List<Bar> _myList = new List<Bar>(); public List<Bar> DoSomething() { // Add items to the list return _myList; } ...
2010/11/05
[ "https://Stackoverflow.com/questions/4104838", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40676/" ]
Return a new [`ReadOnlyCollection`](http://msdn.microsoft.com/en-us/library/ms132474.aspx): ``` public ReadOnlyCollection<Bar> DoSomething() { // Add items to the list return new ReadOnlyCollection<Bar>(_myList); } ``` This is a wrapper for the list and the type is explicitly a read only type. As @Freed notes, ...
If you want to make sure that a collection of elements cannot be modified, use a `ReadOnlyCollection` to communicate this intent. Alternatively, you could instance a new list and return the elements in that new list. Then, your class does not have to care whether that list is modified or not.
4,104,838
Are there any guidelines to return an object of a class? I have a class which has a List and a method which do something with the list and returns that list: ``` public class Foo { private List<Bar> _myList = new List<Bar>(); public List<Bar> DoSomething() { // Add items to the list return _myList; } ...
2010/11/05
[ "https://Stackoverflow.com/questions/4104838", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40676/" ]
If you want to make sure that a collection of elements cannot be modified, use a `ReadOnlyCollection` to communicate this intent. Alternatively, you could instance a new list and return the elements in that new list. Then, your class does not have to care whether that list is modified or not.
how about ``` return new List<Bar>(_myList); ``` would that work? **Sorry - too slow ;)**
4,104,838
Are there any guidelines to return an object of a class? I have a class which has a List and a method which do something with the list and returns that list: ``` public class Foo { private List<Bar> _myList = new List<Bar>(); public List<Bar> DoSomething() { // Add items to the list return _myList; } ...
2010/11/05
[ "https://Stackoverflow.com/questions/4104838", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40676/" ]
If you want to make sure that a collection of elements cannot be modified, use a `ReadOnlyCollection` to communicate this intent. Alternatively, you could instance a new list and return the elements in that new list. Then, your class does not have to care whether that list is modified or not.
You could use the [AsReadOnly](http://msdn.microsoft.com/en-us/library/e78dcd75.aspx) extension
4,104,838
Are there any guidelines to return an object of a class? I have a class which has a List and a method which do something with the list and returns that list: ``` public class Foo { private List<Bar> _myList = new List<Bar>(); public List<Bar> DoSomething() { // Add items to the list return _myList; } ...
2010/11/05
[ "https://Stackoverflow.com/questions/4104838", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40676/" ]
the real problem is not about a copy of your private `_myList`, instead it would be: do you hand out a copy of the items as well? for returning a copy of the list, you have several options * `ReadOnlyCollection<T>` * `IEnumerable<T>` (propably a real conversion, otherwise the attacker could cast back to a `List<T>` o...
You might want to consider `ReadOnlyCollection<T>` - see the answers to [Best practice when returning an array of values (.NET)](https://stackoverflow.com/questions/570083/best-practice-when-returning-an-array-of-values-net)
4,104,838
Are there any guidelines to return an object of a class? I have a class which has a List and a method which do something with the list and returns that list: ``` public class Foo { private List<Bar> _myList = new List<Bar>(); public List<Bar> DoSomething() { // Add items to the list return _myList; } ...
2010/11/05
[ "https://Stackoverflow.com/questions/4104838", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40676/" ]
Return a new [`ReadOnlyCollection`](http://msdn.microsoft.com/en-us/library/ms132474.aspx): ``` public ReadOnlyCollection<Bar> DoSomething() { // Add items to the list return new ReadOnlyCollection<Bar>(_myList); } ``` This is a wrapper for the list and the type is explicitly a read only type. As @Freed notes, ...
the real problem is not about a copy of your private `_myList`, instead it would be: do you hand out a copy of the items as well? for returning a copy of the list, you have several options * `ReadOnlyCollection<T>` * `IEnumerable<T>` (propably a real conversion, otherwise the attacker could cast back to a `List<T>` o...
4,104,838
Are there any guidelines to return an object of a class? I have a class which has a List and a method which do something with the list and returns that list: ``` public class Foo { private List<Bar> _myList = new List<Bar>(); public List<Bar> DoSomething() { // Add items to the list return _myList; } ...
2010/11/05
[ "https://Stackoverflow.com/questions/4104838", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40676/" ]
the real problem is not about a copy of your private `_myList`, instead it would be: do you hand out a copy of the items as well? for returning a copy of the list, you have several options * `ReadOnlyCollection<T>` * `IEnumerable<T>` (propably a real conversion, otherwise the attacker could cast back to a `List<T>` o...
how about ``` return new List<Bar>(_myList); ``` would that work? **Sorry - too slow ;)**
4,104,838
Are there any guidelines to return an object of a class? I have a class which has a List and a method which do something with the list and returns that list: ``` public class Foo { private List<Bar> _myList = new List<Bar>(); public List<Bar> DoSomething() { // Add items to the list return _myList; } ...
2010/11/05
[ "https://Stackoverflow.com/questions/4104838", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40676/" ]
Return a new [`ReadOnlyCollection`](http://msdn.microsoft.com/en-us/library/ms132474.aspx): ``` public ReadOnlyCollection<Bar> DoSomething() { // Add items to the list return new ReadOnlyCollection<Bar>(_myList); } ``` This is a wrapper for the list and the type is explicitly a read only type. As @Freed notes, ...
You could use the [AsReadOnly](http://msdn.microsoft.com/en-us/library/e78dcd75.aspx) extension
62,148,036
I'm trying to deploy a Laravel project to my server with this specs: * OS: CentOS Linux release 7.8.2003 * Nodejs: 13.14.0 * npm: 6.14.5 * 1 CPU * 4GB Ram Everything was fine but a step, as I use ReactJS with Laravel I have to run npm run dev to let webpack build my assets files. (This is just the step to build the v...
2020/06/02
[ "https://Stackoverflow.com/questions/62148036", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5934288/" ]
There is no straight-forward migration path from Silverlight to any technology, despite probably to WPF to a degree, but as you mentioned that you want to run in the browser, probably the best way today is to use [Blazor](https://dotnet.microsoft.com/apps/aspnet/web-apps/blazor), which just got its first official relea...
At Mobilize.Net we have a migration tool that converts the client side XAML and C# to TypeScript using Angular, Kendo UI, HTML, and CSS. It supports C# constructs like generics and interfaces. You can watch a [live stream from Twitch here](https://mobilize.wistia.com/medias/dosg7opq0) This is an approach most suitable...
61,659,128
I got an array like this: ``` rows: [ [ { title: 'Test', value: 1 }, { title: 'Test2', value: 2 }, { title: 'Test3', value: 3 }, ], [ { title: 'Test4', value: 4 }, { title: 'Test5', value: 5 }, ], [ { title: 'Test6', value: 6 }, { title: 'Test7', value: 7 }, ] ] ``` Now I'd li...
2020/05/07
[ "https://Stackoverflow.com/questions/61659128", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7510971/" ]
Probably not modifying existing objects could be a better practice: ``` rows = rows.map(fields => { return fields.map(field => { return {...field, value: ''}; }) }); ```
You can use `delete` to explicitly remove a property and its value. No map needed: ```js var ob = {foo:'bar',fizz:'buzz'}; console.log(ob); // Object { foo: "bar", fizz: "buzz" } delete ob.fizz; console.log(ob); // Object { foo: "bar" } ```
61,659,128
I got an array like this: ``` rows: [ [ { title: 'Test', value: 1 }, { title: 'Test2', value: 2 }, { title: 'Test3', value: 3 }, ], [ { title: 'Test4', value: 4 }, { title: 'Test5', value: 5 }, ], [ { title: 'Test6', value: 6 }, { title: 'Test7', value: 7 }, ] ] ``` Now I'd li...
2020/05/07
[ "https://Stackoverflow.com/questions/61659128", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7510971/" ]
```js function deleteKeyFromObject(inputObject) { for (let[currentObjectKey,currentObjectValue] of Object.entries(inputObject)) { if (currentObjectKey === 'value') { delete inputObject.value; } else if (Array.isArray(currentObjectValue)) { deleteObjectFromArray(currentOb...
You can use `delete` to explicitly remove a property and its value. No map needed: ```js var ob = {foo:'bar',fizz:'buzz'}; console.log(ob); // Object { foo: "bar", fizz: "buzz" } delete ob.fizz; console.log(ob); // Object { foo: "bar" } ```
61,659,128
I got an array like this: ``` rows: [ [ { title: 'Test', value: 1 }, { title: 'Test2', value: 2 }, { title: 'Test3', value: 3 }, ], [ { title: 'Test4', value: 4 }, { title: 'Test5', value: 5 }, ], [ { title: 'Test6', value: 6 }, { title: 'Test7', value: 7 }, ] ] ``` Now I'd li...
2020/05/07
[ "https://Stackoverflow.com/questions/61659128", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7510971/" ]
```js function deleteKeyFromObject(inputObject) { for (let[currentObjectKey,currentObjectValue] of Object.entries(inputObject)) { if (currentObjectKey === 'value') { delete inputObject.value; } else if (Array.isArray(currentObjectValue)) { deleteObjectFromArray(currentOb...
Probably not modifying existing objects could be a better practice: ``` rows = rows.map(fields => { return fields.map(field => { return {...field, value: ''}; }) }); ```
19,468,780
I have 2 tables: `Income` (`InvoiceDate, TotalAmount`) and `Outcome` (`ExpenseDate, TotalAmount`). Suppose that I have data for each column as below: `Income`: ``` | INVOICEDATE | TOTALAMOUNT | |-------------|-------------| | 2013-10-16 | 22000 | | 2013-10-17 | 14400 | | 2013-10-18 | 4488 | `...
2013/10/19
[ "https://Stackoverflow.com/questions/19468780", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1450738/" ]
`this.lexic` is evaluated to `null`. Note that `this.lexis` doesn't point to the constructor's local `lexic` variable, but to the instance's one. *If you want to* add the String to the constructor's `lexic` variable, just get rid of the `this` keyword: ``` lexic.add(word); ```
More than likely you have another variable named `lexic` as a class instance variable. (The above code would not compile if this is not the case) Therefore its likely you're shadowing the `result` variable. Replace ``` Set<String> lexic = new TreeSet<String>(); ``` with ``` lexic = new TreeSet<String>(); ```
19,468,780
I have 2 tables: `Income` (`InvoiceDate, TotalAmount`) and `Outcome` (`ExpenseDate, TotalAmount`). Suppose that I have data for each column as below: `Income`: ``` | INVOICEDATE | TOTALAMOUNT | |-------------|-------------| | 2013-10-16 | 22000 | | 2013-10-17 | 14400 | | 2013-10-18 | 4488 | `...
2013/10/19
[ "https://Stackoverflow.com/questions/19468780", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1450738/" ]
More than likely you have another variable named `lexic` as a class instance variable. (The above code would not compile if this is not the case) Therefore its likely you're shadowing the `result` variable. Replace ``` Set<String> lexic = new TreeSet<String>(); ``` with ``` lexic = new TreeSet<String>(); ```
``` this.lexic.add(word); ``` You are using this in constructor, that means, you are using the object during its creation. That is why you get NPE. remove this, it will work. if you put filling part in a method also, that means ``` Set<String> lexic = new TreeSet<String>(); ``` is also in same method, then also ...
19,468,780
I have 2 tables: `Income` (`InvoiceDate, TotalAmount`) and `Outcome` (`ExpenseDate, TotalAmount`). Suppose that I have data for each column as below: `Income`: ``` | INVOICEDATE | TOTALAMOUNT | |-------------|-------------| | 2013-10-16 | 22000 | | 2013-10-17 | 14400 | | 2013-10-18 | 4488 | `...
2013/10/19
[ "https://Stackoverflow.com/questions/19468780", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1450738/" ]
`this.lexic` is evaluated to `null`. Note that `this.lexis` doesn't point to the constructor's local `lexic` variable, but to the instance's one. *If you want to* add the String to the constructor's `lexic` variable, just get rid of the `this` keyword: ``` lexic.add(word); ```
The only problem I see here is ``` this.lexic.add(word); // this.lexic ``` Remove the `this`. Because the constructor instantiates the class. Even before the object is created, you're tryin to use `this`, which is wrong.
19,468,780
I have 2 tables: `Income` (`InvoiceDate, TotalAmount`) and `Outcome` (`ExpenseDate, TotalAmount`). Suppose that I have data for each column as below: `Income`: ``` | INVOICEDATE | TOTALAMOUNT | |-------------|-------------| | 2013-10-16 | 22000 | | 2013-10-17 | 14400 | | 2013-10-18 | 4488 | `...
2013/10/19
[ "https://Stackoverflow.com/questions/19468780", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1450738/" ]
The only problem I see here is ``` this.lexic.add(word); // this.lexic ``` Remove the `this`. Because the constructor instantiates the class. Even before the object is created, you're tryin to use `this`, which is wrong.
``` this.lexic.add(word); ``` You are using this in constructor, that means, you are using the object during its creation. That is why you get NPE. remove this, it will work. if you put filling part in a method also, that means ``` Set<String> lexic = new TreeSet<String>(); ``` is also in same method, then also ...
19,468,780
I have 2 tables: `Income` (`InvoiceDate, TotalAmount`) and `Outcome` (`ExpenseDate, TotalAmount`). Suppose that I have data for each column as below: `Income`: ``` | INVOICEDATE | TOTALAMOUNT | |-------------|-------------| | 2013-10-16 | 22000 | | 2013-10-17 | 14400 | | 2013-10-18 | 4488 | `...
2013/10/19
[ "https://Stackoverflow.com/questions/19468780", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1450738/" ]
`this.lexic` is evaluated to `null`. Note that `this.lexis` doesn't point to the constructor's local `lexic` variable, but to the instance's one. *If you want to* add the String to the constructor's `lexic` variable, just get rid of the `this` keyword: ``` lexic.add(word); ```
``` this.lexic.add(word); ``` You are using this in constructor, that means, you are using the object during its creation. That is why you get NPE. remove this, it will work. if you put filling part in a method also, that means ``` Set<String> lexic = new TreeSet<String>(); ``` is also in same method, then also ...
5,851
I have a log file which contains a bunch of non visible control characters such as hex \u0003. I would like to replace this using something like SED, but can't get the first part of the regex to match: > > /s/^E/some\_string > > > I am creating the ^E by pressing CTRL-V CTRL-0 CTRL-3 to create the special charac...
2011/01/14
[ "https://unix.stackexchange.com/questions/5851", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/3793/" ]
This perl one-liner will do the job - beware, it will modify the file: ``` perl -i -pe 's#\x{0003}#some_string#g' /path/to/log/file ``` If you want to replace a number of characters with character codes between a specified range: ``` echo {A..Z} | perl -i -pe 's#[\x{0040}-\x{0047}]#P#g' P P P P P P P H I J K L M ...
I'm not sure if I understand what you want, but if it is to substitute for occurrences of the successive hex bytes 0x00 0x03, this should work: ``` $ echo '0 61 20 00 03 0A' | xxd -r | sed 's/\x00\x03/test/g' a test ```
5,851
I have a log file which contains a bunch of non visible control characters such as hex \u0003. I would like to replace this using something like SED, but can't get the first part of the regex to match: > > /s/^E/some\_string > > > I am creating the ^E by pressing CTRL-V CTRL-0 CTRL-3 to create the special charac...
2011/01/14
[ "https://unix.stackexchange.com/questions/5851", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/3793/" ]
You can also use the `tr` command. For example: To delete the control character: ``` tr -d '\033' < file ``` To replace the control character with another: ``` tr '\033' 'x' < file ``` If you are not sure what the value of the control character is, perform an octal dump and it will print it out: ``` $ cat file ...
I'm not sure if I understand what you want, but if it is to substitute for occurrences of the successive hex bytes 0x00 0x03, this should work: ``` $ echo '0 61 20 00 03 0A' | xxd -r | sed 's/\x00\x03/test/g' a test ```
5,851
I have a log file which contains a bunch of non visible control characters such as hex \u0003. I would like to replace this using something like SED, but can't get the first part of the regex to match: > > /s/^E/some\_string > > > I am creating the ^E by pressing CTRL-V CTRL-0 CTRL-3 to create the special charac...
2011/01/14
[ "https://unix.stackexchange.com/questions/5851", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/3793/" ]
This will replace all non-printable characters with a `#` ``` sed 's/[^[:print:]]/#/g' logfile ```
I'm not sure if I understand what you want, but if it is to substitute for occurrences of the successive hex bytes 0x00 0x03, this should work: ``` $ echo '0 61 20 00 03 0A' | xxd -r | sed 's/\x00\x03/test/g' a test ```
14,185,126
Do you know any way / method to **take a photo in iOS** and saving it to camera Roll only with a simple button pressure without showing any preview? I already know how to show the camera view but it show the preview of the image and the user need to click the take photo button to take the photo. **In few Words:** the...
2013/01/06
[ "https://Stackoverflow.com/questions/14185126", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1531219/" ]
Set the `showsCameraControls`-Property to `NO`. ``` poc = [[UIImagePickerController alloc] init]; [poc setTitle:@"Take a photo."]; [poc setDelegate:self]; [poc setSourceType:UIImagePickerControllerSourceTypeCamera]; poc.showsCameraControls = NO; ``` You also have to add your own Controls as a cus...
Assuming you want a point-and-shoot method, you can create an AVSession and just call the UIImageWriteToSavedPhotosAlbum method. Here is a link that goes into that exact process: <http://www.musicalgeometry.com/?p=1297> It's also worth noting that your users need to have given the app access to their camera roll or yo...
14,185,126
Do you know any way / method to **take a photo in iOS** and saving it to camera Roll only with a simple button pressure without showing any preview? I already know how to show the camera view but it show the preview of the image and the user need to click the take photo button to take the photo. **In few Words:** the...
2013/01/06
[ "https://Stackoverflow.com/questions/14185126", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1531219/" ]
Assuming you want a point-and-shoot method, you can create an AVSession and just call the UIImageWriteToSavedPhotosAlbum method. Here is a link that goes into that exact process: <http://www.musicalgeometry.com/?p=1297> It's also worth noting that your users need to have given the app access to their camera roll or yo...
You need to design your own custom preview according to your size, on capture button pressed and call `buttonPressed` method and do stuff what you want ``` (void)buttonPressed:(UIButton *)sender { NSLog(@" Capture Clicked"); [self.imagePicker takePicture]; //[NSTimer scheduledTimerWithTimeInterval:3.0f...
14,185,126
Do you know any way / method to **take a photo in iOS** and saving it to camera Roll only with a simple button pressure without showing any preview? I already know how to show the camera view but it show the preview of the image and the user need to click the take photo button to take the photo. **In few Words:** the...
2013/01/06
[ "https://Stackoverflow.com/questions/14185126", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1531219/" ]
Assuming you want a point-and-shoot method, you can create an AVSession and just call the UIImageWriteToSavedPhotosAlbum method. Here is a link that goes into that exact process: <http://www.musicalgeometry.com/?p=1297> It's also worth noting that your users need to have given the app access to their camera roll or yo...
following is code that will take photo without showing preview screen. when i tried the accepted answer, which uses UIImagePickerController, the preview screen showed, then auto disappeared. with the code below, user taps 'takePhoto' button, and the devices takes photo with zero change to UI (in my app, i add a green c...
14,185,126
Do you know any way / method to **take a photo in iOS** and saving it to camera Roll only with a simple button pressure without showing any preview? I already know how to show the camera view but it show the preview of the image and the user need to click the take photo button to take the photo. **In few Words:** the...
2013/01/06
[ "https://Stackoverflow.com/questions/14185126", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1531219/" ]
Set the `showsCameraControls`-Property to `NO`. ``` poc = [[UIImagePickerController alloc] init]; [poc setTitle:@"Take a photo."]; [poc setDelegate:self]; [poc setSourceType:UIImagePickerControllerSourceTypeCamera]; poc.showsCameraControls = NO; ``` You also have to add your own Controls as a cus...
You need to design your own custom preview according to your size, on capture button pressed and call `buttonPressed` method and do stuff what you want ``` (void)buttonPressed:(UIButton *)sender { NSLog(@" Capture Clicked"); [self.imagePicker takePicture]; //[NSTimer scheduledTimerWithTimeInterval:3.0f...
14,185,126
Do you know any way / method to **take a photo in iOS** and saving it to camera Roll only with a simple button pressure without showing any preview? I already know how to show the camera view but it show the preview of the image and the user need to click the take photo button to take the photo. **In few Words:** the...
2013/01/06
[ "https://Stackoverflow.com/questions/14185126", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1531219/" ]
Set the `showsCameraControls`-Property to `NO`. ``` poc = [[UIImagePickerController alloc] init]; [poc setTitle:@"Take a photo."]; [poc setDelegate:self]; [poc setSourceType:UIImagePickerControllerSourceTypeCamera]; poc.showsCameraControls = NO; ``` You also have to add your own Controls as a cus...
following is code that will take photo without showing preview screen. when i tried the accepted answer, which uses UIImagePickerController, the preview screen showed, then auto disappeared. with the code below, user taps 'takePhoto' button, and the devices takes photo with zero change to UI (in my app, i add a green c...
51,550,869
If I have an string containing a JSONP response, for example`"jsonp([1,2,3])"`, and I want to retrieve the 3rd parameter `3`, how could I write a function that do that for me? I want to avoid using `eval`. My code (below) works fine on the debug line, but return `undefined` for some reason. ``` function unwrap(jsonp...
2018/07/27
[ "https://Stackoverflow.com/questions/51550869", "https://Stackoverflow.com", "https://Stackoverflow.com/users/242076/" ]
Just `slice` the string to remove the `jsonp(` and `);`, and then you can `JSON.parse` it: ```js function unwrap(jsonp) { return JSON.parse(jsonp.slice(6, jsonp.length - 2)); } var j = 'jsonp([1,2,3]);' console.log(unwrap(j)); // returns the whole array console.log(unwrap(j)[2]); // returns the third item in ...
Just a little changes and it'll work fine: ``` function unwrap(jsonp) { var f = new Function("jsonp", `return ${jsonp}`); console.log(f.toString()) return f(unwrapper); } function unwrapper(param) { console.log(param[2]); // This works! return param[2]; } var j = 'jsonp([1,2,3]);' console.log(unw...
567,365
I plan to charge a 12v LiFePO4 battery using a charger specifically designed for that purpose, but I would like to know alternative methods of charging this battery without a dedicated charger. I understand that to charge this battery, the power source for charging must be near the correct voltage and within a safe ra...
2021/05/28
[ "https://electronics.stackexchange.com/questions/567365", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/108278/" ]
If you just hook the LiFePo up to a car battery, you'll get a lot of smoke from both the cables and the batteries involved, and it can also cause the LiFePo to ignite or explode. The problem is that there's nothing to limit the current flowing into the LiFePo battery. A car battery can easily provide thousands of ampe...
Every time someone asks about this sort of thing, the overwhelming response is "only do it the proper way or your batteries will blow up and your house will burn down." You seem to understand that and specifically want to know what will happen or what your options are. In my opinion, that is a perfectly valid question....
567,365
I plan to charge a 12v LiFePO4 battery using a charger specifically designed for that purpose, but I would like to know alternative methods of charging this battery without a dedicated charger. I understand that to charge this battery, the power source for charging must be near the correct voltage and within a safe ra...
2021/05/28
[ "https://electronics.stackexchange.com/questions/567365", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/108278/" ]
If you just hook the LiFePo up to a car battery, you'll get a lot of smoke from both the cables and the batteries involved, and it can also cause the LiFePo to ignite or explode. The problem is that there's nothing to limit the current flowing into the LiFePo battery. A car battery can easily provide thousands of ampe...
You can charge any (rechargeable) battery from any other battery or any other source provided that you can ensure that the charging current is within allowable limits for both batteries. There are a few ways to do this; the simplest is to use a resistor although a constant-current circuit would be better, and a switch-...
567,365
I plan to charge a 12v LiFePO4 battery using a charger specifically designed for that purpose, but I would like to know alternative methods of charging this battery without a dedicated charger. I understand that to charge this battery, the power source for charging must be near the correct voltage and within a safe ra...
2021/05/28
[ "https://electronics.stackexchange.com/questions/567365", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/108278/" ]
If you just hook the LiFePo up to a car battery, you'll get a lot of smoke from both the cables and the batteries involved, and it can also cause the LiFePo to ignite or explode. The problem is that there's nothing to limit the current flowing into the LiFePo battery. A car battery can easily provide thousands of ampe...
Most 12V LiFePO4 batteries are designed as a replacement for a car/truck/boat/RV battery and in particular, EXACTLY to be charged by an ordinary car alternator that is limited at 14.2-14.6 volt. (In contrast, PV/wind/offgrid installations are usually made from single 3.2V cells with external BMS) Charging it from the ...
6,666,735
I just want everyones feedback about the following Async Controller using the Web Api HttpClient. This looks very messy is there a way to make it cleaner? Does anyone have a good wrapper around chaining multiple async tasks together? ``` public class HomeController : AsyncController { public void IndexAsync() ...
2011/07/12
[ "https://Stackoverflow.com/questions/6666735", "https://Stackoverflow.com", "https://Stackoverflow.com/users/104727/" ]
You can use oTranslate to remove numbers: ``` BTEQ -- Enter your SQL request or BTEQ command: Select the_name, oTranslate( the_name, 'a0123456789','a') from ( SELECT 'Larry59N' the_name FROM ( SELECT 'X' DUMMY ) a UNION ALL SELECT 'Laura9' FROM ( SELECT 'X' DUMMY ) b UNION ALL SE...
Unfortunately, I don't believe there is a function native to Teradata that will accomplish this. I would suggest looking at the UDF's posted on the Teradata Developer Exchange ([link](http://developer.teradata.com/blog/madmac/2010/03/a-few-basic-scalar-string-udfs)). The function `eReplaceChar` in particular looks like...
72,102,467
I have a couple tables (see reproducible code at the bottom): `tbl1_have` ``` id json_col 1 {"a_i":"a","a_j":1} 1 {"a_i":"b","a_j":2} 2 {"a_i":"c","a_j":3} 2 {"a_i":"d","a_j":4} ``` `tbl2_have` ``` id json_col 1 [{"a_i":"a","a_j":1},{"a_i":"b","a_j...
2022/05/03
[ "https://Stackoverflow.com/questions/72102467", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2270475/" ]
I am assuming that you don't know the name and type of keys in advance. You need to use dynamic SQL. You first need to use [`OPENJSON`](https://learn.microsoft.com/en-us/sql/t-sql/functions/openjson-transact-sql?view=sql-server-ver15) without the `WITH` clause on the `{objects}` like so: ``` select string_agg(quotena...
Would using the Value returned from OPENJSON work? It probably maps to a string data type, however, you do not have to know the type upfront. The [official doc](https://learn.microsoft.com/en-us/sql/relational-databases/json/convert-json-data-to-rows-and-columns-with-openjson-sql-server?view=sql-server-ver15) of the OP...
72,102,467
I have a couple tables (see reproducible code at the bottom): `tbl1_have` ``` id json_col 1 {"a_i":"a","a_j":1} 1 {"a_i":"b","a_j":2} 2 {"a_i":"c","a_j":3} 2 {"a_i":"d","a_j":4} ``` `tbl2_have` ``` id json_col 1 [{"a_i":"a","a_j":1},{"a_i":"b","a_j...
2022/05/03
[ "https://Stackoverflow.com/questions/72102467", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2270475/" ]
I am assuming that you don't know the name and type of keys in advance. You need to use dynamic SQL. You first need to use [`OPENJSON`](https://learn.microsoft.com/en-us/sql/t-sql/functions/openjson-transact-sql?view=sql-server-ver15) without the `WITH` clause on the `{objects}` like so: ``` select string_agg(quotena...
I have found a solution that maybe works for your use case. I am no SQL-expert by any means, and i did not manage to automatically detect the datatypes of the dynamic columns. But i found a solution for your two examples. First i tried to get all column names dynamically from the json\_col. I found an [answer on stack...
34,052,391
I am trying to save an array of optionals `Strings` to `NSUserDefaults`, but unfortunately it doesn't work: ``` var textFieldEntries: [String?] ... func encodeWithCoder(aCoder: NSCoder!) { aCoder.encodeObject(textFieldEntries, forKey: "textFieldEntries") // prints error: Cannot convert value of type '[String?]...
2015/12/02
[ "https://Stackoverflow.com/questions/34052391", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4735187/" ]
`[String?]` is a Swift type that cannot be represented as a Foundation type. Normally, Swift Array bridges to `NSArray`, but an `NSArray` cannot contain nil. An Array of Optionals can contain nil, so it doesn't bridge automatically. You could work around this by using a sparse array representation. (And since your con...
Let's say this is the original array ``` let textFieldEntries: [String?] ``` First of all let's turn the array of `String?` into an array of `String`. ``` let entries = textFieldEntries.flatMap { $0 } ``` Now we can save it ``` NSUserDefaults.standardUserDefaults().setObject(entries, forKey: "entries") ``` And...
38,211,463
I am using VBA to extract texts from PDF file to a xls spreadsheet. The texts are always the same "*Price of X", "Price of Y", "Price of Z"*. I need to find, copy, and paste them in a spreadsheet. I have not found any similar topics.
2016/07/05
[ "https://Stackoverflow.com/questions/38211463", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6523952/" ]
I think the best for you is to use a JQuery method as the following codes. Your HTML would be like the following. ``` <select> <option value="01" textValue="America">01</option> <option value="02" textValue="Liberia">02</option> <option value="03" textValue="Switzerland">03</option> </select> ``` ``` $("your ...
I think what you want here is something like this ```html <select> <option value="01">America - 01</option> <option value="02">Liberia - 02</option> <option value="03">Switzerland - 03</option> </select> ``` You can use click event for selecting in javascript, not quite sure of how you are planning to use t...
71,603,642
I found quite some info on output redirection, creation of streambuffers and ostream classes, but I did not manage to apply this succesfully yet for my purpose. This post has become quite lengthy because I wanted to describe my step by step approach. I have an application that uses a class MyNotifier that captures eve...
2022/03/24
[ "https://Stackoverflow.com/questions/71603642", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15884156/" ]
You don't want to touch ostream (the formatting layer) at all. You should do everything in the streambuf (the transport layer). You can use manipulators to set or change the state of the underlying transport layers through the generic ostream interface, if required.
By using a class that is derived from std::streambuf that contains an additional buffer member I can do the trick. The main ostream output stream is just std::ostream. I found an example from The C++ Standard Library Second Edition, Nicolai M. Josuttis, p. 837 . See the EDIT in my original post. Thanks @Stephen M. Web...
7,777,906
I have studied both Rails and .Net, and find myself longing for features in one that exist in the other and vice versa. Rails has a wonderfully simple syntax while the C# IDE does have features that make development easier (unless you are a command-line purist). Is there a language/framework out there that takes the be...
2011/10/15
[ "https://Stackoverflow.com/questions/7777906", "https://Stackoverflow.com", "https://Stackoverflow.com/users/849359/" ]
If you like the syntax simplicity echo system of rails, and if it is the IDE, there is always ruby/rails IDEs which does same as VS for C# * NetBeans * [RadRails](http://www.aptana.com/products/radrails) * [Rubymine](http://www.jetbrains.com/ruby/) and lot more
[Scala](http://www.scala-lang.org/) might work for you
7,777,906
I have studied both Rails and .Net, and find myself longing for features in one that exist in the other and vice versa. Rails has a wonderfully simple syntax while the C# IDE does have features that make development easier (unless you are a command-line purist). Is there a language/framework out there that takes the be...
2011/10/15
[ "https://Stackoverflow.com/questions/7777906", "https://Stackoverflow.com", "https://Stackoverflow.com/users/849359/" ]
If you like the syntax simplicity echo system of rails, and if it is the IDE, there is always ruby/rails IDEs which does same as VS for C# * NetBeans * [RadRails](http://www.aptana.com/products/radrails) * [Rubymine](http://www.jetbrains.com/ruby/) and lot more
Have you by any change had a look at JRuby w/ IntelliJ as the IDE?: * <http://jruby.org/> * <http://www.jetbrains.com/idea/features/ruby_rails.html>
7,777,906
I have studied both Rails and .Net, and find myself longing for features in one that exist in the other and vice versa. Rails has a wonderfully simple syntax while the C# IDE does have features that make development easier (unless you are a command-line purist). Is there a language/framework out there that takes the be...
2011/10/15
[ "https://Stackoverflow.com/questions/7777906", "https://Stackoverflow.com", "https://Stackoverflow.com/users/849359/" ]
If you like the syntax simplicity echo system of rails, and if it is the IDE, there is always ruby/rails IDEs which does same as VS for C# * NetBeans * [RadRails](http://www.aptana.com/products/radrails) * [Rubymine](http://www.jetbrains.com/ruby/) and lot more
I don't quite see the benefit of mixing ASP.NET MVC and Ruby when you have Rails. If you are looking for a IDE that's similar to Visual Studio (with ReSharper) for RoR, I would go for RubyMine. It gives you almost the same feeling as if you are working in Visual Studio.
3,544,526
I'm still getting used to SQL, so before I get to using stored procedure, I would like to understand how to use BULK INSERT effectively first. I need to combine 50+ csv files and dump them into an SQL table. The problem is, I'd like to be able to tell each record apart (as in, each record belongs to a certain csv file...
2010/08/23
[ "https://Stackoverflow.com/questions/3544526", "https://Stackoverflow.com", "https://Stackoverflow.com/users/426124/" ]
You can add a column `FileName varchar(max)` to the ResultsDump table, create a view of the table with the new column, bulk insert into the view, and after every insert, set the filename for columns where it still has its default value `null`: ``` CREATE TABLE dbo.ResultsDump ( PC FLOAT, Amp VARCHAR(50), R...
Try this, ``` ALTER PROCEDURE [dbo].[ReadandUpdateFileNames_SP] ( @spRequestId NVARCHAR(50) ,@LoopCounter INT =0 ,@MaxFIVId INT=0 ,@spFileName NVARCHAR(100)=NULL) AS BEGIN SET NOCOUNT ON ...
58,091,754
I'm sending date from Date picker it's going correct date but when I check in the controller the date was getting yesterday date in spring boot backend and angualr js in frontend I havea tried setting timezone in application properties like : > > spring.jackson.time-zone=IST > > > spring.jackson.locale=in\_IN > ...
2019/09/25
[ "https://Stackoverflow.com/questions/58091754", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10293590/" ]
The easiest way is to disable user interaction of super view and then run a timer with desired delay for the touch and enable the user interaction once the timer is invalidated.
Do not use timers or the dispatch. These do not correspond to your in game time. If you exit your app or get a phone call, these will fire prematurely. Instead, use an action on your scene: ``` let wait = SKAction.wait(forDuration:2) let run = SKAction.run{self.isUserInteractionEnabled = true} self.run(SKAction.seque...
8,615,285
I'm trying to create a simple HTML layout where there is a header, content and footer section vertically layed out. The heights of both header and footer should be flexible, determined by the content. The height of the content section should be the remaining height, so the entire layout uses the full height of the wi...
2011/12/23
[ "https://Stackoverflow.com/questions/8615285", "https://Stackoverflow.com", "https://Stackoverflow.com/users/951064/" ]
The first thing you should do is read the Apple documentation relating to [App States](http://developer.apple.com/library/ios/#documentation/iphone/conceptual/iphoneosprogrammingguide/ManagingYourApplicationsFlow/ManagingYourApplicationsFlow.html) and [Responding to Low-Memory Warnings in iOS](http://developer.apple.co...
you're right in that the more apps that are run the more memory is used, and if the OS decides it needs to free some memory it could kill your app. there's nothing you can do about this, apart from saving your application's state when the app enters the background (you really should do this anyway). never assume you'll...
8,615,285
I'm trying to create a simple HTML layout where there is a header, content and footer section vertically layed out. The heights of both header and footer should be flexible, determined by the content. The height of the content section should be the remaining height, so the entire layout uses the full height of the wi...
2011/12/23
[ "https://Stackoverflow.com/questions/8615285", "https://Stackoverflow.com", "https://Stackoverflow.com/users/951064/" ]
you're right in that the more apps that are run the more memory is used, and if the OS decides it needs to free some memory it could kill your app. there's nothing you can do about this, apart from saving your application's state when the app enters the background (you really should do this anyway). never assume you'll...
You should save your app status and data when your app before your app goes into the background.
8,615,285
I'm trying to create a simple HTML layout where there is a header, content and footer section vertically layed out. The heights of both header and footer should be flexible, determined by the content. The height of the content section should be the remaining height, so the entire layout uses the full height of the wi...
2011/12/23
[ "https://Stackoverflow.com/questions/8615285", "https://Stackoverflow.com", "https://Stackoverflow.com/users/951064/" ]
you're right in that the more apps that are run the more memory is used, and if the OS decides it needs to free some memory it could kill your app. there's nothing you can do about this, apart from saving your application's state when the app enters the background (you really should do this anyway). never assume you'll...
If you want your app to run for a limited time in the background, and have set the appropriate background modes plist keys, your app must minimize it's memory footprint in order for the OS not to kill it. Release **everything** except the bare minimum resources required to run in the background, preferably to only a fe...
8,615,285
I'm trying to create a simple HTML layout where there is a header, content and footer section vertically layed out. The heights of both header and footer should be flexible, determined by the content. The height of the content section should be the remaining height, so the entire layout uses the full height of the wi...
2011/12/23
[ "https://Stackoverflow.com/questions/8615285", "https://Stackoverflow.com", "https://Stackoverflow.com/users/951064/" ]
The first thing you should do is read the Apple documentation relating to [App States](http://developer.apple.com/library/ios/#documentation/iphone/conceptual/iphoneosprogrammingguide/ManagingYourApplicationsFlow/ManagingYourApplicationsFlow.html) and [Responding to Low-Memory Warnings in iOS](http://developer.apple.co...
You should save your app status and data when your app before your app goes into the background.
8,615,285
I'm trying to create a simple HTML layout where there is a header, content and footer section vertically layed out. The heights of both header and footer should be flexible, determined by the content. The height of the content section should be the remaining height, so the entire layout uses the full height of the wi...
2011/12/23
[ "https://Stackoverflow.com/questions/8615285", "https://Stackoverflow.com", "https://Stackoverflow.com/users/951064/" ]
The first thing you should do is read the Apple documentation relating to [App States](http://developer.apple.com/library/ios/#documentation/iphone/conceptual/iphoneosprogrammingguide/ManagingYourApplicationsFlow/ManagingYourApplicationsFlow.html) and [Responding to Low-Memory Warnings in iOS](http://developer.apple.co...
If you want your app to run for a limited time in the background, and have set the appropriate background modes plist keys, your app must minimize it's memory footprint in order for the OS not to kill it. Release **everything** except the bare minimum resources required to run in the background, preferably to only a fe...
57,080,989
it shows the error on the emulator while playing > > java.lang.RuntimeException: Unable to start activity > ComponentInfo{com.nehagupta.braintrainer/com.nehagupta.braintrainer.MainActivity}: > java.lang.NullPointerException: Attempt to invoke virtual method 'void > android.widget.TextView.setText(java.lang.CharSeq...
2019/07/17
[ "https://Stackoverflow.com/questions/57080989", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11798729/" ]
Turns out that I had missed setting the default value for the `CurrencyID` property. Kind of obvious now I see it. I added the following... ``` builder.Entity<Donation>() .Property(p => p.CurrencyID) .HasDefaultValue(1); ``` ...and the error went away. On a side note, this gave me a different error about...
There's a few different ways you could tackle it. 1) * Generate your migration with your property being non-nullable, and including the data as you are now, but modify the migration so it adds the column as a nullable, and pre-populate the data and alter it later to become non-nullable. 2) * Generate a migration wi...
111,408
On [this deleted answer](https://stackoverflow.com/questions/8054165/using-put-method-in-html-form/8054177#8054177), there is a comment which I am able to click the up arrow (great comment button) on. The vote registers, as in, it changes the arrow to orange, however when I refresh the page my upvote is not reflected. ...
2011/11/08
[ "https://meta.stackexchange.com/questions/111408", "https://meta.stackexchange.com", "https://meta.stackexchange.com/users/-1/" ]
That *used* to trigger an alert saying > > Comments on deleted answers cannot be upvoted > > > Recent [bug](/questions/tagged/bug "show questions tagged 'bug'"), I assume
On Meta Stack Overflow, which is using revision 2011.11.8.6 of the code (instead of the revision 2011.11.8.4 used on Stack Overflow), voting a comment on a deleted post doesn't show an error message, and the vote seems accepted. ![screenshot](https://i.stack.imgur.com/BpXgy.png) When you refresh the page, the comment...
49,047,244
I am processing outputs from a piece of software that provides co-ordinates as an x, y, z triple in a single column. Is there any way to split the string out into its three separate parts and convert to floats in one fell swoop? For example, I know that I can do the following: ``` import pandas as pd df = pd.DataFram...
2018/03/01
[ "https://Stackoverflow.com/questions/49047244", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5309300/" ]
Use [`split`](http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.str.split.html) with `expand=True` for `DataFrame` and assign to new columns in subset by double `[]`: ``` df[['Front_x', 'Front_y', 'Front_z']] = df['COORDFRONT'].str.split(expand=True).astype(float) print (df) COORDFRONT ...
This is one way: ``` df['Front_x'], df['Front_y'], df['Front_z'] = list(zip(*[list(map(float, i)) for i in \ df['COORDFRONT'].str.split(' ')])) ``` **Result** ``` df.dtypes # COORDFRONT object # COORDREAR object # ID int64 # Front_x flo...
260,818
[Drupal 8] I have a List (text) field that allows multiple values, displayed as a check box list when editing. But when viewing the node, only the checked values are displayed. **How can I display *all* values, with an indicator which ones are checked/unchecked?** Is this possible with theming? What I found so far: ...
2018/04/29
[ "https://drupal.stackexchange.com/questions/260818", "https://drupal.stackexchange.com", "https://drupal.stackexchange.com/users/9223/" ]
You can easily generate a field formatter to output what you need in drupal 8 ([generate field formatter](https://www.drupal.org/docs/8/creating-custom-modules/create-a-custom-field-formatter) => `drupal gpff` with drupal console) and get the result into a view. Getting the field definition will allow you to get all p...
['Display Selected and Unselected'](https://www.drupal.org/project/display_selected_and_unselected) module - is one of the possible solutions for Drupal 8.
8,797,562
I'm trying to use List.fold on a record type that defines an operator overload for `+`, but I'm getting a type mismatch error when trying to use the `(+)` operator as the lambda passed to fold. Here's a simplified snippet that exemplifies my problem: ``` // a record type that also includes an overload for '+' type Per...
2012/01/10
[ "https://Stackoverflow.com/questions/8797562", "https://Stackoverflow.com", "https://Stackoverflow.com/users/73482/" ]
The `List.fold` function takes a lambda / function of type `State -> T -> State`. The `+` operator in this case has type `Person -> Person -> int` which is incompatible with the signature. This is why you're getting the error. To fold the ages try the following ``` people |> List.fold (fun sum p -> sum + p.Age) 0 `...
How about this (+) overload? ``` type Person = { Name : string; Age: int } static member ( + ) (x: Person, y: Person) = { Name = x.Name + " and " + y.Name; Age = x.Age + y.Age } let jen = { Name = "Jen"; Age = 20 } let kevin = { Name = "Kevin"; Age = 40 } [jen; kevin] |> List.fold (+) { Name = ""; Age = ...
8,797,562
I'm trying to use List.fold on a record type that defines an operator overload for `+`, but I'm getting a type mismatch error when trying to use the `(+)` operator as the lambda passed to fold. Here's a simplified snippet that exemplifies my problem: ``` // a record type that also includes an overload for '+' type Per...
2012/01/10
[ "https://Stackoverflow.com/questions/8797562", "https://Stackoverflow.com", "https://Stackoverflow.com/users/73482/" ]
The `List.fold` function takes a lambda / function of type `State -> T -> State`. The `+` operator in this case has type `Person -> Person -> int` which is incompatible with the signature. This is why you're getting the error. To fold the ages try the following ``` people |> List.fold (fun sum p -> sum + p.Age) 0 `...
Here is a reasonable solution that may be useful for you. ``` type Person = { Name : string Age: int } with static member (+) (x: Person, y: Person) = { Set = Set.ofList [x; y]; SumOfAges = x.Age + y.Age } and People = { Set:Person Set SumOfAges:int } with static member (+) (x:Peop...
8,797,562
I'm trying to use List.fold on a record type that defines an operator overload for `+`, but I'm getting a type mismatch error when trying to use the `(+)` operator as the lambda passed to fold. Here's a simplified snippet that exemplifies my problem: ``` // a record type that also includes an overload for '+' type Per...
2012/01/10
[ "https://Stackoverflow.com/questions/8797562", "https://Stackoverflow.com", "https://Stackoverflow.com/users/73482/" ]
The `List.fold` function takes a lambda / function of type `State -> T -> State`. The `+` operator in this case has type `Person -> Person -> int` which is incompatible with the signature. This is why you're getting the error. To fold the ages try the following ``` people |> List.fold (fun sum p -> sum + p.Age) 0 `...
I think your problem is conceptual. What you pass to `List.fold` is a single function. It is best to think of `+` as syntactic sugar for a whole stack of different functions - with type signatures like `int -> int -> int`, `float -> float -> float` and `person -> person -> int`. So what happens when the compiler sees ...
8,797,562
I'm trying to use List.fold on a record type that defines an operator overload for `+`, but I'm getting a type mismatch error when trying to use the `(+)` operator as the lambda passed to fold. Here's a simplified snippet that exemplifies my problem: ``` // a record type that also includes an overload for '+' type Per...
2012/01/10
[ "https://Stackoverflow.com/questions/8797562", "https://Stackoverflow.com", "https://Stackoverflow.com/users/73482/" ]
The `List.fold` function takes a lambda / function of type `State -> T -> State`. The `+` operator in this case has type `Person -> Person -> int` which is incompatible with the signature. This is why you're getting the error. To fold the ages try the following ``` people |> List.fold (fun sum p -> sum + p.Age) 0 `...
the problem is than + is defined for add integers,floats,etc and you define an + for add 2 Persons..but when you try: ``` List.fold (+) 0 people;; ``` you're trying add an int (0) with a Person (people) that is!.. actually when you add 2 peoples this return an integer...then everytime than you iterate over people ...
8,797,562
I'm trying to use List.fold on a record type that defines an operator overload for `+`, but I'm getting a type mismatch error when trying to use the `(+)` operator as the lambda passed to fold. Here's a simplified snippet that exemplifies my problem: ``` // a record type that also includes an overload for '+' type Per...
2012/01/10
[ "https://Stackoverflow.com/questions/8797562", "https://Stackoverflow.com", "https://Stackoverflow.com/users/73482/" ]
How about this (+) overload? ``` type Person = { Name : string; Age: int } static member ( + ) (x: Person, y: Person) = { Name = x.Name + " and " + y.Name; Age = x.Age + y.Age } let jen = { Name = "Jen"; Age = 20 } let kevin = { Name = "Kevin"; Age = 40 } [jen; kevin] |> List.fold (+) { Name = ""; Age = ...
the problem is than + is defined for add integers,floats,etc and you define an + for add 2 Persons..but when you try: ``` List.fold (+) 0 people;; ``` you're trying add an int (0) with a Person (people) that is!.. actually when you add 2 peoples this return an integer...then everytime than you iterate over people ...
8,797,562
I'm trying to use List.fold on a record type that defines an operator overload for `+`, but I'm getting a type mismatch error when trying to use the `(+)` operator as the lambda passed to fold. Here's a simplified snippet that exemplifies my problem: ``` // a record type that also includes an overload for '+' type Per...
2012/01/10
[ "https://Stackoverflow.com/questions/8797562", "https://Stackoverflow.com", "https://Stackoverflow.com/users/73482/" ]
Here is a reasonable solution that may be useful for you. ``` type Person = { Name : string Age: int } with static member (+) (x: Person, y: Person) = { Set = Set.ofList [x; y]; SumOfAges = x.Age + y.Age } and People = { Set:Person Set SumOfAges:int } with static member (+) (x:Peop...
the problem is than + is defined for add integers,floats,etc and you define an + for add 2 Persons..but when you try: ``` List.fold (+) 0 people;; ``` you're trying add an int (0) with a Person (people) that is!.. actually when you add 2 peoples this return an integer...then everytime than you iterate over people ...
8,797,562
I'm trying to use List.fold on a record type that defines an operator overload for `+`, but I'm getting a type mismatch error when trying to use the `(+)` operator as the lambda passed to fold. Here's a simplified snippet that exemplifies my problem: ``` // a record type that also includes an overload for '+' type Per...
2012/01/10
[ "https://Stackoverflow.com/questions/8797562", "https://Stackoverflow.com", "https://Stackoverflow.com/users/73482/" ]
I think your problem is conceptual. What you pass to `List.fold` is a single function. It is best to think of `+` as syntactic sugar for a whole stack of different functions - with type signatures like `int -> int -> int`, `float -> float -> float` and `person -> person -> int`. So what happens when the compiler sees ...
the problem is than + is defined for add integers,floats,etc and you define an + for add 2 Persons..but when you try: ``` List.fold (+) 0 people;; ``` you're trying add an int (0) with a Person (people) that is!.. actually when you add 2 peoples this return an integer...then everytime than you iterate over people ...
33,806
I sometimes see ‘you and …’ in English, for example “you and the other nine”, “You and your big mouth!”. This makes me sensitive to *you and something*. > > “Okay,” said Harry slowly. “But … are you saying Karkaroff put my name in the goblet? Because if he did, he’s a really good actor. He seemed furious about it. He...
2011/07/12
[ "https://english.stackexchange.com/questions/33806", "https://english.stackexchange.com", "https://english.stackexchange.com/users/-1/" ]
As stated by yourself, Harry doesn't like anyone to be interested in the *Daily Prophet*. When "Harry" said 'you and the rest of the world', he is stating : "*Everyone* reads the *Daily Prophet*!" It's the same when someone say, teases you. You could get upset and say "No one likes me anymore!" Not really literall...
Harry is using sarcasm to convey his contempt for the Daily Prophet. If the statement didn't include exaggeration as it does, it would lose meaning sounding a bit absurd. "You and..." is a fairly common meme used in this sarcastic context. It can be used either in a happy joking fashion or the above bitter fashion amo...
33,806
I sometimes see ‘you and …’ in English, for example “you and the other nine”, “You and your big mouth!”. This makes me sensitive to *you and something*. > > “Okay,” said Harry slowly. “But … are you saying Karkaroff put my name in the goblet? Because if he did, he’s a really good actor. He seemed furious about it. He...
2011/07/12
[ "https://english.stackexchange.com/questions/33806", "https://english.stackexchange.com", "https://english.stackexchange.com/users/-1/" ]
As stated by yourself, Harry doesn't like anyone to be interested in the *Daily Prophet*. When "Harry" said 'you and the rest of the world', he is stating : "*Everyone* reads the *Daily Prophet*!" It's the same when someone say, teases you. You could get upset and say "No one likes me anymore!" Not really literall...
This is a common phrase that actually has a pretty nuanced meaning. It's synonymous to the phrase "Everyone and their grandmother." Everyone would already include all grandmothers, so this is just a silly way of saying "A whole lot of people." Of course, Harry isn't actually saying "Everyone else in the world is readi...
33,806
I sometimes see ‘you and …’ in English, for example “you and the other nine”, “You and your big mouth!”. This makes me sensitive to *you and something*. > > “Okay,” said Harry slowly. “But … are you saying Karkaroff put my name in the goblet? Because if he did, he’s a really good actor. He seemed furious about it. He...
2011/07/12
[ "https://english.stackexchange.com/questions/33806", "https://english.stackexchange.com", "https://english.stackexchange.com/users/-1/" ]
As stated by yourself, Harry doesn't like anyone to be interested in the *Daily Prophet*. When "Harry" said 'you and the rest of the world', he is stating : "*Everyone* reads the *Daily Prophet*!" It's the same when someone say, teases you. You could get upset and say "No one likes me anymore!" Not really literall...
"You and..." is an idiomatic use of English, which means it is used more figuratively than literally. In saying *"You and the rest of the world,"* Harry is pointing out that Ron is not the only person who is reading about him in the *Prophet*. We are being told that a lot of other people are doing the same thing; not ...
33,806
I sometimes see ‘you and …’ in English, for example “you and the other nine”, “You and your big mouth!”. This makes me sensitive to *you and something*. > > “Okay,” said Harry slowly. “But … are you saying Karkaroff put my name in the goblet? Because if he did, he’s a really good actor. He seemed furious about it. He...
2011/07/12
[ "https://english.stackexchange.com/questions/33806", "https://english.stackexchange.com", "https://english.stackexchange.com/users/-1/" ]
"You and..." is an idiomatic use of English, which means it is used more figuratively than literally. In saying *"You and the rest of the world,"* Harry is pointing out that Ron is not the only person who is reading about him in the *Prophet*. We are being told that a lot of other people are doing the same thing; not ...
Harry is using sarcasm to convey his contempt for the Daily Prophet. If the statement didn't include exaggeration as it does, it would lose meaning sounding a bit absurd. "You and..." is a fairly common meme used in this sarcastic context. It can be used either in a happy joking fashion or the above bitter fashion amo...
33,806
I sometimes see ‘you and …’ in English, for example “you and the other nine”, “You and your big mouth!”. This makes me sensitive to *you and something*. > > “Okay,” said Harry slowly. “But … are you saying Karkaroff put my name in the goblet? Because if he did, he’s a really good actor. He seemed furious about it. He...
2011/07/12
[ "https://english.stackexchange.com/questions/33806", "https://english.stackexchange.com", "https://english.stackexchange.com/users/-1/" ]
"You and..." is an idiomatic use of English, which means it is used more figuratively than literally. In saying *"You and the rest of the world,"* Harry is pointing out that Ron is not the only person who is reading about him in the *Prophet*. We are being told that a lot of other people are doing the same thing; not ...
This is a common phrase that actually has a pretty nuanced meaning. It's synonymous to the phrase "Everyone and their grandmother." Everyone would already include all grandmothers, so this is just a silly way of saying "A whole lot of people." Of course, Harry isn't actually saying "Everyone else in the world is readi...
13,232
Does anyone know the difference between the 3rd and 4th edition of "100 Endgames You Must Know"? I just looked at the Table Of Contents and they are identical and random pages on Amazon look the same too. I would imagine there must be some new use of the new tablebases that were completed since 2012?
2015/12/29
[ "https://chess.stackexchange.com/questions/13232", "https://chess.stackexchange.com", "https://chess.stackexchange.com/users/9096/" ]
Endgame books always **contain analysis mistakes**, and newer editions always **correct these mistakes**. So I would recommend to get up-to-date by buying the last one. As you said, 7-men Lomonosov built since last edition, and probably 7-men tablebase revealed that some analyses wrong. From [erreta page](https://www...
More often than not, edition differences are often just edits and re-phrasings. If you have the 3rd edition, then I would not fret about getting the 4th.
13,232
Does anyone know the difference between the 3rd and 4th edition of "100 Endgames You Must Know"? I just looked at the Table Of Contents and they are identical and random pages on Amazon look the same too. I would imagine there must be some new use of the new tablebases that were completed since 2012?
2015/12/29
[ "https://chess.stackexchange.com/questions/13232", "https://chess.stackexchange.com", "https://chess.stackexchange.com/users/9096/" ]
De la Villa's "100 Endgames you must know", though apparently a good book seems to have been plagued by an abundance of typos and mistakes as [detailed in this blogpost.](http://streathambrixtonchess.blogspot.com.es/2012/08/sixty-memorable-annotations.html) So although the culprit in this case has been the 2nd edition...
More often than not, edition differences are often just edits and re-phrasings. If you have the 3rd edition, then I would not fret about getting the 4th.
13,232
Does anyone know the difference between the 3rd and 4th edition of "100 Endgames You Must Know"? I just looked at the Table Of Contents and they are identical and random pages on Amazon look the same too. I would imagine there must be some new use of the new tablebases that were completed since 2012?
2015/12/29
[ "https://chess.stackexchange.com/questions/13232", "https://chess.stackexchange.com", "https://chess.stackexchange.com/users/9096/" ]
I know this answer is coming late, but as someone who had the 3rd edition and upgrated to the 4th edition I can answer this definitely. The ONLY difference in the new edition is that diagrams have an indicator of who is to move, and glancing at the text below the diagram it's very easy to see who is to move if you can'...
More often than not, edition differences are often just edits and re-phrasings. If you have the 3rd edition, then I would not fret about getting the 4th.
13,232
Does anyone know the difference between the 3rd and 4th edition of "100 Endgames You Must Know"? I just looked at the Table Of Contents and they are identical and random pages on Amazon look the same too. I would imagine there must be some new use of the new tablebases that were completed since 2012?
2015/12/29
[ "https://chess.stackexchange.com/questions/13232", "https://chess.stackexchange.com", "https://chess.stackexchange.com/users/9096/" ]
I have the book on Chessable (popular site for reading chess books like this one): > > <https://www.chessable.com/endgame-book/100-endgames-you-must-know/5193/> > > > [![enter image description here](https://i.stack.imgur.com/jTMne.png)](https://i.stack.imgur.com/jTMne.png) The difference in edition come from im...
More often than not, edition differences are often just edits and re-phrasings. If you have the 3rd edition, then I would not fret about getting the 4th.
13,232
Does anyone know the difference between the 3rd and 4th edition of "100 Endgames You Must Know"? I just looked at the Table Of Contents and they are identical and random pages on Amazon look the same too. I would imagine there must be some new use of the new tablebases that were completed since 2012?
2015/12/29
[ "https://chess.stackexchange.com/questions/13232", "https://chess.stackexchange.com", "https://chess.stackexchange.com/users/9096/" ]
De la Villa's "100 Endgames you must know", though apparently a good book seems to have been plagued by an abundance of typos and mistakes as [detailed in this blogpost.](http://streathambrixtonchess.blogspot.com.es/2012/08/sixty-memorable-annotations.html) So although the culprit in this case has been the 2nd edition...
Endgame books always **contain analysis mistakes**, and newer editions always **correct these mistakes**. So I would recommend to get up-to-date by buying the last one. As you said, 7-men Lomonosov built since last edition, and probably 7-men tablebase revealed that some analyses wrong. From [erreta page](https://www...
13,232
Does anyone know the difference between the 3rd and 4th edition of "100 Endgames You Must Know"? I just looked at the Table Of Contents and they are identical and random pages on Amazon look the same too. I would imagine there must be some new use of the new tablebases that were completed since 2012?
2015/12/29
[ "https://chess.stackexchange.com/questions/13232", "https://chess.stackexchange.com", "https://chess.stackexchange.com/users/9096/" ]
I have the book on Chessable (popular site for reading chess books like this one): > > <https://www.chessable.com/endgame-book/100-endgames-you-must-know/5193/> > > > [![enter image description here](https://i.stack.imgur.com/jTMne.png)](https://i.stack.imgur.com/jTMne.png) The difference in edition come from im...
Endgame books always **contain analysis mistakes**, and newer editions always **correct these mistakes**. So I would recommend to get up-to-date by buying the last one. As you said, 7-men Lomonosov built since last edition, and probably 7-men tablebase revealed that some analyses wrong. From [erreta page](https://www...
13,232
Does anyone know the difference between the 3rd and 4th edition of "100 Endgames You Must Know"? I just looked at the Table Of Contents and they are identical and random pages on Amazon look the same too. I would imagine there must be some new use of the new tablebases that were completed since 2012?
2015/12/29
[ "https://chess.stackexchange.com/questions/13232", "https://chess.stackexchange.com", "https://chess.stackexchange.com/users/9096/" ]
De la Villa's "100 Endgames you must know", though apparently a good book seems to have been plagued by an abundance of typos and mistakes as [detailed in this blogpost.](http://streathambrixtonchess.blogspot.com.es/2012/08/sixty-memorable-annotations.html) So although the culprit in this case has been the 2nd edition...
I know this answer is coming late, but as someone who had the 3rd edition and upgrated to the 4th edition I can answer this definitely. The ONLY difference in the new edition is that diagrams have an indicator of who is to move, and glancing at the text below the diagram it's very easy to see who is to move if you can'...