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
20,247,923
I'm making a program that change the color of the background, for example, when I press white, change background to white, black to black, and so on... and after have pressed a button the others disappear and I have already done that but what I want to do is that each tap on the Textview the buttons appear/disappear. h...
2013/11/27
['https://Stackoverflow.com/questions/20247923', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2958480/']
the problem was that i was calling a function (one click) and then nothing triggered. I change the code and now it's working super! here you can check it out: <http://bootply.com/97366> View: Is the same that in my question, but only changed the modal name to "myModal". Js File: ``` $('#myModal').on('show', funct...
Try saving the id you pass there (I suppose it's the id of the user in the list) to a global variable which will be always overridden with the last id of the corresponding row where you pressed the delete button. and then you can just call the modal like this: ``` $('#myModal3').modal('show'); ``` After this you c...
1,214,269
I created a console application using C# that references external DLLs. When I run it on my dev machine, everything works fine. On the production machine, I get a "type initiatization" error. Looking into this, it seems it may because the app can't find the referenced DLLs. On my dev box, the referenced DLLs are in th...
2009/07/31
['https://Stackoverflow.com/questions/1214269', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/-1/']
The simplest answer is to put the DLL's in the same directory as the Console Application and it will find them. The longer answer is fairly complex as there are many factors which influence how and where the CLR looks for referenced assemblies. I encourage you to take a look at the following article from MSDN which g...
When you examine the exception you get (and you may need to dive into the inner exception), you should see a log of all the locations searched (the "fusion log"). I'd recommend just placing the dependent DLLs in the same directory as your console app.
1,214,269
I created a console application using C# that references external DLLs. When I run it on my dev machine, everything works fine. On the production machine, I get a "type initiatization" error. Looking into this, it seems it may because the app can't find the referenced DLLs. On my dev box, the referenced DLLs are in th...
2009/07/31
['https://Stackoverflow.com/questions/1214269', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/-1/']
The simplest answer is to put the DLL's in the same directory as the Console Application and it will find them. The longer answer is fairly complex as there are many factors which influence how and where the CLR looks for referenced assemblies. I encourage you to take a look at the following article from MSDN which g...
The GAC ([Global Assembly Cache](http://msdn.microsoft.com/en-us/library/yf1d93sz%28VS.80%29.aspx)) registers your .dll's so you don't have to have them in the working directory of your application. All of .NET's .dll's (System.IO.dll, System.dll, etc) are registered through the GAC which means you don't have to have t...
1,214,269
I created a console application using C# that references external DLLs. When I run it on my dev machine, everything works fine. On the production machine, I get a "type initiatization" error. Looking into this, it seems it may because the app can't find the referenced DLLs. On my dev box, the referenced DLLs are in th...
2009/07/31
['https://Stackoverflow.com/questions/1214269', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/-1/']
The simplest answer is to put the DLL's in the same directory as the Console Application and it will find them. The longer answer is fairly complex as there are many factors which influence how and where the CLR looks for referenced assemblies. I encourage you to take a look at the following article from MSDN which g...
``` - Right click on the assembly name in your project reference. - select Properties - In the properties window set CopyLocal to true ```
1,214,269
I created a console application using C# that references external DLLs. When I run it on my dev machine, everything works fine. On the production machine, I get a "type initiatization" error. Looking into this, it seems it may because the app can't find the referenced DLLs. On my dev box, the referenced DLLs are in th...
2009/07/31
['https://Stackoverflow.com/questions/1214269', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/-1/']
The simplest answer is to put the DLL's in the same directory as the Console Application and it will find them. The longer answer is fairly complex as there are many factors which influence how and where the CLR looks for referenced assemblies. I encourage you to take a look at the following article from MSDN which g...
You can deploy referenced dlls where you want. You have to add an App.config (add/new item/application configuration file) to your base project and use the tag probing (configuration/runtime/assemblybinding/probing) to indicate a path for your dlls. You have to copy the dll or dlls to that path and add a reference to ...
1,214,269
I created a console application using C# that references external DLLs. When I run it on my dev machine, everything works fine. On the production machine, I get a "type initiatization" error. Looking into this, it seems it may because the app can't find the referenced DLLs. On my dev box, the referenced DLLs are in th...
2009/07/31
['https://Stackoverflow.com/questions/1214269', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/-1/']
The GAC ([Global Assembly Cache](http://msdn.microsoft.com/en-us/library/yf1d93sz%28VS.80%29.aspx)) registers your .dll's so you don't have to have them in the working directory of your application. All of .NET's .dll's (System.IO.dll, System.dll, etc) are registered through the GAC which means you don't have to have t...
When you examine the exception you get (and you may need to dive into the inner exception), you should see a log of all the locations searched (the "fusion log"). I'd recommend just placing the dependent DLLs in the same directory as your console app.
1,214,269
I created a console application using C# that references external DLLs. When I run it on my dev machine, everything works fine. On the production machine, I get a "type initiatization" error. Looking into this, it seems it may because the app can't find the referenced DLLs. On my dev box, the referenced DLLs are in th...
2009/07/31
['https://Stackoverflow.com/questions/1214269', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/-1/']
``` - Right click on the assembly name in your project reference. - select Properties - In the properties window set CopyLocal to true ```
When you examine the exception you get (and you may need to dive into the inner exception), you should see a log of all the locations searched (the "fusion log"). I'd recommend just placing the dependent DLLs in the same directory as your console app.
1,214,269
I created a console application using C# that references external DLLs. When I run it on my dev machine, everything works fine. On the production machine, I get a "type initiatization" error. Looking into this, it seems it may because the app can't find the referenced DLLs. On my dev box, the referenced DLLs are in th...
2009/07/31
['https://Stackoverflow.com/questions/1214269', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/-1/']
The GAC ([Global Assembly Cache](http://msdn.microsoft.com/en-us/library/yf1d93sz%28VS.80%29.aspx)) registers your .dll's so you don't have to have them in the working directory of your application. All of .NET's .dll's (System.IO.dll, System.dll, etc) are registered through the GAC which means you don't have to have t...
You can deploy referenced dlls where you want. You have to add an App.config (add/new item/application configuration file) to your base project and use the tag probing (configuration/runtime/assemblybinding/probing) to indicate a path for your dlls. You have to copy the dll or dlls to that path and add a reference to ...
1,214,269
I created a console application using C# that references external DLLs. When I run it on my dev machine, everything works fine. On the production machine, I get a "type initiatization" error. Looking into this, it seems it may because the app can't find the referenced DLLs. On my dev box, the referenced DLLs are in th...
2009/07/31
['https://Stackoverflow.com/questions/1214269', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/-1/']
``` - Right click on the assembly name in your project reference. - select Properties - In the properties window set CopyLocal to true ```
You can deploy referenced dlls where you want. You have to add an App.config (add/new item/application configuration file) to your base project and use the tag probing (configuration/runtime/assemblybinding/probing) to indicate a path for your dlls. You have to copy the dll or dlls to that path and add a reference to ...
162,148
I recently transferred a virtualbox machine from my laptop to my recently reinstalled desktop. The image works fine on my laptop, but when I try to boot it on my new machine, I get dumped to an "EFI Shell" where it asks me about my hard drives rather than booting the machine. I want it to boot to the actual machine ima...
2012/07/10
['https://askubuntu.com/questions/162148', 'https://askubuntu.com', 'https://askubuntu.com/users/74997/']
It turns out that as I was messing around with getting the machine to load (due to Virtualization technologies being disabled), I clicked one too many items on the image settings page. To fix this, go to the "Settings" page for the virtual machine, and click "System". Under the "motherboard" options, be sure that "Ena...
1. in Efi shell: `edit startup.nsh` 2. add line `FS0:\EFI\Path\To\Desired.efi` 3. Save, reboot.
43,751,628
I am trying to update and insert using one file. Following code can insert the data but when i try to update it is not working but data is also going to else part when i try to update it. **Flow Homepage -> Insert/Update UI -> Insert/Update Operation** Homepage which display all the data. There is update and delete l...
2017/05/03
['https://Stackoverflow.com/questions/43751628', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4995030/']
`$id` is not defined when you run your `UPDATE`. While you have defined `id` while you're on on the GUI page, the value is not passed with the next request to the script that actually queries your database. Add the following line to your form: ``` <input type="hidden" name="id" value="<?php echo htmlentities($_G...
Make user your id is retrieved properly. In your form i didn't any input element for the **id**. So when you try to get from the request it always comes empty. If you server error logs are on, you might get the error **undefined variable $id...**
72,695,685
I am working with JetEngine forms and i need to add a dropdown of users to select from in one of the form. is there any way to do this? i dont see any field type of users and also for the select option. if i choose filled dynamicly i have some pre build functions to get the data but none for the users? How can I set ...
2022/06/21
['https://Stackoverflow.com/questions/72695685', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2022193/']
Here I got the solution and it works. ``` const [loading, setLoading] = useState(false); const [data, setData] = useState([]); const getCMSID = () => { let url = `${URL}/store-api/category`; let getId = { method: 'POST', headers: { 'Content-Type': 'application/json', Accept: ...
***useState*** hook is asynchronous. So do not set something using ***useState*** and use it inside the same function. As per your code, you can just use the ID directly without using the set value. ``` const [loading, setLoading] = useState(true); const [data, setData] = useState([]); const [id, setId] = useState(' ...
27,812,897
I have a Node / Mongoose / MongoDB project which I use Selenium WebDriver for integration tests. Part of my testcase setup is to wipe the database before each test. I accomplish this via command line using the method that's heavily accepted here [Delete everything in a MongoDB database](https://stackoverflow.com/questi...
2015/01/07
['https://Stackoverflow.com/questions/27812897', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/698289/']
As you stated, your `mongod` (or multiple ones) is a separate process to your application, and as such your application has no knowledge of what has happened when you dropped the database. While the collections and indeed the database will be created when accessed by default, this is not true of all the indexes you def...
Thanks to Neil Lunn for pointing out the pitfalls of `dropDatabase` and re-indexing. Ultimately, I went for the following command line solution, and removing the `dropDatabase` command. ``` mongo [database] --eval "db.getCollectionNames().forEach(function(n){db[n].remove()});" ```
9,249,793
> > **Possible Duplicate:** > > [MySQL delete row from multiple tables](https://stackoverflow.com/questions/2214433/mysql-delete-row-from-multiple-tables) > > > I have 5 tables: * members * member\_videos * member\_photos * member\_friends * member\_pages When I delete that member, I want to delete all his r...
2012/02/12
['https://Stackoverflow.com/questions/9249793', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1020895/']
Yes, you can. ``` DELETE m, mv, mp, mf, mpp FROM members AS m LEFT JOIN member_videos AS mv ON mv.member_id = m.id LEFT JOIN member_photos AS mp ON mp.member_id = m.id LEFT JOIN member_friends AS mf ON mf.member_id = m.id LEFT JOIN member_pages AS mpp ON mpp.member_id = m.id WHERE m.id = 12 ```
I don't think you can. However, I think you can separate the queries with ; and give it as one query to mysql\_query() or whatever you're using. For example: ``` mysql_query('DELETE * FROM members WHERE user_id = 4; DELETE * FROM member_videos WHERE user_id = 4;'); ``` and so on :)
9,249,793
> > **Possible Duplicate:** > > [MySQL delete row from multiple tables](https://stackoverflow.com/questions/2214433/mysql-delete-row-from-multiple-tables) > > > I have 5 tables: * members * member\_videos * member\_photos * member\_friends * member\_pages When I delete that member, I want to delete all his r...
2012/02/12
['https://Stackoverflow.com/questions/9249793', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1020895/']
<http://dev.mysql.com/doc/refman/5.0/en/delete.html> Check this page, there is a section for multiple-tables DELETE.
I don't think you can. However, I think you can separate the queries with ; and give it as one query to mysql\_query() or whatever you're using. For example: ``` mysql_query('DELETE * FROM members WHERE user_id = 4; DELETE * FROM member_videos WHERE user_id = 4;'); ``` and so on :)
9,249,793
> > **Possible Duplicate:** > > [MySQL delete row from multiple tables](https://stackoverflow.com/questions/2214433/mysql-delete-row-from-multiple-tables) > > > I have 5 tables: * members * member\_videos * member\_photos * member\_friends * member\_pages When I delete that member, I want to delete all his r...
2012/02/12
['https://Stackoverflow.com/questions/9249793', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1020895/']
Yes, you can. ``` DELETE m, mv, mp, mf, mpp FROM members AS m LEFT JOIN member_videos AS mv ON mv.member_id = m.id LEFT JOIN member_photos AS mp ON mp.member_id = m.id LEFT JOIN member_friends AS mf ON mf.member_id = m.id LEFT JOIN member_pages AS mpp ON mpp.member_id = m.id WHERE m.id = 12 ```
<http://dev.mysql.com/doc/refman/5.0/en/delete.html> Check this page, there is a section for multiple-tables DELETE.
52,937,718
Having the following dataframe: ``` UserID TweetLanguage 2014-08-25 21:00:00 001 english 2014-08-27 21:04:00 001 arabic 2014-08-29 22:07:00 001 espanish 2014-08-25 22:09:00 002 english 2014-08-26 22:09:00 002 espanish 2014-08-25 22:09:00 003 english ...
2018/10/22
['https://Stackoverflow.com/questions/52937718', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5413088/']
``` df.groupby([pd.Grouper(freq='W'), 'User ID'])['TweetLanguage'].nunique().unstack().plot() ```
``` df.groupby(pd.Grouper(key='datetime', freq='W')).apply(lambda df:\ df.groupby('UserID').apply(lambda df: len(df.TweetLanguage.value_counts()))) ``` This is a one liner that will seperate the week and get number of language in a week ``` df.groupby('UserID').apply(lambda df: len(df.TweetLanguage.value_counts())) ...
52,937,718
Having the following dataframe: ``` UserID TweetLanguage 2014-08-25 21:00:00 001 english 2014-08-27 21:04:00 001 arabic 2014-08-29 22:07:00 001 espanish 2014-08-25 22:09:00 002 english 2014-08-26 22:09:00 002 espanish 2014-08-25 22:09:00 003 english ...
2018/10/22
['https://Stackoverflow.com/questions/52937718', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5413088/']
``` df.groupby([pd.Grouper(freq='W'), 'User ID'])['TweetLanguage'].nunique().unstack().plot() ```
Use 2 `groupbys`. The first finds the users who post in more than one language every week, the second counts how many there are per week. ``` (df.groupby([df.index.year.rename('year'), df.index.week.rename('week'), 'UserID']).TweetLanguage.nunique() > 1).groupby(level=[0,1]).sum() #year week #2014 35 2.0 #Nam...
153,204
I am working with Goole map in a VF page.Consider that Account object has Geolocation field. Based on the user location I have mapped the center point in the map and got the bounds of the map using getBounds() function in javascript. `GetBounds` returns two Geolocations SouthWest and NorthEast. How I can query all t...
2016/12/20
['https://salesforce.stackexchange.com/questions/153204', 'https://salesforce.stackexchange.com', 'https://salesforce.stackexchange.com/users/19084/']
If you can get a latitude/longitude pair from those Geolocations on the page, you should be able to find records within a radius of those points via the `DISTANCE` and `GEOLOCATION` functions used in a `WHERE` clause. The specifics of these functions are discussed in the [Geolocation based SOQL Queries](https://develop...
Finally Google developer doc helped me. Here is the solution, ``` //Creating the map var mapOptions = {center: myLatLng , zoom: 8, mapTypeId: google.maps.MapTypeId.ROADMAP}; //Link with page component var map = new google.maps.Map(document.getElementById("map_canvas"), mapOptio...
7,182,762
I'm using Netbeans to compile and sign all my jars, all with the same certificate. However, when I run Webstart with Sun Java SE 6, I get the error Found unsigned entry in resource .. .jar. I messed around with adding and removing jars, etc, but no luck. As far as I know the keystore is in the build directory and g...
2011/08/24
['https://Stackoverflow.com/questions/7182762', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1925248/']
Enabling JAR caching should fix the problem. It's a common bug that exists in Java for *years*. For details, see my blogpost: <https://www.nowaker.net/post/found-unsigned-entry-in-resource-java-web-start.html>
I restarted the pc again and it works again. Must've been something weird with the Java JRE or something...
66,117
According to Judaism illicit relations are forbidden. I always thought that the way one can control his lustful desires is by marrying. In the *Garden of Peace*, Rabbi Shalom Arush says that a man cannot be a giver if he has lust towards his wife. That is, he should nullify all his lust towards his wife and only focus...
2015/12/09
['https://judaism.stackexchange.com/questions/66117', 'https://judaism.stackexchange.com', 'https://judaism.stackexchange.com/users/3006/']
This discussion centers around the mishna in avos towards the end of chapter two (either mishna 12 or 17, depending on your print) "all your deeds should be lishem shomayim". Rambam offers two different approaches between his pirush on the mishna and in his shmona perakim, which is echoed in the two different approac...
There are some *very, very* different views on the subject in different sources. [More is discussed here.](https://judaism.stackexchange.com/a/33902/21) Satmar thought has similar language, by the way. And many other groups feel that's unworkable. The Shulchan Aruch in Or HaChaim uses very strong language about "only...
66,117
According to Judaism illicit relations are forbidden. I always thought that the way one can control his lustful desires is by marrying. In the *Garden of Peace*, Rabbi Shalom Arush says that a man cannot be a giver if he has lust towards his wife. That is, he should nullify all his lust towards his wife and only focus...
2015/12/09
['https://judaism.stackexchange.com/questions/66117', 'https://judaism.stackexchange.com', 'https://judaism.stackexchange.com/users/3006/']
Ezra and his generation of Anshei Keneses haGdolah tried to put in place legislation requiring a man to go to the miqvah the morning after relations, "so that he should not copulate like a rooster". I don't know if this was an estimate of the right level of annoyance the next morning, or so that the man who did overdue...
There are some *very, very* different views on the subject in different sources. [More is discussed here.](https://judaism.stackexchange.com/a/33902/21) Satmar thought has similar language, by the way. And many other groups feel that's unworkable. The Shulchan Aruch in Or HaChaim uses very strong language about "only...
3,392,055
Need some hints how to solve the following differential equation $$xy'= \sqrt{y^2+x^2}+y$$ Just don't know how to begin. Thank you.
2019/10/13
['https://math.stackexchange.com/questions/3392055', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/680628/']
Alternatively, you could try to make use of the hyperbolic identity $$\cosh^2t - \sinh^2t = 1 \implies \cosh^2t = 1 + \sinh^2t$$ and use the inspired substitution $$y = x\sinh\left(f(x)\right)$$ which simplifies nicely: $$x(\sinh(f(x)) + xf'(x)\cosh(f(x))) = |x|\cosh(f(x))+x\sinh(f(x)) \implies f'(x) = \frac{1}{|x...
Square both sides then replace $\sqrt{y^2+x^2}$ by $xy'-y$ This becomes $$x^2(y')^2+y^2-xy'(1+y)-y=0$$ Now you could you appropriate subsitution
65,788,251
I am using reselect lib in my React project. Here is a code: ``` const App = () => { // const { tickets, isFetching, error } = useSelector(({ tickets }) => tickets) // <- this works good const { sorterTabs, selected } = useSelector(({ sorter }) => sorter) const { isFetching } = useSelector(({ tickets }) => t...
2021/01/19
['https://Stackoverflow.com/questions/65788251', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/13115642/']
This is a nice example of when to actually use [arrow functions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions) in favor of regular functions! Because regular functions—like in your code—establish their own `this` scope you no longer have access to the `this` scope you are ...
The `this` has a type of SVGRectElement because it is inside a regular anonymous function. In D3, methods for manipulating nodes replace the `this` context with the own DOM Element that is being manipulated, in your case a `<rect>`. The `<rect>` nodes don't have x or y methods, hence the type error. Replacing the anon...
34,602,460
I'm teaching myself JavaScript and I'm trying to make a random background color appear when a button is clicked. Below you can find my code: HTML Code ``` <!DOCTYPE html> <html> <head> <title>Day 4</title> <link rel="stylesheet" type="text/css" href="css/foundation.min.css"> <link rel="stylesheet" type="t...
2016/01/05
['https://Stackoverflow.com/questions/34602460', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5069799/']
It seems like its basically already been answered by others, but there is nothing wrong with repetition. 1. You are calling `randomColors()` instead of `randomcolor()`. 2. You really shouldn't be using getElementById on the body tag. You can just use document.body to get the body. 3. You need to use `style.background`...
First, you're using the wrong function in your callback. Use `onclick='randomcolor()'`. Make sure your JS functions are defined in the `<head>` of the document. Finally, `document.getElementById('background').style.color` is the text color, not the background color. Use `document.getElementById('background').style.back...
34,602,460
I'm teaching myself JavaScript and I'm trying to make a random background color appear when a button is clicked. Below you can find my code: HTML Code ``` <!DOCTYPE html> <html> <head> <title>Day 4</title> <link rel="stylesheet" type="text/css" href="css/foundation.min.css"> <link rel="stylesheet" type="t...
2016/01/05
['https://Stackoverflow.com/questions/34602460', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5069799/']
What happened is when your html loads, the onclick handler is undefined because your script hasn't been loaded as yet.. .hence you will get an an error in your console.log stating that your function is undefined. Move script tag above your onclick handler. **Snippet using .onclick** ```js document.getElementById('but...
First, you're using the wrong function in your callback. Use `onclick='randomcolor()'`. Make sure your JS functions are defined in the `<head>` of the document. Finally, `document.getElementById('background').style.color` is the text color, not the background color. Use `document.getElementById('background').style.back...
34,602,460
I'm teaching myself JavaScript and I'm trying to make a random background color appear when a button is clicked. Below you can find my code: HTML Code ``` <!DOCTYPE html> <html> <head> <title>Day 4</title> <link rel="stylesheet" type="text/css" href="css/foundation.min.css"> <link rel="stylesheet" type="t...
2016/01/05
['https://Stackoverflow.com/questions/34602460', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5069799/']
It seems like its basically already been answered by others, but there is nothing wrong with repetition. 1. You are calling `randomColors()` instead of `randomcolor()`. 2. You really shouldn't be using getElementById on the body tag. You can just use document.body to get the body. 3. You need to use `style.background`...
What happened is when your html loads, the onclick handler is undefined because your script hasn't been loaded as yet.. .hence you will get an an error in your console.log stating that your function is undefined. Move script tag above your onclick handler. **Snippet using .onclick** ```js document.getElementById('but...
19,363,489
I want to set all C-x command to be M-x so I can keep my thumb in my left hand on ALT button. But what is the function which C-h and C-x run? Thanks.
2013/10/14
['https://Stackoverflow.com/questions/19363489', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2767553/']
Control-X is bound to the function `Control-X-prefix`, which is a keymap (a table associating keystrokes with commands). So to set `\M-x` to work like `\C-x`, just do the following: ``` (define-key global-map "\M-x" 'Control-X-prefix) ``` All that said, instead of rebinding emacs I would recommend that you look int...
Use `C-x C-h` to see the `C-x` bindings. Load [`help-fns+.el`](http://www.emacswiki.org/emacs/download/help-fns%2b.el) and use `C-h M-k` with `ctl-x-map` and `help-map` to see all bindings for `C-x` and `C-h`.
2,840,303
For every open set $ G \subset \mathbb{R}^n$ and $ \epsilon > 0 $ there exist a finite collection of compact intervals $\{ I\_j \quad|\quad j=1,2,...m\}$ in $ \mathbb{R}^n $ such that $\cup^{j=1}\_{m}I\_j \subset G $ and $ m(G\backslash \cup^{j=1}\_{m}I\_j)< \epsilon $ where m denotes lebesgue measure. NOTE : compact ...
2018/07/04
['https://math.stackexchange.com/questions/2840303', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/402639/']
This follows from the fact that every open set in $\mathbb{R}^n$ is a countable disjoint union of compact intervals. Indeed, if $G = \cup\_{k=1}^\infty I\_k$, then since $\sum\_k m(I\_k) = m(G) < \infty$, we may take $K$ so that $\sum\_{k > K} m(I\_k) < \epsilon$. Then $\cup\_{k=1}^K I\_k$ does the trick. See page 7 ...
This is false. For example take $G= \mathbb R^n$.
19,455,400
I have a shell script that runs on AIX 7.1 and the purpose of it is to archive a bunch of different directories using CPIO. We pass in the directories to be archived to CPIO from a flat file called synclive\_cpio.list. Here is a snippet of the script.. ``` #!/bin/ksh CPIO_LIST="$BASE/synclive_cpio.list" DUMP_DIR=/us...
2013/10/18
['https://Stackoverflow.com/questions/19455400', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/-1/']
Exclude them in the `find` command ``` time find . ! \( -name '*.log' -o -name '*.tmp' \) -print | cpio -o | gzip > $DUMP_DIR/$f2.cpio.gz & ``` You can keep adding `-o *.suffix` to the list.
Another method is to use egrep -v in the pipeline. I believe that would be a teeny tiny bit more efficient. ``` time find . -print | egrep -v '\.(tmp|log)$' | cpio -o | gz ``` To me, it is also easier to read and modify if the list gets really long.
20,469,861
in my application I have a TableView that displays all the posts made by users of the app ... I noticed that the date on social networks of the post is written based on the current date, for example: The post was made ​​2 hours ago In your opinion what is the best method to accomplish this? There are no tutorials or ...
2013/12/09
['https://Stackoverflow.com/questions/20469861', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2773233/']
Once you have NSDate of some event and your current date you can use NSCalendar to calculate the difference between them in calendar units you want. And then you can generate your user-readable string based on that (e.g. you may want to use only the largest non-zero date component): ``` NSCalendar *calendar = [NSCalen...
Basically, create a timestamp using whenever a post is created. Then compare that to the current time.
20,469,861
in my application I have a TableView that displays all the posts made by users of the app ... I noticed that the date on social networks of the post is written based on the current date, for example: The post was made ​​2 hours ago In your opinion what is the best method to accomplish this? There are no tutorials or ...
2013/12/09
['https://Stackoverflow.com/questions/20469861', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2773233/']
This problem has already been solved for you; use the excellent [FormatterKit](https://github.com/mattt/FormatterKit#ttttimeintervalformatter), specifically the time interval formatter component of it.
Basically, create a timestamp using whenever a post is created. Then compare that to the current time.
14,482,707
I am needing help forming a jquery selector to return elements which are missing a particular child element. Given the following HTML fragment: ``` <div id="rack1" class="rack"> <span id="rackunit1" class="rackspace"> <span id="component1">BoxA</span> <span id="label1">Space A</span> </spa...
2013/01/23
['https://Stackoverflow.com/questions/14482707', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/681009/']
I guess the following should work: ``` $(".rack .rackspace:not(:has(span[id^=component]))"). ... ``` **DEMO:** <http://jsfiddle.net/WbCzj/>
You could use [`.filter()`](http://api.jquery.com/filter/): ``` $('.rack .rackspace').filter(function() { return $(this).find('span[id^="component"]').length === 0; }); ```
2,915,329
Does anyone know if there is a way to "transform" specific sections of values instead of replacing the whole value or an attribute? For example, I've got several appSettings entries that specify the URLs for different webservices. These entries are slightly different in the dev environment than the production environm...
2010/05/26
['https://Stackoverflow.com/questions/2915329', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/80268/']
As a matter of fact you can do this, but it is not as easy as you might think. You can create your own config transformation. I have just written a very detailed blog post at <http://sedodream.com/2010/09/09/ExtendingXMLWebconfigConfigTransformation.aspx> regarding this. But here are the hightlights: * Create Class Li...
Just as an update, if you're using Visual Studio 2013, you should reference %Program Files (x86)%MSBuild\Microsoft\VisualStudio\v12.0\Web\Microsoft.Web.XmlTransform.dll instead.
67,850,085
basically my code stops working after my first input where i chose one of the following cases, but it should keep on workin until i choose case x. can anybody help and tell me where the issue is? ``` #include <stdio.h> #include <math.h> #include <stdlib.h> #include <time.h> int main(){ char choice; int a,b,c,s; int F...
2021/06/05
['https://Stackoverflow.com/questions/67850085', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/16137524/']
use a do-while loop, instead of switch-while because the switch while loop doesn't exist, at least not in c++ or c. ``` #include <stdio.h> #include <math.h> #include <stdlib.h> #include <time.h> int main(){ char choice; int a,b,c,s; int F; do{ printf("Objekttyp wahlen:\n (R) Rechteck\n (E) Ellipse\n (D) Dreieck\n...
**Beautiful code format:** ``` #include <stdio.h> #include <math.h> #include <stdlib.h> #include <time.h> int main(){ char choice; int a,b,c,s; int F; do{ printf("Objekttyp wahlen:\n (R) Rechteck\n (E) Ellipse\n (D) Dreieck\n (x) Exit\n"); choice = getchar(); while(choice == '\...
67,850,085
basically my code stops working after my first input where i chose one of the following cases, but it should keep on workin until i choose case x. can anybody help and tell me where the issue is? ``` #include <stdio.h> #include <math.h> #include <stdlib.h> #include <time.h> int main(){ char choice; int a,b,c,s; int F...
2021/06/05
['https://Stackoverflow.com/questions/67850085', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/16137524/']
use a do-while loop, instead of switch-while because the switch while loop doesn't exist, at least not in c++ or c. ``` #include <stdio.h> #include <math.h> #include <stdlib.h> #include <time.h> int main(){ char choice; int a,b,c,s; int F; do{ printf("Objekttyp wahlen:\n (R) Rechteck\n (E) Ellipse\n (D) Dreieck\n...
By the way: If you want to output the German umlauts in the console (for example `"Ungültige Eingabe!\n\n"`), you can write: `printf("Ung\x81 \bltige Eingabe!\n\n");` The console is using the [codepage 850](https://de.wikipedia.org/wiki/Codepage_850)... `printf("Seitenl\x84 \bngen a,b des Rechtecks: ");` You just hav...
67,850,085
basically my code stops working after my first input where i chose one of the following cases, but it should keep on workin until i choose case x. can anybody help and tell me where the issue is? ``` #include <stdio.h> #include <math.h> #include <stdlib.h> #include <time.h> int main(){ char choice; int a,b,c,s; int F...
2021/06/05
['https://Stackoverflow.com/questions/67850085', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/16137524/']
By the way: If you want to output the German umlauts in the console (for example `"Ungültige Eingabe!\n\n"`), you can write: `printf("Ung\x81 \bltige Eingabe!\n\n");` The console is using the [codepage 850](https://de.wikipedia.org/wiki/Codepage_850)... `printf("Seitenl\x84 \bngen a,b des Rechtecks: ");` You just hav...
**Beautiful code format:** ``` #include <stdio.h> #include <math.h> #include <stdlib.h> #include <time.h> int main(){ char choice; int a,b,c,s; int F; do{ printf("Objekttyp wahlen:\n (R) Rechteck\n (E) Ellipse\n (D) Dreieck\n (x) Exit\n"); choice = getchar(); while(choice == '\...
11,161,920
I'm writing an iPad app that uses an Audio Queue. I'm running into an error resulting from calling AudioSessionInitialize more than once. I'm trying to find a way to test whether or not AudioSessionInitialize has already been called to avoid this, but so far no luck. Does anyone have a way to do this? Thanks in advanc...
2012/06/22
['https://Stackoverflow.com/questions/11161920', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1475624/']
You could just wrap it in a dispatch\_once block as per: ``` static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ AudioSessionInitialize(NULL, NULL, InterruptionListenerCallback, clientData); // Perform other setup here... }); ``` although you may find it easier in the long term to use implicit ini...
Since the audio session is currently a global property, you could set a C global variable flag when initializing, and then check this global variable before attempting to (re)initialize. However a dispatch\_once block would be less likely to incur race condition bugs if your app is multi-threaded.
130,190
Here is my problem Let $H(x)=\Phi(\frac{Ax+b}{\sqrt{2}})$ where $A$, $b$ are some non-negative constant and $\Phi$ is the CDf of a standard normal distribution. I want to find $$\int x \, dH(x)$$ I thought maybe integration by parts which yields: $$x H(x)-\int H(x) \, dx$$ And now I'm not sure how to proceed or i...
2012/04/10
['https://math.stackexchange.com/questions/130190', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/28789/']
\begin{eqnarray} \lim\_{x\to\infty}\left(1+\frac{f(x)}x\right)^x &=&\lim\_{x\to\infty}\exp \left(x\log \left(1+\frac{f(x)}x \right) \right)=\exp \left(\lim\_{x\to\infty}x\log \left(1+\frac{f(x)}x\right)\right)\\ \ \\ &=&\exp \left(\lim\_{x\to\infty}x \left(\frac{f(x)}x+o\left(\frac1{x^2}\right)\right)\right) =\exp \lef...
Since there exist $\lim\limits\_{x\to 0}f(x)=l$ we have that $f$ is bounded in the neighborhood of $\infty$. So $\lim\limits\_{x\to\infty}\frac{f(x)}{x}=0$ and we can write $$ \lim\limits\_{x\to\infty}\left(1+\frac{f(x)}{x}\right)^x= \lim\limits\_{x\to\infty}\left(\left(1+\frac{f(x)}{x}\right)^{\frac{x}{f(x)}}\right)^{...
361,282
During review of an article I found an erroneous sentence: > > The known predators of the plant are sheep, donkeys ... > > > I am an engineer, with not so much knowledge in ecology. Based on my earlier studies I suggested to change *predators* to *consumers*. I checked it with a search on the net. Surprisingly I ...
2016/12/01
['https://english.stackexchange.com/questions/361282', 'https://english.stackexchange.com', 'https://english.stackexchange.com/users/162691/']
According to the wikibook [Predation and Herbivory](https://en.wikibooks.org/wiki/Ecology/Predation_and_Herbivory): > > ecologically, predation is defined as any interaction between two organisms that results in a flow of energy between them. This definition is applicable to both plants and animals. There are four co...
Most of the online definitions of 'predator' such as [the ODO](https://en.oxforddictionaries.com/definition/predator), [the Cambridge](http://dictionary.cambridge.org/dictionary/english/predator) and [the Macmillan](http://www.macmillandictionary.com/dictionary/british/predator) define 'predator' as an animal which eat...
84,640
I found this sentence in [an article about japanese swords](https://newsinslowjapanese.com/2020/03/24/nisj-354-japanese-swords/) > > 日本刀と他の刀との違いは、どれだけ波紋と鉄が美しい**か**にこだわっている**か**です > > > The translation is > > The difference between japanese swords and other swords **is** how much the ripples and iron are particu...
2021/03/17
['https://japanese.stackexchange.com/questions/84640', 'https://japanese.stackexchange.com', 'https://japanese.stackexchange.com/users/41902/']
The basic structure of this sentence is: > > 日本刀と他の刀との違いはX**です**。 > > The difference between Japanese swords and other swords **is** (in) X. > > > The "is" in the translation simply corresponds to the copula です at the end of the original sentence. There is no need to change it to something else like "could be"...
I would parse it this way: > > The difference between Japanese swords and other swords is this: How much do they care about "how beautiful are the ripples and iron?"? > > > And since this way there are essentially two implicit questions in this phrase it makes sense that there are two か.
99,835
Yesterday I heard of the [Bland-Altman plot](https://en.wikipedia.org/wiki/Bland%E2%80%93Altman_plot) for the first time. I have to compare two methods of measuring blood pressure, and I need to produce a Bland-Altman plot. I am not sure if I get everything about it right, so here's what I think I know: I have two set...
2014/05/23
['https://stats.stackexchange.com/questions/99835', 'https://stats.stackexchange.com', 'https://stats.stackexchange.com/users/46069/']
Have you looked at [the Wikipedia entry](https://en.wikipedia.org/wiki/Bland%E2%80%93Altman_plot) I linked in your question? You don't plot "the mean of the data", but for each data point measured in two ways, you plot the difference in the two measurements ($y$) against the average of the two measurements ($x$). Usin...
If you would like to do this in Python you can use this code ```py import matplotlib.pyplot as plt import numpy as np from numpy.random import random %matplotlib inline plt.style.use('ggplot') ``` I just added the last line because I like the ggplot style. ```py def plotblandaltman(x,y,title,sd_limit): plt.figu...
21,694
When some living being like dog or any mini bacteria are killed, since they are not self aware or concious do they feel the same type of pain as we do? what is the difference between their suffering and our suffering?
2017/07/24
['https://buddhism.stackexchange.com/questions/21694', 'https://buddhism.stackexchange.com', 'https://buddhism.stackexchange.com/users/-1/']
Dogs don't forget pain. You only have to look at a dog that has been continuously beaten and then cringes or tries to bite anyone who tries to pet it. Yes it has become an automatic reaction but there must be some kind of memory there about humans not being trustworthy.
Its very clear that dogs are conscious and feel the same pain as humans do and the suffering is the same suffering If by self aware you mean mindful- than most people arent mindful 99.9999% of the time --- many many monks if good ones are not mindful most of the time About bacteria i cant say much
21,694
When some living being like dog or any mini bacteria are killed, since they are not self aware or concious do they feel the same type of pain as we do? what is the difference between their suffering and our suffering?
2017/07/24
['https://buddhism.stackexchange.com/questions/21694', 'https://buddhism.stackexchange.com', 'https://buddhism.stackexchange.com/users/-1/']
Its very clear that dogs are conscious and feel the same pain as humans do and the suffering is the same suffering If by self aware you mean mindful- than most people arent mindful 99.9999% of the time --- many many monks if good ones are not mindful most of the time About bacteria i cant say much
In all [31 planes of existence](http://www.accesstoinsight.org/ptf/dhamma/sagga/loka.html) there is attachment to life except for the plane for [Unconscious Beings (asaññasatta)](https://suttacentral.net/define/asa%C3%B1%C3%B1asatt%C4%81). So a dog feels pain thus like us. Also any being in any plane are self aware ex...
21,694
When some living being like dog or any mini bacteria are killed, since they are not self aware or concious do they feel the same type of pain as we do? what is the difference between their suffering and our suffering?
2017/07/24
['https://buddhism.stackexchange.com/questions/21694', 'https://buddhism.stackexchange.com', 'https://buddhism.stackexchange.com/users/-1/']
Dogs don't forget pain. You only have to look at a dog that has been continuously beaten and then cringes or tries to bite anyone who tries to pet it. Yes it has become an automatic reaction but there must be some kind of memory there about humans not being trustworthy.
It is hard to say unless you are an animal or bacteria. In general observation, it appears animals such as dogs enjoy the sex and they feel the pain. According to Buddhist teaching animals possess five aggregate same as the human. Interesting video to watch. In this video, it is explained in plain English that any liv...
21,694
When some living being like dog or any mini bacteria are killed, since they are not self aware or concious do they feel the same type of pain as we do? what is the difference between their suffering and our suffering?
2017/07/24
['https://buddhism.stackexchange.com/questions/21694', 'https://buddhism.stackexchange.com', 'https://buddhism.stackexchange.com/users/-1/']
Dogs don't forget pain. You only have to look at a dog that has been continuously beaten and then cringes or tries to bite anyone who tries to pet it. Yes it has become an automatic reaction but there must be some kind of memory there about humans not being trustworthy.
I think that (according to Buddhism) humans, animals, ghosts, and residents of hell all belong to the same kind of category: all "[sentient](https://en.wikipedia.org/wiki/Sentient_beings_(Buddhism))", all composed of the five skandhas, and all subject to suffering. Since all belong to the same continuum (i.e. samsara)...
21,694
When some living being like dog or any mini bacteria are killed, since they are not self aware or concious do they feel the same type of pain as we do? what is the difference between their suffering and our suffering?
2017/07/24
['https://buddhism.stackexchange.com/questions/21694', 'https://buddhism.stackexchange.com', 'https://buddhism.stackexchange.com/users/-1/']
Dogs don't forget pain. You only have to look at a dog that has been continuously beaten and then cringes or tries to bite anyone who tries to pet it. Yes it has become an automatic reaction but there must be some kind of memory there about humans not being trustworthy.
More primitive life forms, such as worms or fish, have a nervous system, therefore their nervous system experiences physical pain. Dogs are probably more complex and have emotions such as lust, love, *emotional* attachment; that makes them experience *emotional* sorrow & unhappiness. However. as we can directly exper...
21,694
When some living being like dog or any mini bacteria are killed, since they are not self aware or concious do they feel the same type of pain as we do? what is the difference between their suffering and our suffering?
2017/07/24
['https://buddhism.stackexchange.com/questions/21694', 'https://buddhism.stackexchange.com', 'https://buddhism.stackexchange.com/users/-1/']
Its very clear that dogs are conscious and feel the same pain as humans do and the suffering is the same suffering If by self aware you mean mindful- than most people arent mindful 99.9999% of the time --- many many monks if good ones are not mindful most of the time About bacteria i cant say much
I think that (according to Buddhism) humans, animals, ghosts, and residents of hell all belong to the same kind of category: all "[sentient](https://en.wikipedia.org/wiki/Sentient_beings_(Buddhism))", all composed of the five skandhas, and all subject to suffering. Since all belong to the same continuum (i.e. samsara)...
21,694
When some living being like dog or any mini bacteria are killed, since they are not self aware or concious do they feel the same type of pain as we do? what is the difference between their suffering and our suffering?
2017/07/24
['https://buddhism.stackexchange.com/questions/21694', 'https://buddhism.stackexchange.com', 'https://buddhism.stackexchange.com/users/-1/']
Dogs don't forget pain. You only have to look at a dog that has been continuously beaten and then cringes or tries to bite anyone who tries to pet it. Yes it has become an automatic reaction but there must be some kind of memory there about humans not being trustworthy.
In all [31 planes of existence](http://www.accesstoinsight.org/ptf/dhamma/sagga/loka.html) there is attachment to life except for the plane for [Unconscious Beings (asaññasatta)](https://suttacentral.net/define/asa%C3%B1%C3%B1asatt%C4%81). So a dog feels pain thus like us. Also any being in any plane are self aware ex...
21,694
When some living being like dog or any mini bacteria are killed, since they are not self aware or concious do they feel the same type of pain as we do? what is the difference between their suffering and our suffering?
2017/07/24
['https://buddhism.stackexchange.com/questions/21694', 'https://buddhism.stackexchange.com', 'https://buddhism.stackexchange.com/users/-1/']
Its very clear that dogs are conscious and feel the same pain as humans do and the suffering is the same suffering If by self aware you mean mindful- than most people arent mindful 99.9999% of the time --- many many monks if good ones are not mindful most of the time About bacteria i cant say much
More primitive life forms, such as worms or fish, have a nervous system, therefore their nervous system experiences physical pain. Dogs are probably more complex and have emotions such as lust, love, *emotional* attachment; that makes them experience *emotional* sorrow & unhappiness. However. as we can directly exper...
21,694
When some living being like dog or any mini bacteria are killed, since they are not self aware or concious do they feel the same type of pain as we do? what is the difference between their suffering and our suffering?
2017/07/24
['https://buddhism.stackexchange.com/questions/21694', 'https://buddhism.stackexchange.com', 'https://buddhism.stackexchange.com/users/-1/']
I think that (according to Buddhism) humans, animals, ghosts, and residents of hell all belong to the same kind of category: all "[sentient](https://en.wikipedia.org/wiki/Sentient_beings_(Buddhism))", all composed of the five skandhas, and all subject to suffering. Since all belong to the same continuum (i.e. samsara)...
More primitive life forms, such as worms or fish, have a nervous system, therefore their nervous system experiences physical pain. Dogs are probably more complex and have emotions such as lust, love, *emotional* attachment; that makes them experience *emotional* sorrow & unhappiness. However. as we can directly exper...
21,694
When some living being like dog or any mini bacteria are killed, since they are not self aware or concious do they feel the same type of pain as we do? what is the difference between their suffering and our suffering?
2017/07/24
['https://buddhism.stackexchange.com/questions/21694', 'https://buddhism.stackexchange.com', 'https://buddhism.stackexchange.com/users/-1/']
I think that (according to Buddhism) humans, animals, ghosts, and residents of hell all belong to the same kind of category: all "[sentient](https://en.wikipedia.org/wiki/Sentient_beings_(Buddhism))", all composed of the five skandhas, and all subject to suffering. Since all belong to the same continuum (i.e. samsara)...
It is hard to say unless you are an animal or bacteria. In general observation, it appears animals such as dogs enjoy the sex and they feel the pain. According to Buddhist teaching animals possess five aggregate same as the human. Interesting video to watch. In this video, it is explained in plain English that any liv...
24,514
Basically I have created a function which takes two lists of dicts, for example: ``` oldList = [{'a':2}, {'v':2}] newList = [{'a':4},{'c':4},{'e':5}] ``` My aim is to check for each dictionary key in the oldList and if it has the same dictionary key as in the newList update the dictionary, else append to the oldLis...
2013/03/29
['https://codereview.stackexchange.com/questions/24514', 'https://codereview.stackexchange.com', 'https://codereview.stackexchange.com/users/23629/']
``` def sortList(oldList, newList): ``` Python convention is to lowercase\_with\_underscores for pretty much everything besides class names ``` for new in newList: #{'a':4},{'c':4},{'e':5} isAdd = True ``` Avoid boolean flags. They are delayed gotos and make it harder to follow your code. In this case...
You don't need the `isAdd` flag, instead you can structure your for loops like this: ``` for new, old in newList, oldList: if new.keys()[0] == old.keys()[0]: old.update(new) else: oldList.append(new) return oldList ``` As well, you might want to look at [PEP](http://python.net/~goodger/projec...
24,514
Basically I have created a function which takes two lists of dicts, for example: ``` oldList = [{'a':2}, {'v':2}] newList = [{'a':4},{'c':4},{'e':5}] ``` My aim is to check for each dictionary key in the oldList and if it has the same dictionary key as in the newList update the dictionary, else append to the oldLis...
2013/03/29
['https://codereview.stackexchange.com/questions/24514', 'https://codereview.stackexchange.com', 'https://codereview.stackexchange.com/users/23629/']
A list of 1-pair dictionaries makes no sense as data structure. You should join them to create a single dictionary. This way all your code reduces to: ``` d1 = {'a': 2, 'b': 2} d2 = {'a': 4, 'c': 4, 'e': 5} d3 = dict(d1, **d2) # {'a': 4, 'b': 2, 'c': 4, 'e': 5} ``` If you are going to union/merge dicts a lot, you ca...
You don't need the `isAdd` flag, instead you can structure your for loops like this: ``` for new, old in newList, oldList: if new.keys()[0] == old.keys()[0]: old.update(new) else: oldList.append(new) return oldList ``` As well, you might want to look at [PEP](http://python.net/~goodger/projec...
24,514
Basically I have created a function which takes two lists of dicts, for example: ``` oldList = [{'a':2}, {'v':2}] newList = [{'a':4},{'c':4},{'e':5}] ``` My aim is to check for each dictionary key in the oldList and if it has the same dictionary key as in the newList update the dictionary, else append to the oldLis...
2013/03/29
['https://codereview.stackexchange.com/questions/24514', 'https://codereview.stackexchange.com', 'https://codereview.stackexchange.com/users/23629/']
A list of 1-pair dictionaries makes no sense as data structure. You should join them to create a single dictionary. This way all your code reduces to: ``` d1 = {'a': 2, 'b': 2} d2 = {'a': 4, 'c': 4, 'e': 5} d3 = dict(d1, **d2) # {'a': 4, 'b': 2, 'c': 4, 'e': 5} ``` If you are going to union/merge dicts a lot, you ca...
``` def sortList(oldList, newList): ``` Python convention is to lowercase\_with\_underscores for pretty much everything besides class names ``` for new in newList: #{'a':4},{'c':4},{'e':5} isAdd = True ``` Avoid boolean flags. They are delayed gotos and make it harder to follow your code. In this case...
74,616,016
How do I add a string/integer into an existing text file at a specific location? My sample text looks like below: ```txt No, Color, Height, age 1, blue,70, 2, white,65, 3, brown,49, 4, purple,71, 5, grey,60, ``` My text file has 4 columns, three columns have text, how do I write to any row in the fourth column? ...
2022/11/29
['https://Stackoverflow.com/questions/74616016', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5255512/']
Here's the proper `case_when` syntax. ``` df <- data.frame(x = c("A", "B", "C", "D")) library(dplyr) df <- df %>% mutate(y = case_when(x %in% c("A", "D") ~ 1, x %in% c("B", "C") ~ 0, TRUE ~ NA_real_)) df #> x y #> 1 A 1 #> 2 B 0 #> 3 C 0 #> 4 D 1 ```
You're combining syntaxes in a way that makes sense in speech but not in code. Generally you can't use `foo == "G" | "H"`. You need to use `foo == "G" | foo == "H"`, or the handy shorthand `foo %in% c("G", "H")`. Similarly `x %in% df == "A"` doesn't make sense `x %in% df` makes sense. `df == "A"` makes sense. Putting ...
72,278,607
I am having a problem with my java and xml code. As I am using the Android Studio IDE I can see the good version of the app page I wanna make, while when I export it to my phone and build it it isn't working and everything is on top of each ither. I will be showing the code and pictures of what I see in the ide and wha...
2022/05/17
['https://Stackoverflow.com/questions/72278607', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/19070139/']
Even though you have arranged your views in the appropriate position for the design they don't have constraints. You can see that error in under the views in `activity_main.xml`. so try this layout which has some basic constraints. You can change the constraints as per your need ``` <androidx.constraintlayout.widget.C...
Try this I have made proper constraint with UI ``` <?xml version="1.0" encoding="utf-8"?> <androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_pa...
72,278,607
I am having a problem with my java and xml code. As I am using the Android Studio IDE I can see the good version of the app page I wanna make, while when I export it to my phone and build it it isn't working and everything is on top of each ither. I will be showing the code and pictures of what I see in the ide and wha...
2022/05/17
['https://Stackoverflow.com/questions/72278607', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/19070139/']
You have used `tools:layout_editor_absoluteX` and `tools:layout_editor_absoluteY` in your XML file. The `tools:` keyword is used to add attributes to views when you are in your IDE designing your XML file and won't apply to the build version and also you have forgot to add constraints when you've used constraint layo...
Try this I have made proper constraint with UI ``` <?xml version="1.0" encoding="utf-8"?> <androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_pa...
244,842
After running in the Exchange Shell add-MailboxPermission "user X" -user UserY Fullaccess to give userY the ability to access UserX's mailbox, is there anyway that User X can tell that User Y now has full access?
2011/03/08
['https://serverfault.com/questions/244842', 'https://serverfault.com', 'https://serverfault.com/users/73606/']
This is not detectable in Outlook, OWA or any other Exchange client, which is how all standard users usually access Exchange; however, a skilled user (or an administrator) *could* detect it by looking at the actual permissions on the AD user object or on the Exchange mailbox; this requires no actual console access to t...
No, unless UserY alters the content in a way that can be noticeable.
244,842
After running in the Exchange Shell add-MailboxPermission "user X" -user UserY Fullaccess to give userY the ability to access UserX's mailbox, is there anyway that User X can tell that User Y now has full access?
2011/03/08
['https://serverfault.com/questions/244842', 'https://serverfault.com', 'https://serverfault.com/users/73606/']
This is not detectable in Outlook, OWA or any other Exchange client, which is how all standard users usually access Exchange; however, a skilled user (or an administrator) *could* detect it by looking at the actual permissions on the AD user object or on the Exchange mailbox; this requires no actual console access to t...
The user (user X) that has had the permissions changed on their mailbox will not know unless the mailbox is opened on another users (User Y) machine, and User Y makes changes to the contents of the mailbox. In the past I have dealt with managers who have demanded this capability, and things got really ugly when the ma...
64,814,676
I have a simple HTMLAudioElement element: ``` let player = new Audio() player.src = 'file://' + _filePath player.load() ``` This pauses and plays by using the play/pause media keys while the windows isn't focused, **Q:** how do I make it ignore the play/pause keys? I'm using electron but not sure if this is a chro...
2020/11/13
['https://Stackoverflow.com/questions/64814676', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5905035/']
Found an answer in this question: [Disable media control keys with javascript](https://stackoverflow.com/questions/59347480/disable-media-control-keys-with-javascript), thanks @PableWeb18 We can just override the media key listeners: ``` navigator.mediaSession.setActionHandler('play', function() { /* Code excerpted. ...
To override a function you can use `prototype`, see the example below: ```js var audio = new Audio(); Audio.prototype.play = function() { console.log('Play override') }; Audio.prototype.stop = function() { console.log('Stop override') }; audio.play(); audio.stop(); ``` `EDIT:` So just add the primary function in...
12,114,174
Specifically, why would it help to fix a PermGen OutOfMemoryError issue? Also, bonus points for an answer that points me to the documentation on JVM arguments...
2012/08/24
['https://Stackoverflow.com/questions/12114174', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/242135/']
The permanent space is where the classes, methods, internalized strings, and similar objects used by the VM are stored and never deallocated (hence the name). [This Oracle article](http://www.oracle.com/technetwork/java/javase/gc-tuning-6-140523.html) succinctly presents the working and parameterization of the HotSpot...
`-XX:PermSize -XX:MaxPermSize` are used to set size for Permanent Generation. Permanent Generation: The Permanent Generation is where class files are kept. These are the result of compiled classes and JSP pages. If this space is full, it triggers a Full Garbage Collection. If the Full Garbage Collection cannot clean ...
12,114,174
Specifically, why would it help to fix a PermGen OutOfMemoryError issue? Also, bonus points for an answer that points me to the documentation on JVM arguments...
2012/08/24
['https://Stackoverflow.com/questions/12114174', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/242135/']
The permanent space is where the classes, methods, internalized strings, and similar objects used by the VM are stored and never deallocated (hence the name). [This Oracle article](http://www.oracle.com/technetwork/java/javase/gc-tuning-6-140523.html) succinctly presents the working and parameterization of the HotSpot...
In Java 8 that parameter is commonly used to print a warning message like this one: > > Java HotSpot(TM) 64-Bit Server VM warning: ignoring option > MaxPermSize=512m; support was removed in 8.0 > > > The reason why you get this message in Java 8 is because Permgen has been replaced by Metaspace to address some o...
12,114,174
Specifically, why would it help to fix a PermGen OutOfMemoryError issue? Also, bonus points for an answer that points me to the documentation on JVM arguments...
2012/08/24
['https://Stackoverflow.com/questions/12114174', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/242135/']
`-XX:PermSize -XX:MaxPermSize` are used to set size for Permanent Generation. Permanent Generation: The Permanent Generation is where class files are kept. These are the result of compiled classes and JSP pages. If this space is full, it triggers a Full Garbage Collection. If the Full Garbage Collection cannot clean ...
In Java 8 that parameter is commonly used to print a warning message like this one: > > Java HotSpot(TM) 64-Bit Server VM warning: ignoring option > MaxPermSize=512m; support was removed in 8.0 > > > The reason why you get this message in Java 8 is because Permgen has been replaced by Metaspace to address some o...
35,996,096
I am trying to find the number of Strings that only appear exactly once in an `ArrayList`. How many I achieve this (preferably with the best possible time complexity)? Below is my method: ``` public static int countNonRepeats(WordStream words) { ArrayList<String> list = new ArrayList<String>(); for (Strin...
2016/03/14
['https://Stackoverflow.com/questions/35996096', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5938067/']
Here's one simple suggestion: 1. First, sort your array by alphanumerical order 2. Iterate through with a loop, `if( !list.get(i).equals(list.get(i+1)) ) → unique` 3. If you find duplicates, increment `i` until you reach a different string This will have the complexity of the sorting algorithm, since step 2+3 should...
Is there any specific need of using an `ArrayList`? You can do it easily by using a `HashSet`. Here is the code snippet: ``` public static void main (String[] args) { String[] words = {"foo","bar","foo","fo","of","bar","of","ba","of","ab"}; Set<String> set = new HashSet<>(); Set<String> common = new HashS...
35,996,096
I am trying to find the number of Strings that only appear exactly once in an `ArrayList`. How many I achieve this (preferably with the best possible time complexity)? Below is my method: ``` public static int countNonRepeats(WordStream words) { ArrayList<String> list = new ArrayList<String>(); for (Strin...
2016/03/14
['https://Stackoverflow.com/questions/35996096', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5938067/']
Here's one simple suggestion: 1. First, sort your array by alphanumerical order 2. Iterate through with a loop, `if( !list.get(i).equals(list.get(i+1)) ) → unique` 3. If you find duplicates, increment `i` until you reach a different string This will have the complexity of the sorting algorithm, since step 2+3 should...
You can use hashmap to achieve this.With this approach we can count the occurrence of all the words, If we are interested in only unique words then access the element having count = 1. **`HashMap<String,Integer>`** - key represents the String from arraylist and Integer represents the count of occurrence. ``` ...
35,996,096
I am trying to find the number of Strings that only appear exactly once in an `ArrayList`. How many I achieve this (preferably with the best possible time complexity)? Below is my method: ``` public static int countNonRepeats(WordStream words) { ArrayList<String> list = new ArrayList<String>(); for (Strin...
2016/03/14
['https://Stackoverflow.com/questions/35996096', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5938067/']
Here's one simple suggestion: 1. First, sort your array by alphanumerical order 2. Iterate through with a loop, `if( !list.get(i).equals(list.get(i+1)) ) → unique` 3. If you find duplicates, increment `i` until you reach a different string This will have the complexity of the sorting algorithm, since step 2+3 should...
There is no need for sorting. A better approach would be to use two HashSet One for maintaining repeating and one for non-repeating words. Since HashSet internally uses HashMap, Ideally contains, get, put operation has o(1) complexity. So the overall complexity of this approach would be o(n). ``` public static in...
35,996,096
I am trying to find the number of Strings that only appear exactly once in an `ArrayList`. How many I achieve this (preferably with the best possible time complexity)? Below is my method: ``` public static int countNonRepeats(WordStream words) { ArrayList<String> list = new ArrayList<String>(); for (Strin...
2016/03/14
['https://Stackoverflow.com/questions/35996096', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5938067/']
Is there any specific need of using an `ArrayList`? You can do it easily by using a `HashSet`. Here is the code snippet: ``` public static void main (String[] args) { String[] words = {"foo","bar","foo","fo","of","bar","of","ba","of","ab"}; Set<String> set = new HashSet<>(); Set<String> common = new HashS...
You can use hashmap to achieve this.With this approach we can count the occurrence of all the words, If we are interested in only unique words then access the element having count = 1. **`HashMap<String,Integer>`** - key represents the String from arraylist and Integer represents the count of occurrence. ``` ...
35,996,096
I am trying to find the number of Strings that only appear exactly once in an `ArrayList`. How many I achieve this (preferably with the best possible time complexity)? Below is my method: ``` public static int countNonRepeats(WordStream words) { ArrayList<String> list = new ArrayList<String>(); for (Strin...
2016/03/14
['https://Stackoverflow.com/questions/35996096', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5938067/']
There is no need for sorting. A better approach would be to use two HashSet One for maintaining repeating and one for non-repeating words. Since HashSet internally uses HashMap, Ideally contains, get, put operation has o(1) complexity. So the overall complexity of this approach would be o(n). ``` public static in...
You can use hashmap to achieve this.With this approach we can count the occurrence of all the words, If we are interested in only unique words then access the element having count = 1. **`HashMap<String,Integer>`** - key represents the String from arraylist and Integer represents the count of occurrence. ``` ...
317,552
I'm trying to export a layer via QTiles, gotten from the Data Source Manager and connecting to ([USGSHydroCached](https://basemap.nationalmap.gov/arcgis/rest/services/USGSHydroCached/MapServer)). I have QTiles set to zoom levels `0-20` and `Render tiles outside of layers extent` checked (basemap goes up to `20`). For ...
2019/04/02
['https://gis.stackexchange.com/questions/317552', 'https://gis.stackexchange.com', 'https://gis.stackexchange.com/users/139763/']
The layer info at the link you provide indicates the MapServer should provide tiles up to level 19, not 20 as you'd like. But that shouldn't create problems at level 17! However, I've played around with zooming in on the layer the QGis map window and it shows up at scales up to 1:6019, but not more detailed than that....
As @Houska has noted the map service that you are using only provides tiles down to level 17. However, the data supplied in the map service is the [USGS National Hydrography Dataset](https://www.usgs.gov/core-science-systems/ngp/national-hydrography/access-national-hydrography-products) which is freely available to dow...
28,175
After some research surrounding this I can't seem to fix this issue. So for a project I made a simple module with some variables that simply has to make an OAuth1 call and return some data. The provider of the website advised me to use : <https://github.com/thephpleague/oauth1-client> So in my module I initialised a...
2018/10/23
['https://craftcms.stackexchange.com/questions/28175', 'https://craftcms.stackexchange.com', 'https://craftcms.stackexchange.com/users/8359/']
Twig has an [interpolation syntax](https://twig.symfony.com/doc/2.x/templates.html#string-interpolation) (using `#{}` inside a double-quoted string) to accomplish this: ``` {% set location = block.locationVacancies %} {% set entries = craft .entries .section('careers') .search("locationVacancies:#{location...
```twig {% set location = block.locationVacancies %} {% set entries = craft .entries .section('careers') .search('locationVacancies:"' ~ location ~ '"') .find() %} ```
44,790,947
I am working on music app so I am trying to do a button when I click it the song be repeating and the background change I have two background one of them I want to make it background of the button when play the song once and the another when the song is repeating ``` package khaledbanafa.shaylat; impor...
2017/06/27
['https://Stackoverflow.com/questions/44790947', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/7872328/']
Anything is possible in the magical world of software, not only can it be done but there are many different ways of achieving it. Here is a rough example: <https://jsfiddle.net/n6fm39ww/> HTML ``` <select name="start_time"> </select> <select name="end_time"> <option value="default">Pick a start time</option> </se...
Please make sure to provide code samples in the future. Here is an example of how that is done: <https://jsfiddle.net/c6432wee/> --- Say we have two selects. `<select id="startTime"> <option value="na">Please Select A Time</option> <option value=1>1:00PM</option> </select>` `<select id="endTime"> <option value=...
12,930,583
I have been trying to upload an image using CodeIgniter's File Upload class. The image is used for a user's avatar. Here is a snippet for my code: ``` //upload file if($_FILES['image']['name'] != ''){ if (!file_exists($dirpath)) mkdir($dirpath); $this->l...
2012/10/17
['https://Stackoverflow.com/questions/12930583', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/805183/']
My mistake, I assigned `$old_image` after I updated the data, so `$old_image` contains the current image name, causing it to be deleted when i call `unlink($file)`. Problem solved :)
Please update your Upload.php class with previous version of CodeIgniter
22,018,987
I've got the following crash in `GameHelper.java`: > > [main] java.lang.NullPointerException at > com.google.android.gms.common.ConnectionResult.startResolutionForResult(Unknown > Source) at > com.google.example.games.basegameutils.GameHelper.resolveConnectionResult(GameHelper.java:752) > at > com.google.example...
2014/02/25
['https://Stackoverflow.com/questions/22018987', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1986565/']
EDIT: This now has been fixed in latest GameHelper version: <https://github.com/playgameservices/android-samples/commit/e7b3758c136b5b434f1dfd9ca8c03f75aad70f09> OLD ANSWER: For me it happens on the start of the app, when Google Play Services asks me to sign in and if I click cancel, this same error happens. So whe...
Today is 16th september 2014 and I still facing this problem. I don't know why anyone else did not answer about to comment GameHelper line. In onStop method there is a line to set mActivity variable as null. I commented this line (like below) and my app is working properly. ``` /** Call this method from your A...
26,003,797
Assuming that there are many elements in a webpage how do i apply CSS to: * All the `<hr>` that are AFTER an unordered list * All the `<hr>` that are AFTER `<div>` * All the `<span>` which are inside `<p><article>` * All the `<span>` which are inside `<article>` Example: ``` #first > p > em { background: #739D0...
2014/09/23
['https://Stackoverflow.com/questions/26003797', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3257288/']
The appropriate selectors, in order: ``` ul + hr {} div + hr {} p > article span {} article span {} ``` Remarks: ======== The `+` selector selects all elements **immediately** after a given element. In general, `A + B`, will cause the first element `B` that follows after any element `A`, to be styled. You can also...
You can use those selectors: * [Next-sibling combinator](http://dev.w3.org/csswg/selectors3/#adjacent-sibling-combinators) (`+`) For example, `ul + hr` matches all `hr` that are immediately preceded by an `ul` (ignoring non-element nodes). * [Following-sibling combinator](http://dev.w3.org/csswg/selectors3/#general-s...
26,003,797
Assuming that there are many elements in a webpage how do i apply CSS to: * All the `<hr>` that are AFTER an unordered list * All the `<hr>` that are AFTER `<div>` * All the `<span>` which are inside `<p><article>` * All the `<span>` which are inside `<article>` Example: ``` #first > p > em { background: #739D0...
2014/09/23
['https://Stackoverflow.com/questions/26003797', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3257288/']
The appropriate selectors, in order: ``` ul + hr {} div + hr {} p > article span {} article span {} ``` Remarks: ======== The `+` selector selects all elements **immediately** after a given element. In general, `A + B`, will cause the first element `B` that follows after any element `A`, to be styled. You can also...
Instead of `<hr>`, use border-bottom article is a block-level item that essentially replaces a `<div>` tag, and `<p>` tags should be within `<article>`, ``` article {border-bottom:#C3F 8px solid} article span {font-size:200%; color:#C3F} ul {border-bottom:#C3F 8px solid} ``` and in html, looks like this: ``` <a...
26,003,797
Assuming that there are many elements in a webpage how do i apply CSS to: * All the `<hr>` that are AFTER an unordered list * All the `<hr>` that are AFTER `<div>` * All the `<span>` which are inside `<p><article>` * All the `<span>` which are inside `<article>` Example: ``` #first > p > em { background: #739D0...
2014/09/23
['https://Stackoverflow.com/questions/26003797', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3257288/']
You can use those selectors: * [Next-sibling combinator](http://dev.w3.org/csswg/selectors3/#adjacent-sibling-combinators) (`+`) For example, `ul + hr` matches all `hr` that are immediately preceded by an `ul` (ignoring non-element nodes). * [Following-sibling combinator](http://dev.w3.org/csswg/selectors3/#general-s...
Instead of `<hr>`, use border-bottom article is a block-level item that essentially replaces a `<div>` tag, and `<p>` tags should be within `<article>`, ``` article {border-bottom:#C3F 8px solid} article span {font-size:200%; color:#C3F} ul {border-bottom:#C3F 8px solid} ``` and in html, looks like this: ``` <a...
846,279
I have found a lot of very solid articles/answers about this topic: * <https://askubuntu.com/a/555812/574648> * <https://unix.stackexchange.com/a/213984> * <https://askubuntu.com/a/662567/574648> And of course: * <https://wiki.archlinux.org/index.php/Xrandr> * <https://wiki.archlinux.org/index.php/HiDPI#Multiple_dis...
2016/11/06
['https://askubuntu.com/questions/846279', 'https://askubuntu.com', 'https://askubuntu.com/users/574648/']
I have nvidia driver `340.98` with GT218M [NVS 3100M], Xubuntu 16.04, any results below are from this environment if I don't mention otherwise. Here is [my testing environment info](https://paste.ubuntu.com/23738679/), the output of: ``` sudo apt-get install pastebinit; \ sudo sh -c "lsb_release -sd; \ dmidecode -s s...
I found a simple solution. I am running Ubuntu 18.04. This is my xrandr output: ``` light@light:~$ xrandr Screen 0: minimum 8 x 8, current 5760 x 2160, maximum 32767 x 32767 HDMI-0 connected 1920x1080+3840+92 (normal left inverted right x axis y axis) 476mm x 268mm 1920x1080 60.00*+ 59.94 50.00 1680x10...
28,630,360
I want to read a number as a String, and split its characters to an integer array, and find the sum of it's digits by looping through that integers array. This is my code so far: ``` public static void main(String[] args) { Scanner S = new Scanner(System.in); String Number = S.next(); int counterEnd = Num...
2015/02/20
['https://Stackoverflow.com/questions/28630360', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3301836/']
You can subtract the `'0'` character (i.e. `'1' - '0'` is `49 - 48` = `1`): ``` sum += Number.charAt(i) - '0'; ```
You could, has @August suggested, substract the character `'0'` to obtain the numeric value of the character (I find this approach kind of hackish). Or you can use [`Character.getNumericValue`](http://docs.oracle.com/javase/7/docs/api/java/lang/Character.html#getNumericValue(char)) to achieve this: ``` sum += Characte...
28,630,360
I want to read a number as a String, and split its characters to an integer array, and find the sum of it's digits by looping through that integers array. This is my code so far: ``` public static void main(String[] args) { Scanner S = new Scanner(System.in); String Number = S.next(); int counterEnd = Num...
2015/02/20
['https://Stackoverflow.com/questions/28630360', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3301836/']
You can subtract the `'0'` character (i.e. `'1' - '0'` is `49 - 48` = `1`): ``` sum += Number.charAt(i) - '0'; ```
``` sum+= Integer.parseInt(String.valueOf(Number.charAt(i))); ```
28,630,360
I want to read a number as a String, and split its characters to an integer array, and find the sum of it's digits by looping through that integers array. This is my code so far: ``` public static void main(String[] args) { Scanner S = new Scanner(System.in); String Number = S.next(); int counterEnd = Num...
2015/02/20
['https://Stackoverflow.com/questions/28630360', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3301836/']
You can subtract the `'0'` character (i.e. `'1' - '0'` is `49 - 48` = `1`): ``` sum += Number.charAt(i) - '0'; ```
You can do it like this: ``` public static void main(String[] args) { Scanner S = new Scanner(System.in); String n = S.next(); int sum = 0; for (int i = 0; i < n.length(); i++) { sum += Integer.parseInt(n.substring(i, i+1)); } System.out.println(sum); } ``` Note: Replacin...
28,630,360
I want to read a number as a String, and split its characters to an integer array, and find the sum of it's digits by looping through that integers array. This is my code so far: ``` public static void main(String[] args) { Scanner S = new Scanner(System.in); String Number = S.next(); int counterEnd = Num...
2015/02/20
['https://Stackoverflow.com/questions/28630360', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3301836/']
You could, has @August suggested, substract the character `'0'` to obtain the numeric value of the character (I find this approach kind of hackish). Or you can use [`Character.getNumericValue`](http://docs.oracle.com/javase/7/docs/api/java/lang/Character.html#getNumericValue(char)) to achieve this: ``` sum += Characte...
``` sum+= Integer.parseInt(String.valueOf(Number.charAt(i))); ```
28,630,360
I want to read a number as a String, and split its characters to an integer array, and find the sum of it's digits by looping through that integers array. This is my code so far: ``` public static void main(String[] args) { Scanner S = new Scanner(System.in); String Number = S.next(); int counterEnd = Num...
2015/02/20
['https://Stackoverflow.com/questions/28630360', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3301836/']
You could, has @August suggested, substract the character `'0'` to obtain the numeric value of the character (I find this approach kind of hackish). Or you can use [`Character.getNumericValue`](http://docs.oracle.com/javase/7/docs/api/java/lang/Character.html#getNumericValue(char)) to achieve this: ``` sum += Characte...
You can do it like this: ``` public static void main(String[] args) { Scanner S = new Scanner(System.in); String n = S.next(); int sum = 0; for (int i = 0; i < n.length(); i++) { sum += Integer.parseInt(n.substring(i, i+1)); } System.out.println(sum); } ``` Note: Replacin...
35,994,855
I have a dictionary of dictionary as below: ``` ls = [{'0': {'1': '1','2': '0.5','3': '1'},'1': {'0': '0.2','2': '1','3': '0.8'},}] ``` I would like to select k-largest values with their keys for each key of dictionary (ls). I have written below commands. It just gives me the k-largest keys without their values. **...
2016/03/14
['https://Stackoverflow.com/questions/35994855', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/6062233/']
* First of all, I just wanted to check why you have `ls = [{'0': {'1': '1','2': '0.5','3': '1'},'1': {'0': '0.2','2': '1','3': '0.8'},}]` This is a list containing a dict, which doesn't match your description in the question. * Here is a solution that uses dict comprehensions that should give you what you want :) `...
How about: ``` from operator import itemgetter for d in ls: for key, d2 in d.items(): print(dict(heapq.nlargest(k, d2.items(), key=itemgetter(1)))) ``` Notice that your *values* are still *strings* so they'd be lexically ordered, which is not what you want, because `'2' > 12'` And the dictionary is not o...
239
Is it acceptable to ask **fitness equipment** related questions on Fitness.SE? I'm specifically referring to my treadmill and my question would be along the lines of *why does my treadmill do X at certain speeds*? Looking at the [FAQ](https://fitness.stackexchange.com/faq), I see that **gear and gadgets used during ex...
2012/01/13
['https://fitness.meta.stackexchange.com/questions/239', 'https://fitness.meta.stackexchange.com', 'https://fitness.meta.stackexchange.com/users/2698/']
Our [faq](https://fitness.stackexchange.com/faq) states "gear and gadgets used during exercise" is on-topic. Presumably, as I said in [my comment](https://fitness.meta.stackexchange.com/questions/239/questions-about-fitness-equipment#comment459_239) on your question, a question about fitness equipment should be on-topi...
This question is similar to asking questions on SO related to specific IDEs, rather than the code generated by them. It seems that on SO these questions are acceptable [[1]](https://stackoverflow.com/questions/tagged/eclipse)[[2]](https://stackoverflow.com/questions/tagged/xcode)[[3]](https://stackoverflow.com/question...
239
Is it acceptable to ask **fitness equipment** related questions on Fitness.SE? I'm specifically referring to my treadmill and my question would be along the lines of *why does my treadmill do X at certain speeds*? Looking at the [FAQ](https://fitness.stackexchange.com/faq), I see that **gear and gadgets used during ex...
2012/01/13
['https://fitness.meta.stackexchange.com/questions/239', 'https://fitness.meta.stackexchange.com', 'https://fitness.meta.stackexchange.com/users/2698/']
This question is similar to asking questions on SO related to specific IDEs, rather than the code generated by them. It seems that on SO these questions are acceptable [[1]](https://stackoverflow.com/questions/tagged/eclipse)[[2]](https://stackoverflow.com/questions/tagged/xcode)[[3]](https://stackoverflow.com/question...
Shopping recommendations have typically been off topic. The [stackexchange blog post](http://blog.stackoverflow.com/2010/11/qa-is-hard-lets-go-shopping/) defines how they should be rephrased: > > Here’s one way to ask: > > > Q: What’s the best low light point-and-shoot camera? > > > A: Canon S90 and Lumix LX3. > ...
239
Is it acceptable to ask **fitness equipment** related questions on Fitness.SE? I'm specifically referring to my treadmill and my question would be along the lines of *why does my treadmill do X at certain speeds*? Looking at the [FAQ](https://fitness.stackexchange.com/faq), I see that **gear and gadgets used during ex...
2012/01/13
['https://fitness.meta.stackexchange.com/questions/239', 'https://fitness.meta.stackexchange.com', 'https://fitness.meta.stackexchange.com/users/2698/']
Our [faq](https://fitness.stackexchange.com/faq) states "gear and gadgets used during exercise" is on-topic. Presumably, as I said in [my comment](https://fitness.meta.stackexchange.com/questions/239/questions-about-fitness-equipment#comment459_239) on your question, a question about fitness equipment should be on-topi...
Shopping recommendations have typically been off topic. The [stackexchange blog post](http://blog.stackoverflow.com/2010/11/qa-is-hard-lets-go-shopping/) defines how they should be rephrased: > > Here’s one way to ask: > > > Q: What’s the best low light point-and-shoot camera? > > > A: Canon S90 and Lumix LX3. > ...
14,074,731
Is it valid HTML to use IRIs containing non-ASCII characters as attribute values (e.g. for `href` attributes) instead of URIs? Are there any differences among the HTML flavors (HTML and XHTML, 4 and 5)? At least [RFC 3986](https://www.rfc-editor.org/rfc/rfc3986#page-16) seems to imply that it isn't. I realize that it ...
2012/12/28
['https://Stackoverflow.com/questions/14074731', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1016939/']
HTML 4.01 is straightforward enough. Different attributes have different rules as to what they can contain, but if we're dealing with the href attribute on an `<a>` element, then the [HTML 4 spec, section B.2.1 Non-ASCII characters in URI attribute values](http://www.w3.org/TR/html4/appendix/notes.html#non-ascii-chars)...
When in doubt, read the official HTML specs for definitive answers. HTML 4 does not support IRIs at all. They must be encoded as URIs per [RFC 3987 Section 3.1](https://www.rfc-editor.org/rfc/rfc3987#section-3.1), or encode non-ASCII URI data as UTF-8 with percent encoding per [HTML4 Section B.2.1](http://www.w3.org/T...
3,428,999
Prove $\sin(\sqrt x)$ is not periodic. My wrong assumption was non-periodicity is due to the injectivity of the square root, but, then this would work for any positive real number, but it doesn't, and $\sin(x^2)$ isn't periodic either, so injectivity fails. I find this example more interesting because it is defined o...
2019/11/09
['https://math.stackexchange.com/questions/3428999', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/721644/']
Hint: Consider at what points $\sin(\sqrt x)$ is equal to $0$. If the function were periodic, could those points get further and further apart?
Let us look at zeroes of $$f(x) = \sin \sqrt x $$ The zeroes of this function are $$x=0, x= \pi ^2, x=4\pi ^2, x=9\pi ^2,....$$ which are not equi-distance. For a periodic function we have to have $f(x+P)=f(x)$ for some period $P$ so if you get $ f(x)=0$ , you have to have $$f(x+P)=f(x+2P)=... =0$$ that is zeroes ...
3,428,999
Prove $\sin(\sqrt x)$ is not periodic. My wrong assumption was non-periodicity is due to the injectivity of the square root, but, then this would work for any positive real number, but it doesn't, and $\sin(x^2)$ isn't periodic either, so injectivity fails. I find this example more interesting because it is defined o...
2019/11/09
['https://math.stackexchange.com/questions/3428999', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/721644/']
Hint: Consider at what points $\sin(\sqrt x)$ is equal to $0$. If the function were periodic, could those points get further and further apart?
Let $f$ be periodic with period $T$. Then for $f(g(u))$ to be periodic with period $U$, we need $$g(u+U)=g(u)+kT$$ for some integer constant $k$. Now if $$h(u):=g(u)-kT\frac uU,$$ $$h(u+U)=g(u+U)-kT\frac{u+U}U=g(u)+kT-kT\frac{u+U}U=h(u)$$ and $h$ is periodic. Finally, $g$ must be of the form $$g(u)=kT\frac uU+h(u...
536,207
I download a tarball containing only one directory; this directory has a very long name. I desire to change that directory's name once I extract it from the tarball but I prefer another way than `mkdir` with `strip-components 1` and `-C`. I consider `mv` but I prefer to automatically hold the directory's name in a v...
2019/08/19
['https://unix.stackexchange.com/questions/536207', 'https://unix.stackexchange.com', 'https://unix.stackexchange.com/users/-1/']
I'm not sure if I understood your question correctly but I think you're looking for something like this: ``` $ dir="$(tar tf archive.tar | cut -d / -f1 | uniq)" $ echo "$dir" tar-very-long-nime-very-very-long ```
With GNU tar you can use a sed-like expression to transform the file names: ``` tar -xf archive.tar.gz --xform='s,^very_long_name,short,' ``` Read about the whole thing [here](https://www.gnu.org/software/tar/manual/tar.html#SEC115).
536,207
I download a tarball containing only one directory; this directory has a very long name. I desire to change that directory's name once I extract it from the tarball but I prefer another way than `mkdir` with `strip-components 1` and `-C`. I consider `mv` but I prefer to automatically hold the directory's name in a v...
2019/08/19
['https://unix.stackexchange.com/questions/536207', 'https://unix.stackexchange.com', 'https://unix.stackexchange.com/users/-1/']
The following assumes that you are working with an archive in the current directory. ``` tar -x -f "$archivedir.tar" mv "$archivedir" new-name ``` This assumes that the variable `$archivedir` contains the name of the `tar` archive without the `.tar` suffix and that this is also the name of the directory that will be...
With GNU tar you can use a sed-like expression to transform the file names: ``` tar -xf archive.tar.gz --xform='s,^very_long_name,short,' ``` Read about the whole thing [here](https://www.gnu.org/software/tar/manual/tar.html#SEC115).
17,961,813
I have the following: ``` var catCreyz = function() { console.log('maaaow'); }.call() ``` and when I test its type: ``` typeof catCreyz ``` The result returned is: > > undefined > > > Why?
2013/07/31
['https://Stackoverflow.com/questions/17961813', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1061967/']
[Function.prototype.call](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/call) returns what the function being called returns. Your function returns nothing ``` var catCreyz = function() { console.log('maaaow'); }.call() //logs undefined console.log(catCreyz); var result = f...
Call executes the function, and you're missing a return statement in your function, Javascript does not return the last expression like other languages. You must explicitly return a value, else you get undefined. If you want an instance of catCreyz, then take the call() off the expression.
107,132
we are using custom module for finding shipping charges and **we wrote the list of supported zip codes in below code**. what we need is instead of saving zip codes in code, we want to **save list of zip codes in database**. we saved list of zip codes in backend as below. Now we have to connect this DB to below code, ...
2016/03/21
['https://magento.stackexchange.com/questions/107132', 'https://magento.stackexchange.com', 'https://magento.stackexchange.com/users/12982/']
Create a module called '**ZipcodeChecker**' **config.xml** is ``` <?xml version="1.0"?> <config> <modules> <SR_ZipcodeChecker> <version>0.0.0.1 </SR_ZipcodeChecker> </modules> <frontend> <routers> <checkout> <args> <module...
If you want receive data from the your module field (`textarea` in system config), you could use next solution: ``` public function getRestrictedZipCodes() { // Replace 'test/module/zips' with the original path from the system.xml file $restrictedCodesString = Mage::getStoreConfig('test/module/zips'); $res...
107,132
we are using custom module for finding shipping charges and **we wrote the list of supported zip codes in below code**. what we need is instead of saving zip codes in code, we want to **save list of zip codes in database**. we saved list of zip codes in backend as below. Now we have to connect this DB to below code, ...
2016/03/21
['https://magento.stackexchange.com/questions/107132', 'https://magento.stackexchange.com', 'https://magento.stackexchange.com/users/12982/']
Create a module called '**ZipcodeChecker**' **config.xml** is ``` <?xml version="1.0"?> <config> <modules> <SR_ZipcodeChecker> <version>0.0.0.1 </SR_ZipcodeChecker> </modules> <frontend> <routers> <checkout> <args> <module...
create an extension what will provide a section in system configuration(You can create this by silk module creator). and corresponding messages. and create an Ajax for front-end check. and fetch data from that system->configuration part and do your checking part. enjoy.. :)
107,132
we are using custom module for finding shipping charges and **we wrote the list of supported zip codes in below code**. what we need is instead of saving zip codes in code, we want to **save list of zip codes in database**. we saved list of zip codes in backend as below. Now we have to connect this DB to below code, ...
2016/03/21
['https://magento.stackexchange.com/questions/107132', 'https://magento.stackexchange.com', 'https://magento.stackexchange.com/users/12982/']
If you want receive data from the your module field (`textarea` in system config), you could use next solution: ``` public function getRestrictedZipCodes() { // Replace 'test/module/zips' with the original path from the system.xml file $restrictedCodesString = Mage::getStoreConfig('test/module/zips'); $res...
create an extension what will provide a section in system configuration(You can create this by silk module creator). and corresponding messages. and create an Ajax for front-end check. and fetch data from that system->configuration part and do your checking part. enjoy.. :)
29,349,499
I was looking for some solution about adding new value into list. Eg. I have list of values ``` n = c(2, 3, 5) s = c("aa", "bb", "cc", "dd", "ee") b = c(TRUE, FALSE, TRUE, FALSE, FALSE) x = list(n, s, b, 3) # x contains copies of n, s, b ``` and I need to add value 6 to list x to have in x[[1]] 2, 3, 5, 6 value...
2015/03/30
['https://Stackoverflow.com/questions/29349499', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4274408/']
The reason why nothing was being written to the Difference file is because it was not closed. In my create\_diff proc, I forgot to include the command: `close $dso1` Therefore once the script finished running, only then it would write to the file. However, right after the diff proc, I compress the files, and since it c...
``` set status [catch {exec diff $file1 $file2} result] ``` "status" is **not** `diff`'s exit status, it is `catch`'s exit status. Not the same. To get `diff`'s exit status: ``` if {$status == 1} { set err_type [lindex $::errorCode 0] if {$err_type eq "NONE"} { # diff exited with exit status 0 but pr...
14,863,806
Well I've did do my research and I just can't seem to figure this out. So long story short, I'm using something like this: btw, "(WebsiteInfo)" is just to sensor out my website/database information. ``` $SQL = new PDO('mysql:dbname=(WebsiteInfo);host=(WebsiteInfo);charset=utf8', '(WebsiteInfo)', '(WebsiteInfo)'); $S...
2013/02/13
['https://Stackoverflow.com/questions/14863806', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1733856/']
I do my PDO queries like this: ``` $user_id = 16; $query = $SQL->prepare('SELECT tags FROM users WHERE user_id = :uid'); $query->bindValue(':uid', $user_id, PDO::PARAM_INT); $query->execute(); while ($row = $query->fetch(PDO::FETCH_ASSOC)) { echo $row['tags']; } ``` This will select data from the database,...
There is a thing called *user defined function*. I am wondering why noone on this site ever using them. For some reason everyone is ready to make a mile long single line of chained methods, instead of clean and concise function call: ``` $user_id = 16; $tags = getone('SELECT tags FROM users WHERE user_id = ?'...
50,848
This is my first question on here so I hope I'm not breaking any rules, but I have a problem: I have a site that uses an Adobe Site Catalyst for its online analytics. The suite supports tagging through JavaScript and when implemented, it looks something like this that is placed on `http://www.mydomain.com`: ``` <scri...
2013/07/16
['https://webmasters.stackexchange.com/questions/50848', 'https://webmasters.stackexchange.com', 'https://webmasters.stackexchange.com/users/-1/']
I've encountered this as well. It's annoying that Google is reporting 404 errors on something you never actually link to, but only based on their heuristic that finds links in JavaScript code. These reported errors don't seem to indicate actual problems than need to be addressed. [Google's John Mueller posted this on ...
The only thing that is impacted by this is your crawling budget so unless it’s millions of urls I wouldn’t worry about it
42,297,695
I have a numpy binary array like this: ``` np_bin_array = [0 1 0 0 1 0 0 0 0 1 1 0 0 1 0 1 0 1 1 0 1 1 0 0 0 1 1 0 1 1 0 0 0 1 1 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] ``` It was 8-bit string characters of a word originally, starting from the left, with 0's padding it out. I need to convert this...
2017/02/17
['https://Stackoverflow.com/questions/42297695', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/7580607/']
You can firstly interpret the bits into an array, using [`numpy.packbits()`](https://docs.scipy.org/doc/numpy/reference/generated/numpy.packbits.html), then convert it to an array of bytes by applying [`bytearray()`](https://docs.python.org/3.6/library/functions.html#bytearray), then `decode()` it to be a normal string...
This one works to me. I had a boolean array though, so had to make an additional conversion. ``` def split_list(alist,max_size=1): """Yield successive n-sized chunks from l.""" for i in range(0, len(alist), max_size): yield alist[i:i+max_size] result = "".join([chr(i) for i in (int("".join([str(int(j)...