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
5,064,715
I don't know what this is called, but it is something like syncing android application and a Web server. Examples are RSS Feeds and Weather Forecast Does anyone know the concept behind developing application? I mean how do you sync the Android phone with a web server. Is there any programming needed in the server side...
2011/02/21
[ "https://Stackoverflow.com/questions/5064715", "https://Stackoverflow.com", "https://Stackoverflow.com/users/626365/" ]
Try this: ``` SELECT myCol FROM myTable WHERE SUBSTRING(myCol, 1 , 1) >= 'A' AND SUBSTRING(myCol, 1 , 1) <= 'Z' AND SUBSTRING(myCol, 2 , 1) >= 'A' AND SUBSTRING(myCol, 2 , 1) <= 'Z' AND SUBSTRING(myCol, 3 , 1) >= '0' AND SUBSTRING(myCol, 3 , 1) <= '9' ```
If you are using EMS SQL Manager for MySQL, you can use RegEx to filter data. ``` SELECT col FROM tbl WHERE col REGEXP '^[[:alpha:]]{2}[[:digit:]]{1}$' ``` RegEx: ``` ^[[:alpha:]]{2}[[:digit:]]{1}$ ``` `^` = starts with `[[:alpha:]]` = alphabet `[[:digit:]]` = numbers `{n}` = exactly n instances of Hope this...
5,064,715
I don't know what this is called, but it is something like syncing android application and a Web server. Examples are RSS Feeds and Weather Forecast Does anyone know the concept behind developing application? I mean how do you sync the Android phone with a web server. Is there any programming needed in the server side...
2011/02/21
[ "https://Stackoverflow.com/questions/5064715", "https://Stackoverflow.com", "https://Stackoverflow.com/users/626365/" ]
Well, yes, but it would be very slow and resource-intensive ... ``` SELECT myCol FROM myTable WHERE CHAR_LENGTH(myCol) = 3 AND SUBSTRING(myCol, 1, 1) IN ('1', '2', '3', '4', '5', '6', '7', '8', '9', '0') AND SUBSTRING(myCol, 2, 1) IN ('1', '2', '3', '4', '5', '6', '7', '8', '9', '0') A...
If your query is as simple as your example (ie. no parameters) then can you use a Stored Procedure to return the results using Reg Exp? In that case the driver shouldn't know or care that you're using Reg Exp.
5,064,715
I don't know what this is called, but it is something like syncing android application and a Web server. Examples are RSS Feeds and Weather Forecast Does anyone know the concept behind developing application? I mean how do you sync the Android phone with a web server. Is there any programming needed in the server side...
2011/02/21
[ "https://Stackoverflow.com/questions/5064715", "https://Stackoverflow.com", "https://Stackoverflow.com/users/626365/" ]
Just to state the accepted answer explicitly: ``` SELECT myCol FROM myTable WHERE SUBSTRING(myCol, 1 , 1) BETWEEN 'A' AND 'Z' AND SUBSTRING(myCol, 2 , 1) BETWEEN 'A' AND 'Z' AND SUBSTRING(myCol, 3 , 1) BETWEEN '0' AND '9' ``` (mixture of Ken's answer and Andriy's suggestion)
You can test the first two digits using LIKE, and for the third use an ascii range. The first two digits can use an ascii range too, but LIKE should be better. ``` select * from tbl where length(n) = 3 and '0123456789' like concat('%',mid(numcol,1,1),'%') and '0123456789' like concat('%',mid(numcol,2,1),'%') and...
5,064,715
I don't know what this is called, but it is something like syncing android application and a Web server. Examples are RSS Feeds and Weather Forecast Does anyone know the concept behind developing application? I mean how do you sync the Android phone with a web server. Is there any programming needed in the server side...
2011/02/21
[ "https://Stackoverflow.com/questions/5064715", "https://Stackoverflow.com", "https://Stackoverflow.com/users/626365/" ]
Just to state the accepted answer explicitly: ``` SELECT myCol FROM myTable WHERE SUBSTRING(myCol, 1 , 1) BETWEEN 'A' AND 'Z' AND SUBSTRING(myCol, 2 , 1) BETWEEN 'A' AND 'Z' AND SUBSTRING(myCol, 3 , 1) BETWEEN '0' AND '9' ``` (mixture of Ken's answer and Andriy's suggestion)
If you are using EMS SQL Manager for MySQL, you can use RegEx to filter data. ``` SELECT col FROM tbl WHERE col REGEXP '^[[:alpha:]]{2}[[:digit:]]{1}$' ``` RegEx: ``` ^[[:alpha:]]{2}[[:digit:]]{1}$ ``` `^` = starts with `[[:alpha:]]` = alphabet `[[:digit:]]` = numbers `{n}` = exactly n instances of Hope this...
5,064,715
I don't know what this is called, but it is something like syncing android application and a Web server. Examples are RSS Feeds and Weather Forecast Does anyone know the concept behind developing application? I mean how do you sync the Android phone with a web server. Is there any programming needed in the server side...
2011/02/21
[ "https://Stackoverflow.com/questions/5064715", "https://Stackoverflow.com", "https://Stackoverflow.com/users/626365/" ]
Well, yes, but it would be very slow and resource-intensive ... ``` SELECT myCol FROM myTable WHERE CHAR_LENGTH(myCol) = 3 AND SUBSTRING(myCol, 1, 1) IN ('1', '2', '3', '4', '5', '6', '7', '8', '9', '0') AND SUBSTRING(myCol, 2, 1) IN ('1', '2', '3', '4', '5', '6', '7', '8', '9', '0') A...
Try this - ``` SELECT myCol FROM myTable WHERE myCol REGEXP '[[:alpha:]]{2}[[:digit:]]{1}' ``` <http://dev.mysql.com/doc/refman/5.1/en/regexp.html>
5,064,715
I don't know what this is called, but it is something like syncing android application and a Web server. Examples are RSS Feeds and Weather Forecast Does anyone know the concept behind developing application? I mean how do you sync the Android phone with a web server. Is there any programming needed in the server side...
2011/02/21
[ "https://Stackoverflow.com/questions/5064715", "https://Stackoverflow.com", "https://Stackoverflow.com/users/626365/" ]
Try this: ``` SELECT myCol FROM myTable WHERE SUBSTRING(myCol, 1 , 1) >= 'A' AND SUBSTRING(myCol, 1 , 1) <= 'Z' AND SUBSTRING(myCol, 2 , 1) >= 'A' AND SUBSTRING(myCol, 2 , 1) <= 'Z' AND SUBSTRING(myCol, 3 , 1) >= '0' AND SUBSTRING(myCol, 3 , 1) <= '9' ```
``` SELECT myCol FROM myTable WHERE ( myCol LIKE '12X%' OR myCol LIKE '34Y%' ) AND myCol NOT LIKE '34YY%' ``` Rough example, but should help you figure the problem out. Can't help more since your example isn't that precise.
5,064,715
I don't know what this is called, but it is something like syncing android application and a Web server. Examples are RSS Feeds and Weather Forecast Does anyone know the concept behind developing application? I mean how do you sync the Android phone with a web server. Is there any programming needed in the server side...
2011/02/21
[ "https://Stackoverflow.com/questions/5064715", "https://Stackoverflow.com", "https://Stackoverflow.com/users/626365/" ]
Well, yes, but it would be very slow and resource-intensive ... ``` SELECT myCol FROM myTable WHERE CHAR_LENGTH(myCol) = 3 AND SUBSTRING(myCol, 1, 1) IN ('1', '2', '3', '4', '5', '6', '7', '8', '9', '0') AND SUBSTRING(myCol, 2, 1) IN ('1', '2', '3', '4', '5', '6', '7', '8', '9', '0') A...
If you are using EMS SQL Manager for MySQL, you can use RegEx to filter data. ``` SELECT col FROM tbl WHERE col REGEXP '^[[:alpha:]]{2}[[:digit:]]{1}$' ``` RegEx: ``` ^[[:alpha:]]{2}[[:digit:]]{1}$ ``` `^` = starts with `[[:alpha:]]` = alphabet `[[:digit:]]` = numbers `{n}` = exactly n instances of Hope this...
5,064,715
I don't know what this is called, but it is something like syncing android application and a Web server. Examples are RSS Feeds and Weather Forecast Does anyone know the concept behind developing application? I mean how do you sync the Android phone with a web server. Is there any programming needed in the server side...
2011/02/21
[ "https://Stackoverflow.com/questions/5064715", "https://Stackoverflow.com", "https://Stackoverflow.com/users/626365/" ]
Well, yes, but it would be very slow and resource-intensive ... ``` SELECT myCol FROM myTable WHERE CHAR_LENGTH(myCol) = 3 AND SUBSTRING(myCol, 1, 1) IN ('1', '2', '3', '4', '5', '6', '7', '8', '9', '0') AND SUBSTRING(myCol, 2, 1) IN ('1', '2', '3', '4', '5', '6', '7', '8', '9', '0') A...
You can test the first two digits using LIKE, and for the third use an ascii range. The first two digits can use an ascii range too, but LIKE should be better. ``` select * from tbl where length(n) = 3 and '0123456789' like concat('%',mid(numcol,1,1),'%') and '0123456789' like concat('%',mid(numcol,2,1),'%') and...
5,064,715
I don't know what this is called, but it is something like syncing android application and a Web server. Examples are RSS Feeds and Weather Forecast Does anyone know the concept behind developing application? I mean how do you sync the Android phone with a web server. Is there any programming needed in the server side...
2011/02/21
[ "https://Stackoverflow.com/questions/5064715", "https://Stackoverflow.com", "https://Stackoverflow.com/users/626365/" ]
Well, yes, but it would be very slow and resource-intensive ... ``` SELECT myCol FROM myTable WHERE CHAR_LENGTH(myCol) = 3 AND SUBSTRING(myCol, 1, 1) IN ('1', '2', '3', '4', '5', '6', '7', '8', '9', '0') AND SUBSTRING(myCol, 2, 1) IN ('1', '2', '3', '4', '5', '6', '7', '8', '9', '0') A...
``` SELECT myCol FROM myTable WHERE ( myCol LIKE '12X%' OR myCol LIKE '34Y%' ) AND myCol NOT LIKE '34YY%' ``` Rough example, but should help you figure the problem out. Can't help more since your example isn't that precise.
48,296,638
If for example I have `"all_stations_info": {"1": {"playing": "some song"}, "2": {"playing": "another song"}}` and I want to get the song playing on station "1", how'd I do it without the "1" getting recognized as Int or Float? typedef doesn't work since it, too, doesn't want an Int, and I'm not sure DynamicAccess c...
2018/01/17
[ "https://Stackoverflow.com/questions/48296638", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8190897/" ]
If you use `haxe.DynamicAccess<Any>` as type then you can just use array access like this `all_stations_info["1"]`. > > [DynamicAccess](https://api.haxe.org/haxe/DynamicAccess.html) is an abstract type for working with anonymous structures that are intended to hold collections of objects by the string key. DynamicAc...
Have you tried using [Reflect](https://api.haxe.org/Reflect.html)? Can find an example here: <https://try.haxe.org/#c621C>
53,781,042
Actually i'm using Retrofit2 in my app for sending some text to my server. The issue is when i'm using a Radio Frequency Device when the network is interrupted so i'm getting onFailure the call should be cancelled but as soon as the device is reconnected to the network seems it's resending the text or something like t...
2018/12/14
[ "https://Stackoverflow.com/questions/53781042", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9945307/" ]
You could try canceling the call directly. So when the call fails, in the `onFailure` callback, you can do something like ``` @Override public void onFailure(@NonNull Call<Void> call, @NonNull Throwable t) { if (!call.isCanceled()) { // Do receipt logic call.cancel(); } } ```
Since `retryOnConnectionFailure(false)` didn't help, the problem is not caused by OKHttp retry. I suspect you are duplicating the request. Check whether `sendPost()` is getting called multiple times.
45,528,685
I'm trying to make my header full width but I don't know why it doesn't work, the high is perfect but I don't know what's wrong with the width, I would appreciate it if you can help me, this is what I have tried: ``` #header { width:100%; -webkit-background-size: contain; -moz-background-size: contain; -o-backg...
2017/08/06
[ "https://Stackoverflow.com/questions/45528685", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8423460/" ]
I had a similar problem when launching Firefox version 52.3.0 with X11 forwarding on CentOS 7 : *WARNING: pipe error (35): Connexion ré-initialisée par le correspondant: file /builddir/build/BUILD/firefox-52.3.0/firefox-52.3.0esr/ipc/chromium/src/chrome/common/ipc\_channel\_posix.cc, line 322* And same error (in fren...
Check your SELinux configuration. In special check that `mozilla_plugin_can_network_connect` is enabled. You can do: `getsebool mozilla_plugin_can_network_connect` if answer is `off` then do `setsebool -P mozilla_plugin_can_network_connect=1`. Then try again `firefox&`
778,324
I am trying to create a dropdown menu based on Stu Nicholls' : <http://www.cssplay.co.uk/menus/pro_drop8.html> Mine needs to go over *Select* dropdowns and be IE6/7 compliant, so that's why I'm using all this iFrame nonsense. Changing z-index will not fix it because IE set an infinite zindex value to select dropdowns....
2009/04/22
[ "https://Stackoverflow.com/questions/778324", "https://Stackoverflow.com", "https://Stackoverflow.com/users/90691/" ]
Sometimes IE will have an issue with it's [haslayout](http://www.satzansatz.de/cssd/onhavinglayout.html) property. A quick easy fix is to set: ``` height: 1%; ```
I don't know if this is necessarilly what you need but the [jQuery bgiframe plugin](http://plugins.jquery.com/project/bgiframe) handles the select problem pretty cleanly so you don't have to do everything manually. Hope that helps.
778,324
I am trying to create a dropdown menu based on Stu Nicholls' : <http://www.cssplay.co.uk/menus/pro_drop8.html> Mine needs to go over *Select* dropdowns and be IE6/7 compliant, so that's why I'm using all this iFrame nonsense. Changing z-index will not fix it because IE set an infinite zindex value to select dropdowns....
2009/04/22
[ "https://Stackoverflow.com/questions/778324", "https://Stackoverflow.com", "https://Stackoverflow.com/users/90691/" ]
Sometimes IE will have an issue with it's [haslayout](http://www.satzansatz.de/cssd/onhavinglayout.html) property. A quick easy fix is to set: ``` height: 1%; ```
IE uses a different event trigger than the rest of the browsers. Try doing this for the mouse out: ``` //browser sniff if (navigator.appName == "Microsoft Internet Explorer") { document.getElementById('yourtriggerid').onmouseleave = function() { document.getElementById('them...
778,324
I am trying to create a dropdown menu based on Stu Nicholls' : <http://www.cssplay.co.uk/menus/pro_drop8.html> Mine needs to go over *Select* dropdowns and be IE6/7 compliant, so that's why I'm using all this iFrame nonsense. Changing z-index will not fix it because IE set an infinite zindex value to select dropdowns....
2009/04/22
[ "https://Stackoverflow.com/questions/778324", "https://Stackoverflow.com", "https://Stackoverflow.com/users/90691/" ]
I hate to be "that guy" who suggests you use something else, so don't try this if you're set on using Nicholls' code. But if you're not sold on Stu Nicholls' dropdown menus, you could check out [YUI's menus](http://developer.yahoo.com/yui/menu/). I specifically mention those because I've had great success with their if...
I don't know if this is necessarilly what you need but the [jQuery bgiframe plugin](http://plugins.jquery.com/project/bgiframe) handles the select problem pretty cleanly so you don't have to do everything manually. Hope that helps.
778,324
I am trying to create a dropdown menu based on Stu Nicholls' : <http://www.cssplay.co.uk/menus/pro_drop8.html> Mine needs to go over *Select* dropdowns and be IE6/7 compliant, so that's why I'm using all this iFrame nonsense. Changing z-index will not fix it because IE set an infinite zindex value to select dropdowns....
2009/04/22
[ "https://Stackoverflow.com/questions/778324", "https://Stackoverflow.com", "https://Stackoverflow.com/users/90691/" ]
I hate to be "that guy" who suggests you use something else, so don't try this if you're set on using Nicholls' code. But if you're not sold on Stu Nicholls' dropdown menus, you could check out [YUI's menus](http://developer.yahoo.com/yui/menu/). I specifically mention those because I've had great success with their if...
IE uses a different event trigger than the rest of the browsers. Try doing this for the mouse out: ``` //browser sniff if (navigator.appName == "Microsoft Internet Explorer") { document.getElementById('yourtriggerid').onmouseleave = function() { document.getElementById('them...
778,324
I am trying to create a dropdown menu based on Stu Nicholls' : <http://www.cssplay.co.uk/menus/pro_drop8.html> Mine needs to go over *Select* dropdowns and be IE6/7 compliant, so that's why I'm using all this iFrame nonsense. Changing z-index will not fix it because IE set an infinite zindex value to select dropdowns....
2009/04/22
[ "https://Stackoverflow.com/questions/778324", "https://Stackoverflow.com", "https://Stackoverflow.com/users/90691/" ]
Ok I found how to fix my issue. I'm using Chrome Drop Down Menu : <http://www.dynamicdrive.com/dynamicindex1/chrome/index.htm> The code is simple, pretty and works perfectly. I had some hard time customizing it but now it's done and my life is much better : ``` <div class="chromestyle" id="chromemenu"> <ul> <li><a hr...
I don't know if this is necessarilly what you need but the [jQuery bgiframe plugin](http://plugins.jquery.com/project/bgiframe) handles the select problem pretty cleanly so you don't have to do everything manually. Hope that helps.
778,324
I am trying to create a dropdown menu based on Stu Nicholls' : <http://www.cssplay.co.uk/menus/pro_drop8.html> Mine needs to go over *Select* dropdowns and be IE6/7 compliant, so that's why I'm using all this iFrame nonsense. Changing z-index will not fix it because IE set an infinite zindex value to select dropdowns....
2009/04/22
[ "https://Stackoverflow.com/questions/778324", "https://Stackoverflow.com", "https://Stackoverflow.com/users/90691/" ]
I don't know if this is necessarilly what you need but the [jQuery bgiframe plugin](http://plugins.jquery.com/project/bgiframe) handles the select problem pretty cleanly so you don't have to do everything manually. Hope that helps.
IE uses a different event trigger than the rest of the browsers. Try doing this for the mouse out: ``` //browser sniff if (navigator.appName == "Microsoft Internet Explorer") { document.getElementById('yourtriggerid').onmouseleave = function() { document.getElementById('them...
778,324
I am trying to create a dropdown menu based on Stu Nicholls' : <http://www.cssplay.co.uk/menus/pro_drop8.html> Mine needs to go over *Select* dropdowns and be IE6/7 compliant, so that's why I'm using all this iFrame nonsense. Changing z-index will not fix it because IE set an infinite zindex value to select dropdowns....
2009/04/22
[ "https://Stackoverflow.com/questions/778324", "https://Stackoverflow.com", "https://Stackoverflow.com/users/90691/" ]
Ok I found how to fix my issue. I'm using Chrome Drop Down Menu : <http://www.dynamicdrive.com/dynamicindex1/chrome/index.htm> The code is simple, pretty and works perfectly. I had some hard time customizing it but now it's done and my life is much better : ``` <div class="chromestyle" id="chromemenu"> <ul> <li><a hr...
IE uses a different event trigger than the rest of the browsers. Try doing this for the mouse out: ``` //browser sniff if (navigator.appName == "Microsoft Internet Explorer") { document.getElementById('yourtriggerid').onmouseleave = function() { document.getElementById('them...
20,163,702
I am learning C and I want to implement a function that returns to main function a string. I have read some topics here but I got confused.. I wrote: ``` #include <stdio.h> #include <string.h> char myPrint(int); int main() { char msg[10]; msg = myPrint(1); printf("\n %s \n", msg); } char myPrint(int ...
2013/11/23
[ "https://Stackoverflow.com/questions/20163702", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2594961/" ]
Declare your function as ``` char *myPrint(int n); ``` Do not return the local variable `msg` from your function - it ceases to exist after `myPrint` function. ``` if(n==1) return "ACCEPT"; else return "DENY"; ```
Declare your function as ``` char *myPrint(char *ptr, int n); ``` to return string from your function. Call it from your `main` function as ``` printf("\n %s \n", myPrint(msg, 1)); ``` Your function ``` char *myPrint(char *msg, int n) { if(n==1) strcpy(msg, "ACCEPT"); else st...
20,163,702
I am learning C and I want to implement a function that returns to main function a string. I have read some topics here but I got confused.. I wrote: ``` #include <stdio.h> #include <string.h> char myPrint(int); int main() { char msg[10]; msg = myPrint(1); printf("\n %s \n", msg); } char myPrint(int ...
2013/11/23
[ "https://Stackoverflow.com/questions/20163702", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2594961/" ]
You should never return a pointer to variable that is allocated in the function, because by the time it returns, the variable will be de-allocated automatically (it is stack-allocated as opposed to heap-allocated or static). So instead, you pass in a char \* to myPrint and fill the char array from inside it. Then the o...
Declare your function as ``` char *myPrint(char *ptr, int n); ``` to return string from your function. Call it from your `main` function as ``` printf("\n %s \n", myPrint(msg, 1)); ``` Your function ``` char *myPrint(char *msg, int n) { if(n==1) strcpy(msg, "ACCEPT"); else st...
20,163,702
I am learning C and I want to implement a function that returns to main function a string. I have read some topics here but I got confused.. I wrote: ``` #include <stdio.h> #include <string.h> char myPrint(int); int main() { char msg[10]; msg = myPrint(1); printf("\n %s \n", msg); } char myPrint(int ...
2013/11/23
[ "https://Stackoverflow.com/questions/20163702", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2594961/" ]
A bit of advice: returning a pointer to a string when that string is defined as a local variable in the function won't work, as the allocated memory for the string will be unvalidated. If your function returns literal strings, as per your example, you have to do as **Acme** said: ``` char *MyPrint (int n) { if (n==...
Declare your function as ``` char *myPrint(char *ptr, int n); ``` to return string from your function. Call it from your `main` function as ``` printf("\n %s \n", myPrint(msg, 1)); ``` Your function ``` char *myPrint(char *msg, int n) { if(n==1) strcpy(msg, "ACCEPT"); else st...
20,163,702
I am learning C and I want to implement a function that returns to main function a string. I have read some topics here but I got confused.. I wrote: ``` #include <stdio.h> #include <string.h> char myPrint(int); int main() { char msg[10]; msg = myPrint(1); printf("\n %s \n", msg); } char myPrint(int ...
2013/11/23
[ "https://Stackoverflow.com/questions/20163702", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2594961/" ]
Declare your function as ``` char *myPrint(char *ptr, int n); ``` to return string from your function. Call it from your `main` function as ``` printf("\n %s \n", myPrint(msg, 1)); ``` Your function ``` char *myPrint(char *msg, int n) { if(n==1) strcpy(msg, "ACCEPT"); else st...
``` #include <stdio.h> #include <stdlib.h> #include <string.h> #define STR_SIZE 10 char * myPrint(const int ); int main() { char *msg = NULL; msg = myPrint(1); free(myPrint(1)); printf("\n %s \n", msg); return 0; } char * myPrint(const int n) { char *msg = (char *) malloc(STR_SIZE * ...
20,163,702
I am learning C and I want to implement a function that returns to main function a string. I have read some topics here but I got confused.. I wrote: ``` #include <stdio.h> #include <string.h> char myPrint(int); int main() { char msg[10]; msg = myPrint(1); printf("\n %s \n", msg); } char myPrint(int ...
2013/11/23
[ "https://Stackoverflow.com/questions/20163702", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2594961/" ]
Declare your function as ``` char *myPrint(int n); ``` Do not return the local variable `msg` from your function - it ceases to exist after `myPrint` function. ``` if(n==1) return "ACCEPT"; else return "DENY"; ```
You should never return a pointer to variable that is allocated in the function, because by the time it returns, the variable will be de-allocated automatically (it is stack-allocated as opposed to heap-allocated or static). So instead, you pass in a char \* to myPrint and fill the char array from inside it. Then the o...
20,163,702
I am learning C and I want to implement a function that returns to main function a string. I have read some topics here but I got confused.. I wrote: ``` #include <stdio.h> #include <string.h> char myPrint(int); int main() { char msg[10]; msg = myPrint(1); printf("\n %s \n", msg); } char myPrint(int ...
2013/11/23
[ "https://Stackoverflow.com/questions/20163702", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2594961/" ]
Declare your function as ``` char *myPrint(int n); ``` Do not return the local variable `msg` from your function - it ceases to exist after `myPrint` function. ``` if(n==1) return "ACCEPT"; else return "DENY"; ```
``` #include <stdio.h> #include <stdlib.h> #include <string.h> #define STR_SIZE 10 char * myPrint(const int ); int main() { char *msg = NULL; msg = myPrint(1); free(myPrint(1)); printf("\n %s \n", msg); return 0; } char * myPrint(const int n) { char *msg = (char *) malloc(STR_SIZE * ...
20,163,702
I am learning C and I want to implement a function that returns to main function a string. I have read some topics here but I got confused.. I wrote: ``` #include <stdio.h> #include <string.h> char myPrint(int); int main() { char msg[10]; msg = myPrint(1); printf("\n %s \n", msg); } char myPrint(int ...
2013/11/23
[ "https://Stackoverflow.com/questions/20163702", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2594961/" ]
A bit of advice: returning a pointer to a string when that string is defined as a local variable in the function won't work, as the allocated memory for the string will be unvalidated. If your function returns literal strings, as per your example, you have to do as **Acme** said: ``` char *MyPrint (int n) { if (n==...
You should never return a pointer to variable that is allocated in the function, because by the time it returns, the variable will be de-allocated automatically (it is stack-allocated as opposed to heap-allocated or static). So instead, you pass in a char \* to myPrint and fill the char array from inside it. Then the o...
20,163,702
I am learning C and I want to implement a function that returns to main function a string. I have read some topics here but I got confused.. I wrote: ``` #include <stdio.h> #include <string.h> char myPrint(int); int main() { char msg[10]; msg = myPrint(1); printf("\n %s \n", msg); } char myPrint(int ...
2013/11/23
[ "https://Stackoverflow.com/questions/20163702", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2594961/" ]
You should never return a pointer to variable that is allocated in the function, because by the time it returns, the variable will be de-allocated automatically (it is stack-allocated as opposed to heap-allocated or static). So instead, you pass in a char \* to myPrint and fill the char array from inside it. Then the o...
``` #include <stdio.h> #include <stdlib.h> #include <string.h> #define STR_SIZE 10 char * myPrint(const int ); int main() { char *msg = NULL; msg = myPrint(1); free(myPrint(1)); printf("\n %s \n", msg); return 0; } char * myPrint(const int n) { char *msg = (char *) malloc(STR_SIZE * ...
20,163,702
I am learning C and I want to implement a function that returns to main function a string. I have read some topics here but I got confused.. I wrote: ``` #include <stdio.h> #include <string.h> char myPrint(int); int main() { char msg[10]; msg = myPrint(1); printf("\n %s \n", msg); } char myPrint(int ...
2013/11/23
[ "https://Stackoverflow.com/questions/20163702", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2594961/" ]
A bit of advice: returning a pointer to a string when that string is defined as a local variable in the function won't work, as the allocated memory for the string will be unvalidated. If your function returns literal strings, as per your example, you have to do as **Acme** said: ``` char *MyPrint (int n) { if (n==...
``` #include <stdio.h> #include <stdlib.h> #include <string.h> #define STR_SIZE 10 char * myPrint(const int ); int main() { char *msg = NULL; msg = myPrint(1); free(myPrint(1)); printf("\n %s \n", msg); return 0; } char * myPrint(const int n) { char *msg = (char *) malloc(STR_SIZE * ...
70,117,249
Right now i have four images which are being dynamically presented on html. This is done via an onload function. Basically when i click on of those wheels I would like the image to change for around one second then go back. But right now only one wheel changes colour which is quite annoying. ``` function setWheels() {...
2021/11/25
[ "https://Stackoverflow.com/questions/70117249", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16083765/" ]
Your if statements aren't checking anything useful. `if(document.querySelector(".blue-wheel"))` is only checking if that element is there, not if the image inside was clicked. If you want to know which image was clicked, pass it in as a parameter to the function. ```html <img src='blue-dark.svg.svg' onclick='buttonEv...
you can use a variable (let x=0) to count on what image are you on. then make function that will see what x = 0 so it will show the first image then add one to the x (like "x++")but before you show the image you need to remove the last one, so then you need to loop through the images (you can give the same class to the...
70,117,249
Right now i have four images which are being dynamically presented on html. This is done via an onload function. Basically when i click on of those wheels I would like the image to change for around one second then go back. But right now only one wheel changes colour which is quite annoying. ``` function setWheels() {...
2021/11/25
[ "https://Stackoverflow.com/questions/70117249", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16083765/" ]
You are missing a " ``` .innerHTML =<img src='red-light.svg.svg'>"; ``` should be ``` .innerHTML = "<img src='red-light.svg.svg'>"; ```
you can use a variable (let x=0) to count on what image are you on. then make function that will see what x = 0 so it will show the first image then add one to the x (like "x++")but before you show the image you need to remove the last one, so then you need to loop through the images (you can give the same class to the...
70,117,249
Right now i have four images which are being dynamically presented on html. This is done via an onload function. Basically when i click on of those wheels I would like the image to change for around one second then go back. But right now only one wheel changes colour which is quite annoying. ``` function setWheels() {...
2021/11/25
[ "https://Stackoverflow.com/questions/70117249", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16083765/" ]
Your if statements aren't checking anything useful. `if(document.querySelector(".blue-wheel"))` is only checking if that element is there, not if the image inside was clicked. If you want to know which image was clicked, pass it in as a parameter to the function. ```html <img src='blue-dark.svg.svg' onclick='buttonEv...
You are missing a " ``` .innerHTML =<img src='red-light.svg.svg'>"; ``` should be ``` .innerHTML = "<img src='red-light.svg.svg'>"; ```
43,525,822
here is my problem: I would like to improve an event on my database which give every player 1 point. That's great but i would like to do it proportionnally so that the players with like 20000 earn 0 points and the player with 10000 earn 50% less than the player with 0. The formula is already made. All i need is the...
2017/04/20
[ "https://Stackoverflow.com/questions/43525822", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4071479/" ]
Here is another solution using multiple "-draw" options: "-draw" doesn't have a "dissolve" option so you'd need to prepare the watermark image ahead of time to have 30% alpha. ``` convert watermark.jpg -alpha set -channel alpha -fx .30 watermark30.png convert originalImage.jpg \ -gravity NorthWest -draw "image over...
Not at a computer, so untested, but this should be close: ``` convert originalImage.jpg \( watermark.jpg -write MPR:wm \) \ -define compose:args=30,100 -compose dissolve \ -gravity NorthWest -geometry +3+3 -composite \ MPR:wm -gravity NorthEast -geometry +3+3 -composite \ MPR:wm...
51,427
Outside my house, there is a gap visible below some of my windows. I have attached pictures to make it clear, since I don't know the terminology. The gap is about the width of my thumb. I can see the insulation easily. Should I fill this, and if so, how? Gallery link: [http://imgur.com/a/P3Sl6](https://imgur.com/a/P...
2014/10/19
[ "https://diy.stackexchange.com/questions/51427", "https://diy.stackexchange.com", "https://diy.stackexchange.com/users/14069/" ]
Backer rod and sealant can fill the joint. Provided the installation prevents bulk water infiltration, it provides an additional layer of protection. If the joint currently allows the passage of water, this is a stopgap versus reinstalling the windows properly.
It looks to me like the window unit itself *(what looks to be the newer vinyl clad window)* may have been installed over the original sill and inside the frame of the original window. No telling why this may have been done other than to avoid having to deal with the interface between the old frame and siding. Anyway i...
7,274
If I've a big sprite png image with 40x40 icons. How I can convert it to separate images for each icon with photoshop or gimp? As the sprite is quite big I would prefer and automated method.
2012/05/03
[ "https://graphicdesign.stackexchange.com/questions/7274", "https://graphicdesign.stackexchange.com", "https://graphicdesign.stackexchange.com/users/4472/" ]
Okay, if you don't have too many sprites then this shouldn't take too long. It's not automated, but if that's what you're looking for let me know and I can help you with a script to do it (although at that point this begins to fall out of the bounds of Graphic Design) 1. Setup your sprite grid in the Photoshop prefer...
Because `"the sprite is quite big"`, an excellent `"automated method"` is imagemagick. I know it is not Gimp or Photoshop but with large files and automation, it is by far easier to use imagemagick. You can automate this with simple Cron -one-liner, `$ crontab -e` but ask more about it in Stackoverflow. Anyway here the...
10,146,974
My data table looks like that: ``` chr4 124097568 124098568 337 chr4 159597106 159598106 1000 chr4 159597106 159598106 1000 chr4 164361532 164362532 455 chr4 164361532 164362532 74 chr4 164361532 164362532 2 chr4 170360150...
2012/04/13
[ "https://Stackoverflow.com/questions/10146974", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1286528/" ]
``` $ cat example.txt chr4 124097568 124098568 337 chr4 159597106 159598106 1000 chr4 159597106 159598106 1000 chr4 164361532 164362532 455 chr4 164361532 164362532 74 chr4 164361532 164362532 2 chr4 170360150 1703611...
That would be easier if the last column (COL#4) was "right space padded", like this: ``` chr4 124097568 124098568 337 chr4 159597106 159598106 1000 chr4 159597106 159598106 1000 chr4 164361532 164362532 455 chr4 164361532 164362532 74 c...
10,146,974
My data table looks like that: ``` chr4 124097568 124098568 337 chr4 159597106 159598106 1000 chr4 159597106 159598106 1000 chr4 164361532 164362532 455 chr4 164361532 164362532 74 chr4 164361532 164362532 2 chr4 170360150...
2012/04/13
[ "https://Stackoverflow.com/questions/10146974", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1286528/" ]
That would be easier if the last column (COL#4) was "right space padded", like this: ``` chr4 124097568 124098568 337 chr4 159597106 159598106 1000 chr4 159597106 159598106 1000 chr4 164361532 164362532 455 chr4 164361532 164362532 74 c...
one possible solution is to sort the lines of your input and then kill the lines which occur multiple times. In Python, you could do something like ``` f = open("table.dat", "r") lines = f.read().split() lines.sort() old = lines[0] singles = [old] for line in lines: if old != line: singles.append(line) ...
10,146,974
My data table looks like that: ``` chr4 124097568 124098568 337 chr4 159597106 159598106 1000 chr4 159597106 159598106 1000 chr4 164361532 164362532 455 chr4 164361532 164362532 74 chr4 164361532 164362532 2 chr4 170360150...
2012/04/13
[ "https://Stackoverflow.com/questions/10146974", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1286528/" ]
``` $ cat example.txt chr4 124097568 124098568 337 chr4 159597106 159598106 1000 chr4 159597106 159598106 1000 chr4 164361532 164362532 455 chr4 164361532 164362532 74 chr4 164361532 164362532 2 chr4 170360150 1703611...
one possible solution is to sort the lines of your input and then kill the lines which occur multiple times. In Python, you could do something like ``` f = open("table.dat", "r") lines = f.read().split() lines.sort() old = lines[0] singles = [old] for line in lines: if old != line: singles.append(line) ...
10,146,974
My data table looks like that: ``` chr4 124097568 124098568 337 chr4 159597106 159598106 1000 chr4 159597106 159598106 1000 chr4 164361532 164362532 455 chr4 164361532 164362532 74 chr4 164361532 164362532 2 chr4 170360150...
2012/04/13
[ "https://Stackoverflow.com/questions/10146974", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1286528/" ]
``` $ cat example.txt chr4 124097568 124098568 337 chr4 159597106 159598106 1000 chr4 159597106 159598106 1000 chr4 164361532 164362532 455 chr4 164361532 164362532 74 chr4 164361532 164362532 2 chr4 170360150 1703611...
``` awk ' {key = $2 SUBSEP $3} !(key in max) || $4 > max[key] {max[key]=$4; line[key]=$0} END {for (key in line) print line[key]} ' ```
10,146,974
My data table looks like that: ``` chr4 124097568 124098568 337 chr4 159597106 159598106 1000 chr4 159597106 159598106 1000 chr4 164361532 164362532 455 chr4 164361532 164362532 74 chr4 164361532 164362532 2 chr4 170360150...
2012/04/13
[ "https://Stackoverflow.com/questions/10146974", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1286528/" ]
``` $ cat example.txt chr4 124097568 124098568 337 chr4 159597106 159598106 1000 chr4 159597106 159598106 1000 chr4 164361532 164362532 455 chr4 164361532 164362532 74 chr4 164361532 164362532 2 chr4 170360150 1703611...
This might work for you: ``` sort -k4nr file | sort -uk2,3n ```
10,146,974
My data table looks like that: ``` chr4 124097568 124098568 337 chr4 159597106 159598106 1000 chr4 159597106 159598106 1000 chr4 164361532 164362532 455 chr4 164361532 164362532 74 chr4 164361532 164362532 2 chr4 170360150...
2012/04/13
[ "https://Stackoverflow.com/questions/10146974", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1286528/" ]
``` awk ' {key = $2 SUBSEP $3} !(key in max) || $4 > max[key] {max[key]=$4; line[key]=$0} END {for (key in line) print line[key]} ' ```
one possible solution is to sort the lines of your input and then kill the lines which occur multiple times. In Python, you could do something like ``` f = open("table.dat", "r") lines = f.read().split() lines.sort() old = lines[0] singles = [old] for line in lines: if old != line: singles.append(line) ...
10,146,974
My data table looks like that: ``` chr4 124097568 124098568 337 chr4 159597106 159598106 1000 chr4 159597106 159598106 1000 chr4 164361532 164362532 455 chr4 164361532 164362532 74 chr4 164361532 164362532 2 chr4 170360150...
2012/04/13
[ "https://Stackoverflow.com/questions/10146974", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1286528/" ]
This might work for you: ``` sort -k4nr file | sort -uk2,3n ```
one possible solution is to sort the lines of your input and then kill the lines which occur multiple times. In Python, you could do something like ``` f = open("table.dat", "r") lines = f.read().split() lines.sort() old = lines[0] singles = [old] for line in lines: if old != line: singles.append(line) ...
198,159
About 2 month ago I upgraded my Dell Latitude E6500 laptop with a Corsair Force F120 SSD drive. Everything worked well until about a week or so back. I started the computer and was faced with a beep and a message saying "No boot sector on Internal HDD (IRRT). No bootable devices". Since I figured that the boot sector h...
2010/11/04
[ "https://serverfault.com/questions/198159", "https://serverfault.com", "https://serverfault.com/users/-1/" ]
Corsair F Series drives have a firmware problem that arises if you change system states. From another forum: "It runs fine as long as you don't try to put the laptop to sleep, wake it up, or change the hardware profile (say, by docking or undocking it)". Allegedly there is a firmware update to 2.0 which may address it ...
Call the vendor for support and/or RMA, and stand by for a restore from backup. (You do have a backup, right?)
198,159
About 2 month ago I upgraded my Dell Latitude E6500 laptop with a Corsair Force F120 SSD drive. Everything worked well until about a week or so back. I started the computer and was faced with a beep and a message saying "No boot sector on Internal HDD (IRRT). No bootable devices". Since I figured that the boot sector h...
2010/11/04
[ "https://serverfault.com/questions/198159", "https://serverfault.com", "https://serverfault.com/users/-1/" ]
Corsair F Series drives have a firmware problem that arises if you change system states. From another forum: "It runs fine as long as you don't try to put the laptop to sleep, wake it up, or change the hardware profile (say, by docking or undocking it)". Allegedly there is a firmware update to 2.0 which may address it ...
Sounds like something that happened to me: A systemcrash rendered the partition on the harddrive useless. I rebooted and startet up Knoppix to investigate further. I wasn't able to find partitions. What had happened was that (after being unable to find something he thought was useful) a `trim` command got issued and...
198,159
About 2 month ago I upgraded my Dell Latitude E6500 laptop with a Corsair Force F120 SSD drive. Everything worked well until about a week or so back. I started the computer and was faced with a beep and a message saying "No boot sector on Internal HDD (IRRT). No bootable devices". Since I figured that the boot sector h...
2010/11/04
[ "https://serverfault.com/questions/198159", "https://serverfault.com", "https://serverfault.com/users/-1/" ]
Corsair F Series drives have a firmware problem that arises if you change system states. From another forum: "It runs fine as long as you don't try to put the laptop to sleep, wake it up, or change the hardware profile (say, by docking or undocking it)". Allegedly there is a firmware update to 2.0 which may address it ...
This type of thing happens when the controller screws up somehow. The flash memory itself is fine, most likely, as well as the data on it but you can't get to it without a functional controller. Usually the only way to restore controller functionality is to re-flash the drive's firmware, which incidentally wipes out al...
117,393
When the user enters a valid email on the login like Google did some time ago, is there any problem to show the avatar? Does make the experience better? Is a there is any security risk?
2018/04/17
[ "https://ux.stackexchange.com/questions/117393", "https://ux.stackexchange.com", "https://ux.stackexchange.com/users/114316/" ]
This would be bad from the security point of view. Anyone will be able to enter any name and see if this login (if this person) is registered at this site. Suppose you enter the name of your neighbor at some web site that sells drugs or weapon and see his picture. This would mean he is registered at this web site (unl...
In the case of a legitimate user signing in with their email address, this can be helpful. There's a privacy question you should consider: if I wasn't the legitimate user owning the account, and I was just trying to snoop on someone else by entering their email address into your service, would the legitimate user be p...
20,701,672
I am new to the world of Python. I have this `'if statement'` in my jinja2 template: ``` {{context.disabled==True and "Yes" or "No"}} ``` I am not sure what this syntax is called, but it works like an `if`. php equivalent would be: `echo $disabled ? "Yes" : "No"` This is always returning `No` or `False` even thoug...
2013/12/20
[ "https://Stackoverflow.com/questions/20701672", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2173793/" ]
What you want is something like this: ``` value = "Yes" if context.disabled else "No" ```
It should be {{ 'Yes' if context.disabled else 'No' }}
20,701,672
I am new to the world of Python. I have this `'if statement'` in my jinja2 template: ``` {{context.disabled==True and "Yes" or "No"}} ``` I am not sure what this syntax is called, but it works like an `if`. php equivalent would be: `echo $disabled ? "Yes" : "No"` This is always returning `No` or `False` even thoug...
2013/12/20
[ "https://Stackoverflow.com/questions/20701672", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2173793/" ]
Not sure about boolean expressions in jinja templates, but you can use [conditions](http://jinja.pocoo.org/docs/switching/#conditions): ``` {% if context.disabled %} "Yes" {% else %} "No" {% endif %} ```
It should be {{ 'Yes' if context.disabled else 'No' }}
4,709,293
In Hibernate, the default value of the property dynamic-update = false. But it seems, that this is not good for performance. Then why is this set to false by default?
2011/01/17
[ "https://Stackoverflow.com/questions/4709293", "https://Stackoverflow.com", "https://Stackoverflow.com/users/454671/" ]
The only drawback I can see here is that many different queries can increase a load on query parser or confuse query optimizer. Therefore Hibernate documentation recommends you to check performance impact in your particular case: > > Although these settings can increase performance in some cases, they can actually de...
The reason that they have as default dynamic-update = false is because they want to be backwards compatible to their previous hibernate versions as this is a new feature and they didn't had it before. They don't want to enable this feature by default to a project that updated to newer hibernate version and they give th...
4,536,864
Why java Number / Numeric datatypes such as (Integer/Long/...) doesnt throw overflow exception? For example: We get mathematically wrong answer for following ``` Integer val = Integer.MAX_VALUE * 2; System.out.println("Max val unexpected" + val); ``` \*\* Max val unexpected-2\*\* I know; at the core these datatype...
2010/12/27
[ "https://Stackoverflow.com/questions/4536864", "https://Stackoverflow.com", "https://Stackoverflow.com/users/503095/" ]
Those types are just wrappers for the primitive types, and so it would be unexpected if they behaved differently. One reason those types do not throw those exceptions is that it would be incredibly costly if such checks were performed, and these integral types on the processor don't trigger interrupts when they overflo...
That is the way the specification says it works. Check [4.2 - Primitive Types And Values](http://java.sun.com/docs/books/jls/second_edition/html/typesValues.doc.html) in the Java Specification for more information.
4,536,864
Why java Number / Numeric datatypes such as (Integer/Long/...) doesnt throw overflow exception? For example: We get mathematically wrong answer for following ``` Integer val = Integer.MAX_VALUE * 2; System.out.println("Max val unexpected" + val); ``` \*\* Max val unexpected-2\*\* I know; at the core these datatype...
2010/12/27
[ "https://Stackoverflow.com/questions/4536864", "https://Stackoverflow.com", "https://Stackoverflow.com/users/503095/" ]
Those types are just wrappers for the primitive types, and so it would be unexpected if they behaved differently. One reason those types do not throw those exceptions is that it would be incredibly costly if such checks were performed, and these integral types on the processor don't trigger interrupts when they overflo...
The data types do overflow, your example proves it. What they do not do is throw an exception when overflowing. In Java an Exception generally must be declared, and in doing so, must be caught. Yes, there are some scenarios where this doesn't hold (Errors, RuntimeExceptions, etc.) but such rules hold fast for the MAJO...
4,536,864
Why java Number / Numeric datatypes such as (Integer/Long/...) doesnt throw overflow exception? For example: We get mathematically wrong answer for following ``` Integer val = Integer.MAX_VALUE * 2; System.out.println("Max val unexpected" + val); ``` \*\* Max val unexpected-2\*\* I know; at the core these datatype...
2010/12/27
[ "https://Stackoverflow.com/questions/4536864", "https://Stackoverflow.com", "https://Stackoverflow.com/users/503095/" ]
The data types do overflow, your example proves it. What they do not do is throw an exception when overflowing. In Java an Exception generally must be declared, and in doing so, must be caught. Yes, there are some scenarios where this doesn't hold (Errors, RuntimeExceptions, etc.) but such rules hold fast for the MAJO...
That is the way the specification says it works. Check [4.2 - Primitive Types And Values](http://java.sun.com/docs/books/jls/second_edition/html/typesValues.doc.html) in the Java Specification for more information.
52,147,066
Angular 2 form validation is not working, I can not find where I did mistake. Please help me how to resolve this issue. <https://stackblitz.com/edit/angular-6-reactive-form-validation-jb2snp?file=app/app.component.ts> app.component.ts: ``` this.registerForm = this.formBuilder.group({ userType: ['', Val...
2018/09/03
[ "https://Stackoverflow.com/questions/52147066", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10161204/" ]
problem in your html, for radio button you have to you formControlName and name should be same like this, ``` <div class="col-md-4"> <label> <input type="radio" formControlName="onebhk" name="onebhk" value="yes" /> 1 BHK </label> <label> <input type="radio" formControlName="two...
You should not use **name** and **formControlName** together: [DEMO](https://stackblitz.com/edit/angular-6-reactive-form-validation-mg1xie) Image Of Solution [![enter image description here](https://i.stack.imgur.com/HhqSx.png)](https://i.stack.imgur.com/HhqSx.png) HTML: ``` <!-- main app container --> <div class=...
52,147,066
Angular 2 form validation is not working, I can not find where I did mistake. Please help me how to resolve this issue. <https://stackblitz.com/edit/angular-6-reactive-form-validation-jb2snp?file=app/app.component.ts> app.component.ts: ``` this.registerForm = this.formBuilder.group({ userType: ['', Val...
2018/09/03
[ "https://Stackoverflow.com/questions/52147066", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10161204/" ]
problem in your html, for radio button you have to you formControlName and name should be same like this, ``` <div class="col-md-4"> <label> <input type="radio" formControlName="onebhk" name="onebhk" value="yes" /> 1 BHK </label> <label> <input type="radio" formControlName="two...
remove `name` attribure fom this control `name="onebhk"` and `name="twobhk"` ``` <div class="col-md-4"> <label> <input type="radio" formControlName="onebhk" value="yes" /> 1 BHK </label> <label> <input type="radio" formControlName="twobhk" value="no" /> 2 BHK </label> </div>...
180,095
What type of quality combinations exist? In TF2, there are Strangifiers which can add the Strange Quality to an item. I have seen Strange Genuines, but what other types of combinations exist?
2014/08/14
[ "https://gaming.stackexchange.com/questions/180095", "https://gaming.stackexchange.com", "https://gaming.stackexchange.com/users/9608/" ]
This is a difficult question to answer, because the different qualities that are possible for weapons are [specific to each weapon with almost no rhyme or reason](https://wiki.teamfortress.com/wiki/Item_quality/Possible_weapon_qualities). You can apply a [Strangifier](https://wiki.teamfortress.com/wiki/Strangifier) to...
Well, if you're asking about items, which have 2 types of qualities (Like Genuine Strange, which you already mentioned), yes, there're some, and there isn't many of them. Here's a list of such items.: * **Strange Collector's:** PBPP/Cow Mangler/Air Strike/Righteous Bison/Phlogistonator/Manmelter/Third Degree/Widowmake...
52,314,348
Here I am trying to set a date programmatically using `ng-bootstrap` date picker I tried some thing like this putting the custom date ``` this.model= { "year": 2018, "month": 8, "day": 15 } ``` I know it is not efficient way and there is one issue is that after selecting the giving the date picker is not na...
2018/09/13
[ "https://Stackoverflow.com/questions/52314348", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10267767/" ]
Just use `[startDate]="model"` binding so you will always get to the page when updating model: ``` <ngb-datepicker #dp [(ngModel)]="model" [startDate]="model" (navigate)="date = $event.next"></ngb-datepicker> ``` Or you might navigate the calendar manually via `dp.navigateTo(model)` method: ``` <ngb-datepicker #dp ...
Create NgbDate instance by, ``` date = new NgbDate(2020,19,2); ``` make this date as ngModel; See <https://ng-bootstrap.github.io/#/components/datepicker/api#NgbDate>
3,127,273
Given this equation: $T=\sqrt{(ugx)^2+(T\_0)^2}$ You're asked to isolate $x$. My process was: $T=ugx + T\_0$ (the square root cancelled the exponents) $T-T\_0=ugx$ $x=\frac{T-T\_0}{ug}$ But that was the wrong answer, and they instead followed this process: $T^2=(\sqrt{(ugx)^2+(T\_0)^2})^2$ (squaring both sides) ...
2019/02/26
[ "https://math.stackexchange.com/questions/3127273", "https://math.stackexchange.com", "https://math.stackexchange.com/users/4729/" ]
Instead of using optimisation, you can just solve a nonlinear equation. For each $\alpha$, evolve $x\_{\alpha},y\_{\alpha}$ by solving the corresponding differential equation (with initial condition $y(0)=\alpha$), and define $F(\alpha) = y\_{\alpha}(1) - g(x\_{\alpha}(1))$. Now you "just" need to solve $F(\alpha)=0$. ...
I believe that you have no much better choice than trial & error, but this can be recast as a standard equation resolution problem: the unknown is $y(0)$ and the target function is $y(1)-g(x(1))$, where $x(1)$ and $y(1)$ are obtained by numerical integration, starting from $x(0),y(0)$. You can use a derivative-free me...
334,604
I currently Dual Boot Windows 7 and Ubuntu 13.04. I would like to be able to use Ubuntu as my only OS but unfortunately there are programs for my job that only play with Windows. I know that Virtual Box will allow me to run Ubuntu and have Windows opened in a window as vmware. Unfortunately, it looks like I would be in...
2013/08/19
[ "https://askubuntu.com/questions/334604", "https://askubuntu.com", "https://askubuntu.com/users/185502/" ]
Yes. You need to use the microsoft disk2vhd program to create a VHD copy of your hard drive. You'll likely need a backup drive to put the exported copy on. Before you copy your harddrive, delete all unecessary programs and files. Empty your recycle bin and temporary internet files as well as defrag the harddrive. If th...
VMware offers a convert program which runs on a running Windows system and writes out a virtual machine file, usable with VMplayer.
334,604
I currently Dual Boot Windows 7 and Ubuntu 13.04. I would like to be able to use Ubuntu as my only OS but unfortunately there are programs for my job that only play with Windows. I know that Virtual Box will allow me to run Ubuntu and have Windows opened in a window as vmware. Unfortunately, it looks like I would be in...
2013/08/19
[ "https://askubuntu.com/questions/334604", "https://askubuntu.com", "https://askubuntu.com/users/185502/" ]
Yes. You need to use the microsoft disk2vhd program to create a VHD copy of your hard drive. You'll likely need a backup drive to put the exported copy on. Before you copy your harddrive, delete all unecessary programs and files. Empty your recycle bin and temporary internet files as well as defrag the harddrive. If th...
I am using VM. And VM offers something that is called Shared Folders. You can add folders and access them in VM. More information at: <https://forums.virtualbox.org/viewtopic.php?t=15868>.
29,841,916
How can we concatenate an expression value with some string and evaluate the resulting expression? If we have one object prefix and I wanted to concatenate its value with some string. e.g ``` {{prefix"Output"}} ``` I would like to first evaluate the prefix value and then concatenate it with the "Output" string. ...
2015/04/24
[ "https://Stackoverflow.com/questions/29841916", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1571019/" ]
Since you have first run ionic setup sass as mentioned in the answers, you need to search and identify the variable you want override on the file **\_variables.css** and them you will override in **ionic.app.scss**. For the bar-stable color i do find into \_variable.scss : ``` $bar-stable-text: $button-stable-text !...
add these line in your style.css under /www/css directory ``` .title.title-center.header-item { background-color:#F38023!important; // for bg color margin:0px!important; margin-left:0px!important; color: #ffffff!important; width: 100%; } ```
29,841,916
How can we concatenate an expression value with some string and evaluate the resulting expression? If we have one object prefix and I wanted to concatenate its value with some string. e.g ``` {{prefix"Output"}} ``` I would like to first evaluate the prefix value and then concatenate it with the "Output" string. ...
2015/04/24
[ "https://Stackoverflow.com/questions/29841916", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1571019/" ]
You can do this with SASS. If you haven't already type into terminal ``` $ ionic setup sass ``` You can then use the overrides inside the scss/ directory. ``` $light: #fff !default; $stable: #f8f8f8 !default; $positive: #387ef5 !default; $cal...
Override this Ionic Sass Variable in themes/variables.scss ```css $toolbar-background:#FFFFFF; ``` [You can find other Ionic Sass Variable list here:](http://ionicframework.com/docs/v2/theming/overriding-ionic-variables/)
29,841,916
How can we concatenate an expression value with some string and evaluate the resulting expression? If we have one object prefix and I wanted to concatenate its value with some string. e.g ``` {{prefix"Output"}} ``` I would like to first evaluate the prefix value and then concatenate it with the "Output" string. ...
2015/04/24
[ "https://Stackoverflow.com/questions/29841916", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1571019/" ]
Since you have first run ionic setup sass as mentioned in the answers, you need to search and identify the variable you want override on the file **\_variables.css** and them you will override in **ionic.app.scss**. For the bar-stable color i do find into \_variable.scss : ``` $bar-stable-text: $button-stable-text !...
Override this Ionic Sass Variable in themes/variables.scss ``` $toolbar-title: #fff; ```
29,841,916
How can we concatenate an expression value with some string and evaluate the resulting expression? If we have one object prefix and I wanted to concatenate its value with some string. e.g ``` {{prefix"Output"}} ``` I would like to first evaluate the prefix value and then concatenate it with the "Output" string. ...
2015/04/24
[ "https://Stackoverflow.com/questions/29841916", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1571019/" ]
An easy fix is to use: ``` .custom-dark{ color : #30393A !important; // text background-color:blue!important; // for bg color } ``` This will overide the current css set.. I think its more appropriate to add to style sheet than in the html itself , as its easier for development , modifying and unnecessary...
Since you have first run ionic setup sass as mentioned in the answers, you need to search and identify the variable you want override on the file **\_variables.css** and them you will override in **ionic.app.scss**. For the bar-stable color i do find into \_variable.scss : ``` $bar-stable-text: $button-stable-text !...
29,841,916
How can we concatenate an expression value with some string and evaluate the resulting expression? If we have one object prefix and I wanted to concatenate its value with some string. e.g ``` {{prefix"Output"}} ``` I would like to first evaluate the prefix value and then concatenate it with the "Output" string. ...
2015/04/24
[ "https://Stackoverflow.com/questions/29841916", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1571019/" ]
You can do this with SASS. If you haven't already type into terminal ``` $ ionic setup sass ``` You can then use the overrides inside the scss/ directory. ``` $light: #fff !default; $stable: #f8f8f8 !default; $positive: #387ef5 !default; $cal...
Since you have first run ionic setup sass as mentioned in the answers, you need to search and identify the variable you want override on the file **\_variables.css** and them you will override in **ionic.app.scss**. For the bar-stable color i do find into \_variable.scss : ``` $bar-stable-text: $button-stable-text !...
29,841,916
How can we concatenate an expression value with some string and evaluate the resulting expression? If we have one object prefix and I wanted to concatenate its value with some string. e.g ``` {{prefix"Output"}} ``` I would like to first evaluate the prefix value and then concatenate it with the "Output" string. ...
2015/04/24
[ "https://Stackoverflow.com/questions/29841916", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1571019/" ]
Since you have first run ionic setup sass as mentioned in the answers, you need to search and identify the variable you want override on the file **\_variables.css** and them you will override in **ionic.app.scss**. For the bar-stable color i do find into \_variable.scss : ``` $bar-stable-text: $button-stable-text !...
Override this Ionic Sass Variable in themes/variables.scss ```css $toolbar-background:#FFFFFF; ``` [You can find other Ionic Sass Variable list here:](http://ionicframework.com/docs/v2/theming/overriding-ionic-variables/)
29,841,916
How can we concatenate an expression value with some string and evaluate the resulting expression? If we have one object prefix and I wanted to concatenate its value with some string. e.g ``` {{prefix"Output"}} ``` I would like to first evaluate the prefix value and then concatenate it with the "Output" string. ...
2015/04/24
[ "https://Stackoverflow.com/questions/29841916", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1571019/" ]
An easy fix is to use: ``` .custom-dark{ color : #30393A !important; // text background-color:blue!important; // for bg color } ``` This will overide the current css set.. I think its more appropriate to add to style sheet than in the html itself , as its easier for development , modifying and unnecessary...
Override this Ionic Sass Variable in themes/variables.scss ```css $toolbar-background:#FFFFFF; ``` [You can find other Ionic Sass Variable list here:](http://ionicframework.com/docs/v2/theming/overriding-ionic-variables/)
29,841,916
How can we concatenate an expression value with some string and evaluate the resulting expression? If we have one object prefix and I wanted to concatenate its value with some string. e.g ``` {{prefix"Output"}} ``` I would like to first evaluate the prefix value and then concatenate it with the "Output" string. ...
2015/04/24
[ "https://Stackoverflow.com/questions/29841916", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1571019/" ]
An easy fix is to use: ``` .custom-dark{ color : #30393A !important; // text background-color:blue!important; // for bg color } ``` This will overide the current css set.. I think its more appropriate to add to style sheet than in the html itself , as its easier for development , modifying and unnecessary...
add these line in your style.css under /www/css directory ``` .title.title-center.header-item { background-color:#F38023!important; // for bg color margin:0px!important; margin-left:0px!important; color: #ffffff!important; width: 100%; } ```
29,841,916
How can we concatenate an expression value with some string and evaluate the resulting expression? If we have one object prefix and I wanted to concatenate its value with some string. e.g ``` {{prefix"Output"}} ``` I would like to first evaluate the prefix value and then concatenate it with the "Output" string. ...
2015/04/24
[ "https://Stackoverflow.com/questions/29841916", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1571019/" ]
You can do this with SASS. If you haven't already type into terminal ``` $ ionic setup sass ``` You can then use the overrides inside the scss/ directory. ``` $light: #fff !default; $stable: #f8f8f8 !default; $positive: #387ef5 !default; $cal...
add these line in your style.css under /www/css directory ``` .title.title-center.header-item { background-color:#F38023!important; // for bg color margin:0px!important; margin-left:0px!important; color: #ffffff!important; width: 100%; } ```
29,841,916
How can we concatenate an expression value with some string and evaluate the resulting expression? If we have one object prefix and I wanted to concatenate its value with some string. e.g ``` {{prefix"Output"}} ``` I would like to first evaluate the prefix value and then concatenate it with the "Output" string. ...
2015/04/24
[ "https://Stackoverflow.com/questions/29841916", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1571019/" ]
An easy fix is to use: ``` .custom-dark{ color : #30393A !important; // text background-color:blue!important; // for bg color } ``` This will overide the current css set.. I think its more appropriate to add to style sheet than in the html itself , as its easier for development , modifying and unnecessary...
Override this Ionic Sass Variable in themes/variables.scss ``` $toolbar-title: #fff; ```
68,083,864
I want to save HTML source of my pugfile rendered with data. My route is: ``` res.render('pugfile', { data: resp }); ``` How can I do that?
2021/06/22
[ "https://Stackoverflow.com/questions/68083864", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1894592/" ]
There's a callback from .render(). ```js res.render('pugfile', { data: resp }, function (err, pageBody) { if (err) throw err /* manipulate pageBody as you will, * but be sure to .send it to the browser if * you use this callback. */ res.send(pageBody) }) ``` See [here](https://stackoverflow.com...
Try using this link and see whether it will be helpfull to you [link to possible answer](https://stackoverflow.com/a/61239305/15770919 "https://stackoverflow.com/a/61239305/15770919") `The createTemplateFile function simply creates a new file if it doesn't exist.` `The exportTemplateFile function saves the HTML ...
651,698
**When they are represented in memory, are C++ objects the same as C structs?** For example, with C, I could do something like this: ``` struct myObj { int myInt; char myVarChar; }; int main() { myObj * testObj = (myObj *) malloc(sizeof(int)+5); testObj->myInt = 3; strcpy((char*)&t...
2009/03/16
[ "https://Stackoverflow.com/questions/651698", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You should not waste your time writing string classes - there's a reason people spent time writing them in the first place and it's naive to think they wrote them because they wanted to create big obfuscated and overheaded code that you could easily improve in a matter of hours. For example your code has quadratic com...
I do not think 'this' works the way you think it works. Specifically, you *cannot* reallocate this to point to a larger buffer in a member function, because whatever called that member function still has a pointer to the old 'this'. Since it's not passed by reference there is no way that you can update it. The obviou...
651,698
**When they are represented in memory, are C++ objects the same as C structs?** For example, with C, I could do something like this: ``` struct myObj { int myInt; char myVarChar; }; int main() { myObj * testObj = (myObj *) malloc(sizeof(int)+5); testObj->myInt = 3; strcpy((char*)&t...
2009/03/16
[ "https://Stackoverflow.com/questions/651698", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
There is a lot a wrong with your class definition/usage. If you want to store a string you should use a pointer type, like char\* a member, not an individual char. Using a single char means that only a single character of memory is allocated. Another mistake is the allocation code where you do a realloc on this - you ...
You are moving the "this" pointer. Thats not going to work. I think what you really want is just a wrapper around a buffer.
651,698
**When they are represented in memory, are C++ objects the same as C structs?** For example, with C, I could do something like this: ``` struct myObj { int myInt; char myVarChar; }; int main() { myObj * testObj = (myObj *) malloc(sizeof(int)+5); testObj->myInt = 3; strcpy((char*)&t...
2009/03/16
[ "https://Stackoverflow.com/questions/651698", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Why do you write in C with classes, why don't use C++?
If you want performance, you can write your class like this: ``` template<int max_size> class MyString { public: size_t size; char contents[max_size]; public: MyString(const char* data); }; ``` Initialize max\_size to an appropriate value under context. In this way the object can be created on stack, and n...
651,698
**When they are represented in memory, are C++ objects the same as C structs?** For example, with C, I could do something like this: ``` struct myObj { int myInt; char myVarChar; }; int main() { myObj * testObj = (myObj *) malloc(sizeof(int)+5); testObj->myInt = 3; strcpy((char*)&t...
2009/03/16
[ "https://Stackoverflow.com/questions/651698", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Wow. What you're trying to do is a complete abuse of C++, would be totally compiler dependent if it worked, and would surely land you in TheDailyWTF some day. The reason you're getting a segfault is probably because your operator= is reallocating the object to a different address, but you're not updating the myString ...
You cannot change the size of an object/struct in either C or C++. Their sizes are fixed at compile time.
651,698
**When they are represented in memory, are C++ objects the same as C structs?** For example, with C, I could do something like this: ``` struct myObj { int myInt; char myVarChar; }; int main() { myObj * testObj = (myObj *) malloc(sizeof(int)+5); testObj->myInt = 3; strcpy((char*)&t...
2009/03/16
[ "https://Stackoverflow.com/questions/651698", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Wow. What you're trying to do is a complete abuse of C++, would be totally compiler dependent if it worked, and would surely land you in TheDailyWTF some day. The reason you're getting a segfault is probably because your operator= is reallocating the object to a different address, but you're not updating the myString ...
Why do you write in C with classes, why don't use C++?
651,698
**When they are represented in memory, are C++ objects the same as C structs?** For example, with C, I could do something like this: ``` struct myObj { int myInt; char myVarChar; }; int main() { myObj * testObj = (myObj *) malloc(sizeof(int)+5); testObj->myInt = 3; strcpy((char*)&t...
2009/03/16
[ "https://Stackoverflow.com/questions/651698", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You can't realloc C++ objects. As others pointed out `this` is not really a pointer you can modify, there's no guarantee that it will be pointing to an area `realloc` has access. One solution to concatenation is to implement a class hierarchy that will defer the real concatenation until it is needed. Something like ...
If you want performance, you can write your class like this: ``` template<int max_size> class MyString { public: size_t size; char contents[max_size]; public: MyString(const char* data); }; ``` Initialize max\_size to an appropriate value under context. In this way the object can be created on stack, and n...
651,698
**When they are represented in memory, are C++ objects the same as C structs?** For example, with C, I could do something like this: ``` struct myObj { int myInt; char myVarChar; }; int main() { myObj * testObj = (myObj *) malloc(sizeof(int)+5); testObj->myInt = 3; strcpy((char*)&t...
2009/03/16
[ "https://Stackoverflow.com/questions/651698", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Wow. What you're trying to do is a complete abuse of C++, would be totally compiler dependent if it worked, and would surely land you in TheDailyWTF some day. The reason you're getting a segfault is probably because your operator= is reallocating the object to a different address, but you're not updating the myString ...
don't mind the lack of const correctness, as this is a mock up, but how about this: ``` class light_string { public: light_string(const char* str) { size_t length = strlen(str); char* buffer = new char[sizeof(size_t) + length + 1]; memcpy(buffer, &length, sizeof(size_t)); memcpy(b...
651,698
**When they are represented in memory, are C++ objects the same as C structs?** For example, with C, I could do something like this: ``` struct myObj { int myInt; char myVarChar; }; int main() { myObj * testObj = (myObj *) malloc(sizeof(int)+5); testObj->myInt = 3; strcpy((char*)&t...
2009/03/16
[ "https://Stackoverflow.com/questions/651698", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You should not waste your time writing string classes - there's a reason people spent time writing them in the first place and it's naive to think they wrote them because they wanted to create big obfuscated and overheaded code that you could easily improve in a matter of hours. For example your code has quadratic com...
You are moving the "this" pointer. Thats not going to work. I think what you really want is just a wrapper around a buffer.
651,698
**When they are represented in memory, are C++ objects the same as C structs?** For example, with C, I could do something like this: ``` struct myObj { int myInt; char myVarChar; }; int main() { myObj * testObj = (myObj *) malloc(sizeof(int)+5); testObj->myInt = 3; strcpy((char*)&t...
2009/03/16
[ "https://Stackoverflow.com/questions/651698", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
> > when they are represented in memory are objects C++ objects the same as C structs. > > > Strictly speaking, no. In general, yes. C++ classes and structs are identical in memory layout to C structs except: * Bit fields have different packing rules * Sizes are fixed at compile time * If there are any virtual fu...
``` #include <iostream> using namespace std; class pString { public: char c[1]; pString * pString::operator=(const char *); }; pString * pString::operator=(const char * buff) { cout << "Address of this: " << (uint32_t) this << endl; cout << "Address of ...
651,698
**When they are represented in memory, are C++ objects the same as C structs?** For example, with C, I could do something like this: ``` struct myObj { int myInt; char myVarChar; }; int main() { myObj * testObj = (myObj *) malloc(sizeof(int)+5); testObj->myInt = 3; strcpy((char*)&t...
2009/03/16
[ "https://Stackoverflow.com/questions/651698", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You cannot change the size of an object/struct in either C or C++. Their sizes are fixed at compile time.
This code is a mess and RnR and others suggested is not advisable. But it works for what i want it to do: ``` #include <iostream> using namespace std; struct pString { /* No Member Variables, the data is the object */ /* This class cannot be extended & will destroy a vtable */ public: pSt...
7,723,870
Okay, so I realised after writing some overloaded methods that webmethods can't be overloaded (by realised I mean VS threw a paddy and wouldn't allow me to update the service references). I have tried to get around that like this: ``` public string DoPing<T>(T IP) { if (typeof(T) == typeof(string)) ...
2011/10/11
[ "https://Stackoverflow.com/questions/7723870", "https://Stackoverflow.com", "https://Stackoverflow.com/users/778197/" ]
Try using `Convert.ChangeType` method then cast as usual: ``` if (typeof(T) == typeof(string)) { return DoPingString((string)Convert.ChangeType(IP, typeof(string))); } if (typeof(T) == typeof(IPAddress)) { return DoPingIP((IPAddress)Convert.ChangeType(IP, typeof(IPAddress))); } ```
I would better do this: ``` public string DoPing(IPAddress ip) { ...logic... } public string DoPing(String ip) { ...logic... } ``` Try to avoid unnecessary patterns and templates.
7,723,870
Okay, so I realised after writing some overloaded methods that webmethods can't be overloaded (by realised I mean VS threw a paddy and wouldn't allow me to update the service references). I have tried to get around that like this: ``` public string DoPing<T>(T IP) { if (typeof(T) == typeof(string)) ...
2011/10/11
[ "https://Stackoverflow.com/questions/7723870", "https://Stackoverflow.com", "https://Stackoverflow.com/users/778197/" ]
You're not using generics the way it was intended. The compiler has no idea what type T is, so it won't just let you implicitly or explicitly cast to String or IPAddress. Here's a version that works: ``` public string DoPing<T>(T IP) { if (typeof(T) == typeof(string)) { return DoPi...
Try using `Convert.ChangeType` method then cast as usual: ``` if (typeof(T) == typeof(string)) { return DoPingString((string)Convert.ChangeType(IP, typeof(string))); } if (typeof(T) == typeof(IPAddress)) { return DoPingIP((IPAddress)Convert.ChangeType(IP, typeof(IPAddress))); } ```
7,723,870
Okay, so I realised after writing some overloaded methods that webmethods can't be overloaded (by realised I mean VS threw a paddy and wouldn't allow me to update the service references). I have tried to get around that like this: ``` public string DoPing<T>(T IP) { if (typeof(T) == typeof(string)) ...
2011/10/11
[ "https://Stackoverflow.com/questions/7723870", "https://Stackoverflow.com", "https://Stackoverflow.com/users/778197/" ]
You can use `WebMethodAttribute` : ``` [WebMethod(MessageName = "DoPingIPAddress")] public string DoPing(IPAddress ip) { } [WebMethod(MessageName = "DoPingString")] public string DoPing(string ip) { } ``` But from the client side, you'll have two different methods : it's web services/SOAP constraints. [Documentati...
Try using `Convert.ChangeType` method then cast as usual: ``` if (typeof(T) == typeof(string)) { return DoPingString((string)Convert.ChangeType(IP, typeof(string))); } if (typeof(T) == typeof(IPAddress)) { return DoPingIP((IPAddress)Convert.ChangeType(IP, typeof(IPAddress))); } ```
7,723,870
Okay, so I realised after writing some overloaded methods that webmethods can't be overloaded (by realised I mean VS threw a paddy and wouldn't allow me to update the service references). I have tried to get around that like this: ``` public string DoPing<T>(T IP) { if (typeof(T) == typeof(string)) ...
2011/10/11
[ "https://Stackoverflow.com/questions/7723870", "https://Stackoverflow.com", "https://Stackoverflow.com/users/778197/" ]
You're not using generics the way it was intended. The compiler has no idea what type T is, so it won't just let you implicitly or explicitly cast to String or IPAddress. Here's a version that works: ``` public string DoPing<T>(T IP) { if (typeof(T) == typeof(string)) { return DoPi...
I would better do this: ``` public string DoPing(IPAddress ip) { ...logic... } public string DoPing(String ip) { ...logic... } ``` Try to avoid unnecessary patterns and templates.
7,723,870
Okay, so I realised after writing some overloaded methods that webmethods can't be overloaded (by realised I mean VS threw a paddy and wouldn't allow me to update the service references). I have tried to get around that like this: ``` public string DoPing<T>(T IP) { if (typeof(T) == typeof(string)) ...
2011/10/11
[ "https://Stackoverflow.com/questions/7723870", "https://Stackoverflow.com", "https://Stackoverflow.com/users/778197/" ]
You can use `WebMethodAttribute` : ``` [WebMethod(MessageName = "DoPingIPAddress")] public string DoPing(IPAddress ip) { } [WebMethod(MessageName = "DoPingString")] public string DoPing(string ip) { } ``` But from the client side, you'll have two different methods : it's web services/SOAP constraints. [Documentati...
I would better do this: ``` public string DoPing(IPAddress ip) { ...logic... } public string DoPing(String ip) { ...logic... } ``` Try to avoid unnecessary patterns and templates.
7,723,870
Okay, so I realised after writing some overloaded methods that webmethods can't be overloaded (by realised I mean VS threw a paddy and wouldn't allow me to update the service references). I have tried to get around that like this: ``` public string DoPing<T>(T IP) { if (typeof(T) == typeof(string)) ...
2011/10/11
[ "https://Stackoverflow.com/questions/7723870", "https://Stackoverflow.com", "https://Stackoverflow.com/users/778197/" ]
It sounds like you want the `KnownTypeAttribute` available in WCF. But seeing as you can't use that here and you definitely want only one method then I think the only way is to just offer two parameters. Just add some validation to check for nulls and pass them on to your private helper methods. ``` [WebMethod] publi...
I would better do this: ``` public string DoPing(IPAddress ip) { ...logic... } public string DoPing(String ip) { ...logic... } ``` Try to avoid unnecessary patterns and templates.
7,723,870
Okay, so I realised after writing some overloaded methods that webmethods can't be overloaded (by realised I mean VS threw a paddy and wouldn't allow me to update the service references). I have tried to get around that like this: ``` public string DoPing<T>(T IP) { if (typeof(T) == typeof(string)) ...
2011/10/11
[ "https://Stackoverflow.com/questions/7723870", "https://Stackoverflow.com", "https://Stackoverflow.com/users/778197/" ]
You're not using generics the way it was intended. The compiler has no idea what type T is, so it won't just let you implicitly or explicitly cast to String or IPAddress. Here's a version that works: ``` public string DoPing<T>(T IP) { if (typeof(T) == typeof(string)) { return DoPi...
It sounds like you want the `KnownTypeAttribute` available in WCF. But seeing as you can't use that here and you definitely want only one method then I think the only way is to just offer two parameters. Just add some validation to check for nulls and pass them on to your private helper methods. ``` [WebMethod] publi...
7,723,870
Okay, so I realised after writing some overloaded methods that webmethods can't be overloaded (by realised I mean VS threw a paddy and wouldn't allow me to update the service references). I have tried to get around that like this: ``` public string DoPing<T>(T IP) { if (typeof(T) == typeof(string)) ...
2011/10/11
[ "https://Stackoverflow.com/questions/7723870", "https://Stackoverflow.com", "https://Stackoverflow.com/users/778197/" ]
You can use `WebMethodAttribute` : ``` [WebMethod(MessageName = "DoPingIPAddress")] public string DoPing(IPAddress ip) { } [WebMethod(MessageName = "DoPingString")] public string DoPing(string ip) { } ``` But from the client side, you'll have two different methods : it's web services/SOAP constraints. [Documentati...
It sounds like you want the `KnownTypeAttribute` available in WCF. But seeing as you can't use that here and you definitely want only one method then I think the only way is to just offer two parameters. Just add some validation to check for nulls and pass them on to your private helper methods. ``` [WebMethod] publi...
1,983,881
Find integers $ a,b, $ and $ c $ where $ \gcd(a,b,c) = 1 $, but $ \gcd(a,b) \neq 1 $, $ \gcd(a,c) \neq 1 $, and $ \gcd(b,c) \neq 1 $. I tried so many combinations but I can't find 3 integers that meet these requirements. I even though $ (0,0,0) $ works, because I tried to convince myself 1 is the first positive inte...
2016/10/25
[ "https://math.stackexchange.com/questions/1983881", "https://math.stackexchange.com", "https://math.stackexchange.com/users/372301/" ]
Consider $a = 6, b= 10, c = 15$ An easy way to construct these is by considering three prime $2, 3, 5$, then pairwise multiply them.
Choose any three prime numbers $p,q,r$ and create the products $pq,qr,pr$. Each product lacks one of the prime factors, so the largest number that divides all three is $1$, but every pair of products has a factor in common, and hence a gcd greater than $1$. This is a generalization of the rather specific answer given f...
14,210,507
I am trying to load an xml file that is on my local system. But I always get Network\_err. I do the following. ``` function LoadXmlDoc(dName) { var xhttp; if(window.XMLHttpRequest) { xhttp = new XMLHttpRequest(); } else { xhttp = new ActiveXObject("Microsoft.XMLHTTP"); } ...
2013/01/08
[ "https://Stackoverflow.com/questions/14210507", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1651158/" ]
Firstly they way this im implemented is not awesome. There is a lot that could be done better but Im not going to try to change you implementation here... :) To do what you want to do, that is access a global variable without knowing its actual name, can be done like this. ``` window[drugname + "qty"] = drugqty; ```...
You can use the [`eval()`](http://www.w3schools.com/jsref/jsref_eval.asp) function for this: ``` eval(drugname+"qty"=drugqty); ``` *Note*: It would be much better to learn about Object Oriented programming. So you can make a `Drug` [class](https://stackoverflow.com/questions/387707/whats-the-best-way-to-define-a-cla...
14,210,507
I am trying to load an xml file that is on my local system. But I always get Network\_err. I do the following. ``` function LoadXmlDoc(dName) { var xhttp; if(window.XMLHttpRequest) { xhttp = new XMLHttpRequest(); } else { xhttp = new ActiveXObject("Microsoft.XMLHTTP"); } ...
2013/01/08
[ "https://Stackoverflow.com/questions/14210507", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1651158/" ]
Firstly they way this im implemented is not awesome. There is a lot that could be done better but Im not going to try to change you implementation here... :) To do what you want to do, that is access a global variable without knowing its actual name, can be done like this. ``` window[drugname + "qty"] = drugqty; ```...
You could save all your quantities in a single object and add a property per drug. ``` var quantities = {}; quantities[drugname + "qty"] = drugqty; ``` But, if you want to display the results also, it might be easier to leave out the "qty"-part: ``` var quantities = {}; quantities[drugname] = drugqty; ``` And for...
44,055,342
I'm looking for good regex in java to get string url from all links and all emails. Now I have regex for links: ``` String linkRegex = "http[s]*://(\\w+\\.)*(\\w+)"; Pattern pattern = Pattern.compile(linkRegex); Matcher matcher = pattern.matcher(stringAddres); while (matcher.find()) { Str...
2017/05/18
[ "https://Stackoverflow.com/questions/44055342", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7600032/" ]
> > 1) What is `vars()` doing in the below code > > > Honestly, it's hard to tell. `vars()` (without an argument) returns the local namespace as a dictionary. In other words, it does the same thing as [`locals()`](https://docs.python.org/2/library/functions.html#locals). In your code, you then look up a name (`dic...
First, you shouldn't overwrite `__builtin__` functions. `dict` is a reserved name for a function used to create dictionary objects. Second, `var` gives you access to name declarations within the current running scope.
44,055,342
I'm looking for good regex in java to get string url from all links and all emails. Now I have regex for links: ``` String linkRegex = "http[s]*://(\\w+\\.)*(\\w+)"; Pattern pattern = Pattern.compile(linkRegex); Matcher matcher = pattern.matcher(stringAddres); while (matcher.find()) { Str...
2017/05/18
[ "https://Stackoverflow.com/questions/44055342", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7600032/" ]
> > What is vars() actually doing in the below code? > > > It does what it always does: it retrieves all local variables as a dictionary. That's how it works when calling `vars` *without* arguments. > > Why is the vars() necessary in front of the dictionary I created and could I leave it out? > > > It seems ...
First, you shouldn't overwrite `__builtin__` functions. `dict` is a reserved name for a function used to create dictionary objects. Second, `var` gives you access to name declarations within the current running scope.
41,140,658
suppose I have the following three models, see as follow: I wanna to construct a Django model query to archive the same effect as the following SQL statement. **SQL statement** ``` select B.value, C.special from B inner join C where B.version = C.version and B.order = C.order; ``` I got the following three models:...
2016/12/14
[ "https://Stackoverflow.com/questions/41140658", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3628275/" ]
Use [`zip()`](https://docs.python.org/3/library/functions.html#zip) like this: ``` amp = ['a1', 'a2', 'a3', 'a4'] mass = ['m1', 'm2', 'm3', 'm4'] period = ['p1', 'p2', 'p3', 'p4'] ecc = ['e1', 'e2', 'e3', 'e4'] planet = [1, 2, 3, 4] titles = ['planet', 'amp', 'mass', 'period', 'ecc'] print '{:<6}|{:<6}|{:<6}|{:<6}|{...
You can use `\t`. For example: ``` print 'a\t','b\t','\n','c\t','d\t' ``` output: ``` a b c d ```
41,140,658
suppose I have the following three models, see as follow: I wanna to construct a Django model query to archive the same effect as the following SQL statement. **SQL statement** ``` select B.value, C.special from B inner join C where B.version = C.version and B.order = C.order; ``` I got the following three models:...
2016/12/14
[ "https://Stackoverflow.com/questions/41140658", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3628275/" ]
tabulate.tabulate() takes a list of lists (or arrays) as its main argument, you've given it a list of floats (and a '1'). So you want to put in all your data at once. You'll need to create new lists where each is one horizontal row of the new table. You'll also need to add the row number at the front. First build ne...
You can use `\t`. For example: ``` print 'a\t','b\t','\n','c\t','d\t' ``` output: ``` a b c d ```
41,140,658
suppose I have the following three models, see as follow: I wanna to construct a Django model query to archive the same effect as the following SQL statement. **SQL statement** ``` select B.value, C.special from B inner join C where B.version = C.version and B.order = C.order; ``` I got the following three models:...
2016/12/14
[ "https://Stackoverflow.com/questions/41140658", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3628275/" ]
You can combine the usage of [zip()](https://docs.python.org/3/library/functions.html#zip) with [tabulate](https://pypi.python.org/pypi/tabulate) to create a nicer looking table: ```python from tabulate import tabulate headers = ['planet', 'amp', 'mass', 'period', 'ecc'] amp = [1.1, 1.2, 1.3, 1.4] mass = [2.1, 2....
You can use `\t`. For example: ``` print 'a\t','b\t','\n','c\t','d\t' ``` output: ``` a b c d ```
41,140,658
suppose I have the following three models, see as follow: I wanna to construct a Django model query to archive the same effect as the following SQL statement. **SQL statement** ``` select B.value, C.special from B inner join C where B.version = C.version and B.order = C.order; ``` I got the following three models:...
2016/12/14
[ "https://Stackoverflow.com/questions/41140658", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3628275/" ]
Use [`zip()`](https://docs.python.org/3/library/functions.html#zip) like this: ``` amp = ['a1', 'a2', 'a3', 'a4'] mass = ['m1', 'm2', 'm3', 'm4'] period = ['p1', 'p2', 'p3', 'p4'] ecc = ['e1', 'e2', 'e3', 'e4'] planet = [1, 2, 3, 4] titles = ['planet', 'amp', 'mass', 'period', 'ecc'] print '{:<6}|{:<6}|{:<6}|{:<6}|{...
tabulate.tabulate() takes a list of lists (or arrays) as its main argument, you've given it a list of floats (and a '1'). So you want to put in all your data at once. You'll need to create new lists where each is one horizontal row of the new table. You'll also need to add the row number at the front. First build ne...
41,140,658
suppose I have the following three models, see as follow: I wanna to construct a Django model query to archive the same effect as the following SQL statement. **SQL statement** ``` select B.value, C.special from B inner join C where B.version = C.version and B.order = C.order; ``` I got the following three models:...
2016/12/14
[ "https://Stackoverflow.com/questions/41140658", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3628275/" ]
You can combine the usage of [zip()](https://docs.python.org/3/library/functions.html#zip) with [tabulate](https://pypi.python.org/pypi/tabulate) to create a nicer looking table: ```python from tabulate import tabulate headers = ['planet', 'amp', 'mass', 'period', 'ecc'] amp = [1.1, 1.2, 1.3, 1.4] mass = [2.1, 2....
tabulate.tabulate() takes a list of lists (or arrays) as its main argument, you've given it a list of floats (and a '1'). So you want to put in all your data at once. You'll need to create new lists where each is one horizontal row of the new table. You'll also need to add the row number at the front. First build ne...
63,500
I wonder what are some good sample ways for breaking down tedious processes, e.g., creation of long content. Most sites present long forms - for example, eBay presents one long form for the details of a selling item. In contrast, I fairly like the way Airbnb breaks down the listing process into, first, a clean outline ...
2014/08/25
[ "https://ux.stackexchange.com/questions/63500", "https://ux.stackexchange.com", "https://ux.stackexchange.com/users/53484/" ]
You're asking how to make it **extremely obvious**, so you could write *Click to select other dates* into the textfield. E.g. *24 August, 2014 (click to select other dates)*
By virtue of having a control which resembles a text field and a button, you have already provided the user with something he or she knows can be clicked. I would also suggest adding placeholder text ('Enter a date...' perhaps?) rather than a default date to prevent the user from assuming that the default date is uncha...
63,500
I wonder what are some good sample ways for breaking down tedious processes, e.g., creation of long content. Most sites present long forms - for example, eBay presents one long form for the details of a selling item. In contrast, I fairly like the way Airbnb breaks down the listing process into, first, a clean outline ...
2014/08/25
[ "https://ux.stackexchange.com/questions/63500", "https://ux.stackexchange.com", "https://ux.stackexchange.com/users/53484/" ]
You're asking how to make it **extremely obvious**, so you could write *Click to select other dates* into the textfield. E.g. *24 August, 2014 (click to select other dates)*
If you want it to be extremely obvious, that the user should click on the button to select a date, I suggest you add a label to the button or replace the icon with a label. The label could say something like "Change Date", or maybe just "Change" or "Select," given that it follows a text control that already contains a ...
7,398,850
Why this code always return 0 ``` public int loveCal(String bname, String gname) { char[] boy_name = bname.toLowerCase().toCharArray(); char[] girl_name = gname.toLowerCase().toCharArray(); int boy = 0; int girl = 0; int love = 0; for(int i = 0; i < bname.length(); i++) boy += (int) ...
2011/09/13
[ "https://Stackoverflow.com/questions/7398850", "https://Stackoverflow.com", "https://Stackoverflow.com/users/757634/" ]
You probably need to do floating point calculations or maybe just change the order, to avoid rounding intermediate results down to 0 when everything is done with integers. ``` return 100.0 * girl / boy; // using floating points // or maybe just return 100 * girl / boy; // using int, but multiplying first ```
It's because of this division: ``` (girl/boy) ``` Using int, if this results in a fractionary number, returned int will be 0. Use floats or double instead.