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
43,901,638
*I only just started learning XML and Java code this week, thanks to Udacity's course... I'm barely halfway through but I felt like making my own pointless app..* So I have some black text on a red background. When I click the text, I tell Java to change the text to white and background to blue, and it does. When I ...
2017/05/10
[ "https://Stackoverflow.com/questions/43901638", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7956460/" ]
Add the planet objects to an array, and then you can write: ``` Planet[] planets = {planet1, planet2, planet3, planet4, planet5}; for (int i = 0; i < star.returnZones(); i++) { this.createPlanet(planets[i], star); } ```
There is another solution similar to the first part of the answer of @njzk2: It is `switch/case` with *fall through*: ``` int zones = star.returnZones(); switch (zones ) { case 5: createPlanet(planet5, star); case 4: createPlanet(planet4, star); case 3: createPlanet(planet3, star); case 2: createPl...
43,901,638
*I only just started learning XML and Java code this week, thanks to Udacity's course... I'm barely halfway through but I felt like making my own pointless app..* So I have some black text on a red background. When I click the text, I tell Java to change the text to white and background to blue, and it does. When I ...
2017/05/10
[ "https://Stackoverflow.com/questions/43901638", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7956460/" ]
One way to do it, is a `switch` statement with fall-through behavior: ``` switch (star.returnZones()) { case 5: this.createPlanet(planet5, star); // fall-through case 4: this.createPlanet(planet4, star); // fall-through case 3: this.createPlanet(planet3, star); // fall-through case 2: this.createPlanet...
Just a slight variation on the arrays answer: ``` List<Planet> planets = Arrays.asList(planet1, planet2, planet3 /*etc*/); for (Planet p : planets.subList(0, start.returnZones()) { createPlanet(p, star); } ```
43,901,638
*I only just started learning XML and Java code this week, thanks to Udacity's course... I'm barely halfway through but I felt like making my own pointless app..* So I have some black text on a red background. When I click the text, I tell Java to change the text to white and background to blue, and it does. When I ...
2017/05/10
[ "https://Stackoverflow.com/questions/43901638", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7956460/" ]
Start by removing the duplicates: ``` int zones = star.returnZones(); if (zones >= 1) { createPlanet(planet1, star); } if (zones >= 2) { createPlanet(planet2, star); } ... ``` You can see that in the example where `zones == 2`, it does execute the 2 blocks, so you keep the same functionality. Then, you can ...
One way to do it, is a `switch` statement with fall-through behavior: ``` switch (star.returnZones()) { case 5: this.createPlanet(planet5, star); // fall-through case 4: this.createPlanet(planet4, star); // fall-through case 3: this.createPlanet(planet3, star); // fall-through case 2: this.createPlanet...
43,901,638
*I only just started learning XML and Java code this week, thanks to Udacity's course... I'm barely halfway through but I felt like making my own pointless app..* So I have some black text on a red background. When I click the text, I tell Java to change the text to white and background to blue, and it does. When I ...
2017/05/10
[ "https://Stackoverflow.com/questions/43901638", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7956460/" ]
One way to do it, is a `switch` statement with fall-through behavior: ``` switch (star.returnZones()) { case 5: this.createPlanet(planet5, star); // fall-through case 4: this.createPlanet(planet4, star); // fall-through case 3: this.createPlanet(planet3, star); // fall-through case 2: this.createPlanet...
The problem statement sometimes itself guides for the solution. In your case you need to repeat *similar* task. For each task there is a different `planet` but again it follows an order. Such problem can be solved easily by *looping*. A simple solution can be putting the objects `planet1`, `planet2`,...`planet3` in a...
43,901,638
*I only just started learning XML and Java code this week, thanks to Udacity's course... I'm barely halfway through but I felt like making my own pointless app..* So I have some black text on a red background. When I click the text, I tell Java to change the text to white and background to blue, and it does. When I ...
2017/05/10
[ "https://Stackoverflow.com/questions/43901638", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7956460/" ]
One way to do it, is a `switch` statement with fall-through behavior: ``` switch (star.returnZones()) { case 5: this.createPlanet(planet5, star); // fall-through case 4: this.createPlanet(planet4, star); // fall-through case 3: this.createPlanet(planet3, star); // fall-through case 2: this.createPlanet...
The other answers are correct that repetitive work like this can be handled neatly with a loop. With **Java 8** there is an another, arguably even neater, option - using the Stream API to declare the repetitive work in a functional style. You can get the entire thing done in a one-liner. ``` Arrays.asList(planet1, p...
43,901,638
*I only just started learning XML and Java code this week, thanks to Udacity's course... I'm barely halfway through but I felt like making my own pointless app..* So I have some black text on a red background. When I click the text, I tell Java to change the text to white and background to blue, and it does. When I ...
2017/05/10
[ "https://Stackoverflow.com/questions/43901638", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7956460/" ]
Add the planet objects to an array, and then you can write: ``` Planet[] planets = {planet1, planet2, planet3, planet4, planet5}; for (int i = 0; i < star.returnZones(); i++) { this.createPlanet(planets[i], star); } ```
The problem statement sometimes itself guides for the solution. In your case you need to repeat *similar* task. For each task there is a different `planet` but again it follows an order. Such problem can be solved easily by *looping*. A simple solution can be putting the objects `planet1`, `planet2`,...`planet3` in a...
8,515,778
I have following problem. I have created a tab based Application with three Views and Viewcontroller. FirstView(Start screen stuff), SecondView (Detailpage), ThirdView (Table for listing items). (Connections from storyboard were set automatically). In the third view a table is integrated and the content is display...
2011/12/15
[ "https://Stackoverflow.com/questions/8515778", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1092253/" ]
You might want to think about your design. If I am understanding your description correctly, the user will be on the third tab, tap on a row in a table, and then you will be switching them back to the second tab. A navigation controller might be a more natural, less confusing, choice there. But in any case, something...
I think problem is at self.navigationController. If your view is not inside the navigation controller this will not work. So what you do is create a new navigation controller object there and then use it to show your detail view.
257,021
Is there a theorem which guarentees the existance of an elliptic curve with given number of points over $\mathbf{F}\_p$ for a given $p$. Thanks
2016/12/12
[ "https://mathoverflow.net/questions/257021", "https://mathoverflow.net", "https://mathoverflow.net/users/97542/" ]
Deuring proved that for every $a, |a| < 2\sqrt{p}$, there exists an elliptic curve with $p+1-a$ points over $\mathbb{F}\_p$. M Deuring, Die Typen der Multiplikatorenringe elliptischer Funktionenkörper, Abh. Math. Sem. Univ. Hamburg 14 (1941), 197-272.
Perhaps you are looking for Honda-Tate theory, see <http://projecteuclid.org/download/pdf_1/euclid.jmsj/1260463295> Honda, Taira (1968), "Isogeny classes of abelian varieties over finite fields", Journal of the Mathematical Society of Japan, 20: 83–95. (The eigenvalues of the Frobenius determine the number of $\mathbf{...
4,128,421
For some physical applications I need the knowledge of irreducible characters for symmetric groups $S\_n$ with large $n$. For small ones I was using `FiniteGroupData` in Mathematica, but this is limited to $n=10$. For larger $n$ I am using GAP: `Display(CharacterTable(SymmetricGroup(n)));` (cf. [Mathematica-stackexchan...
2021/05/05
[ "https://math.stackexchange.com/questions/4128421", "https://math.stackexchange.com", "https://math.stackexchange.com/users/191666/" ]
Of course it is highly unlikely that the tables really differ, but the issue is most likely an arrangement of classes and characters. `CharacterTable(SymmetricGroup(n))` will take $S\_n$ as a group and calculate the character table with generic methods (that might be somewhat adapted. There is no guarantee about the a...
Are the two results really different? A character table is only determined up to ordering of the rows and columns. Did you check if the two results are the same up to such permutations ?
31,057,382
My program generates doc file on browser and i want to save this file to my C drive dynamically ``` string filename = "fileName"; Response.Clear(); Response.Buffer = true; Response.AddHeader("content-disposition", "attachment;filename= " + filename +".doc" ); Response.Charset = ""; Response.ContentType = "applicati...
2015/06/25
[ "https://Stackoverflow.com/questions/31057382", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5044891/" ]
You cannot decide for the user where to save the file. User decides that.
You can save a given location on the server, but you can't tell a client where to save a file in the HTTP response. Beyond the security problems inherent in that approach, you have to take into account that there are a diverse array of clients with different file structures. Even Windows clients do not necessarily have...
15,241,415
I have a column C filled with empty cells or cells that contain value "OK". I need that every cell which contains text "OK" will be change to incremented value 1,2,3 etc. total 2642 cells ``` C - 1 [empty] - 2 [empty] - 3 [OK] - 4 [empty] - 5 [OK] - 6 [empty] ``` Need to look like: C ``` - 1 [empty] - 2 [empty...
2013/03/06
[ "https://Stackoverflow.com/questions/15241415", "https://Stackoverflow.com", "https://Stackoverflow.com/users/787456/" ]
Your code is close but the problem you are having is that your cell value is checking `OK` thinking it is a variable. To avoid this the first thing you want to do is put `Option Explicit` at the top of each module to tell you when you haven't declared variables. Now all you need to do is make 'OK' a string like `"OK"...
You can do this without a macro: 1. Change to R1C1 reference style (*File* tab->*Options*->*Calculation*->*R1C1 reference style* 2. Select the full column 3. Replace dialog (`Ctrl`-`H`) 4. Replace all `OK` with `=MAX(R1C1:R[-1]C)+1` 5. If you wish, copy and paste special the values 6. Uncheck R1C1 reference style Alt...
467,666
Example of a file ``` line 1 line 2 line 3 line 4 ``` `line 4` should be after `line 1` ``` line 1 line 4 line 2 line 3 ``` Important: It could be more than 4 lines somehow the script has to understand that it has to read the last line, **not** line 4.
2018/09/08
[ "https://unix.stackexchange.com/questions/467666", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/303480/" ]
First, there is an issue with your `.htaccess` file: * In lines 6-8; you require that the user is authenticated, but only if it's not an `OPTIONS` request. This is fine. * In line 4 however, you require that the user is authenticated as user `usernam`, regardles of the request method (GET, POST, OPTIONS, etc...) So i...
The error `401 Unauthorized` means that the HTTP server expects credentials, usually a user name and password. Accoring to the question, you removed the `.htacccess` file that requested authentication, so there must be still something in the active configuration that requests authentication. To provide the credentials...
10,981,186
I have the following jquery code: ``` $(document).ready(function() { $('button').click(function() { $.getJSON('http://world.needforspeed.com/SpeedAPI/ws/game/nfsw/server/status?output=json', function(json) { alert("Entered getJSON"); $("#output").append("working...");...
2012/06/11
[ "https://Stackoverflow.com/questions/10981186", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1439875/" ]
Did you check the console? You might be suffering from a access-control-origin error [jQuery.getJSON - Access-Control-Allow-Origin Issue](https://stackoverflow.com/questions/6396623/jquery-getjson-access-control-allow-origin-issue)
You can not fetch JSON from another domain unless they support [CORS](https://developer.mozilla.org/en/http_access_control) because of the [same origin policy](https://developer.mozilla.org/En/Same_origin_policy_for_JavaScript). Does the api support [jsonp](http://api.jquery.com/jQuery.getJSON/#jsonp)?
10,981,186
I have the following jquery code: ``` $(document).ready(function() { $('button').click(function() { $.getJSON('http://world.needforspeed.com/SpeedAPI/ws/game/nfsw/server/status?output=json', function(json) { alert("Entered getJSON"); $("#output").append("working...");...
2012/06/11
[ "https://Stackoverflow.com/questions/10981186", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1439875/" ]
Did you check the console? You might be suffering from a access-control-origin error [jQuery.getJSON - Access-Control-Allow-Origin Issue](https://stackoverflow.com/questions/6396623/jquery-getjson-access-control-allow-origin-issue)
I don't think you will be able to do this. For cross domain ajax requests the api provider have to use jsonp. What you can do is create a php file for the request. Lets call the file request.php ``` <?php /* gets the data from a URL */ function get_data($url) { $ch = curl_init(); $timeout = 5; curl_setopt($c...
10,981,186
I have the following jquery code: ``` $(document).ready(function() { $('button').click(function() { $.getJSON('http://world.needforspeed.com/SpeedAPI/ws/game/nfsw/server/status?output=json', function(json) { alert("Entered getJSON"); $("#output").append("working...");...
2012/06/11
[ "https://Stackoverflow.com/questions/10981186", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1439875/" ]
You can not fetch JSON from another domain unless they support [CORS](https://developer.mozilla.org/en/http_access_control) because of the [same origin policy](https://developer.mozilla.org/En/Same_origin_policy_for_JavaScript). Does the api support [jsonp](http://api.jquery.com/jQuery.getJSON/#jsonp)?
I don't think you will be able to do this. For cross domain ajax requests the api provider have to use jsonp. What you can do is create a php file for the request. Lets call the file request.php ``` <?php /* gets the data from a URL */ function get_data($url) { $ch = curl_init(); $timeout = 5; curl_setopt($c...
29,756,279
The situation : I have a list of view which contains an EditText. I want the user to be able to modify the text and only send his new text to the viewmodel when he press on the done button on the keyboard. My edit text is binded has follow ``` <EditText android:id="@+id/textNumero" android:layout_width="0dp" ...
2015/04/20
[ "https://Stackoverflow.com/questions/29756279", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1188639/" ]
Assuming @Jinesh Sutar is correct in the above comment, to change your multiple variables into a single categorical variable you can use the following syntax. `varx` and `newvar` would obviously need renamed for your dataset. ``` IF (var1=1) newvar=1. IF (var2=1) newvar=2. IF (var3=1) newvar=3. IF (var4=1) newvar=4. I...
Nikhil, if I am correct, the data you must be having is in **checked/ unchecked** form. You need to convert it into **Item numbers per column**. This can be done using vectors in SPSS: ``` vector multin = var1 to var11. loop #i=1 to 11. if (multin(#i)=1) multin(#i)=#i. end loop. exe. ``` Using this, there is no need...
25,198,973
I have a service that uploads data to our database via XML feeds provided by customers. Often these XML files are claimed to be UTF-8 encoded, but they clearly have quite a few invalid byte sequences. I can clean up these files and import them perfectly into our database by simply running the following Linux command be...
2014/08/08
[ "https://Stackoverflow.com/questions/25198973", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3727308/" ]
Ruby 2.1 has a new method called [String.scrub](https://ruby-doc.org/core-2.1.0/String.html#method-i-scrub) which is exactly what you need. > > If the string is invalid byte sequence then replace invalid bytes with > given replacement character, else returns self. If block is given, > replace invalid bytes with ret...
Try using a combination of force\_encoding("ISO-8859-1") and encode("utf-8"): ``` data_string.force_encoding("ISO-8859-1").encode("utf-8", replace: nil) ``` This helped me once.
25,198,973
I have a service that uploads data to our database via XML feeds provided by customers. Often these XML files are claimed to be UTF-8 encoded, but they clearly have quite a few invalid byte sequences. I can clean up these files and import them perfectly into our database by simply running the following Linux command be...
2014/08/08
[ "https://Stackoverflow.com/questions/25198973", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3727308/" ]
Ruby 2.1 has a new method called [String.scrub](https://ruby-doc.org/core-2.1.0/String.html#method-i-scrub) which is exactly what you need. > > If the string is invalid byte sequence then replace invalid bytes with > given replacement character, else returns self. If block is given, > replace invalid bytes with ret...
Thanks for the responses. I did find something that works by testing all sorts of combinations of different tools. I hope this is helpful to other people who have shared the same frustration. ``` data_string.encode!("UTF-8", "UTF-8", invalid: :replace, undef: :replace, replace: "" ) data_string.gsub!(/[[:cntrl:]&&[^\n...
25,198,973
I have a service that uploads data to our database via XML feeds provided by customers. Often these XML files are claimed to be UTF-8 encoded, but they clearly have quite a few invalid byte sequences. I can clean up these files and import them perfectly into our database by simply running the following Linux command be...
2014/08/08
[ "https://Stackoverflow.com/questions/25198973", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3727308/" ]
Ruby 2.1 has a new method called [String.scrub](https://ruby-doc.org/core-2.1.0/String.html#method-i-scrub) which is exactly what you need. > > If the string is invalid byte sequence then replace invalid bytes with > given replacement character, else returns self. If block is given, > replace invalid bytes with ret...
I found this on Stack Overflow for some other question and this too worked fine for me. Assuming data\_string is your XML: ``` data_string.encode!('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '') ```
25,198,973
I have a service that uploads data to our database via XML feeds provided by customers. Often these XML files are claimed to be UTF-8 encoded, but they clearly have quite a few invalid byte sequences. I can clean up these files and import them perfectly into our database by simply running the following Linux command be...
2014/08/08
[ "https://Stackoverflow.com/questions/25198973", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3727308/" ]
I found this on Stack Overflow for some other question and this too worked fine for me. Assuming data\_string is your XML: ``` data_string.encode!('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '') ```
Try using a combination of force\_encoding("ISO-8859-1") and encode("utf-8"): ``` data_string.force_encoding("ISO-8859-1").encode("utf-8", replace: nil) ``` This helped me once.
25,198,973
I have a service that uploads data to our database via XML feeds provided by customers. Often these XML files are claimed to be UTF-8 encoded, but they clearly have quite a few invalid byte sequences. I can clean up these files and import them perfectly into our database by simply running the following Linux command be...
2014/08/08
[ "https://Stackoverflow.com/questions/25198973", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3727308/" ]
I found this on Stack Overflow for some other question and this too worked fine for me. Assuming data\_string is your XML: ``` data_string.encode!('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '') ```
Thanks for the responses. I did find something that works by testing all sorts of combinations of different tools. I hope this is helpful to other people who have shared the same frustration. ``` data_string.encode!("UTF-8", "UTF-8", invalid: :replace, undef: :replace, replace: "" ) data_string.gsub!(/[[:cntrl:]&&[^\n...
64,105,631
I am currently in the process of writing a thesis at university. Both the university and my assigned supervisor require the thesis to: * be in MS Word document format, ie. `doc` or `docx` * contain some formal boilerplate at the beginning, the templates for which are only available in said format - a title page, a for...
2020/09/28
[ "https://Stackoverflow.com/questions/64105631", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2096451/" ]
Sounds like you'd like [pandoc](https://pandoc.org/MANUAL.html): > > Pandoc is a Haskell library for converting from one markup format to > another, and a command-line tool that uses this library. > > > Pandoc can convert between numerous markup and word processing > formats, including, but not limited to, various ...
There is a wonderful DOCX generator from a programmers perspective, which IMHO would be more suitable than Pandoc as suggested by @kjhughes, take a look at <https://docx.js.org/> and the examples at github repository at <https://github.com/dolanmiu/docx/tree/master/demo> it has an amazing set of examples for styles, se...
136,166
I'm 49 years old, currently have a VA 30yr @ 3.75% mortgage with 26years left. (We moved across the country for a new job in 2017). Remaining balance 254K, No PMI, have approximately 100K in equity. Looking at VA IRRRL refinancing, best mortgage broker I've found so far has both 15 and 30 year mortgages at 2.25% with ...
2021/02/06
[ "https://money.stackexchange.com/questions/136166", "https://money.stackexchange.com", "https://money.stackexchange.com/users/106538/" ]
Stop worrying about the sunburn (reducing 3.75% to 2.25%) when **your hair in on fire** ($30K debt at 10%). Facts: you've got $10K in cash, and can afford a $1927 monthly mortgage. > > @RonJohn still thinking about this...added another option, what are your thoughts? > > > My thoughts: 1. **Immediately** throw ...
> > But it seems like I should be able to find a better use for that $700/mo. > > > Yes. That is the heart of the matter. Specifically, can you find something to do with the money that gets a better rate of return than 2.25%? If you put it into the house, you are guaranteeing yourself a 2.25% return. That is fairl...
136,166
I'm 49 years old, currently have a VA 30yr @ 3.75% mortgage with 26years left. (We moved across the country for a new job in 2017). Remaining balance 254K, No PMI, have approximately 100K in equity. Looking at VA IRRRL refinancing, best mortgage broker I've found so far has both 15 and 30 year mortgages at 2.25% with ...
2021/02/06
[ "https://money.stackexchange.com/questions/136166", "https://money.stackexchange.com", "https://money.stackexchange.com/users/106538/" ]
> > But it seems like I should be able to find a better use for that $700/mo. > > > Yes. That is the heart of the matter. Specifically, can you find something to do with the money that gets a better rate of return than 2.25%? If you put it into the house, you are guaranteeing yourself a 2.25% return. That is fairl...
[Oversimplify it for me: the correct order of investing](https://money.stackexchange.com/questions/47856/oversimplify-it-for-me-the-correct-order-of-investing) really goes a long way to answering your question. But of course, you offer details that are important to address. The 15 has its place. The risk averse invest...
136,166
I'm 49 years old, currently have a VA 30yr @ 3.75% mortgage with 26years left. (We moved across the country for a new job in 2017). Remaining balance 254K, No PMI, have approximately 100K in equity. Looking at VA IRRRL refinancing, best mortgage broker I've found so far has both 15 and 30 year mortgages at 2.25% with ...
2021/02/06
[ "https://money.stackexchange.com/questions/136166", "https://money.stackexchange.com", "https://money.stackexchange.com/users/106538/" ]
Stop worrying about the sunburn (reducing 3.75% to 2.25%) when **your hair in on fire** ($30K debt at 10%). Facts: you've got $10K in cash, and can afford a $1927 monthly mortgage. > > @RonJohn still thinking about this...added another option, what are your thoughts? > > > My thoughts: 1. **Immediately** throw ...
[Oversimplify it for me: the correct order of investing](https://money.stackexchange.com/questions/47856/oversimplify-it-for-me-the-correct-order-of-investing) really goes a long way to answering your question. But of course, you offer details that are important to address. The 15 has its place. The risk averse invest...
35,260,982
I'm using YouTube's V3 Data API to add a subscription to a channel. This occurs on a Wordpress installation. I added Google APIs (for oauth) on Wordpress theme functions: ``` wp_enqueue_script( 'googleapi', 'https://apis.google.com/js/client.js?onload=googleApiClientReady', array(), '1.0.0', true ); ``` I added in ...
2016/02/08
[ "https://Stackoverflow.com/questions/35260982", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5312050/" ]
This is work solution [jsfiddle](http://jsfiddle.net/Stepan_Kasyanenko/c2v9t7n2/1/) ```js function TestController($scope) { $scope.list = [{ value: 'value 1' }, { value: 'value 2' }, { value: 'value 3' }]; var orgiinalList = []; angular.forEach($scope.list, function(item) { orgii...
You can't use global functions as controllers in newer versions of angular but you can register your controllers in your application: ``` <div ng-app ng-controller="TestController"> <div ng-repeat="item in list"> <label>Input {{$index+1}}:</label> <input ng-model="item.value" type="text" ng-click="...
35,260,982
I'm using YouTube's V3 Data API to add a subscription to a channel. This occurs on a Wordpress installation. I added Google APIs (for oauth) on Wordpress theme functions: ``` wp_enqueue_script( 'googleapi', 'https://apis.google.com/js/client.js?onload=googleApiClientReady', array(), '1.0.0', true ); ``` I added in ...
2016/02/08
[ "https://Stackoverflow.com/questions/35260982", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5312050/" ]
This is work solution [jsfiddle](http://jsfiddle.net/Stepan_Kasyanenko/c2v9t7n2/1/) ```js function TestController($scope) { $scope.list = [{ value: 'value 1' }, { value: 'value 2' }, { value: 'value 3' }]; var orgiinalList = []; angular.forEach($scope.list, function(item) { orgii...
Changing your reset function so that it looks like this: ``` $scope.reset = function(index) { $scope.list[index].value = "value "+ (index+1); }; ``` will make it so that your 'reset' buttons restore what would be those original values... Angular controller: ``` function TestController($scope) { $scope.sele...
12,767,892
I am working on a code and need some help. There is a line which needs to be read from a file. The first word must be ignored and the remaining characters (white spaces included) have to be stored into variable. How do I do it?
2012/10/07
[ "https://Stackoverflow.com/questions/12767892", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1690383/" ]
This will work if your word has no spaces in front of it and you use white space (' ') as separating character. ``` #include <stdio.h> #include <string.h> int main() { char buffer[80]; char storage[80]; fgets(buffer, 80, stdin); // enter: »hello nice world!\n« char *rest = strchr(buffer, ' '); // rest...
Some examples. Read the comments in the program to understand the effect. This will assume that words are delimited by whitespace characters (as defined by `isspace()`). Depending on your definition of "word", the solution may differ. ``` #include <stdio.h> int main() { char rest[1000]; // Remove first word a...
1,408,529
I found a [website](http://www.javacamp.org/javavscsharp/) comparing Java with C#][1](http://www.javacamp.org/javavscsharp/) in very details. Does anybody know any website comparing c++ with Java or c++ with C# in the similar way?
2009/09/11
[ "https://Stackoverflow.com/questions/1408529", "https://Stackoverflow.com", "https://Stackoverflow.com/users/319274/" ]
<http://en.wikipedia.org/wiki/Comparison_of_Java_and_C%2B%2B> <http://en.wikipedia.org/wiki/Comparison_of_Java_and_C_Sharp>
<http://en.wikipedia.org/wiki/Comparison_of_Java_and_C++> I think that this is a pretty good comparison.
1,408,529
I found a [website](http://www.javacamp.org/javavscsharp/) comparing Java with C#][1](http://www.javacamp.org/javavscsharp/) in very details. Does anybody know any website comparing c++ with Java or c++ with C# in the similar way?
2009/09/11
[ "https://Stackoverflow.com/questions/1408529", "https://Stackoverflow.com", "https://Stackoverflow.com/users/319274/" ]
There are two big features/advantages that Java/C# have over C++: 1. `Built-in garbage collection/managed memory.` You don't have to worry about cleaning up your objects. Garbage collection is coming/available for C++ as well, but it's considerably less convenient to use. Java/C# make it like the air you breath. It ha...
<http://en.wikipedia.org/wiki/Comparison_of_Java_and_C++> I think that this is a pretty good comparison.
1,408,529
I found a [website](http://www.javacamp.org/javavscsharp/) comparing Java with C#][1](http://www.javacamp.org/javavscsharp/) in very details. Does anybody know any website comparing c++ with Java or c++ with C# in the similar way?
2009/09/11
[ "https://Stackoverflow.com/questions/1408529", "https://Stackoverflow.com", "https://Stackoverflow.com/users/319274/" ]
<http://en.wikipedia.org/wiki/Comparison_of_Java_and_C++> I think that this is a pretty good comparison.
This is a well done comparison of C++/Java/C#/Objective-C in a tabular mode: <http://hyperpolyglot.org/cpp>
1,408,529
I found a [website](http://www.javacamp.org/javavscsharp/) comparing Java with C#][1](http://www.javacamp.org/javavscsharp/) in very details. Does anybody know any website comparing c++ with Java or c++ with C# in the similar way?
2009/09/11
[ "https://Stackoverflow.com/questions/1408529", "https://Stackoverflow.com", "https://Stackoverflow.com/users/319274/" ]
<http://en.wikipedia.org/wiki/Comparison_of_Java_and_C%2B%2B> <http://en.wikipedia.org/wiki/Comparison_of_Java_and_C_Sharp>
This is a well done comparison of C++/Java/C#/Objective-C in a tabular mode: <http://hyperpolyglot.org/cpp>
1,408,529
I found a [website](http://www.javacamp.org/javavscsharp/) comparing Java with C#][1](http://www.javacamp.org/javavscsharp/) in very details. Does anybody know any website comparing c++ with Java or c++ with C# in the similar way?
2009/09/11
[ "https://Stackoverflow.com/questions/1408529", "https://Stackoverflow.com", "https://Stackoverflow.com/users/319274/" ]
There are two big features/advantages that Java/C# have over C++: 1. `Built-in garbage collection/managed memory.` You don't have to worry about cleaning up your objects. Garbage collection is coming/available for C++ as well, but it's considerably less convenient to use. Java/C# make it like the air you breath. It ha...
This is a well done comparison of C++/Java/C#/Objective-C in a tabular mode: <http://hyperpolyglot.org/cpp>
30,719,257
Okay so I'm trying to create a simple todo list, web api. I have the basic functions implemented and working properly but I'm trying to use a query to search by task\_name as declared in my code, but no matter what I can't seem to get it functioning. app.js ``` var express = require('express') , routes = require('...
2015/06/08
[ "https://Stackoverflow.com/questions/30719257", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4987996/" ]
If jQuery is fine, here's something you can try: ``` $(function(){ if($(window).width()>640){ //add video only if screen width is above 640px $("body").append(yourVideoHere); } }); ```
Depends how you are trying to load the video, I would recommend the HTML5 video element with the preload attribute set to none so the video does not automatically begin to download. You could also then look at using a script that allows you to swap out video files depending on screen resolution, so for mobile you could...
30,719,257
Okay so I'm trying to create a simple todo list, web api. I have the basic functions implemented and working properly but I'm trying to use a query to search by task\_name as declared in my code, but no matter what I can't seem to get it functioning. app.js ``` var express = require('express') , routes = require('...
2015/06/08
[ "https://Stackoverflow.com/questions/30719257", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4987996/" ]
If jQuery is fine, here's something you can try: ``` $(function(){ if($(window).width()>640){ //add video only if screen width is above 640px $("body").append(yourVideoHere); } }); ```
**How to do it based on screen size** see the other answers, measure screen size with javascript and only add the video tag, or set the source, if the screen size is big enough. There's a gotcha if you use jquery as the `<video>` functions like `.play()` are javascript functions and won't be available to a jquery obj...
30,719,257
Okay so I'm trying to create a simple todo list, web api. I have the basic functions implemented and working properly but I'm trying to use a query to search by task\_name as declared in my code, but no matter what I can't seem to get it functioning. app.js ``` var express = require('express') , routes = require('...
2015/06/08
[ "https://Stackoverflow.com/questions/30719257", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4987996/" ]
You need to first check to see if the screen is the appropriate width and then load your video source. Something like this should get you started. ``` var videoElem = document.querySelector('video'); var yourThreshold = 600; if (screen.availWidth >= yourThreshold) { videoElem.append('<source src="yourVideo.mp4" type...
Depends how you are trying to load the video, I would recommend the HTML5 video element with the preload attribute set to none so the video does not automatically begin to download. You could also then look at using a script that allows you to swap out video files depending on screen resolution, so for mobile you could...
30,719,257
Okay so I'm trying to create a simple todo list, web api. I have the basic functions implemented and working properly but I'm trying to use a query to search by task\_name as declared in my code, but no matter what I can't seem to get it functioning. app.js ``` var express = require('express') , routes = require('...
2015/06/08
[ "https://Stackoverflow.com/questions/30719257", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4987996/" ]
You need to first check to see if the screen is the appropriate width and then load your video source. Something like this should get you started. ``` var videoElem = document.querySelector('video'); var yourThreshold = 600; if (screen.availWidth >= yourThreshold) { videoElem.append('<source src="yourVideo.mp4" type...
**How to do it based on screen size** see the other answers, measure screen size with javascript and only add the video tag, or set the source, if the screen size is big enough. There's a gotcha if you use jquery as the `<video>` functions like `.play()` are javascript functions and won't be available to a jquery obj...
15,669,062
I want to make a code wich reads from the keyboard a character and that character i want to add it to a string variable Example ``` char c = sc.next().charAt(0); String l = ""; ``` [my character from keyboard beeing now in "c" and "l" beeing empty] How can i make "l" to add to it's value the character from "c" I ...
2013/03/27
[ "https://Stackoverflow.com/questions/15669062", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2217376/" ]
You should use a `DatePicker` to allow the user to choose the when. Time in Android is stored on a `long` (not an `int`). And the `long` time can easily be converted back and forth between `long` (always milli-seconds) and a `Date` object. The `Date` object gives you all sorts of tools to compare before and after, lo...
EDIT : Check David's Answer its better. First Filter the date selected with today's date. You can compare it by date.isbefore(date) or date.isafter(date) these booleans will let you tell know if a date is of past or future or present. then to further calculate the days inbetween you can make a method with switch state...
11,114,149
What are all the knowledge management features of Facebook's HiPal data analytics tool, and how does it work? Is it purely architectured for hadoop environment or can be used with other DBs?
2012/06/20
[ "https://Stackoverflow.com/questions/11114149", "https://Stackoverflow.com", "https://Stackoverflow.com/users/939317/" ]
Though this is just speculation as HiPal has not been released to the public. HiPal is a UI for a SQL-like program called HIVE. Hive is a program that allows you to run SQL-like queries on files in a Hadoop File System. Hadoop is a distributed map/reduce architecture used for large(many terabytes) data sets. But as ...
Facebook uses Hive (<http://borthakur.com/ftp/hadoopworld.pdf>) to process data. Hive is a SQL-like framework interface that runs on top of Hadoop, created by the Facebook team themselves, and latter on donated to the apache community. They say they analyse 20 PB of data with Hive/Hadoop. Here is a quick start guide...
3,502,992
I'd like to know if there is a way to get the elapsed time since the phone was unplugged from AC supply. I know that I can register a receiver to catch battery events - but this just works if my service is running already when the status changes. In my case I assume that the application is started when the AC supply w...
2010/08/17
[ "https://Stackoverflow.com/questions/3502992", "https://Stackoverflow.com", "https://Stackoverflow.com/users/415347/" ]
JuicePlotter does this somehow (<http://latedroid.com/juiceplotter>), it graphs battery events from before the app was started, or even installed. I don't know how it works, but it would be a good place to do some research.
looks like there's no way to figure out
64,796,977
I used Google-managed SSL certificate on GKE for set up SSL for my website. This is working example.com (that is insecure) and working also https://example.com(that is secure). when i access my website example.com why it's not redirect to <https://example.com> ? I used below yaml file to set up ssl. ```js apiVersion: ...
2020/11/12
[ "https://Stackoverflow.com/questions/64796977", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11880241/" ]
There is now a supported way of doing this in GKE with Frontend Config: <https://cloud.google.com/kubernetes-engine/docs/how-to/ingress-features#https_redirect> You will need GKE version at least `1.18.10-gke.600`. EDIT: As per comment by @mltsy, it also works in `1.17.17`. How we have it set up is: ```yaml apiVers...
GKE ingress doesn't support HTTP to HTTPS redirect at this time. You can take a look at this [Stack post](https://stackoverflow.com/questions/64159880/kubernetes-ingress-redirects-http-to-https). However, you can create a redirection rule for your Ingress resource using setting up an HTTP-to-HTTPS redirect for external...
31,108,123
Given a Parquet dataset distributed on HDFS (metadata file + may `.parquet` parts), how to correctly merge parts and collect the data onto local file system? `dfs -getmerge ...` doesn't work - it merges metadata with actual parquet files..
2015/06/29
[ "https://Stackoverflow.com/questions/31108123", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2028058/" ]
There is a way involving Apache Spark APIs - which provides a solution, but more efficient method without third-party tools may exist. ``` spark> val parquetData = sqlContext.parquetFile("pathToMultipartParquetHDFS") spark> parquet.repartition(1).saveAsParquetFile("pathToSinglePartParquetHDFS") bash> ../bin/ha...
you may use pig ``` A = LOAD '/path/to parquet/files' USING parquet.pig.ParquetLoader as (x,y,z) ; STORE A INTO 'xyz path' USING PigStorage('|'); ``` You may create Impala table on to it, & then use ``` impala-shell -e "query" -o <output> ``` same way you may use Mapreduce as well
31,108,123
Given a Parquet dataset distributed on HDFS (metadata file + may `.parquet` parts), how to correctly merge parts and collect the data onto local file system? `dfs -getmerge ...` doesn't work - it merges metadata with actual parquet files..
2015/06/29
[ "https://Stackoverflow.com/questions/31108123", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2028058/" ]
There is a way involving Apache Spark APIs - which provides a solution, but more efficient method without third-party tools may exist. ``` spark> val parquetData = sqlContext.parquetFile("pathToMultipartParquetHDFS") spark> parquet.repartition(1).saveAsParquetFile("pathToSinglePartParquetHDFS") bash> ../bin/ha...
You may use parquet tools `java -jar parquet-tools.jar merge source/ target/`
31,108,123
Given a Parquet dataset distributed on HDFS (metadata file + may `.parquet` parts), how to correctly merge parts and collect the data onto local file system? `dfs -getmerge ...` doesn't work - it merges metadata with actual parquet files..
2015/06/29
[ "https://Stackoverflow.com/questions/31108123", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2028058/" ]
you may use pig ``` A = LOAD '/path/to parquet/files' USING parquet.pig.ParquetLoader as (x,y,z) ; STORE A INTO 'xyz path' USING PigStorage('|'); ``` You may create Impala table on to it, & then use ``` impala-shell -e "query" -o <output> ``` same way you may use Mapreduce as well
You may use parquet tools `java -jar parquet-tools.jar merge source/ target/`
661,152
I have a situation which I think I need the functionality provided by an interface and an abstract class. I am creating models to be used in a simulation. Each model is contained in a C# class that implements an IModel interface (of my design so it can be modified). I also created a c++ unmanaged Win32 DLL that acts a...
2009/03/19
[ "https://Stackoverflow.com/questions/661152", "https://Stackoverflow.com", "https://Stackoverflow.com/users/56564/" ]
``` public abstract class Base{} public interface IBase{} public Something: Base, IBase{} // the interface needs to go after the base class ```
I would try having your abstract class implement the Interface (and have the method as abstract). Then each implementation just subclasses the abstract class. I think that should work. ``` public interface IModel { void doSomething(); } public abstract class AbstractModel : IModel { public abstract void doSomethi...
20,184,232
I'm trying to find an efficient algorithm to generate a simple connected graph with given the number of nodes. Something like: ``` Input: N - size of generated graph Output: simple connected graph G(v,e) with N vertices and S edges, The number of edges should be uniform distribution. ```
2013/11/25
[ "https://Stackoverflow.com/questions/20184232", "https://Stackoverflow.com", "https://Stackoverflow.com/users/389898/" ]
You might want to create a minimal spanning tree first to ensure connectivity. Later, randomly generate two nodes (which are not yet connected) and connect them. Repeat until you have S edges. For minimal spanning tree, the easiest thing to do is start with a random node as tree. For every remaining node (ordered rand...
A very common random graph generation algorithm (used in many academic works) is based on RMat method, or a generalization in the form of Kronecker graphs. It's a simple, iterative process, that uses very few parameters and is easily scalable. There's a really good explanation here (including why it's better than othe...
20,184,232
I'm trying to find an efficient algorithm to generate a simple connected graph with given the number of nodes. Something like: ``` Input: N - size of generated graph Output: simple connected graph G(v,e) with N vertices and S edges, The number of edges should be uniform distribution. ```
2013/11/25
[ "https://Stackoverflow.com/questions/20184232", "https://Stackoverflow.com", "https://Stackoverflow.com/users/389898/" ]
It may be a bit surprising but if you choose (randomly) `log(n)` edges (where `n` - maximum number of edges) then you can be *almost* sure that your graph is connected ([a reference](http://economics.mit.edu/files/4622)). If number of edges is much lower than `log(n)` you can be almost sure that the graph is disconnect...
A very common random graph generation algorithm (used in many academic works) is based on RMat method, or a generalization in the form of Kronecker graphs. It's a simple, iterative process, that uses very few parameters and is easily scalable. There's a really good explanation here (including why it's better than othe...
373,164
I've been trying to calculate $$\int\_0^\infty\frac{1}{x^a(1-x)}\,dx\quad\text{with }0<a<1.$$I haven't had much luck. I tried taking the branch cut with of the positive reals and estimating that way, but I wasn't sure how to handle the poles at $z=0$ and $z=1$ when dealing with branch cuts. I also looked at the Wikiped...
2013/04/26
[ "https://math.stackexchange.com/questions/373164", "https://math.stackexchange.com", "https://math.stackexchange.com/users/54360/" ]
You use an almost-keyhole contour, except that you indent both paths above and below the real axis with a small semicircle to avoid the pole at $z=1$: ![enter image description here](https://i.stack.imgur.com/OWT9D.jpg) In doing this, you end up with not $4$, but $8$ contour segments. I will avoid writing them all ou...
$\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,} \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace} \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack} \newcommand{\dd}{\mathrm{d}} \newcommand{\ds}[1]{\displaystyle{#1}} \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,} \new...
44,182,966
I currently have a dataframe which has the following schema; ``` Year: integer (nullable = true) Month: integer (nullable = true) Day: integer (nullable = true) Hour: integer (nullable = true) Minute: integer (nullable = true) Second: integer (nullable = true) ``` I want to basically add an additional column to my d...
2017/05/25
[ "https://Stackoverflow.com/questions/44182966", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7465902/" ]
**Convert to date** ------------------- First, let's create some sample dataset. ``` df_pd = pd.DataFrame([[16, 3, 15], [2016, 4, 3]], columns=['Year', 'Month', 'Day']) df = spark.createDataFrame(df_pd) ``` Then you can write `udf` function to work around your question. ...
You can use datetime module to create your format. The following code worked for me, ``` from datetime import datetime def getdate(*args): dt_str = '-'.join(map(str,args[:3])) + ' ' + ':'.join(map(str,args[3:])) yr_len = len(str(args[0])) if yr_len == 2: yr = 'y' else: yr = 'Y' form...
6,213,030
``` #include <stdio.h> class InnerOne { int m_iDummy; public: InnerOne(int iDummy) { m_iDummy=iDummy; } InnerOne& operator=(InnerOne &obj) { printf("In InnerOne Operator=\n"); m_iDummy = obj.m_iDummy; return *this; } }; class OuterOne { ...
2011/06/02
[ "https://Stackoverflow.com/questions/6213030", "https://Stackoverflow.com", "https://Stackoverflow.com/users/148869/" ]
Yes. The compiler generated copy-assignment for `OuterOne` will invoke the `operator=` for `InnerOne`. As a sidenote, its better if you write `InnerOne` copy-assignment as: ``` InnerOne& operator=(const InnerOne &obj) //^^^^ add this! ``` `const` is necessary, or else your code wouldn't work for t...
Yes. The automatically generated assignment operator for `OuterOne` will call the assignment operator of `InnerOne`.
5,187,402
I'm wondering if there is a service that to get a set of lat,long points that when connected into a polygon show the outline of a country Ideally I would like to search by country, and get back an array of lat,long coordinates. Is there such a service?
2011/03/03
[ "https://Stackoverflow.com/questions/5187402", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7473/" ]
IF you are happy to consider not using a webservice, this data is available at varying resolutions from [Natural Earth](http://www.naturalearthdata.com/downloads/). The data is in the [public domain](http://creativecommons.org/publicdomain/).
[Yahoo! GeoPlanet](http://developer.yahoo.com/geo/geoplanet/), the service Stack Overflow are using [for their careers site](https://meta.stackexchange.com/questions/46433/france-is-not-within-30-miles-of-london) seems to do bounding boxes. Here is a [blog post with detailed query examples](http://developer.yahoo.com/...
5,187,402
I'm wondering if there is a service that to get a set of lat,long points that when connected into a polygon show the outline of a country Ideally I would like to search by country, and get back an array of lat,long coordinates. Is there such a service?
2011/03/03
[ "https://Stackoverflow.com/questions/5187402", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7473/" ]
have a closer look here; [http://en.wikipedia.org/wiki/User:The\_Anome/country\_bounding\_boxes](http://en.wikipedia.org/wiki/User%3aThe_Anome/country_bounding_boxes) > > User:The Anome/country bounding boxes A first hack, based on all > places in the NGA GNS dataset, not (yet) properly handling latitude > wrap-r...
[Yahoo! GeoPlanet](http://developer.yahoo.com/geo/geoplanet/), the service Stack Overflow are using [for their careers site](https://meta.stackexchange.com/questions/46433/france-is-not-within-30-miles-of-london) seems to do bounding boxes. Here is a [blog post with detailed query examples](http://developer.yahoo.com/...
5,187,402
I'm wondering if there is a service that to get a set of lat,long points that when connected into a polygon show the outline of a country Ideally I would like to search by country, and get back an array of lat,long coordinates. Is there such a service?
2011/03/03
[ "https://Stackoverflow.com/questions/5187402", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7473/" ]
[Yahoo! GeoPlanet](http://developer.yahoo.com/geo/geoplanet/), the service Stack Overflow are using [for their careers site](https://meta.stackexchange.com/questions/46433/france-is-not-within-30-miles-of-london) seems to do bounding boxes. Here is a [blog post with detailed query examples](http://developer.yahoo.com/...
This repo contains a set of square bounding boxes. Example below: ``` { "AF": ["Afghanistan", [60.5284298033, 29.318572496, 75.1580277851, 38.4862816432]], "AO": ["Angola", [11.6400960629, -17.9306364885, 24.0799052263, -4.43802336998]], "AL": ["Albania", [19.3044861183, 39.624997667, 21.0200403175, 42.688247382...
5,187,402
I'm wondering if there is a service that to get a set of lat,long points that when connected into a polygon show the outline of a country Ideally I would like to search by country, and get back an array of lat,long coordinates. Is there such a service?
2011/03/03
[ "https://Stackoverflow.com/questions/5187402", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7473/" ]
IF you are happy to consider not using a webservice, this data is available at varying resolutions from [Natural Earth](http://www.naturalearthdata.com/downloads/). The data is in the [public domain](http://creativecommons.org/publicdomain/).
have a closer look here; [http://en.wikipedia.org/wiki/User:The\_Anome/country\_bounding\_boxes](http://en.wikipedia.org/wiki/User%3aThe_Anome/country_bounding_boxes) > > User:The Anome/country bounding boxes A first hack, based on all > places in the NGA GNS dataset, not (yet) properly handling latitude > wrap-r...
5,187,402
I'm wondering if there is a service that to get a set of lat,long points that when connected into a polygon show the outline of a country Ideally I would like to search by country, and get back an array of lat,long coordinates. Is there such a service?
2011/03/03
[ "https://Stackoverflow.com/questions/5187402", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7473/" ]
IF you are happy to consider not using a webservice, this data is available at varying resolutions from [Natural Earth](http://www.naturalearthdata.com/downloads/). The data is in the [public domain](http://creativecommons.org/publicdomain/).
This repo contains a set of square bounding boxes. Example below: ``` { "AF": ["Afghanistan", [60.5284298033, 29.318572496, 75.1580277851, 38.4862816432]], "AO": ["Angola", [11.6400960629, -17.9306364885, 24.0799052263, -4.43802336998]], "AL": ["Albania", [19.3044861183, 39.624997667, 21.0200403175, 42.688247382...
5,187,402
I'm wondering if there is a service that to get a set of lat,long points that when connected into a polygon show the outline of a country Ideally I would like to search by country, and get back an array of lat,long coordinates. Is there such a service?
2011/03/03
[ "https://Stackoverflow.com/questions/5187402", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7473/" ]
have a closer look here; [http://en.wikipedia.org/wiki/User:The\_Anome/country\_bounding\_boxes](http://en.wikipedia.org/wiki/User%3aThe_Anome/country_bounding_boxes) > > User:The Anome/country bounding boxes A first hack, based on all > places in the NGA GNS dataset, not (yet) properly handling latitude > wrap-r...
This repo contains a set of square bounding boxes. Example below: ``` { "AF": ["Afghanistan", [60.5284298033, 29.318572496, 75.1580277851, 38.4862816432]], "AO": ["Angola", [11.6400960629, -17.9306364885, 24.0799052263, -4.43802336998]], "AL": ["Albania", [19.3044861183, 39.624997667, 21.0200403175, 42.688247382...
108,942
Have you read The Chronicles of Amber by Roger Zelazny? Imagine yourself playing in 3rd person MMO game. You spawn in the world and start to wander around. After some time, when you think, that you've learned the map, you realize, that you are in a place, that you have never seen before. You go back to the last place ...
2015/09/28
[ "https://gamedev.stackexchange.com/questions/108942", "https://gamedev.stackexchange.com", "https://gamedev.stackexchange.com/users/72720/" ]
Use a slice of higher-order noise. If you used 2d noise for a height-map before, use 3D noise with the last coordinate fixed instead. Now you can slowly change the position in the last dimension to modify the terrain. Since Perlin noise is continuous in all dimensions, you'll get smooth transitions as long as you smoot...
Your idea to split the world into several chunks is not bad. It is just incomplete. The only problem is junctions between chunks. For instance, if you use perlin noise to generate relief, and a seed different for each chunk, and risk this to happen: [![Chunk relief bug](https://i.stack.imgur.com/Vou23.jpg)](https://i...
108,942
Have you read The Chronicles of Amber by Roger Zelazny? Imagine yourself playing in 3rd person MMO game. You spawn in the world and start to wander around. After some time, when you think, that you've learned the map, you realize, that you are in a place, that you have never seen before. You go back to the last place ...
2015/09/28
[ "https://gamedev.stackexchange.com/questions/108942", "https://gamedev.stackexchange.com", "https://gamedev.stackexchange.com/users/72720/" ]
Your idea to split the world into several chunks is not bad. It is just incomplete. The only problem is junctions between chunks. For instance, if you use perlin noise to generate relief, and a seed different for each chunk, and risk this to happen: [![Chunk relief bug](https://i.stack.imgur.com/Vou23.jpg)](https://i...
While danijar's idea is pretty solid, you could end up storing a lot of data, if you wanted to have the local area the same and the distance shift. And requesting more and more slices of more and more complex noise. You can get all of these in a more standard 2d fashion. I developed [an algorithm](http://godsnotwhereg...
108,942
Have you read The Chronicles of Amber by Roger Zelazny? Imagine yourself playing in 3rd person MMO game. You spawn in the world and start to wander around. After some time, when you think, that you've learned the map, you realize, that you are in a place, that you have never seen before. You go back to the last place ...
2015/09/28
[ "https://gamedev.stackexchange.com/questions/108942", "https://gamedev.stackexchange.com", "https://gamedev.stackexchange.com/users/72720/" ]
Use a slice of higher-order noise. If you used 2d noise for a height-map before, use 3D noise with the last coordinate fixed instead. Now you can slowly change the position in the last dimension to modify the terrain. Since Perlin noise is continuous in all dimensions, you'll get smooth transitions as long as you smoot...
While danijar's idea is pretty solid, you could end up storing a lot of data, if you wanted to have the local area the same and the distance shift. And requesting more and more slices of more and more complex noise. You can get all of these in a more standard 2d fashion. I developed [an algorithm](http://godsnotwhereg...
45,430,803
I am trying to make one form which give functionality like when user enter name and email,then PDF file starts download automatically. And while i am applying this code in additional setting tab on submit button,it replay the error message like this. I am currently working in local machine, i know error is in contact...
2017/08/01
[ "https://Stackoverflow.com/questions/45430803", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8289170/" ]
I Found solution for your need,just follow below stops,it can not send mail,but works fine in local machine as per your requirement. 1) Just paste below code in your Additional Setting tab in contact form 7 ``` demo_mode : on on_sent_ok: "location = 'http://localhost/wordpress/wp-content/uploads/2017/08/pdf-sample.p...
the following code is working for me: I made it with javascript ``` function force_download( file ) { pdf = window.open(file, '', 'left=100,screenX=100'); pdf.document.execCommand('SaveAs', 'null', 'myfile.pdf'); pdf.close(); } on_sent_ok: "force_download('pdf_url_here');" ```
45,430,803
I am trying to make one form which give functionality like when user enter name and email,then PDF file starts download automatically. And while i am applying this code in additional setting tab on submit button,it replay the error message like this. I am currently working in local machine, i know error is in contact...
2017/08/01
[ "https://Stackoverflow.com/questions/45430803", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8289170/" ]
If someone is looking for an up-to-date answer since `in_sent_ok` is being deprecated, instead we can use: ```html <script> document.addEventListener( 'wpcf7mailsent', function( event ) { location = 'http://example.com/'; }, false ); </script> ```
the following code is working for me: I made it with javascript ``` function force_download( file ) { pdf = window.open(file, '', 'left=100,screenX=100'); pdf.document.execCommand('SaveAs', 'null', 'myfile.pdf'); pdf.close(); } on_sent_ok: "force_download('pdf_url_here');" ```
45,430,803
I am trying to make one form which give functionality like when user enter name and email,then PDF file starts download automatically. And while i am applying this code in additional setting tab on submit button,it replay the error message like this. I am currently working in local machine, i know error is in contact...
2017/08/01
[ "https://Stackoverflow.com/questions/45430803", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8289170/" ]
I Found solution for your need,just follow below stops,it can not send mail,but works fine in local machine as per your requirement. 1) Just paste below code in your Additional Setting tab in contact form 7 ``` demo_mode : on on_sent_ok: "location = 'http://localhost/wordpress/wp-content/uploads/2017/08/pdf-sample.p...
If someone is looking for an up-to-date answer since `in_sent_ok` is being deprecated, instead we can use: ```html <script> document.addEventListener( 'wpcf7mailsent', function( event ) { location = 'http://example.com/'; }, false ); </script> ```
26,927,512
This question was inspired by [that one](https://stackoverflow.com/questions/478898/how-to-execute-a-command-and-get-output-of-command-within-c). I've understood how to execute utils from C or C++ code. But how can we get result from some command, that doesn't just printing the result, but enters some interactive mode...
2014/11/14
[ "https://Stackoverflow.com/questions/26927512", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2718535/" ]
So just select the third `td` in the second `tr` like that: ```css .MainTable tr:nth-child(2) td:nth-child(3) { background-color:red; } ``` And you miss a in your html: ``` <table class="MainTable"> <tr> <td>xxxx</td> <td>yyy</td> </tr> <tr> <th>AAAAA</th> <td>yyy</t...
As others have mentioned, you have serious problems with your table structure. A table has to contain one or more `<tbody>` children and a `<tr>` can't contain other `<tr>`s (unless contained in an inner table). If I get you correctly, you want to select the second td in every row, i.e you want to disregard the `<th>`...
2,252,914
Is there a way to generate all getters and setters in an entire package in eclipse? Thanks.
2010/02/12
[ "https://Stackoverflow.com/questions/2252914", "https://Stackoverflow.com", "https://Stackoverflow.com/users/249571/" ]
Assuming you're using Java, you may want to take a look at [Project Lombok](http://projectlombok.org/).
Generating getters and setters on everything in an entire package seems like a very bad idea. Not everything should be accessible or modifiable. Good OO design includes knowing when to encapsulate by keeping some things private. That said, you might already know this. If you're looking to do this for some academic exe...
51,464,647
I know several posts have similar issues, but none of the ones I have looked at have the specific issue I'm experiencing. The problem is, I have a HTML5 video which won't autoplay, even though it is muted. Specifically, it doesn't work in Chrome. It works completely fine in Safari and Firefox. The code snippet looks ...
2018/07/22
[ "https://Stackoverflow.com/questions/51464647", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6167979/" ]
Using Angular 6. I wanted a muted autoplay. None of the previous worked for me, this one did: ``` oncanplay="this.play()" ``` Hope it helps somebody.
I don't know if it helps but sometimes muted attribute won't completely mute the video. What I often experienced was it's volume 1 instead of 0 still, and 100% volume doesn't mean it's muted. So when I set volume to 0 it worked. <https://www.w3schools.com/tags/av_prop_volume.asp>
51,464,647
I know several posts have similar issues, but none of the ones I have looked at have the specific issue I'm experiencing. The problem is, I have a HTML5 video which won't autoplay, even though it is muted. Specifically, it doesn't work in Chrome. It works completely fine in Safari and Firefox. The code snippet looks ...
2018/07/22
[ "https://Stackoverflow.com/questions/51464647", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6167979/" ]
**Solution to Angular 2+ of cases in which automatic reproduction is needed silent and does not work.** 1. Autoplay is prevented, until the user performs an action on the screen. *Chrome's autoplay policies will change in April of 2018.* [<https://developers.google.com/web/updates/2017/09/autoplay-policy-changes]> 2. ...
Here is my working example: ``` <video [muted]="'muted'" autoplay="autoplay" loop="loop" playsinline id="video-start"> <!-- Dynamic Content --> <source *ngIf="backgroundVideo?.Link?.Url" [src]="backgroundVideo.Link.Url" type="video/mp4"> <!-- Default Content, displaying when dynamic content has a problem ...
51,464,647
I know several posts have similar issues, but none of the ones I have looked at have the specific issue I'm experiencing. The problem is, I have a HTML5 video which won't autoplay, even though it is muted. Specifically, it doesn't work in Chrome. It works completely fine in Safari and Firefox. The code snippet looks ...
2018/07/22
[ "https://Stackoverflow.com/questions/51464647", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6167979/" ]
**Solution to Angular 2+ of cases in which automatic reproduction is needed silent and does not work.** 1. Autoplay is prevented, until the user performs an action on the screen. *Chrome's autoplay policies will change in April of 2018.* [<https://developers.google.com/web/updates/2017/09/autoplay-policy-changes]> 2. ...
I needed to use both `onloadedmetadata` and `oncanplay` to fix in angular 6 ``` <video loop muted autoplay oncanplay="this.play()" onloadedmetadata="this.muted = true"> <source src="video.mp4" type="video/mp4"> </video> ```
51,464,647
I know several posts have similar issues, but none of the ones I have looked at have the specific issue I'm experiencing. The problem is, I have a HTML5 video which won't autoplay, even though it is muted. Specifically, it doesn't work in Chrome. It works completely fine in Safari and Firefox. The code snippet looks ...
2018/07/22
[ "https://Stackoverflow.com/questions/51464647", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6167979/" ]
Instead of using the HTML attribute `autoplay` & `muted`. You need to use the Angular attributes `[autoplay]="true"` & `[muted]="true"`
I have the same problem with angular 6 and Chrome 70, the [new autoplay policy](https://developers.google.com/web/updates/2017/09/autoplay-policy-changes) was changing by google in the last months, I solve the problem adding a new method in to the ngAfterViewInit() ``` <!-- home.component.html --> <div class="fullscre...
51,464,647
I know several posts have similar issues, but none of the ones I have looked at have the specific issue I'm experiencing. The problem is, I have a HTML5 video which won't autoplay, even though it is muted. Specifically, it doesn't work in Chrome. It works completely fine in Safari and Firefox. The code snippet looks ...
2018/07/22
[ "https://Stackoverflow.com/questions/51464647", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6167979/" ]
Thanks to bigless' linking [this SO post](https://stackoverflow.com/questions/48856562/chrome-android-video-autoplay-inside-angular-2-component?rq=1) I solved the problem. MY implementation of the solution from the link looks like this: **HTML** ``` <div class="video-chrome-fix" [innerHTML]="videoTag"></div> ``` *...
you have to use `autoplay` attribute in `<video>` tag. ``` <video autoplay></video> ```
51,464,647
I know several posts have similar issues, but none of the ones I have looked at have the specific issue I'm experiencing. The problem is, I have a HTML5 video which won't autoplay, even though it is muted. Specifically, it doesn't work in Chrome. It works completely fine in Safari and Firefox. The code snippet looks ...
2018/07/22
[ "https://Stackoverflow.com/questions/51464647", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6167979/" ]
I needed to use both `onloadedmetadata` and `oncanplay` to fix in angular 6 ``` <video loop muted autoplay oncanplay="this.play()" onloadedmetadata="this.muted = true"> <source src="video.mp4" type="video/mp4"> </video> ```
I have the same problem with angular 6 and Chrome 70, the [new autoplay policy](https://developers.google.com/web/updates/2017/09/autoplay-policy-changes) was changing by google in the last months, I solve the problem adding a new method in to the ngAfterViewInit() ``` <!-- home.component.html --> <div class="fullscre...
51,464,647
I know several posts have similar issues, but none of the ones I have looked at have the specific issue I'm experiencing. The problem is, I have a HTML5 video which won't autoplay, even though it is muted. Specifically, it doesn't work in Chrome. It works completely fine in Safari and Firefox. The code snippet looks ...
2018/07/22
[ "https://Stackoverflow.com/questions/51464647", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6167979/" ]
you have to use `autoplay` attribute in `<video>` tag. ``` <video autoplay></video> ```
I have the same problem with angular 6 and Chrome 70, the [new autoplay policy](https://developers.google.com/web/updates/2017/09/autoplay-policy-changes) was changing by google in the last months, I solve the problem adding a new method in to the ngAfterViewInit() ``` <!-- home.component.html --> <div class="fullscre...
51,464,647
I know several posts have similar issues, but none of the ones I have looked at have the specific issue I'm experiencing. The problem is, I have a HTML5 video which won't autoplay, even though it is muted. Specifically, it doesn't work in Chrome. It works completely fine in Safari and Firefox. The code snippet looks ...
2018/07/22
[ "https://Stackoverflow.com/questions/51464647", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6167979/" ]
Thanks to bigless' linking [this SO post](https://stackoverflow.com/questions/48856562/chrome-android-video-autoplay-inside-angular-2-component?rq=1) I solved the problem. MY implementation of the solution from the link looks like this: **HTML** ``` <div class="video-chrome-fix" [innerHTML]="videoTag"></div> ``` *...
this is what worked for me in chrome 67 (and firefox 61). ``` <video width="320" height="240" muted controls autoplay> <source src="http://techslides.com/demos/sample-videos/small.mp4" type="video/mp4"> Your browser does not support the video tag. </video> ``` live example: [jsfiddle](https://jsfiddle.net/gababa...
51,464,647
I know several posts have similar issues, but none of the ones I have looked at have the specific issue I'm experiencing. The problem is, I have a HTML5 video which won't autoplay, even though it is muted. Specifically, it doesn't work in Chrome. It works completely fine in Safari and Firefox. The code snippet looks ...
2018/07/22
[ "https://Stackoverflow.com/questions/51464647", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6167979/" ]
this is what worked for me in chrome 67 (and firefox 61). ``` <video width="320" height="240" muted controls autoplay> <source src="http://techslides.com/demos/sample-videos/small.mp4" type="video/mp4"> Your browser does not support the video tag. </video> ``` live example: [jsfiddle](https://jsfiddle.net/gababa...
I don't know if it helps but sometimes muted attribute won't completely mute the video. What I often experienced was it's volume 1 instead of 0 still, and 100% volume doesn't mean it's muted. So when I set volume to 0 it worked. <https://www.w3schools.com/tags/av_prop_volume.asp>
51,464,647
I know several posts have similar issues, but none of the ones I have looked at have the specific issue I'm experiencing. The problem is, I have a HTML5 video which won't autoplay, even though it is muted. Specifically, it doesn't work in Chrome. It works completely fine in Safari and Firefox. The code snippet looks ...
2018/07/22
[ "https://Stackoverflow.com/questions/51464647", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6167979/" ]
you have to use `autoplay` attribute in `<video>` tag. ``` <video autoplay></video> ```
I don't know if it helps but sometimes muted attribute won't completely mute the video. What I often experienced was it's volume 1 instead of 0 still, and 100% volume doesn't mean it's muted. So when I set volume to 0 it worked. <https://www.w3schools.com/tags/av_prop_volume.asp>
39,818,624
I currently am using PHP and was reading the PHP manual but still have a problem with $this. Is $this something global or is it is just another variable name to build objects on? Here is an example: ``` public function using_a_function($variable1, $variable2, $variable3) { $params = array( 'associative...
2016/10/02
[ "https://Stackoverflow.com/questions/39818624", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6905698/" ]
It is refered to as the Object scope, lets use an example class. ``` Class Example { private $property; public function A($foo) { $this->property = $foo; // we are telling the method to look at the object scope not the method scope } public function B() { return self:...
`$this` is only used in object oriented programming (OOP) and refers to the current object. ``` class SomeObject{ public function returnThis(){ return $this; } } $object = new SomeObject(); var_dump($object === $object->returnThis()); // true ``` This is used inside the object to reach member variab...
4,649,850
I'm attempting to access the [Closure Compiler](http://closure-compiler.appspot.com/home) tool [programmatically](http://code.google.com/closure/compiler/docs/api-tutorial1.html), but having issues both with PHP and JavaScript. Here is a quick and dirty PHP script I whipped up just to play around with the compilers' RE...
2011/01/10
[ "https://Stackoverflow.com/questions/4649850", "https://Stackoverflow.com", "https://Stackoverflow.com/users/77047/" ]
According to API docs ``` The request must always have a Content-type header of application/x-www-form-urlencoded ``` Didn't see that in your code Add ``` curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/x-www-form-urlencoded' )); ``` before `curl_exec()`
Ajax (*via jQuery or otherwise*) will not work because of same-origin policy. (*ajax requests are restricted in same domain, unless jsonp is expected as result*) Simply using your example to post the info, it works as seen in <http://www.jsfiddle.net/RySLr/> So it must be what @German Rumm mentions..
27,904,086
I have a table with a column 'Name', like the following: ``` Name Michael Jackson Chester Bennington Mike Shinoda ``` I want to split the 'Name' values in FirstName and LastName,blike this: ``` LastName FirstName Jackson Michael Bennington Chester Shinoda Mike ``` And also I n...
2015/01/12
[ "https://Stackoverflow.com/questions/27904086", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2863468/" ]
Try this ``` UPDATE data SET FirstName = SUBSTRING_INDEX(Name, ' ', 1), LastName = SUBSTRING(SUBSTRING_INDEX(Name, ' ', 2), LENGTH(SUBSTRING_INDEX(Name, ' ', 1)) + 1) ``` **EDIT** As David Faber stated, one can use `SUBSTRING_INDEX(Name, ' ', -1)` for updating the `LastName` column.
This is your table. You use it how you want. Try this ``` select * from ( select SUBSTRING ( name ,(select CHARINDEX(' ',name, 0) from table1)+1 , (select LEN(name) from table1)-(select CHARINDEX(' ',name, 0) from table1)-1) as lastname, SUBSTRING ( name ,0 , (select LEN(name) from table1)-(select CHARINDEX(' ',name, ...
27,904,086
I have a table with a column 'Name', like the following: ``` Name Michael Jackson Chester Bennington Mike Shinoda ``` I want to split the 'Name' values in FirstName and LastName,blike this: ``` LastName FirstName Jackson Michael Bennington Chester Shinoda Mike ``` And also I n...
2015/01/12
[ "https://Stackoverflow.com/questions/27904086", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2863468/" ]
Try this ``` UPDATE data SET FirstName = SUBSTRING_INDEX(Name, ' ', 1), LastName = SUBSTRING(SUBSTRING_INDEX(Name, ' ', 2), LENGTH(SUBSTRING_INDEX(Name, ' ', 1)) + 1) ``` **EDIT** As David Faber stated, one can use `SUBSTRING_INDEX(Name, ' ', -1)` for updating the `LastName` column.
You might try this: ``` ALTER TABLE `data` ADD `FirstName` VARCHAR(30) , ADD `LastName` VARCHAR(30); UPDATE `data` SET `FirstName` = SUBSTR( `Name`, 1, INSTR(`Name`, ' ') - 1 ) , `LastName` = SUBSTR( `Name`, INSTR(`Name`, ' ') + 1, LENGTH(`Name`) - INSTR(`Name`, ' ') ) WHERE `Name` LIKE '% %...
27,904,086
I have a table with a column 'Name', like the following: ``` Name Michael Jackson Chester Bennington Mike Shinoda ``` I want to split the 'Name' values in FirstName and LastName,blike this: ``` LastName FirstName Jackson Michael Bennington Chester Shinoda Mike ``` And also I n...
2015/01/12
[ "https://Stackoverflow.com/questions/27904086", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2863468/" ]
Try this ``` UPDATE data SET FirstName = SUBSTRING_INDEX(Name, ' ', 1), LastName = SUBSTRING(SUBSTRING_INDEX(Name, ' ', 2), LENGTH(SUBSTRING_INDEX(Name, ' ', 1)) + 1) ``` **EDIT** As David Faber stated, one can use `SUBSTRING_INDEX(Name, ' ', -1)` for updating the `LastName` column.
INSTR shows error, so used POSITION. I am trying to split the columns at character '/': ``` UPDATE pincode SET latitude = LEFT( coordinates, POSITION('/' IN coordinates) - 1 ) , longitude = RIGHT( coordinates, LENGTH(coordinates) - POSITION('/' IN coordinates) ) WHERE coordinates LIKE '%/%'; ```
27,904,086
I have a table with a column 'Name', like the following: ``` Name Michael Jackson Chester Bennington Mike Shinoda ``` I want to split the 'Name' values in FirstName and LastName,blike this: ``` LastName FirstName Jackson Michael Bennington Chester Shinoda Mike ``` And also I n...
2015/01/12
[ "https://Stackoverflow.com/questions/27904086", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2863468/" ]
You might try this: ``` ALTER TABLE `data` ADD `FirstName` VARCHAR(30) , ADD `LastName` VARCHAR(30); UPDATE `data` SET `FirstName` = SUBSTR( `Name`, 1, INSTR(`Name`, ' ') - 1 ) , `LastName` = SUBSTR( `Name`, INSTR(`Name`, ' ') + 1, LENGTH(`Name`) - INSTR(`Name`, ' ') ) WHERE `Name` LIKE '% %...
This is your table. You use it how you want. Try this ``` select * from ( select SUBSTRING ( name ,(select CHARINDEX(' ',name, 0) from table1)+1 , (select LEN(name) from table1)-(select CHARINDEX(' ',name, 0) from table1)-1) as lastname, SUBSTRING ( name ,0 , (select LEN(name) from table1)-(select CHARINDEX(' ',name, ...
27,904,086
I have a table with a column 'Name', like the following: ``` Name Michael Jackson Chester Bennington Mike Shinoda ``` I want to split the 'Name' values in FirstName and LastName,blike this: ``` LastName FirstName Jackson Michael Bennington Chester Shinoda Mike ``` And also I n...
2015/01/12
[ "https://Stackoverflow.com/questions/27904086", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2863468/" ]
INSTR shows error, so used POSITION. I am trying to split the columns at character '/': ``` UPDATE pincode SET latitude = LEFT( coordinates, POSITION('/' IN coordinates) - 1 ) , longitude = RIGHT( coordinates, LENGTH(coordinates) - POSITION('/' IN coordinates) ) WHERE coordinates LIKE '%/%'; ```
This is your table. You use it how you want. Try this ``` select * from ( select SUBSTRING ( name ,(select CHARINDEX(' ',name, 0) from table1)+1 , (select LEN(name) from table1)-(select CHARINDEX(' ',name, 0) from table1)-1) as lastname, SUBSTRING ( name ,0 , (select LEN(name) from table1)-(select CHARINDEX(' ',name, ...
27,904,086
I have a table with a column 'Name', like the following: ``` Name Michael Jackson Chester Bennington Mike Shinoda ``` I want to split the 'Name' values in FirstName and LastName,blike this: ``` LastName FirstName Jackson Michael Bennington Chester Shinoda Mike ``` And also I n...
2015/01/12
[ "https://Stackoverflow.com/questions/27904086", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2863468/" ]
You might try this: ``` ALTER TABLE `data` ADD `FirstName` VARCHAR(30) , ADD `LastName` VARCHAR(30); UPDATE `data` SET `FirstName` = SUBSTR( `Name`, 1, INSTR(`Name`, ' ') - 1 ) , `LastName` = SUBSTR( `Name`, INSTR(`Name`, ' ') + 1, LENGTH(`Name`) - INSTR(`Name`, ' ') ) WHERE `Name` LIKE '% %...
INSTR shows error, so used POSITION. I am trying to split the columns at character '/': ``` UPDATE pincode SET latitude = LEFT( coordinates, POSITION('/' IN coordinates) - 1 ) , longitude = RIGHT( coordinates, LENGTH(coordinates) - POSITION('/' IN coordinates) ) WHERE coordinates LIKE '%/%'; ```
21,557,516
I have a database which stores a diary of events (pretty similar to how facebook works) these can be for a specific single date, or recurring each year. For example I may have a wedding on 1st June 2013 and a birthday on the 4th May every year. I am trying to extract a list of all events that are occurring in the next ...
2014/02/04
[ "https://Stackoverflow.com/questions/21557516", "https://Stackoverflow.com", "https://Stackoverflow.com/users/927974/" ]
In my case the header's "content-length" property was insufficient for the data being posted. Make sure "content-length" is set to the length of the data you are sending.
I had a problem with the POST request handling: ``` request.on('data', function (data) { body +=data; }); request.on('end',function(){ ... //do some stuff } var headers={'Content-Type': 'text/plain'}; response.writeHeader(200, headers); response.end(); }); ``` transferring my code t...
273,740
I'm a zoology minor and we are doing protein estimation by colorimetric method. I have stumbled upon a term 'Optical density'. I don't understand the term well. Is it a measure of the extent of light that can pass through a particular object? I've checked a [related question](https://physics.stackexchange.com/question...
2016/08/11
[ "https://physics.stackexchange.com/questions/273740", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/107034/" ]
You're a little confused probably because there are *two* usages of the words "optical density". The first usage is as a synonym for *refractive index*, as described in the answers to the related question you cite. This is the commoner usage in physics. The second usage is the total attenuation afforded by a protect...
For all intents and purposes, OD is the negative of the order of magnitude the factor by which the intensity of the light is reduced by the attenuating element with said OD. In other words: OD = 6, means that the intensity will be reduced by a factor of 10 to the power of -6, a.k.a by a factor of a million.
273,740
I'm a zoology minor and we are doing protein estimation by colorimetric method. I have stumbled upon a term 'Optical density'. I don't understand the term well. Is it a measure of the extent of light that can pass through a particular object? I've checked a [related question](https://physics.stackexchange.com/question...
2016/08/11
[ "https://physics.stackexchange.com/questions/273740", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/107034/" ]
For all intents and purposes, OD is the negative of the order of magnitude the factor by which the intensity of the light is reduced by the attenuating element with said OD. In other words: OD = 6, means that the intensity will be reduced by a factor of 10 to the power of -6, a.k.a by a factor of a million.
Optical density is a mathematical way of describing the extent of attenuation of visual lightwaves. Density is the log of opacity. Opacity is the reciprocal of transmittance. So a transmittance of 50% of the light (half of the light) would have an opacity of 2. The log of 2 = .3 So a density of .3 blocks half of th...
273,740
I'm a zoology minor and we are doing protein estimation by colorimetric method. I have stumbled upon a term 'Optical density'. I don't understand the term well. Is it a measure of the extent of light that can pass through a particular object? I've checked a [related question](https://physics.stackexchange.com/question...
2016/08/11
[ "https://physics.stackexchange.com/questions/273740", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/107034/" ]
For all intents and purposes, OD is the negative of the order of magnitude the factor by which the intensity of the light is reduced by the attenuating element with said OD. In other words: OD = 6, means that the intensity will be reduced by a factor of 10 to the power of -6, a.k.a by a factor of a million.
The term Optical Density or ("OD") can have two different but related uses. 1. The first is in relation to the refractive index. I've included an image that will enable a quick grasp of this concept. [![REFRACTIVE INDEX EXPLAINED](https://i.stack.imgur.com/JUUSe.jpg)](https://i.stack.imgur.com/JUUSe.jpg) 2. The seco...
273,740
I'm a zoology minor and we are doing protein estimation by colorimetric method. I have stumbled upon a term 'Optical density'. I don't understand the term well. Is it a measure of the extent of light that can pass through a particular object? I've checked a [related question](https://physics.stackexchange.com/question...
2016/08/11
[ "https://physics.stackexchange.com/questions/273740", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/107034/" ]
You're a little confused probably because there are *two* usages of the words "optical density". The first usage is as a synonym for *refractive index*, as described in the answers to the related question you cite. This is the commoner usage in physics. The second usage is the total attenuation afforded by a protect...
Optical density is a mathematical way of describing the extent of attenuation of visual lightwaves. Density is the log of opacity. Opacity is the reciprocal of transmittance. So a transmittance of 50% of the light (half of the light) would have an opacity of 2. The log of 2 = .3 So a density of .3 blocks half of th...
273,740
I'm a zoology minor and we are doing protein estimation by colorimetric method. I have stumbled upon a term 'Optical density'. I don't understand the term well. Is it a measure of the extent of light that can pass through a particular object? I've checked a [related question](https://physics.stackexchange.com/question...
2016/08/11
[ "https://physics.stackexchange.com/questions/273740", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/107034/" ]
You're a little confused probably because there are *two* usages of the words "optical density". The first usage is as a synonym for *refractive index*, as described in the answers to the related question you cite. This is the commoner usage in physics. The second usage is the total attenuation afforded by a protect...
The term Optical Density or ("OD") can have two different but related uses. 1. The first is in relation to the refractive index. I've included an image that will enable a quick grasp of this concept. [![REFRACTIVE INDEX EXPLAINED](https://i.stack.imgur.com/JUUSe.jpg)](https://i.stack.imgur.com/JUUSe.jpg) 2. The seco...
18,961,635
This is my Service which does network operation. But it is throwing NetworkonMainThreadException which i understand android upper version doesn't allows network operation under main thread. Now i want to use Async Task for this purpose. I am not sure which are all code i need to add under Async Task from Service Class ...
2013/09/23
[ "https://Stackoverflow.com/questions/18961635", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2625547/" ]
Hope this helps you ``` var Something =$("#TextBoxID").val(); if(Something == "aaaa") { window.location.href = 'URL1'; //Will take you to URL1 } ...... ...... ```
Use a function like this, if you store your URLs on the client side (HTML/JS page): ``` function determineAndGoToURL(text) { var url = "#"; switch(text) { case "aaaa": url="www.google.com"; break; case "bbbb": url = "www.bing.com"; break; default: url = "www....
18,961,635
This is my Service which does network operation. But it is throwing NetworkonMainThreadException which i understand android upper version doesn't allows network operation under main thread. Now i want to use Async Task for this purpose. I am not sure which are all code i need to add under Async Task from Service Class ...
2013/09/23
[ "https://Stackoverflow.com/questions/18961635", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2625547/" ]
if you want to configure the list on an admin console you need to have some kind of server side technology like php (or node.js if you want to keep using javascript). You need to think of where this data will be stored. A possibility would be fetching the list of text/url pairs using ajax (e.g. with jQuery) and storing...
Use a function like this, if you store your URLs on the client side (HTML/JS page): ``` function determineAndGoToURL(text) { var url = "#"; switch(text) { case "aaaa": url="www.google.com"; break; case "bbbb": url = "www.bing.com"; break; default: url = "www....
4,479,489
I read a couple of thing about this, but I can't figure how to put it in my code. Here it is : ``` function go($image) { // Open the image $getimage=imagecreatefrompng($image); //Get the width/height $w = imagesx($getimage); $h = imagesy($getimage); //init Count variable, when it reach the width, s...
2010/12/18
[ "https://Stackoverflow.com/questions/4479489", "https://Stackoverflow.com", "https://Stackoverflow.com/users/473908/" ]
Here is the correct working code, in order to complete this question. ``` function go($image) { // Open the image $getimage=imagecreatefrompng($image); imagealphablending($getimage, true); imagesavealpha($getimage, true); //Get the width/height $w = imagesx($getimage); $h = imagesy($getimage); //init C...
According to comments on the [imagecreatefrompng](http://php.net/manual/en/function.imagecreatefrompng.php) page, you need to call [imagealphablending](http://www.php.net/manual/en/function.imagealphablending.php) and [imagesavealpha](http://www.php.net/manual/en/function.imagesavealpha.php) ``` imagealphablending($ge...
69,942
As I understand a gravel bike, it's basically a road frame but perhaps with a slightly more upright riding position. It has wider tires with much deeper treads and a stiffer rubber than standard road bike tires. What is the theory behind these changes? I had always thought that the thicker and stiffer tires were to pre...
2020/07/27
[ "https://bicycles.stackexchange.com/questions/69942", "https://bicycles.stackexchange.com", "https://bicycles.stackexchange.com/users/50954/" ]
I think you are asking two separate questions: 1. What's a gravel bike and why are they popular? 2. Why are off-road tires designed they way they are? (Which applies equally to mountain bikes and hybrids) Gravel bikes have longer seat stays and more relaxed steering geometry than road bikes, which makes them a little...
**Q1: Riding position** A1: Do you know the riding position of a so-called gravel bike and a regular road bike could be 100% identical? Let me show you my real case. I just have a s-works diverge (so-called gravel bike) and a giant advanced tcr (so-called regular road bike). I have carefully studied their differen...
69,942
As I understand a gravel bike, it's basically a road frame but perhaps with a slightly more upright riding position. It has wider tires with much deeper treads and a stiffer rubber than standard road bike tires. What is the theory behind these changes? I had always thought that the thicker and stiffer tires were to pre...
2020/07/27
[ "https://bicycles.stackexchange.com/questions/69942", "https://bicycles.stackexchange.com", "https://bicycles.stackexchange.com/users/50954/" ]
**Q1: Riding position** A1: Do you know the riding position of a so-called gravel bike and a regular road bike could be 100% identical? Let me show you my real case. I just have a s-works diverge (so-called gravel bike) and a giant advanced tcr (so-called regular road bike). I have carefully studied their differen...
> > As I understand a gravel bike, it's basically a road frame but perhaps with a slightly more upright riding position. It has wider tires with much deeper treads and a stiffer rubber than standard road bike tires. What is the theory behind these changes? I had always thought that the thicker and stiffer tires were t...
69,942
As I understand a gravel bike, it's basically a road frame but perhaps with a slightly more upright riding position. It has wider tires with much deeper treads and a stiffer rubber than standard road bike tires. What is the theory behind these changes? I had always thought that the thicker and stiffer tires were to pre...
2020/07/27
[ "https://bicycles.stackexchange.com/questions/69942", "https://bicycles.stackexchange.com", "https://bicycles.stackexchange.com/users/50954/" ]
My theory and it is just a theory. In the U.S. at least there has been a proliferation of unpaved bike trails due to the conversion of abandoned railroad rights of way to bike paths. They are for the most part either flat or have a slight grade. Most of these trails are too uneven for a conventional road bike. At the s...
There's an interesting discussion with [Josh Poertner](https://www.youtube.com/watch?v=asEYkpW0vwQ), an aerospace/automotive engineer turned pro cycling consultant, on finding the most efficient tire pressure for different riding conditions. Basically, high pressure tires are less efficient on imperfect surfaces becaus...
69,942
As I understand a gravel bike, it's basically a road frame but perhaps with a slightly more upright riding position. It has wider tires with much deeper treads and a stiffer rubber than standard road bike tires. What is the theory behind these changes? I had always thought that the thicker and stiffer tires were to pre...
2020/07/27
[ "https://bicycles.stackexchange.com/questions/69942", "https://bicycles.stackexchange.com", "https://bicycles.stackexchange.com/users/50954/" ]
GCN had a funny take on this recently: [Gravel bikes exist because mountain biking is now boring](https://www.youtube.com/watch?v=XC_xFpg_UmA). Or to give slightly more nuance, mountain bikes make it so easy to ride over difficult terrain that they remove the challenge. Coming at it from the opposite direction, road c...
My theory and it is just a theory. In the U.S. at least there has been a proliferation of unpaved bike trails due to the conversion of abandoned railroad rights of way to bike paths. They are for the most part either flat or have a slight grade. Most of these trails are too uneven for a conventional road bike. At the s...
69,942
As I understand a gravel bike, it's basically a road frame but perhaps with a slightly more upright riding position. It has wider tires with much deeper treads and a stiffer rubber than standard road bike tires. What is the theory behind these changes? I had always thought that the thicker and stiffer tires were to pre...
2020/07/27
[ "https://bicycles.stackexchange.com/questions/69942", "https://bicycles.stackexchange.com", "https://bicycles.stackexchange.com/users/50954/" ]
What is called a "gravel bike" is really a new word for a cyclocross bike, but with maybe a tad less aggressive geometry. And cyclocross goes back pretty much to the beginning of bicycling, as the first races were held on unpaved courses and no roads were paved yet, or at best cobbled. The original road bikes looked a ...
There's an interesting discussion with [Josh Poertner](https://www.youtube.com/watch?v=asEYkpW0vwQ), an aerospace/automotive engineer turned pro cycling consultant, on finding the most efficient tire pressure for different riding conditions. Basically, high pressure tires are less efficient on imperfect surfaces becaus...
69,942
As I understand a gravel bike, it's basically a road frame but perhaps with a slightly more upright riding position. It has wider tires with much deeper treads and a stiffer rubber than standard road bike tires. What is the theory behind these changes? I had always thought that the thicker and stiffer tires were to pre...
2020/07/27
[ "https://bicycles.stackexchange.com/questions/69942", "https://bicycles.stackexchange.com", "https://bicycles.stackexchange.com/users/50954/" ]
My theory and it is just a theory. In the U.S. at least there has been a proliferation of unpaved bike trails due to the conversion of abandoned railroad rights of way to bike paths. They are for the most part either flat or have a slight grade. Most of these trails are too uneven for a conventional road bike. At the s...
**Q1: Riding position** A1: Do you know the riding position of a so-called gravel bike and a regular road bike could be 100% identical? Let me show you my real case. I just have a s-works diverge (so-called gravel bike) and a giant advanced tcr (so-called regular road bike). I have carefully studied their differen...
69,942
As I understand a gravel bike, it's basically a road frame but perhaps with a slightly more upright riding position. It has wider tires with much deeper treads and a stiffer rubber than standard road bike tires. What is the theory behind these changes? I had always thought that the thicker and stiffer tires were to pre...
2020/07/27
[ "https://bicycles.stackexchange.com/questions/69942", "https://bicycles.stackexchange.com", "https://bicycles.stackexchange.com/users/50954/" ]
GCN had a funny take on this recently: [Gravel bikes exist because mountain biking is now boring](https://www.youtube.com/watch?v=XC_xFpg_UmA). Or to give slightly more nuance, mountain bikes make it so easy to ride over difficult terrain that they remove the challenge. Coming at it from the opposite direction, road c...
> > As I understand a gravel bike, it's basically a road frame but perhaps with a slightly more upright riding position. It has wider tires with much deeper treads and a stiffer rubber than standard road bike tires. What is the theory behind these changes? I had always thought that the thicker and stiffer tires were t...
69,942
As I understand a gravel bike, it's basically a road frame but perhaps with a slightly more upright riding position. It has wider tires with much deeper treads and a stiffer rubber than standard road bike tires. What is the theory behind these changes? I had always thought that the thicker and stiffer tires were to pre...
2020/07/27
[ "https://bicycles.stackexchange.com/questions/69942", "https://bicycles.stackexchange.com", "https://bicycles.stackexchange.com/users/50954/" ]
My theory and it is just a theory. In the U.S. at least there has been a proliferation of unpaved bike trails due to the conversion of abandoned railroad rights of way to bike paths. They are for the most part either flat or have a slight grade. Most of these trails are too uneven for a conventional road bike. At the s...
The other answers address one theory of gravel bikes. In the past, many road bikes focused too much on on-tarmac performance, at the cost of general utility and comfort. Endurance road bikes married high-performance capabilities to a relatively upright position, enabling many cyclists to enjoy a fast *and* comfortable ...
69,942
As I understand a gravel bike, it's basically a road frame but perhaps with a slightly more upright riding position. It has wider tires with much deeper treads and a stiffer rubber than standard road bike tires. What is the theory behind these changes? I had always thought that the thicker and stiffer tires were to pre...
2020/07/27
[ "https://bicycles.stackexchange.com/questions/69942", "https://bicycles.stackexchange.com", "https://bicycles.stackexchange.com/users/50954/" ]
GCN had a funny take on this recently: [Gravel bikes exist because mountain biking is now boring](https://www.youtube.com/watch?v=XC_xFpg_UmA). Or to give slightly more nuance, mountain bikes make it so easy to ride over difficult terrain that they remove the challenge. Coming at it from the opposite direction, road c...
The other answers address one theory of gravel bikes. In the past, many road bikes focused too much on on-tarmac performance, at the cost of general utility and comfort. Endurance road bikes married high-performance capabilities to a relatively upright position, enabling many cyclists to enjoy a fast *and* comfortable ...