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
106,947
I've been able to add a Google Calendar (CalDAV) account to OS X Calendar (v6, Mountain Lion 10.8.5) without problem, and all my own calendars show up. Is there a way of seeing calendars others have shared with me (these show up under 'Other Calendars' in the Google Calendar website settings)? (Same situation on my i...
2013/10/26
[ "https://apple.stackexchange.com/questions/106947", "https://apple.stackexchange.com", "https://apple.stackexchange.com/users/37070/" ]
Yes, this question is answered by google here: <https://www.google.com/calendar/syncselect> You can click on the link and select shared calendars you wanna sync with your device.
You could use a Calendar Program like Informant for macOS. it allows you to combine numerous calendars into a single app.
12,859,824
I am parsing through the subviews of a parent view, It has various subviews, all custom classes, of 10 different UIView subclasses. There is just one class which is a normal UIView. Now when I am looping thru, I need to get hold of the UIView subview, isKindOfClass is failing to do so as it returns 1 for all the UIVie...
2012/10/12
[ "https://Stackoverflow.com/questions/12859824", "https://Stackoverflow.com", "https://Stackoverflow.com/users/961021/" ]
You shoud use : ``` [currentView isMemberOfClass:[UIView class]]; ```
<http://developer.apple.com/library/ios/documentation/cocoa/reference/foundation/Protocols/NSObject_Protocol/Reference/NSObject.html#//apple_ref/occ/intfm/NSObject/isMemberOfClass>:
12,523,776
``` #ifndef UNICODE #define UNICODE #endif #include <iostream> #include <Windows.h> #include <queue> using namespace std; void addSomeContent(queue<TCHAR*> &s) { static int counter=0; TCHAR* buffer = new TCHAR[250]; //Allocate memory on heap wsprintf(buffer,TEXT("foo%d"),counter); s.push(buffer); ...
2012/09/21
[ "https://Stackoverflow.com/questions/12523776", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1349442/" ]
Agree with Seth about using unique\_ptr for your queue, or you can simply call ``` delete[] strings.front() ``` before the `strings.pop()` `front()` should be used to ensure we clean the element we are about to `pop()` i.e. the oldest element in the queue rather than `back()`, which is the newest!
If you just want to work with strings, I would consider to just use ``` typedef std::basic_string<TCHAR> tstring; std::queue<tstring> strings; ``` Otherwise you could use ``` std::queue<std::unique_ptr<TCHAR[]>> strings; // notice the [], they are important! ``` unique\_ptr is C++11, but I think it's supported by...
12,523,776
``` #ifndef UNICODE #define UNICODE #endif #include <iostream> #include <Windows.h> #include <queue> using namespace std; void addSomeContent(queue<TCHAR*> &s) { static int counter=0; TCHAR* buffer = new TCHAR[250]; //Allocate memory on heap wsprintf(buffer,TEXT("foo%d"),counter); s.push(buffer); ...
2012/09/21
[ "https://Stackoverflow.com/questions/12523776", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1349442/" ]
You can use a `queue<unique_ptr<TCHAR[]>>` to avoid memory deallocation entirely, or you can simply deallocate the memory before you remove it from the `queue` like so: ``` delete[] strings.front(); strings.pop(); ```
Agree with Seth about using unique\_ptr for your queue, or you can simply call ``` delete[] strings.front() ``` before the `strings.pop()` `front()` should be used to ensure we clean the element we are about to `pop()` i.e. the oldest element in the queue rather than `back()`, which is the newest!
12,523,776
``` #ifndef UNICODE #define UNICODE #endif #include <iostream> #include <Windows.h> #include <queue> using namespace std; void addSomeContent(queue<TCHAR*> &s) { static int counter=0; TCHAR* buffer = new TCHAR[250]; //Allocate memory on heap wsprintf(buffer,TEXT("foo%d"),counter); s.push(buffer); ...
2012/09/21
[ "https://Stackoverflow.com/questions/12523776", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1349442/" ]
You can use a `queue<unique_ptr<TCHAR[]>>` to avoid memory deallocation entirely, or you can simply deallocate the memory before you remove it from the `queue` like so: ``` delete[] strings.front(); strings.pop(); ```
If you just want to work with strings, I would consider to just use ``` typedef std::basic_string<TCHAR> tstring; std::queue<tstring> strings; ``` Otherwise you could use ``` std::queue<std::unique_ptr<TCHAR[]>> strings; // notice the [], they are important! ``` unique\_ptr is C++11, but I think it's supported by...
11,736,566
I'm trying to retrieve the month using `date`. ``` $year= 2012; $mon = date( 'F', mktime(0, 0, 0, $month,$year) ); ``` In the above code snippet, `$month` is dynamically incremented. I have used a while loop with `$month++`. But it doesn't give me the correct date. For example, let's say I gave `$month=5` at the be...
2012/07/31
[ "https://Stackoverflow.com/questions/11736566", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1503607/" ]
You forgot $date parameter. THe correct syntax of mktime is ``` mktime($hour,$minute,$second,$month,$day,$year); ``` so in your example $year will be considered as 'date' try something like ``` mktime(0,0,0,$month,1,$year); ```
there's an error in `mktime`: should be `mktime(0, 0, 0, $month, 1,$year)`, cause the 5th argument is `day`, but not the `year`
11,736,566
I'm trying to retrieve the month using `date`. ``` $year= 2012; $mon = date( 'F', mktime(0, 0, 0, $month,$year) ); ``` In the above code snippet, `$month` is dynamically incremented. I have used a while loop with `$month++`. But it doesn't give me the correct date. For example, let's say I gave `$month=5` at the be...
2012/07/31
[ "https://Stackoverflow.com/questions/11736566", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1503607/" ]
You forgot $date parameter. THe correct syntax of mktime is ``` mktime($hour,$minute,$second,$month,$day,$year); ``` so in your example $year will be considered as 'date' try something like ``` mktime(0,0,0,$month,1,$year); ```
Your problem stems from these lines: ``` $year= 2012; $mon = date( 'F', mktime(0, 0, 0, $month,$year) ); ``` To be exact from the mktime command. The exact syntax is: mktime($hour,$minute,$second,$month,$day,$year); As you have given $year as 5th parameter it is interpreted as "day" instead of "year". Thus when you...
1,231,785
I have two .Net applications running on client machine.One is IMSOperations and other is IMSInvoice.Both are windows forms application using C#. What happens is when both of these applications are running,after some time IMSOperations gets automatically closed. What i tried is to find reason of closing by subscribing...
2009/08/05
[ "https://Stackoverflow.com/questions/1231785", "https://Stackoverflow.com", "https://Stackoverflow.com/users/139357/" ]
Might I suggest adding these to make sure no exception is being thrown: You need to add this line to your Main(): ``` AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Appl...
Is it a clean exit? or its throwing an exception? If its the first there must be some code that checks the status of the other application. If its the latter you have to find the source of the crash.
3,880,339
I have a referenced library, inside there I want to perform a different action if the assembly that references it is in DEBUG/RELEASE mode. Is it possible to switch on the condition that the calling assembly is in DEBUG/RELEASE mode? Is there a way to do this without resorting to something like: ``` bool debug = fa...
2010/10/07
[ "https://Stackoverflow.com/questions/3880339", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28543/" ]
[Google says](http://stevesmithblog.com/blog/determine-whether-an-assembly-was-compiled-in-debug-mode/) it is very simple. You get the information from the [DebuggableAttribute](http://msdn.microsoft.com/en-us/library/system.diagnostics.debuggableattribute.aspx) of the assembly in question: ``` IsAssemblyDebugBuild(As...
You can use [reflection](http://msdn.microsoft.com/en-us/library/system.reflection.assembly.getcallingassembly.aspx) to get the calling assembly and use [this method](http://stevesmithblog.com/blog/determine-whether-an-assembly-was-compiled-in-debug-mode/) to check if it is in debug mode.
3,880,339
I have a referenced library, inside there I want to perform a different action if the assembly that references it is in DEBUG/RELEASE mode. Is it possible to switch on the condition that the calling assembly is in DEBUG/RELEASE mode? Is there a way to do this without resorting to something like: ``` bool debug = fa...
2010/10/07
[ "https://Stackoverflow.com/questions/3880339", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28543/" ]
[Google says](http://stevesmithblog.com/blog/determine-whether-an-assembly-was-compiled-in-debug-mode/) it is very simple. You get the information from the [DebuggableAttribute](http://msdn.microsoft.com/en-us/library/system.diagnostics.debuggableattribute.aspx) of the assembly in question: ``` IsAssemblyDebugBuild(As...
The accepted answer is correct. Here's an alternative version that skips the iteration stage and is provided as an extension method: ``` public static class AssemblyExtensions { public static bool IsDebugBuild(this Assembly assembly) { if (assembly == null) { throw new ArgumentNullE...
3,880,339
I have a referenced library, inside there I want to perform a different action if the assembly that references it is in DEBUG/RELEASE mode. Is it possible to switch on the condition that the calling assembly is in DEBUG/RELEASE mode? Is there a way to do this without resorting to something like: ``` bool debug = fa...
2010/10/07
[ "https://Stackoverflow.com/questions/3880339", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28543/" ]
The accepted answer is correct. Here's an alternative version that skips the iteration stage and is provided as an extension method: ``` public static class AssemblyExtensions { public static bool IsDebugBuild(this Assembly assembly) { if (assembly == null) { throw new ArgumentNullE...
You can use [reflection](http://msdn.microsoft.com/en-us/library/system.reflection.assembly.getcallingassembly.aspx) to get the calling assembly and use [this method](http://stevesmithblog.com/blog/determine-whether-an-assembly-was-compiled-in-debug-mode/) to check if it is in debug mode.
54,014,561
I have the following array: var numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35]; I want to get 15 random numbers from this array, where there can't be duplicates. I have no idea on how to do it. Also, if it'd be easier, I w...
2019/01/02
[ "https://Stackoverflow.com/questions/54014561", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10860157/" ]
If you are just trying to get a number between 1 and 35 then you could do this, ``` Math.floor(Math.random() * 35) + 1 ``` Math.random() returns a number between 0 and 1, multiplying this by 35 gives a number between 0 and 35 (not inclusive) as a float, you then take a floor add 1 to get the desired range. You can...
Here is a simple method,. First create the array of numbers from 1 to 35. Then randomly delete one from this array until the length is equal to 15. ```js const nums = Array.from(new Array(35),(v,i)=>i+1); while (nums.length > 15) nums.splice(Math.random() * nums.length, 1); console.log(nums.join(", ")); ```
41,413
My friend asked me for help with an IQ test and after she did it online she came back at me with the ones she couldn't solve. Two of them however, I discovered are the same puzzle type, but no matter how much I look at it, I just can't see the logic in it. We redid the test and this puzzle occurred yet again, so now ...
2016/08/25
[ "https://puzzling.stackexchange.com/questions/41413", "https://puzzling.stackexchange.com", "https://puzzling.stackexchange.com/users/29405/" ]
The Answer to number 2: > > 793: Why? They are all odd numbers! (Only possible to guess given the multiple choice nature of the question) The pattern means diddle squat. > > > --- None of the below matters, these were early attempts, which turned out to be wrong -------------------------------------------------...
Answers: > > 75, 67, 61 > > > $N\_2-N\_1=24\\N\_3-N\_1=64\\N\_4-N\_1=214$ Assume that each sequence is structured as an initial number followed by a succession of groups of three numbers: $$\{N\_1\}\quad\{N\_2,N\_3,N\_4\}\quad\{N\_5,N\_6,N\_7\}\quad\dots$$ $N\_5-N\_2=16\\N\_6-N\_3=-12\\N\_7-N\_4=50$ So, for an...
41,413
My friend asked me for help with an IQ test and after she did it online she came back at me with the ones she couldn't solve. Two of them however, I discovered are the same puzzle type, but no matter how much I look at it, I just can't see the logic in it. We redid the test and this puzzle occurred yet again, so now ...
2016/08/25
[ "https://puzzling.stackexchange.com/questions/41413", "https://puzzling.stackexchange.com", "https://puzzling.stackexchange.com/users/29405/" ]
The Answer to number 2: > > 793: Why? They are all odd numbers! (Only possible to guess given the multiple choice nature of the question) The pattern means diddle squat. > > > --- None of the below matters, these were early attempts, which turned out to be wrong -------------------------------------------------...
I interpreted it a different way, with each sequence as two strings with a prime as an index. It makes me think it's the same sequence that's been modified by the first number: ``` 19 43 83 233 59 61 283 +16 -22 +50 11 35 75 225 51 53 275 +16 -22 +50 5 29 69 219 45 47 269 +1...
41,413
My friend asked me for help with an IQ test and after she did it online she came back at me with the ones she couldn't solve. Two of them however, I discovered are the same puzzle type, but no matter how much I look at it, I just can't see the logic in it. We redid the test and this puzzle occurred yet again, so now ...
2016/08/25
[ "https://puzzling.stackexchange.com/questions/41413", "https://puzzling.stackexchange.com", "https://puzzling.stackexchange.com/users/29405/" ]
The Answer to number 2: > > 793: Why? They are all odd numbers! (Only possible to guess given the multiple choice nature of the question) The pattern means diddle squat. > > > --- None of the below matters, these were early attempts, which turned out to be wrong -------------------------------------------------...
> > The pattern is simply odd numbers. Of the choices, only one of them is an odd number. > > >
41,413
My friend asked me for help with an IQ test and after she did it online she came back at me with the ones she couldn't solve. Two of them however, I discovered are the same puzzle type, but no matter how much I look at it, I just can't see the logic in it. We redid the test and this puzzle occurred yet again, so now ...
2016/08/25
[ "https://puzzling.stackexchange.com/questions/41413", "https://puzzling.stackexchange.com", "https://puzzling.stackexchange.com/users/29405/" ]
I think numbers should be 111,103,97 respectively.[![enter image description here](https://i.stack.imgur.com/IN2gp.jpg)](https://i.stack.imgur.com/IN2gp.jpg) We take difference only those number whose last digit is same.
I don't know where it can lead, but (and for the first sequence only) : (43 + 83) \* **2 -** 19 = 233 (59 + 61) \* **2 +** 43 = 283 Coincidence...? but this is not working for the 2 other sequences. That was just to contribute a bit or give an idea to someone... Above all that, either the scenario of the question ...
41,413
My friend asked me for help with an IQ test and after she did it online she came back at me with the ones she couldn't solve. Two of them however, I discovered are the same puzzle type, but no matter how much I look at it, I just can't see the logic in it. We redid the test and this puzzle occurred yet again, so now ...
2016/08/25
[ "https://puzzling.stackexchange.com/questions/41413", "https://puzzling.stackexchange.com", "https://puzzling.stackexchange.com/users/29405/" ]
What these three have in common is that in all of these sequences the addition to the next is in this order: > > 24 40 150 -174 2 222 ? > > > So as these three sequences share the same changing sequence then the changing isn't related to the numbers themselves but the differences between the numbers. Got some hi...
I think numbers should be 111,103,97 respectively.[![enter image description here](https://i.stack.imgur.com/IN2gp.jpg)](https://i.stack.imgur.com/IN2gp.jpg) We take difference only those number whose last digit is same.
41,413
My friend asked me for help with an IQ test and after she did it online she came back at me with the ones she couldn't solve. Two of them however, I discovered are the same puzzle type, but no matter how much I look at it, I just can't see the logic in it. We redid the test and this puzzle occurred yet again, so now ...
2016/08/25
[ "https://puzzling.stackexchange.com/questions/41413", "https://puzzling.stackexchange.com", "https://puzzling.stackexchange.com/users/29405/" ]
The Answer to number 2: > > 793: Why? They are all odd numbers! (Only possible to guess given the multiple choice nature of the question) The pattern means diddle squat. > > > --- None of the below matters, these were early attempts, which turned out to be wrong -------------------------------------------------...
I think numbers should be 111,103,97 respectively.[![enter image description here](https://i.stack.imgur.com/IN2gp.jpg)](https://i.stack.imgur.com/IN2gp.jpg) We take difference only those number whose last digit is same.
41,413
My friend asked me for help with an IQ test and after she did it online she came back at me with the ones she couldn't solve. Two of them however, I discovered are the same puzzle type, but no matter how much I look at it, I just can't see the logic in it. We redid the test and this puzzle occurred yet again, so now ...
2016/08/25
[ "https://puzzling.stackexchange.com/questions/41413", "https://puzzling.stackexchange.com", "https://puzzling.stackexchange.com/users/29405/" ]
How about we try to normalize the numbers by removing the first from all subsequent. Hereby we get > > 0 24 64 214 40 42 264 > > > Every number has a 4 in it, with many 2's and 6's. Work in progress for others to consider. Is there a pattern to the numbers now?
I think numbers should be 111,103,97 respectively.[![enter image description here](https://i.stack.imgur.com/IN2gp.jpg)](https://i.stack.imgur.com/IN2gp.jpg) We take difference only those number whose last digit is same.
41,413
My friend asked me for help with an IQ test and after she did it online she came back at me with the ones she couldn't solve. Two of them however, I discovered are the same puzzle type, but no matter how much I look at it, I just can't see the logic in it. We redid the test and this puzzle occurred yet again, so now ...
2016/08/25
[ "https://puzzling.stackexchange.com/questions/41413", "https://puzzling.stackexchange.com", "https://puzzling.stackexchange.com/users/29405/" ]
What these three have in common is that in all of these sequences the addition to the next is in this order: > > 24 40 150 -174 2 222 ? > > > So as these three sequences share the same changing sequence then the changing isn't related to the numbers themselves but the differences between the numbers. Got some hi...
Answers: > > 75, 67, 61 > > > $N\_2-N\_1=24\\N\_3-N\_1=64\\N\_4-N\_1=214$ Assume that each sequence is structured as an initial number followed by a succession of groups of three numbers: $$\{N\_1\}\quad\{N\_2,N\_3,N\_4\}\quad\{N\_5,N\_6,N\_7\}\quad\dots$$ $N\_5-N\_2=16\\N\_6-N\_3=-12\\N\_7-N\_4=50$ So, for an...
41,413
My friend asked me for help with an IQ test and after she did it online she came back at me with the ones she couldn't solve. Two of them however, I discovered are the same puzzle type, but no matter how much I look at it, I just can't see the logic in it. We redid the test and this puzzle occurred yet again, so now ...
2016/08/25
[ "https://puzzling.stackexchange.com/questions/41413", "https://puzzling.stackexchange.com", "https://puzzling.stackexchange.com/users/29405/" ]
The Answer to number 2: > > 793: Why? They are all odd numbers! (Only possible to guess given the multiple choice nature of the question) The pattern means diddle squat. > > > --- None of the below matters, these were early attempts, which turned out to be wrong -------------------------------------------------...
Not sure about this answer but it's worth the try Using the first sequence and repeadetly finding (negative) differences: ``` 19 43 83 233 59 61 283 / -3929 24 40 150 -174 2 222/-4212 16 110 -324 176 220/-4434 94 -434 500 44/-4654 -...
41,413
My friend asked me for help with an IQ test and after she did it online she came back at me with the ones she couldn't solve. Two of them however, I discovered are the same puzzle type, but no matter how much I look at it, I just can't see the logic in it. We redid the test and this puzzle occurred yet again, so now ...
2016/08/25
[ "https://puzzling.stackexchange.com/questions/41413", "https://puzzling.stackexchange.com", "https://puzzling.stackexchange.com/users/29405/" ]
How about we try to normalize the numbers by removing the first from all subsequent. Hereby we get > > 0 24 64 214 40 42 264 > > > Every number has a 4 in it, with many 2's and 6's. Work in progress for others to consider. Is there a pattern to the numbers now?
I don't know where it can lead, but (and for the first sequence only) : (43 + 83) \* **2 -** 19 = 233 (59 + 61) \* **2 +** 43 = 283 Coincidence...? but this is not working for the 2 other sequences. That was just to contribute a bit or give an idea to someone... Above all that, either the scenario of the question ...
23,293,043
Hi I have question about HTML form array and PHP. For example I have name and email but ask 6 times and I want to send this mail. What I should edit to work? thank you! **HTML:** ``` <form method="Post" action="send.php" onSubmit="return validate();"> <?php $amount=6; //amount shows the number of data I ...
2014/04/25
[ "https://Stackoverflow.com/questions/23293043", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3572757/" ]
I personally prefer to avoid dynamic stuff like ViewBag /ViewData as much as possible to transfer data between action methods and views. Let's build a strongly typed Viewmodel. ``` public class CreateCustomerVM { public string MidName{ get; set; } [Required] public string FirstName{ get; set; } public stri...
Use this in your view: ``` @Html.DropDownListFor(x => x.ID, ViewBag.Names, new Dictionary<string, object>{{"class", "control-label col-md-2"}}) ``` That should work.
23,293,043
Hi I have question about HTML form array and PHP. For example I have name and email but ask 6 times and I want to send this mail. What I should edit to work? thank you! **HTML:** ``` <form method="Post" action="send.php" onSubmit="return validate();"> <?php $amount=6; //amount shows the number of data I ...
2014/04/25
[ "https://Stackoverflow.com/questions/23293043", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3572757/" ]
I personally prefer to avoid dynamic stuff like ViewBag /ViewData as much as possible to transfer data between action methods and views. Let's build a strongly typed Viewmodel. ``` public class CreateCustomerVM { public string MidName{ get; set; } [Required] public string FirstName{ get; set; } public stri...
populate in viewbag again in post action of create: ``` public ActionResult Create(){ ViewBag.Names= new SelectList(db.TbName, "ID", "MidName"); return View(); } [HttpPost] public ActionResult Create(){ ViewBag.Names= new SelectList(db.TbName, "ID", "MidName"); return View(); } ``...
57,575,105
Is there a way to search for multiple conditions in the same column and then count the number of occurrences? For example, I want to figure out how many times a specific combination of values (x and then y, x then w, x then z) occur after one another for each respective person. I tried writing an IF statement but w...
2019/08/20
[ "https://Stackoverflow.com/questions/57575105", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9867193/" ]
``` library(dplyr) c1 = c("person1", "person1", "person1", "person1", "person2", "person2", "person1", "person1") c2 = c("x","y","a","a","x","w","x","z") df = as_tibble(cbind(c1,c2)) df %>% group_by(c1) %>% summarise(xy = sum(c2 == "x" & lead(c2, 1) =...
An option using `spread`. Create a column by `paste`ing the 'c2' with the `lead` values of 'c2', `filter` only the selected elementss in 'newcol' using `%in%` and `spread` from 'long' to 'wide' format ``` library(tidyverse) df %>% mutate(newcol = str_c(c2, lead(c2)), ind = 1) %>% select(-c2) %>% filter(newc...
17,449,157
Having made the move to C++11, I am now systematically passing my strings by value in my constructors. But now, I realize that it makes it easier to introduce bugs when also using the value in the body of the constructor: ``` class A(std::string val): _val(std::move(val)) { std::cout << val << std::endl; // Bug!!!...
2013/07/03
[ "https://Stackoverflow.com/questions/17449157", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16877/" ]
Name arguments whose purpose is to be moved-from in some distinctive manner, at least within the implementation of the constructor ``` A::A(std::string val_moved_from): _val(std::move(val_moved_from)) { std::cout << val_moved_from << std::endl; // Bug, but obvious } ``` then move from them as early as possible (i...
"Having made the move to C++11, I am now systematically passing my strings by value in my constructors." I'm sorry, I don't see why one would want to do this. What improvement does this provide in relation to the traditional method? (which is basically bug proof). ```` class A(const std::string & s): _val(s) { s...
23,395,932
Is it possible to overload = operator of type double? I have the following: ``` double operator=(double a, Length b) { return a = (b.getInches()/12+b.getFeet())*3.2808*0.9144; } ``` It throws the following error: ``` 'double operator=(double, Length)' must be a nonstatic member function ``` What am I doing...
2014/04/30
[ "https://Stackoverflow.com/questions/23395932", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1527217/" ]
You cannot overload operators for builtin (integral or floating point) types like `double`, and also you cannot globally overload the `=` operator for *any* type. The `=` operator can only be overloaded as a class member function. See also: [Can I define an operator overload that works with built-in / intrinsic / prim...
You cannot overload the assignment operator for a primitive type, but you can supply an operator that converts `Length` to `double`, giving you the desired effect: ``` class Length { ... public: operator double() { return (getInches()/12+getFeet())*3.2808*0.9144; } }; main() { Length len = ......
57,748,100
When any element with `.mytrigger` is clicked, `.myactive` will be toggled on element with `#mytarget`. I have the following code: ```js var navclick = document.getElementsByClassName("mytrigger"); for (var i = 0; i < navclick.length; i++) { navclick[i].onclick = function() { document.getElementById('mytarget...
2019/09/01
[ "https://Stackoverflow.com/questions/57748100", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11282590/" ]
Make as many as elements you want with class ".mytrigger" Just put onclick function as mentioned. I hope this helps:- If not then please clarify your problem **HTML CODE** ``` <a onclick="myFunction()" class="mytrigger">Button</a> <div id="mytarget"><p>Hello</p></div> <a onclick="myFunction()" class="mytrigger">Butt...
Using your code, I just changed *document.getElementsById* to *document.getElementById* (removing the s). ```js var navclick = document.getElementsByClassName("mytrigger"); for (var i = 0; i < navclick.length; i++) { navclick[i].onclick = function() { document.getElementById("mytarget").classList.toggle('m...
57,748,100
When any element with `.mytrigger` is clicked, `.myactive` will be toggled on element with `#mytarget`. I have the following code: ```js var navclick = document.getElementsByClassName("mytrigger"); for (var i = 0; i < navclick.length; i++) { navclick[i].onclick = function() { document.getElementById('mytarget...
2019/09/01
[ "https://Stackoverflow.com/questions/57748100", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11282590/" ]
Make as many as elements you want with class ".mytrigger" Just put onclick function as mentioned. I hope this helps:- If not then please clarify your problem **HTML CODE** ``` <a onclick="myFunction()" class="mytrigger">Button</a> <div id="mytarget"><p>Hello</p></div> <a onclick="myFunction()" class="mytrigger">Butt...
Using [addEventListener](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener): It sets up a function that will be called whenever the specified event is delivered to the target. ``` document.getElementsByClassName('mytrigger').addEventListener('click', function() { document.getElementById('...
48,057,433
The following query returns ``` select to_char( trunc(sysdate) - numtoyminterval(level - 1, 'month'), 'mon-yy') as month from dual connect by level <= 12 ``` last 12 months according to today's date(i.e. 2-Jan-18). [![enter image description here](https://i.stack.imgur.com/Sd9ZQ.png)](https://i.stack.imgur.com/Sd9...
2018/01/02
[ "https://Stackoverflow.com/questions/48057433", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7906671/" ]
`char` is `signed` on your platform. If you use `unsigned char` for your types for `c2` and `c1` then the implicit promotion to `int` for each term in your expression will have the effect you are after.
You can use multiplication instead of shifting: ``` int i = (int)c2 * 256 + c1; ```
22,499,848
I am looking for a way to get the content of the webpage using the url. For instance lets say when you go to www.example.com, you see the text "hello world". I want to get the text hello world in razor c#. In other words, I need a replacement of the following jquery code using c#: ``` $.post("www.example.com",{},fun...
2014/03/19
[ "https://Stackoverflow.com/questions/22499848", "https://Stackoverflow.com", "https://Stackoverflow.com/users/991609/" ]
``` var html = Html.Raw(new System.Net.WebClient().DownloadString("http://www.example.com")); ``` `Html.Raw` allows in parsing to HTML while a new instance of `WebClient` can help with directly fetching the string.
You can use the [WebClient class DownloadString](http://msdn.microsoft.com/en-us/library/ms144200%28v=vs.110%29.aspx) method to obtain the content of a remote page: ``` using (var client = new WebClient()){ var response = client.DownloadString("http://www.example.com"); // process response } ``` If the respo...
61,544,349
*"Do not embed secrets related to authentication in source code"* - [one may hear frequently](https://cloud.google.com/docs/authentication/production#best_practices_for_managing_credentials). Okay, so I use the [Key Management Service](https://cloud.google.com/kms) and [Secret Manager](https://cloud.google.com/secret-m...
2020/05/01
[ "https://Stackoverflow.com/questions/61544349", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3508719/" ]
I found one way to make this work, (*sortof*): * On local dev env rely on `GOOGLE_APPLICATION_CREDENTIALS` to point to the Service Account credentials manually downloaded from the GCP. * On local Docker container, provide that same file as a secret. My app then searches `/run/secrets/` for it if `GOOGLE_APPLICATION_CR...
Your Idea with cloud storage is good and workaround your needs; The easiest way to access the secrets stored on Secret Manager from a VM instance will be by curl, gcloud command or python script by ["accessing a secret version"](https://cloud.google.com/secret-manager/docs/creating-and-accessing-secrets#access_a_secret...
31,415,188
I have an ASP.NET MVC app written in C#. One of my actions looks like this: ``` [HttpPost] public async Task<ActionResult> Save(int id, MyViewModel viewModel) { viewModel.SaveToDb(); await Backup.Save(viewModel); return View(viewModel); } ``` ... ``` public class Backup { async public static Task Save(IBac...
2015/07/14
[ "https://Stackoverflow.com/questions/31415188", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1185425/" ]
See here for a discussion of this: [Can I use threads to carry out long-running jobs on IIS?](https://stackoverflow.com/questions/536681/can-i-use-threads-to-carry-out-long-running-jobs-on-iis) One simple alternative without having to use threads or queues would be to make an additional async call via the client, poss...
you can make a method that takes an action or a function (whatever you need), and runs a thread with whatever you need to run in the background. Basically whatever way you choose to make it, run the method in a separate thread.
10,947,628
I want to get distance text from following link. i have used NSXML parsing but unable to get the result. please tell me which xml method should i used for following xml. <http://maps.googleapis.com/maps/api/directions/xml?origin=30.9165904,75.8634752&destination=30.89314000,75.86938000&sensor=true> Thanks to all
2012/06/08
[ "https://Stackoverflow.com/questions/10947628", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1314522/" ]
Grid view can be really powerful if used correctly, one of the things you can do is hook onto an event (on data row bound) which will allow you to manipulate each row at a time. ASP.NET is more event driven than PHP, however if you still want to do things the PHP way you could in theory loop through each result. ``...
For more control over the rendering, you can use a [ListView](http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.listview). Scroll down to the bottom of that page for an example.
10,947,628
I want to get distance text from following link. i have used NSXML parsing but unable to get the result. please tell me which xml method should i used for following xml. <http://maps.googleapis.com/maps/api/directions/xml?origin=30.9165904,75.8634752&destination=30.89314000,75.86938000&sensor=true> Thanks to all
2012/06/08
[ "https://Stackoverflow.com/questions/10947628", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1314522/" ]
Grid view can be really powerful if used correctly, one of the things you can do is hook onto an event (on data row bound) which will allow you to manipulate each row at a time. ASP.NET is more event driven than PHP, however if you still want to do things the PHP way you could in theory loop through each result. ``...
example aspx: ``` <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false"> <Columns> <asp:BoundField DataField="CountryID" HeaderText="ID" ItemStyle-HorizontalAlign="Center" /> <asp:TemplateField HeaderText="Flag" ItemStyle-HorizontalAlign="Center"> <ItemTemplate> ...
10,947,628
I want to get distance text from following link. i have used NSXML parsing but unable to get the result. please tell me which xml method should i used for following xml. <http://maps.googleapis.com/maps/api/directions/xml?origin=30.9165904,75.8634752&destination=30.89314000,75.86938000&sensor=true> Thanks to all
2012/06/08
[ "https://Stackoverflow.com/questions/10947628", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1314522/" ]
first: Write your code on server side on Page\_load or in any other method for selecting record. and for selecting record from database you can use the following code ``` string myConnectionString="server=dbserver;database=mydatabase;uid=user;pwd=password;Connect Timeout=120;pooling=true;Max Pool Size=60;";// you can...
For more control over the rendering, you can use a [ListView](http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.listview). Scroll down to the bottom of that page for an example.
10,947,628
I want to get distance text from following link. i have used NSXML parsing but unable to get the result. please tell me which xml method should i used for following xml. <http://maps.googleapis.com/maps/api/directions/xml?origin=30.9165904,75.8634752&destination=30.89314000,75.86938000&sensor=true> Thanks to all
2012/06/08
[ "https://Stackoverflow.com/questions/10947628", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1314522/" ]
first: Write your code on server side on Page\_load or in any other method for selecting record. and for selecting record from database you can use the following code ``` string myConnectionString="server=dbserver;database=mydatabase;uid=user;pwd=password;Connect Timeout=120;pooling=true;Max Pool Size=60;";// you can...
example aspx: ``` <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false"> <Columns> <asp:BoundField DataField="CountryID" HeaderText="ID" ItemStyle-HorizontalAlign="Center" /> <asp:TemplateField HeaderText="Flag" ItemStyle-HorizontalAlign="Center"> <ItemTemplate> ...
27,216,471
I'm trying to create a custom iOS 8 keyboard. I am using Interface Builder to arrange the keyboard layout. I have two NIB files, one for iPhone 6 and one for iPhone 5. There are certain apps that are "scaled" up for the iPhone 6. For these apps, I want to load the iPhone 5 NIB (the iPhone 6 NIB goes off the screen). ...
2014/11/30
[ "https://Stackoverflow.com/questions/27216471", "https://Stackoverflow.com", "https://Stackoverflow.com/users/834310/" ]
In scaled app `[UIScreen mainScreen].scale` and `[UIScreen mainScreen].nativeScale` not be the same.
If your app is designed for iPhone 5 the `scale` and `nativeScale` properties will match when running your app on an iPhone 6 because both phones have a 2.0x native scale factor. Instead, you can use `[[UIScreen mainScreen] nativeBounds]` to see the bounds of the screen in pixels. For example, when running an app desi...
465,531
I have tried right clicking on the file selecting properties and then the permissions tab and setting it to execute. However, when I double click the file it opens in gedit. What do I do?
2014/05/14
[ "https://askubuntu.com/questions/465531", "https://askubuntu.com", "https://askubuntu.com/users/276476/" ]
To run your script by double clicking on its icon, you will need to create a `.desktop` file for it: ``` [Desktop Entry] Name=My script Comment=Test hello world script Exec=/home/user/yourscript.sh Icon=/home/user/youricon.gif Terminal=false Type=Application ``` Save the above as a file on your Desktop with a `.desk...
File Manager > Edit > Preferences > Behaviour forExecutable Text Files. In Ubuntu it is set to View Executable Files when they are opened i prefer set it to "Ask each time" like the previous version of ubuntu.
45,235,912
In the main window I can set CSS styles for different standard widgets: > > setStyleSheet("QComboBox { background-color: red; } QLabel { background-color: blue; }") > > > These styles will be applied in child widgets with those names. But is it possible to set styles for widgets defined by me in the same fashio...
2017/07/21
[ "https://Stackoverflow.com/questions/45235912", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7827768/" ]
Yes, styles will work just fine on your own widgets. If you have non-standard properties you want to set, you'll need to declare them using `Q_PROPERTY`. For example: ```c++ class MyWidget : public QWidget { Q_OBJECT Q_PROPERTY(QString extra READ extra WRITE setExtra) //... }; ``` You can then style ...
When applying stylesheets to a custom QWidget-derived class, do not forget to override the paintEvent as mentionned in [the documentation](http://doc.qt.io/qt-5/stylesheet-reference.html): > > QWidget Supports only the background, background-clip and > background-origin properties. > > > If you subclass from QWidg...
12,929,165
how to create sql server cte from a while loop my loop like this ``` declare @ind as int declare @code as nvarchar set @ind = 0 while @ind < 884 begin select @ind = @ind + 1 --here execute Procedure --and set return value to variable set @code = cast (@ind as nvarchar) end ...
2012/10/17
[ "https://Stackoverflow.com/questions/12929165", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1743326/" ]
If you need table: ``` ;WITH Sec(Number) AS ( SELECT 0 AS Number UNION ALL SELECT Number + 1 FROM Sec WHERE Number < 884 ) SELECT * FROM Sec OPTION(MAXRECURSION 0) ``` If you need one string: ``` ;WITH Sec(Number) AS ( SELECT 0 AS Number UNION ALL SELECT Number + 1 FROM Sec ...
Below query selects values from 0 to 884: ``` ;WITH T(Num)AS ( SELECT 0 UNION ALL SELECT Num+1 FROM T WHERE T.Num < 884 )SELECT Num FROM T OPTION (MAXRECURSION 0); ```
67,681,547
I want to set some variables getting they from the values of 5 select elements, the multiselect IDs have the same name that the variable names in the script.... Inside HTML part: ``` <select id="variable1"> <option value="10">10</option> <option value="20">20</option> <option value="50">50</option> </...
2021/05/25
[ "https://Stackoverflow.com/questions/67681547", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10950209/" ]
Use a setInterval and set it to one **second** => `1000` ```js let display = document.getElementById('display') let x = display.textContent; // textContent returns a string value setInterval(()=>{ // lets change the string value into an integer using parseInt() // parseInt would not be needed if the value of x wa...
You can use javascript setInterval function <https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setInterval> For example: ``` var x = 0; setInterval(() => { x = x + 1; }, 1000); //1000ms = 1 second ``` Then each second it will increment the "x" variable.
40,827,044
I'm using SQLite's `last_insert_rowid()` to grab the last inserted row ID following a batch insert. Is there any risk of race conditions that could cause this value to not return the last id of the batch insert? For example, is it possible that in between the completion of the insert and the calling of `last_insert_row...
2016/11/27
[ "https://Stackoverflow.com/questions/40827044", "https://Stackoverflow.com", "https://Stackoverflow.com/users/411954/" ]
`last_insert_rowid()` returns information about the last insert done in this specific connection; it cannot return a value written by some other process. To ensure that the returned value corresponds to the current state of the database, take advantage of SQLite's [ACID](http://en.wikipedia.org/wiki/ACID) guarantees (...
`last_insert_rowid()` is connection-dependent, so there is a risk when multiple threads are using the same connection, without SQLite switched to Serialized threading mode.
35,555,849
I'm fairly new to Qt and therefor try to find out how things are working. Especially for QTreeView this seems to be quite difficult: the documentation and the example that come from Qt are (at least for me) more or less cryptic. I'd guess one will understand this documentation only when one already knows how it works. ...
2016/02/22
[ "https://Stackoverflow.com/questions/35555849", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1138160/" ]
Maybe [this mini example](http://www.java2s.com/Code/Cpp/Qt/QTreeViewdemoandQStandardItem.htm) can help you. But to understand it you have to grasp the Model-View concept. The idea is that you **don't** add to the view, you add to the model and the view updates itself.
You can start with the combination of `QStandardItemModel` and `QTreeView`. Set the proper row and column count of your model by `QStandadItemModel::setRowCount()` and `QStandardItemModel::columnCount()`. Then you can insert a QStandardItem instance into the particular cell of the model with the `QStandardItemModel::...
54,662,572
It seems the backward compatibility of SSIS covered from SQL server 2008R2 to SQL server 2017 (since an instance with SQL server 2017 installed can proceed SSIS package with PackageFormatVersion = 3) The question is why do we need to update the SSIS package (.dtsx) Is there any performance boost or other necessaries ...
2019/02/13
[ "https://Stackoverflow.com/questions/54662572", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3686334/" ]
It is highly recommended to update packages because each new release of SQL Server contains new features, bug fixes, performance improvement. There are many articles describing the features of each release as example: * in SQL Server 2016 package parts was founded which guarantee high re-usability * ODATA components w...
The SSIS execution engine can run packages that are current version or older. That's been a feature since the second release. Why then should we upgrade SSIS packages from an older version to the current version since the execution engine can run them "as is?" I can think of a few reasons why you would want to do this...
15,202,513
I am trying to calculate the monthly payment of a loan and it always comes out wrong. The formula is as follows where i is interest ``` ((1 + i)^months / (1 + i)^months - 1) * principal * i ``` Assuming that annual interest rate and principal is an invisible floating point, can you tell me what's wrong with my form...
2013/03/04
[ "https://Stackoverflow.com/questions/15202513", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1892641/" ]
If you didn't, `john.property` would be undefined.
The `this` keyword is used to refer to the owner of the function executed: <http://www.quirksmode.org/js/this.html> As said, you need it to define the `john.property`, because the `property` variable passed to the function will expire once the function is executed.
22,912,327
I have the following PHP code to resize an image (i know this image will be a png so no need for checking...) ``` // The file //$filename = $_POST['original']; $filename = 'planets.png'; // Set a maximum height and width $width = 200; $height = 200; // Content type header('Content-Type: image/png'); // Get new dime...
2014/04/07
[ "https://Stackoverflow.com/questions/22912327", "https://Stackoverflow.com", "https://Stackoverflow.com/users/457148/" ]
Basically you need index for the `cell` which has to be deleted when delete is pressed. you can set the `tag` property and when button is pressed you can check the tag propery of the button which is sending event. see below code, ``` UIButton *removeButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; removeB...
Try this, ``` - (IBAction)removeItem:(id)sender { UIButton *button = (UIButton *)sender; CGPoint pointInTable = [button convertPoint:button.bounds.origin toView:_tableView]; NSIndexPath *indexPath = [_tableView indexPathForRowAtPoint:pointInTable]; //Remove the cell at indexPath } ```
22,912,327
I have the following PHP code to resize an image (i know this image will be a png so no need for checking...) ``` // The file //$filename = $_POST['original']; $filename = 'planets.png'; // Set a maximum height and width $width = 200; $height = 200; // Content type header('Content-Type: image/png'); // Get new dime...
2014/04/07
[ "https://Stackoverflow.com/questions/22912327", "https://Stackoverflow.com", "https://Stackoverflow.com/users/457148/" ]
Basically you need index for the `cell` which has to be deleted when delete is pressed. you can set the `tag` property and when button is pressed you can check the tag propery of the button which is sending event. see below code, ``` UIButton *removeButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; removeB...
//1. add tag to the button, for identifing later ``` removeButton.tag = indexPath.row; ``` //2. Get the cell ``` UITableViewCell *cellToBeDeleted = [tableView cellForRowAtIndexPath:sender.tag]; ```
34,713,996
I have this code: ``` <?php echo $form->fileField($model, 'avatar_url', array('style' => 'display:none')) ?> <a href="#" class="thumbnail" style="width: 96px" id="avatar"> <?php if (empty($model->avatar_url)) { ?> <img data-src="holder.js/96x96" id="avatar-img"> <?php } else { ?> <img src="<?= Yii::app()->base...
2016/01/11
[ "https://Stackoverflow.com/questions/34713996", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3750963/" ]
Sounds like you need to enable `short_open_tag` in your php.ini. Find the line `short_open_tag` in your php.ini and set the value to `1`: ``` short_open_tag = 1 ``` After you make the change, restart your web server. Read more here: <http://php.net/manual/en/ini.core.php#ini.short-open-tag> > > **short\_open\_tag...
Although technically `<?` can be used with PHP it's [considered best practice](http://www.php-fig.org/psr/psr-1/) to always use `<?php` instead.
34,713,996
I have this code: ``` <?php echo $form->fileField($model, 'avatar_url', array('style' => 'display:none')) ?> <a href="#" class="thumbnail" style="width: 96px" id="avatar"> <?php if (empty($model->avatar_url)) { ?> <img data-src="holder.js/96x96" id="avatar-img"> <?php } else { ?> <img src="<?= Yii::app()->base...
2016/01/11
[ "https://Stackoverflow.com/questions/34713996", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3750963/" ]
Sounds like you need to enable `short_open_tag` in your php.ini. Find the line `short_open_tag` in your php.ini and set the value to `1`: ``` short_open_tag = 1 ``` After you make the change, restart your web server. Read more here: <http://php.net/manual/en/ini.core.php#ini.short-open-tag> > > **short\_open\_tag...
In PHP5 `<?` is not allowed any more. We always should use `<?php`. By the way you can do this doing some tricks. But `<?php` is a good practice so don't leave it.
59,080,359
I have a sequence of numbers that I somehow obtain from an external source, not separated by any commas and not in a data structure, e.g: 1 1.5 120202.4343 58 -2442.5 Where distinct numbers are separated by a space(s). Is there a way for me to write a program to quickly convert this sequence into a list or numpy ar...
2019/11/28
[ "https://Stackoverflow.com/questions/59080359", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12448955/" ]
I can't believe nobody came up with the obvious: ``` np.array(your_string.split(),dtype=float) ```
You can use `split()` and split the spaces to get a list of strings. Then simply convert each string to a float using type casting. This is achieved in one line using list comprehension. For example: ``` x = '1 1.5 120202.4343 58 -2442.5' output = [float(i) for i in x.split(" ")] ``` **Output:** ``` [1, 1.5, 12020...
59,080,359
I have a sequence of numbers that I somehow obtain from an external source, not separated by any commas and not in a data structure, e.g: 1 1.5 120202.4343 58 -2442.5 Where distinct numbers are separated by a space(s). Is there a way for me to write a program to quickly convert this sequence into a list or numpy ar...
2019/11/28
[ "https://Stackoverflow.com/questions/59080359", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12448955/" ]
``` >>> in_str = '1 1.5 120202.4343 58 -2442.5' >>> list(map(float, in_str.split(' '))) [1, 1.5, 120202.4343, 58, -2442.5] ```
Like the other answers say using split() can be used for this problem once you get the data as a string. I feel like it is valuable to show that ``` with open(filename,'r') as fil: f = fil.read().split() ``` will let you put your external source file in a variable *filename* and then split that data into a list s...
59,080,359
I have a sequence of numbers that I somehow obtain from an external source, not separated by any commas and not in a data structure, e.g: 1 1.5 120202.4343 58 -2442.5 Where distinct numbers are separated by a space(s). Is there a way for me to write a program to quickly convert this sequence into a list or numpy ar...
2019/11/28
[ "https://Stackoverflow.com/questions/59080359", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12448955/" ]
Like the other answers say using split() can be used for this problem once you get the data as a string. I feel like it is valuable to show that ``` with open(filename,'r') as fil: f = fil.read().split() ``` will let you put your external source file in a variable *filename* and then split that data into a list s...
You can use `split()` and split the spaces to get a list of strings. Then simply convert each string to a float using type casting. This is achieved in one line using list comprehension. For example: ``` x = '1 1.5 120202.4343 58 -2442.5' output = [float(i) for i in x.split(" ")] ``` **Output:** ``` [1, 1.5, 12020...
59,080,359
I have a sequence of numbers that I somehow obtain from an external source, not separated by any commas and not in a data structure, e.g: 1 1.5 120202.4343 58 -2442.5 Where distinct numbers are separated by a space(s). Is there a way for me to write a program to quickly convert this sequence into a list or numpy ar...
2019/11/28
[ "https://Stackoverflow.com/questions/59080359", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12448955/" ]
``` >>> in_str = '1 1.5 120202.4343 58 -2442.5' >>> list(map(float, in_str.split(' '))) [1, 1.5, 120202.4343, 58, -2442.5] ```
I can't believe nobody came up with the obvious: ``` np.array(your_string.split(),dtype=float) ```
59,080,359
I have a sequence of numbers that I somehow obtain from an external source, not separated by any commas and not in a data structure, e.g: 1 1.5 120202.4343 58 -2442.5 Where distinct numbers are separated by a space(s). Is there a way for me to write a program to quickly convert this sequence into a list or numpy ar...
2019/11/28
[ "https://Stackoverflow.com/questions/59080359", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12448955/" ]
I can't believe nobody came up with the obvious: ``` np.array(your_string.split(),dtype=float) ```
You're on the right track. You can load the numbers as a single string, then `split` the string by spaces. This will give you a list of strings: ```py number_string = "1 1.5 120202.4343 58 -2442.5" number_list = number_string.split(" ") ``` Then, you can easily convert that list of strings into a numpy array of floa...
59,080,359
I have a sequence of numbers that I somehow obtain from an external source, not separated by any commas and not in a data structure, e.g: 1 1.5 120202.4343 58 -2442.5 Where distinct numbers are separated by a space(s). Is there a way for me to write a program to quickly convert this sequence into a list or numpy ar...
2019/11/28
[ "https://Stackoverflow.com/questions/59080359", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12448955/" ]
``` >>> in_str = '1 1.5 120202.4343 58 -2442.5' >>> list(map(float, in_str.split(' '))) [1, 1.5, 120202.4343, 58, -2442.5] ```
You're on the right track. You can load the numbers as a single string, then `split` the string by spaces. This will give you a list of strings: ```py number_string = "1 1.5 120202.4343 58 -2442.5" number_list = number_string.split(" ") ``` Then, you can easily convert that list of strings into a numpy array of floa...
59,080,359
I have a sequence of numbers that I somehow obtain from an external source, not separated by any commas and not in a data structure, e.g: 1 1.5 120202.4343 58 -2442.5 Where distinct numbers are separated by a space(s). Is there a way for me to write a program to quickly convert this sequence into a list or numpy ar...
2019/11/28
[ "https://Stackoverflow.com/questions/59080359", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12448955/" ]
``` >>> in_str = '1 1.5 120202.4343 58 -2442.5' >>> list(map(float, in_str.split(' '))) [1, 1.5, 120202.4343, 58, -2442.5] ```
You can use `split()` and split the spaces to get a list of strings. Then simply convert each string to a float using type casting. This is achieved in one line using list comprehension. For example: ``` x = '1 1.5 120202.4343 58 -2442.5' output = [float(i) for i in x.split(" ")] ``` **Output:** ``` [1, 1.5, 12020...
59,080,359
I have a sequence of numbers that I somehow obtain from an external source, not separated by any commas and not in a data structure, e.g: 1 1.5 120202.4343 58 -2442.5 Where distinct numbers are separated by a space(s). Is there a way for me to write a program to quickly convert this sequence into a list or numpy ar...
2019/11/28
[ "https://Stackoverflow.com/questions/59080359", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12448955/" ]
I'm not sure what you mean by "not in a data structure", that doesn't make much sense. But assuming you have a string, then `numpy` even provides a utility method for this: ``` >>> import numpy as np >>> data = '1 1.5 120202.4343 58 -2442.5' >>> np.fromstring(data, sep=' ') array([ 1.00000000e+00, 1.50000000e+00, 1....
Like the other answers say using split() can be used for this problem once you get the data as a string. I feel like it is valuable to show that ``` with open(filename,'r') as fil: f = fil.read().split() ``` will let you put your external source file in a variable *filename* and then split that data into a list s...
59,080,359
I have a sequence of numbers that I somehow obtain from an external source, not separated by any commas and not in a data structure, e.g: 1 1.5 120202.4343 58 -2442.5 Where distinct numbers are separated by a space(s). Is there a way for me to write a program to quickly convert this sequence into a list or numpy ar...
2019/11/28
[ "https://Stackoverflow.com/questions/59080359", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12448955/" ]
I'm not sure what you mean by "not in a data structure", that doesn't make much sense. But assuming you have a string, then `numpy` even provides a utility method for this: ``` >>> import numpy as np >>> data = '1 1.5 120202.4343 58 -2442.5' >>> np.fromstring(data, sep=' ') array([ 1.00000000e+00, 1.50000000e+00, 1....
``` >>> in_str = '1 1.5 120202.4343 58 -2442.5' >>> list(map(float, in_str.split(' '))) [1, 1.5, 120202.4343, 58, -2442.5] ```
59,080,359
I have a sequence of numbers that I somehow obtain from an external source, not separated by any commas and not in a data structure, e.g: 1 1.5 120202.4343 58 -2442.5 Where distinct numbers are separated by a space(s). Is there a way for me to write a program to quickly convert this sequence into a list or numpy ar...
2019/11/28
[ "https://Stackoverflow.com/questions/59080359", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12448955/" ]
Like the other answers say using split() can be used for this problem once you get the data as a string. I feel like it is valuable to show that ``` with open(filename,'r') as fil: f = fil.read().split() ``` will let you put your external source file in a variable *filename* and then split that data into a list s...
You're on the right track. You can load the numbers as a single string, then `split` the string by spaces. This will give you a list of strings: ```py number_string = "1 1.5 120202.4343 58 -2442.5" number_list = number_string.split(" ") ``` Then, you can easily convert that list of strings into a numpy array of floa...
17,706,823
I need create an Email List. For each Folder, I need get all email from owners. But, I have an error in listRequest.Email = reader["Email"].ToList(); The error is in "ToList()", I'm declaring namespace System.Collections.Generic but don't resolves. ``` public class ListRequest { public List<string> Email { get; se...
2013/07/17
[ "https://Stackoverflow.com/questions/17706823", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2456471/" ]
Below statement is not valid. ``` listRequest.Email = reader["Email"].ToList(); ``` Using SqlDataReader you can read only single element but not list like what you did to retrieve folder access. ``` listRequest.FolderAccess = reader["FolderAccess"].ToString(); ``` One thing you could do is retrieve email addresse...
`reader["Email"]` is an object. There is no method `object.ToList()` If it is supposed to be a delimited string, I recommend doing a `ToString()`, then `Split()` before your `ToList()`. Example: ``` listRequest.Email = reader["Email"] .ToString() .Split(new [] {","}, StringSplitOptions.RemoveEmptyEntries) ...
17,706,823
I need create an Email List. For each Folder, I need get all email from owners. But, I have an error in listRequest.Email = reader["Email"].ToList(); The error is in "ToList()", I'm declaring namespace System.Collections.Generic but don't resolves. ``` public class ListRequest { public List<string> Email { get; se...
2013/07/17
[ "https://Stackoverflow.com/questions/17706823", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2456471/" ]
`reader["Email"]` is an object. There is no method `object.ToList()` If it is supposed to be a delimited string, I recommend doing a `ToString()`, then `Split()` before your `ToList()`. Example: ``` listRequest.Email = reader["Email"] .ToString() .Split(new [] {","}, StringSplitOptions.RemoveEmptyEntries) ...
reader["Email"] is not a collection. Its gets the value of the specified column in the native format given the column name. So do this ``` var lstEmail = new List<string>(); using (connection) { SqlCommand command = new SqlCommand("SELECT Email FROM TableName;",connection); ...
17,706,823
I need create an Email List. For each Folder, I need get all email from owners. But, I have an error in listRequest.Email = reader["Email"].ToList(); The error is in "ToList()", I'm declaring namespace System.Collections.Generic but don't resolves. ``` public class ListRequest { public List<string> Email { get; se...
2013/07/17
[ "https://Stackoverflow.com/questions/17706823", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2456471/" ]
Below statement is not valid. ``` listRequest.Email = reader["Email"].ToList(); ``` Using SqlDataReader you can read only single element but not list like what you did to retrieve folder access. ``` listRequest.FolderAccess = reader["FolderAccess"].ToString(); ``` One thing you could do is retrieve email addresse...
reader["Email"] is not a collection. Its gets the value of the specified column in the native format given the column name. So do this ``` var lstEmail = new List<string>(); using (connection) { SqlCommand command = new SqlCommand("SELECT Email FROM TableName;",connection); ...
27,651,730
I have the following string example: ``` [14:48:51.690] LOGON error group: 103 ``` I get many different from them. The only thing is, that the beginning is always the same expect the date (always in brackets) and name of `LOGON`. I want to remove thi in front. How can I achieve this efficiently? Regex? Sp...
2014/12/26
[ "https://Stackoverflow.com/questions/27651730", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2257374/" ]
You can split the string based on regex `\[\d{1,2}:\d{1,2}:\d{1,2}\.\d{1,3}\]\s*\w*\s*` ``` import java.util.regex.Pattern; public class T { public static void main(String[] args) { String s = "[14:48:51.690] LOGON error group: 103"; String[] split = s.split("\\[\\d{1,2}:\\d{1,2}:\\d{1...
Here is another way using a simple regular expression: ``` Pattern pattern = Pattern.compile("\\[.*\\]\\s*LOGON\\s*(.*)\\s*"); Matcher matcher = pattern.matcher("[14:48:51.690] LOGON error group: 103"); if (matcher.find()) { System.out.println(matcher.group(1)); } ``` So...
27,651,730
I have the following string example: ``` [14:48:51.690] LOGON error group: 103 ``` I get many different from them. The only thing is, that the beginning is always the same expect the date (always in brackets) and name of `LOGON`. I want to remove thi in front. How can I achieve this efficiently? Regex? Sp...
2014/12/26
[ "https://Stackoverflow.com/questions/27651730", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2257374/" ]
You can split the string based on regex `\[\d{1,2}:\d{1,2}:\d{1,2}\.\d{1,3}\]\s*\w*\s*` ``` import java.util.regex.Pattern; public class T { public static void main(String[] args) { String s = "[14:48:51.690] LOGON error group: 103"; String[] split = s.split("\\[\\d{1,2}:\\d{1,2}:\\d{1...
Assuming the event text ("LOGIN" in your case) is all caps and one word: ``` String target = str.replaceAll(".*?\\]\\s*[A-Z]+\\s*", ""); ```
27,651,730
I have the following string example: ``` [14:48:51.690] LOGON error group: 103 ``` I get many different from them. The only thing is, that the beginning is always the same expect the date (always in brackets) and name of `LOGON`. I want to remove thi in front. How can I achieve this efficiently? Regex? Sp...
2014/12/26
[ "https://Stackoverflow.com/questions/27651730", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2257374/" ]
You can split the string based on regex `\[\d{1,2}:\d{1,2}:\d{1,2}\.\d{1,3}\]\s*\w*\s*` ``` import java.util.regex.Pattern; public class T { public static void main(String[] args) { String s = "[14:48:51.690] LOGON error group: 103"; String[] split = s.split("\\[\\d{1,2}:\\d{1,2}:\\d{1...
Regex is a very expensive task. If you're searching into a log file with 100,000 lines, it will take too much time! If your string always has the same pattern, TRY TO TAKE ADVANTAGE OF IT! I'm assuming your line is: ``` [some_time] some_event some event description ``` Simplest way I can see now is just to...
27,651,730
I have the following string example: ``` [14:48:51.690] LOGON error group: 103 ``` I get many different from them. The only thing is, that the beginning is always the same expect the date (always in brackets) and name of `LOGON`. I want to remove thi in front. How can I achieve this efficiently? Regex? Sp...
2014/12/26
[ "https://Stackoverflow.com/questions/27651730", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2257374/" ]
Here is another way using a simple regular expression: ``` Pattern pattern = Pattern.compile("\\[.*\\]\\s*LOGON\\s*(.*)\\s*"); Matcher matcher = pattern.matcher("[14:48:51.690] LOGON error group: 103"); if (matcher.find()) { System.out.println(matcher.group(1)); } ``` So...
Assuming the event text ("LOGIN" in your case) is all caps and one word: ``` String target = str.replaceAll(".*?\\]\\s*[A-Z]+\\s*", ""); ```
27,651,730
I have the following string example: ``` [14:48:51.690] LOGON error group: 103 ``` I get many different from them. The only thing is, that the beginning is always the same expect the date (always in brackets) and name of `LOGON`. I want to remove thi in front. How can I achieve this efficiently? Regex? Sp...
2014/12/26
[ "https://Stackoverflow.com/questions/27651730", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2257374/" ]
Regex is a very expensive task. If you're searching into a log file with 100,000 lines, it will take too much time! If your string always has the same pattern, TRY TO TAKE ADVANTAGE OF IT! I'm assuming your line is: ``` [some_time] some_event some event description ``` Simplest way I can see now is just to...
Assuming the event text ("LOGIN" in your case) is all caps and one word: ``` String target = str.replaceAll(".*?\\]\\s*[A-Z]+\\s*", ""); ```
489,035
It is a simple exercise to prove using mathematical induction that if a natural number n > 1 is not divisible by 2, then n can be written as m + m + 1 for some natural number m. (Depending on your definition of odd number, this can either be stated as "every number is even or odd", or as "every odd number is one greate...
2013/09/10
[ "https://math.stackexchange.com/questions/489035", "https://math.stackexchange.com", "https://math.stackexchange.com/users/71829/" ]
This is just a partial answer. Let $\mathcal L =\{S,<\}$ be the language with an unary function $S$ and a binary relation $<$. Consider the structure $(\mathbb N, S,<)$ ($S$ is the successor function), then $E=\{2n:n\in\mathbb N\}$ is not definable in $(\mathbb N, S,<)$. To see this consider the elementary extension $\...
I appear to have found an answer to my own question, from page 49 of Edward Nelson's book [The Elements](http://kolany.pl/KNMaT/r%C3%B3%C5%BCno%C5%9Bci/PA/dane/2.%20elem.pdf) (which was a failed attempt to prove that Peano arithmetic is inconsistent): "Here is a semantic indication that induction is necessary to prove...
489,035
It is a simple exercise to prove using mathematical induction that if a natural number n > 1 is not divisible by 2, then n can be written as m + m + 1 for some natural number m. (Depending on your definition of odd number, this can either be stated as "every number is even or odd", or as "every odd number is one greate...
2013/09/10
[ "https://math.stackexchange.com/questions/489035", "https://math.stackexchange.com", "https://math.stackexchange.com/users/71829/" ]
Take $M = \{P = a\_nx^n + \ldots + a\_0 \in \Bbb Z[x] / a\_n > 0 \}$, with the usual addition and multiplication on polynomials. Interprete $S(P)$ as $P(X)+1$. Then $M$ is a model of Robinson arithmetic, but there are long strings of "not-even" numbers, such as $X,X+1,X+2,\ldots$. So in this model, it is false that i...
This is just a partial answer. Let $\mathcal L =\{S,<\}$ be the language with an unary function $S$ and a binary relation $<$. Consider the structure $(\mathbb N, S,<)$ ($S$ is the successor function), then $E=\{2n:n\in\mathbb N\}$ is not definable in $(\mathbb N, S,<)$. To see this consider the elementary extension $\...
489,035
It is a simple exercise to prove using mathematical induction that if a natural number n > 1 is not divisible by 2, then n can be written as m + m + 1 for some natural number m. (Depending on your definition of odd number, this can either be stated as "every number is even or odd", or as "every odd number is one greate...
2013/09/10
[ "https://math.stackexchange.com/questions/489035", "https://math.stackexchange.com", "https://math.stackexchange.com/users/71829/" ]
This is just a partial answer. Let $\mathcal L =\{S,<\}$ be the language with an unary function $S$ and a binary relation $<$. Consider the structure $(\mathbb N, S,<)$ ($S$ is the successor function), then $E=\{2n:n\in\mathbb N\}$ is not definable in $(\mathbb N, S,<)$. To see this consider the elementary extension $\...
I know this is a pretty old post, but I want to share some of my own insights. First, I want to highlight a slight error in the answer by mercio. It is a correct model of PA - induction, but Robinson Arithmetic is PA - induction + $\forall n (n = 0 \vee \exists m (n = S(m)))$. Their model does not satisfy this additio...
489,035
It is a simple exercise to prove using mathematical induction that if a natural number n > 1 is not divisible by 2, then n can be written as m + m + 1 for some natural number m. (Depending on your definition of odd number, this can either be stated as "every number is even or odd", or as "every odd number is one greate...
2013/09/10
[ "https://math.stackexchange.com/questions/489035", "https://math.stackexchange.com", "https://math.stackexchange.com/users/71829/" ]
Take $M = \{P = a\_nx^n + \ldots + a\_0 \in \Bbb Z[x] / a\_n > 0 \}$, with the usual addition and multiplication on polynomials. Interprete $S(P)$ as $P(X)+1$. Then $M$ is a model of Robinson arithmetic, but there are long strings of "not-even" numbers, such as $X,X+1,X+2,\ldots$. So in this model, it is false that i...
I appear to have found an answer to my own question, from page 49 of Edward Nelson's book [The Elements](http://kolany.pl/KNMaT/r%C3%B3%C5%BCno%C5%9Bci/PA/dane/2.%20elem.pdf) (which was a failed attempt to prove that Peano arithmetic is inconsistent): "Here is a semantic indication that induction is necessary to prove...
489,035
It is a simple exercise to prove using mathematical induction that if a natural number n > 1 is not divisible by 2, then n can be written as m + m + 1 for some natural number m. (Depending on your definition of odd number, this can either be stated as "every number is even or odd", or as "every odd number is one greate...
2013/09/10
[ "https://math.stackexchange.com/questions/489035", "https://math.stackexchange.com", "https://math.stackexchange.com/users/71829/" ]
Take $M = \{P = a\_nx^n + \ldots + a\_0 \in \Bbb Z[x] / a\_n > 0 \}$, with the usual addition and multiplication on polynomials. Interprete $S(P)$ as $P(X)+1$. Then $M$ is a model of Robinson arithmetic, but there are long strings of "not-even" numbers, such as $X,X+1,X+2,\ldots$. So in this model, it is false that i...
I know this is a pretty old post, but I want to share some of my own insights. First, I want to highlight a slight error in the answer by mercio. It is a correct model of PA - induction, but Robinson Arithmetic is PA - induction + $\forall n (n = 0 \vee \exists m (n = S(m)))$. Their model does not satisfy this additio...
37,770,930
I have a JSON file and need to get the parameter ' fulltext ' , but I'm new to JSON and do not know how to retrieve it in Java . Could someone explain to me how caught this value fulltext ? Here a piece of the file in JSON. ``` { "head": { "vars": [ "author" , "title" , "paper" , "fulltext" ] } , "results":...
2016/06/12
[ "https://Stackoverflow.com/questions/37770930", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6363322/" ]
Json library download from here **jar** dowonload form [here](http://central.maven.org/maven2/org/json/json/20160212/json-20160212.jar) Add this code in **JSonParsing.java** ``` import org.json.*; public class JSonParsing { public static void main(String[] args){ String source = "{\n" + ...
You can use org.json/Jackson to convert this string to JSONObject. If it is a JSONObject called val; then `val.get("results").get("bindings").get(0).get("fulltext")` will give you the full text of first element of bindings.
37,770,930
I have a JSON file and need to get the parameter ' fulltext ' , but I'm new to JSON and do not know how to retrieve it in Java . Could someone explain to me how caught this value fulltext ? Here a piece of the file in JSON. ``` { "head": { "vars": [ "author" , "title" , "paper" , "fulltext" ] } , "results":...
2016/06/12
[ "https://Stackoverflow.com/questions/37770930", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6363322/" ]
Json library download from here **jar** dowonload form [here](http://central.maven.org/maven2/org/json/json/20160212/json-20160212.jar) Add this code in **JSonParsing.java** ``` import org.json.*; public class JSonParsing { public static void main(String[] args){ String source = "{\n" + ...
There are many good JSON parsing libraries for Java. Try out [Org.JSON](https://github.com/stleary/JSON-java) [(Maven)](http://mvnrepository.com/artifact/org.json/json) or [Jackson Library](https://github.com/FasterXML/jackson) ([Maven](http://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind)) or ...
37,770,930
I have a JSON file and need to get the parameter ' fulltext ' , but I'm new to JSON and do not know how to retrieve it in Java . Could someone explain to me how caught this value fulltext ? Here a piece of the file in JSON. ``` { "head": { "vars": [ "author" , "title" , "paper" , "fulltext" ] } , "results":...
2016/06/12
[ "https://Stackoverflow.com/questions/37770930", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6363322/" ]
Json library download from here **jar** dowonload form [here](http://central.maven.org/maven2/org/json/json/20160212/json-20160212.jar) Add this code in **JSonParsing.java** ``` import org.json.*; public class JSonParsing { public static void main(String[] args){ String source = "{\n" + ...
I recommend you using <https://github.com/alibaba/fastjson> , It's easy to use.
19,250
Can the [psychology](http://en.wikipedia.org/wiki/Psychology) of a middle-aged person alter their immune health? I have read about the different types of linkage between nervous system and immune system. Can someone outline the general facts about what is understood about this?
2014/06/22
[ "https://biology.stackexchange.com/questions/19250", "https://biology.stackexchange.com", "https://biology.stackexchange.com/users/8101/" ]
I'm not sure what you mean by psychology exactly, but assuming you are referring to a persons mental state there is a known link between stress and immunity. This link occurs through neuro-endocrine pathways. The central nervous system and endocrine (hormonal) systems are linked through the hypothalamus, a key controll...
**Yes.** It's called Psychoneuroimmunology [Ziemssen & Kern 2007](https://pubmed.ncbi.nlm.nih.gov/17503136/): > > There is evidence for rich neural connections with > lymphoid tissue [Steinman et al.(2004)](https://pubmed.ncbi.nlm.nih.gov/15164017/). Receptors for various neurotrans > mitters beyond acetylcholine and...
25,103
In WC3 TFT when you're doing ladder, you can view a lot of statistics online, e.g: <http://classic.battle.net/war3/ladder/w3xp-player-stats.aspx?Gateway=Azeroth&PlayerName=Jorgie> I've been trying to find the similar information for SC2 but the most I can see is a basic match history and the # of wins, am I missing s...
2011/06/22
[ "https://gaming.stackexchange.com/questions/25103", "https://gaming.stackexchange.com", "https://gaming.stackexchange.com/users/1789/" ]
[SC2 Ranks](http://sc2ranks.com) has a match history, and can also show win percentage by map, but I believe they skim off the Battle.Net API, so it won't be any more than Blizzard provides in the first place. If you want more information about *your own* matches, [SC2 Gears](https://sites.google.com/site/sc2gears/) c...
Check out [sc2drill](http://sc2drill.com) ![graphic](https://i.stack.imgur.com/0zGYn.png) You can filter by matchup/type and team size too.
192,976
I have a similar problem to [this post](https://stackoverflow.com/questions/174535/google-maps-overlays). I need to display up to 1000 polygons on an embedded Google map. The polygons are in a SQL database, and I can render each one as a single KML file on the fly using a custom HttpHandler (in ASP.NET), like this <htt...
2008/10/10
[ "https://Stackoverflow.com/questions/192976", "https://Stackoverflow.com", "https://Stackoverflow.com/users/239663/" ]
For your second question: you need the [Douglas-Peucker Generalization Algorithm](http://everything2.com/index.pl?node_id=859282)
I don't know much aobut KML, but I think the usual solution to question #2 involves iterating over the points, and deleting any line segments under a certain size. This will cause some "unfortunate" effects in some cases, but it's relatively fast and easy to do.
192,976
I have a similar problem to [this post](https://stackoverflow.com/questions/174535/google-maps-overlays). I need to display up to 1000 polygons on an embedded Google map. The polygons are in a SQL database, and I can render each one as a single KML file on the fly using a custom HttpHandler (in ASP.NET), like this <htt...
2008/10/10
[ "https://Stackoverflow.com/questions/192976", "https://Stackoverflow.com", "https://Stackoverflow.com/users/239663/" ]
For your first question, could you calculate the area of a particular polygon, and relate each zoom level to a particular minimum area, so as you zoom in or out polygon's disappear and markers appear depending on the zoom level. For the second question, I'd use Mark Bessey's suggestion.
I don't know much aobut KML, but I think the usual solution to question #2 involves iterating over the points, and deleting any line segments under a certain size. This will cause some "unfortunate" effects in some cases, but it's relatively fast and easy to do.
192,976
I have a similar problem to [this post](https://stackoverflow.com/questions/174535/google-maps-overlays). I need to display up to 1000 polygons on an embedded Google map. The polygons are in a SQL database, and I can render each one as a single KML file on the fly using a custom HttpHandler (in ASP.NET), like this <htt...
2008/10/10
[ "https://Stackoverflow.com/questions/192976", "https://Stackoverflow.com", "https://Stackoverflow.com/users/239663/" ]
For your second question: you need the [Douglas-Peucker Generalization Algorithm](http://everything2.com/index.pl?node_id=859282)
I would recommend 2 things: - Calculate and combine polygons that are touching. This involves a LOT of processing and hard math, but I've done it so I know it's possible. - Create your own overlay instead of using KML in PNG format, while you combine them in the previous suggestion. You'll have to create a LOT of PNGs...
192,976
I have a similar problem to [this post](https://stackoverflow.com/questions/174535/google-maps-overlays). I need to display up to 1000 polygons on an embedded Google map. The polygons are in a SQL database, and I can render each one as a single KML file on the fly using a custom HttpHandler (in ASP.NET), like this <htt...
2008/10/10
[ "https://Stackoverflow.com/questions/192976", "https://Stackoverflow.com", "https://Stackoverflow.com/users/239663/" ]
For your first question, could you calculate the area of a particular polygon, and relate each zoom level to a particular minimum area, so as you zoom in or out polygon's disappear and markers appear depending on the zoom level. For the second question, I'd use Mark Bessey's suggestion.
I would recommend 2 things: - Calculate and combine polygons that are touching. This involves a LOT of processing and hard math, but I've done it so I know it's possible. - Create your own overlay instead of using KML in PNG format, while you combine them in the previous suggestion. You'll have to create a LOT of PNGs...
192,976
I have a similar problem to [this post](https://stackoverflow.com/questions/174535/google-maps-overlays). I need to display up to 1000 polygons on an embedded Google map. The polygons are in a SQL database, and I can render each one as a single KML file on the fly using a custom HttpHandler (in ASP.NET), like this <htt...
2008/10/10
[ "https://Stackoverflow.com/questions/192976", "https://Stackoverflow.com", "https://Stackoverflow.com/users/239663/" ]
For your second question: you need the [Douglas-Peucker Generalization Algorithm](http://everything2.com/index.pl?node_id=859282)
For your first question, could you calculate the area of a particular polygon, and relate each zoom level to a particular minimum area, so as you zoom in or out polygon's disappear and markers appear depending on the zoom level. For the second question, I'd use Mark Bessey's suggestion.
192,976
I have a similar problem to [this post](https://stackoverflow.com/questions/174535/google-maps-overlays). I need to display up to 1000 polygons on an embedded Google map. The polygons are in a SQL database, and I can render each one as a single KML file on the fly using a custom HttpHandler (in ASP.NET), like this <htt...
2008/10/10
[ "https://Stackoverflow.com/questions/192976", "https://Stackoverflow.com", "https://Stackoverflow.com/users/239663/" ]
For your second question: you need the [Douglas-Peucker Generalization Algorithm](http://everything2.com/index.pl?node_id=859282)
I needed a solution to your #2 question a little bit ago and after looking at a few of the available line-simplification algorithms, I created my own. The process is simple and it seems to work well, though it can be a bit slow if you don't implement it correctly: **`P[0..n]`** is your array of points Let **`T[n]`**...
192,976
I have a similar problem to [this post](https://stackoverflow.com/questions/174535/google-maps-overlays). I need to display up to 1000 polygons on an embedded Google map. The polygons are in a SQL database, and I can render each one as a single KML file on the fly using a custom HttpHandler (in ASP.NET), like this <htt...
2008/10/10
[ "https://Stackoverflow.com/questions/192976", "https://Stackoverflow.com", "https://Stackoverflow.com/users/239663/" ]
For your first question, could you calculate the area of a particular polygon, and relate each zoom level to a particular minimum area, so as you zoom in or out polygon's disappear and markers appear depending on the zoom level. For the second question, I'd use Mark Bessey's suggestion.
I needed a solution to your #2 question a little bit ago and after looking at a few of the available line-simplification algorithms, I created my own. The process is simple and it seems to work well, though it can be a bit slow if you don't implement it correctly: **`P[0..n]`** is your array of points Let **`T[n]`**...
19,343,518
I have an edittext for which I want to set below background![enter image description here](https://i.stack.imgur.com/xgiFQ.png) but when I set this as background it stretches itself to fit in whole EditText like below image.![enter image description here](https://i.stack.imgur.com/70GuR.png) and below is my code for ...
2013/10/13
[ "https://Stackoverflow.com/questions/19343518", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1109493/" ]
Ok So issue resolved simply by using nine patch image i have got from actionBarsherlock library which is using it for it's search view.
This line.- ``` android:layout_weight="1" ``` makes your `TextView` fill the empty width in the `LinearLayout`. Just try and remove it. You should also replace ``` android:padding="5dp" ``` for ``` android:layout_margin="5dp" ```
19,343,518
I have an edittext for which I want to set below background![enter image description here](https://i.stack.imgur.com/xgiFQ.png) but when I set this as background it stretches itself to fit in whole EditText like below image.![enter image description here](https://i.stack.imgur.com/70GuR.png) and below is my code for ...
2013/10/13
[ "https://Stackoverflow.com/questions/19343518", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1109493/" ]
Ok So issue resolved simply by using nine patch image i have got from actionBarsherlock library which is using it for it's search view.
``` // try this <LinearLayout android:id="@+id/footer" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:visibility="visible" > <LinearLayout android:layout_width="...
57,433,195
Unable to locate image hyperlink on my profile. Tried using `xpath`, `css locator` but nothing worked. 1. `driver.findElement(By.cssSelector("//img[contains(@src,'https://d3ejdag3om7lbm.cloudfront.net/assets/img/Default User.png')]")).click();` 2. `driver.findElement(By.xpath("//span[@class='user_name']")).click();` ...
2019/08/09
[ "https://Stackoverflow.com/questions/57433195", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11908159/" ]
Converting my comments to answer to help out future visitors to easily find a quick solution. ``` Options +FollowSymlinks -MultiViews RewriteEngine On # redirect to https RewriteCond %{HTTPS} !=on RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] # pass query parameter to a php file internally RewriteRule ^...
I modified your rules, check it: ``` Options +FollowSymlinks RewriteEngine On RewriteRule ^services\/(.*)$ /services#$1 [R=301,L] RewriteCond %{HTTPS} !=on RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^\.]+)$ $1.php [N...
14,496,831
This is the code I am using to get string coming through a SBJson parsing: ``` NSMutableArray *abc=[jsonData valueForKey:@"items"]; NSString *imgStr=(NSString *)[abc valueForKey:@"image"]; NSLog(@"%@",imgStr); ``` here abc is `NSMutableArray` and the exception it is throwing is ``` > -[__NSArrayI stringByReplacin...
2013/01/24
[ "https://Stackoverflow.com/questions/14496831", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1983242/" ]
In the first line you declare `abc` to be an `NSMutableArray` In the second line you attempt to access it as an `NSDictionary`. In your case (and I am guessing here), I expect you have an array of items, and each item is a dictionary with an "image" key. So to get your first item you might use ``` NSDictionary*...
Your code has several problems: 1. For NSArray, `valueForKey:` returns another array. It does *not* return an NSString, regardless of your cast. You need get a reference to the first entry in the array, then call `objectForKey:` on that. 2. You're using the NSKeyValueCoding method `valueForKey:` where you're probably ...
53,755,508
I would like to run multiple Hive queries, preferably in parallel rather than sequentially, and store the output of each query into a csv file. For example, `query1` output in `csv1`, `query2` output in `csv2`, etc. I would be running these queries after leaving work with the goal of having output to analyze during the...
2018/12/13
[ "https://Stackoverflow.com/questions/53755508", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2205916/" ]
You can run and monitor parallel jobs in a shell script: ``` #!/bin/bash #Run parallel processes and wait for their completion #Add loop here or add more calls hive -e "SELECT * FROM db.table1;" | tr "\t" "," > example1.csv & hive -e "SELECT * FROM db.table2;" | tr "\t" "," > example2.csv & hive -e "SELECT * FROM db...
With GNU Parallel it looks like this: ``` doit() { id="$1" hive -e "SELECT * FROM db.table$id;" | tr "\t" "," > example"$id".csv } export -f doit parallel --bar doit ::: 1 2 3 4 ``` If your queries do not share the same template you can do: ``` queries.txt: SELECT * FROM db.table1; SELECT id,name FROM db.person...
231,859
I am working with a library that has a base class Base, and three class descending from it Destination, Amenity and Landmarks. The Base class looks something like this ``` public class Base { public Integer id; public String externalId; public Base() { } public int getId() { return this....
2019/11/05
[ "https://codereview.stackexchange.com/questions/231859", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/212659/" ]
Create a class that extends `Base` that has the `points` field and have your 3 classes extend that class. Your improved method would look like this: (Note: you should give it a better name) ``` private static <T> point[] getpointsArrayFromMapObject(T base){ if(base instanceof MyBase ){ return ((MyBase) ba...
You *cannot* avoid some kind of `instanceof` checks but you can do them once only. This is useful if you intend to check the *same* objects multiple times. It seems like a lot of effort but I've had to deal with co-mingled types a few times over the years so it's a useful pattern to know. ### Example 1 - group by Clas...
231,859
I am working with a library that has a base class Base, and three class descending from it Destination, Amenity and Landmarks. The Base class looks something like this ``` public class Base { public Integer id; public String externalId; public Base() { } public int getId() { return this....
2019/11/05
[ "https://codereview.stackexchange.com/questions/231859", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/212659/" ]
I will assume that you really, really want to use the classes defined in the library and not make your own. Presumably the library classes offer other benefits that were not otherwise relevant to the question. One thought is that you could define an interface that offers a function with the same signature as `getPoint...
You *cannot* avoid some kind of `instanceof` checks but you can do them once only. This is useful if you intend to check the *same* objects multiple times. It seems like a lot of effort but I've had to deal with co-mingled types a few times over the years so it's a useful pattern to know. ### Example 1 - group by Clas...
201,832
Okay so I am part of two Mage the Awakening 2ed campaigns and the two GM's disagree on the rules for prime sight. What they disagree on is if prime sight is able to see if a mage have active spells. The rule stats: "... and the presence (if not the composition) of any awakened spell ...". One of the GMs interpret this...
2022/10/03
[ "https://rpg.stackexchange.com/questions/201832", "https://rpg.stackexchange.com", "https://rpg.stackexchange.com/users/43898/" ]
**Yes, a mage with prime sight active would be able to see that another mage has a spell active on themselves** The rules are on page 91. In my opinion, the part you quoted already answers the question. Someone with active prime sight would would at least be able to see that there was an awakened spell affecting the t...
In my Opinion, it would be yes. I also agree with Timothy who answered, If you expand the quote even more with more additional text, it infers that you can detect upon a subject as well, which applies to more than objects since somebody is also able to be considered a subject. * Highlights anything that can be used as...
41,596,491
If I remove the part `$this->upload->do_upload('filefoto')` my data is saved into the database, but the image file is not saved to the folder path. [enter link description here](http://pastebin.com/hHQgt1ap) Copied from pastebin ``` public function tambahanggota() { $this->load->library('upload'); $nmfil...
2017/01/11
[ "https://Stackoverflow.com/questions/41596491", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6752036/" ]
on a shared server hosting you may need to provide the **complete relative path** to your upload folder. Also make sure you have all permissions to write a file to that directory! you can use on a localhost environment ``` $config['upload_path'] = './assets/upload'; ``` but on a shared hosting, you'll need to ge...
you missed this ``` $this->upload->upload_path.'/'.$this->upload->file_name; ```
9,219,010
I have a child layer that I'm adding to the scene which contains a menu, it is initialized like so: ``` - (id) init { if((self=[super init])) { CGSize winSize = [[CCDirector sharedDirector] winSize]; CCMenuItemImage* attackButton = [CCMenuItemImage itemFromNormalImage:@"btn...
2012/02/09
[ "https://Stackoverflow.com/questions/9219010", "https://Stackoverflow.com", "https://Stackoverflow.com/users/744306/" ]
I would follow the native API of your tablet. Your tablet's vendor has very well described SDK including several [`examples`](http://www.wacomeng.com/windows/index.html) (in Visual C++). What you are specifically looking for is [`the eraser detection`](http://www.wacomeng.com/windows/docs/Wintab_v140.htm#_Toc275759917...
Dealing with WinTab is easy enough if all you want is to detect device type. However it can get a lot more confusing if you want to process absolute positions, pen orientation and pressure. There's a good C++ lib for dealing with this: <http://www.billbaxter.com/projects/bbtablet/index.html> Even if you don't want to...
8,034,657
I have a moveable and closable jquery pop-up notification box. It works well aside from the fact that it pops up every time the page is loaded. What method would I need to implement to allow a user to permanently (or at least semi permanently) close the pop-up box? If I need to use cookies how would I tie a cookie to ...
2011/11/07
[ "https://Stackoverflow.com/questions/8034657", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1709066/" ]
yes you can use cookies. when user click on the close button you can write it to the cookies. and when page load, if cookie is not available display the popup
session would be another candidate and its secure than cookies. And you don't have to do anything else than setting a variable on loading popup on first time and check afterwards if that variable is set or not.
8,034,657
I have a moveable and closable jquery pop-up notification box. It works well aside from the fact that it pops up every time the page is loaded. What method would I need to implement to allow a user to permanently (or at least semi permanently) close the pop-up box? If I need to use cookies how would I tie a cookie to ...
2011/11/07
[ "https://Stackoverflow.com/questions/8034657", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1709066/" ]
yes you can use cookies. when user click on the close button you can write it to the cookies. and when page load, if cookie is not available display the popup
Yes you can use cookies to do the trick, basically you're checking to see if the variable in the cookie is set, if not update the variable: <http://www.w3schools.com/js/js_cookies.asp> Don't forget that on close, you should update the cookie variable.
8,034,657
I have a moveable and closable jquery pop-up notification box. It works well aside from the fact that it pops up every time the page is loaded. What method would I need to implement to allow a user to permanently (or at least semi permanently) close the pop-up box? If I need to use cookies how would I tie a cookie to ...
2011/11/07
[ "https://Stackoverflow.com/questions/8034657", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1709066/" ]
yes you can use cookies. when user click on the close button you can write it to the cookies. and when page load, if cookie is not available display the popup
You could simply use client side cookies: <http://www.w3schools.com/js/js_cookies.asp> If the user doesn't have a cookie present, display box; If the user has the cookie present and cookie specifies the user has already closed the box, keep it closed; etc.. It's simple, and doesn't put any extra weight on the server,...
8,034,657
I have a moveable and closable jquery pop-up notification box. It works well aside from the fact that it pops up every time the page is loaded. What method would I need to implement to allow a user to permanently (or at least semi permanently) close the pop-up box? If I need to use cookies how would I tie a cookie to ...
2011/11/07
[ "https://Stackoverflow.com/questions/8034657", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1709066/" ]
You could simply use client side cookies: <http://www.w3schools.com/js/js_cookies.asp> If the user doesn't have a cookie present, display box; If the user has the cookie present and cookie specifies the user has already closed the box, keep it closed; etc.. It's simple, and doesn't put any extra weight on the server,...
session would be another candidate and its secure than cookies. And you don't have to do anything else than setting a variable on loading popup on first time and check afterwards if that variable is set or not.
8,034,657
I have a moveable and closable jquery pop-up notification box. It works well aside from the fact that it pops up every time the page is loaded. What method would I need to implement to allow a user to permanently (or at least semi permanently) close the pop-up box? If I need to use cookies how would I tie a cookie to ...
2011/11/07
[ "https://Stackoverflow.com/questions/8034657", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1709066/" ]
You could simply use client side cookies: <http://www.w3schools.com/js/js_cookies.asp> If the user doesn't have a cookie present, display box; If the user has the cookie present and cookie specifies the user has already closed the box, keep it closed; etc.. It's simple, and doesn't put any extra weight on the server,...
Yes you can use cookies to do the trick, basically you're checking to see if the variable in the cookie is set, if not update the variable: <http://www.w3schools.com/js/js_cookies.asp> Don't forget that on close, you should update the cookie variable.