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 |
|---|---|---|---|---|---|
12,242,879 | In my project I have to select multiple values and pass it to a query. i.e page1 contains checkboxes. I am storing the selected checkbox id's into an array.
I am shuffling that array and getting the values randomly. Now I need to pass these random values to a query. Using IN operator in database I can pass the values
... | 2012/09/03 | [
"https://Stackoverflow.com/questions/12242879",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1455252/"
] | You can generate your query like this
```
int values[]; //it contains your generated values like 21,22....
String query="SELECT * FROM Persons WHERE person_id IN (";
for(int i=0;i<values.length;i++){
query=query+"'"+values[i]+"'";
if(i<values.length-1){
query=query+","; //No , after last values
}
}
query+="... | Try it
```
cursor = database.query(tablename,
new String[] {"TopName"}, "id IN(?,?)", new String[]{"2","3"}, null, null, null);
```
using raw query
```
String query = "SELECT * FROM Persons WHERE person_id IN ("+parameter1+","+parameter2+")";
db.rawQuery(query);
``` |
12,242,879 | In my project I have to select multiple values and pass it to a query. i.e page1 contains checkboxes. I am storing the selected checkbox id's into an array.
I am shuffling that array and getting the values randomly. Now I need to pass these random values to a query. Using IN operator in database I can pass the values
... | 2012/09/03 | [
"https://Stackoverflow.com/questions/12242879",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1455252/"
] | `String query = "SELECT * FROM Persons WHERE person_id IN (" + TextUtils.join(",", chksublist) + ")";`
But shuffling the `chksublist` before sending it to your SQL query has no impact on the result set you get from SQL. It will not randomly permute your results. Remove `Collections.shuffle(chksublist);` and use
`Stri... | You can generate your query like this
```
int values[]; //it contains your generated values like 21,22....
String query="SELECT * FROM Persons WHERE person_id IN (";
for(int i=0;i<values.length;i++){
query=query+"'"+values[i]+"'";
if(i<values.length-1){
query=query+","; //No , after last values
}
}
query+="... |
12,242,879 | In my project I have to select multiple values and pass it to a query. i.e page1 contains checkboxes. I am storing the selected checkbox id's into an array.
I am shuffling that array and getting the values randomly. Now I need to pass these random values to a query. Using IN operator in database I can pass the values
... | 2012/09/03 | [
"https://Stackoverflow.com/questions/12242879",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1455252/"
] | `String query = "SELECT * FROM Persons WHERE person_id IN (" + TextUtils.join(",", chksublist) + ")";`
But shuffling the `chksublist` before sending it to your SQL query has no impact on the result set you get from SQL. It will not randomly permute your results. Remove `Collections.shuffle(chksublist);` and use
`Stri... | Try it
```
cursor = database.query(tablename,
new String[] {"TopName"}, "id IN(?,?)", new String[]{"2","3"}, null, null, null);
```
using raw query
```
String query = "SELECT * FROM Persons WHERE person_id IN ("+parameter1+","+parameter2+")";
db.rawQuery(query);
``` |
107,973 | [iOS Human Interface Guidelines](https://developer.apple.com/ios/human-interface-guidelines/graphics/launch-screen/) say:
>
> Design a launch screen that’s nearly identical to the first screen
> of your app. If you include elements that look different when the app
> finishes launching, people can experience an unpl... | 2017/05/13 | [
"https://ux.stackexchange.com/questions/107973",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/68624/"
] | Maybe they are using other guidelines. You have the iOS Human Interface Guidelines, but also Material Design Guidelines. They are not OS-bound. Google applications on iOS also use Material Design. [Material Design guidelines](https://material.io/guidelines/patterns/launch-screens.html#launch-screens-types-of-launch-scr... | I know that in some cases splash screens are a must due to technical reasons. Depending on how the code of the app is written, it may take some time for the app to load when launched so splash screens are used for that reason. |
19,564,281 | I am trying to submit this form without refreshing the page , but when i submit it takes me to action page. what is wrong with my code?
This is my form:
```
<form class="ajax" action="/../addchannel/createUser.php" method="post" >
<input type="text" name="userName" placeholder="userName"><br>
<input type="text" name="... | 2013/10/24 | [
"https://Stackoverflow.com/questions/19564281",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2866602/"
] | You forgot `return false` at the end or prevent default.
```
$('form.ajax').on('submit', function (event) {
event.preventDefault();
var that = $(this),
url = that.attr('action'),
type = that.attr('method'),
data = {};
....
//or return false;
});
``` | Use [e.preventDefault()](http://api.jquery.com/event.preventDefault/) or `return false;` to prevent form submitting
```
$('form.ajax').on('submit', function (e) {//Pass the event argument here
var that = $(this),
url = that.attr('action'),
type = that.attr('method'),
data = {};
that.fi... |
19,564,281 | I am trying to submit this form without refreshing the page , but when i submit it takes me to action page. what is wrong with my code?
This is my form:
```
<form class="ajax" action="/../addchannel/createUser.php" method="post" >
<input type="text" name="userName" placeholder="userName"><br>
<input type="text" name="... | 2013/10/24 | [
"https://Stackoverflow.com/questions/19564281",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2866602/"
] | You forgot `return false` at the end or prevent default.
```
$('form.ajax').on('submit', function (event) {
event.preventDefault();
var that = $(this),
url = that.attr('action'),
type = that.attr('method'),
data = {};
....
//or return false;
});
``` | Use [event.preventDefault()](http://api.jquery.com/event.preventDefault/)
```
$('form.ajax').on('submit', function (e) {
e.preventDefault();
//code here
});
``` |
19,564,281 | I am trying to submit this form without refreshing the page , but when i submit it takes me to action page. what is wrong with my code?
This is my form:
```
<form class="ajax" action="/../addchannel/createUser.php" method="post" >
<input type="text" name="userName" placeholder="userName"><br>
<input type="text" name="... | 2013/10/24 | [
"https://Stackoverflow.com/questions/19564281",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2866602/"
] | You forgot `return false` at the end or prevent default.
```
$('form.ajax').on('submit', function (event) {
event.preventDefault();
var that = $(this),
url = that.attr('action'),
type = that.attr('method'),
data = {};
....
//or return false;
});
``` | try this..
```
<form method='post' action="javascript:mail();" >
<input type="text" class="input-large" id="user_name" name="name">
<input type="text" class="input-large" id="email" name="name">
<button type="submit" class="btn btn-primary">Submit</a>
</form>
function mail()
{
var name = $("#user_name").val();
var em... |
19,564,281 | I am trying to submit this form without refreshing the page , but when i submit it takes me to action page. what is wrong with my code?
This is my form:
```
<form class="ajax" action="/../addchannel/createUser.php" method="post" >
<input type="text" name="userName" placeholder="userName"><br>
<input type="text" name="... | 2013/10/24 | [
"https://Stackoverflow.com/questions/19564281",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2866602/"
] | You forgot `return false` at the end or prevent default.
```
$('form.ajax').on('submit', function (event) {
event.preventDefault();
var that = $(this),
url = that.attr('action'),
type = that.attr('method'),
data = {};
....
//or return false;
});
``` | Using jQuery ajax is not preventing browser to follow Form Action page.
To achieve this, you should prevent browser to do it by simple function: [e.preventDefault()](http://api.jquery.com/event.preventDefault/)
Here is you code:
```
//Pass the event argument (e)
$('form.ajax').on('submit', function (e) {
var tha... |
19,564,281 | I am trying to submit this form without refreshing the page , but when i submit it takes me to action page. what is wrong with my code?
This is my form:
```
<form class="ajax" action="/../addchannel/createUser.php" method="post" >
<input type="text" name="userName" placeholder="userName"><br>
<input type="text" name="... | 2013/10/24 | [
"https://Stackoverflow.com/questions/19564281",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2866602/"
] | Pass event as argument and use `event.preventDefault()`.
**Example**
```
$('form.ajax').on('submit', function (e) {
e.preventDefault();
``` | Use [e.preventDefault()](http://api.jquery.com/event.preventDefault/) or `return false;` to prevent form submitting
```
$('form.ajax').on('submit', function (e) {//Pass the event argument here
var that = $(this),
url = that.attr('action'),
type = that.attr('method'),
data = {};
that.fi... |
19,564,281 | I am trying to submit this form without refreshing the page , but when i submit it takes me to action page. what is wrong with my code?
This is my form:
```
<form class="ajax" action="/../addchannel/createUser.php" method="post" >
<input type="text" name="userName" placeholder="userName"><br>
<input type="text" name="... | 2013/10/24 | [
"https://Stackoverflow.com/questions/19564281",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2866602/"
] | Pass event as argument and use `event.preventDefault()`.
**Example**
```
$('form.ajax').on('submit', function (e) {
e.preventDefault();
``` | Use [event.preventDefault()](http://api.jquery.com/event.preventDefault/)
```
$('form.ajax').on('submit', function (e) {
e.preventDefault();
//code here
});
``` |
19,564,281 | I am trying to submit this form without refreshing the page , but when i submit it takes me to action page. what is wrong with my code?
This is my form:
```
<form class="ajax" action="/../addchannel/createUser.php" method="post" >
<input type="text" name="userName" placeholder="userName"><br>
<input type="text" name="... | 2013/10/24 | [
"https://Stackoverflow.com/questions/19564281",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2866602/"
] | Pass event as argument and use `event.preventDefault()`.
**Example**
```
$('form.ajax').on('submit', function (e) {
e.preventDefault();
``` | try this..
```
<form method='post' action="javascript:mail();" >
<input type="text" class="input-large" id="user_name" name="name">
<input type="text" class="input-large" id="email" name="name">
<button type="submit" class="btn btn-primary">Submit</a>
</form>
function mail()
{
var name = $("#user_name").val();
var em... |
19,564,281 | I am trying to submit this form without refreshing the page , but when i submit it takes me to action page. what is wrong with my code?
This is my form:
```
<form class="ajax" action="/../addchannel/createUser.php" method="post" >
<input type="text" name="userName" placeholder="userName"><br>
<input type="text" name="... | 2013/10/24 | [
"https://Stackoverflow.com/questions/19564281",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2866602/"
] | Pass event as argument and use `event.preventDefault()`.
**Example**
```
$('form.ajax').on('submit', function (e) {
e.preventDefault();
``` | Using jQuery ajax is not preventing browser to follow Form Action page.
To achieve this, you should prevent browser to do it by simple function: [e.preventDefault()](http://api.jquery.com/event.preventDefault/)
Here is you code:
```
//Pass the event argument (e)
$('form.ajax').on('submit', function (e) {
var tha... |
755,680 | I am running the code below and the result is totally different when it runs in Release mode. While in Debug mode, it never collects the object of class A and in Reaelse mode it immediately collects the object of class A.
Can someone explain why.
```
using System;
using System.Collections.Generic;
using System.Linq... | 2009/04/16 | [
"https://Stackoverflow.com/questions/755680",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17296/"
] | In Debug mode, the compiler does not optimize the local variables. Therefore, the reference to A still exists. In Release mode, the compiler optimized the usage so that the reference is thrown away and the object can be collected. | The garbage collector handles variable usage differently in debug mode and release mode.
In release mode the usage of a variable is only where it's actually used. After the last use of the varaible, the object is up for garbage collection.
In debug mode the usage of a varaible is expanded to it's scope. The reason fo... |
755,680 | I am running the code below and the result is totally different when it runs in Release mode. While in Debug mode, it never collects the object of class A and in Reaelse mode it immediately collects the object of class A.
Can someone explain why.
```
using System;
using System.Collections.Generic;
using System.Linq... | 2009/04/16 | [
"https://Stackoverflow.com/questions/755680",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17296/"
] | In Debug mode, the compiler does not optimize the local variables. Therefore, the reference to A still exists. In Release mode, the compiler optimized the usage so that the reference is thrown away and the object can be collected. | I just found this behavior in my tests. Inserting
```
obj = null;
```
right before GC.Collect() should help. I think that is kind of "simulated" optimization. |
39,094,332 | Most probably I oversee something in this trivial use case.
My code iterates over annotated fields in a class and the for every field I'd like to run some code dependent on the type. The simplest is just to set a value:
```
field.setAccessible(true);
final Class<?> type = field.getType();
if (type.equals(Boolean.class... | 2016/08/23 | [
"https://Stackoverflow.com/questions/39094332",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2650481/"
] | Take a look at this post: [Check type of primitive field](https://stackoverflow.com/questions/1891595/check-type-of-primitive-field)
basically you need to check primitive types separately (`Boolean.TYPE`, `Long.TYPE` etc)
```
if (field.getType().equals(Boolean.TYPE) {
// do something if field is boolean
}
``` | In Java, `boolean` and `Boolean` are two different types: `boolean` is a primitive data type while `Boolean` is a class in `java.lang.Boolean`. In this example, in your class you are using `private boolean isVerbose` which is not of type `java.lang.Boolean`. Hence you have to change it to `private Boolean isVerbose`.
H... |
39,094,332 | Most probably I oversee something in this trivial use case.
My code iterates over annotated fields in a class and the for every field I'd like to run some code dependent on the type. The simplest is just to set a value:
```
field.setAccessible(true);
final Class<?> type = field.getType();
if (type.equals(Boolean.class... | 2016/08/23 | [
"https://Stackoverflow.com/questions/39094332",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2650481/"
] | Take a look at this post: [Check type of primitive field](https://stackoverflow.com/questions/1891595/check-type-of-primitive-field)
basically you need to check primitive types separately (`Boolean.TYPE`, `Long.TYPE` etc)
```
if (field.getType().equals(Boolean.TYPE) {
// do something if field is boolean
}
``` | I believe you are having troubles with the java primitives and the boxing.
java.lang.Boolean is a class, where as "boolean" just denotes the primitive type.
It is a difference wether you declare:
```
private boolean myBool; // this a java primitive
private Boolean myOtherBool; // this is an object
```
Java automati... |
11,252,639 | The existing dialog plugin doesn't have an option to close dialog on clicking modal overlay, how to add an option to provide the functionality? | 2012/06/28 | [
"https://Stackoverflow.com/questions/11252639",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/342553/"
] | ```
(function($){
var _init = $.ui.dialog.prototype._init;
$.ui.dialog.prototype._init = function(){
var self = this;
_init.apply(this,arguments);
$('.ui-widget-overlay').live('click', function(){
if (self.options['overlay_close']){
self.destroy();
}... | It would be even better if the self-provided answer worked.
I get no response when clicking outside the dialog. Here is my [jsFiddle](http://jsfiddle.net/styson/menjK/) for testing.
Maybe I am doing something wrong, but it doesn't seem to do its desired function.
@JamesLin provided the key insight. I needed to add t... |
3,500,967 | Can some body explain why the TD element is taking width when its not allowed in strict mode.This is the code [Was not able to put code because of HTML rendering problem.]
```
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" con... | 2010/08/17 | [
"https://Stackoverflow.com/questions/3500967",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/341144/"
] | Even though it's deprecated per the spec the browser will still apply it because you specified it. It has to be lenient toward older docs which may otherwise have broken layouts if it didn't apply the attribute(s). | Since you specified it the browser will apply it, but your document won't validate. |
3,500,967 | Can some body explain why the TD element is taking width when its not allowed in strict mode.This is the code [Was not able to put code because of HTML rendering problem.]
```
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" con... | 2010/08/17 | [
"https://Stackoverflow.com/questions/3500967",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/341144/"
] | Even though it's deprecated per the spec the browser will still apply it because you specified it. It has to be lenient toward older docs which may otherwise have broken layouts if it didn't apply the attribute(s). | Your doctype (HTML 4.01) doesn't match your content type.
The content type should read `application/xhtml+xml` instead of `text/xml+xhtml`, *and* your web server should also serve your page as such in order for standards-compliant browsers to treat it strictly (that is, fail to render your document if it's invalid). A... |
3,500,967 | Can some body explain why the TD element is taking width when its not allowed in strict mode.This is the code [Was not able to put code because of HTML rendering problem.]
```
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" con... | 2010/08/17 | [
"https://Stackoverflow.com/questions/3500967",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/341144/"
] | Even though it's deprecated per the spec the browser will still apply it because you specified it. It has to be lenient toward older docs which may otherwise have broken layouts if it didn't apply the attribute(s). | I did everything suggested but it still it is taking width attribute. I think it is because of browsers have to support it now but future browsers will throw an error on code like this |
54,114,923 | I want to make a button in an activity disabled if it is intented from a certain button and otherwise enabled if and it is intented from some other class.What I am saying will be clear after reading the code.
This is the function to intent the class containing the button.
```
showperson.setOnClickListener(new View.On... | 2019/01/09 | [
"https://Stackoverflow.com/questions/54114923",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10841645/"
] | i had this issue and it was a directory name capitalization problem.
i was importing my component like this :
```
../proxies/test.component
../Proxies/test.component
``` | In my case, when renaming the folder I made a capitalization error, then corrected it. Somehow, visual studio created a second directory with the bad capitalization. That second directory was invisible in VS, but when I tracked it down manually I was able to delete it. After restarting VS code to force it to recognize ... |
54,114,923 | I want to make a button in an activity disabled if it is intented from a certain button and otherwise enabled if and it is intented from some other class.What I am saying will be clear after reading the code.
This is the function to intent the class containing the button.
```
showperson.setOnClickListener(new View.On... | 2019/01/09 | [
"https://Stackoverflow.com/questions/54114923",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10841645/"
] | I had a similar issue and solved it by closing the folder, then on the Recent workspaces list click More at the bottom, and from the list click the 'x' (remove) button to remove the workspace. Then, after loading the project's folder, it build normally. So probably there is some cache and that is probably one way to cl... | I have the same issue, and just discovered that for some reason, in some ts file it is called using capitalize letter, then I renamed it for lowercase and it works.
You can try also removing this model ts file and creating again with angular-CLI. |
54,114,923 | I want to make a button in an activity disabled if it is intented from a certain button and otherwise enabled if and it is intented from some other class.What I am saying will be clear after reading the code.
This is the function to intent the class containing the button.
```
showperson.setOnClickListener(new View.On... | 2019/01/09 | [
"https://Stackoverflow.com/questions/54114923",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10841645/"
] | i had this issue and it was a directory name capitalization problem.
i was importing my component like this :
```
../proxies/test.component
../Proxies/test.component
``` | I have the same issue, and just discovered that for some reason, in some ts file it is called using capitalize letter, then I renamed it for lowercase and it works.
You can try also removing this model ts file and creating again with angular-CLI. |
54,114,923 | I want to make a button in an activity disabled if it is intented from a certain button and otherwise enabled if and it is intented from some other class.What I am saying will be clear after reading the code.
This is the function to intent the class containing the button.
```
showperson.setOnClickListener(new View.On... | 2019/01/09 | [
"https://Stackoverflow.com/questions/54114923",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10841645/"
] | i had this issue and it was a directory name capitalization problem.
i was importing my component like this :
```
../proxies/test.component
../Proxies/test.component
``` | I solved it by restarting typescript server:
Make sure that you have a TypeScript file open, press Ctrl+Shift+P (or Cmd+Shift+P on macOS) to open the Command Palette and type restart, then select the command "TypeScript: Restart TS server".
[Source](https://tinytip.co/tips/vscode-restart-ts/#:%7E:text=You%20can%20res... |
54,114,923 | I want to make a button in an activity disabled if it is intented from a certain button and otherwise enabled if and it is intented from some other class.What I am saying will be clear after reading the code.
This is the function to intent the class containing the button.
```
showperson.setOnClickListener(new View.On... | 2019/01/09 | [
"https://Stackoverflow.com/questions/54114923",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10841645/"
] | I had a similar issue and solved it by closing the folder, then on the Recent workspaces list click More at the bottom, and from the list click the 'x' (remove) button to remove the workspace. Then, after loading the project's folder, it build normally. So probably there is some cache and that is probably one way to cl... | In my case, when renaming the folder I made a capitalization error, then corrected it. Somehow, visual studio created a second directory with the bad capitalization. That second directory was invisible in VS, but when I tracked it down manually I was able to delete it. After restarting VS code to force it to recognize ... |
54,114,923 | I want to make a button in an activity disabled if it is intented from a certain button and otherwise enabled if and it is intented from some other class.What I am saying will be clear after reading the code.
This is the function to intent the class containing the button.
```
showperson.setOnClickListener(new View.On... | 2019/01/09 | [
"https://Stackoverflow.com/questions/54114923",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10841645/"
] | I have the same issue, and just discovered that for some reason, in some ts file it is called using capitalize letter, then I renamed it for lowercase and it works.
You can try also removing this model ts file and creating again with angular-CLI. | It's all about the path of files, make sure it is **case-sensitive** |
54,114,923 | I want to make a button in an activity disabled if it is intented from a certain button and otherwise enabled if and it is intented from some other class.What I am saying will be clear after reading the code.
This is the function to intent the class containing the button.
```
showperson.setOnClickListener(new View.On... | 2019/01/09 | [
"https://Stackoverflow.com/questions/54114923",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10841645/"
] | I had a similar issue and solved it by closing the folder, then on the Recent workspaces list click More at the bottom, and from the list click the 'x' (remove) button to remove the workspace. Then, after loading the project's folder, it build normally. So probably there is some cache and that is probably one way to cl... | It's all about the path of files, make sure it is **case-sensitive** |
54,114,923 | I want to make a button in an activity disabled if it is intented from a certain button and otherwise enabled if and it is intented from some other class.What I am saying will be clear after reading the code.
This is the function to intent the class containing the button.
```
showperson.setOnClickListener(new View.On... | 2019/01/09 | [
"https://Stackoverflow.com/questions/54114923",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10841645/"
] | I had a similar issue and solved it by closing the folder, then on the Recent workspaces list click More at the bottom, and from the list click the 'x' (remove) button to remove the workspace. Then, after loading the project's folder, it build normally. So probably there is some cache and that is probably one way to cl... | i had this issue and it was a directory name capitalization problem.
i was importing my component like this :
```
../proxies/test.component
../Proxies/test.component
``` |
54,114,923 | I want to make a button in an activity disabled if it is intented from a certain button and otherwise enabled if and it is intented from some other class.What I am saying will be clear after reading the code.
This is the function to intent the class containing the button.
```
showperson.setOnClickListener(new View.On... | 2019/01/09 | [
"https://Stackoverflow.com/questions/54114923",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10841645/"
] | i had this issue and it was a directory name capitalization problem.
i was importing my component like this :
```
../proxies/test.component
../Proxies/test.component
``` | It's all about the path of files, make sure it is **case-sensitive** |
54,114,923 | I want to make a button in an activity disabled if it is intented from a certain button and otherwise enabled if and it is intented from some other class.What I am saying will be clear after reading the code.
This is the function to intent the class containing the button.
```
showperson.setOnClickListener(new View.On... | 2019/01/09 | [
"https://Stackoverflow.com/questions/54114923",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10841645/"
] | I have the same issue, and just discovered that for some reason, in some ts file it is called using capitalize letter, then I renamed it for lowercase and it works.
You can try also removing this model ts file and creating again with angular-CLI. | In my case, when renaming the folder I made a capitalization error, then corrected it. Somehow, visual studio created a second directory with the bad capitalization. That second directory was invisible in VS, but when I tracked it down manually I was able to delete it. After restarting VS code to force it to recognize ... |
146,570 | I am writing an app that requires multiple levels of users, where one user is an administrator and adds slave users.
I can't really seem to find a way to allow access to the slave users safely. Emailing a password is unsafe as emails are unencrypted, and I might as well just send the password if I'm sending a one-time... | 2016/12/27 | [
"https://security.stackexchange.com/questions/146570",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/112167/"
] | Assuming you are talking about personal accounts not company accounts here. It's part of your identity and you should protect it as much as possible, risk is greater if they can find your address (fairly easy - online address finders, whois records if you own the website) or your date of birth.
There was a case a few... | I think I could pay my car payment with just that information.
You could use PayPal for this kind of venture. |
32,802,592 | I'm developing an application that lets my users upload files, and I've made it works with "local" disk using filesystem feature, but now I want to migrate and use google Google Cloud Storage for it.
It has been a lot difficult to find some useful information.
In the docs there is an "example" for work with dropbox, ... | 2015/09/26 | [
"https://Stackoverflow.com/questions/32802592",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2533782/"
] | I've found a solution.
It seems that Google Cloud Storage uses the same api than Amazon S3, so I could use it as I would use amazon, the same driver.
The only thing I needed to change was when I config disks in laravel, using this code in config/filesystems when adding a disk for google:
```
'google' => [
'driv... | I didn't find solutions\adapters like [here](https://github.com/GrahamCampbell/Laravel-Flysystem)
This is what i [found](https://stackoverflow.com/questions/24778296/use-google-drive-api-with-laravel/24798103#24798103) but it's for google drive. |
18,227,090 | I have a service that fetches some client data from my server:
```
app.factory('clientDataService', function ($http) {
var clientDataObject = {};
var cdsService = {
fetch: function (cid) {
//$http returns a promise, which has a then function, which also returns a promise
var pro... | 2013/08/14 | [
"https://Stackoverflow.com/questions/18227090",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1000654/"
] | clientDataService.clientDataObject is not part of your controller's scope, so you can't watch for changes on that object.
You need to inject the $rootScope into your service then broadcast the changes to the controllers scopes.
```
app.factory('clientDataService', function ($rootScope, $http) {
var clientDataObjec... | Another approach can be:
1. define new service
```
app.factory('DataSharingObject', function(){
return {};
}
```
2. include this new service in controller where we want to store the data
```
app.factory('clientDataService', function ($http, DataSharingObject) {
DataSharingObject.sharedata = ..assign it here
... |
29,885,786 | In wordpress I have an article in my `content.php` which creates a grid of images out of the `featured-thumbnail` of posts. This snippet of code puts the post title `(the_title();)` and the category title `(the_category(', '))`
**HTML**:
```
<div class="title-styling">
<a href="<?php the_permalink(); ?>" rel="book... | 2015/04/27 | [
"https://Stackoverflow.com/questions/29885786",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3550879/"
] | Try using the following
```
.title-styling > a > h2.title-category {
color: #fff;
font: 500 15px/10px "Open Sans";
}
```
And this if you want to remove the underline of the anchor tag (link) **[optional]**
```
.title-styling > a {
text-decoration: none;
}
```
**UPDATE:**
Try giving a class to the h2 tag to... | >
> represent it parent must .title-styling
>
>
>
try below:
```
.title-styling h2 {
color: #fff;
font: 500 15px/10px "Open Sans";
}
``` |
1,737,416 | Quick question about general MVC design principle in PHP, using CodeIgniter or Kohana (I'm actually using Kohana).
I'm new to MVC and don't want to get this wrong... so I'm wondering if i have tables:
```
categories, pages, notes
```
I create a separate controller and view for each one...? So people can go to
```... | 2009/11/15 | [
"https://Stackoverflow.com/questions/1737416",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/156749/"
] | Yes, instead of just passing 1 entity (category, page, note) to your view, pass a list of entities. With a loop inside the view, you can display the whole list.
That view may call another one (or a function) that know how to display one entry. | 1. You can loop in the View. The View is allowed can also access the model in MVC. See: <http://www.phpwact.org/pattern/model_view_controller>
2. You don't need to have a controller (or model) for each table. |
1,737,416 | Quick question about general MVC design principle in PHP, using CodeIgniter or Kohana (I'm actually using Kohana).
I'm new to MVC and don't want to get this wrong... so I'm wondering if i have tables:
```
categories, pages, notes
```
I create a separate controller and view for each one...? So people can go to
```... | 2009/11/15 | [
"https://Stackoverflow.com/questions/1737416",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/156749/"
] | I would personally have a "show" method for one item and a "list" method for multiple. In your controller you can say something like `$page_data['note'] = get_note(cat_id,page_id)` for the "show" method and `$page_data['notes'] = get_all_notes(cat_id)` for the "list" method.
Then in your view, you loop over the `$pag... | 1. You can loop in the View. The View is allowed can also access the model in MVC. See: <http://www.phpwact.org/pattern/model_view_controller>
2. You don't need to have a controller (or model) for each table. |
1,737,416 | Quick question about general MVC design principle in PHP, using CodeIgniter or Kohana (I'm actually using Kohana).
I'm new to MVC and don't want to get this wrong... so I'm wondering if i have tables:
```
categories, pages, notes
```
I create a separate controller and view for each one...? So people can go to
```... | 2009/11/15 | [
"https://Stackoverflow.com/questions/1737416",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/156749/"
] | Yes, instead of just passing 1 entity (category, page, note) to your view, pass a list of entities. With a loop inside the view, you can display the whole list.
That view may call another one (or a function) that know how to display one entry. | I would personally have a "show" method for one item and a "list" method for multiple. In your controller you can say something like `$page_data['note'] = get_note(cat_id,page_id)` for the "show" method and `$page_data['notes'] = get_all_notes(cat_id)` for the "list" method.
Then in your view, you loop over the `$pag... |
1,737,416 | Quick question about general MVC design principle in PHP, using CodeIgniter or Kohana (I'm actually using Kohana).
I'm new to MVC and don't want to get this wrong... so I'm wondering if i have tables:
```
categories, pages, notes
```
I create a separate controller and view for each one...? So people can go to
```... | 2009/11/15 | [
"https://Stackoverflow.com/questions/1737416",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/156749/"
] | Yes, instead of just passing 1 entity (category, page, note) to your view, pass a list of entities. With a loop inside the view, you can display the whole list.
That view may call another one (or a function) that know how to display one entry. | In CodeIgniter I create a separate helper file where I put functions that return the markup for UI elements that may need to be included multiple times in the one view.
In your example, I would create a function to return the markup for a note.
**application/helpers/view\_helper.php**
```
function note($note)
{
... |
1,737,416 | Quick question about general MVC design principle in PHP, using CodeIgniter or Kohana (I'm actually using Kohana).
I'm new to MVC and don't want to get this wrong... so I'm wondering if i have tables:
```
categories, pages, notes
```
I create a separate controller and view for each one...? So people can go to
```... | 2009/11/15 | [
"https://Stackoverflow.com/questions/1737416",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/156749/"
] | I would personally have a "show" method for one item and a "list" method for multiple. In your controller you can say something like `$page_data['note'] = get_note(cat_id,page_id)` for the "show" method and `$page_data['notes'] = get_all_notes(cat_id)` for the "list" method.
Then in your view, you loop over the `$pag... | In CodeIgniter I create a separate helper file where I put functions that return the markup for UI elements that may need to be included multiple times in the one view.
In your example, I would create a function to return the markup for a note.
**application/helpers/view\_helper.php**
```
function note($note)
{
... |
58,091,848 | Trying to create a socketio link between flask server and reactjs client. It shows this error
"Access to XMLHttpRequest at '<http://127.0.0.1:5000/socket.io/?EIO=3&transport=polling&t=MrcruFC>' from origin '<http://localhost:3000>' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on... | 2019/09/25 | [
"https://Stackoverflow.com/questions/58091848",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12057928/"
] | You can add an option for creating SocketIO.
```
socketio = SocketIO(app=app, cors_allowed_origins='*')
``` | You can allow the CORS using the following headers:
```py
header = response.headers
header['Access-Control-Allow-Origin'] = '*'
``` |
5,081,640 | Dear experts,
I am currently working on an code that allows users to drag & resize HTML elements across the pages. I could tackle the draggable no problem. But the problem comes from resizing. I don't know how attach Event Listeners to the "borders" of this elements to trigger the resize, specifically only the "right a... | 2011/02/22 | [
"https://Stackoverflow.com/questions/5081640",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/291051/"
] | jquery ui appends 8 elements on top of your draggable element. south, southwest, west... and so on. Is it what you meant? | How do users resize them without dragging? if they just input a number have you tried the following
```
$(element).width(widthInput);
$(element).height(heightInput);
``` |
7,699,870 | Hi I have turned on buffer cycling placing following commands in my .emacs
```
(global-set-key (kbd "<C-tab>") 'bury-buffer)
```
But while cycling how do I avoid cycling through the Messages and the scrratch buffers which
are always present in any emacs buffer list. I never use those buffers and become an eye-sore ... | 2011/10/08 | [
"https://Stackoverflow.com/questions/7699870",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/505306/"
] | If you never use the scratch buffer, just add this to your .emacs to automatically close it:
>
> (kill-buffer "\*scratch\*")
>
>
>
I also found [this code](http://www.emacswiki.org/emacs/ControlTABbufferCycling#toc3) on the [Emacs wiki](http://www.emacswiki.org/) which should do what you want:
```
; necessary s... | Luke's answered your specific question. In my personal experience buffer cycling is more useful as a most-recently-used stack instead of the Emacs default cycling functions. That is, the buffers you most recently used should bubble to the top of the stack, similar to how alt-tab works in Windows.
There are quite a few... |
7,699,870 | Hi I have turned on buffer cycling placing following commands in my .emacs
```
(global-set-key (kbd "<C-tab>") 'bury-buffer)
```
But while cycling how do I avoid cycling through the Messages and the scrratch buffers which
are always present in any emacs buffer list. I never use those buffers and become an eye-sore ... | 2011/10/08 | [
"https://Stackoverflow.com/questions/7699870",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/505306/"
] | If you never use the scratch buffer, just add this to your .emacs to automatically close it:
>
> (kill-buffer "\*scratch\*")
>
>
>
I also found [this code](http://www.emacswiki.org/emacs/ControlTABbufferCycling#toc3) on the [Emacs wiki](http://www.emacswiki.org/) which should do what you want:
```
; necessary s... | Well, if you use `ido-mode` to cycle between buffers you can set `ido-ignore-buffers` to match the buffers you want to ignore. From the documentation:
>
> List of regexps or functions matching buffer names to ignore.
> For example, traditional behavior is not to list buffers whose names begin
> with a space, for w... |
7,699,870 | Hi I have turned on buffer cycling placing following commands in my .emacs
```
(global-set-key (kbd "<C-tab>") 'bury-buffer)
```
But while cycling how do I avoid cycling through the Messages and the scrratch buffers which
are always present in any emacs buffer list. I never use those buffers and become an eye-sore ... | 2011/10/08 | [
"https://Stackoverflow.com/questions/7699870",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/505306/"
] | If you never use the scratch buffer, just add this to your .emacs to automatically close it:
>
> (kill-buffer "\*scratch\*")
>
>
>
I also found [this code](http://www.emacswiki.org/emacs/ControlTABbufferCycling#toc3) on the [Emacs wiki](http://www.emacswiki.org/) which should do what you want:
```
; necessary s... | All the buffers I did not use, such as scratch, messages and completions, messed with my workflow.
I've managed to completely get rid of them, without breaking emacs in any way.
Posted first [here](https://unix.stackexchange.com/a/152151/72170), and pasted bellow:
Place this in your .emacs:
```
;; Makes *scratch... |
7,699,870 | Hi I have turned on buffer cycling placing following commands in my .emacs
```
(global-set-key (kbd "<C-tab>") 'bury-buffer)
```
But while cycling how do I avoid cycling through the Messages and the scrratch buffers which
are always present in any emacs buffer list. I never use those buffers and become an eye-sore ... | 2011/10/08 | [
"https://Stackoverflow.com/questions/7699870",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/505306/"
] | Luke's answered your specific question. In my personal experience buffer cycling is more useful as a most-recently-used stack instead of the Emacs default cycling functions. That is, the buffers you most recently used should bubble to the top of the stack, similar to how alt-tab works in Windows.
There are quite a few... | Well, if you use `ido-mode` to cycle between buffers you can set `ido-ignore-buffers` to match the buffers you want to ignore. From the documentation:
>
> List of regexps or functions matching buffer names to ignore.
> For example, traditional behavior is not to list buffers whose names begin
> with a space, for w... |
7,699,870 | Hi I have turned on buffer cycling placing following commands in my .emacs
```
(global-set-key (kbd "<C-tab>") 'bury-buffer)
```
But while cycling how do I avoid cycling through the Messages and the scrratch buffers which
are always present in any emacs buffer list. I never use those buffers and become an eye-sore ... | 2011/10/08 | [
"https://Stackoverflow.com/questions/7699870",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/505306/"
] | Luke's answered your specific question. In my personal experience buffer cycling is more useful as a most-recently-used stack instead of the Emacs default cycling functions. That is, the buffers you most recently used should bubble to the top of the stack, similar to how alt-tab works in Windows.
There are quite a few... | All the buffers I did not use, such as scratch, messages and completions, messed with my workflow.
I've managed to completely get rid of them, without breaking emacs in any way.
Posted first [here](https://unix.stackexchange.com/a/152151/72170), and pasted bellow:
Place this in your .emacs:
```
;; Makes *scratch... |
7,699,870 | Hi I have turned on buffer cycling placing following commands in my .emacs
```
(global-set-key (kbd "<C-tab>") 'bury-buffer)
```
But while cycling how do I avoid cycling through the Messages and the scrratch buffers which
are always present in any emacs buffer list. I never use those buffers and become an eye-sore ... | 2011/10/08 | [
"https://Stackoverflow.com/questions/7699870",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/505306/"
] | All the buffers I did not use, such as scratch, messages and completions, messed with my workflow.
I've managed to completely get rid of them, without breaking emacs in any way.
Posted first [here](https://unix.stackexchange.com/a/152151/72170), and pasted bellow:
Place this in your .emacs:
```
;; Makes *scratch... | Well, if you use `ido-mode` to cycle between buffers you can set `ido-ignore-buffers` to match the buffers you want to ignore. From the documentation:
>
> List of regexps or functions matching buffer names to ignore.
> For example, traditional behavior is not to list buffers whose names begin
> with a space, for w... |
34,653,103 | ```
@ECHO OFF
:Start
SET /P Enter user name:
SET /P Enter Password:
SET /P Enter age:
SET /p Enter Passeword:
```
For the given above .bat file . How do I pass arguments using PYTHON
I want to write Python automation script which call the batch file and pass the required argument in the bat... | 2016/01/07 | [
"https://Stackoverflow.com/questions/34653103",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4653130/"
] | Its important to hide session ID for MITMA but of accessibility you need it to let web sites know who you are and what was your last activity. The technique which is widely used is limited time session ID | What would be the benefit of encrypting or masking it? Assuming there were an uncomplicated and non-timewasting way to do this, an attacker only need copy the encrypted form of the token and feed it to your application and your application will dutifully decrypt it, regardless of the source. Ditto for masking it: whate... |
8,272,897 | I have a `ListActivity`, where I need to show a image and text in every row.
The `event.xml` layout looks like this:
```
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content" android:layout_height="wrap_content">
<Im... | 2011/11/25 | [
"https://Stackoverflow.com/questions/8272897",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1055201/"
] | By definition: http status code 503: Service Unavailable. The server is currently unavailable (because it is overloaded or down for maintenance). Generally, this is a temporary state.
As 500-599 present a server side error, happening all the time, on Web service or Web site. For 503, slowing down the frequency of the ... | How about a TTimer? That way your app isn't locked up with a sleep() call. |
8,272,897 | I have a `ListActivity`, where I need to show a image and text in every row.
The `event.xml` layout looks like this:
```
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content" android:layout_height="wrap_content">
<Im... | 2011/11/25 | [
"https://Stackoverflow.com/questions/8272897",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1055201/"
] | To handle a temorary error like 503, the message processing queue could use an incrementing delay time, a failed request will increase the waiting time (up to a defined maximum). If a request was successful, the delay is reset.
So I would for example start with a 500 msec interval. Every time the request fails, the in... | How about a TTimer? That way your app isn't locked up with a sleep() call. |
8,272,897 | I have a `ListActivity`, where I need to show a image and text in every row.
The `event.xml` layout looks like this:
```
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content" android:layout_height="wrap_content">
<Im... | 2011/11/25 | [
"https://Stackoverflow.com/questions/8272897",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1055201/"
] | How about a TTimer? That way your app isn't locked up with a sleep() call. | I'm answering my own question. I won't accept it yet because this is only in concept stage.
I think I'll create a common stack for all calls to services belonging to my provider. Every time a call is made, I'll set up a 'cool down' period using some form of thread or timer (I'm tempted to use this as an excuse to incl... |
8,272,897 | I have a `ListActivity`, where I need to show a image and text in every row.
The `event.xml` layout looks like this:
```
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content" android:layout_height="wrap_content">
<Im... | 2011/11/25 | [
"https://Stackoverflow.com/questions/8272897",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1055201/"
] | By definition: http status code 503: Service Unavailable. The server is currently unavailable (because it is overloaded or down for maintenance). Generally, this is a temporary state.
As 500-599 present a server side error, happening all the time, on Web service or Web site. For 503, slowing down the frequency of the ... | I'm answering my own question. I won't accept it yet because this is only in concept stage.
I think I'll create a common stack for all calls to services belonging to my provider. Every time a call is made, I'll set up a 'cool down' period using some form of thread or timer (I'm tempted to use this as an excuse to incl... |
8,272,897 | I have a `ListActivity`, where I need to show a image and text in every row.
The `event.xml` layout looks like this:
```
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content" android:layout_height="wrap_content">
<Im... | 2011/11/25 | [
"https://Stackoverflow.com/questions/8272897",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1055201/"
] | To handle a temorary error like 503, the message processing queue could use an incrementing delay time, a failed request will increase the waiting time (up to a defined maximum). If a request was successful, the delay is reset.
So I would for example start with a 500 msec interval. Every time the request fails, the in... | I'm answering my own question. I won't accept it yet because this is only in concept stage.
I think I'll create a common stack for all calls to services belonging to my provider. Every time a call is made, I'll set up a 'cool down' period using some form of thread or timer (I'm tempted to use this as an excuse to incl... |
25,975,746 | I'm new to C++ and I am having problems setting up my class variables through the constructor.
I have all of my .h and .cpp file setup in what I think is the correct way.
But I keep getting errors on line 4 and 5. I am using Visual Studio 2013. The error says Vector3: 'class' type redefinition. And x, y,z is not ... | 2014/09/22 | [
"https://Stackoverflow.com/questions/25975746",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2925538/"
] | You are re-defining the `class Vector3`.
It should just be (the implementation);
```
Vector3::Vector3(float _x, float _y, float _z) : x(_x), y(_y), z(_z)
// ^^^^
{
}
```
And so on for all the member methods. | Change your .cpp body to this: Its a syntax error, you have to mention a class name in cpp before each funtion.
```
#include "Vector3.h"
Vector3::Vector3(float _x, float _y, float _z) : x(_x), y(_y), z(_z)
{
}
Vector3::Vector3(const Vector3 &v)
{
}
Vector3::Vector3(Vector3 start, Vector3 end)
{
}
Vector3 Vecto... |
32,019 | I understand that this circuit could be used as a treble control circuit with high frequency gain occuring when R3 is set so a=b (we'll call this k=0), and high frequency attenuation occuring when R3 is 22kOhms across a and b (k=1). So therefore, depending on R3's setting, this circuit is either a high pass (k=0) or lo... | 2012/05/16 | [
"https://electronics.stackexchange.com/questions/32019",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/9374/"
] | The AC feedback via C2 is negative feedback - it will decrease the gain.
Increasing the negative feedback with frequency will reduce the gain as frequency increases.
C2 impedance decreases as frequency increases so feedback via C2 increases so gain decreases if all feedback is applied to inverting input.
Fina... | Rather than thinking of the capactior as such, think of it as simply a resistor who's value decreases linearly with the increasing frequency of the current flowing through it.
An inductor can be considered in the same way except the frequency relationship is not inverse. (in this case rising 'reactance' with rising ... |
98,597 | Is there any way I can verify the integrity of a remotely transferred file? I am currently transferring a large amount of files and folders from an ftp server to another remote server using wget, but I have no way of knowing if the files are corrupt.
Is there any way I can verify the integrity of the transfer, by getti... | 2009/12/31 | [
"https://serverfault.com/questions/98597",
"https://serverfault.com",
"https://serverfault.com/users/-1/"
] | Depending on the tool you use it's possible to automatically hash and verify the downloaded files, the only tool that can do this that comes to mind immediately though is the [DownThemAll!](https://addons.mozilla.org/en-US/firefox/addon/201 "DownThemAll!") addon for Firefox.
What I normally use for situations like thi... | While I really like the md5deep and rsync answers (and upvoted both), it sounds like you're facing a really hard group of people at the source server. An alternative that is really ugly but better than nothing is to cull the transfer log for the file sizes then compare them locally.
```
wget -nv -o log.txt ftp://ftp.m... |
98,597 | Is there any way I can verify the integrity of a remotely transferred file? I am currently transferring a large amount of files and folders from an ftp server to another remote server using wget, but I have no way of knowing if the files are corrupt.
Is there any way I can verify the integrity of the transfer, by getti... | 2009/12/31 | [
"https://serverfault.com/questions/98597",
"https://serverfault.com",
"https://serverfault.com/users/-1/"
] | Depending on the tool you use it's possible to automatically hash and verify the downloaded files, the only tool that can do this that comes to mind immediately though is the [DownThemAll!](https://addons.mozilla.org/en-US/firefox/addon/201 "DownThemAll!") addon for Firefox.
What I normally use for situations like thi... | That's a long shot, but if the server supports [php](https://php.net), you can exploit that.
Save the following as a `php` file (say, `check.php`), in the same folder as your `name_of_file.txt` file:
```
<? php
echo md5_file('name_of_file.txt');
php>
```
Then, visit the page `check.php`, and you should get the md5 ... |
98,597 | Is there any way I can verify the integrity of a remotely transferred file? I am currently transferring a large amount of files and folders from an ftp server to another remote server using wget, but I have no way of knowing if the files are corrupt.
Is there any way I can verify the integrity of the transfer, by getti... | 2009/12/31 | [
"https://serverfault.com/questions/98597",
"https://serverfault.com",
"https://serverfault.com/users/-1/"
] | `rsync` is almost always the best answer for file transfers. It's best known for its differential optimization transfers (great when you already have a similar file or directory) but it profusely checksums every step of the transmissions. | While I really like the md5deep and rsync answers (and upvoted both), it sounds like you're facing a really hard group of people at the source server. An alternative that is really ugly but better than nothing is to cull the transfer log for the file sizes then compare them locally.
```
wget -nv -o log.txt ftp://ftp.m... |
98,597 | Is there any way I can verify the integrity of a remotely transferred file? I am currently transferring a large amount of files and folders from an ftp server to another remote server using wget, but I have no way of knowing if the files are corrupt.
Is there any way I can verify the integrity of the transfer, by getti... | 2009/12/31 | [
"https://serverfault.com/questions/98597",
"https://serverfault.com",
"https://serverfault.com/users/-1/"
] | `rsync` is almost always the best answer for file transfers. It's best known for its differential optimization transfers (great when you already have a similar file or directory) but it profusely checksums every step of the transmissions. | That's a long shot, but if the server supports [php](https://php.net), you can exploit that.
Save the following as a `php` file (say, `check.php`), in the same folder as your `name_of_file.txt` file:
```
<? php
echo md5_file('name_of_file.txt');
php>
```
Then, visit the page `check.php`, and you should get the md5 ... |
98,597 | Is there any way I can verify the integrity of a remotely transferred file? I am currently transferring a large amount of files and folders from an ftp server to another remote server using wget, but I have no way of knowing if the files are corrupt.
Is there any way I can verify the integrity of the transfer, by getti... | 2009/12/31 | [
"https://serverfault.com/questions/98597",
"https://serverfault.com",
"https://serverfault.com/users/-1/"
] | While I really like the md5deep and rsync answers (and upvoted both), it sounds like you're facing a really hard group of people at the source server. An alternative that is really ugly but better than nothing is to cull the transfer log for the file sizes then compare them locally.
```
wget -nv -o log.txt ftp://ftp.m... | That's a long shot, but if the server supports [php](https://php.net), you can exploit that.
Save the following as a `php` file (say, `check.php`), in the same folder as your `name_of_file.txt` file:
```
<? php
echo md5_file('name_of_file.txt');
php>
```
Then, visit the page `check.php`, and you should get the md5 ... |
66,863,639 | Suppose I have a list of string:
```
distance <- c("CHI #12 DEBRINCAT(1), Snap, Off. Zone, 18 ft.Assists: #88 KANE(2); #56 GUSTAFSSON(1)", "TOR ONGOAL - #44 RIELLY, Backhand, Off. Zone, 77 ft.")
```
Now I hope to get a string vector that contains only the parts
that contains the distance, that is, substring = c ("18... | 2021/03/30 | [
"https://Stackoverflow.com/questions/66863639",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14503956/"
] | Using `str_extract` to match one or more digits followed by zero or more spaces (`\\s*`) and the substring 'ft'
```
library(stringr)
str_extract(distance, "\\d+\\s*ft")
#[1] "18 ft" "77 ft"
``` | Alternatives:
```r
regmatches(distance, gregexpr("\\b[0-9]+\\s*ft", distance, perl = TRUE))
# [[1]]
# [1] "18 ft"
# [[2]]
# [1] "77 ft"
strcapture("\\b([0-9]+\\s*ft)", distance, list(dist = ""))
# dist
# 1 18 ft
# 2 77 ft
```
Though they're all just doing the same thing with slightly different interfaces. |
66,863,639 | Suppose I have a list of string:
```
distance <- c("CHI #12 DEBRINCAT(1), Snap, Off. Zone, 18 ft.Assists: #88 KANE(2); #56 GUSTAFSSON(1)", "TOR ONGOAL - #44 RIELLY, Backhand, Off. Zone, 77 ft.")
```
Now I hope to get a string vector that contains only the parts
that contains the distance, that is, substring = c ("18... | 2021/03/30 | [
"https://Stackoverflow.com/questions/66863639",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14503956/"
] | Using `str_extract` to match one or more digits followed by zero or more spaces (`\\s*`) and the substring 'ft'
```
library(stringr)
str_extract(distance, "\\d+\\s*ft")
#[1] "18 ft" "77 ft"
``` | Try `gsub`
```
> gsub(".*?(\\d+\\s+ft).*", "\\1", distance)
[1] "18 ft" "77 ft"
``` |
66,863,639 | Suppose I have a list of string:
```
distance <- c("CHI #12 DEBRINCAT(1), Snap, Off. Zone, 18 ft.Assists: #88 KANE(2); #56 GUSTAFSSON(1)", "TOR ONGOAL - #44 RIELLY, Backhand, Off. Zone, 77 ft.")
```
Now I hope to get a string vector that contains only the parts
that contains the distance, that is, substring = c ("18... | 2021/03/30 | [
"https://Stackoverflow.com/questions/66863639",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14503956/"
] | Alternatives:
```r
regmatches(distance, gregexpr("\\b[0-9]+\\s*ft", distance, perl = TRUE))
# [[1]]
# [1] "18 ft"
# [[2]]
# [1] "77 ft"
strcapture("\\b([0-9]+\\s*ft)", distance, list(dist = ""))
# dist
# 1 18 ft
# 2 77 ft
```
Though they're all just doing the same thing with slightly different interfaces. | Try `gsub`
```
> gsub(".*?(\\d+\\s+ft).*", "\\1", distance)
[1] "18 ft" "77 ft"
``` |
1,250,253 | I'm using Dipperstein's bitarray.cpp class to work on bi-level (black and white) images where the image data is natively stored as simply as one pixel one bit.
I need to iterate through each and every bit, on the order of 4--9 megapixels per image, over hundreds of images, using a for loop, something like:
```
for( i... | 2009/08/09 | [
"https://Stackoverflow.com/questions/1250253",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/140827/"
] | Without seeing your code it's hard to make specific comments about how to speed up what you are doing. However, `vector::begin()` is used to return an iterator to the first element in a vector - it's a standard routine when iterating across a vector.
I'd actually recommend using a more modern profiler such as [OProfil... | You could improve performance by using a pointer/iterator (I'm not sure what exactly bitarray.cpp does for you), like this:
```
for (bool *ptr = myBitArray, int i = 0; i != imgLength; ++i, ++ptr)
{
if (*myBitArray == 1)
{
//handle
}
}
```
I only use int i here because I'm not sure if your bit array w... |
1,250,253 | I'm using Dipperstein's bitarray.cpp class to work on bi-level (black and white) images where the image data is natively stored as simply as one pixel one bit.
I need to iterate through each and every bit, on the order of 4--9 megapixels per image, over hundreds of images, using a for loop, something like:
```
for( i... | 2009/08/09 | [
"https://Stackoverflow.com/questions/1250253",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/140827/"
] | Without seeing your code it's hard to make specific comments about how to speed up what you are doing. However, `vector::begin()` is used to return an iterator to the first element in a vector - it's a standard routine when iterating across a vector.
I'd actually recommend using a more modern profiler such as [OProfil... | If performance matters enough that you have to worry about accessing individual bits, then you should probably parallelize your code. Since you describe this as image processing, odds are that the state of bit i won't affect how you handle bits i+1 through i+6, so you can probably rewrite your code to operate on bytes ... |
1,250,253 | I'm using Dipperstein's bitarray.cpp class to work on bi-level (black and white) images where the image data is natively stored as simply as one pixel one bit.
I need to iterate through each and every bit, on the order of 4--9 megapixels per image, over hundreds of images, using a for loop, something like:
```
for( i... | 2009/08/09 | [
"https://Stackoverflow.com/questions/1250253",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/140827/"
] | The fact that you see a lot of inline functions in your profile output implies that they aren't being inlined -- that is, you aren't compiling with optimization turned on. So the simplest thing you could do to optimize your code would be to use -O2 or -O3.
Profiling unoptimized code is rarely worthwhile, since the exe... | Without seeing your code it's hard to make specific comments about how to speed up what you are doing. However, `vector::begin()` is used to return an iterator to the first element in a vector - it's a standard routine when iterating across a vector.
I'd actually recommend using a more modern profiler such as [OProfil... |
1,250,253 | I'm using Dipperstein's bitarray.cpp class to work on bi-level (black and white) images where the image data is natively stored as simply as one pixel one bit.
I need to iterate through each and every bit, on the order of 4--9 megapixels per image, over hundreds of images, using a for loop, something like:
```
for( i... | 2009/08/09 | [
"https://Stackoverflow.com/questions/1250253",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/140827/"
] | a quick peak into the code for bitarray.cpp shows:
```
bool bit_array_c::operator[](const unsigned int bit) const
{
return((m_Array[BIT_CHAR(bit)] & BIT_IN_CHAR(bit)) != 0);
}
```
m\_Array is of type std::vector
the [] operator on STL vectors is of constant complexity but its likely implemented as a call to vec... | Without seeing your code it's hard to make specific comments about how to speed up what you are doing. However, `vector::begin()` is used to return an iterator to the first element in a vector - it's a standard routine when iterating across a vector.
I'd actually recommend using a more modern profiler such as [OProfil... |
1,250,253 | I'm using Dipperstein's bitarray.cpp class to work on bi-level (black and white) images where the image data is natively stored as simply as one pixel one bit.
I need to iterate through each and every bit, on the order of 4--9 megapixels per image, over hundreds of images, using a for loop, something like:
```
for( i... | 2009/08/09 | [
"https://Stackoverflow.com/questions/1250253",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/140827/"
] | The fact that you see a lot of inline functions in your profile output implies that they aren't being inlined -- that is, you aren't compiling with optimization turned on. So the simplest thing you could do to optimize your code would be to use -O2 or -O3.
Profiling unoptimized code is rarely worthwhile, since the exe... | You could improve performance by using a pointer/iterator (I'm not sure what exactly bitarray.cpp does for you), like this:
```
for (bool *ptr = myBitArray, int i = 0; i != imgLength; ++i, ++ptr)
{
if (*myBitArray == 1)
{
//handle
}
}
```
I only use int i here because I'm not sure if your bit array w... |
1,250,253 | I'm using Dipperstein's bitarray.cpp class to work on bi-level (black and white) images where the image data is natively stored as simply as one pixel one bit.
I need to iterate through each and every bit, on the order of 4--9 megapixels per image, over hundreds of images, using a for loop, something like:
```
for( i... | 2009/08/09 | [
"https://Stackoverflow.com/questions/1250253",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/140827/"
] | a quick peak into the code for bitarray.cpp shows:
```
bool bit_array_c::operator[](const unsigned int bit) const
{
return((m_Array[BIT_CHAR(bit)] & BIT_IN_CHAR(bit)) != 0);
}
```
m\_Array is of type std::vector
the [] operator on STL vectors is of constant complexity but its likely implemented as a call to vec... | You could improve performance by using a pointer/iterator (I'm not sure what exactly bitarray.cpp does for you), like this:
```
for (bool *ptr = myBitArray, int i = 0; i != imgLength; ++i, ++ptr)
{
if (*myBitArray == 1)
{
//handle
}
}
```
I only use int i here because I'm not sure if your bit array w... |
1,250,253 | I'm using Dipperstein's bitarray.cpp class to work on bi-level (black and white) images where the image data is natively stored as simply as one pixel one bit.
I need to iterate through each and every bit, on the order of 4--9 megapixels per image, over hundreds of images, using a for loop, something like:
```
for( i... | 2009/08/09 | [
"https://Stackoverflow.com/questions/1250253",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/140827/"
] | The fact that you see a lot of inline functions in your profile output implies that they aren't being inlined -- that is, you aren't compiling with optimization turned on. So the simplest thing you could do to optimize your code would be to use -O2 or -O3.
Profiling unoptimized code is rarely worthwhile, since the exe... | If performance matters enough that you have to worry about accessing individual bits, then you should probably parallelize your code. Since you describe this as image processing, odds are that the state of bit i won't affect how you handle bits i+1 through i+6, so you can probably rewrite your code to operate on bytes ... |
1,250,253 | I'm using Dipperstein's bitarray.cpp class to work on bi-level (black and white) images where the image data is natively stored as simply as one pixel one bit.
I need to iterate through each and every bit, on the order of 4--9 megapixels per image, over hundreds of images, using a for loop, something like:
```
for( i... | 2009/08/09 | [
"https://Stackoverflow.com/questions/1250253",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/140827/"
] | a quick peak into the code for bitarray.cpp shows:
```
bool bit_array_c::operator[](const unsigned int bit) const
{
return((m_Array[BIT_CHAR(bit)] & BIT_IN_CHAR(bit)) != 0);
}
```
m\_Array is of type std::vector
the [] operator on STL vectors is of constant complexity but its likely implemented as a call to vec... | If performance matters enough that you have to worry about accessing individual bits, then you should probably parallelize your code. Since you describe this as image processing, odds are that the state of bit i won't affect how you handle bits i+1 through i+6, so you can probably rewrite your code to operate on bytes ... |
6,005 | To the outside world, programmers, computer scientists, software engineers, and developers may all seem alike, but that's far from the case for the people who create software for a living. Any single programmer's ability and knowledge can range very widely, as well as their tools (OS, language, and yes, preferred edito... | 2010/09/21 | [
"https://softwareengineering.stackexchange.com/questions/6005",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/2026/"
] | **Academics that make research using computers, not research about computers.**
They:
- are writing software that can consume unlimited quantities of CPU time, memory and disc space so they care (or at least try to care) of performance, *either* by using stuff like `-O3`, `time`, profilers, memcheck, and spend ho... | Count me down as the 'old-school' guy. I never did LISP well, though. Emacs? Nah, `vi` and `set -o vi` in my shell for me thank you. |
6,005 | To the outside world, programmers, computer scientists, software engineers, and developers may all seem alike, but that's far from the case for the people who create software for a living. Any single programmer's ability and knowledge can range very widely, as well as their tools (OS, language, and yes, preferred edito... | 2010/09/21 | [
"https://softwareengineering.stackexchange.com/questions/6005",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/2026/"
] | I'd consider myself part of the **Real-Time Systems** group. There are some 'Old School' characteristics but with less focus on CS, more on hardware.
The archetype:
* Has expert knowledge of 'C'
+ Has an original copy of K&R
+ Writes in other languages as if they were just an alternate syntax for 'C'
* Can predict... | I represent the lonely contingent of Delphi Devs under 30. Our caucus is small, but our hearts are big. |
6,005 | To the outside world, programmers, computer scientists, software engineers, and developers may all seem alike, but that's far from the case for the people who create software for a living. Any single programmer's ability and knowledge can range very widely, as well as their tools (OS, language, and yes, preferred edito... | 2010/09/21 | [
"https://softwareengineering.stackexchange.com/questions/6005",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/2026/"
] | I'd consider myself part of the **Real-Time Systems** group. There are some 'Old School' characteristics but with less focus on CS, more on hardware.
The archetype:
* Has expert knowledge of 'C'
+ Has an original copy of K&R
+ Writes in other languages as if they were just an alternate syntax for 'C'
* Can predict... | I guess that there exists several cultures which somehow live alongside rather then fight and are somehow transcendent:
* **Hacker/Open Source culture**: sharing code, uses real name or not. Concentrated probably on small tools that solve one problem. Allows in-program hacks. Languages: *C*, *Lisp*, *C++*, *Python*. P... |
6,005 | To the outside world, programmers, computer scientists, software engineers, and developers may all seem alike, but that's far from the case for the people who create software for a living. Any single programmer's ability and knowledge can range very widely, as well as their tools (OS, language, and yes, preferred edito... | 2010/09/21 | [
"https://softwareengineering.stackexchange.com/questions/6005",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/2026/"
] | I'd consider myself part of the **Real-Time Systems** group. There are some 'Old School' characteristics but with less focus on CS, more on hardware.
The archetype:
* Has expert knowledge of 'C'
+ Has an original copy of K&R
+ Writes in other languages as if they were just an alternate syntax for 'C'
* Can predict... | Count me down as the 'old-school' guy. I never did LISP well, though. Emacs? Nah, `vi` and `set -o vi` in my shell for me thank you. |
6,005 | To the outside world, programmers, computer scientists, software engineers, and developers may all seem alike, but that's far from the case for the people who create software for a living. Any single programmer's ability and knowledge can range very widely, as well as their tools (OS, language, and yes, preferred edito... | 2010/09/21 | [
"https://softwareengineering.stackexchange.com/questions/6005",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/2026/"
] | I represent the lonely contingent of Delphi Devs under 30. Our caucus is small, but our hearts are big. | I'm kind of in the Alt.NET/old-school CS camp. I work with Microsoft tech (C#, etc.), but I'm aware that there's a whole world around me, other languages, algorithms, frameworks, "stuff under the hood", etc. Not perfect, obviously, but it's a work in progress. |
6,005 | To the outside world, programmers, computer scientists, software engineers, and developers may all seem alike, but that's far from the case for the people who create software for a living. Any single programmer's ability and knowledge can range very widely, as well as their tools (OS, language, and yes, preferred edito... | 2010/09/21 | [
"https://softwareengineering.stackexchange.com/questions/6005",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/2026/"
] | **Academics that make research using computers, not research about computers.**
They:
- are writing software that can consume unlimited quantities of CPU time, memory and disc space so they care (or at least try to care) of performance, *either* by using stuff like `-O3`, `time`, profilers, memcheck, and spend ho... | I'm probably a combination of **Old-school CS people** and **New-school web developers**: I learned programming by writing websites with PHP, Javascript and SQL, and am now attending university where everything is done in command-prompts and Emacs under UNIX. |
6,005 | To the outside world, programmers, computer scientists, software engineers, and developers may all seem alike, but that's far from the case for the people who create software for a living. Any single programmer's ability and knowledge can range very widely, as well as their tools (OS, language, and yes, preferred edito... | 2010/09/21 | [
"https://softwareengineering.stackexchange.com/questions/6005",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/2026/"
] | I'd consider myself part of the **Real-Time Systems** group. There are some 'Old School' characteristics but with less focus on CS, more on hardware.
The archetype:
* Has expert knowledge of 'C'
+ Has an original copy of K&R
+ Writes in other languages as if they were just an alternate syntax for 'C'
* Can predict... | I don't entirely agree with this statement about MS subculture: "Don't see what the fuss with open-source and such is all about - besides, who needs to know another language? Generally, I've found such places to be 9-5 and quite corporate (driven by business managers, not software people). The anti-thesis of the hacker... |
6,005 | To the outside world, programmers, computer scientists, software engineers, and developers may all seem alike, but that's far from the case for the people who create software for a living. Any single programmer's ability and knowledge can range very widely, as well as their tools (OS, language, and yes, preferred edito... | 2010/09/21 | [
"https://softwareengineering.stackexchange.com/questions/6005",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/2026/"
] | I guess that there exists several cultures which somehow live alongside rather then fight and are somehow transcendent:
* **Hacker/Open Source culture**: sharing code, uses real name or not. Concentrated probably on small tools that solve one problem. Allows in-program hacks. Languages: *C*, *Lisp*, *C++*, *Python*. P... | Count me down as the 'old-school' guy. I never did LISP well, though. Emacs? Nah, `vi` and `set -o vi` in my shell for me thank you. |
6,005 | To the outside world, programmers, computer scientists, software engineers, and developers may all seem alike, but that's far from the case for the people who create software for a living. Any single programmer's ability and knowledge can range very widely, as well as their tools (OS, language, and yes, preferred edito... | 2010/09/21 | [
"https://softwareengineering.stackexchange.com/questions/6005",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/2026/"
] | I represent the lonely contingent of Delphi Devs under 30. Our caucus is small, but our hearts are big. | **Academics that make research using computers, not research about computers.**
They:
- are writing software that can consume unlimited quantities of CPU time, memory and disc space so they care (or at least try to care) of performance, *either* by using stuff like `-O3`, `time`, profilers, memcheck, and spend ho... |
6,005 | To the outside world, programmers, computer scientists, software engineers, and developers may all seem alike, but that's far from the case for the people who create software for a living. Any single programmer's ability and knowledge can range very widely, as well as their tools (OS, language, and yes, preferred edito... | 2010/09/21 | [
"https://softwareengineering.stackexchange.com/questions/6005",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/2026/"
] | I'm kind of in the Alt.NET/old-school CS camp. I work with Microsoft tech (C#, etc.), but I'm aware that there's a whole world around me, other languages, algorithms, frameworks, "stuff under the hood", etc. Not perfect, obviously, but it's a work in progress. | Count me down as the 'old-school' guy. I never did LISP well, though. Emacs? Nah, `vi` and `set -o vi` in my shell for me thank you. |
15,648,726 | I am trying to always redirect people to
```
https://www.somedomain.com/URL
```
when they come in on a non secure port. This is because my SSL is for this url.
When someone goes to <http://www.somedomain.com> they get sent to
```
http://www.www.somedomain.com
```
Here is the htaccess rewrite that i am trying... | 2013/03/26 | [
"https://Stackoverflow.com/questions/15648726",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2213594/"
] | You want this:
```
return parseFloat($scope.x) + parseFloat($scope.y);
```
`+` overrides string concatenation when you have 2 strings. You'll need to cast them to integers or floats explicitly. `-`,`*`,`/` will all cast to numbers if possible. | That is because the concatenation has higher precedence over addition operation or the Plus (+) Operator.
Since, Minus Operator (-) works just fine , here is a Simple Hack!
```
<script type="text/javascript">
function TodoCtrl($scope) {
$scope.total = function () {
//Subtracting a Zero converts... |
15,648,726 | I am trying to always redirect people to
```
https://www.somedomain.com/URL
```
when they come in on a non secure port. This is because my SSL is for this url.
When someone goes to <http://www.somedomain.com> they get sent to
```
http://www.www.somedomain.com
```
Here is the htaccess rewrite that i am trying... | 2013/03/26 | [
"https://Stackoverflow.com/questions/15648726",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2213594/"
] | That is because the concatenation has higher precedence over addition operation or the Plus (+) Operator.
Since, Minus Operator (-) works just fine , here is a Simple Hack!
```
<script type="text/javascript">
function TodoCtrl($scope) {
$scope.total = function () {
//Subtracting a Zero converts... | Adding floating numbers in correct way
```
$scope.Total = parseFloat($scope.firstValue) + parseFloat($scope.secondValue);
$scope.Total = parseFloat($scope.Total.toFixed(2));
```
The $scope.Total now will display correctly in the view if binding with `ng-model` is applied
for example if you have
```
$scope.firstV... |
15,648,726 | I am trying to always redirect people to
```
https://www.somedomain.com/URL
```
when they come in on a non secure port. This is because my SSL is for this url.
When someone goes to <http://www.somedomain.com> they get sent to
```
http://www.www.somedomain.com
```
Here is the htaccess rewrite that i am trying... | 2013/03/26 | [
"https://Stackoverflow.com/questions/15648726",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2213594/"
] | You want this:
```
return parseFloat($scope.x) + parseFloat($scope.y);
```
`+` overrides string concatenation when you have 2 strings. You'll need to cast them to integers or floats explicitly. `-`,`*`,`/` will all cast to numbers if possible. | Adding floating numbers in correct way
```
$scope.Total = parseFloat($scope.firstValue) + parseFloat($scope.secondValue);
$scope.Total = parseFloat($scope.Total.toFixed(2));
```
The $scope.Total now will display correctly in the view if binding with `ng-model` is applied
for example if you have
```
$scope.firstV... |
15,648,726 | I am trying to always redirect people to
```
https://www.somedomain.com/URL
```
when they come in on a non secure port. This is because my SSL is for this url.
When someone goes to <http://www.somedomain.com> they get sent to
```
http://www.www.somedomain.com
```
Here is the htaccess rewrite that i am trying... | 2013/03/26 | [
"https://Stackoverflow.com/questions/15648726",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2213594/"
] | If that is indeed the case then what is happening is the values that are being passed in for x and y are being treated as strings and concatenated. What you should do is convert them to numbers using `parseInt`
```
return parseInt($scope.x) + parseInt($scope.y);
```
or if you prefer brevity
```
return $scope.x*1 + ... | Adding floating numbers in correct way
```
$scope.Total = parseFloat($scope.firstValue) + parseFloat($scope.secondValue);
$scope.Total = parseFloat($scope.Total.toFixed(2));
```
The $scope.Total now will display correctly in the view if binding with `ng-model` is applied
for example if you have
```
$scope.firstV... |
15,648,726 | I am trying to always redirect people to
```
https://www.somedomain.com/URL
```
when they come in on a non secure port. This is because my SSL is for this url.
When someone goes to <http://www.somedomain.com> they get sent to
```
http://www.www.somedomain.com
```
Here is the htaccess rewrite that i am trying... | 2013/03/26 | [
"https://Stackoverflow.com/questions/15648726",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2213594/"
] | You want this:
```
return parseFloat($scope.x) + parseFloat($scope.y);
```
`+` overrides string concatenation when you have 2 strings. You'll need to cast them to integers or floats explicitly. `-`,`*`,`/` will all cast to numbers if possible. | I advise you to change the type of your input to "number", then, you will not need to parse it, angular will convert it automatically to interger. I did it and it works, without a scope, but only to declare your {{total}} |
15,648,726 | I am trying to always redirect people to
```
https://www.somedomain.com/URL
```
when they come in on a non secure port. This is because my SSL is for this url.
When someone goes to <http://www.somedomain.com> they get sent to
```
http://www.www.somedomain.com
```
Here is the htaccess rewrite that i am trying... | 2013/03/26 | [
"https://Stackoverflow.com/questions/15648726",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2213594/"
] | If that is indeed the case then what is happening is the values that are being passed in for x and y are being treated as strings and concatenated. What you should do is convert them to numbers using `parseInt`
```
return parseInt($scope.x) + parseInt($scope.y);
```
or if you prefer brevity
```
return $scope.x*1 + ... | You want this:
```
return parseFloat($scope.x) + parseFloat($scope.y);
```
`+` overrides string concatenation when you have 2 strings. You'll need to cast them to integers or floats explicitly. `-`,`*`,`/` will all cast to numbers if possible. |
15,648,726 | I am trying to always redirect people to
```
https://www.somedomain.com/URL
```
when they come in on a non secure port. This is because my SSL is for this url.
When someone goes to <http://www.somedomain.com> they get sent to
```
http://www.www.somedomain.com
```
Here is the htaccess rewrite that i am trying... | 2013/03/26 | [
"https://Stackoverflow.com/questions/15648726",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2213594/"
] | Adding floating numbers in correct way
```
$scope.Total = parseFloat($scope.firstValue) + parseFloat($scope.secondValue);
$scope.Total = parseFloat($scope.Total.toFixed(2));
```
The $scope.Total now will display correctly in the view if binding with `ng-model` is applied
for example if you have
```
$scope.firstV... | I advise you to change the type of your input to "number", then, you will not need to parse it, angular will convert it automatically to interger. I did it and it works, without a scope, but only to declare your {{total}} |
15,648,726 | I am trying to always redirect people to
```
https://www.somedomain.com/URL
```
when they come in on a non secure port. This is because my SSL is for this url.
When someone goes to <http://www.somedomain.com> they get sent to
```
http://www.www.somedomain.com
```
Here is the htaccess rewrite that i am trying... | 2013/03/26 | [
"https://Stackoverflow.com/questions/15648726",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2213594/"
] | That is because the concatenation has higher precedence over addition operation or the Plus (+) Operator.
Since, Minus Operator (-) works just fine , here is a Simple Hack!
```
<script type="text/javascript">
function TodoCtrl($scope) {
$scope.total = function () {
//Subtracting a Zero converts... | I advise you to change the type of your input to "number", then, you will not need to parse it, angular will convert it automatically to interger. I did it and it works, without a scope, but only to declare your {{total}} |
15,648,726 | I am trying to always redirect people to
```
https://www.somedomain.com/URL
```
when they come in on a non secure port. This is because my SSL is for this url.
When someone goes to <http://www.somedomain.com> they get sent to
```
http://www.www.somedomain.com
```
Here is the htaccess rewrite that i am trying... | 2013/03/26 | [
"https://Stackoverflow.com/questions/15648726",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2213594/"
] | You want this:
```
return parseFloat($scope.x) + parseFloat($scope.y);
```
`+` overrides string concatenation when you have 2 strings. You'll need to cast them to integers or floats explicitly. `-`,`*`,`/` will all cast to numbers if possible. | To add two numbers together I would parse the string for Integers and check for null:
```
function TodoCtrl($scope) {
$scope.total = function() {
var firstNum = parseInt($scope.firstNum)
var secondNum = parseInt($scope.secondNum);
if (!firstNum)
firstNum = 0;
if (!seco... |
15,648,726 | I am trying to always redirect people to
```
https://www.somedomain.com/URL
```
when they come in on a non secure port. This is because my SSL is for this url.
When someone goes to <http://www.somedomain.com> they get sent to
```
http://www.www.somedomain.com
```
Here is the htaccess rewrite that i am trying... | 2013/03/26 | [
"https://Stackoverflow.com/questions/15648726",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2213594/"
] | Make input type as number, since it is addition operation
```
<input type="text" ng-model="x" />
<input type="text" ng-model="y" />
``` | To add two numbers together I would parse the string for Integers and check for null:
```
function TodoCtrl($scope) {
$scope.total = function() {
var firstNum = parseInt($scope.firstNum)
var secondNum = parseInt($scope.secondNum);
if (!firstNum)
firstNum = 0;
if (!seco... |
11,076,467 | Basically what I'm trying to do is get the information from column x no matter how many times it was mentioned. means that if I have this kind of table:
```
x | y | z
------+-------+--------
hello | one | bye
hello | two | goodbye
hi | three | see you
```
so what I'm trying to do is creat... | 2012/06/18 | [
"https://Stackoverflow.com/questions/11076467",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/994705/"
] | You seem to be using only `x`. So you can just use query:
```
SELECT DISTINCT x FROM names
``` | if this is your query
```
$sql="SELECT * FROM names";
$result=mysql_query($sql);
```
Then
```
$sql="SELECT DISTINCT x FROM names";
$result=mysql_query($sql);
```
Change \* to x if you want only one column as it is faster |
3,931,485 | I'm trying to get the country from which the user is browsing the website so I can work out what currency to show on the website. I have tried using the GET scripts available from: <http://api.hostip.info> but they just return XX when I test it.
If anyone knows any better methods please share.
Thanks. | 2010/10/14 | [
"https://Stackoverflow.com/questions/3931485",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/356372/"
] | I use this:
```
$_SESSION['ip'] = $_SERVER['REMOTE_ADDR'];
$ip = $_SESSION['ip'];
$try1 = "http://ipinfodb.com/ip_query.php?ip=".$ip."&output=xml";
$try2 = "http://backup.ipinfodb.com/ip_query.php?ip=".$ip."&output=xml";
$XML = @simplexml_load_file($try1,NULL,TRUE);
if(!$XML) { $XML = @simplexml_load_file(... | You should use the [geoip library](http://php.net/manual/en/book.geoip.php).
Maxmind provides free databases and commercial databases, with a difference in the date of last update and precision, the commercial being of better quality.
See <http://www.maxmind.com/app/geolitecountry> for the free database.
I think it ... |
3,931,485 | I'm trying to get the country from which the user is browsing the website so I can work out what currency to show on the website. I have tried using the GET scripts available from: <http://api.hostip.info> but they just return XX when I test it.
If anyone knows any better methods please share.
Thanks. | 2010/10/14 | [
"https://Stackoverflow.com/questions/3931485",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/356372/"
] | Try these:
<http://ip-to-country.webhosting.info/>
<http://www.ip2location.com/>
Both are IP address-to-country databases, which allow you to look up the country of origin of a given IP address.
However it's important to note that these databases are not 100% accurate. They're a good guide, but you will get false r... | You should use the [geoip library](http://php.net/manual/en/book.geoip.php).
Maxmind provides free databases and commercial databases, with a difference in the date of last update and precision, the commercial being of better quality.
See <http://www.maxmind.com/app/geolitecountry> for the free database.
I think it ... |
3,931,485 | I'm trying to get the country from which the user is browsing the website so I can work out what currency to show on the website. I have tried using the GET scripts available from: <http://api.hostip.info> but they just return XX when I test it.
If anyone knows any better methods please share.
Thanks. | 2010/10/14 | [
"https://Stackoverflow.com/questions/3931485",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/356372/"
] | I use this:
```
$_SESSION['ip'] = $_SERVER['REMOTE_ADDR'];
$ip = $_SESSION['ip'];
$try1 = "http://ipinfodb.com/ip_query.php?ip=".$ip."&output=xml";
$try2 = "http://backup.ipinfodb.com/ip_query.php?ip=".$ip."&output=xml";
$XML = @simplexml_load_file($try1,NULL,TRUE);
if(!$XML) { $XML = @simplexml_load_file(... | You can use Geolocation to get the Coordinates and then some Service to get the Country from that, but the geolocation API is browser based so you can only access it via JavaScript and then have to pass theese Informations to PHP somehow, i wrote something on the JS Part once:
<http://www.lautr.com/utilizing-html5-geo... |
3,931,485 | I'm trying to get the country from which the user is browsing the website so I can work out what currency to show on the website. I have tried using the GET scripts available from: <http://api.hostip.info> but they just return XX when I test it.
If anyone knows any better methods please share.
Thanks. | 2010/10/14 | [
"https://Stackoverflow.com/questions/3931485",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/356372/"
] | Try these:
<http://ip-to-country.webhosting.info/>
<http://www.ip2location.com/>
Both are IP address-to-country databases, which allow you to look up the country of origin of a given IP address.
However it's important to note that these databases are not 100% accurate. They're a good guide, but you will get false r... | You can use Geolocation to get the Coordinates and then some Service to get the Country from that, but the geolocation API is browser based so you can only access it via JavaScript and then have to pass theese Informations to PHP somehow, i wrote something on the JS Part once:
<http://www.lautr.com/utilizing-html5-geo... |
3,931,485 | I'm trying to get the country from which the user is browsing the website so I can work out what currency to show on the website. I have tried using the GET scripts available from: <http://api.hostip.info> but they just return XX when I test it.
If anyone knows any better methods please share.
Thanks. | 2010/10/14 | [
"https://Stackoverflow.com/questions/3931485",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/356372/"
] | I use this:
```
$_SESSION['ip'] = $_SERVER['REMOTE_ADDR'];
$ip = $_SESSION['ip'];
$try1 = "http://ipinfodb.com/ip_query.php?ip=".$ip."&output=xml";
$try2 = "http://backup.ipinfodb.com/ip_query.php?ip=".$ip."&output=xml";
$XML = @simplexml_load_file($try1,NULL,TRUE);
if(!$XML) { $XML = @simplexml_load_file(... | **Try these:**
$key="9dcde915a1a065fbaf14165f00fcc0461b8d0a6b43889614e8acdb8343e2cf15";
$ip= "198.168.1230.122";
$url = "<http://api.ipinfodb.com/v3/ip-city/?key=>$key&ip=$ip&format=xml";
// load xml file
$xml = simplexml\_load\_file($url);
// print the name of the first element
echo $xml->getName() . "
";
// cr... |
3,931,485 | I'm trying to get the country from which the user is browsing the website so I can work out what currency to show on the website. I have tried using the GET scripts available from: <http://api.hostip.info> but they just return XX when I test it.
If anyone knows any better methods please share.
Thanks. | 2010/10/14 | [
"https://Stackoverflow.com/questions/3931485",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/356372/"
] | I use this:
```
$_SESSION['ip'] = $_SERVER['REMOTE_ADDR'];
$ip = $_SESSION['ip'];
$try1 = "http://ipinfodb.com/ip_query.php?ip=".$ip."&output=xml";
$try2 = "http://backup.ipinfodb.com/ip_query.php?ip=".$ip."&output=xml";
$XML = @simplexml_load_file($try1,NULL,TRUE);
if(!$XML) { $XML = @simplexml_load_file(... | There are many ways to do it as suggested by those earlier. But I suggest you take a look at the IP2 PHP library available at <https://github.com/ip2iq/ip2-lib-php> which we developed.
You can use it like below:
```
<?php
require_once("Ip2.php");
$ip2 = new \ip2iq\Ip2();
$country_code = $ip2->country('8.... |
3,931,485 | I'm trying to get the country from which the user is browsing the website so I can work out what currency to show on the website. I have tried using the GET scripts available from: <http://api.hostip.info> but they just return XX when I test it.
If anyone knows any better methods please share.
Thanks. | 2010/10/14 | [
"https://Stackoverflow.com/questions/3931485",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/356372/"
] | Try these:
<http://ip-to-country.webhosting.info/>
<http://www.ip2location.com/>
Both are IP address-to-country databases, which allow you to look up the country of origin of a given IP address.
However it's important to note that these databases are not 100% accurate. They're a good guide, but you will get false r... | **Try these:**
$key="9dcde915a1a065fbaf14165f00fcc0461b8d0a6b43889614e8acdb8343e2cf15";
$ip= "198.168.1230.122";
$url = "<http://api.ipinfodb.com/v3/ip-city/?key=>$key&ip=$ip&format=xml";
// load xml file
$xml = simplexml\_load\_file($url);
// print the name of the first element
echo $xml->getName() . "
";
// cr... |
3,931,485 | I'm trying to get the country from which the user is browsing the website so I can work out what currency to show on the website. I have tried using the GET scripts available from: <http://api.hostip.info> but they just return XX when I test it.
If anyone knows any better methods please share.
Thanks. | 2010/10/14 | [
"https://Stackoverflow.com/questions/3931485",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/356372/"
] | Try these:
<http://ip-to-country.webhosting.info/>
<http://www.ip2location.com/>
Both are IP address-to-country databases, which allow you to look up the country of origin of a given IP address.
However it's important to note that these databases are not 100% accurate. They're a good guide, but you will get false r... | There are many ways to do it as suggested by those earlier. But I suggest you take a look at the IP2 PHP library available at <https://github.com/ip2iq/ip2-lib-php> which we developed.
You can use it like below:
```
<?php
require_once("Ip2.php");
$ip2 = new \ip2iq\Ip2();
$country_code = $ip2->country('8.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.