qid
int64
1
74.7M
question
stringlengths
0
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
2
48.3k
response_k
stringlengths
2
40.5k
2,526,826
I'm looking over the documentation that comes with Apache Ant version 1.8.0 and can't find where classpath, path and pathelement are documented. I've found a page that describes path like structures but it doesn't list the valid attributes or nested elements for these. Another thing I can't find in the documentation is...
2010/03/26
[ "https://Stackoverflow.com/questions/2526826", "https://Stackoverflow.com", "https://Stackoverflow.com/users/291154/" ]
This is the closest I could find to documentation on classpath. <http://ant.apache.org/manual/using.html#path>
[Path](https://ant.apache.org/manual-1.9.x/api/org/apache/tools/ant/types/Path.html): > > This object represents a path as used by CLASSPATH or PATH environment variable. A path might also be described as a collection of unique filesystem resources. > > > and [PathElement](https://ant.apache.org/manual-1.9.x/api/...
105
Is it possible to reliably run a Pi in an airtight (watertight) case or is some form of ventilation required for cooling? I'm assuming it doesn't chuck out too much heat, but am wondering whether running it indefinitely this way may cause issues.
2012/06/12
[ "https://raspberrypi.stackexchange.com/questions/105", "https://raspberrypi.stackexchange.com", "https://raspberrypi.stackexchange.com/users/93/" ]
There are **no ventilation or cooling requirements.** This has been verified by an RPi admin [here](http://www.raspberrypi.org/phpBB3/viewtopic.php?f=2&t=1701).
Based on my test Raspberry Pi runs relatively cool even when the CPU is 100% loaded for longer periods, so I think there shouldn't be a problem (I did not try loading the GPU though).
105
Is it possible to reliably run a Pi in an airtight (watertight) case or is some form of ventilation required for cooling? I'm assuming it doesn't chuck out too much heat, but am wondering whether running it indefinitely this way may cause issues.
2012/06/12
[ "https://raspberrypi.stackexchange.com/questions/105", "https://raspberrypi.stackexchange.com", "https://raspberrypi.stackexchange.com/users/93/" ]
Yes, under usual circumstances it should be possible to run the Raspberry Pi in an airtight case. I have measured some temperatures confirming that there is amply thermal headroom. For reference: * 22°C room temperature * 42°C idle I ran [sysbench](http://sysbench.sourceforge.net/docs/#cpu_mode) to stress the CPU: ...
Based on my test Raspberry Pi runs relatively cool even when the CPU is 100% loaded for longer periods, so I think there shouldn't be a problem (I did not try loading the GPU though).
105
Is it possible to reliably run a Pi in an airtight (watertight) case or is some form of ventilation required for cooling? I'm assuming it doesn't chuck out too much heat, but am wondering whether running it indefinitely this way may cause issues.
2012/06/12
[ "https://raspberrypi.stackexchange.com/questions/105", "https://raspberrypi.stackexchange.com", "https://raspberrypi.stackexchange.com/users/93/" ]
Based on my test Raspberry Pi runs relatively cool even when the CPU is 100% loaded for longer periods, so I think there shouldn't be a problem (I did not try loading the GPU though).
According to [this test](https://www.jeffgeerling.com/blog/2019/raspberry-pi-microsd-card-performance-comparison-2019) the USB 3.0 controller on Raspberry Pi 4 cannot work at full speed if there is no fan. The slow down without a fan could be 2-3 times. In the test the maximum speed was 346 MB/s for USB 3.0 (for compar...
105
Is it possible to reliably run a Pi in an airtight (watertight) case or is some form of ventilation required for cooling? I'm assuming it doesn't chuck out too much heat, but am wondering whether running it indefinitely this way may cause issues.
2012/06/12
[ "https://raspberrypi.stackexchange.com/questions/105", "https://raspberrypi.stackexchange.com", "https://raspberrypi.stackexchange.com/users/93/" ]
There are **no ventilation or cooling requirements.** This has been verified by an RPi admin [here](http://www.raspberrypi.org/phpBB3/viewtopic.php?f=2&t=1701).
Yes, under usual circumstances it should be possible to run the Raspberry Pi in an airtight case. I have measured some temperatures confirming that there is amply thermal headroom. For reference: * 22°C room temperature * 42°C idle I ran [sysbench](http://sysbench.sourceforge.net/docs/#cpu_mode) to stress the CPU: ...
105
Is it possible to reliably run a Pi in an airtight (watertight) case or is some form of ventilation required for cooling? I'm assuming it doesn't chuck out too much heat, but am wondering whether running it indefinitely this way may cause issues.
2012/06/12
[ "https://raspberrypi.stackexchange.com/questions/105", "https://raspberrypi.stackexchange.com", "https://raspberrypi.stackexchange.com/users/93/" ]
There are **no ventilation or cooling requirements.** This has been verified by an RPi admin [here](http://www.raspberrypi.org/phpBB3/viewtopic.php?f=2&t=1701).
According to [this test](https://www.jeffgeerling.com/blog/2019/raspberry-pi-microsd-card-performance-comparison-2019) the USB 3.0 controller on Raspberry Pi 4 cannot work at full speed if there is no fan. The slow down without a fan could be 2-3 times. In the test the maximum speed was 346 MB/s for USB 3.0 (for compar...
105
Is it possible to reliably run a Pi in an airtight (watertight) case or is some form of ventilation required for cooling? I'm assuming it doesn't chuck out too much heat, but am wondering whether running it indefinitely this way may cause issues.
2012/06/12
[ "https://raspberrypi.stackexchange.com/questions/105", "https://raspberrypi.stackexchange.com", "https://raspberrypi.stackexchange.com/users/93/" ]
Yes, under usual circumstances it should be possible to run the Raspberry Pi in an airtight case. I have measured some temperatures confirming that there is amply thermal headroom. For reference: * 22°C room temperature * 42°C idle I ran [sysbench](http://sysbench.sourceforge.net/docs/#cpu_mode) to stress the CPU: ...
According to [this test](https://www.jeffgeerling.com/blog/2019/raspberry-pi-microsd-card-performance-comparison-2019) the USB 3.0 controller on Raspberry Pi 4 cannot work at full speed if there is no fan. The slow down without a fan could be 2-3 times. In the test the maximum speed was 346 MB/s for USB 3.0 (for compar...
58,074,976
How to resolve Laravel 401 (Unauthorized) error for a particular single URL. url is accessible directly but when request send using axios its how this error.
2019/09/24
[ "https://Stackoverflow.com/questions/58074976", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1937521/" ]
api\_token: this.user.api\_token ``` axios.post("http://foo", {headers: { 'Authorization' : 'Bearer '+ api_token}}) .then(response => { //action }) ``` link: <https://forum.vuejs.org/t/401-unauthorized-vuejs-laravel-and-passport/59770> or ``` p...
Some people just assume all has been configured right out of the box; but you need to: Follow this Laravel documentation to gain api\_token for all your users. [Laravel api authentication](https://laravel.com/docs/6.x/api-authentication) **NOTE:** When you register users, if users api\_token in database is still bein...
117,025
I used pc decrapifier to uninstall lots of programs because revo uninstaller takes a lot of your time just to uninstall a single program. Can I remove the registry keys and folders left behind by pc decrapifier using revo uninstaller? Or do you know of any application that function like decrapifier and revo?
2010/03/06
[ "https://superuser.com/questions/117025", "https://superuser.com", "https://superuser.com/users/23950/" ]
Yes, Revo can get rid of the registry entries. Depending on which scan mode you use, it can look into more places in the registry for a deeper scan: ![alt text](https://i.stack.imgur.com/WG4Jr.png) [**CCleaner**](http://www.ccleaner.com/) also performs registry scanning for old entries lying around.
As I understand, OP wanted to clean the Registry after the UNINSTALL OF APPLICATION has already been made before opening Revo. Accepted answer doesn't answer that. Unfortunately, it doesn't seem possible doable directly. However: A) Re-install that target application and uninstall again, now with REVO. OR B) use CCl...
298,601
I am trying to create custom page page having error 404. **routes.xml** ``` <?xml version="1.0"?> <!-- /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framewor...
2019/12/13
[ "https://magento.stackexchange.com/questions/298601", "https://magento.stackexchange.com", "https://magento.stackexchange.com/users/84377/" ]
Please correct your file path with below structure > > app/code/SimpleMagento/Custom/registration.php > > > Content for this file is.. ``` <?php \Magento\Framework\Component\ComponentRegistrar::register( \Magento\Framework\Component\ComponentRegistrar::MODULE, 'SimpleMagento_Custom', __DIR__ ); ``` ...
Calling wrong route. call ``` hello_test_displayInfo ``` URL : ``` hello/test/displayInfo ```
58,040,303
I was wasting a lot of time figuring out why an algorithm that should be more efficient than another one, however, was perfectly the same in terms of speed to the other. I did these operations: I compiled the first source code in a separate terminal window; while the second source code in another window. I simply used ...
2019/09/21
[ "https://Stackoverflow.com/questions/58040303", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11736671/" ]
You should include the measurement in your code. There is clearly something wrong with your measurement and you need to clearly show your method. I performed the following test modified to use `uint64_t` to prevent arithmetic overflow in `alg1()`, and also replacing the `printf()` output with a volatile sink: ``` {vo...
First of all the output of the codes most probably aren't identical but you didn't check. `j * j` does not fit in a 32-bit int with numbers larger than 46340, so undefined behaviour is a possibility, but I do not believe that it is the reason here. The first code executes the inner loop *O(i)* times whereas the 2nd ex...
71,051,218
I have a co-worker who have a problem with posting here, he will be the one answering comments and validating answer. Here is his question: I'm using Net5 with Microsoft.Extensions.Hosting. Instead of appsettings.json, I need to use xml files. I have App.config to specify common app settings (log4net config, etc.) and...
2022/02/09
[ "https://Stackoverflow.com/questions/71051218", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10884472/" ]
The problem come from the xml structure: As this is application configuration the structure from this: ```xml <?xml version="1.0" encoding="utf-8" ?> <AcquisitionManagerConfiguration> <val>1</val> </AcquisitionManagerConfiguration> ``` become this: ```xml <?xml version="1.0" encoding="utf-8...
It looks like you are just missing the `Bind` part in your services registration. `services.Configure<AcquisitionManagerConfiguration>(options => Configuration.GetSection("AcquisitionManagerConfiguration"));` should be `services.Configure<AcquisitionManagerConfiguration>(options => Configuration.GetSection("Acquisit...
38,267,381
I am new to TypeScript and came accross this example: ``` for (let i = 0; i < 10 ; i++) { setTimeout(function() {console.log(i); }, 100 * i); } ``` output: `1,2,3,4,5,6,7,8,9,10` But ``` for (var i = 0; i < 10 ; i++) { setTimeout(function() {console.log(i); }, 100 * i); } ``` output : `10,10,10,10,10,10...
2016/07/08
[ "https://Stackoverflow.com/questions/38267381", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6166984/" ]
this is due to the scope difference =================================== it is due the scoping difference between var and let. The first time the timeout actually can complete the console.log, i has already been changed by the loop to 10. (Essentially, you are stacking console.logs with various timeouts, they will only...
@DylanMeeus is correct in that it's a scoping/closure issue. To help visualize this, this is what using "let" is compiled to in es5: ``` var _loop_1 = function(i) { setTimeout(function () { console.log(i); }, 100 * i); }; for (var i = 0; i < 10; i++) { _loop_1(i); } ``` Notice that the `i` in `_loop_1` is a ...
45,750,243
I want to give storage permission for my app. My code working perfect till Marshmallow, only problem in Nougat The below method always return false in nougat even permission granted manually from settings. ``` private boolean checkWriteExternalPermission() { String permission = "android.permission.WRITE_EXTERNAL...
2017/08/18
[ "https://Stackoverflow.com/questions/45750243", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3809936/" ]
Assuming that you mean months ammount ( i.e for a monthly payment ) You can do it like this in your store method i.e: ``` $start_day = Carbon::parse($request->created_at); //get a carbon instance with created_at as date $expiry_day = $start_day->addMonths($request->user_selected_months); //add X months to created_at ...
``` public function store(StoreRequest $request) { date_default_timezone_set('asia/calcutta'); $month = $request->month; $expiry_date = Carbon::now()->addMonths($month); $request['expiry_date'] = $expiry_date; } ```
126,106
I have created a script to start a server (my first question). Now I want it to run on the system boot and start the defined server. What should I do to get this done? My findings tell me put this file in the `/etc/init.d` location, and it will execute when the system will boot. But I am not able to understand how th...
2010/03/31
[ "https://superuser.com/questions/126106", "https://superuser.com", "https://superuser.com/users/29155/" ]
`/etc/init.d` is the script directory, in which the executable scripts appear. However, in order to run scripts in a particular order after your system starts, you need to add files to the `/etc/rc#.d` directory. Entries that appear here tell your system in what order and at what run level scripts in `/etc/init.d` shou...
The $1 is the command line argument that is passed to your script, it is one of start, stop or restart. In [openSUSE](http://en.wikipedia.org/wiki/OpenSUSE), I don't remember having an option to pass other arguments into the script when useing the runlevel editor thingy, so I think that these are probably the only ones...
126,106
I have created a script to start a server (my first question). Now I want it to run on the system boot and start the defined server. What should I do to get this done? My findings tell me put this file in the `/etc/init.d` location, and it will execute when the system will boot. But I am not able to understand how th...
2010/03/31
[ "https://superuser.com/questions/126106", "https://superuser.com", "https://superuser.com/users/29155/" ]
You don't have to --- and shouldn't --- create files in `/etc/rc.d/rcN.d/`; what you should do instead is put a comment in your init script reading ``` # chkconfig NNN A B ``` where `NNN` is the set of run-levels in which you want the script active (e.g., `345` if it's active in runlevels `3`, `4`, and `5`), and `A`...
The $1 is the command line argument that is passed to your script, it is one of start, stop or restart. In [openSUSE](http://en.wikipedia.org/wiki/OpenSUSE), I don't remember having an option to pass other arguments into the script when useing the runlevel editor thingy, so I think that these are probably the only ones...
126,106
I have created a script to start a server (my first question). Now I want it to run on the system boot and start the defined server. What should I do to get this done? My findings tell me put this file in the `/etc/init.d` location, and it will execute when the system will boot. But I am not able to understand how th...
2010/03/31
[ "https://superuser.com/questions/126106", "https://superuser.com", "https://superuser.com/users/29155/" ]
`/etc/init.d` is the script directory, in which the executable scripts appear. However, in order to run scripts in a particular order after your system starts, you need to add files to the `/etc/rc#.d` directory. Entries that appear here tell your system in what order and at what run level scripts in `/etc/init.d` shou...
You don't have to --- and shouldn't --- create files in `/etc/rc.d/rcN.d/`; what you should do instead is put a comment in your init script reading ``` # chkconfig NNN A B ``` where `NNN` is the set of run-levels in which you want the script active (e.g., `345` if it's active in runlevels `3`, `4`, and `5`), and `A`...
31,379,823
Consider this case. I am writing a library and want to wrap my data in a namespace. For example: ``` //header.h #pragma once namespace wrapper { // some interface functions here.. } ``` And I want to make my namespace private. So that no one can write anything in it. For instance, we can always write something ...
2015/07/13
[ "https://Stackoverflow.com/questions/31379823", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1856429/" ]
This is not possible. If all else fails, I can always edit your header file.
No there isn't. A namespace can always be added to, unless it's an *anonymous namespace*. But they can only feasibly reside in a single compilation unit.
31,379,823
Consider this case. I am writing a library and want to wrap my data in a namespace. For example: ``` //header.h #pragma once namespace wrapper { // some interface functions here.. } ``` And I want to make my namespace private. So that no one can write anything in it. For instance, we can always write something ...
2015/07/13
[ "https://Stackoverflow.com/questions/31379823", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1856429/" ]
No there isn't. A namespace can always be added to, unless it's an *anonymous namespace*. But they can only feasibly reside in a single compilation unit.
A namespace cannot be made private, there is no access control (i.e. similar to a class) for a namespace. Even without attempting to edit the header file, the namespace can always be added to. Alternatives include; * Put the data into the cpp file, still in a namespace if desired. Thus the data is not "private" but s...
31,379,823
Consider this case. I am writing a library and want to wrap my data in a namespace. For example: ``` //header.h #pragma once namespace wrapper { // some interface functions here.. } ``` And I want to make my namespace private. So that no one can write anything in it. For instance, we can always write something ...
2015/07/13
[ "https://Stackoverflow.com/questions/31379823", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1856429/" ]
This is not possible. If all else fails, I can always edit your header file.
A namespace cannot be made private, there is no access control (i.e. similar to a class) for a namespace. Even without attempting to edit the header file, the namespace can always be added to. Alternatives include; * Put the data into the cpp file, still in a namespace if desired. Thus the data is not "private" but s...
57,330,034
I am trying to build a function that checks if all fields are populated, if populated then show div if not hide. I can get this to work on one fields however i have then tried two ways of checking multiple. **first** if first condition met I then ran other condition checking second field nested inside the first... th...
2019/08/02
[ "https://Stackoverflow.com/questions/57330034", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2975042/" ]
Make it so your function takes an argument of the element ID and the class Name you need to check for. Also, never use `.getElementsByClassName()` ([read here for why](https://stackoverflow.com/questions/54952088/how-to-modify-style-to-html-elements-styled-externally-with-css-using-js/54952474#54952474)). Instead, use...
You can create a const of all elements that need to validate. For example, ``` const elementIdsToBeValidated = ['name', 'email']; ``` You can also create validator functions that returns true and false based on input, ``` const nameValidator = (val) => !!val; const emailValidator = (email) => !!email; const valida...
57,330,034
I am trying to build a function that checks if all fields are populated, if populated then show div if not hide. I can get this to work on one fields however i have then tried two ways of checking multiple. **first** if first condition met I then ran other condition checking second field nested inside the first... th...
2019/08/02
[ "https://Stackoverflow.com/questions/57330034", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2975042/" ]
If you have an array of the IDs such as ``` let idArray = ['foo', 'bar', 'baz'] ``` You can iterate through an array using a `for` loop ``` for (i = 0; i > idArray.length; i++) { if (!document.getElementById(idArray[i]).value) { // your hide logic } else { // your show logic } } ```
You can create a const of all elements that need to validate. For example, ``` const elementIdsToBeValidated = ['name', 'email']; ``` You can also create validator functions that returns true and false based on input, ``` const nameValidator = (val) => !!val; const emailValidator = (email) => !!email; const valida...
71,770,276
I created the aks cluster with azure service principal id and i provided the contributer role according to the subscription and resource group. For each and every time when i executed the pipeline the sign-in is asking and after i authenticated it is getting the data. Also the "kubectl get" task is taking more than 3...
2022/04/06
[ "https://Stackoverflow.com/questions/71770276", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11617499/" ]
The easiest solution may be to flatten the different split characters to a single one: ```py with open("example.dat", "r") as fh: lines = [] for line in fh: lines.append( line.strip().replace("[", ",").replace("]", ",").split(",") ) ```
You can use named groups in regular expression to more properly extract the information (read more here: <https://www.regular-expressions.info/refext.html>): ``` import re pat = r"(?P<city>[^,]*), (?P<state>[\w\W]*)\[(?P<lat>\d+),(?P<lon>\d+)\](?P<pop>\d+)" pat = re.compile(pat, re.VERBOSE) city = match.group("city"...
71,770,276
I created the aks cluster with azure service principal id and i provided the contributer role according to the subscription and resource group. For each and every time when i executed the pipeline the sign-in is asking and after i authenticated it is getting the data. Also the "kubectl get" task is taking more than 3...
2022/04/06
[ "https://Stackoverflow.com/questions/71770276", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11617499/" ]
The easiest solution may be to flatten the different split characters to a single one: ```py with open("example.dat", "r") as fh: lines = [] for line in fh: lines.append( line.strip().replace("[", ",").replace("]", ",").split(",") ) ```
Regex is pretty useful in such cases: ``` import re x = 'New York City, NY[40,74]11000000' res = re.split(', |\[|\]|,', x) print(res) ##### ['New York City', 'NY', '40', '74', '11000000'] ```
3,617,766
Is there any logger to asp.net like the System.ServiceModel.MessageLogging used in WCF?
2010/09/01
[ "https://Stackoverflow.com/questions/3617766", "https://Stackoverflow.com", "https://Stackoverflow.com/users/373433/" ]
You could use log4net for this... [log4net Website](http://logging.apache.org/log4net/index.html)
Not sure what you are actually asking for. There is [ASP.NET tracing](http://msdn.microsoft.com/en-us/library/0x5wc973.aspx) and [trace.axd](http://msdn.microsoft.com/en-us/library/wwh16c6c.aspx) handler to browsing traces.
3,617,766
Is there any logger to asp.net like the System.ServiceModel.MessageLogging used in WCF?
2010/09/01
[ "https://Stackoverflow.com/questions/3617766", "https://Stackoverflow.com", "https://Stackoverflow.com/users/373433/" ]
There is health monitoring: <http://msdn.microsoft.com/en-us/library/ff650305.aspx>. It has a bunch of predefined events, plus you can create your own custom events for tracking purposes.
You could use log4net for this... [log4net Website](http://logging.apache.org/log4net/index.html)
3,617,766
Is there any logger to asp.net like the System.ServiceModel.MessageLogging used in WCF?
2010/09/01
[ "https://Stackoverflow.com/questions/3617766", "https://Stackoverflow.com", "https://Stackoverflow.com/users/373433/" ]
You could use log4net for this... [log4net Website](http://logging.apache.org/log4net/index.html)
After having used it myself, I'd like to suggest [ELMAH](http://code.google.com/p/elmah/): > > ELMAH (Error Logging Modules and > Handlers) is an application-wide error > logging facility that is completely > pluggable. It can be dynamically added > to a running ASP.NET web application, > or even all ASP.NET web...
3,617,766
Is there any logger to asp.net like the System.ServiceModel.MessageLogging used in WCF?
2010/09/01
[ "https://Stackoverflow.com/questions/3617766", "https://Stackoverflow.com", "https://Stackoverflow.com/users/373433/" ]
There is health monitoring: <http://msdn.microsoft.com/en-us/library/ff650305.aspx>. It has a bunch of predefined events, plus you can create your own custom events for tracking purposes.
Not sure what you are actually asking for. There is [ASP.NET tracing](http://msdn.microsoft.com/en-us/library/0x5wc973.aspx) and [trace.axd](http://msdn.microsoft.com/en-us/library/wwh16c6c.aspx) handler to browsing traces.
3,617,766
Is there any logger to asp.net like the System.ServiceModel.MessageLogging used in WCF?
2010/09/01
[ "https://Stackoverflow.com/questions/3617766", "https://Stackoverflow.com", "https://Stackoverflow.com/users/373433/" ]
There is health monitoring: <http://msdn.microsoft.com/en-us/library/ff650305.aspx>. It has a bunch of predefined events, plus you can create your own custom events for tracking purposes.
After having used it myself, I'd like to suggest [ELMAH](http://code.google.com/p/elmah/): > > ELMAH (Error Logging Modules and > Handlers) is an application-wide error > logging facility that is completely > pluggable. It can be dynamically added > to a running ASP.NET web application, > or even all ASP.NET web...
38,488,978
Using Google Analytics [Sessions API](https://developers.google.com/analytics/devguides/reporting/core/dimsmets#view=detail&group=session&jump=ga_sessions) I can get the total hits (i.e. total page views and events etc) in a session. Is there a way to get a list of all the page views and events that took place in a s...
2016/07/20
[ "https://Stackoverflow.com/questions/38488978", "https://Stackoverflow.com", "https://Stackoverflow.com/users/553223/" ]
We should first locate the columns that will be adjusted. We do this according to your description as the columns from `Al` to `Zn`. Next we `sub` unnecessary characters and convert to `numeric` with the `numerize` function. I added more columns to show the complexity: ``` cols <- match("Al", names(df)):match("Zn", na...
`tidyr::extract_numeric` is handy, whether in `dplyr` or not: ``` df$Al <- tidyr::extract_numeric(Al) # or df %>% mutate(Al = extract_numeric(Al)) ``` which is roughly equivalent to ``` df$Al <- as.numeric(sub('.*(-?[0-9]+.?[0-9]*).*', '\\1', df$Al)) ``` which for this particular case could be simplified to: ...
57,062,428
I am testing an spring boot application that reads/writes data to an Oracle DB. This Oracle DB has Oracle packages and in those packages procedures. At some point, the spring boot application calls this procedure via a Entity Repository as follows ```java @Repository public interface StudentRepository extends JpaRepos...
2019/07/16
[ "https://Stackoverflow.com/questions/57062428", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8032106/" ]
Here is what I did. **Question #2:** To answer this question I had to change the native query as follows ```java @Repository public interface StudentRepository extends JpaRepository<Student, String> { @Modifying @Query(value = "call sch1.STUDENT_PACKAGE.Set_Grades_To_A('A')", nativeQuery = true) public void setStude...
I was able to fix the issue by adding `IGNORE_CATALOGS=TRUE` ``` spring.datasource.url = jdbc:h2:mem:testdb;MODE=Oracle;IGNORE_CATALOGS=TRUE ``` This will ignore the database name
16,651,031
I stored the data bytes in an Array. Now, in the program I used getBytes:range:NSmakeRange(position, length). When I printed my received bytes I think their position got swapped and my answer was 0x0292 instead of 0x9202 (check my program below). Now, I am confused on which one is the correct answer. Is it really nece...
2013/05/20
[ "https://Stackoverflow.com/questions/16651031", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2029446/" ]
Whether you make use of functions like `CFSwapInt16BigToHost` depends on what you are dealing with on both ends. If your "host" (the machine this code is running on) could vary, then using one of the many `CFSwap...ToHost` functions is a really good idea. For example, Intel Macs and ARM iOS devices use different byte ...
It's all about endianness. If you receive your data form the network, it will be big endian. Your machine is little endian, so in that case you need to swap the bytes. See: <http://en.wikipedia.org/wiki/Endianness>
217,415
Can I see how many duplicates there are of a post? I.e. how many posts have been labelled as duplicate because of this post? If so, how? And can I also get a list of these duplicated posts?
2014/01/24
[ "https://meta.stackexchange.com/questions/217415", "https://meta.stackexchange.com", "https://meta.stackexchange.com/users/227229/" ]
The most reliable way to do this is to [use the Data Explorer:](https://data.stackexchange.com/stackoverflow/query/162748/duplicates-for-a-given-post?OriginalPostId=8028957) ```sql select PostId as [Post Link] from PostLinks where RelatedPostId=##OriginalPostId## and LinkTypeId=3 -- duplicate ``` This will give you ...
There is a record of all *linked* questions, both linked from the given question to others and vice versa. You can see the full list by directly browsing to this URL: `https://meta.stackexchange.com/questions/linked/[question id]` For example: <https://meta.stackexchange.com/questions/linked/194476> > > ![](https://...
14,011,093
``` sLine = sLine.replaceAll("&&", "&"); sLine = sLine.replaceAll(((char)245)+"", "ő"); sLine = sLine.replaceAll(((char)213)+"", "Ő"); sLine = sLine.replaceAll(((char)361)+"", "ű"); sLine = sLine.replaceAll(((char)251)+"", "ű"); ``` Is there a way to to this only one line? This is very ...
2012/12/23
[ "https://Stackoverflow.com/questions/14011093", "https://Stackoverflow.com", "https://Stackoverflow.com/users/472537/" ]
Consider converting the string to a `char[]` and then iterating over the array manually. Avoid string concatenation such as `((char)245)+""`. Use a character constant. But it looks like you are trying to *fix the encoding of strings* manually? That is a *really bad idea*. Because next week, you will have a user with ...
You can improve performance by using precompiled regular expressions. Under the hood `String.replaceAll` is going to compile and apply a regular expression for you anyway. As compilation of the regexp is *relatively* computationally intensive, this should improve performance when executing this code frequently. ``` pr...
14,011,093
``` sLine = sLine.replaceAll("&&", "&"); sLine = sLine.replaceAll(((char)245)+"", "ő"); sLine = sLine.replaceAll(((char)213)+"", "Ő"); sLine = sLine.replaceAll(((char)361)+"", "ű"); sLine = sLine.replaceAll(((char)251)+"", "ű"); ``` Is there a way to to this only one line? This is very ...
2012/12/23
[ "https://Stackoverflow.com/questions/14011093", "https://Stackoverflow.com", "https://Stackoverflow.com/users/472537/" ]
Consider converting the string to a `char[]` and then iterating over the array manually. Avoid string concatenation such as `((char)245)+""`. Use a character constant. But it looks like you are trying to *fix the encoding of strings* manually? That is a *really bad idea*. Because next week, you will have a user with ...
``` private static final String char1 = Character.toString((char) 245); private static final String char2 = Character.toString((char) 213); private static final String char3 = Character.toString((char) 361); private static final String char4 = Character.toString((char) 251); private static fina...
14,011,093
``` sLine = sLine.replaceAll("&&", "&"); sLine = sLine.replaceAll(((char)245)+"", "ő"); sLine = sLine.replaceAll(((char)213)+"", "Ő"); sLine = sLine.replaceAll(((char)361)+"", "ű"); sLine = sLine.replaceAll(((char)251)+"", "ű"); ``` Is there a way to to this only one line? This is very ...
2012/12/23
[ "https://Stackoverflow.com/questions/14011093", "https://Stackoverflow.com", "https://Stackoverflow.com/users/472537/" ]
You can improve performance by using precompiled regular expressions. Under the hood `String.replaceAll` is going to compile and apply a regular expression for you anyway. As compilation of the regexp is *relatively* computationally intensive, this should improve performance when executing this code frequently. ``` pr...
``` private static final String char1 = Character.toString((char) 245); private static final String char2 = Character.toString((char) 213); private static final String char3 = Character.toString((char) 361); private static final String char4 = Character.toString((char) 251); private static fina...
19,557,139
I am parsing a file, and every odd line gives me a "letter" (A, B, C, etc), and every even line gives me a "binary sequence" (0101, 1111, 0001, etc). I would like to create a hash of arrays (but if you think another datatype is more suitable, please let me know) to keep all lines organized. I know the has of arrays c...
2013/10/24
[ "https://Stackoverflow.com/questions/19557139", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
To create the hash, just put `my %HoA;` at the beginning of your code. Given a `$letter` and `$seq`, you can accomplish steps 2-4 at once by just doing `push @{$HoA{$letter}}, $seq;`, and Perl takes care of the details.
Check [perl data structures cookbook](http://perldoc.perl.org/perldsc.html#HASHES-OF-ARRAYS). ``` my %HoA; my $letter; while (<INPUT>) { s/[\n\r]//g; if ( /^>/) { $letter = substr($_, 7, 1); } if ( /^[01]/) { # $seq = $_; push @{ $HoA{$letter} }, $_; } } ```
19,557,139
I am parsing a file, and every odd line gives me a "letter" (A, B, C, etc), and every even line gives me a "binary sequence" (0101, 1111, 0001, etc). I would like to create a hash of arrays (but if you think another datatype is more suitable, please let me know) to keep all lines organized. I know the has of arrays c...
2013/10/24
[ "https://Stackoverflow.com/questions/19557139", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
To create the hash, just put `my %HoA;` at the beginning of your code. Given a `$letter` and `$seq`, you can accomplish steps 2-4 at once by just doing `push @{$HoA{$letter}}, $seq;`, and Perl takes care of the details.
Assuming your data is infallible. ``` #!/usr/bin/perl use strict; use warnings FATAL => qw/all/; use Data::Dumper; $/ = "\r\n"; my %HoA; while (<DATA>) { my $letter = substr($_, 7, 1); chomp(my $seq = <DATA>); push @{$HoA{$letter}}, $seq; } print Dumper \%HoA; __DATA__ > A 0001 > A 1010 > ...
7,954
In real world, business initiatives always take higher priority as there are associated ROIs and deliver something tangible to the users. But there are technical initiatives and projects that need to be done to keep up with the different versions of software, upgrading to a newer platforms, architecture re-factoring et...
2012/11/01
[ "https://pm.stackexchange.com/questions/7954", "https://pm.stackexchange.com", "https://pm.stackexchange.com/users/4731/" ]
I'm going to pick on @jmort253's answer, because I disagree. ROI initiatives aren't the only kinds of project, nor should they be. Chris Matts (the analyst behind BDD, Feature Injection and Real Options) found that 80% of one of his CIO's projects were concerned with protecting existing customer revenue, rather than t...
Fascinating discussion, and very relevant to me. I believe that technical debt is a PM's concern. One could argue that a project is a coordinated effort to produce a specific outcome/change; if the project produces the outcome, the project is successful, and technical debt doesn't enter into the equation. But I think...
7,954
In real world, business initiatives always take higher priority as there are associated ROIs and deliver something tangible to the users. But there are technical initiatives and projects that need to be done to keep up with the different versions of software, upgrading to a newer platforms, architecture re-factoring et...
2012/11/01
[ "https://pm.stackexchange.com/questions/7954", "https://pm.stackexchange.com", "https://pm.stackexchange.com/users/4731/" ]
I tend to disagree with the basic assumption that technical initiatives are not business initiatives. They may be different from rolling out a new product or an advertising campaign, but: * They have a business benefits... be it regulatory compliance, improving efficiencies, making the customer experience better, etc ...
I know there's an answer for this and I mostly agree with @Lunivore and @jmort253 answers but I thought I would chime in on how I have seen and heard technical debt handled? In our company we recently started trying to allocate dedicated week-long sprints that we focus on technical debt. Unfortunately this hasn't work...
7,954
In real world, business initiatives always take higher priority as there are associated ROIs and deliver something tangible to the users. But there are technical initiatives and projects that need to be done to keep up with the different versions of software, upgrading to a newer platforms, architecture re-factoring et...
2012/11/01
[ "https://pm.stackexchange.com/questions/7954", "https://pm.stackexchange.com", "https://pm.stackexchange.com/users/4731/" ]
I'm going to pick on @jmort253's answer, because I disagree. ROI initiatives aren't the only kinds of project, nor should they be. Chris Matts (the analyst behind BDD, Feature Injection and Real Options) found that 80% of one of his CIO's projects were concerned with protecting existing customer revenue, rather than t...
I would start by **Identifying the ROI that the technical debt delivers** and discussing this with the business. If you can describe both value work and what John Seddon calls 'Failure Demand' in the same terms and using the same metrics then you can agree how to split your capacity across them. **Example - Architectu...
7,954
In real world, business initiatives always take higher priority as there are associated ROIs and deliver something tangible to the users. But there are technical initiatives and projects that need to be done to keep up with the different versions of software, upgrading to a newer platforms, architecture re-factoring et...
2012/11/01
[ "https://pm.stackexchange.com/questions/7954", "https://pm.stackexchange.com", "https://pm.stackexchange.com/users/4731/" ]
I'm going to pick on @jmort253's answer, because I disagree. ROI initiatives aren't the only kinds of project, nor should they be. Chris Matts (the analyst behind BDD, Feature Injection and Real Options) found that 80% of one of his CIO's projects were concerned with protecting existing customer revenue, rather than t...
I tend to disagree with the basic assumption that technical initiatives are not business initiatives. They may be different from rolling out a new product or an advertising campaign, but: * They have a business benefits... be it regulatory compliance, improving efficiencies, making the customer experience better, etc ...
7,954
In real world, business initiatives always take higher priority as there are associated ROIs and deliver something tangible to the users. But there are technical initiatives and projects that need to be done to keep up with the different versions of software, upgrading to a newer platforms, architecture re-factoring et...
2012/11/01
[ "https://pm.stackexchange.com/questions/7954", "https://pm.stackexchange.com", "https://pm.stackexchange.com/users/4731/" ]
**Technical Debt isn't a PM's Responsibility:** ----------------------------------------------- As a project manager, the short answer is, you don't. This is really a job for the technical team, which includes functional managers and the actual developers working on the project. If you're doing project management corr...
Fascinating discussion, and very relevant to me. I believe that technical debt is a PM's concern. One could argue that a project is a coordinated effort to produce a specific outcome/change; if the project produces the outcome, the project is successful, and technical debt doesn't enter into the equation. But I think...
7,954
In real world, business initiatives always take higher priority as there are associated ROIs and deliver something tangible to the users. But there are technical initiatives and projects that need to be done to keep up with the different versions of software, upgrading to a newer platforms, architecture re-factoring et...
2012/11/01
[ "https://pm.stackexchange.com/questions/7954", "https://pm.stackexchange.com", "https://pm.stackexchange.com/users/4731/" ]
**Technical Debt isn't a PM's Responsibility:** ----------------------------------------------- As a project manager, the short answer is, you don't. This is really a job for the technical team, which includes functional managers and the actual developers working on the project. If you're doing project management corr...
I know there's an answer for this and I mostly agree with @Lunivore and @jmort253 answers but I thought I would chime in on how I have seen and heard technical debt handled? In our company we recently started trying to allocate dedicated week-long sprints that we focus on technical debt. Unfortunately this hasn't work...
7,954
In real world, business initiatives always take higher priority as there are associated ROIs and deliver something tangible to the users. But there are technical initiatives and projects that need to be done to keep up with the different versions of software, upgrading to a newer platforms, architecture re-factoring et...
2012/11/01
[ "https://pm.stackexchange.com/questions/7954", "https://pm.stackexchange.com", "https://pm.stackexchange.com/users/4731/" ]
I'm going to pick on @jmort253's answer, because I disagree. ROI initiatives aren't the only kinds of project, nor should they be. Chris Matts (the analyst behind BDD, Feature Injection and Real Options) found that 80% of one of his CIO's projects were concerned with protecting existing customer revenue, rather than t...
I know there's an answer for this and I mostly agree with @Lunivore and @jmort253 answers but I thought I would chime in on how I have seen and heard technical debt handled? In our company we recently started trying to allocate dedicated week-long sprints that we focus on technical debt. Unfortunately this hasn't work...
7,954
In real world, business initiatives always take higher priority as there are associated ROIs and deliver something tangible to the users. But there are technical initiatives and projects that need to be done to keep up with the different versions of software, upgrading to a newer platforms, architecture re-factoring et...
2012/11/01
[ "https://pm.stackexchange.com/questions/7954", "https://pm.stackexchange.com", "https://pm.stackexchange.com/users/4731/" ]
I tend to disagree with the basic assumption that technical initiatives are not business initiatives. They may be different from rolling out a new product or an advertising campaign, but: * They have a business benefits... be it regulatory compliance, improving efficiencies, making the customer experience better, etc ...
I would start by **Identifying the ROI that the technical debt delivers** and discussing this with the business. If you can describe both value work and what John Seddon calls 'Failure Demand' in the same terms and using the same metrics then you can agree how to split your capacity across them. **Example - Architectu...
7,954
In real world, business initiatives always take higher priority as there are associated ROIs and deliver something tangible to the users. But there are technical initiatives and projects that need to be done to keep up with the different versions of software, upgrading to a newer platforms, architecture re-factoring et...
2012/11/01
[ "https://pm.stackexchange.com/questions/7954", "https://pm.stackexchange.com", "https://pm.stackexchange.com/users/4731/" ]
I would start by **Identifying the ROI that the technical debt delivers** and discussing this with the business. If you can describe both value work and what John Seddon calls 'Failure Demand' in the same terms and using the same metrics then you can agree how to split your capacity across them. **Example - Architectu...
I know there's an answer for this and I mostly agree with @Lunivore and @jmort253 answers but I thought I would chime in on how I have seen and heard technical debt handled? In our company we recently started trying to allocate dedicated week-long sprints that we focus on technical debt. Unfortunately this hasn't work...
7,954
In real world, business initiatives always take higher priority as there are associated ROIs and deliver something tangible to the users. But there are technical initiatives and projects that need to be done to keep up with the different versions of software, upgrading to a newer platforms, architecture re-factoring et...
2012/11/01
[ "https://pm.stackexchange.com/questions/7954", "https://pm.stackexchange.com", "https://pm.stackexchange.com/users/4731/" ]
**Technical Debt isn't a PM's Responsibility:** ----------------------------------------------- As a project manager, the short answer is, you don't. This is really a job for the technical team, which includes functional managers and the actual developers working on the project. If you're doing project management corr...
I would start by **Identifying the ROI that the technical debt delivers** and discussing this with the business. If you can describe both value work and what John Seddon calls 'Failure Demand' in the same terms and using the same metrics then you can agree how to split your capacity across them. **Example - Architectu...
7,403,227
I was writing code with exception handling the other day, and I had a few questions about exceptions, their guarantees and throwables. Basically, say you have: ``` class X { string m_str; X() : m_str("foo")//what if this throws? { ifstream b("a.in")//what if this throws? } ``` And after running through all the ...
2011/09/13
[ "https://Stackoverflow.com/questions/7403227", "https://Stackoverflow.com", "https://Stackoverflow.com/users/459930/" ]
If either of these throw ``` class X { string m_str; X() : m_str("foo")//what if this throws? { ifstream b("a.in")//what if this throws? } ``` Then the object you were creating will not exist. If an exception is thrown in the constructor of an object, then all fully created members are destructed (using the t...
AFAIK whether or not (and more importantly, which) exceptions are thrown is mostly left to the implementation. I don't see any point in attempting to catch those - I mean, what are you gonna do if this fails? Is there any reasonable way to recover from an exception being thrown there? Keep in mind that no exception is...
7,403,227
I was writing code with exception handling the other day, and I had a few questions about exceptions, their guarantees and throwables. Basically, say you have: ``` class X { string m_str; X() : m_str("foo")//what if this throws? { ifstream b("a.in")//what if this throws? } ``` And after running through all the ...
2011/09/13
[ "https://Stackoverflow.com/questions/7403227", "https://Stackoverflow.com", "https://Stackoverflow.com/users/459930/" ]
The only authoritative reference on how the standard library works, including under which conditions it is allowed to throw which exception types, is the C++ Language Standard. Years ago it was available in electronic form for a reasonable price, but unfortunately this doesn't appear to be the case anymore. You might c...
AFAIK whether or not (and more importantly, which) exceptions are thrown is mostly left to the implementation. I don't see any point in attempting to catch those - I mean, what are you gonna do if this fails? Is there any reasonable way to recover from an exception being thrown there? Keep in mind that no exception is...
7,403,227
I was writing code with exception handling the other day, and I had a few questions about exceptions, their guarantees and throwables. Basically, say you have: ``` class X { string m_str; X() : m_str("foo")//what if this throws? { ifstream b("a.in")//what if this throws? } ``` And after running through all the ...
2011/09/13
[ "https://Stackoverflow.com/questions/7403227", "https://Stackoverflow.com", "https://Stackoverflow.com/users/459930/" ]
Throwing exceptions in constructors *is* a good idea, since you have no other means of reporting failure. *I tend to prefer C++ exceptions to error codes, even when they are considered "control flow", because I don't have to add checks everywhere. But this is a debatable matter of taste. For constructors, you have no ...
AFAIK whether or not (and more importantly, which) exceptions are thrown is mostly left to the implementation. I don't see any point in attempting to catch those - I mean, what are you gonna do if this fails? Is there any reasonable way to recover from an exception being thrown there? Keep in mind that no exception is...
7,403,227
I was writing code with exception handling the other day, and I had a few questions about exceptions, their guarantees and throwables. Basically, say you have: ``` class X { string m_str; X() : m_str("foo")//what if this throws? { ifstream b("a.in")//what if this throws? } ``` And after running through all the ...
2011/09/13
[ "https://Stackoverflow.com/questions/7403227", "https://Stackoverflow.com", "https://Stackoverflow.com/users/459930/" ]
Every function has a precondition and a postcondition. The correct time to throw an exception is when the postconditions cannot be satisfied. There is no other correct time. There are two special cases. * *The postcondition for a constructor is the existence of a valid object*, therefore throwing is the ***only*** re...
AFAIK whether or not (and more importantly, which) exceptions are thrown is mostly left to the implementation. I don't see any point in attempting to catch those - I mean, what are you gonna do if this fails? Is there any reasonable way to recover from an exception being thrown there? Keep in mind that no exception is...
7,403,227
I was writing code with exception handling the other day, and I had a few questions about exceptions, their guarantees and throwables. Basically, say you have: ``` class X { string m_str; X() : m_str("foo")//what if this throws? { ifstream b("a.in")//what if this throws? } ``` And after running through all the ...
2011/09/13
[ "https://Stackoverflow.com/questions/7403227", "https://Stackoverflow.com", "https://Stackoverflow.com/users/459930/" ]
If either of these throw ``` class X { string m_str; X() : m_str("foo")//what if this throws? { ifstream b("a.in")//what if this throws? } ``` Then the object you were creating will not exist. If an exception is thrown in the constructor of an object, then all fully created members are destructed (using the t...
The only authoritative reference on how the standard library works, including under which conditions it is allowed to throw which exception types, is the C++ Language Standard. Years ago it was available in electronic form for a reasonable price, but unfortunately this doesn't appear to be the case anymore. You might c...
7,403,227
I was writing code with exception handling the other day, and I had a few questions about exceptions, their guarantees and throwables. Basically, say you have: ``` class X { string m_str; X() : m_str("foo")//what if this throws? { ifstream b("a.in")//what if this throws? } ``` And after running through all the ...
2011/09/13
[ "https://Stackoverflow.com/questions/7403227", "https://Stackoverflow.com", "https://Stackoverflow.com/users/459930/" ]
If either of these throw ``` class X { string m_str; X() : m_str("foo")//what if this throws? { ifstream b("a.in")//what if this throws? } ``` Then the object you were creating will not exist. If an exception is thrown in the constructor of an object, then all fully created members are destructed (using the t...
Throwing exceptions in constructors *is* a good idea, since you have no other means of reporting failure. *I tend to prefer C++ exceptions to error codes, even when they are considered "control flow", because I don't have to add checks everywhere. But this is a debatable matter of taste. For constructors, you have no ...
7,403,227
I was writing code with exception handling the other day, and I had a few questions about exceptions, their guarantees and throwables. Basically, say you have: ``` class X { string m_str; X() : m_str("foo")//what if this throws? { ifstream b("a.in")//what if this throws? } ``` And after running through all the ...
2011/09/13
[ "https://Stackoverflow.com/questions/7403227", "https://Stackoverflow.com", "https://Stackoverflow.com/users/459930/" ]
If either of these throw ``` class X { string m_str; X() : m_str("foo")//what if this throws? { ifstream b("a.in")//what if this throws? } ``` Then the object you were creating will not exist. If an exception is thrown in the constructor of an object, then all fully created members are destructed (using the t...
Every function has a precondition and a postcondition. The correct time to throw an exception is when the postconditions cannot be satisfied. There is no other correct time. There are two special cases. * *The postcondition for a constructor is the existence of a valid object*, therefore throwing is the ***only*** re...
7,403,227
I was writing code with exception handling the other day, and I had a few questions about exceptions, their guarantees and throwables. Basically, say you have: ``` class X { string m_str; X() : m_str("foo")//what if this throws? { ifstream b("a.in")//what if this throws? } ``` And after running through all the ...
2011/09/13
[ "https://Stackoverflow.com/questions/7403227", "https://Stackoverflow.com", "https://Stackoverflow.com/users/459930/" ]
Every function has a precondition and a postcondition. The correct time to throw an exception is when the postconditions cannot be satisfied. There is no other correct time. There are two special cases. * *The postcondition for a constructor is the existence of a valid object*, therefore throwing is the ***only*** re...
The only authoritative reference on how the standard library works, including under which conditions it is allowed to throw which exception types, is the C++ Language Standard. Years ago it was available in electronic form for a reasonable price, but unfortunately this doesn't appear to be the case anymore. You might c...
7,403,227
I was writing code with exception handling the other day, and I had a few questions about exceptions, their guarantees and throwables. Basically, say you have: ``` class X { string m_str; X() : m_str("foo")//what if this throws? { ifstream b("a.in")//what if this throws? } ``` And after running through all the ...
2011/09/13
[ "https://Stackoverflow.com/questions/7403227", "https://Stackoverflow.com", "https://Stackoverflow.com/users/459930/" ]
Every function has a precondition and a postcondition. The correct time to throw an exception is when the postconditions cannot be satisfied. There is no other correct time. There are two special cases. * *The postcondition for a constructor is the existence of a valid object*, therefore throwing is the ***only*** re...
Throwing exceptions in constructors *is* a good idea, since you have no other means of reporting failure. *I tend to prefer C++ exceptions to error codes, even when they are considered "control flow", because I don't have to add checks everywhere. But this is a debatable matter of taste. For constructors, you have no ...
4,083,195
I have a complex App that runs reliably, but I'm puzzled why I need to retain a particular NSArray ('sources') *twice* to prevent a crash (although no exception is reported on the console, but the application crashes and returns to the springboard). A snippet of the code is included below. There's too much code to pas...
2010/11/03
[ "https://Stackoverflow.com/questions/4083195", "https://Stackoverflow.com", "https://Stackoverflow.com/users/451544/" ]
You’re using `+arrayWithContentsOfFile:`, which returns an autoreleased object, then autoreleasing it again. Take out the call to `-autorelease` and you’ll be OK. You could re-write it as so: ``` sources  = [[NSArray arrayWithContentsOfFile:plistPath] retain]; ```
That's because arrayWithContentsOfFile: returns an autoreleased array to you. Calling autorelease on this array will release it twice at the end of current event run loop.
4,083,195
I have a complex App that runs reliably, but I'm puzzled why I need to retain a particular NSArray ('sources') *twice* to prevent a crash (although no exception is reported on the console, but the application crashes and returns to the springboard). A snippet of the code is included below. There's too much code to pas...
2010/11/03
[ "https://Stackoverflow.com/questions/4083195", "https://Stackoverflow.com", "https://Stackoverflow.com/users/451544/" ]
You’re using `+arrayWithContentsOfFile:`, which returns an autoreleased object, then autoreleasing it again. Take out the call to `-autorelease` and you’ll be OK. You could re-write it as so: ``` sources  = [[NSArray arrayWithContentsOfFile:plistPath] retain]; ```
Ditch the autorelease on the factory method. It's why you need a second retain.
4,083,195
I have a complex App that runs reliably, but I'm puzzled why I need to retain a particular NSArray ('sources') *twice* to prevent a crash (although no exception is reported on the console, but the application crashes and returns to the springboard). A snippet of the code is included below. There's too much code to pas...
2010/11/03
[ "https://Stackoverflow.com/questions/4083195", "https://Stackoverflow.com", "https://Stackoverflow.com/users/451544/" ]
Is it something to do with that autorelease? I can't see why that's there: it should be the factory method that autoreleases. Although I don't know what the consequence of adding an extra autorelease is, it might be worth seeing what happens if you take that out along with one of the retains.
``` NSString *plistPath = [[NSBundle mainBundle] pathForResource:@"Sources" ofType:@"plist"]; sources = [[NSArray alloc] initWithContentsOfFile:plistPath]; ```
4,083,195
I have a complex App that runs reliably, but I'm puzzled why I need to retain a particular NSArray ('sources') *twice* to prevent a crash (although no exception is reported on the console, but the application crashes and returns to the springboard). A snippet of the code is included below. There's too much code to pas...
2010/11/03
[ "https://Stackoverflow.com/questions/4083195", "https://Stackoverflow.com", "https://Stackoverflow.com/users/451544/" ]
Ditch the autorelease on the factory method. It's why you need a second retain.
``` NSString *plistPath = [[NSBundle mainBundle] pathForResource:@"Sources" ofType:@"plist"]; sources = [[NSArray alloc] initWithContentsOfFile:plistPath]; ```
4,083,195
I have a complex App that runs reliably, but I'm puzzled why I need to retain a particular NSArray ('sources') *twice* to prevent a crash (although no exception is reported on the console, but the application crashes and returns to the springboard). A snippet of the code is included below. There's too much code to pas...
2010/11/03
[ "https://Stackoverflow.com/questions/4083195", "https://Stackoverflow.com", "https://Stackoverflow.com/users/451544/" ]
There *is* an explicit call to release the array. `autorelease` is just as explicit as `release` — it just happens later. Not only that, but it was wrong to autorelease the array in the first place, since you didn't own it. One `retain` is necessary to claim ownership of the array. The second one prevents the crash by ...
That's because arrayWithContentsOfFile: returns an autoreleased array to you. Calling autorelease on this array will release it twice at the end of current event run loop.
4,083,195
I have a complex App that runs reliably, but I'm puzzled why I need to retain a particular NSArray ('sources') *twice* to prevent a crash (although no exception is reported on the console, but the application crashes and returns to the springboard). A snippet of the code is included below. There's too much code to pas...
2010/11/03
[ "https://Stackoverflow.com/questions/4083195", "https://Stackoverflow.com", "https://Stackoverflow.com/users/451544/" ]
There *is* an explicit call to release the array. `autorelease` is just as explicit as `release` — it just happens later. Not only that, but it was wrong to autorelease the array in the first place, since you didn't own it. One `retain` is necessary to claim ownership of the array. The second one prevents the crash by ...
``` NSString *plistPath = [[NSBundle mainBundle] pathForResource:@"Sources" ofType:@"plist"]; sources = [[NSArray alloc] initWithContentsOfFile:plistPath]; ```
4,083,195
I have a complex App that runs reliably, but I'm puzzled why I need to retain a particular NSArray ('sources') *twice* to prevent a crash (although no exception is reported on the console, but the application crashes and returns to the springboard). A snippet of the code is included below. There's too much code to pas...
2010/11/03
[ "https://Stackoverflow.com/questions/4083195", "https://Stackoverflow.com", "https://Stackoverflow.com/users/451544/" ]
There *is* an explicit call to release the array. `autorelease` is just as explicit as `release` — it just happens later. Not only that, but it was wrong to autorelease the array in the first place, since you didn't own it. One `retain` is necessary to claim ownership of the array. The second one prevents the crash by ...
Ditch the autorelease on the factory method. It's why you need a second retain.
4,083,195
I have a complex App that runs reliably, but I'm puzzled why I need to retain a particular NSArray ('sources') *twice* to prevent a crash (although no exception is reported on the console, but the application crashes and returns to the springboard). A snippet of the code is included below. There's too much code to pas...
2010/11/03
[ "https://Stackoverflow.com/questions/4083195", "https://Stackoverflow.com", "https://Stackoverflow.com/users/451544/" ]
That's because arrayWithContentsOfFile: returns an autoreleased array to you. Calling autorelease on this array will release it twice at the end of current event run loop.
``` NSString *plistPath = [[NSBundle mainBundle] pathForResource:@"Sources" ofType:@"plist"]; sources = [[NSArray alloc] initWithContentsOfFile:plistPath]; ```
4,083,195
I have a complex App that runs reliably, but I'm puzzled why I need to retain a particular NSArray ('sources') *twice* to prevent a crash (although no exception is reported on the console, but the application crashes and returns to the springboard). A snippet of the code is included below. There's too much code to pas...
2010/11/03
[ "https://Stackoverflow.com/questions/4083195", "https://Stackoverflow.com", "https://Stackoverflow.com/users/451544/" ]
You’re using `+arrayWithContentsOfFile:`, which returns an autoreleased object, then autoreleasing it again. Take out the call to `-autorelease` and you’ll be OK. You could re-write it as so: ``` sources  = [[NSArray arrayWithContentsOfFile:plistPath] retain]; ```
``` NSString *plistPath = [[NSBundle mainBundle] pathForResource:@"Sources" ofType:@"plist"]; sources = [[NSArray alloc] initWithContentsOfFile:plistPath]; ```
4,083,195
I have a complex App that runs reliably, but I'm puzzled why I need to retain a particular NSArray ('sources') *twice* to prevent a crash (although no exception is reported on the console, but the application crashes and returns to the springboard). A snippet of the code is included below. There's too much code to pas...
2010/11/03
[ "https://Stackoverflow.com/questions/4083195", "https://Stackoverflow.com", "https://Stackoverflow.com/users/451544/" ]
There *is* an explicit call to release the array. `autorelease` is just as explicit as `release` — it just happens later. Not only that, but it was wrong to autorelease the array in the first place, since you didn't own it. One `retain` is necessary to claim ownership of the array. The second one prevents the crash by ...
You’re using `+arrayWithContentsOfFile:`, which returns an autoreleased object, then autoreleasing it again. Take out the call to `-autorelease` and you’ll be OK. You could re-write it as so: ``` sources  = [[NSArray arrayWithContentsOfFile:plistPath] retain]; ```
21,721
Does anyone know why in some stores the save does not change the is\_anchor and in some stores it does? It is not working on a multi-store site (multiple default root categories)., though there may be other reasons. The code below generally works. When it does not it, the save has no effect, without any log errors. ...
2014/05/28
[ "https://magento.stackexchange.com/questions/21721", "https://magento.stackexchange.com", "https://magento.stackexchange.com/users/3373/" ]
The problem might be the fact that you are calling `save` on a category object that comes from a collection. To be sure it works, you should always call `load` before calling `save`. something like this: ``` foreach($categories as $category) { $anchor = $category->getIsAnchor(); if ($anchor == 1 ) { c...
• Create a php file, Add below content ``` <?php error_reporting(E_ALL); ini_set('display_errors', '1'); require_once('app/Mage.php'); Mage::app(); $categories = Mage::getModel('catalog/category') ->getCollection() ->addAttributeToSelect('*') ->addAttributeToFilter('is_anchor', 0) ->addAttributeToFilter('entit...
21,721
Does anyone know why in some stores the save does not change the is\_anchor and in some stores it does? It is not working on a multi-store site (multiple default root categories)., though there may be other reasons. The code below generally works. When it does not it, the save has no effect, without any log errors. ...
2014/05/28
[ "https://magento.stackexchange.com/questions/21721", "https://magento.stackexchange.com", "https://magento.stackexchange.com/users/3373/" ]
The problem might be the fact that you are calling `save` on a category object that comes from a collection. To be sure it works, you should always call `load` before calling `save`. something like this: ``` foreach($categories as $category) { $anchor = $category->getIsAnchor(); if ($anchor == 1 ) { c...
Almost certainly the reason is that you have ***Use Flat Catalog Category*** set to ***Yes*** and your code doesn't account for this scenario. Try turning that setting off in ***System -> Configuration -> Catalog -> Frontend*** and then run the script again. When you switch flat catalog back on again, be sure to rein...
21,721
Does anyone know why in some stores the save does not change the is\_anchor and in some stores it does? It is not working on a multi-store site (multiple default root categories)., though there may be other reasons. The code below generally works. When it does not it, the save has no effect, without any log errors. ...
2014/05/28
[ "https://magento.stackexchange.com/questions/21721", "https://magento.stackexchange.com", "https://magento.stackexchange.com/users/3373/" ]
Almost certainly the reason is that you have ***Use Flat Catalog Category*** set to ***Yes*** and your code doesn't account for this scenario. Try turning that setting off in ***System -> Configuration -> Catalog -> Frontend*** and then run the script again. When you switch flat catalog back on again, be sure to rein...
• Create a php file, Add below content ``` <?php error_reporting(E_ALL); ini_set('display_errors', '1'); require_once('app/Mage.php'); Mage::app(); $categories = Mage::getModel('catalog/category') ->getCollection() ->addAttributeToSelect('*') ->addAttributeToFilter('is_anchor', 0) ->addAttributeToFilter('entit...
69,495,808
My code is: ``` import time local_time = time.localtime() time_string_d = time.strftime("%d", local_time) time_string_m = time.strftime("%m", local_time) time_string_y = time.strftime("%Y", local_time) time_string_hm = time.strftime("%H:%M", local_time) day_st = ['1', '21', '31'] day_nd = ['2', '22', '32'] day_rd = [...
2021/10/08
[ "https://Stackoverflow.com/questions/69495808", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13814234/" ]
You should use single [if-elif-else](https://docs.python.org/3/reference/compound_stmts.html#the-if-statement) for example ``` x = 1 if x == 1: print(1) elif x == 2: print(2) else: print("else") ``` will print `1`, whilst ``` x = 1 if x == 1: print(1) if x == 2: print(2) else: print("else") ...
The issue here is that you are chaining `if` statements instead of `elif`s, when your code is running, it checks each line, but the else statement runs in every case where: ``` if time_string_d in day_th: ``` is not true. As in, your function looks like this: ``` def day(): if time_string_d in day_st: ...
28,948,726
I would like to create a button style which all of my buttons use, this way I do not need to set the android:textColor on each one. I have this styling in a file named defaultbutton.xml ``` <item android:state_pressed="false" android:state_focused="false"> <shape android:shape="rectangle"> <solid android:...
2015/03/09
[ "https://Stackoverflow.com/questions/28948726", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1522049/" ]
You need to add color attribute to the item tag to set color of text. `/res/drawable/custom_color.xml` ``` <item android:state_pressed="false" android:state_focused="false" android:color="@color/text_color"> //this is how text color can be defined </item> ``` Now set `textColor` to the `textView` of your lay...
You can set it with style: ``` <style name="MyButtonText" parent="@android:style/Widget.Button"> <item name="android:textColor">@color/mycolor</item> ```
28,948,726
I would like to create a button style which all of my buttons use, this way I do not need to set the android:textColor on each one. I have this styling in a file named defaultbutton.xml ``` <item android:state_pressed="false" android:state_focused="false"> <shape android:shape="rectangle"> <solid android:...
2015/03/09
[ "https://Stackoverflow.com/questions/28948726", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1522049/" ]
You need to add color attribute to the item tag to set color of text. `/res/drawable/custom_color.xml` ``` <item android:state_pressed="false" android:state_focused="false" android:color="@color/text_color"> //this is how text color can be defined </item> ``` Now set `textColor` to the `textView` of your lay...
You can go to "styles.xml" file, you can find it in "values" folder and add the following lines to the file : ``` <style name="buttonstyle" > <item name="android:textColor" >#ff11</item> </style> ``` after that when you add button add this line to your button attr. ``` style="@style/buttonstyle" ```
2,455,061
A function f is defined to be convex on the closed interval $[1,5]$ if and only if $f(t+(1-t)5) \le tf(1) + (1-t)f(5)$ for any $t$ between $0$ and $1$ inclusive $(0\le t\le 1).$ Please help me prove this or at least where to start and what I am looking for at the end. I am lost. I would really appreciate it! Thanks!
2017/10/03
[ "https://math.stackexchange.com/questions/2455061", "https://math.stackexchange.com", "https://math.stackexchange.com/users/486823/" ]
$f(1)=(1-3)^2=4$, $f(5)=(5-3)^2=4$, so the right hand side is $tf(1)+(1-t)f(5)=4t+(1-t)4=4$. The left hand side is $f(t+(1-t)5)=f(5-4t)=(5-4t-3)^2=(2-4t)^2=4(1-t)^2$. Note that $0\leq t\leq 1$, so $0\leq 1-t\leq 1$, $0\leq(1-t)^2\leq 1$. Multiply by 4 to obtain $4(1-t)^2\leq 4$. Q.E.D.
As per my comment, we must show $$f(tx + (1 - t)y) \le tf(x) + (1 - t)f(y)$$ for $t \in [0, 1]$ and $x, y \in [1, 5]$. Actually, $f(x) = (x - 3)^2$ is convex everywhere, so you'll find that we don't really need the assumption that $x, y \in [1, 5]$. We have, \begin{align\*} &tf(x) + (1 - t)f(y) - f(tx + (1- t)y) \\ =...
2,455,061
A function f is defined to be convex on the closed interval $[1,5]$ if and only if $f(t+(1-t)5) \le tf(1) + (1-t)f(5)$ for any $t$ between $0$ and $1$ inclusive $(0\le t\le 1).$ Please help me prove this or at least where to start and what I am looking for at the end. I am lost. I would really appreciate it! Thanks!
2017/10/03
[ "https://math.stackexchange.com/questions/2455061", "https://math.stackexchange.com", "https://math.stackexchange.com/users/486823/" ]
$f(1)=(1-3)^2=4$, $f(5)=(5-3)^2=4$, so the right hand side is $tf(1)+(1-t)f(5)=4t+(1-t)4=4$. The left hand side is $f(t+(1-t)5)=f(5-4t)=(5-4t-3)^2=(2-4t)^2=4(1-t)^2$. Note that $0\leq t\leq 1$, so $0\leq 1-t\leq 1$, $0\leq(1-t)^2\leq 1$. Multiply by 4 to obtain $4(1-t)^2\leq 4$. Q.E.D.
In this case, the function has a second derivative and $f''(x) = 2 > 0$ so it is convex.
20,024,688
I have a DIV which will contain the content for a website of mine. On the left side there is a menu which has its position set to `float`. When I re-size my browser the container gets under the box and it looks quite bad. This is how it looks like: ![Bad look](https://i.stack.imgur.com/Lw288.png) I have tried to put ...
2013/11/16
[ "https://Stackoverflow.com/questions/20024688", "https://Stackoverflow.com", "https://Stackoverflow.com/users/445820/" ]
The `*` character in a regular expression has a special meaning. To show the Pattern you don't mean for this special meaning, you have to "escape" it. The easiest way to do it is to put your expression through `Pattern.quote()`. For example: ``` String searchFor = Pattern.quote("***"); ``` Then use that string to s...
This is not perfect, but it'll get you started: ``` // 4 lines, 2 of each containing "***" at random locations String input = "abc***def\nghijkl\n***mnop\n**blah"; // replacing multiline pattern starting with any character 0 or more times, // followed by 3 escaped "*"s, // followed by any character 0 or more times ...
20,024,688
I have a DIV which will contain the content for a website of mine. On the left side there is a menu which has its position set to `float`. When I re-size my browser the container gets under the box and it looks quite bad. This is how it looks like: ![Bad look](https://i.stack.imgur.com/Lw288.png) I have tried to put ...
2013/11/16
[ "https://Stackoverflow.com/questions/20024688", "https://Stackoverflow.com", "https://Stackoverflow.com/users/445820/" ]
The `*` character in a regular expression has a special meaning. To show the Pattern you don't mean for this special meaning, you have to "escape" it. The easiest way to do it is to put your expression through `Pattern.quote()`. For example: ``` String searchFor = Pattern.quote("***"); ``` Then use that string to s...
If the three asterisks are not always at the begining of the line, you can use this pattern that removes newlines too: ``` (\r?\n)?[^\r\n*]*\Q***\E.*((1)?|\r?\n?) ```
20,024,688
I have a DIV which will contain the content for a website of mine. On the left side there is a menu which has its position set to `float`. When I re-size my browser the container gets under the box and it looks quite bad. This is how it looks like: ![Bad look](https://i.stack.imgur.com/Lw288.png) I have tried to put ...
2013/11/16
[ "https://Stackoverflow.com/questions/20024688", "https://Stackoverflow.com", "https://Stackoverflow.com/users/445820/" ]
The `*` character in a regular expression has a special meaning. To show the Pattern you don't mean for this special meaning, you have to "escape" it. The easiest way to do it is to put your expression through `Pattern.quote()`. For example: ``` String searchFor = Pattern.quote("***"); ``` Then use that string to s...
If all you're doing is looking for three specific characters together in a string, you don't need a regex at all: ``` if (line.contains("***")) { ... } ``` (But if things get more complicated and you do need a regex, then use a backslash or `Pattern.quote` as the other answers say.) (This is assuming you're rea...
20,024,688
I have a DIV which will contain the content for a website of mine. On the left side there is a menu which has its position set to `float`. When I re-size my browser the container gets under the box and it looks quite bad. This is how it looks like: ![Bad look](https://i.stack.imgur.com/Lw288.png) I have tried to put ...
2013/11/16
[ "https://Stackoverflow.com/questions/20024688", "https://Stackoverflow.com", "https://Stackoverflow.com/users/445820/" ]
Note that`*` is a special character in regex so you have to use `\\*` Your expression will be: `(?m)^\\*\\*.\\*`
This is not perfect, but it'll get you started: ``` // 4 lines, 2 of each containing "***" at random locations String input = "abc***def\nghijkl\n***mnop\n**blah"; // replacing multiline pattern starting with any character 0 or more times, // followed by 3 escaped "*"s, // followed by any character 0 or more times ...
20,024,688
I have a DIV which will contain the content for a website of mine. On the left side there is a menu which has its position set to `float`. When I re-size my browser the container gets under the box and it looks quite bad. This is how it looks like: ![Bad look](https://i.stack.imgur.com/Lw288.png) I have tried to put ...
2013/11/16
[ "https://Stackoverflow.com/questions/20024688", "https://Stackoverflow.com", "https://Stackoverflow.com/users/445820/" ]
Note that`*` is a special character in regex so you have to use `\\*` Your expression will be: `(?m)^\\*\\*.\\*`
If the three asterisks are not always at the begining of the line, you can use this pattern that removes newlines too: ``` (\r?\n)?[^\r\n*]*\Q***\E.*((1)?|\r?\n?) ```
20,024,688
I have a DIV which will contain the content for a website of mine. On the left side there is a menu which has its position set to `float`. When I re-size my browser the container gets under the box and it looks quite bad. This is how it looks like: ![Bad look](https://i.stack.imgur.com/Lw288.png) I have tried to put ...
2013/11/16
[ "https://Stackoverflow.com/questions/20024688", "https://Stackoverflow.com", "https://Stackoverflow.com/users/445820/" ]
Note that`*` is a special character in regex so you have to use `\\*` Your expression will be: `(?m)^\\*\\*.\\*`
If all you're doing is looking for three specific characters together in a string, you don't need a regex at all: ``` if (line.contains("***")) { ... } ``` (But if things get more complicated and you do need a regex, then use a backslash or `Pattern.quote` as the other answers say.) (This is assuming you're rea...
3,284,131
I would like to solve the following series: $$\sum\_{n=3}^\infty \frac{\log(n-1)-\log(n)}{\log(n-1)\log(n)}$$ Here's what I did: $$\sum\_{n=3}^\infty \frac{\log(n-1)-\log(n)}{\log(n-1)\log(n)}=\sum\_{n=3}^\infty \frac{\log\bigl(\frac{n-1}{n}\bigr)}{\log(n-1)\log(n)}=\sum\_{n=3}^\infty\frac{\log\bigl(1-\frac{1}{n}\bigr...
2019/07/05
[ "https://math.stackexchange.com/questions/3284131", "https://math.stackexchange.com", "https://math.stackexchange.com/users/353053/" ]
$$\begin{align} \sum\_{n=3}^{\infty} \frac{\log(n-1)-\log(n)}{\log(n-1) \log(n)} &=\sum\_{n=3}^{\infty}\left( \frac{\log(n-1)}{\log(n-1) \log(n)}-\frac{\log(n)}{\log(n-1) \log(n)}\right) \\ &=\sum\_{n=3}^{\infty}\left( \frac{1}{\log(n)}-\frac{1}{\log(n-1)}\right) \\ &=\lim\_{N\to \infty}\sum\_{n=3}^N\left( \frac{1}{\lo...
Hint: It is $$\sum\_{n=3}^{\infty}\frac{1}{\log(n)}-\frac{1}{\log(n-1)}$$
18,758,041
I'm trying to play a video from youtube using javaFX. Here is my code ``` public class Main extends Application { public static void main(String[] args) { launch(args); } @Override public void start(Stage primaryStage) throws Exception { primaryStage.setTitle("Media"); Group root = new Group(); Media...
2013/09/12
[ "https://Stackoverflow.com/questions/18758041", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2326666/" ]
*Update Oct 2021* I tried this solution again using JavaFX 17, it worked fine for me, which is kind of nice six years later. Note that the video in the original example is no longer hosted on YouTube, but you would want to play a different video anyway. To do so, just substitute the video id part of the url `utUPth7...
JavaFX can't play youtube video just with the video url. you need to specify the file of your video, not just a random youtube link. Try with this URL : <http://download.oracle.com/otndocs/products/javafx/oow2010-2.flv> your code works fine
124,653
I am new to Python and need help. Looked for my answer but don't know if I am even using the correct terminology. I have a model in which I iterated through rows and performed a set of processes on each. For example a feature class with 10 features and on each of the 10 features I wanted to create an individual featur...
2014/12/05
[ "https://gis.stackexchange.com/questions/124653", "https://gis.stackexchange.com", "https://gis.stackexchange.com/users/41060/" ]
`row.getValue(field)` didn't make sense to me. Going down that path never worked out. I ended up finding something that worked: ``` arcpy.MakeFeatureLayer_management(Caribou, FCView) cursor = arcpy.SearchCursor(FCView) for row in cursor: objectid = str(row.getValue("OBJECTID")) arcpy.SelectLayerByAttribute_...
I think your error is with: ``` rows = arcpy.SearchCursor(selectingLayer) for row in rows: arcpy.FeatureClassToFeatureClass_conversion(row, TEMP, "Zone2.shp", "", "ID \"ID\" true true false 4 Short 0 4 ,First,#,\\\\silver\\clients\\SYNCRUDE\\Projects\\P696\\8_BaseMine\\Processing\\TEMP\\trans1.shp,ID,-1,-1", "") ...
48,930,447
I am trying to learn geofire I try to implement the SFVehicle app but it is showing error can you please help this is the crucial part of my project ``` public class MapsActivity extends FragmentActivity implements OnMapReadyCallback { private GoogleMap mMap; private static final GeoLocation INITIAL_CENTER = ...
2018/02/22
[ "https://Stackoverflow.com/questions/48930447", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9204259/" ]
It will work fine if you add a listener in its parameters.As ``` geoFire = new GeoFire(database.getReference().child("geofire_location")); String key = geoFire.getDatabaseReference().push().getKey(); geoFire.setLocation(key,new GeoLocation(37.7789, -122.4017)),new GeoFire.CompletionListener(){ @Overr...
I spent 4 hours working on that error ``` geoFire.setLocation(userId, new GeoLocation(37.7789, -122.4017)),new GeoFire.CompletionListener(){ @Override public void onComplete(String key, DatabaseError error) { Log.e(TAG, "GeoFire Complete"); } }); ``` It ...
48,930,447
I am trying to learn geofire I try to implement the SFVehicle app but it is showing error can you please help this is the crucial part of my project ``` public class MapsActivity extends FragmentActivity implements OnMapReadyCallback { private GoogleMap mMap; private static final GeoLocation INITIAL_CENTER = ...
2018/02/22
[ "https://Stackoverflow.com/questions/48930447", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9204259/" ]
It will work fine if you add a listener in its parameters.As ``` geoFire = new GeoFire(database.getReference().child("geofire_location")); String key = geoFire.getDatabaseReference().push().getKey(); geoFire.setLocation(key,new GeoLocation(37.7789, -122.4017)),new GeoFire.CompletionListener(){ @Overr...
Downgrade your geofire dependency from latest version to implementation 'com.firebase:geofire-android:2.1.1'
48,930,447
I am trying to learn geofire I try to implement the SFVehicle app but it is showing error can you please help this is the crucial part of my project ``` public class MapsActivity extends FragmentActivity implements OnMapReadyCallback { private GoogleMap mMap; private static final GeoLocation INITIAL_CENTER = ...
2018/02/22
[ "https://Stackoverflow.com/questions/48930447", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9204259/" ]
It will work fine if you add a listener in its parameters.As ``` geoFire = new GeoFire(database.getReference().child("geofire_location")); String key = geoFire.getDatabaseReference().push().getKey(); geoFire.setLocation(key,new GeoLocation(37.7789, -122.4017)),new GeoFire.CompletionListener(){ @Overr...
Read this - <https://github.com/firebase/geofire-java> Its support - implementation 'com.firebase:geofire-java:3.0.0' (vertion) //----------------------------------------code------------------------------------------- ``` firebaseAuth = FirebaseAuth.getInstance(); firebaseDatabase = FirebaseDatabase.getInstance(); fi...
13,628,337
Is it possible to detect where text wraps? > > Lorem ipsum dolor sit amet > > > lets say that above text wraps after 'dolor' word. How to detect that and insert there some mark of it so it would be `Lorem ipsum dolor<div class='wrap-mark'/> sit amet` for example?
2012/11/29
[ "https://Stackoverflow.com/questions/13628337", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1785870/" ]
I've seen this problem solved a few different ways. One of my favorites involves creating a div that mirrors the width of the container that holds your text. You then print words of your content into faux-container one-by-one, measuring the height of the container along the way. When the height of the container changes...
Use the soft-hyphen entity to mark the wrapping position, plus the non-breaking-space entity to separate words without whitespace. The non-breaking space needs to come before the soft hyphen for IE10. Here is an example: Here is a cross-browser solution: ``` <!doctype html> <html> <head> <title>Soft Hyphen Text Wra...
59,356,616
I have a large data-set consisting of a header and a series of values in that column. I want to detect the presence and number of duplicates of these values within the whole dataset. ``` 1 2 3 4 5 6 7 734 456 346 545 874 734 455 734 783 482 545 456 948 483 ``` So for ex...
2019/12/16
[ "https://Stackoverflow.com/questions/59356616", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7136792/" ]
You can use `table()` and `data.frame()` to see the occurrence ``` data.frame(table(v)) ``` such that ``` v Freq 1 1 1 2 2 1 3 3 1 4 4 1 5 5 1 6 6 1 7 7 1 8 346 1 9 455 1 10 456 2 11 482 1 12 483 1 13 545 2 14 734 3 15 783 1 16 874 1 17 94...
You can transform it to a vector and then use `table()` as follows: ``` library(data.table) library(dplyr) df<-fread("734 456 346 545 874 734 455 734 783 482 545 456 948 483") df%>%unlist()%>%table() # 346 455 456 482 483 545 734 783 874 948 # 1 1 2 1 1 2 3 1 1 1 ```
31,543,550
this is my first post so I'll try to make sure I'm following appropriate posting etiquette. I have no experience whatsoever with html, d3, or javascript. I do however have some exposure to xml and svg. I'm trying to work through this tutorial: [<http://bost.ocks.org/mike/circles/]>. I spent several hours yesterday fru...
2015/07/21
[ "https://Stackoverflow.com/questions/31543550", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5139794/" ]
@Aaron's code above is broken due to *gensim* API changes. I rewrote and simplified it as follows. Works as of June 2017 with *gensim* v2.1.0 ``` import pandas as pd def topic_prob_extractor(gensim_hdp): shown_topics = gensim_hdp.show_topics(num_topics=-1, formatted=False) topics_nos = [x[0] for x in shown_to...
@user3907335 is exactly correct here: HDP will calculate as many topics as the assigned truncation level. *However*, it may be the case that many of these topics have basically zero probability of occurring. To help with this in my own work, I wrote a handy little function that performs a rough estimate of the probabil...
31,543,550
this is my first post so I'll try to make sure I'm following appropriate posting etiquette. I have no experience whatsoever with html, d3, or javascript. I do however have some exposure to xml and svg. I'm trying to work through this tutorial: [<http://bost.ocks.org/mike/circles/]>. I spent several hours yesterday fru...
2015/07/21
[ "https://Stackoverflow.com/questions/31543550", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5139794/" ]
There is apparently a bug in Gensim(version 3.8.3), in which giving `-1` to `show_topics` doesn't return anything at all. So I have tweaked the answers by **Roko Mijic** and **aaron**. ``` def topic_prob_extractor(gensim_hdp): shown_topics = gensim_hdp.show_topics(num_topics=gensim_hdp.m_T, formatted=False) to...
I haven't used gensim for HDPs, but is it possible that most of the topics in the smaller corpus have extremely low probability of occurring ? Can you trying printing the topic probabilities? Maybe, the length of the topics array doesn't necessarily mean that all those topics were actually found in the corpus.
31,543,550
this is my first post so I'll try to make sure I'm following appropriate posting etiquette. I have no experience whatsoever with html, d3, or javascript. I do however have some exposure to xml and svg. I'm trying to work through this tutorial: [<http://bost.ocks.org/mike/circles/]>. I spent several hours yesterday fru...
2015/07/21
[ "https://Stackoverflow.com/questions/31543550", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5139794/" ]
@Aron's and @Roko Mijic's approaches neglect the fact that the function [`show_topics`](https://radimrehurek.com/gensim/models/hdpmodel.html#gensim.models.hdpmodel.HdpModel.show_topics) returns by default the top 20 words of each topic only. If one returns all the words that compose a topic, all the approximated topic ...
I think you misunderstood the operation performed by the called method. Directly from the documentation you can see: > > Alias for show\_topics() that prints the top n most probable words for topics number of topics to log. Set topics=-1 to print all topics. > > > You trained the model without specifying the tr...
31,543,550
this is my first post so I'll try to make sure I'm following appropriate posting etiquette. I have no experience whatsoever with html, d3, or javascript. I do however have some exposure to xml and svg. I'm trying to work through this tutorial: [<http://bost.ocks.org/mike/circles/]>. I spent several hours yesterday fru...
2015/07/21
[ "https://Stackoverflow.com/questions/31543550", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5139794/" ]
@Aron's and @Roko Mijic's approaches neglect the fact that the function [`show_topics`](https://radimrehurek.com/gensim/models/hdpmodel.html#gensim.models.hdpmodel.HdpModel.show_topics) returns by default the top 20 words of each topic only. If one returns all the words that compose a topic, all the approximated topic ...
Deriving the average coherence of HDP topics from their coherence at the individual text level is a way to order (and potentially truncate) them. The following function does just that: ```py def order_subset_by_coherence(dirichlet_model, bow_corpus, num_topics=10, num_keywords=10): """ Orders topics based on t...
31,543,550
this is my first post so I'll try to make sure I'm following appropriate posting etiquette. I have no experience whatsoever with html, d3, or javascript. I do however have some exposure to xml and svg. I'm trying to work through this tutorial: [<http://bost.ocks.org/mike/circles/]>. I spent several hours yesterday fru...
2015/07/21
[ "https://Stackoverflow.com/questions/31543550", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5139794/" ]
I haven't used gensim for HDPs, but is it possible that most of the topics in the smaller corpus have extremely low probability of occurring ? Can you trying printing the topic probabilities? Maybe, the length of the topics array doesn't necessarily mean that all those topics were actually found in the corpus.
Deriving the average coherence of HDP topics from their coherence at the individual text level is a way to order (and potentially truncate) them. The following function does just that: ```py def order_subset_by_coherence(dirichlet_model, bow_corpus, num_topics=10, num_keywords=10): """ Orders topics based on t...
31,543,550
this is my first post so I'll try to make sure I'm following appropriate posting etiquette. I have no experience whatsoever with html, d3, or javascript. I do however have some exposure to xml and svg. I'm trying to work through this tutorial: [<http://bost.ocks.org/mike/circles/]>. I spent several hours yesterday fru...
2015/07/21
[ "https://Stackoverflow.com/questions/31543550", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5139794/" ]
@Aron's and @Roko Mijic's approaches neglect the fact that the function [`show_topics`](https://radimrehurek.com/gensim/models/hdpmodel.html#gensim.models.hdpmodel.HdpModel.show_topics) returns by default the top 20 words of each topic only. If one returns all the words that compose a topic, all the approximated topic ...
I haven't used gensim for HDPs, but is it possible that most of the topics in the smaller corpus have extremely low probability of occurring ? Can you trying printing the topic probabilities? Maybe, the length of the topics array doesn't necessarily mean that all those topics were actually found in the corpus.
31,543,550
this is my first post so I'll try to make sure I'm following appropriate posting etiquette. I have no experience whatsoever with html, d3, or javascript. I do however have some exposure to xml and svg. I'm trying to work through this tutorial: [<http://bost.ocks.org/mike/circles/]>. I spent several hours yesterday fru...
2015/07/21
[ "https://Stackoverflow.com/questions/31543550", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5139794/" ]
@Aaron's code above is broken due to *gensim* API changes. I rewrote and simplified it as follows. Works as of June 2017 with *gensim* v2.1.0 ``` import pandas as pd def topic_prob_extractor(gensim_hdp): shown_topics = gensim_hdp.show_topics(num_topics=-1, formatted=False) topics_nos = [x[0] for x in shown_to...
@Aron's and @Roko Mijic's approaches neglect the fact that the function [`show_topics`](https://radimrehurek.com/gensim/models/hdpmodel.html#gensim.models.hdpmodel.HdpModel.show_topics) returns by default the top 20 words of each topic only. If one returns all the words that compose a topic, all the approximated topic ...
31,543,550
this is my first post so I'll try to make sure I'm following appropriate posting etiquette. I have no experience whatsoever with html, d3, or javascript. I do however have some exposure to xml and svg. I'm trying to work through this tutorial: [<http://bost.ocks.org/mike/circles/]>. I spent several hours yesterday fru...
2015/07/21
[ "https://Stackoverflow.com/questions/31543550", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5139794/" ]
@user3907335 is exactly correct here: HDP will calculate as many topics as the assigned truncation level. *However*, it may be the case that many of these topics have basically zero probability of occurring. To help with this in my own work, I wrote a handy little function that performs a rough estimate of the probabil...
I think you misunderstood the operation performed by the called method. Directly from the documentation you can see: > > Alias for show\_topics() that prints the top n most probable words for topics number of topics to log. Set topics=-1 to print all topics. > > > You trained the model without specifying the tr...
31,543,550
this is my first post so I'll try to make sure I'm following appropriate posting etiquette. I have no experience whatsoever with html, d3, or javascript. I do however have some exposure to xml and svg. I'm trying to work through this tutorial: [<http://bost.ocks.org/mike/circles/]>. I spent several hours yesterday fru...
2015/07/21
[ "https://Stackoverflow.com/questions/31543550", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5139794/" ]
There is apparently a bug in Gensim(version 3.8.3), in which giving `-1` to `show_topics` doesn't return anything at all. So I have tweaked the answers by **Roko Mijic** and **aaron**. ``` def topic_prob_extractor(gensim_hdp): shown_topics = gensim_hdp.show_topics(num_topics=gensim_hdp.m_T, formatted=False) to...
Deriving the average coherence of HDP topics from their coherence at the individual text level is a way to order (and potentially truncate) them. The following function does just that: ```py def order_subset_by_coherence(dirichlet_model, bow_corpus, num_topics=10, num_keywords=10): """ Orders topics based on t...
31,543,550
this is my first post so I'll try to make sure I'm following appropriate posting etiquette. I have no experience whatsoever with html, d3, or javascript. I do however have some exposure to xml and svg. I'm trying to work through this tutorial: [<http://bost.ocks.org/mike/circles/]>. I spent several hours yesterday fru...
2015/07/21
[ "https://Stackoverflow.com/questions/31543550", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5139794/" ]
@user3907335 is exactly correct here: HDP will calculate as many topics as the assigned truncation level. *However*, it may be the case that many of these topics have basically zero probability of occurring. To help with this in my own work, I wrote a handy little function that performs a rough estimate of the probabil...
I haven't used gensim for HDPs, but is it possible that most of the topics in the smaller corpus have extremely low probability of occurring ? Can you trying printing the topic probabilities? Maybe, the length of the topics array doesn't necessarily mean that all those topics were actually found in the corpus.
9,201,161
I spoke about this in a previous question, but I have since narrowed down the issue to make it possible to be answered. First, some background. I have an ASP.net website that functions normally on the local server, but when it's on the live server and accessed externally, it has some session data issues that make occa...
2012/02/08
[ "https://Stackoverflow.com/questions/9201161", "https://Stackoverflow.com", "https://Stackoverflow.com/users/812647/" ]
``` $newformat = new DateTime::createFromFormat('Y z', "2009 322")->format('Y-M-d'); ``` Relevant docs here: <http://php.net/manual/en/datetime.createfromformat.php>
Try this [strtotime function](http://php.net/manual/en/function.strtotime.php)