qid
int64
1
74.6M
question
stringlengths
45
24.2k
date
stringlengths
10
10
metadata
stringlengths
101
178
response_j
stringlengths
32
23.2k
response_k
stringlengths
21
13.2k
8,737,854
I have a string in php formatted like this: ``` http://aaaaaaaaaa/*http://bbbbbbbbbbbbbbb ``` where aaa... and bbb.... represent random characters and are random in length. I would like to parse the string so that I am left with this: ``` http://bbbbbbbbbbbbbbb ```
2012/01/05
['https://Stackoverflow.com/questions/8737854', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/657818/']
Hi This would help you to get the address: ``` $str = 'http://www.example.com/*http://www.another.org/'; $pattern = '/^http:\/\/[\.\w\-]+\/\*(http:\/\/.+)$/'; //$result = preg_replace($pattern, '$1', $str); $found = preg_match_all($pattern, $str, $result); $url = (!$found==0) ? $result[1][0] : ''; echo $str . '<br />'...
Here is a clean solution: grab everything after the last occurrence of "http://". ``` $start = strrpos($input, 'http://'); $output = substr($input, $start); ```
49,217,832
This was the question asked to me in interview : Input: ``` SQL> select col1,col2 from Hakuna_matata; COL1 ~ COL2 --------------------------------------------------~ A ~ 2 B ~ 1 C ~ ...
2018/03/11
['https://Stackoverflow.com/questions/49217832', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/9474466/']
You can order by ascending both column in separate and then merge it using [with clauses](https://oracle-base.com/articles/misc/with-clause), `rownum` **EDIT** using @Kaushik Nayak Tip in comments ``` with a as (select rownum as r,a1.* from (select col1, col3 from Hakuna_matata order by col1 asc ) a1) , b as (select...
Appropriate to use `ascii` function in your case : ``` SQL> select col1, ( ascii(col1) - 64 ) col2 from Hakuna_matata; ```
49,217,832
This was the question asked to me in interview : Input: ``` SQL> select col1,col2 from Hakuna_matata; COL1 ~ COL2 --------------------------------------------------~ A ~ 2 B ~ 1 C ~ ...
2018/03/11
['https://Stackoverflow.com/questions/49217832', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/9474466/']
As there is no explanation given on how `col2` should be generated (e.g. swapping the values or just re-numbering them), I'd go for: ``` select col1, row_number() over (order by col1) as col2 from Hakuna_matata; ``` Which produces the desired output - but it's unclear if that is the desired *solution*.
Appropriate to use `ascii` function in your case : ``` SQL> select col1, ( ascii(col1) - 64 ) col2 from Hakuna_matata; ```
49,217,832
This was the question asked to me in interview : Input: ``` SQL> select col1,col2 from Hakuna_matata; COL1 ~ COL2 --------------------------------------------------~ A ~ 2 B ~ 1 C ~ ...
2018/03/11
['https://Stackoverflow.com/questions/49217832', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/9474466/']
You can order by ascending both column in separate and then merge it using [with clauses](https://oracle-base.com/articles/misc/with-clause), `rownum` **EDIT** using @Kaushik Nayak Tip in comments ``` with a as (select rownum as r,a1.* from (select col1, col3 from Hakuna_matata order by col1 asc ) a1) , b as (select...
Maybe there is another way, but I think that you have to update table data: ``` update Hakuna_matata set col2=1 where col1='A'; update Hakuna_matata set col2=2 where col1='B'; ```
49,217,832
This was the question asked to me in interview : Input: ``` SQL> select col1,col2 from Hakuna_matata; COL1 ~ COL2 --------------------------------------------------~ A ~ 2 B ~ 1 C ~ ...
2018/03/11
['https://Stackoverflow.com/questions/49217832', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/9474466/']
As there is no explanation given on how `col2` should be generated (e.g. swapping the values or just re-numbering them), I'd go for: ``` select col1, row_number() over (order by col1) as col2 from Hakuna_matata; ``` Which produces the desired output - but it's unclear if that is the desired *solution*.
Maybe there is another way, but I think that you have to update table data: ``` update Hakuna_matata set col2=1 where col1='A'; update Hakuna_matata set col2=2 where col1='B'; ```
49,217,832
This was the question asked to me in interview : Input: ``` SQL> select col1,col2 from Hakuna_matata; COL1 ~ COL2 --------------------------------------------------~ A ~ 2 B ~ 1 C ~ ...
2018/03/11
['https://Stackoverflow.com/questions/49217832', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/9474466/']
You can order by ascending both column in separate and then merge it using [with clauses](https://oracle-base.com/articles/misc/with-clause), `rownum` **EDIT** using @Kaushik Nayak Tip in comments ``` with a as (select rownum as r,a1.* from (select col1, col3 from Hakuna_matata order by col1 asc ) a1) , b as (select...
As there is no explanation given on how `col2` should be generated (e.g. swapping the values or just re-numbering them), I'd go for: ``` select col1, row_number() over (order by col1) as col2 from Hakuna_matata; ``` Which produces the desired output - but it's unclear if that is the desired *solution*.
49,217,832
This was the question asked to me in interview : Input: ``` SQL> select col1,col2 from Hakuna_matata; COL1 ~ COL2 --------------------------------------------------~ A ~ 2 B ~ 1 C ~ ...
2018/03/11
['https://Stackoverflow.com/questions/49217832', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/9474466/']
You can order by ascending both column in separate and then merge it using [with clauses](https://oracle-base.com/articles/misc/with-clause), `rownum` **EDIT** using @Kaushik Nayak Tip in comments ``` with a as (select rownum as r,a1.* from (select col1, col3 from Hakuna_matata order by col1 asc ) a1) , b as (select...
Interesting. All the other answers seem so complicated. I would do: ``` select col1, row_number() over (order by col1) as seqnum from Hakuna_matata order by col1; ``` But the interviewer probably wants you to ask questions about what the ordering means, not simply come up with a solution that makes assumptions.
49,217,832
This was the question asked to me in interview : Input: ``` SQL> select col1,col2 from Hakuna_matata; COL1 ~ COL2 --------------------------------------------------~ A ~ 2 B ~ 1 C ~ ...
2018/03/11
['https://Stackoverflow.com/questions/49217832', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/9474466/']
As there is no explanation given on how `col2` should be generated (e.g. swapping the values or just re-numbering them), I'd go for: ``` select col1, row_number() over (order by col1) as col2 from Hakuna_matata; ``` Which produces the desired output - but it's unclear if that is the desired *solution*.
Interesting. All the other answers seem so complicated. I would do: ``` select col1, row_number() over (order by col1) as seqnum from Hakuna_matata order by col1; ``` But the interviewer probably wants you to ask questions about what the ordering means, not simply come up with a solution that makes assumptions.
53,771,718
`__FILE__` returns the path of the current Ruby script file. One potentially significant problem is that, if using `binding.pry`, `__FILE__` evaluates to `(pry)`. It is potentially problematic to have `__FILE__` evaluate to different values depending on whether it is evaluated in the context of `binding.pry`. For exam...
2018/12/13
['https://Stackoverflow.com/questions/53771718', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/6572871/']
Use `_file_` instead of `__FILE__`. For example, given two files: ``` # foo.rb require 'pry' require './bar' binding.pry b = Bar.new ``` and: ``` # bar.rb require 'pry' class Bar def initialize binding.pry end end ``` Run them with `ruby foo.rb`: ``` ruby foo.rb From: /Users/username/foo.rb @ line 3 : ...
Sergio Tulentsev made a simple suggestion, assign `__FILE__` to a variable before invoking `binding.pry`. anothermh, mentioned `_file_` which is available in binding pry. In the end, I combined the two answers: ``` # When in the context of binding.pry, __FILE__ resolves to '(pry)', # binding contains the local varia...
8,034,656
For example: ``` <div style="background-color:black;width:20px;height:20px;" > </div> <div style="background-color:red;width:20px;height:20px; margin:50px;" > </div> ``` <http://jsfiddle.net/TLLup/> Here is two bars red and black. I want to stick black bar to red and black bar must follow to red if it changes coor...
2011/11/07
['https://Stackoverflow.com/questions/8034656', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/290082/']
I had a somewhat similar issue because I was performing my calculations in ViewDidLoad. I was able to work around the issue by creating a bool flag in the view's code and only performing the calculations in ViewDidAppear if the flag was not set (and, of course setting the flag so that the logic wasn't repeated each tim...
On iOS 5 and up, sizeThatFits on a UITableView gives the correct result when called within the viewDidLayoutSubviews UIViewController method.
2,891,472
I was wondering if there is a (webbased) way to scale down a whole website and put it into an iframe. [including images etc], so that a user would get a fully functional preview of the website (only for websites without frame busting methods of course).
2010/05/23
['https://Stackoverflow.com/questions/2891472', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/253387/']
Have you tried the following with css? ``` body { zoom: 10%; } ```
Thats up to javascript or css although it really depends about the browser and its behavior to certain commands.
2,891,472
I was wondering if there is a (webbased) way to scale down a whole website and put it into an iframe. [including images etc], so that a user would get a fully functional preview of the website (only for websites without frame busting methods of course).
2010/05/23
['https://Stackoverflow.com/questions/2891472', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/253387/']
No, there isn't. The Microsoft propriety `zoom` property could probably do it, but not in most browsers, and not in pages you can't edit the CSS for. If you want to provide a preview, provide a thumbnail graphic (which would probably be a lot faster for the user to download in most cases anyway)
Thats up to javascript or css although it really depends about the browser and its behavior to certain commands.
2,891,472
I was wondering if there is a (webbased) way to scale down a whole website and put it into an iframe. [including images etc], so that a user would get a fully functional preview of the website (only for websites without frame busting methods of course).
2010/05/23
['https://Stackoverflow.com/questions/2891472', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/253387/']
Have you tried the following with css? ``` body { zoom: 10%; } ```
You can use javascript to specify the iframe src. `document.getElementById('myiframe').src = 'my url';`
2,891,472
I was wondering if there is a (webbased) way to scale down a whole website and put it into an iframe. [including images etc], so that a user would get a fully functional preview of the website (only for websites without frame busting methods of course).
2010/05/23
['https://Stackoverflow.com/questions/2891472', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/253387/']
No, there isn't. The Microsoft propriety `zoom` property could probably do it, but not in most browsers, and not in pages you can't edit the CSS for. If you want to provide a preview, provide a thumbnail graphic (which would probably be a lot faster for the user to download in most cases anyway)
You can use javascript to specify the iframe src. `document.getElementById('myiframe').src = 'my url';`
2,891,472
I was wondering if there is a (webbased) way to scale down a whole website and put it into an iframe. [including images etc], so that a user would get a fully functional preview of the website (only for websites without frame busting methods of course).
2010/05/23
['https://Stackoverflow.com/questions/2891472', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/253387/']
No, there isn't. The Microsoft propriety `zoom` property could probably do it, but not in most browsers, and not in pages you can't edit the CSS for. If you want to provide a preview, provide a thumbnail graphic (which would probably be a lot faster for the user to download in most cases anyway)
Have you tried the following with css? ``` body { zoom: 10%; } ```
22,243
I know that $G\_t = R\_{t+1} + G\_{t+1}$. Suppose $\gamma = 0.9$ and the reward sequence is $R\_1 = 2$ followed by an infinite sequence of $7$s. What is the value of $G\_0$? As it's infinite, how can we deduce the value of $G\_0$? I don't see the solution. It's just $G\_0 = 5 + 0.9\*G\_1$. And we don't know $G\_1$ va...
2020/06/29
['https://ai.stackexchange.com/questions/22243', 'https://ai.stackexchange.com', 'https://ai.stackexchange.com/users/38264/']
You know all the rewards. They're 5, 7, 7, 7, and 7s forever. The problem now boils down to essentially a geometric series computation. $$ G\_0 = R\_0 + \gamma G\_1 $$ $$ G\_0 = 5 + \gamma\sum\_{k=0}^\infty 7\gamma^k $$ $$ G\_0 = 5 + 7\gamma\sum\_{k=0}^\infty\gamma^k $$ $$ G\_0 = 5 + \frac{7\gamma}{1-\gamma} ...
There are a few ways to resolve values of infinite sums. In this case, we can use a simple technique of self-reference to create a solvable equation. I will show how to do it for the generic case here of an MDP with same reward $r$ on each timestep: $$G\_t = \sum\_{k=0}^{\infty} \gamma^k r$$ We can "pop off" the fir...
48,735,135
I am trying to create function using numpy something like f=(x-a1)^2+(y-a2)^2+a3 Where a1,a2,a3 are random generated numbers and x,y are parameters. But I cant work with it, I want to find f(0,0) where [0,0] is [x,y] and [a1,a2,a3] were set before,but my code doesnt work. And then I want to convert this function to t...
2018/02/11
['https://Stackoverflow.com/questions/48735135', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/8895598/']
Please note that as of November of 2018, there has been a [breaking change to MetaMask](https://medium.com/metamask/https-medium-com-metamask-breaking-change-injecting-web3-7722797916a8) where MetaMask will no longer automatically inject web3 into the browser. Instead users must grant the DApp access to their accounts ...
You should use web3 provider like MetaMask in browser. This is script that I use for web3 detection: ``` window.addEventListener('load', function () { if (typeof web3 !== 'undefined') { window.web3 = new Web3(window.web3.currentProvider) if (window.web3.currentProvider.isMetaMask === true)...
48,735,135
I am trying to create function using numpy something like f=(x-a1)^2+(y-a2)^2+a3 Where a1,a2,a3 are random generated numbers and x,y are parameters. But I cant work with it, I want to find f(0,0) where [0,0] is [x,y] and [a1,a2,a3] were set before,but my code doesnt work. And then I want to convert this function to t...
2018/02/11
['https://Stackoverflow.com/questions/48735135', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/8895598/']
You should use web3 provider like MetaMask in browser. This is script that I use for web3 detection: ``` window.addEventListener('load', function () { if (typeof web3 !== 'undefined') { window.web3 = new Web3(window.web3.currentProvider) if (window.web3.currentProvider.isMetaMask === true)...
To new readers that want to fix this issue, as of [January 2021, Metamask has removed it's injected `window.web3` API](https://docs.metamask.io/guide/provider-migration.html#provider-migration-guide). To use connect your app to Metamask, I'd try something like this ``` export const connectWallet = async () => { if (...
48,735,135
I am trying to create function using numpy something like f=(x-a1)^2+(y-a2)^2+a3 Where a1,a2,a3 are random generated numbers and x,y are parameters. But I cant work with it, I want to find f(0,0) where [0,0] is [x,y] and [a1,a2,a3] were set before,but my code doesnt work. And then I want to convert this function to t...
2018/02/11
['https://Stackoverflow.com/questions/48735135', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/8895598/']
You should use web3 provider like MetaMask in browser. This is script that I use for web3 detection: ``` window.addEventListener('load', function () { if (typeof web3 !== 'undefined') { window.web3 = new Web3(window.web3.currentProvider) if (window.web3.currentProvider.isMetaMask === true)...
Thanks for the other answers in this question. I refer to them to create this hook in my project. ``` export function useCheckMetaMaskInstalled() { const [installed, setInstalled] = useState(false); useEffect(() => { if (window.ethereum) { setInstalled(true); } }, []); return installed; } ```
48,735,135
I am trying to create function using numpy something like f=(x-a1)^2+(y-a2)^2+a3 Where a1,a2,a3 are random generated numbers and x,y are parameters. But I cant work with it, I want to find f(0,0) where [0,0] is [x,y] and [a1,a2,a3] were set before,but my code doesnt work. And then I want to convert this function to t...
2018/02/11
['https://Stackoverflow.com/questions/48735135', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/8895598/']
Please note that as of November of 2018, there has been a [breaking change to MetaMask](https://medium.com/metamask/https-medium-com-metamask-breaking-change-injecting-web3-7722797916a8) where MetaMask will no longer automatically inject web3 into the browser. Instead users must grant the DApp access to their accounts ...
To new readers that want to fix this issue, as of [January 2021, Metamask has removed it's injected `window.web3` API](https://docs.metamask.io/guide/provider-migration.html#provider-migration-guide). To use connect your app to Metamask, I'd try something like this ``` export const connectWallet = async () => { if (...
48,735,135
I am trying to create function using numpy something like f=(x-a1)^2+(y-a2)^2+a3 Where a1,a2,a3 are random generated numbers and x,y are parameters. But I cant work with it, I want to find f(0,0) where [0,0] is [x,y] and [a1,a2,a3] were set before,but my code doesnt work. And then I want to convert this function to t...
2018/02/11
['https://Stackoverflow.com/questions/48735135', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/8895598/']
Please note that as of November of 2018, there has been a [breaking change to MetaMask](https://medium.com/metamask/https-medium-com-metamask-breaking-change-injecting-web3-7722797916a8) where MetaMask will no longer automatically inject web3 into the browser. Instead users must grant the DApp access to their accounts ...
Thanks for the other answers in this question. I refer to them to create this hook in my project. ``` export function useCheckMetaMaskInstalled() { const [installed, setInstalled] = useState(false); useEffect(() => { if (window.ethereum) { setInstalled(true); } }, []); return installed; } ```
48,735,135
I am trying to create function using numpy something like f=(x-a1)^2+(y-a2)^2+a3 Where a1,a2,a3 are random generated numbers and x,y are parameters. But I cant work with it, I want to find f(0,0) where [0,0] is [x,y] and [a1,a2,a3] were set before,but my code doesnt work. And then I want to convert this function to t...
2018/02/11
['https://Stackoverflow.com/questions/48735135', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/8895598/']
To new readers that want to fix this issue, as of [January 2021, Metamask has removed it's injected `window.web3` API](https://docs.metamask.io/guide/provider-migration.html#provider-migration-guide). To use connect your app to Metamask, I'd try something like this ``` export const connectWallet = async () => { if (...
Thanks for the other answers in this question. I refer to them to create this hook in my project. ``` export function useCheckMetaMaskInstalled() { const [installed, setInstalled] = useState(false); useEffect(() => { if (window.ethereum) { setInstalled(true); } }, []); return installed; } ```
62,387,623
``` df_clean['message'] = df_clean['message'].apply(lambda x: gensim.parsing.preprocessing.remove_stopwords(x)) ``` I tried this on a dataframe's column 'message' but I get the error: ``` TypeError: decoding to str: need a bytes-like object, list found ```
2020/06/15
['https://Stackoverflow.com/questions/62387623', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/10608841/']
Apparently, the `df_clean["message"]` column contains a list of words, not a string, hence the error saying that `need a bytes-like object, list found`. To fix this issue, you need to convert it to string again using `join()` method like so: ``` df_clean['message'] = df_clean['message'].apply(lambda x: gensim.parsin...
This is not a `gensim` problem, the error is raised by `pandas`: there is a value in your column `message` that is of type `list` instead of `string`. Here's a minimal `pandas` example: ``` import pandas as pd from gensim.parsing.preprocessing import remove_stopwords df = pd.DataFrame([['one', 'two'], ['three', ['four...
62,387,623
``` df_clean['message'] = df_clean['message'].apply(lambda x: gensim.parsing.preprocessing.remove_stopwords(x)) ``` I tried this on a dataframe's column 'message' but I get the error: ``` TypeError: decoding to str: need a bytes-like object, list found ```
2020/06/15
['https://Stackoverflow.com/questions/62387623', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/10608841/']
Apparently, the `df_clean["message"]` column contains a list of words, not a string, hence the error saying that `need a bytes-like object, list found`. To fix this issue, you need to convert it to string again using `join()` method like so: ``` df_clean['message'] = df_clean['message'].apply(lambda x: gensim.parsin...
What the error is saying is that *remove\_stopwords* needs **string** type object and you are passing a **list**, So before removing *stop words* check that all the values in column are of string type. [See the Docs](https://radimrehurek.com/gensim/parsing/preprocessing.html#gensim.parsing.preprocessing.remove_stopword...
18,160,456
I would like to know if there is an API I can use to get a LinkShare merchant domain URL. The merchant search endpoint only returns their `uid` and `name`.
2013/08/10
['https://Stackoverflow.com/questions/18160456', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/83475/']
According to the Linkshare help docs you can get a list of default URLs for all advertisers in your program (by joining data from two APIs), but those will still be affiliate links on Linkshare redirect domains. You would then need to write a script to visit those links and return the final destination URL, then grab t...
This is a duplicate of [this Stack Overflow question](https://stackoverflow.com/questions/16973780/how-to-programmatically-get-a-list-of-my-linkshare-merchants-from-linkshare/16973781#16973781) this is what worked for me: The following URL will allow you to get a list of merchants with data that you have permission to...
6,669,596
I'm trying to map certain routes so that auto generated Urls will look like `Admin/controller/action/param` for both of these code blocks, `@Url.Action("action","controller",new{id="param"})` and `@Url.Action("action","controller",new{type="param"})` What I did was the following in the area registration, ``` context....
2011/07/12
['https://Stackoverflow.com/questions/6669596', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/219933/']
Have you tried removing the Optional default value on id ? In this case, the first route shouldn't match when providing only the type parameter. EDIT: After reading again your question, my solution doesn't keep your first route intact ...
You only need the one route. ``` context.MapRoute("Admin_default", "Admin/{action}/{id}", new { action = "Index", id = UrlParameter.Optional }, new string[] { "namespaces" }); ``` in your controller you URLs: <http://we...
6,669,596
I'm trying to map certain routes so that auto generated Urls will look like `Admin/controller/action/param` for both of these code blocks, `@Url.Action("action","controller",new{id="param"})` and `@Url.Action("action","controller",new{type="param"})` What I did was the following in the area registration, ``` context....
2011/07/12
['https://Stackoverflow.com/questions/6669596', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/219933/']
> > when parameter name is id, url generated is as expected, but when > parameter name is type, instead of controller/action/typevalue, it > generates something like controller/action/?type=typevalue > > > That happens because first route is used to map the url (id is optional). You could try adding some constr...
Have you tried removing the Optional default value on id ? In this case, the first route shouldn't match when providing only the type parameter. EDIT: After reading again your question, my solution doesn't keep your first route intact ...
6,669,596
I'm trying to map certain routes so that auto generated Urls will look like `Admin/controller/action/param` for both of these code blocks, `@Url.Action("action","controller",new{id="param"})` and `@Url.Action("action","controller",new{type="param"})` What I did was the following in the area registration, ``` context....
2011/07/12
['https://Stackoverflow.com/questions/6669596', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/219933/']
> > when parameter name is id, url generated is as expected, but when > parameter name is type, instead of controller/action/typevalue, it > generates something like controller/action/?type=typevalue > > > That happens because first route is used to map the url (id is optional). You could try adding some constr...
You only need the one route. ``` context.MapRoute("Admin_default", "Admin/{action}/{id}", new { action = "Index", id = UrlParameter.Optional }, new string[] { "namespaces" }); ``` in your controller you URLs: <http://we...
18,378,506
I need to get an appropriate table size according to a text in a header. It contains abbreviations of czech names of days like: "Po", "Út", "St", atc. but instead of this three dots are displayed. I have this code: `width`, `height` - max of all minimum row/column sizes `allWidth`,`allHeight` - should be the total...
2013/08/22
['https://Stackoverflow.com/questions/18378506', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2158784/']
you can to get this one ![enter image description here](https://i.stack.imgur.com/rzw8F.jpg) by * `f.pack()` before `f.setVisible(true);` * desired widht should be at 22 / 23 pixelx but `component.getPreferredSize(`) or `SwingUtilities#computeStringWidth(FontMetrics fm, String str)` returns only 17 / 18 and plus `t...
I came to solution :-) I had to change the look and feel before I calculated appropriate column widths. When I did it the other way around, the calculation was out of date. So I only needed to set the correct widths like this: ``` table.getColumnModel().getColumn(col).setPreferredWidth(width); ``` And then change ...
18,378,506
I need to get an appropriate table size according to a text in a header. It contains abbreviations of czech names of days like: "Po", "Út", "St", atc. but instead of this three dots are displayed. I have this code: `width`, `height` - max of all minimum row/column sizes `allWidth`,`allHeight` - should be the total...
2013/08/22
['https://Stackoverflow.com/questions/18378506', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2158784/']
you can to get this one ![enter image description here](https://i.stack.imgur.com/rzw8F.jpg) by * `f.pack()` before `f.setVisible(true);` * desired widht should be at 22 / 23 pixelx but `component.getPreferredSize(`) or `SwingUtilities#computeStringWidth(FontMetrics fm, String str)` returns only 17 / 18 and plus `t...
This is fantastic code to auto-fit your header and cell content in the JTable: ``` jTable1.setAutoResizeMode(JTable.AUTO_RESIZE_OFF ); for (int column = 0; column < jTable1.getColumnCount(); column++){ TableColumn tableColumn = jTable1.getColumnModel().getColumn(column); int preferredWidth = tableColumn.getMi...
18,378,506
I need to get an appropriate table size according to a text in a header. It contains abbreviations of czech names of days like: "Po", "Út", "St", atc. but instead of this three dots are displayed. I have this code: `width`, `height` - max of all minimum row/column sizes `allWidth`,`allHeight` - should be the total...
2013/08/22
['https://Stackoverflow.com/questions/18378506', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2158784/']
This is fantastic code to auto-fit your header and cell content in the JTable: ``` jTable1.setAutoResizeMode(JTable.AUTO_RESIZE_OFF ); for (int column = 0; column < jTable1.getColumnCount(); column++){ TableColumn tableColumn = jTable1.getColumnModel().getColumn(column); int preferredWidth = tableColumn.getMi...
I came to solution :-) I had to change the look and feel before I calculated appropriate column widths. When I did it the other way around, the calculation was out of date. So I only needed to set the correct widths like this: ``` table.getColumnModel().getColumn(col).setPreferredWidth(width); ``` And then change ...
9,320,027
I have an applet (Applet, not JApplet) that has a lot of classes organized into packages, including the applet itself. I have looked everywhere for how to use that jar as an applet. It is not runnable and has a manifest file like such: ``` Manifest-Version: 1.0 Class-Path: AppletSource.jar ``` I put it in an html (G...
2012/02/16
['https://Stackoverflow.com/questions/9320027', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/920628/']
try ``` <applet code="Game.Game" archive="Game.jar" width=800 height=600> Your browser needs JAVA!!! </applet> ``` Also check that the package name is really **Game** and not **game**.
The format for the applet code attribute is from oracle doc "The value appletFile can be of the form classname.class or of the form packagename.classname.class.". This file is relative to the base URL of the applet. It cannot be absolute. Also try adding the jar in the same directory as the html. For some further info...
7,017,809
i m trying to do a loop but get stacked , i have a function that convert facebook id to facebook name , by the facebook api. name is getName(). on the other hand i have an arra with ids . name is $receivers. the count of the total receivers $totalreceivers . i want to show names of receivers according to the ids s...
2011/08/10
['https://Stackoverflow.com/questions/7017809', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/888300/']
The inner foreach loop seems to be entirely redundant. Try something like: ``` $names = array(); for ($i = 0; $i < $totalReceivers; $i++) { $names[] = getName($receivers[$i]); } ``` Doing a `print_r($names)` afterwards should show you the results of the loop, assuming your getNames function is working properly.
Depending of the content of the `$receivers` array try either ``` foreach ($receivers as $value){ echo getName($value) ; } ``` or ``` foreach ($receivers as $key => $value){ echo getName($key) ; } ```
48,310,337
I am completing the 57 programming exercises book by Brian P. Hogan. With most of these exercises, I've tried to develop a GUI. In the following exercise, I want to calculate the Simple Interest of a Principal value over a period of years. Simply put: ``` var yearlyInterest = Principal * (Percentage(whole number) /=...
2018/01/17
['https://Stackoverflow.com/questions/48310337', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5527137/']
You need to get the values of all the inputs, not just the one that the user is currently typing in. Define a single function that does this, and add it as an event listener for all 3 inputs. ```js var principal = document.querySelector(".principal"); var percentage = document.querySelector(".percentage"); var time = ...
Create function to calculate, and call this function instead of just executing some code. Something like that: ```js var principal = document.getElementsByClassName("principal") var percentage = document.getElementsByClassName("percentage") var time = document.getElementsByClassName("time") var output = document.query...
94,754
I need to join a vertex to edge, with *snap to edge* i can snap my vertex on the edge but i don't know how to join it. Now my solution is: 1. snap vertex to edge 2. subdivide edge (this creates a new vertex on the edge) 3. merge the two vertices But i think is too elaborate, so i look for a simpler solution. [![ent...
2017/11/19
['https://blender.stackexchange.com/questions/94754', 'https://blender.stackexchange.com', 'https://blender.stackexchange.com/users/48600/']
Subdivide is a bad option in your situation because you get more verticals than you need. The fastest way, in my opinion, is to manage this with a loop cut. 1. Loop Cut `CTRL`+`R` and slide to the position where you want to connect your vertex 2. Select your vertices and merge `ALT`+`M` them [![enter image descripti...
If i understood the question maybe a quick solution. Download the [addon Snap utilities](https://github.com/Mano-Wii/Addon-Snap-Utilities-Line/blob/master/mesh_snap_utilities_line.py) Press `T` in toolshelf -> Snap utilities -> Select the single verts and click on the line from the addon and draw the line from vert...
30,438,899
I have a service implemented using Jersey that write/read from a JSON file and I have a test file extending JerseyTest class for testing that service. What I am trying to do is when running the test it write/read in a different file (with '\_test' in name). That way I don't have the values changed from the main file. ...
2015/05/25
['https://Stackoverflow.com/questions/30438899', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2249074/']
**1. HomeController.cs** ``` public class HomeController : Controller { MVCDbContext _db = new MVCDbContext(); public ActionResult Index() { return View(_db.Model1.ToList()); } [HttpGet] public ActionResult add(Model1 objmo,int?id) { if (id == null) { re...
You can start with sample project from codeproject <http://www.codeproject.com/Articles/875859/Insert-Update-and-Delete-MVC-WebGrid-Data-using-JQ>
30,438,899
I have a service implemented using Jersey that write/read from a JSON file and I have a test file extending JerseyTest class for testing that service. What I am trying to do is when running the test it write/read in a different file (with '\_test' in name). That way I don't have the values changed from the main file. ...
2015/05/25
['https://Stackoverflow.com/questions/30438899', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2249074/']
**1. HomeController.cs** ``` public class HomeController : Controller { MVCDbContext _db = new MVCDbContext(); public ActionResult Index() { return View(_db.Model1.ToList()); } [HttpGet] public ActionResult add(Model1 objmo,int?id) { if (id == null) { re...
Read this article : [How to Implement Insert, Update, Delete Functionality in Single View of ASP.Net MVC?](http://www.c-sharpcorner.com/UploadFile/bd8b0b/how-to-implement-insert-update-delete-functionality-in-singl/)
38,881,314
Trying to put the last 24hrs of data into a CSV file and getting using tweepy for python ``` Traceback (most recent call last): File "**", line 74, in <module> get_all_tweets("BQ") File "**", line 66, in get_all_tweets writer.writerows(outtweets) File "C:\Users\Barry\AppData\Local\Programs\Python\Python35-32\lib\encod...
2016/08/10
['https://Stackoverflow.com/questions/38881314', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/6230786/']
Your problem is with the characters in some tweets. You're not able to write them to the file you open. If you replace this line ``` with open('%s_tweets.csv' % screen_name, 'w') as f: ``` with this: ``` with open('%s_tweets.csv' % screen_name, mode='w', encoding='utf-8') as f: ``` it should work. Please note tha...
It seems that the character is something that cannot be encoded into utf-8. While it may be useful to view the tweet in question that triggered the error, you can prevent such an error in the future by changing `tweet.text.encode("utf-8")` to either `tweet.text.encode("utf-8", "ignore")`, `tweet.text.encode("utf-8", "r...
13,756,162
PLease help! This is what I have so far: <http://beauxlent.com/nicole> When you click "one" "two" or "three", it takes you to a div that is still on the same page. However, I would like the div to stay within the right div and still on the same page used #tags. I've seen this done before. ``` <style type="text/css"> ...
2012/12/07
['https://Stackoverflow.com/questions/13756162', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1880756/']
Tabbings you mean. This can be done too in CSS. Try to check it here -> <http://css-tricks.com/functional-css-tabs-revisited/> HTML code: ``` <div class="tab"> <input type="radio" id="tab-1" name="tab-group-1" checked> <label for="tab-1">Tab One</label> <div class="content"> stuff ...
Take a look at [jQuery UI Tabs](http://jqueryui.com/tabs/) - very easy to implement. **Include** ``` <link rel="stylesheet" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" /> <script src="http://code.jquery.com/jquery-1.8.3.js"></script> <script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></sc...
145,250
If I run `history`, I can see my latest executed commands. But if I do `tail -f $HISTFILE` or `tail -f ~/.bash_history`, they do not get listed. Does the file get locked, is there a temporary location or something similar?
2014/07/18
['https://unix.stackexchange.com/questions/145250', 'https://unix.stackexchange.com', 'https://unix.stackexchange.com/users/57143/']
(Not an answer but I cannot add comments) If you are checking `.bash_history` because you just want delete a specific command (e.g. containing a password in clear), you can directly delete the entry in memory by `history -d <entry_id>`. For example, supposing an output like: ``` $ history 926 ll 927 cd .. 928 exp...
Commands are saved in memory (RAM) while your session is active. As soon as you close the shell, the commands list gets written to `.bash_history` before shutdown. Thus, you won't see history of current session in `.bash_history`.
145,250
If I run `history`, I can see my latest executed commands. But if I do `tail -f $HISTFILE` or `tail -f ~/.bash_history`, they do not get listed. Does the file get locked, is there a temporary location or something similar?
2014/07/18
['https://unix.stackexchange.com/questions/145250', 'https://unix.stackexchange.com', 'https://unix.stackexchange.com/users/57143/']
(Not an answer but I cannot add comments) If you are checking `.bash_history` because you just want delete a specific command (e.g. containing a password in clear), you can directly delete the entry in memory by `history -d <entry_id>`. For example, supposing an output like: ``` $ history 926 ll 927 cd .. 928 exp...
bash keeps it in working memory, bash can be configured to save it when bash closes or after each command, and to be loaded when bash starts or on request. If you configure to save after each command, then consider the implications of having multiple bash running at same time. (command lines will be interleaved)
145,250
If I run `history`, I can see my latest executed commands. But if I do `tail -f $HISTFILE` or `tail -f ~/.bash_history`, they do not get listed. Does the file get locked, is there a temporary location or something similar?
2014/07/18
['https://unix.stackexchange.com/questions/145250', 'https://unix.stackexchange.com', 'https://unix.stackexchange.com/users/57143/']
Bash maintains the list of commands internally in memory while it's running. They are written into [`.bash_history` on exit](https://www.gnu.org/software/bash/manual/bashref.html#Bash-History-Facilities): > > When an interactive shell exits, the last $HISTSIZE lines are copied from the history list to the file named ...
(Not an answer but I cannot add comments) If you are checking `.bash_history` because you just want delete a specific command (e.g. containing a password in clear), you can directly delete the entry in memory by `history -d <entry_id>`. For example, supposing an output like: ``` $ history 926 ll 927 cd .. 928 exp...
145,250
If I run `history`, I can see my latest executed commands. But if I do `tail -f $HISTFILE` or `tail -f ~/.bash_history`, they do not get listed. Does the file get locked, is there a temporary location or something similar?
2014/07/18
['https://unix.stackexchange.com/questions/145250', 'https://unix.stackexchange.com', 'https://unix.stackexchange.com/users/57143/']
bash keeps it in working memory, bash can be configured to save it when bash closes or after each command, and to be loaded when bash starts or on request. If you configure to save after each command, then consider the implications of having multiple bash running at same time. (command lines will be interleaved)
Commands are saved in memory (RAM) while your session is active. As soon as you close the shell, the commands list gets written to `.bash_history` before shutdown. Thus, you won't see history of current session in `.bash_history`.
145,250
If I run `history`, I can see my latest executed commands. But if I do `tail -f $HISTFILE` or `tail -f ~/.bash_history`, they do not get listed. Does the file get locked, is there a temporary location or something similar?
2014/07/18
['https://unix.stackexchange.com/questions/145250', 'https://unix.stackexchange.com', 'https://unix.stackexchange.com/users/57143/']
Commands are saved in memory (RAM) while your session is active. As soon as you close the shell, the commands list gets written to `.bash_history` before shutdown. Thus, you won't see history of current session in `.bash_history`.
The easiest way to find where your bash history is stored is with this: `echo $HISTFILE`
145,250
If I run `history`, I can see my latest executed commands. But if I do `tail -f $HISTFILE` or `tail -f ~/.bash_history`, they do not get listed. Does the file get locked, is there a temporary location or something similar?
2014/07/18
['https://unix.stackexchange.com/questions/145250', 'https://unix.stackexchange.com', 'https://unix.stackexchange.com/users/57143/']
While running, the history is kept only in memory (by default) if: * set -o history (an `H` in `echo "$-"`) is set. * HISTSIZE is not `0` **and** * HISTIGNORE is not `*` (or some other very restrictive pattern). If any of the above fail, no history is stored in memory and consequently no history could or will be writ...
The easiest way to find where your bash history is stored is with this: `echo $HISTFILE`
145,250
If I run `history`, I can see my latest executed commands. But if I do `tail -f $HISTFILE` or `tail -f ~/.bash_history`, they do not get listed. Does the file get locked, is there a temporary location or something similar?
2014/07/18
['https://unix.stackexchange.com/questions/145250', 'https://unix.stackexchange.com', 'https://unix.stackexchange.com/users/57143/']
Bash maintains the list of commands internally in memory while it's running. They are written into [`.bash_history` on exit](https://www.gnu.org/software/bash/manual/bashref.html#Bash-History-Facilities): > > When an interactive shell exits, the last $HISTSIZE lines are copied from the history list to the file named ...
The easiest way to find where your bash history is stored is with this: `echo $HISTFILE`
145,250
If I run `history`, I can see my latest executed commands. But if I do `tail -f $HISTFILE` or `tail -f ~/.bash_history`, they do not get listed. Does the file get locked, is there a temporary location or something similar?
2014/07/18
['https://unix.stackexchange.com/questions/145250', 'https://unix.stackexchange.com', 'https://unix.stackexchange.com/users/57143/']
Bash maintains the list of commands internally in memory while it's running. They are written into [`.bash_history` on exit](https://www.gnu.org/software/bash/manual/bashref.html#Bash-History-Facilities): > > When an interactive shell exits, the last $HISTSIZE lines are copied from the history list to the file named ...
While running, the history is kept only in memory (by default) if: * set -o history (an `H` in `echo "$-"`) is set. * HISTSIZE is not `0` **and** * HISTIGNORE is not `*` (or some other very restrictive pattern). If any of the above fail, no history is stored in memory and consequently no history could or will be writ...
145,250
If I run `history`, I can see my latest executed commands. But if I do `tail -f $HISTFILE` or `tail -f ~/.bash_history`, they do not get listed. Does the file get locked, is there a temporary location or something similar?
2014/07/18
['https://unix.stackexchange.com/questions/145250', 'https://unix.stackexchange.com', 'https://unix.stackexchange.com/users/57143/']
(Not an answer but I cannot add comments) If you are checking `.bash_history` because you just want delete a specific command (e.g. containing a password in clear), you can directly delete the entry in memory by `history -d <entry_id>`. For example, supposing an output like: ``` $ history 926 ll 927 cd .. 928 exp...
The easiest way to find where your bash history is stored is with this: `echo $HISTFILE`
145,250
If I run `history`, I can see my latest executed commands. But if I do `tail -f $HISTFILE` or `tail -f ~/.bash_history`, they do not get listed. Does the file get locked, is there a temporary location or something similar?
2014/07/18
['https://unix.stackexchange.com/questions/145250', 'https://unix.stackexchange.com', 'https://unix.stackexchange.com/users/57143/']
Bash maintains the list of commands internally in memory while it's running. They are written into [`.bash_history` on exit](https://www.gnu.org/software/bash/manual/bashref.html#Bash-History-Facilities): > > When an interactive shell exits, the last $HISTSIZE lines are copied from the history list to the file named ...
Commands are saved in memory (RAM) while your session is active. As soon as you close the shell, the commands list gets written to `.bash_history` before shutdown. Thus, you won't see history of current session in `.bash_history`.
320,377
I was moving a couple of physical volumes from my lvm. I managed to successfully pvmove and pvremove them. After this i was moving some files from the lvm to one of the removed pvs. Now during this my system hang up and i had to reboot. But once i rebooted i find that the superblock is corrupted on the lvm. Here is the...
2011/08/08
['https://superuser.com/questions/320377', 'https://superuser.com', 'https://superuser.com/users/71178/']
Take a look at [TestDisk](http://www.cgsecurity.org/wiki/TestDisk). You can get it pre-installed with several live rescue cds, or install it from the repo while running a normal live-cd.
Try the below url, hope this will help you <http://www.digitalinux.com/2010/11/lvm-logical-volume-manager.html>
27,884,209
I am attempting to use PHP's `printf` function to print out a user's storage capacity. The full formula looks something like this: ``` echo printf("%.02f", ($size/(1024*1024))) . " GB"; ``` Given that `$size == (10 * 1024 * 1024)`, this should print out > > 10.00 GB > > > But it doesn't. It prints `10.04 GB`....
2015/01/11
['https://Stackoverflow.com/questions/27884209', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/892629/']
So apparently `printf` is not meant to be echoed. At all. Simply changing the instances of `printf` to `sprintf` fixed that problem. --- Furthermore, removing the echo, and just running the command as `printf("%.02f", 10)` does, in fact, print `10.00`, however, it should be noted that you cannot append strings to pr...
This is to deep, But I will try to explain: ``` echo printf("%d", 10) ``` TL>TR: When `echo` is called with an expression, it first evaluate all of the params, then displays the result on the screen. If some of the expressions print something on the screen when evaluated, you get a this mess. First thing that happe...
247,136
How do I add a class to the form element of the search block form? I mean, add a class to this element: ``` <form action="/search/node" method="get" id="search-block-form" accept-charset="UTF-8" data-drupal-form-fields="edit-keys"></form> ``` I've tried: ``` function mytheme_form_alter(&$form, $form_state, $form_i...
2017/10/01
['https://drupal.stackexchange.com/questions/247136', 'https://drupal.stackexchange.com', 'https://drupal.stackexchange.com/users/14968/']
Just tested this and `$node->access('update');` works for me. I let the optional $account parameter out so that it would check the currently logged in user. The only difference was that I loaded my node with: ``` \Drupal\node\Entity\Node::load($nid); ``` To just use `Node::load($nid);` Make sure to include: ``` us...
As Rubix05 mentions, the issue is that you are testing "edit" access when you should be testing "update" access. ``` $node = Node::load(1); $account = User::load(1); $check = $node->access('update', $account); ```
36,906,926
I am using the below code in which I am clearing the data inside datatable. And now I need to attach a new data to existing datatable. ``` var dataTable = $('#mytable').DataTable(); dataTable.clear().draw(); var dtt = $('#mytable').DataTable({ "aaData": GlobalTable, paging: false, searching: false, "c...
2016/04/28
['https://Stackoverflow.com/questions/36906926', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2696717/']
Using the [DATEDIFF](https://msdn.microsoft.com/en-us/library/ms189794.aspx) function you will get the difference of two dates/time in Year/Month/Day/Hour/Min/Sec as you required. Eg:- `DATEDIFF ( MINUTE , startdate , enddate )` --will return the diff in minutes
You can try to use the [DATEDIFF](http://msdn.microsoft.com/en-us/library/ms189794.aspx) function like this: ``` where DATEDIFF(HH,StartWork, EndWork) ```
36,906,926
I am using the below code in which I am clearing the data inside datatable. And now I need to attach a new data to existing datatable. ``` var dataTable = $('#mytable').DataTable(); dataTable.clear().draw(); var dtt = $('#mytable').DataTable({ "aaData": GlobalTable, paging: false, searching: false, "c...
2016/04/28
['https://Stackoverflow.com/questions/36906926', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2696717/']
``` DECLARE @END_DATE TIME = '' , @START_DATE TIME = '' SELECT CONVERT(TIME,DATEADD(MS,DATEDIFF(SS, @START_DATE, @END_DATE )*1000,0),114) ```
You can try to use the [DATEDIFF](http://msdn.microsoft.com/en-us/library/ms189794.aspx) function like this: ``` where DATEDIFF(HH,StartWork, EndWork) ```
19,778,292
I'm making a wordpress template from scratch. I've eliminated many of the files and kept in just the header.php, footer.php, index.php, and style.css to rule out many of my potential problems. I've played with the code, looked up questions, googled for my solution, but I'm not sure why my style isn't being recognized ...
2013/11/04
['https://Stackoverflow.com/questions/19778292', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2951835/']
Add this line in the `<head>` tag ``` <link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" /> ```
Hey you need to specify absolute path to the stylesheets, for example ``` <link type="text/css" rel="stylesheet" href="http://www.yourwebsite.com/wp-content/themes/yourtheme/style.css" /> ``` Also as Matt stated, you can use functions like [get\_stylesheet\_directory\_url()](http://codex.wordpress.org/Function_Refe...
70,638,185
I'm trying to migrate from the now dead Tachyons framework to Tailwindcss. However, there's one block I haven't figured out how to overcome. I use the [jekyll-postscss](https://github.com/mhanberg/jekyll-postcss) Gem to enable postscss processing during `jekyll build`. Things appear to work well with the following set...
2022/01/09
['https://Stackoverflow.com/questions/70638185', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2719660/']
Because the css resource you imported is not in the resolved path, the default resolved path includes: root directory, node\_modules, etc. Other paths can refer to the official documentation [link](https://github.com/postcss/postcss-import). You can try the following methods to solve this problem: 1. Modify the postc...
I used a similar solution to what [Donnie](https://stackoverflow.com/a/73348640/3402925) suggests, but I set the `path` instead of the `addModulesDirectories`, which resolved the issue for me. I didn't try the `addModulesDirectories`, so I don't know whether that might have also worked. ``` module.exports = { ... ...
4,211,509
I created a new xml file, and had an errant ? in it that prevented R.java from regenerating. I tried Cleaning the Project, and Fixing the Project Properties but no luck. Then I realized the XML was creating the R.java from recreating itself, so I deleted the XML file and the R.java was back. Now though, I am getting ...
2010/11/18
['https://Stackoverflow.com/questions/4211509', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/496686/']
Look at the 'import' section of your code. Since you deleted your original R, chances is Eclipse help you to fill in the R as com.android.R instead of com.yourproject.R I also sometimes have problem in Eclipse Resource stuff, sometimes I found turning off and on the "auto buiild" function may help, or simply restartin...
This can happen if .R is imported. Eclipse will automatically add it sometimes when you have difficulty with with R.java
4,211,509
I created a new xml file, and had an errant ? in it that prevented R.java from regenerating. I tried Cleaning the Project, and Fixing the Project Properties but no luck. Then I realized the XML was creating the R.java from recreating itself, so I deleted the XML file and the R.java was back. Now though, I am getting ...
2010/11/18
['https://Stackoverflow.com/questions/4211509', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/496686/']
Look at the 'import' section of your code. Since you deleted your original R, chances is Eclipse help you to fill in the R as com.android.R instead of com.yourproject.R I also sometimes have problem in Eclipse Resource stuff, sometimes I found turning off and on the "auto buiild" function may help, or simply restartin...
first don't bother deleting the R file it not going to make things better only worst lol as you said you some times need to clean the project when you start modifying resources its good to select the root of your project and do a alt+shift+o to reload all ressources then f5 to refresh the tree then clean the project...
63,737,381
I intended to coding" when Listview items appearing and Items appearing " items appearing from **top** or **bottom**. ( using TranslateTo ) but When Listview Viewcell Appearing, or itemsAppearing, i tried to Apply animations. but, higher index of items hiding lower index of items animation. so, lower index items anima...
2020/09/04
['https://Stackoverflow.com/questions/63737381', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/10910681/']
The following worked. Sorry, I cannot provide info on all details since I don't know them :( Maybe somebody else can. deployment.yaml ``` apiVersion: apps/v1 kind: Deployment metadata: name: zipkin labels: app.kubernetes.io/name: zipkin app.kubernetes.io/instance: zipkin app: zipkin spec: replicas: ...
Your service is expecting following labels on pod: ``` selector: app.kubernetes.io/name: zipkin app.kubernetes.io/instance: zipkin app: zipkin ``` Although it looks like you have only one label on zipkin pods: ``` labels: app: zipkin ``` Label selector uses logical AND (&&), and this means that all labe...
267,134
To demonstrate that a set is open, you can show that any element of it is an interior point. That is, for any element $x$ of an open set $S$ there exists some ball of center $x$ and positive radius. Likewise, if you find that all elements of a set are interior points, you can figure that the set is open. What property...
2012/12/29
['https://math.stackexchange.com/questions/267134', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/17622/']
You can’t limit yourself entirely to points of the closed set, because whether a set is closed depends on how it interacts with the surrounding space. For example, $\Bbb Q\times\{0\}$ is a closed subset of $\Bbb Q^2$ but not of $\Bbb R^2$. You don’t, however, have to look just at the complement. > > Let $X$ be a topo...
Well, point-set topology is hardly my métier, but it seems to me that when one speaks of a set being closed, one always has in mind its setting within a larger space. One says (or ought to say), “$K$ is closed in $X$”, because the property of being closed is not intrinsic. Once you understand that, you see that the pr...
267,134
To demonstrate that a set is open, you can show that any element of it is an interior point. That is, for any element $x$ of an open set $S$ there exists some ball of center $x$ and positive radius. Likewise, if you find that all elements of a set are interior points, you can figure that the set is open. What property...
2012/12/29
['https://math.stackexchange.com/questions/267134', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/17622/']
You can’t limit yourself entirely to points of the closed set, because whether a set is closed depends on how it interacts with the surrounding space. For example, $\Bbb Q\times\{0\}$ is a closed subset of $\Bbb Q^2$ but not of $\Bbb R^2$. You don’t, however, have to look just at the complement. > > Let $X$ be a topo...
There is no "intrinsic" property of closedness for sets or spaces $A$. Closedness is *not* a property of sets or of topological spaces, but a property of pairs $(A,X)$ where $X$ is a topological space and $A$ is an arbitrary subset of $X$. The set $A$ is *closed in* $X$ if the properties mentioned in Brian Scott's answ...
48,644,114
I am trying to follow this example in order to understand the join() method: ``` class PrintDemo { public void printCount() { try { for(int i = 5; i > 0; i--) { System.out.println("Counter --- " + i ); } } catch (Exception e) { System.out.println("Thread i...
2018/02/06
['https://Stackoverflow.com/questions/48644114', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2875641/']
You start a thread (A) which starts another thread (B). You wait for thread A to finish - which is almost immediate as it barely does anything besides kick off thread B - but thread B is still running independently.
> > I am trying ... to understand the join() method > > > `t.join()` is trivially easy to understand. All it does is wait for thread `t` to die. It doesn't do anything else. Most especially, it does not do anything to thread `t`. A call to `t.join()` will do nothing, and return immediately if `t` has already fini...
48,644,114
I am trying to follow this example in order to understand the join() method: ``` class PrintDemo { public void printCount() { try { for(int i = 5; i > 0; i--) { System.out.println("Counter --- " + i ); } } catch (Exception e) { System.out.println("Thread i...
2018/02/06
['https://Stackoverflow.com/questions/48644114', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2875641/']
As @Micheal said, your main thread are not joinning to "desire" thread, perhaps this code can help you to clarify. It helps Main thread to join with the inside threads. ``` class PrintDemo { public void printCount() { try { for(int i = 5; i > 0; i--) { System.out.println("Counter ---...
> > I am trying ... to understand the join() method > > > `t.join()` is trivially easy to understand. All it does is wait for thread `t` to die. It doesn't do anything else. Most especially, it does not do anything to thread `t`. A call to `t.join()` will do nothing, and return immediately if `t` has already fini...
69,727,170
I am actually trying to do surface defect detection for the images (checking for defects on the walls like cracks…) when I try to fit the model it throws an error logits and labels must be `broadcastable: logits_size=[32,198] labels_size=[32,3]` I tried a few ways but nothing worked. How do I overcome the error or is ...
2021/10/26
['https://Stackoverflow.com/questions/69727170', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/16297417/']
you have this code as your model top layer ``` prediction = Dense(len(folder_count), activation='softmax')(x) ``` the number of neurons in this layer should be the same as the number of classes you have. Also in model.fit you have ``` steps_per_epoch=len(training_data), validation_steps=len(testing_data)) ``` thi...
Here is the full code that should work for you. ``` import tensorflow as tf import tensorflow as tf from tensorflow import keras from keras.preprocessing.image import ImageDataGenerator from tensorflow.keras.optimizers import Adam from tensorflow.keras.metrics import categorical_crossentropy from tensorflow.keras.mode...
30,723,972
I have an int array called `doubledNumbers` and if a number in this array is greater than 9, I want to add the digits together. (example, 16 would become 1+6=7, 12 would become 3, 14 would become 5, etc) Lets say I had the following numbers in `doubledNumbers`: ``` 12 14 16 17 ``` I want to change the `doubledNumbe...
2015/06/09
['https://Stackoverflow.com/questions/30723972', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3681431/']
There is nothing like decimal digits in an `int`. There are (mostly 32 or 64) *binary* digits (bits) and the base of 2 is not commensurable with the base of 10. You’ll need to divide your numbers by 10 to get decimal digits. ``` unsigned int DigitSum(unsigned int input, unsigned int base = 10) { unsigned int sum =...
``` int A[2]; A[0] = 2; A[1] = 10; for (int i=0;i<2;i++) { if (a[i] > 9) { int b = a[i]%10; int c = a[i]/10; int d = b+c; cout << d; } } ``` It's only for two digit numbers(10 -99) and for more than that (after 99) we will have to change logic.
30,723,972
I have an int array called `doubledNumbers` and if a number in this array is greater than 9, I want to add the digits together. (example, 16 would become 1+6=7, 12 would become 3, 14 would become 5, etc) Lets say I had the following numbers in `doubledNumbers`: ``` 12 14 16 17 ``` I want to change the `doubledNumbe...
2015/06/09
['https://Stackoverflow.com/questions/30723972', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3681431/']
You can use something like this ``` #include <iostream> using namespace std; int sumofdigits(int); int main() { // your code goes here int a[5] ={12,14,15,16,17}; for(int i=0;i<5;i++) { int m=sumofdigits(a[i]); cout <<m<<" "; } return 0; } int sumofdigits(int n) { ...
``` int A[2]; A[0] = 2; A[1] = 10; for (int i=0;i<2;i++) { if (a[i] > 9) { int b = a[i]%10; int c = a[i]/10; int d = b+c; cout << d; } } ``` It's only for two digit numbers(10 -99) and for more than that (after 99) we will have to change logic.
30,723,972
I have an int array called `doubledNumbers` and if a number in this array is greater than 9, I want to add the digits together. (example, 16 would become 1+6=7, 12 would become 3, 14 would become 5, etc) Lets say I had the following numbers in `doubledNumbers`: ``` 12 14 16 17 ``` I want to change the `doubledNumbe...
2015/06/09
['https://Stackoverflow.com/questions/30723972', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3681431/']
``` You can do like this, #include<iostream> #include <string> #include <sstream> using namespace std; int main() { int a[5]={1,2,5,11,12}; int length = sizeof(a)/sizeof(int); for(int i=0;i<length;i++) { if ( a[i] >9 ) { stringstream ss; ss << a[i]; ...
``` int A[2]; A[0] = 2; A[1] = 10; for (int i=0;i<2;i++) { if (a[i] > 9) { int b = a[i]%10; int c = a[i]/10; int d = b+c; cout << d; } } ``` It's only for two digit numbers(10 -99) and for more than that (after 99) we will have to change logic.
30,723,972
I have an int array called `doubledNumbers` and if a number in this array is greater than 9, I want to add the digits together. (example, 16 would become 1+6=7, 12 would become 3, 14 would become 5, etc) Lets say I had the following numbers in `doubledNumbers`: ``` 12 14 16 17 ``` I want to change the `doubledNumbe...
2015/06/09
['https://Stackoverflow.com/questions/30723972', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3681431/']
There is nothing like decimal digits in an `int`. There are (mostly 32 or 64) *binary* digits (bits) and the base of 2 is not commensurable with the base of 10. You’ll need to divide your numbers by 10 to get decimal digits. ``` unsigned int DigitSum(unsigned int input, unsigned int base = 10) { unsigned int sum =...
You can use something like this ``` #include <iostream> using namespace std; int sumofdigits(int); int main() { // your code goes here int a[5] ={12,14,15,16,17}; for(int i=0;i<5;i++) { int m=sumofdigits(a[i]); cout <<m<<" "; } return 0; } int sumofdigits(int n) { ...
30,723,972
I have an int array called `doubledNumbers` and if a number in this array is greater than 9, I want to add the digits together. (example, 16 would become 1+6=7, 12 would become 3, 14 would become 5, etc) Lets say I had the following numbers in `doubledNumbers`: ``` 12 14 16 17 ``` I want to change the `doubledNumbe...
2015/06/09
['https://Stackoverflow.com/questions/30723972', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3681431/']
There is nothing like decimal digits in an `int`. There are (mostly 32 or 64) *binary* digits (bits) and the base of 2 is not commensurable with the base of 10. You’ll need to divide your numbers by 10 to get decimal digits. ``` unsigned int DigitSum(unsigned int input, unsigned int base = 10) { unsigned int sum =...
``` You can do like this, #include<iostream> #include <string> #include <sstream> using namespace std; int main() { int a[5]={1,2,5,11,12}; int length = sizeof(a)/sizeof(int); for(int i=0;i<length;i++) { if ( a[i] >9 ) { stringstream ss; ss << a[i]; ...
30,723,972
I have an int array called `doubledNumbers` and if a number in this array is greater than 9, I want to add the digits together. (example, 16 would become 1+6=7, 12 would become 3, 14 would become 5, etc) Lets say I had the following numbers in `doubledNumbers`: ``` 12 14 16 17 ``` I want to change the `doubledNumbe...
2015/06/09
['https://Stackoverflow.com/questions/30723972', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3681431/']
You can use something like this ``` #include <iostream> using namespace std; int sumofdigits(int); int main() { // your code goes here int a[5] ={12,14,15,16,17}; for(int i=0;i<5;i++) { int m=sumofdigits(a[i]); cout <<m<<" "; } return 0; } int sumofdigits(int n) { ...
``` You can do like this, #include<iostream> #include <string> #include <sstream> using namespace std; int main() { int a[5]={1,2,5,11,12}; int length = sizeof(a)/sizeof(int); for(int i=0;i<length;i++) { if ( a[i] >9 ) { stringstream ss; ss << a[i]; ...
15,446,397
I am adding nested (reddit-like) comments to my app; so far I'm just using `comment` divs, where in my CSS I do this: ``` .comment { margin-left: 40px; } ``` This works fine for displaying comments. My question is what is the cleanest way to now add reply forms to each comment (and only show it when the user click...
2013/03/16
['https://Stackoverflow.com/questions/15446397', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/363078/']
You can do that by having one form field hidden somewhere in the html and when ever user clicks on the commect clone the form element and append it to the comment div checkout this jsFiddle [example](http://jsfiddle.net/jskswamy/p6qFB/) below is the code snippet ``` <div class="comment"> comment1 </div> <div clas...
Keep a template of the form somewhere in your document and keep it hidden. On click of reply next to any comment, do following. 1. Clone the template (you can jquery clone function) 2. Set a hidden field in the template to the id of the comment for which reply is been clicked 3. append it next to comment that need to ...
61,545,026
I've been banging my head on this issue! I have a variable called `repDate` which today is equal to `"5/1/2020"` as a string. I've tried this formula to convert it to a `Long` so I can compare it to a date in the file `rDtLng = CLng(repDate)`. I'm getting error "Type Mismatch" which I am not sure why there would be one...
2020/05/01
['https://Stackoverflow.com/questions/61545026', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/8396248/']
`CLng` expects a numeric input, which the *text-that-looks-like-a-date* `"5/1/2020"` is not. You can convert that to an actual date using `CDate` and then perform mathematical operations on it, including the existing `<` comparison. Though if I understand what your end goal is, you might consider `Range.AutoFilter` w...
Use DateValue() Function. ``` Sub test() Dim myDate As Long Dim str As String str = "5/1/2020" myDate = DateValue(str) If myDate = DateSerial(2020, 5, 1) Then MsgBox "OK" End If End Sub ```
51,322,445
I have a large dataset of which I would like to drop columns that contain `null` values and return a new dataframe. How can I do that? The following only drops a single column or rows containing `null`. ``` df.where(col("dt_mvmt").isNull()) #doesnt work because I do not have all the columns names or for 1000's of col...
2018/07/13
['https://Stackoverflow.com/questions/51322445', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/10020360/']
Here is one possible approach for dropping all columns that have NULL values: See [here](https://stackoverflow.com/questions/44627386/how-to-find-count-of-null-and-nan-values-for-each-column-in-a-pyspark-dataframe) for the source on the code of counting NULL values per column. ``` import pyspark.sql.functions as F # ...
If we need to keep only the rows having at least one inspected column not null then use this. Execution time is very less. ``` from operator import or_ from functools import reduce inspected = df.columns df = df.where(reduce(or_, (F.col(c).isNotNull() for c in inspected ), F.lit(False)))``` ```
48,661,858
I am working with asp .net. I want to send an authentication code to user's email when he sign up. I'm using this code to send email. I'm adding a html file to send. How can I add the authentication code to this HTML file? This is the code which I used to send the html file via Email. So how can I add a `string(authen...
2018/02/07
['https://Stackoverflow.com/questions/48661858', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/-1/']
How about this: If your service is based off of the *microsoft/dotnet* Docker image, create a new dockerfile based on the same image, and install the debugger, ssh and unzip. ``` FROM microsoft/dotnet RUN apt-get update && apt-get -y install openssh-server unzip RUN mkdir /var/run/sshd && chmod 0755 /var/run/sshd R...
As of May 2018, if you are using Visual Studio, you can use their [official support](https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/docker/visual-studio-tools-for-docker?view=aspnetcore-2.1). You just need to have installed Docker and add the support for Docker projects menu *Project* → *Docker support*...
111,196
I am designing a form for a tablet. Typically forms are filled out vertically, but in landscape some fields could be represented on one line to save scrolling. For example: height and weight, or first and last name. My questions are: * Would too many groupings be confusing to users (e.g. gender and birthdate)? * How ...
2017/08/23
['https://ux.stackexchange.com/questions/111196', 'https://ux.stackexchange.com', 'https://ux.stackexchange.com/users/97187/']
Putting input fields next to each other makes them hard to scan for users. Since users like to scan instead of reading putting them below each other makes it far better in terms of usability. There are many articles and studies regarding that, for example you could read: <https://uxplanet.org/designing-more-efficient-...
I think the main scenario where multiple fields on the same line would be where there is a very strong relationship between them. Eg blood pressure. Blood pressure is measured as 2 values that go together Systolic/Diastolic, and both values are small numbers eg 120/80. I could see this being displayed on a single line...
195,718
FP proponents have claimed that concurrency is easy because their paradigm avoids mutable state. I don't get it. Imagine we're creating a multiplayer dungeon crawl (a roguelike) using FP where we emphasize pure functions and immutable data structures. We generate a dungeon composed of rooms, corridors, heroes, monster...
2013/04/22
['https://softwareengineering.stackexchange.com/questions/195718', 'https://softwareengineering.stackexchange.com', 'https://softwareengineering.stackexchange.com/users/88091/']
I'll try to hint on the answer. This is *not* an answer, only an introductory illustration. @jk's answer points to the real thing, zippers. Imagine you have an immutable tree structure. You want to alter one node by inserting a child. As a result, you get a whole new tree. But most of the new tree is exactly the same...
[9000's answer](https://softwareengineering.stackexchange.com/a/195730/31260) is half the answer, persistent data structures allow you to reuse unchanged parts. You may already be thinking however "hey what if I want to change the root of the tree?" as it stands with the example given that now means changing all the ...
195,718
FP proponents have claimed that concurrency is easy because their paradigm avoids mutable state. I don't get it. Imagine we're creating a multiplayer dungeon crawl (a roguelike) using FP where we emphasize pure functions and immutable data structures. We generate a dungeon composed of rooms, corridors, heroes, monster...
2013/04/22
['https://softwareengineering.stackexchange.com/questions/195718', 'https://softwareengineering.stackexchange.com', 'https://softwareengineering.stackexchange.com/users/88091/']
I'll try to hint on the answer. This is *not* an answer, only an introductory illustration. @jk's answer points to the real thing, zippers. Imagine you have an immutable tree structure. You want to alter one node by inserting a child. As a result, you get a whole new tree. But most of the new tree is exactly the same...
Functional style programs create lots of opportunities like that to use concurrency. Anytime you transform or filter or aggregate a collection, and everything is pure or immutable, there's an opportunity for the operation to be sped up by concurrency. For example, suppose you perform AI decisions independently of each...
195,718
FP proponents have claimed that concurrency is easy because their paradigm avoids mutable state. I don't get it. Imagine we're creating a multiplayer dungeon crawl (a roguelike) using FP where we emphasize pure functions and immutable data structures. We generate a dungeon composed of rooms, corridors, heroes, monster...
2013/04/22
['https://softwareengineering.stackexchange.com/questions/195718', 'https://softwareengineering.stackexchange.com', 'https://softwareengineering.stackexchange.com/users/88091/']
I'll try to hint on the answer. This is *not* an answer, only an introductory illustration. @jk's answer points to the real thing, zippers. Imagine you have an immutable tree structure. You want to alter one node by inserting a child. As a result, you get a whole new tree. But most of the new tree is exactly the same...
> > FP proponents have claimed that concurrency is easy because their > paradigm avoids mutable state. I don't get it. > > > I wanted to pitch in about this general question as someone who is a functional neophyte but has been up to my eyeballs in side effects over the years and would like to mitigate them, for a...
195,718
FP proponents have claimed that concurrency is easy because their paradigm avoids mutable state. I don't get it. Imagine we're creating a multiplayer dungeon crawl (a roguelike) using FP where we emphasize pure functions and immutable data structures. We generate a dungeon composed of rooms, corridors, heroes, monster...
2013/04/22
['https://softwareengineering.stackexchange.com/questions/195718', 'https://softwareengineering.stackexchange.com', 'https://softwareengineering.stackexchange.com/users/88091/']
Listening to a few Rich Hickey talks -- [this one](http://www.infoq.com/presentations/Value-Identity-State-Rich-Hickey) in particular -- alleviated my confusion. In one he indicated that it is okay that concurrent processes may not have the most current state. I needed to hear that. What I was having trouble digesting ...
[9000's answer](https://softwareengineering.stackexchange.com/a/195730/31260) is half the answer, persistent data structures allow you to reuse unchanged parts. You may already be thinking however "hey what if I want to change the root of the tree?" as it stands with the example given that now means changing all the ...
195,718
FP proponents have claimed that concurrency is easy because their paradigm avoids mutable state. I don't get it. Imagine we're creating a multiplayer dungeon crawl (a roguelike) using FP where we emphasize pure functions and immutable data structures. We generate a dungeon composed of rooms, corridors, heroes, monster...
2013/04/22
['https://softwareengineering.stackexchange.com/questions/195718', 'https://softwareengineering.stackexchange.com', 'https://softwareengineering.stackexchange.com/users/88091/']
[9000's answer](https://softwareengineering.stackexchange.com/a/195730/31260) is half the answer, persistent data structures allow you to reuse unchanged parts. You may already be thinking however "hey what if I want to change the root of the tree?" as it stands with the example given that now means changing all the ...
> > FP proponents have claimed that concurrency is easy because their > paradigm avoids mutable state. I don't get it. > > > I wanted to pitch in about this general question as someone who is a functional neophyte but has been up to my eyeballs in side effects over the years and would like to mitigate them, for a...
195,718
FP proponents have claimed that concurrency is easy because their paradigm avoids mutable state. I don't get it. Imagine we're creating a multiplayer dungeon crawl (a roguelike) using FP where we emphasize pure functions and immutable data structures. We generate a dungeon composed of rooms, corridors, heroes, monster...
2013/04/22
['https://softwareengineering.stackexchange.com/questions/195718', 'https://softwareengineering.stackexchange.com', 'https://softwareengineering.stackexchange.com/users/88091/']
Listening to a few Rich Hickey talks -- [this one](http://www.infoq.com/presentations/Value-Identity-State-Rich-Hickey) in particular -- alleviated my confusion. In one he indicated that it is okay that concurrent processes may not have the most current state. I needed to hear that. What I was having trouble digesting ...
Functional style programs create lots of opportunities like that to use concurrency. Anytime you transform or filter or aggregate a collection, and everything is pure or immutable, there's an opportunity for the operation to be sped up by concurrency. For example, suppose you perform AI decisions independently of each...
195,718
FP proponents have claimed that concurrency is easy because their paradigm avoids mutable state. I don't get it. Imagine we're creating a multiplayer dungeon crawl (a roguelike) using FP where we emphasize pure functions and immutable data structures. We generate a dungeon composed of rooms, corridors, heroes, monster...
2013/04/22
['https://softwareengineering.stackexchange.com/questions/195718', 'https://softwareengineering.stackexchange.com', 'https://softwareengineering.stackexchange.com/users/88091/']
Functional style programs create lots of opportunities like that to use concurrency. Anytime you transform or filter or aggregate a collection, and everything is pure or immutable, there's an opportunity for the operation to be sped up by concurrency. For example, suppose you perform AI decisions independently of each...
> > FP proponents have claimed that concurrency is easy because their > paradigm avoids mutable state. I don't get it. > > > I wanted to pitch in about this general question as someone who is a functional neophyte but has been up to my eyeballs in side effects over the years and would like to mitigate them, for a...
195,718
FP proponents have claimed that concurrency is easy because their paradigm avoids mutable state. I don't get it. Imagine we're creating a multiplayer dungeon crawl (a roguelike) using FP where we emphasize pure functions and immutable data structures. We generate a dungeon composed of rooms, corridors, heroes, monster...
2013/04/22
['https://softwareengineering.stackexchange.com/questions/195718', 'https://softwareengineering.stackexchange.com', 'https://softwareengineering.stackexchange.com/users/88091/']
Listening to a few Rich Hickey talks -- [this one](http://www.infoq.com/presentations/Value-Identity-State-Rich-Hickey) in particular -- alleviated my confusion. In one he indicated that it is okay that concurrent processes may not have the most current state. I needed to hear that. What I was having trouble digesting ...
> > FP proponents have claimed that concurrency is easy because their > paradigm avoids mutable state. I don't get it. > > > I wanted to pitch in about this general question as someone who is a functional neophyte but has been up to my eyeballs in side effects over the years and would like to mitigate them, for a...
2,442,017
I'm new to the Measure Theory. I was wondering can we always find a measure for a measurable space? It would be better to explain in details.
2017/09/23
['https://math.stackexchange.com/questions/2442017', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/439544/']
There's always the measure that maps every subset to $0$. If you mean a probability measure then it also exists, pick $x\in X$ and define $f(A)=1$ if $x\in A$ and $0$ otherwise. This is called a Dirac measure.
A *measurable space* is just a pair $(X,\mathcal{M})$, where $X$ is a set and $\mathcal{M}\subseteq\mathscr{P}(X)$ is a $\sigma$-algebra on $X$. The purpose of this definition is just to identify a $\sigma$-algebra on $X$, which is the collection of all measurable subsets of $X$. For any given set $X$, there are sever...
2,442,017
I'm new to the Measure Theory. I was wondering can we always find a measure for a measurable space? It would be better to explain in details.
2017/09/23
['https://math.stackexchange.com/questions/2442017', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/439544/']
There's always the measure that maps every subset to $0$. If you mean a probability measure then it also exists, pick $x\in X$ and define $f(A)=1$ if $x\in A$ and $0$ otherwise. This is called a Dirac measure.
To construct a probability measure on any measurable space $(\Omega,\tau)$, consider the Dirac measure P: For any $A\in \tau$ $$P(A) = \begin{cases} 1 & \text{$A\ni x$}, \\ 0 & \text{otherwise}. \end{cases}$$ Choice $x\in \Omega$ such that: $\exists B\in \tau, B\ni x $. Then $(\Omega,\tau,P)$ is a probability space, P ...
2,442,017
I'm new to the Measure Theory. I was wondering can we always find a measure for a measurable space? It would be better to explain in details.
2017/09/23
['https://math.stackexchange.com/questions/2442017', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/439544/']
A *measurable space* is just a pair $(X,\mathcal{M})$, where $X$ is a set and $\mathcal{M}\subseteq\mathscr{P}(X)$ is a $\sigma$-algebra on $X$. The purpose of this definition is just to identify a $\sigma$-algebra on $X$, which is the collection of all measurable subsets of $X$. For any given set $X$, there are sever...
To construct a probability measure on any measurable space $(\Omega,\tau)$, consider the Dirac measure P: For any $A\in \tau$ $$P(A) = \begin{cases} 1 & \text{$A\ni x$}, \\ 0 & \text{otherwise}. \end{cases}$$ Choice $x\in \Omega$ such that: $\exists B\in \tau, B\ni x $. Then $(\Omega,\tau,P)$ is a probability space, P ...
36,372,912
I want to convert my date in to **MM/dd/yyyy** format.i use following code for converting date ``` string NewDateFormat = Convert.ToDateTime(Mydate, englishCulture).ToString("MM/dd/yyyy", englishCulture); ``` but the result is comes like this **04-02-2016** i want to having result in **04/02/2016** in string vari...
2016/04/02
['https://Stackoverflow.com/questions/36372912', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4776191/']
Try using single quotes around the [delimiters](https://msdn.microsoft.com/en-us/library/8kb3ddd4%28v=vs.110%29.aspx#dateSeparator) ``` string NewDateFormat = Convert.ToDateTime(Mydate, englishCulture).ToString("MM'/'dd'/'yyyy", englishCulture); ``` Alternatively, ``` CultureInfo culture = CultureInfo.CreateSpecifi...
Use DateSeparator property of DateTimeFormatInfo. For more details: <https://msdn.microsoft.com/en-us/library/ms130987(v=vs.110).aspx> ``` CultureInfo culture = CultureInfo.CreateSpecificCulture("en-UK"); DateTimeFormatInfo dtfi = culture.DateTimeFormat; dtfi.DateSeparator = "/"; strin...
36,372,912
I want to convert my date in to **MM/dd/yyyy** format.i use following code for converting date ``` string NewDateFormat = Convert.ToDateTime(Mydate, englishCulture).ToString("MM/dd/yyyy", englishCulture); ``` but the result is comes like this **04-02-2016** i want to having result in **04/02/2016** in string vari...
2016/04/02
['https://Stackoverflow.com/questions/36372912', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4776191/']
try this.. ``` string NewDateFormat = Convert.ToDateTime(Mydate, englishCulture).ToString("MM'/'dd'/'yyyy", CultureInfo.InvariantCulture); ```
Try using single quotes around the [delimiters](https://msdn.microsoft.com/en-us/library/8kb3ddd4%28v=vs.110%29.aspx#dateSeparator) ``` string NewDateFormat = Convert.ToDateTime(Mydate, englishCulture).ToString("MM'/'dd'/'yyyy", englishCulture); ``` Alternatively, ``` CultureInfo culture = CultureInfo.CreateSpecifi...
36,372,912
I want to convert my date in to **MM/dd/yyyy** format.i use following code for converting date ``` string NewDateFormat = Convert.ToDateTime(Mydate, englishCulture).ToString("MM/dd/yyyy", englishCulture); ``` but the result is comes like this **04-02-2016** i want to having result in **04/02/2016** in string vari...
2016/04/02
['https://Stackoverflow.com/questions/36372912', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4776191/']
try this.. ``` string NewDateFormat = Convert.ToDateTime(Mydate, englishCulture).ToString("MM'/'dd'/'yyyy", CultureInfo.InvariantCulture); ```
Use DateSeparator property of DateTimeFormatInfo. For more details: <https://msdn.microsoft.com/en-us/library/ms130987(v=vs.110).aspx> ``` CultureInfo culture = CultureInfo.CreateSpecificCulture("en-UK"); DateTimeFormatInfo dtfi = culture.DateTimeFormat; dtfi.DateSeparator = "/"; strin...
35,144,056
I've problem to click event on Kendo bar chart (seriesClick). I got undefined. Previously, I've do like e.category and its works because of categoryAxis: not in array. But now my code categoryAxis:is in array to avoid overlapping label with bar chart. Actually how do I call if categoryAxis in array. Below is my script:...
2016/02/02
['https://Stackoverflow.com/questions/35144056', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5676150/']
Clearly this relates to your [earlier question](https://stackoverflow.com/questions/35103336/maple-how-to-insert-a-command-to-force-my-code-to-choose-random-integer-values). So I'll try to address both here. You may be get the idea that a "thorough" search grid does better at finding most (or sometimes all) roots, but...
For each 'do' statement (i.e. loop) you need a corresponding 'end do', you only have one. Also you need to terminate statements (e.g. X\_\_0:=[i+j*I,m+n*I]) with a colon or semicolon. E.g., ``` for i from -100.0 to 100.0 do for j from -100.0 to 100.0 do for m from -100.0 to 100.0 do for n from -100.0 to 10...
4,132,955
I have a `Logger` class which is implemented singleton. The class is simple and there are few methods and one `static` property, `Instance`. Like all singleton classes, I access the unique instance via `Logger.Instance` property. I extracted an interface from `Logger` class (using Visual Studio refactor context menu)....
2010/11/09
['https://Stackoverflow.com/questions/4132955', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/313421/']
Did you actually declare that `Logger` implements `ILogger`? ``` public sealed class Logger : ILogger { ... } ``` If so, it should be fine. Please post some code so we can try to diagnose the issue. If not, that's the problem, and it's easily fixed :)
The example you described works fine for me. I made a small example, maybe you see some differences: ``` class Program { static void Main(string[] args) { ILogger logger = Logger.GetLogger(); logger.LogMessage("Hello"); } } public interface ILogger { void LogMessage(string message); } ...
430,943
У того спортсмена был номер "4". Спортсмен под номером "4" первым достиг цели. Номер "4", подойдите, пожалуйста, к стойке регистрации.
2017/03/28
['https://rus.stackexchange.com/questions/430943', 'https://rus.stackexchange.com', 'https://rus.stackexchange.com/users/185870/']
В каких случаях нужны кавычки? В современном русском языке кавычки выполняют следующие функции: 1. Выделение безабзацной прямой речи и цитат. 2. Выделение условных (собственных) наименований. 3. Выделение слов, которые употребляются в необычном, ироническом, особом значении. ([Грамота.ру](http://new.gramota.ru/spravk...
Кавычки не нужны. Иначе все номера писались бы в кавычках. Чем отличается номер спортсмена от номера дома или квартиры?
54,812
On May 28, 1754, a young Lt. Colonel named George Washington [ambushed a French force at Jumonville Glen](https://en.wikipedia.org/wiki/Battle_of_Jumonville_Glen) with assistance from a Iroquois leader named Tanacharison. One of the casualties was the French expedition's leader, [Joseph Coulon de Villiers, Sieur de Jum...
2019/09/30
['https://history.stackexchange.com/questions/54812', 'https://history.stackexchange.com', 'https://history.stackexchange.com/users/16866/']
**Short answer** **George Washington relied on the translation of a mercenary he knew well and who had previously acted as his translator, [Jacob Van Braam](https://en.wikipedia.org/wiki/Jacob_Van_Braam), and did not think he was signing a document in which (the French later claimed) he admitted *assassinating* a Fren...
> > **Question:** > > Why did a young George Washington sign a document admitting to assassinating a French military officer? > > > Because he really had no choice. Fort Necessity was a hastily assembled wooden structure placed in the middle of a meadow. Unfortunately Necessity was built within rifle range of ...
1,645,315
> > For two sequences $a\_n$ and $b\_n$, “If $\{a\_n\}$ and $\{b\_n\}$ are increasing, then $\{a\_nb\_n\}$ is increasing.” Show this is false, make the hypothesis on $\{b\_n\}$ stronger, and prove the amended statement. > > > I was thinking to let both $a\_n$ and $b\_n$ be positive, but it only let me change the h...
2016/02/07
['https://math.stackexchange.com/questions/1645315', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/309006/']
Suppose that $\{a\_n\}$ is increasing, $\{b\_n\}$ is positive and increasing, and that $\{b\_n\}$ also has the following property: > > for all $n$, if $a\_{n+1}<0$ then $b\_{n+1}\le a\_nb\_n/a\_{n+1}$. > > > First check that the conditions on $\{b\_n\}$ are not inconsistent: if $a\_{n+1}<0$ then $a\_n\le a\_{n+1}...
It's possible that there may be an error in the exercise; if you require that the new condition on $b\_n$ be independent of $a\_n$, then you have a problem: For all increasing sequences $b\_n$, there exists a sequence $a\_n$ such that $a\_nb\_n$ is not increasing. One can prove this by cases: If $b\_1$ and $b\_2$ are p...
59,319,987
> > > ``` > id user_id name qty datetime > --- --------- ---- ---- ----------- > 1 1 a 5 2019-12-01 12:26:01 > 2 2 b 3 2019-12-13 12:26:02 > 3 1 c 4 2019-12-13 12:26:03 > 4 2 a 2 2019-12-25 12:26:04 > 5 1 ...
2019/12/13
['https://Stackoverflow.com/questions/59319987', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/11195843/']
**Models:** *Users:* id, name, email, etc... *Orders:* user\_id, qty, name, datetime etc.. **Model Query:** ``` Orders::orderBy('datetime', 'desc')->get()->unique('user_id'); ``` **DB Query** ``` DB::table('orders')->orderBy('datetime', 'desc')->get()->unique('user_id'); ```
In pure SQL, you can filter with a correlated subquery: ``` select t.* from mytable t where t.datetime = ( select max(t1.datetime) from mytable t1 where t1.user_id = t.user_id ) ```
59,319,987
> > > ``` > id user_id name qty datetime > --- --------- ---- ---- ----------- > 1 1 a 5 2019-12-01 12:26:01 > 2 2 b 3 2019-12-13 12:26:02 > 3 1 c 4 2019-12-13 12:26:03 > 4 2 a 2 2019-12-25 12:26:04 > 5 1 ...
2019/12/13
['https://Stackoverflow.com/questions/59319987', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/11195843/']
**Models:** *Users:* id, name, email, etc... *Orders:* user\_id, qty, name, datetime etc.. **Model Query:** ``` Orders::orderBy('datetime', 'desc')->get()->unique('user_id'); ``` **DB Query** ``` DB::table('orders')->orderBy('datetime', 'desc')->get()->unique('user_id'); ```
or an uncorrelated subquery... ``` select x.* from mytable x join ( select user_id, max(t1.datetime) datetime from mytable group by user_id ) y on y.user_id = x.user_id and y.datetime = x.datetime ```
293,885
Please note that I asked the same question on [stackoverflow](https://stackoverflow.com/questions/32049022/application-logic-vs-business-logic) but they directed me to ask here. While I am trying to discerne the difference between the application logic and business logic I have found set of articles but unfortunately ...
2015/08/17
['https://softwareengineering.stackexchange.com/questions/293885', 'https://softwareengineering.stackexchange.com', 'https://softwareengineering.stackexchange.com/users/192185/']
I agree with SO's LoztInSpace that this is quite opinionated answer and that everyone can have slightly different definitions. Especially if historical influences are involved. This is how I would define the terms: Business logic is logic, that is created with collaboration and agreement with business experts. If busi...
Na, they're just different terms for the same thing - the "middle tier" of program code that does the things you want your program to perform. Like many things in software, there are no hard-and-fast terminology for pieces of a system, as there are no single formal definitions for building systems. So sometimes people...
293,885
Please note that I asked the same question on [stackoverflow](https://stackoverflow.com/questions/32049022/application-logic-vs-business-logic) but they directed me to ask here. While I am trying to discerne the difference between the application logic and business logic I have found set of articles but unfortunately ...
2015/08/17
['https://softwareengineering.stackexchange.com/questions/293885', 'https://softwareengineering.stackexchange.com', 'https://softwareengineering.stackexchange.com/users/192185/']
I agree with SO's LoztInSpace that this is quite opinionated answer and that everyone can have slightly different definitions. Especially if historical influences are involved. This is how I would define the terms: Business logic is logic, that is created with collaboration and agreement with business experts. If busi...
Every system or application is going to have its own definitions of what is business logic and what is application logic. It will either be explicit or implicit. In my experience data driven applications (e.g. DBs etc.) tend to have a more formal definition of what the business logic is. The application logic tends t...
293,885
Please note that I asked the same question on [stackoverflow](https://stackoverflow.com/questions/32049022/application-logic-vs-business-logic) but they directed me to ask here. While I am trying to discerne the difference between the application logic and business logic I have found set of articles but unfortunately ...
2015/08/17
['https://softwareengineering.stackexchange.com/questions/293885', 'https://softwareengineering.stackexchange.com', 'https://softwareengineering.stackexchange.com/users/192185/']
I agree with SO's LoztInSpace that this is quite opinionated answer and that everyone can have slightly different definitions. Especially if historical influences are involved. This is how I would define the terms: Business logic is logic, that is created with collaboration and agreement with business experts. If busi...
As others have pointed out, these terms do not have one universally accepted meaning. I will describe the definitions I have encountered more often, i.e. in several projects with different companies. The **business logic** defines a normalized, general-purpose model of the business domain for which an application is w...
293,885
Please note that I asked the same question on [stackoverflow](https://stackoverflow.com/questions/32049022/application-logic-vs-business-logic) but they directed me to ask here. While I am trying to discerne the difference between the application logic and business logic I have found set of articles but unfortunately ...
2015/08/17
['https://softwareengineering.stackexchange.com/questions/293885', 'https://softwareengineering.stackexchange.com', 'https://softwareengineering.stackexchange.com/users/192185/']
Every system or application is going to have its own definitions of what is business logic and what is application logic. It will either be explicit or implicit. In my experience data driven applications (e.g. DBs etc.) tend to have a more formal definition of what the business logic is. The application logic tends t...
Na, they're just different terms for the same thing - the "middle tier" of program code that does the things you want your program to perform. Like many things in software, there are no hard-and-fast terminology for pieces of a system, as there are no single formal definitions for building systems. So sometimes people...