qid int64 1 74.7M | question stringlengths 15 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 4 30.2k | response_k stringlengths 11 36.5k |
|---|---|---|---|---|---|
26,351 | I guess it is a pretty common feeling more or less everyone had at least once: Your boss is talking to you and you think "what would happen if I would just tell him to shut up". Very similar is the feeling of driving on a highway while thinking "what would happen if I would just drive my car into the oncoming traffic?"... | 2017/06/28 | [
"https://french.stackexchange.com/questions/26351",
"https://french.stackexchange.com",
"https://french.stackexchange.com/users/14154/"
] | The word (more a phrase) I was looking for is *L'appel du vide*. I found it on a webpage about "words that cannot be translated into another language".
This [Wikipedia article](https://en.m.wikipedia.org/wiki/L%27appel_du_vide) defines it as
>
> the urge to engage in a self-destructive behavior during everyday life... | Dans la question, le passage à l'acte n'est pas envisagé: les situations décrites sont juste des expériences de pensée.
Sinon, j'aurais proposé *pensées suicidaires*. |
6,782,804 | Reading the documentation and going through the Apple sample codes (and most of the third party Objective-C code available out there), I get the impression that you are not supposed to do exception handling by using try/catch and "traditional/C" methods.
Recently I was reading Amazons AWS iOS SDK and noticed that th... | 2011/07/21 | [
"https://Stackoverflow.com/questions/6782804",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/487855/"
] | There is every reason to avoid exceptions on iOS.
[Exceptions on iOS are explicitly reserved for catastrophic failure that cannot be recovered from. They are not intended to be used to do catch-and-recover type operations.](http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Exceptions/Exceptions.ht... | bbum is spot on. looks like AWS iOS SDK is moving towards NSError based approach for future releases. As of now they provided mechanism to stop Exceptions and work with NSErrors.
```
#import <AWSiOSSDK/AmazonErrorHandler.h>
// put this in didFinishLaunching
[AmazonErrorHandler shouldNotThrowExceptions];
```
mor... |
108,005 | I have set up google reCaptcha on contact us page but i dont know how to check its mandatory on submit for any other way. | 2016/03/25 | [
"https://magento.stackexchange.com/questions/108005",
"https://magento.stackexchange.com",
"https://magento.stackexchange.com/users/37310/"
] | To do so, you need some custom code, please follow below steps which work for me:
>
> Note: I assume you used **jQuery** library on your frontend theme
>
>
>
**Step-1**: On document ready add some custom class to your `reCAPTCHA` input field:
```
<script type="text/javascript">
jQuery(document).ready(function(){... | You can try this method:
[Magento Enable Captcha For Contact Us Form](http://www.magentostack.com/magento-enable-captcha-for-contact-us-form/)
Hope it will help you. |
61,817,908 | Learning from the book "python crash course second edition". I'm getting syntaxerrors for the code that is being taught inside the book and don't understand why.
```
bicycles = ['trek', 'cannondale', 'redline', 'specialized']
message = f"My first bicycle was a {bicycles[0].title()}."
print(bicycles[0].title())
print(... | 2020/05/15 | [
"https://Stackoverflow.com/questions/61817908",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11287873/"
] | You might be using python version 3.6 and below, message = f"My first bicycle was a {bicycles[0].title()}." 'f' strings are introduced in python 3.6 and above. So check you current python version, if your version below 3.6 then surely that's the error's route cause. Learn more about python 'f' string visit <https://www... | The code runs OK for me.
The syntax with `f` (`f"My first bicycle was a {bicycles[0].title()}."`) is new from Python 3.6.
Check that your Python version is recent enough. It's also useful to post the exact error you get. |
5,450,775 | I have recently read Apple's sample code for [MVCNetworking](http://developer.apple.com/library/ios/samplecode/MVCNetworking/) written by Apple's Developer Technical Support guru Quinn "The Eskimo!". The sample is really nice learning experience with what I guess are best development practices for iOS development.
What... | 2011/03/27 | [
"https://Stackoverflow.com/questions/5450775",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41307/"
] | If you're used to Java, this may seem strange. You'd expect an object creation message to throw an exception when it fails, rather than return `nil`. However, while [Objective-C on Mac OS X has support for exception handling](http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/ObjectiveC/Chapters/ocE... | Yup. I think it's a good idea.. It helps to filter out the edge cases (out of memory, input variables empty/nil) as soon as the variables are introduced. Although I am not sure the impact on speed because of the overhead! |
5,450,775 | I have recently read Apple's sample code for [MVCNetworking](http://developer.apple.com/library/ios/samplecode/MVCNetworking/) written by Apple's Developer Technical Support guru Quinn "The Eskimo!". The sample is really nice learning experience with what I guess are best development practices for iOS development.
What... | 2011/03/27 | [
"https://Stackoverflow.com/questions/5450775",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41307/"
] | Yup. I think it's a good idea.. It helps to filter out the edge cases (out of memory, input variables empty/nil) as soon as the variables are introduced. Although I am not sure the impact on speed because of the overhead! | I have [also asked this on Apple DevForums](https://devforums.apple.com/thread/93893?tstart=0). According to Quinn "The Eskimo!" (author of the MVCNetworking sample in question) it is a [matter of coding style and his personal preference](https://devforums.apple.com/message/408698#408698):
>
> I use lots of asserts b... |
5,450,775 | I have recently read Apple's sample code for [MVCNetworking](http://developer.apple.com/library/ios/samplecode/MVCNetworking/) written by Apple's Developer Technical Support guru Quinn "The Eskimo!". The sample is really nice learning experience with what I guess are best development practices for iOS development.
What... | 2011/03/27 | [
"https://Stackoverflow.com/questions/5450775",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41307/"
] | If you're used to Java, this may seem strange. You'd expect an object creation message to throw an exception when it fails, rather than return `nil`. However, while [Objective-C on Mac OS X has support for exception handling](http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/ObjectiveC/Chapters/ocE... | I guess it's a matter of personal choice. Usually asserts are used for debugging purpose so that the app crashes at the assert points if the conditions are not met. You'd normally like to strip them out on your app releases though.
I personally am too lazy to place asserts around every block of code as you have shown.... |
5,450,775 | I have recently read Apple's sample code for [MVCNetworking](http://developer.apple.com/library/ios/samplecode/MVCNetworking/) written by Apple's Developer Technical Support guru Quinn "The Eskimo!". The sample is really nice learning experience with what I guess are best development practices for iOS development.
What... | 2011/03/27 | [
"https://Stackoverflow.com/questions/5450775",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41307/"
] | I guess it's a matter of personal choice. Usually asserts are used for debugging purpose so that the app crashes at the assert points if the conditions are not met. You'd normally like to strip them out on your app releases though.
I personally am too lazy to place asserts around every block of code as you have shown.... | I have [also asked this on Apple DevForums](https://devforums.apple.com/thread/93893?tstart=0). According to Quinn "The Eskimo!" (author of the MVCNetworking sample in question) it is a [matter of coding style and his personal preference](https://devforums.apple.com/message/408698#408698):
>
> I use lots of asserts b... |
5,450,775 | I have recently read Apple's sample code for [MVCNetworking](http://developer.apple.com/library/ios/samplecode/MVCNetworking/) written by Apple's Developer Technical Support guru Quinn "The Eskimo!". The sample is really nice learning experience with what I guess are best development practices for iOS development.
What... | 2011/03/27 | [
"https://Stackoverflow.com/questions/5450775",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41307/"
] | If you're used to Java, this may seem strange. You'd expect an object creation message to throw an exception when it fails, rather than return `nil`. However, while [Objective-C on Mac OS X has support for exception handling](http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/ObjectiveC/Chapters/ocE... | I have [also asked this on Apple DevForums](https://devforums.apple.com/thread/93893?tstart=0). According to Quinn "The Eskimo!" (author of the MVCNetworking sample in question) it is a [matter of coding style and his personal preference](https://devforums.apple.com/message/408698#408698):
>
> I use lots of asserts b... |
18,569,994 | I have this code which shows/hides the div on click.
```
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>slide demo</title>
<style>
#showmenu {
background: '#5D8AA8';
border-radius: 35px;
border: none;
he... | 2013/09/02 | [
"https://Stackoverflow.com/questions/18569994",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2717658/"
] | Try with `inline-style` like
```
<button id="showmenu" type="button" style="font-weight:bold;">show menu</button>
```
Using `internal/external-style` use like
```
#showmenu {
font-weight : bold ;
}
``` | You can use the CSS [font-weight](https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight) setting.
Add this to your CSS:
```
#showmenu {
font-weight: bold;
}
```
* After adding this you can remove the `<b>` tags from the button's content. |
18,569,994 | I have this code which shows/hides the div on click.
```
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>slide demo</title>
<style>
#showmenu {
background: '#5D8AA8';
border-radius: 35px;
border: none;
he... | 2013/09/02 | [
"https://Stackoverflow.com/questions/18569994",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2717658/"
] | You can use the CSS [font-weight](https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight) setting.
Add this to your CSS:
```
#showmenu {
font-weight: bold;
}
```
* After adding this you can remove the `<b>` tags from the button's content. | just change your selector to
```
$('#showmenu b').text($('.menu').is(':visible') ? 'Show Menu' : 'Hide Menu');
//-------^---here
``` |
18,569,994 | I have this code which shows/hides the div on click.
```
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>slide demo</title>
<style>
#showmenu {
background: '#5D8AA8';
border-radius: 35px;
border: none;
he... | 2013/09/02 | [
"https://Stackoverflow.com/questions/18569994",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2717658/"
] | You can use the CSS [font-weight](https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight) setting.
Add this to your CSS:
```
#showmenu {
font-weight: bold;
}
```
* After adding this you can remove the `<b>` tags from the button's content. | You could use .html instead of .text like this
```
$(document).ready(function() {
$('#showmenu').click(function() {
$('#showmenu').html($('.menu').is(':visible') ? '<b>Show</b>' : '<b>Hide</b>');
$('.menu').toggle("slide");
});
});
```
Here's a [Fiddle](http://jsfiddle.net/mdesdev/QNMD4/) and please don... |
18,569,994 | I have this code which shows/hides the div on click.
```
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>slide demo</title>
<style>
#showmenu {
background: '#5D8AA8';
border-radius: 35px;
border: none;
he... | 2013/09/02 | [
"https://Stackoverflow.com/questions/18569994",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2717658/"
] | Try with `inline-style` like
```
<button id="showmenu" type="button" style="font-weight:bold;">show menu</button>
```
Using `internal/external-style` use like
```
#showmenu {
font-weight : bold ;
}
``` | Add this to your stylesheet?
```
button {
text-weight: bold;
}
``` |
18,569,994 | I have this code which shows/hides the div on click.
```
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>slide demo</title>
<style>
#showmenu {
background: '#5D8AA8';
border-radius: 35px;
border: none;
he... | 2013/09/02 | [
"https://Stackoverflow.com/questions/18569994",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2717658/"
] | Try with `inline-style` like
```
<button id="showmenu" type="button" style="font-weight:bold;">show menu</button>
```
Using `internal/external-style` use like
```
#showmenu {
font-weight : bold ;
}
``` | just change your selector to
```
$('#showmenu b').text($('.menu').is(':visible') ? 'Show Menu' : 'Hide Menu');
//-------^---here
``` |
18,569,994 | I have this code which shows/hides the div on click.
```
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>slide demo</title>
<style>
#showmenu {
background: '#5D8AA8';
border-radius: 35px;
border: none;
he... | 2013/09/02 | [
"https://Stackoverflow.com/questions/18569994",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2717658/"
] | Try with `inline-style` like
```
<button id="showmenu" type="button" style="font-weight:bold;">show menu</button>
```
Using `internal/external-style` use like
```
#showmenu {
font-weight : bold ;
}
``` | You could use .html instead of .text like this
```
$(document).ready(function() {
$('#showmenu').click(function() {
$('#showmenu').html($('.menu').is(':visible') ? '<b>Show</b>' : '<b>Hide</b>');
$('.menu').toggle("slide");
});
});
```
Here's a [Fiddle](http://jsfiddle.net/mdesdev/QNMD4/) and please don... |
18,569,994 | I have this code which shows/hides the div on click.
```
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>slide demo</title>
<style>
#showmenu {
background: '#5D8AA8';
border-radius: 35px;
border: none;
he... | 2013/09/02 | [
"https://Stackoverflow.com/questions/18569994",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2717658/"
] | Add this to your stylesheet?
```
button {
text-weight: bold;
}
``` | just change your selector to
```
$('#showmenu b').text($('.menu').is(':visible') ? 'Show Menu' : 'Hide Menu');
//-------^---here
``` |
18,569,994 | I have this code which shows/hides the div on click.
```
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>slide demo</title>
<style>
#showmenu {
background: '#5D8AA8';
border-radius: 35px;
border: none;
he... | 2013/09/02 | [
"https://Stackoverflow.com/questions/18569994",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2717658/"
] | Add this to your stylesheet?
```
button {
text-weight: bold;
}
``` | You could use .html instead of .text like this
```
$(document).ready(function() {
$('#showmenu').click(function() {
$('#showmenu').html($('.menu').is(':visible') ? '<b>Show</b>' : '<b>Hide</b>');
$('.menu').toggle("slide");
});
});
```
Here's a [Fiddle](http://jsfiddle.net/mdesdev/QNMD4/) and please don... |
51,190,180 | Somehow `position: 'absolute'` is not working in Android. It's working with iOS, but in Android it's not rendering. Does anybody know how to set position: "absolute" on an Android device?
```
Button: {
position: "absolute",
right: 0,
top: 0,
borderRadius: 4,
borderWidth: 2,
width: 100,
height: 40,
bor... | 2018/07/05 | [
"https://Stackoverflow.com/questions/51190180",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9468014/"
] | Wrapping the Button inside a View will work for both Android & iOS:
```
import React, { Component } from 'react';
import { Text, View, StyleSheet, Button } from 'react-native';
export default class App extends Component {
render() {
return (
<View style={styles.container}>
<View style={styles.butt... | if you have a **textinput** in your screen, you should check the windowsoftinputmode in
AndroidManifest.xml. if it's **adjustResize**, you should change it by **adjustPan**
your's:
```
android:windowSoftInputMode="adjustResize"
```
should be:
```
android:windowSoftInputMode="adjustPan"
``` |
51,190,180 | Somehow `position: 'absolute'` is not working in Android. It's working with iOS, but in Android it's not rendering. Does anybody know how to set position: "absolute" on an Android device?
```
Button: {
position: "absolute",
right: 0,
top: 0,
borderRadius: 4,
borderWidth: 2,
width: 100,
height: 40,
bor... | 2018/07/05 | [
"https://Stackoverflow.com/questions/51190180",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9468014/"
] | Wrapping the Button inside a View will work for both Android & iOS:
```
import React, { Component } from 'react';
import { Text, View, StyleSheet, Button } from 'react-native';
export default class App extends Component {
render() {
return (
<View style={styles.container}>
<View style={styles.butt... | this code will work fine on Android (not sure for IOS)
```
<View style={styles.containerView}>
{/* SearchBar */}
<Animated.View style={{
transform: [{ translateY: translateSearchContainer }],
position: "absolute",
top: 0,
left: 0,
right: 0,
ba... |
51,190,180 | Somehow `position: 'absolute'` is not working in Android. It's working with iOS, but in Android it's not rendering. Does anybody know how to set position: "absolute" on an Android device?
```
Button: {
position: "absolute",
right: 0,
top: 0,
borderRadius: 4,
borderWidth: 2,
width: 100,
height: 40,
bor... | 2018/07/05 | [
"https://Stackoverflow.com/questions/51190180",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9468014/"
] | Wrapping the Button inside a View will work for both Android & iOS:
```
import React, { Component } from 'react';
import { Text, View, StyleSheet, Button } from 'react-native';
export default class App extends Component {
render() {
return (
<View style={styles.container}>
<View style={styles.butt... | I had this same issue. I noticed that if I add a border the issue was fixed. So I solved it by adding this:
```
position: absolute;
right: 0;
top: 0;
${Platform.OS === 'android' &&
css`
border: 1px solid transparent;
margin: -1px;
`}
``` |
51,190,180 | Somehow `position: 'absolute'` is not working in Android. It's working with iOS, but in Android it's not rendering. Does anybody know how to set position: "absolute" on an Android device?
```
Button: {
position: "absolute",
right: 0,
top: 0,
borderRadius: 4,
borderWidth: 2,
width: 100,
height: 40,
bor... | 2018/07/05 | [
"https://Stackoverflow.com/questions/51190180",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9468014/"
] | Wrapping the Button inside a View will work for both Android & iOS:
```
import React, { Component } from 'react';
import { Text, View, StyleSheet, Button } from 'react-native';
export default class App extends Component {
render() {
return (
<View style={styles.container}>
<View style={styles.butt... | try adding `"100%"`.
if you are trying to center it at the bottom add `bottom:"100%"`
if top then `top:"100%"` which is exactly like the number 0, and this should work on all Platforms. |
62,372,917 | I have the following component:
```
import React, { useState, useEffect, useContext } from 'react';
import PropTypes from 'prop-types';
import { Redirect } from 'react-router-dom';
import DashboardContext from '../../contexts/DashboardContext';
import authorizeWorker from '../../workers/authorize-worker';
/**
* A pr... | 2020/06/14 | [
"https://Stackoverflow.com/questions/62372917",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4083744/"
] | The error is because **on initial render phase**, you render the component with `setIsDashboard(true);`, usually, you want to do it on mount (`useEffect` with empty dep array).
>
> There is an **initial render** phase, then [mount phase](http://projects.wojtekmaj.pl/react-lifecycle-methods-diagram/), see [component's... | The error is because you can't set state when you are rendering:
`dashboardContext.setIsDashboard(true);` is probably the problem.
You don't post your stack trace or line numbers so it's hard to tell exactly what the issue is:
<https://stackoverflow.com/help/minimal-reproducible-example> |
7,217,757 | I'm setting up <http://www.streetofwalls.com>
You'll see that there is an irritating gap appearing next to the relatively positioned #wrapper (which contains the whole page). It causes the whole page to scroll about an inch to the right (for no apparent reason). I can remove the gap by changing the position property, ... | 2011/08/27 | [
"https://Stackoverflow.com/questions/7217757",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1141918/"
] | You can use [levenshtein](http://php.net/manual/en/function.levenshtein.php) function
```
<?php
// input misspelled word
$input = 'helllo';
// array of words to check against
$words = array('hello' 'try', 'hel', 'hey hello');
// no shortest distance found, yet
$shortest = -1;
// loop through words to find the clos... | Another way is to use **similar\_text** function which returns result in percents.
See more <http://www.php.net/manual/en/function.similar-text.php> . |
7,217,757 | I'm setting up <http://www.streetofwalls.com>
You'll see that there is an irritating gap appearing next to the relatively positioned #wrapper (which contains the whole page). It causes the whole page to scroll about an inch to the right (for no apparent reason). I can remove the gap by changing the position property, ... | 2011/08/27 | [
"https://Stackoverflow.com/questions/7217757",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1141918/"
] | You can use [levenshtein](http://php.net/manual/en/function.levenshtein.php) function
```
<?php
// input misspelled word
$input = 'helllo';
// array of words to check against
$words = array('hello' 'try', 'hel', 'hey hello');
// no shortest distance found, yet
$shortest = -1;
// loop through words to find the clos... | if you want to sort your array, you can do this:
```
$arr = array("hello", "try", "hel", "hey hello");
$search = "hey"; //your search var
for($i=0; $i<count($arr); $i++) {
$temp_arr[$i] = levenshtein($search, $arr[$i]);
}
asort($temp_arr);
foreach($temp_arr as $k => $v) {
$sorted_arr[] = $arr[$k];
}
```
`$so... |
7,217,757 | I'm setting up <http://www.streetofwalls.com>
You'll see that there is an irritating gap appearing next to the relatively positioned #wrapper (which contains the whole page). It causes the whole page to scroll about an inch to the right (for no apparent reason). I can remove the gap by changing the position property, ... | 2011/08/27 | [
"https://Stackoverflow.com/questions/7217757",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1141918/"
] | This is a quick solution by using <http://php.net/manual/en/function.similar-text.php>:
>
> This calculates the similarity between two strings as described in Programming Classics: Implementing the World's Best Algorithms by Oliver (ISBN 0-131-00413-1). Note that this implementation does not use a stack as in Oliver'... | You can use [levenshtein](http://php.net/manual/en/function.levenshtein.php) function
```
<?php
// input misspelled word
$input = 'helllo';
// array of words to check against
$words = array('hello' 'try', 'hel', 'hey hello');
// no shortest distance found, yet
$shortest = -1;
// loop through words to find the clos... |
7,217,757 | I'm setting up <http://www.streetofwalls.com>
You'll see that there is an irritating gap appearing next to the relatively positioned #wrapper (which contains the whole page). It causes the whole page to scroll about an inch to the right (for no apparent reason). I can remove the gap by changing the position property, ... | 2011/08/27 | [
"https://Stackoverflow.com/questions/7217757",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1141918/"
] | You can use [levenshtein](http://php.net/manual/en/function.levenshtein.php) function
```
<?php
// input misspelled word
$input = 'helllo';
// array of words to check against
$words = array('hello' 'try', 'hel', 'hey hello');
// no shortest distance found, yet
$shortest = -1;
// loop through words to find the clos... | While @yceruto's answer is correct and informative, I would like to extend additional insights and demonstrate more modern implementation syntax.
* The three-way comparison operator (aka "[spaceship operator](https://www.tutorialspoint.com/php7/php7_spaceship_operator.htm)") `<=>` from PHP7+
* [Arrow function syntax](... |
7,217,757 | I'm setting up <http://www.streetofwalls.com>
You'll see that there is an irritating gap appearing next to the relatively positioned #wrapper (which contains the whole page). It causes the whole page to scroll about an inch to the right (for no apparent reason). I can remove the gap by changing the position property, ... | 2011/08/27 | [
"https://Stackoverflow.com/questions/7217757",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1141918/"
] | if you want to sort your array, you can do this:
```
$arr = array("hello", "try", "hel", "hey hello");
$search = "hey"; //your search var
for($i=0; $i<count($arr); $i++) {
$temp_arr[$i] = levenshtein($search, $arr[$i]);
}
asort($temp_arr);
foreach($temp_arr as $k => $v) {
$sorted_arr[] = $arr[$k];
}
```
`$so... | Another way is to use **similar\_text** function which returns result in percents.
See more <http://www.php.net/manual/en/function.similar-text.php> . |
7,217,757 | I'm setting up <http://www.streetofwalls.com>
You'll see that there is an irritating gap appearing next to the relatively positioned #wrapper (which contains the whole page). It causes the whole page to scroll about an inch to the right (for no apparent reason). I can remove the gap by changing the position property, ... | 2011/08/27 | [
"https://Stackoverflow.com/questions/7217757",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1141918/"
] | This is a quick solution by using <http://php.net/manual/en/function.similar-text.php>:
>
> This calculates the similarity between two strings as described in Programming Classics: Implementing the World's Best Algorithms by Oliver (ISBN 0-131-00413-1). Note that this implementation does not use a stack as in Oliver'... | Another way is to use **similar\_text** function which returns result in percents.
See more <http://www.php.net/manual/en/function.similar-text.php> . |
7,217,757 | I'm setting up <http://www.streetofwalls.com>
You'll see that there is an irritating gap appearing next to the relatively positioned #wrapper (which contains the whole page). It causes the whole page to scroll about an inch to the right (for no apparent reason). I can remove the gap by changing the position property, ... | 2011/08/27 | [
"https://Stackoverflow.com/questions/7217757",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1141918/"
] | While @yceruto's answer is correct and informative, I would like to extend additional insights and demonstrate more modern implementation syntax.
* The three-way comparison operator (aka "[spaceship operator](https://www.tutorialspoint.com/php7/php7_spaceship_operator.htm)") `<=>` from PHP7+
* [Arrow function syntax](... | Another way is to use **similar\_text** function which returns result in percents.
See more <http://www.php.net/manual/en/function.similar-text.php> . |
7,217,757 | I'm setting up <http://www.streetofwalls.com>
You'll see that there is an irritating gap appearing next to the relatively positioned #wrapper (which contains the whole page). It causes the whole page to scroll about an inch to the right (for no apparent reason). I can remove the gap by changing the position property, ... | 2011/08/27 | [
"https://Stackoverflow.com/questions/7217757",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1141918/"
] | This is a quick solution by using <http://php.net/manual/en/function.similar-text.php>:
>
> This calculates the similarity between two strings as described in Programming Classics: Implementing the World's Best Algorithms by Oliver (ISBN 0-131-00413-1). Note that this implementation does not use a stack as in Oliver'... | if you want to sort your array, you can do this:
```
$arr = array("hello", "try", "hel", "hey hello");
$search = "hey"; //your search var
for($i=0; $i<count($arr); $i++) {
$temp_arr[$i] = levenshtein($search, $arr[$i]);
}
asort($temp_arr);
foreach($temp_arr as $k => $v) {
$sorted_arr[] = $arr[$k];
}
```
`$so... |
7,217,757 | I'm setting up <http://www.streetofwalls.com>
You'll see that there is an irritating gap appearing next to the relatively positioned #wrapper (which contains the whole page). It causes the whole page to scroll about an inch to the right (for no apparent reason). I can remove the gap by changing the position property, ... | 2011/08/27 | [
"https://Stackoverflow.com/questions/7217757",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1141918/"
] | This is a quick solution by using <http://php.net/manual/en/function.similar-text.php>:
>
> This calculates the similarity between two strings as described in Programming Classics: Implementing the World's Best Algorithms by Oliver (ISBN 0-131-00413-1). Note that this implementation does not use a stack as in Oliver'... | While @yceruto's answer is correct and informative, I would like to extend additional insights and demonstrate more modern implementation syntax.
* The three-way comparison operator (aka "[spaceship operator](https://www.tutorialspoint.com/php7/php7_spaceship_operator.htm)") `<=>` from PHP7+
* [Arrow function syntax](... |
35,295,826 | I am writing a C program and using gcc 4.4.6 to compile. I do not want to use a c++ compiler.
I am implementing a component and I intend to have several instances of this component live and owned by other components at runtime.
As a means of decoupling the definition of an interface from its implementation and hide t... | 2016/02/09 | [
"https://Stackoverflow.com/questions/35295826",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/261295/"
] | You're almost there. Your interface has to be in terms of pointers to the opaque type:
```
struct hidden_implementation_type;
typedef struct hidden_implementation_type visible_type_to_clients;
int component_function1(visible_type_to_clients *instance_type);
```
and:
```
int main(void)
{
visible_type_to_clients... | Having structs hidden has advantages and disadvantages. A hidden struct can never be allocated by the client without constructor. A hidden struct requires a destructor and the client is required to remember calling it. This is an advantage or a disadvantage depending on your requirement.
Here are two implementations f... |
66,702,512 | I need to keep track of how many times I remove an element from my list. I have something like list remove(an element).
I tried:
```
c=0
list remove(an element)
c+=1
``` | 2021/03/19 | [
"https://Stackoverflow.com/questions/66702512",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15356186/"
] | `.testcontainer.properties` in my `$HOME` directory fixed the issue for me.
This file is used to override properties but I am still not sure how that fixes the issue.
I see in my `.gitlab.yml` that what we do and just imitated that in my local, that solved the issue. | For some it might help to update the version of testcontainers |
40,537,206 | i already posted this question and still cant seem to get it. whenever i hover for the first time on any of the smaller images the larger image appears on the placeholder and whenever i mouse out of the image the placeholder image is blank which is what i want it to do. however, after only doing it once, whenever i hov... | 2016/11/10 | [
"https://Stackoverflow.com/questions/40537206",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7050334/"
] | This code creates a new cropped SoftwareBitmap from an existing SoftwareBitmap. Useful if the image already is in memory.
```
async public static Task<SoftwareBitmap> GetCroppedBitmapAsync(SoftwareBitmap softwareBitmap,
uint startPointX, uint startPointY, uint width, uint height)
{
... | >
> Problem is, none of the solutions i found worked easily in UWP to crop that PdfBitmap before drawing it. I solved that problem without cropping a diagram, it's working, but to crop it is much more better and nicer solution.
>
>
>
You can crop it before the `PdfBitmap` creation.There is a good Sample project fo... |
23,245,359 | I am trying to build a audio/video streaming app that works cross platform on iOS and Android mobile devices.
No matter how deep I Google, I'm ending up with suggestions that point me towards OpenTok/TokBox API. But this is what I wish to avoid.
I've checked a few demo, but WebRTC/HTML5 do not seem to work with strea... | 2014/04/23 | [
"https://Stackoverflow.com/questions/23245359",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2041826/"
] | [getUserMedia](http://caniuse.com/stream) and [WebRTC Peer-to-peer connections](http://caniuse.com/rtcpeerconnection) APIs are not supported in iOS.
One of the reason is that at the moment efforts around WebRTC focus on VP8 video codec which Apple and Microsoft do not support natively. Support in the near future is u... | You might want to look into Ericsson's Bowser App <http://www.ericsson.com/research-blog/context-aware-communication/bowser-openwebrtc-released-open-source>. It claims to provide WebRTC on Android and IOS. Apparently the App is currently under review in the App Store so if you wait it may just be a case of downloading ... |
23,245,359 | I am trying to build a audio/video streaming app that works cross platform on iOS and Android mobile devices.
No matter how deep I Google, I'm ending up with suggestions that point me towards OpenTok/TokBox API. But this is what I wish to avoid.
I've checked a few demo, but WebRTC/HTML5 do not seem to work with strea... | 2014/04/23 | [
"https://Stackoverflow.com/questions/23245359",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2041826/"
] | [getUserMedia](http://caniuse.com/stream) and [WebRTC Peer-to-peer connections](http://caniuse.com/rtcpeerconnection) APIs are not supported in iOS.
One of the reason is that at the moment efforts around WebRTC focus on VP8 video codec which Apple and Microsoft do not support natively. Support in the near future is u... | good news, will be supported at Safari 11.0
<https://developer.apple.com/library/content/releasenotes/General/WhatsNewInSafari/Safari_11_0/Safari_11_0.html> |
23,245,359 | I am trying to build a audio/video streaming app that works cross platform on iOS and Android mobile devices.
No matter how deep I Google, I'm ending up with suggestions that point me towards OpenTok/TokBox API. But this is what I wish to avoid.
I've checked a few demo, but WebRTC/HTML5 do not seem to work with strea... | 2014/04/23 | [
"https://Stackoverflow.com/questions/23245359",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2041826/"
] | You might want to look into Ericsson's Bowser App <http://www.ericsson.com/research-blog/context-aware-communication/bowser-openwebrtc-released-open-source>. It claims to provide WebRTC on Android and IOS. Apparently the App is currently under review in the App Store so if you wait it may just be a case of downloading ... | good news, will be supported at Safari 11.0
<https://developer.apple.com/library/content/releasenotes/General/WhatsNewInSafari/Safari_11_0/Safari_11_0.html> |
12,810,685 | I want to define generic static method in my one of project.
Requirement is to method return type to be one of method parameter.
The below is my solution.
```
public static <T> List<T> convertMapToAttribute(Class<T> attrClass, T attr) {
List<T> list = null;
if (attrClass.equals(String.class)) {
list =... | 2012/10/10 | [
"https://Stackoverflow.com/questions/12810685",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1580974/"
] | The following should work fine:
```
List<T> list = new ArrayList<T>();
List<T> list = new ArrayList<>(); // Java 7
``` | Couldn't you just do something like...
```
public static <T> List<T> convertMapToAttribute(Class<T> attrClass, T attr) {
List<T> list = new ArrayList<T>(1);
list.add(attr);
return list;
}
```
instead?
**UPDATE based on feedback**
```
public static <T> List<T> convertMapToAttribute(T attr) {
List<T>... |
12,810,685 | I want to define generic static method in my one of project.
Requirement is to method return type to be one of method parameter.
The below is my solution.
```
public static <T> List<T> convertMapToAttribute(Class<T> attrClass, T attr) {
List<T> list = null;
if (attrClass.equals(String.class)) {
list =... | 2012/10/10 | [
"https://Stackoverflow.com/questions/12810685",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1580974/"
] | The following should work fine:
```
List<T> list = new ArrayList<T>();
List<T> list = new ArrayList<>(); // Java 7
``` | 1. Not to my knowledge
2. Skip the attrClass parameter, since it actually makes the method non-generic. |
12,810,685 | I want to define generic static method in my one of project.
Requirement is to method return type to be one of method parameter.
The below is my solution.
```
public static <T> List<T> convertMapToAttribute(Class<T> attrClass, T attr) {
List<T> list = null;
if (attrClass.equals(String.class)) {
list =... | 2012/10/10 | [
"https://Stackoverflow.com/questions/12810685",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1580974/"
] | Couldn't you just do something like...
```
public static <T> List<T> convertMapToAttribute(Class<T> attrClass, T attr) {
List<T> list = new ArrayList<T>(1);
list.add(attr);
return list;
}
```
instead?
**UPDATE based on feedback**
```
public static <T> List<T> convertMapToAttribute(T attr) {
List<T>... | 1. Not to my knowledge
2. Skip the attrClass parameter, since it actually makes the method non-generic. |
12,810,685 | I want to define generic static method in my one of project.
Requirement is to method return type to be one of method parameter.
The below is my solution.
```
public static <T> List<T> convertMapToAttribute(Class<T> attrClass, T attr) {
List<T> list = null;
if (attrClass.equals(String.class)) {
list =... | 2012/10/10 | [
"https://Stackoverflow.com/questions/12810685",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1580974/"
] | By having `Class<T>` as a parameter, the way to do a checked cast (and skip the annoying warning) is to invoke `attrClass.cast()` which will throw `ClassCastException` if the casting fails. In this case, `T` should be either `String` or `Integer`.
The problem here is that you're doing an unchecked cast from a list of ... | Couldn't you just do something like...
```
public static <T> List<T> convertMapToAttribute(Class<T> attrClass, T attr) {
List<T> list = new ArrayList<T>(1);
list.add(attr);
return list;
}
```
instead?
**UPDATE based on feedback**
```
public static <T> List<T> convertMapToAttribute(T attr) {
List<T>... |
12,810,685 | I want to define generic static method in my one of project.
Requirement is to method return type to be one of method parameter.
The below is my solution.
```
public static <T> List<T> convertMapToAttribute(Class<T> attrClass, T attr) {
List<T> list = null;
if (attrClass.equals(String.class)) {
list =... | 2012/10/10 | [
"https://Stackoverflow.com/questions/12810685",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1580974/"
] | By having `Class<T>` as a parameter, the way to do a checked cast (and skip the annoying warning) is to invoke `attrClass.cast()` which will throw `ClassCastException` if the casting fails. In this case, `T` should be either `String` or `Integer`.
The problem here is that you're doing an unchecked cast from a list of ... | 1. Not to my knowledge
2. Skip the attrClass parameter, since it actually makes the method non-generic. |
193,149 | We recently asked several manufacturers if they could send us a sample of their material(s) for us to test towards their suitability for a process we developed. They sent us free samples. Once we identify the most suitable material we plan on ordering more from that material.
After receiving the materials, we decided ... | 2023/02/03 | [
"https://academia.stackexchange.com/questions/193149",
"https://academia.stackexchange.com",
"https://academia.stackexchange.com/users/133549/"
] | You should definitely mention this in the paper. There is a conflict-of-interest concern here so that you should be as transparent as possible. This arrangement is very common with pharmaceutical manufacturers and academic research.
Whether you do it in the acknowledgement or within the methods is really up to you, I'... | I suggest that you ask each of them whether they would like to be acknowledged or not. Some might not want to be named, especially since you didn't make your intention about the use clear. Many corporations are (very) sensitive about being named in any way that might affect their brand.
If some say yes and some no, th... |
7,211,407 | I am using TLS between a Windows 7 acting as the server and an Android 2.2 acting as the client. The certificate was created using makecert.exe. The SSL socket creation works on both ends, but the negotiations on the server side report that the two end points do not share a common algorithm and therefore cannot communi... | 2011/08/26 | [
"https://Stackoverflow.com/questions/7211407",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/574771/"
] | It turns out that on this particular windows box I created a signing certificate rather than a data exchange certificate. I forgot the "sky" parameter in the makecert.exe command line tool. Once I fixed that it worked like a charm.
Thanks for all the replies, though. I do appreciate it. | If you aren't using the wrong name such as "TLS" instead of "TLSv1" then download [SpongyCastle](https://github.com/rtyley/spongycastle) and register it as a provider:
```
static {
Security.addProvider(new org.spongycastle.jce.provider.BouncyCastleProvider());
}
```
then get your SSLContext like so:
`SSLContext... |
41,959,390 | I am building an recommendation engine. This json file contains event data, I want to convert it into a dataframe. I tried read\_json method but it give an error
>
>
> ```
> UnicodeDecodeError:'charmap'codec can't decode byte 0x81
> in position 21573281:charactermaps to <undefined>
>
> ```
>
>
Below is some ent... | 2017/01/31 | [
"https://Stackoverflow.com/questions/41959390",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7472923/"
] | EdChum has you covered in the comments for how to fix your approach - you should be using [`.loc`](http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.loc.html) for indexing. However can achieve the same much more simply and without having to resort to row iteration by using `zip`.
```
In[43]: df['... | You never updated the original column. You just updated a variable named row. But for ease of remembering code (not the most efficient obviously):
```
df['C'] = zip(df.feature1, df.feature2)
``` |
41,959,390 | I am building an recommendation engine. This json file contains event data, I want to convert it into a dataframe. I tried read\_json method but it give an error
>
>
> ```
> UnicodeDecodeError:'charmap'codec can't decode byte 0x81
> in position 21573281:charactermaps to <undefined>
>
> ```
>
>
Below is some ent... | 2017/01/31 | [
"https://Stackoverflow.com/questions/41959390",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7472923/"
] | If you want to build a tuple out of two columns, be explicit and keep it simple:
```
df['c'] = df.apply(tuple, axis=1)
df
Out[7]:
feature1 feature2 c
0 0 0 (0, 0)
1 2 2 (2, 2)
``` | You never updated the original column. You just updated a variable named row. But for ease of remembering code (not the most efficient obviously):
```
df['C'] = zip(df.feature1, df.feature2)
``` |
41,959,390 | I am building an recommendation engine. This json file contains event data, I want to convert it into a dataframe. I tried read\_json method but it give an error
>
>
> ```
> UnicodeDecodeError:'charmap'codec can't decode byte 0x81
> in position 21573281:charactermaps to <undefined>
>
> ```
>
>
Below is some ent... | 2017/01/31 | [
"https://Stackoverflow.com/questions/41959390",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7472923/"
] | ```
df.assign(c=df.set_index(['feature1', 'feature2']).index.to_series().values)
``` | You never updated the original column. You just updated a variable named row. But for ease of remembering code (not the most efficient obviously):
```
df['C'] = zip(df.feature1, df.feature2)
``` |
38,853,769 | Why my array of functions is not triggered?
Edit:
Still nothing:
```
var actions = [];
$.each(data, function(i, v) {
actions.push(new Promise(function(resolve, reject) {
if (_this.apiConversatiosGet(v.app_id)) {
resolve();
}
}));
});
$.when(actions).done(function() {
consol... | 2016/08/09 | [
"https://Stackoverflow.com/questions/38853769",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2972127/"
] | Seeing your code you don't need promises.
Just make sure the Ajax/Deferred
object is stored in your array, as follows.
```
var actions = [];
$.each(data, function(i, v) {
actions.push(_this.apiConversatiosGet(v.app_id));
});
$.when.apply($, actions).done(function() {
console.log("done");
});
apiConversati... | It's a little unclear what you're asking, but if you want to evaluate the function as you push it to the array then you should do something like:
```
actions.push(function(){
alert("0");
}());
```
Adding the `()` to the end of the function will cause it to evaluate the function and use what the f... |
38,853,769 | Why my array of functions is not triggered?
Edit:
Still nothing:
```
var actions = [];
$.each(data, function(i, v) {
actions.push(new Promise(function(resolve, reject) {
if (_this.apiConversatiosGet(v.app_id)) {
resolve();
}
}));
});
$.when(actions).done(function() {
consol... | 2016/08/09 | [
"https://Stackoverflow.com/questions/38853769",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2972127/"
] | Seeing your code you don't need promises.
Just make sure the Ajax/Deferred
object is stored in your array, as follows.
```
var actions = [];
$.each(data, function(i, v) {
actions.push(_this.apiConversatiosGet(v.app_id));
});
$.when.apply($, actions).done(function() {
console.log("done");
});
apiConversati... | ```js
var actions = [];
actions.push = function(i){
alert(i);
Array.prototype.push.apply(this,[i]);
}
//TODO::BEGIN:Ajax Call
actions.push(0);
data = [1,2,3,4,5,6];
... |
38,853,769 | Why my array of functions is not triggered?
Edit:
Still nothing:
```
var actions = [];
$.each(data, function(i, v) {
actions.push(new Promise(function(resolve, reject) {
if (_this.apiConversatiosGet(v.app_id)) {
resolve();
}
}));
});
$.when(actions).done(function() {
consol... | 2016/08/09 | [
"https://Stackoverflow.com/questions/38853769",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2972127/"
] | Seeing your code you don't need promises.
Just make sure the Ajax/Deferred
object is stored in your array, as follows.
```
var actions = [];
$.each(data, function(i, v) {
actions.push(_this.apiConversatiosGet(v.app_id));
});
$.when.apply($, actions).done(function() {
console.log("done");
});
apiConversati... | ```
function processItem(i){
alert(i);
}
var act = [];
data = [1,2,3,4,5,6];
$.each(data, function (i, v) {
act.push(processItem(data[i]));
});
$.when.apply(null, act).done(function(){
alert("All was done");
});
```
<https://jsfiddle.net/6avom0v4/> |
334,927 | Given this code, can I alter the behavior of the Stack Overflow snippet editor to make the `console.log()` behave like [Node.js](http://en.wikipedia.org/wiki/Node.js)?
```js
var siUnits = [
{ symbol: "m", unit: "meter", quantity: "length"},
{ symbol: "k", unit: "kilogram", quantity: "mass"},
{ symbol: "... | 2016/09/20 | [
"https://meta.stackoverflow.com/questions/334927",
"https://meta.stackoverflow.com",
"https://meta.stackoverflow.com/users/3776535/"
] | You can use `JSON.stringify`
```js
var siUnits = [
{ symbol: "m", unit: "meter", quantity: "length"},
{ symbol: "k", unit: "kilogram", quantity: "mass"},
{ symbol: "s", unit: "second", quantity: "second"}
];
console.log(JSON.stringify(siUnits))
``` | You can create your own method to accomplish this. `JSON.stringify` can indent the JSON, but not just for one level. You'd have to compromise.
```js
var siUnits = [
{ symbol: "m", unit: "meter", quantity: "length"},
{ symbol: "k", unit: "kilogram", quantity: "mass"},
{ symbol: "s", unit: "second", quant... |
334,927 | Given this code, can I alter the behavior of the Stack Overflow snippet editor to make the `console.log()` behave like [Node.js](http://en.wikipedia.org/wiki/Node.js)?
```js
var siUnits = [
{ symbol: "m", unit: "meter", quantity: "length"},
{ symbol: "k", unit: "kilogram", quantity: "mass"},
{ symbol: "... | 2016/09/20 | [
"https://meta.stackoverflow.com/questions/334927",
"https://meta.stackoverflow.com",
"https://meta.stackoverflow.com/users/3776535/"
] | You can use `JSON.stringify`
```js
var siUnits = [
{ symbol: "m", unit: "meter", quantity: "length"},
{ symbol: "k", unit: "kilogram", quantity: "mass"},
{ symbol: "s", unit: "second", quantity: "second"}
];
console.log(JSON.stringify(siUnits))
``` | You could probably overload your object's toString function, but to be honest anything done is just going to muddy the example you were trying to make in your question or answer.
Furthermore, the indentation shown is the standard, and changing the current most used style just because it looks slightly different in nod... |
334,927 | Given this code, can I alter the behavior of the Stack Overflow snippet editor to make the `console.log()` behave like [Node.js](http://en.wikipedia.org/wiki/Node.js)?
```js
var siUnits = [
{ symbol: "m", unit: "meter", quantity: "length"},
{ symbol: "k", unit: "kilogram", quantity: "mass"},
{ symbol: "... | 2016/09/20 | [
"https://meta.stackoverflow.com/questions/334927",
"https://meta.stackoverflow.com",
"https://meta.stackoverflow.com/users/3776535/"
] | You could probably overload your object's toString function, but to be honest anything done is just going to muddy the example you were trying to make in your question or answer.
Furthermore, the indentation shown is the standard, and changing the current most used style just because it looks slightly different in nod... | You can create your own method to accomplish this. `JSON.stringify` can indent the JSON, but not just for one level. You'd have to compromise.
```js
var siUnits = [
{ symbol: "m", unit: "meter", quantity: "length"},
{ symbol: "k", unit: "kilogram", quantity: "mass"},
{ symbol: "s", unit: "second", quant... |
3,078,308 | You know how you can assign a temporary column name to a return value in a SQL statement like this?
```
SELECT something+this+that AS myvalue FROM mytable
```
Is it possible to use the temporary name `myvalue` as a conditional?
```
SELECT something+this+that AS myvalue FROM mytable WHERE myvalue = 10
```
I can't ... | 2010/06/20 | [
"https://Stackoverflow.com/questions/3078308",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/172350/"
] | Use a derived table...
```
SELECT
myvalue
FROM
(
SELECT something+this+that AS myvalue FROM mytable
) foo
WHERE
myvalue = 10
```
Or use a CTE which looks more elegant but is the same
```
;WITh myCTE AS
(
SELECT something+this+that AS myvalue FROM mytable
)
SELECT
myvalue
FROM
myCTE
W... | I don't think it is possible, but you may cheat by putting the data into a temporary table, and then running a second query to run the rest.
That, or dynamic SQL, but I'm not a fan of the latter. |
3,078,308 | You know how you can assign a temporary column name to a return value in a SQL statement like this?
```
SELECT something+this+that AS myvalue FROM mytable
```
Is it possible to use the temporary name `myvalue` as a conditional?
```
SELECT something+this+that AS myvalue FROM mytable WHERE myvalue = 10
```
I can't ... | 2010/06/20 | [
"https://Stackoverflow.com/questions/3078308",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/172350/"
] | I don't think it is possible, but you may cheat by putting the data into a temporary table, and then running a second query to run the rest.
That, or dynamic SQL, but I'm not a fan of the latter. | >
> SELECT something+this+that AS myvalue FROM mytable WHERE myvalue = 10
>
>
>
You could try something like that:
```
SELECT something+this+that AS myvalue
FROM `users`
HAVING myvalue=10;
``` |
3,078,308 | You know how you can assign a temporary column name to a return value in a SQL statement like this?
```
SELECT something+this+that AS myvalue FROM mytable
```
Is it possible to use the temporary name `myvalue` as a conditional?
```
SELECT something+this+that AS myvalue FROM mytable WHERE myvalue = 10
```
I can't ... | 2010/06/20 | [
"https://Stackoverflow.com/questions/3078308",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/172350/"
] | Use a derived table...
```
SELECT
myvalue
FROM
(
SELECT something+this+that AS myvalue FROM mytable
) foo
WHERE
myvalue = 10
```
Or use a CTE which looks more elegant but is the same
```
;WITh myCTE AS
(
SELECT something+this+that AS myvalue FROM mytable
)
SELECT
myvalue
FROM
myCTE
W... | >
> SELECT something+this+that AS myvalue FROM mytable WHERE myvalue = 10
>
>
>
You could try something like that:
```
SELECT something+this+that AS myvalue
FROM `users`
HAVING myvalue=10;
``` |
72,996,656 | I am building a registration screen and it is asking the user to choose a profile picture which is implemented inside the CircleAvatar widget, when the user clicks the avatar a bottomSheet appears with Camera Icon and Gallery icon to provide options for the user to select the image, now when i click on the camera icon ... | 2022/07/15 | [
"https://Stackoverflow.com/questions/72996656",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17369207/"
] | >
> Is there any advantage of using a UUIDField vs just having `default=uuid.uuid4` in a `CharField`?
>
>
>
**Yes**.
A `UUIDField` will for a [postgresql](/questions/tagged/postgresql "show questions tagged 'postgresql'") database make use of a [**`UUID`** type [postgresql-doc]](https://www.postgresql.org/docs/cu... | The `UUIDField` is essentially a 32-character long CharField that validates that a valid UUID has been provided. According to the documentation, a UUID type will be saved in Postgres but as a CharField in any other DB.
<https://docs.djangoproject.com/en/4.0/ref/models/fields/#uuidfield>
I don't see why you couldn't j... |
66,501,877 | I need remove some rows for a DataFrame like this:
`import pandas as pd`
`import numpy as np`
`input_ = pd.DataFrame()`
`input_ ['ID'] = [1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4]`
`input_ ['ST'] = [1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3]`
`input_ ['V'] = [NaN, NaN, 1, 1, NaN, 1, Nan, 1, NaN, NaN, NaN, NaN]`\
And ... | 2021/03/06 | [
"https://Stackoverflow.com/questions/66501877",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15340258/"
] | You can use the [Grafana REST API](https://grafana.com/docs/grafana/latest/http_api/dashboard/) to access the json definition of your dashboards.
The rest is 'just' iterating over all dashboards, receiving the code, search and replace and posting the changed dashboard code back to Grafana | Thanks @Jens Baitinger
Your tip helped. Though I did not try the API yet, (which I will).
I has exported the report to migrate to the new server and discovered the data link urls are present there. I was able to do an update.
So now I have options.
Thank You |
679 | Is there a hidden config variable for the "Word Separator for URL Titles" setting? What other hidden config variables remain undocumented in the [ExpressionEngine User Guide](http://ellislab.com/expressionengine/user-guide/general/hidden_configuration_variables.html)? | 2012/11/28 | [
"https://expressionengine.stackexchange.com/questions/679",
"https://expressionengine.stackexchange.com",
"https://expressionengine.stackexchange.com/users/237/"
] | Yes, there is `$config['word_separator'] = "dash";`
or `$config['word_separator'] = "underscore";` | Devot:ee has a page dedicated to this: <http://devot-ee.com/ee-config-vars> |
679 | Is there a hidden config variable for the "Word Separator for URL Titles" setting? What other hidden config variables remain undocumented in the [ExpressionEngine User Guide](http://ellislab.com/expressionengine/user-guide/general/hidden_configuration_variables.html)? | 2012/11/28 | [
"https://expressionengine.stackexchange.com/questions/679",
"https://expressionengine.stackexchange.com",
"https://expressionengine.stackexchange.com/users/237/"
] | Yes, there is `$config['word_separator'] = "dash";`
or `$config['word_separator'] = "underscore";` | You can also see any hidden config values that add-ons might have if you turn on the Output Profiler and then on the front end of the site you click Show on "Config Variables" which will show all the config items and their values. |
679 | Is there a hidden config variable for the "Word Separator for URL Titles" setting? What other hidden config variables remain undocumented in the [ExpressionEngine User Guide](http://ellislab.com/expressionengine/user-guide/general/hidden_configuration_variables.html)? | 2012/11/28 | [
"https://expressionengine.stackexchange.com/questions/679",
"https://expressionengine.stackexchange.com",
"https://expressionengine.stackexchange.com/users/237/"
] | Devot:ee has a page dedicated to this: <http://devot-ee.com/ee-config-vars> | You can also see any hidden config values that add-ons might have if you turn on the Output Profiler and then on the front end of the site you click Show on "Config Variables" which will show all the config items and their values. |
147,190 | I have a situation where most of the electrical outlets are placed low--about 2 inches above the floor measured from the bottom of the outlet plate. It originally had base moldings which rose to about a third of the way up the outlet plates, but was cut badly to fit and globs of caulk was used to fill the gaps, etc.
I... | 2018/09/18 | [
"https://diy.stackexchange.com/questions/147190",
"https://diy.stackexchange.com",
"https://diy.stackexchange.com/users/91228/"
] | The nuts leading to the mixing valve is what is keeping it on the pipes. Undo those (after shutting off the water) and the mixing valve will come off.
Then you can install a new tap assembly. There are models that come with a diverter where a shower can be attached to. Those are often used for bathtubs. | That is an "external mixing valve" the advantage of which is that the wall does not have to be opened up to change the entire mixing valve. Look on youtube for videos showing installation of external mixing valves.
The usual expected spacing for the supply lines for an external mixing valve is 15 cm (about 6 inches). ... |
55,872,340 | I'm having trouble with this question in my Database homework And need to answer this question:
**Which employee has the highest sales to the customer who has made the most purchases?**
And these are my database tables
[](https://i.stack.imgur.com/Hu... | 2019/04/26 | [
"https://Stackoverflow.com/questions/55872340",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11096853/"
] | Try to solve the problem step by step. Find the customer id with most orders by total:
```
SELECT TOP 1 sales.customerid
FROM sales
JOIN products ON sales.productid = products.productid
GROUP BY sales.customerid
ORDER BY SUM(sales.quantity * products.price) DESC
```
Next step is to find the employee with most sales ... | Maybe something like this....
First get the customer with most purchases and then find all employees who have sold to that customer and return the top 1 employee with the most sales.
```
SELECT TOP (1)
e.EmploeeId
, SUM(s.quantity * p.Price) TotalSales
FROM Emploees e
inner join Sales ... |
55,872,340 | I'm having trouble with this question in my Database homework And need to answer this question:
**Which employee has the highest sales to the customer who has made the most purchases?**
And these are my database tables
[](https://i.stack.imgur.com/Hu... | 2019/04/26 | [
"https://Stackoverflow.com/questions/55872340",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11096853/"
] | Maybe something like this....
First get the customer with most purchases and then find all employees who have sold to that customer and return the top 1 employee with the most sales.
```
SELECT TOP (1)
e.EmploeeId
, SUM(s.quantity * p.Price) TotalSales
FROM Emploees e
inner join Sales ... | In one of the comments you said that "most sales" mean more sale quantity. This answer takes this criteria into consideration.
```
SELECT TOP (1) SalesPersonID,
(FirstName + ' ' + MiddleName + ' ' + LastName) AS EmployeeName
FROM Sales S
JOIN Employees E ON S.S... |
55,872,340 | I'm having trouble with this question in my Database homework And need to answer this question:
**Which employee has the highest sales to the customer who has made the most purchases?**
And these are my database tables
[](https://i.stack.imgur.com/Hu... | 2019/04/26 | [
"https://Stackoverflow.com/questions/55872340",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11096853/"
] | Try to solve the problem step by step. Find the customer id with most orders by total:
```
SELECT TOP 1 sales.customerid
FROM sales
JOIN products ON sales.productid = products.productid
GROUP BY sales.customerid
ORDER BY SUM(sales.quantity * products.price) DESC
```
Next step is to find the employee with most sales ... | In one of the comments you said that "most sales" mean more sale quantity. This answer takes this criteria into consideration.
```
SELECT TOP (1) SalesPersonID,
(FirstName + ' ' + MiddleName + ' ' + LastName) AS EmployeeName
FROM Sales S
JOIN Employees E ON S.S... |
446,147 | I am navigating with CMD+TAB through the app-switcher, but if I release the keys on a closed window, I get only the focus on that application. Is there a way to reopen that window again, with a **shortcut**? | 2012/07/07 | [
"https://superuser.com/questions/446147",
"https://superuser.com",
"https://superuser.com/users/144639/"
] | 10 MB/s is about the limit of fast Ethernet. So a Gigabit router will most likely help a lot in the wired case -- if both devices support Gigabit Ethernet.
As for the wireless case, it will depend on the capabilities of the particular router and the particular wireless interface on the other end. If 802.11n is support... | Probable answer: **No**
The long answer is comes in three parts:
1. When you used a wired connection your speeds is about 10 MBps. That roughly equals 100mbit wire speeds. Getting a faster **wired** connection will probably help.
2. A gigabit wireless router probably means a router with **wired** gigabit connections... |
35,086,051 | I have a tableview whose rows are dynamic and each row have n numbers of imageviews as it is in the screenshot attached [](https://i.stack.imgur.com/bF0I0.jpg)
Now what I want is to know which imageview I have clicked.
NOTE : imageview is added dynamica... | 2016/01/29 | [
"https://Stackoverflow.com/questions/35086051",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2388856/"
] | In your cellForRowAtIndexPath method add the `UITapGestureRecognizer` for your Concept
```
// by default the imageview userInteraction is disable you need to manually enable
cell.yourimageView.userInteractionEnabled = YES;
// the following line used for assign the different tags for eachImage
cell.yourimageView.tag = ... | Try giving a button instead of image view added to a view. Assign the image to button's backgroundImageView. You can then give actions for the buttons |
35,086,051 | I have a tableview whose rows are dynamic and each row have n numbers of imageviews as it is in the screenshot attached [](https://i.stack.imgur.com/bF0I0.jpg)
Now what I want is to know which imageview I have clicked.
NOTE : imageview is added dynamica... | 2016/01/29 | [
"https://Stackoverflow.com/questions/35086051",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2388856/"
] | In your cellForRowAtIndexPath method add the `UITapGestureRecognizer` for your Concept
```
// by default the imageview userInteraction is disable you need to manually enable
cell.yourimageView.userInteractionEnabled = YES;
// the following line used for assign the different tags for eachImage
cell.yourimageView.tag = ... | Use UIButton as @Arun says or the imageview ur using currently add button on Image with clear background color and add tag to that button and use that click action. |
30,898,041 | In older textbooks1 one frequently encounters operator declarations like the following:
```
?- op(1200,fx,(:-)).
^ ^
```
These round brackets used to be necessary. But today, they are no longer needed:
```
| ?- writeq(op(1200,fx,(:-))).
op(1200,fx,:-)
```
Why are they no longer needed? How doe... | 2015/06/17 | [
"https://Stackoverflow.com/questions/30898041",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/772868/"
] | You can use `viewToModel()` method (in fact you already use it) to detect charatcer position for the clicked point.
Then use `javax.swing.text.Utilities` class. It has methods:
```
public static final int getWordStart(JTextComponent c, int offs)
public static final int getWordEnd(JTextComponent c, int offs)
```
Jus... | People who got the same problem... Here's how I solved it.
First, add `mouseClicked` event to your `jTextPane` (this can be done in design tab in netbeans). Write the code to get the clicked text from the `jTextPane`. Here's the code:
```
private void jTextPane1MouseClicked(java.awt.event.MouseEvent evt) { ... |
30,898,041 | In older textbooks1 one frequently encounters operator declarations like the following:
```
?- op(1200,fx,(:-)).
^ ^
```
These round brackets used to be necessary. But today, they are no longer needed:
```
| ?- writeq(op(1200,fx,(:-))).
op(1200,fx,:-)
```
Why are they no longer needed? How doe... | 2015/06/17 | [
"https://Stackoverflow.com/questions/30898041",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/772868/"
] | You can use `viewToModel()` method (in fact you already use it) to detect charatcer position for the clicked point.
Then use `javax.swing.text.Utilities` class. It has methods:
```
public static final int getWordStart(JTextComponent c, int offs)
public static final int getWordEnd(JTextComponent c, int offs)
```
Jus... | ```
//You can get text without highlighting it like:
private void jTextPaneMouseClicked(java.awt.event.MouseEvent evt) {
try
{
String word = null;
int point = jTextPane.viewToModel(evt.getPoint());
int startPoint = Utilities.getWordStart(... |
30,898,041 | In older textbooks1 one frequently encounters operator declarations like the following:
```
?- op(1200,fx,(:-)).
^ ^
```
These round brackets used to be necessary. But today, they are no longer needed:
```
| ?- writeq(op(1200,fx,(:-))).
op(1200,fx,:-)
```
Why are they no longer needed? How doe... | 2015/06/17 | [
"https://Stackoverflow.com/questions/30898041",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/772868/"
] | People who got the same problem... Here's how I solved it.
First, add `mouseClicked` event to your `jTextPane` (this can be done in design tab in netbeans). Write the code to get the clicked text from the `jTextPane`. Here's the code:
```
private void jTextPane1MouseClicked(java.awt.event.MouseEvent evt) { ... | ```
//You can get text without highlighting it like:
private void jTextPaneMouseClicked(java.awt.event.MouseEvent evt) {
try
{
String word = null;
int point = jTextPane.viewToModel(evt.getPoint());
int startPoint = Utilities.getWordStart(... |
8,635,797 | D is one of the fastest programming languages to compile, if not the fastest, but this isn't always the case. Things become painfully slow when `unittest` is turned on. My current project has 6-7 modules (~2000 LOC), with every single one of them having unittests that also contain benchmarks. Here are some numbers from... | 2011/12/26 | [
"https://Stackoverflow.com/questions/8635797",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/554075/"
] | DMD has a known issue with optimisations: [long blocks of code optimise with an O(n^2) algorithm](http://d.puremagic.com/issues/show_bug.cgi?id=7157), so long functions take a long time to compile with optimisations.
Try splitting your code up into smaller functions and you should get better compile times in the meant... | A very tiny performance improvement could be to move template instantiation to module-scope, via a `version(unittest) block`, e.g.:
```
auto foo(T)(T t) { return t; }
version(unittest) {
alias foo!int fooInt;
}
unittest {
auto x = fooInt(1);
}
```
Profiling this, I get around `~30msec` speed improvement if... |
8,635,797 | D is one of the fastest programming languages to compile, if not the fastest, but this isn't always the case. Things become painfully slow when `unittest` is turned on. My current project has 6-7 modules (~2000 LOC), with every single one of them having unittests that also contain benchmarks. Here are some numbers from... | 2011/12/26 | [
"https://Stackoverflow.com/questions/8635797",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/554075/"
] | A very tiny performance improvement could be to move template instantiation to module-scope, via a `version(unittest) block`, e.g.:
```
auto foo(T)(T t) { return t; }
version(unittest) {
alias foo!int fooInt;
}
unittest {
auto x = fooInt(1);
}
```
Profiling this, I get around `~30msec` speed improvement if... | I did replace much of my generic code, but it only reduced compilation time by 4-5 seconds. Things have gotten worse, and I believe the compiler is probably the issue:
`time dmd -O -inline -release -noboundscheck -unittest` takes `0m30.388s`
`time dmd -O -inline -release -noboundscheck` takes `0m11.597s`
`time dmd -... |
8,635,797 | D is one of the fastest programming languages to compile, if not the fastest, but this isn't always the case. Things become painfully slow when `unittest` is turned on. My current project has 6-7 modules (~2000 LOC), with every single one of them having unittests that also contain benchmarks. Here are some numbers from... | 2011/12/26 | [
"https://Stackoverflow.com/questions/8635797",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/554075/"
] | DMD has a known issue with optimisations: [long blocks of code optimise with an O(n^2) algorithm](http://d.puremagic.com/issues/show_bug.cgi?id=7157), so long functions take a long time to compile with optimisations.
Try splitting your code up into smaller functions and you should get better compile times in the meant... | I did replace much of my generic code, but it only reduced compilation time by 4-5 seconds. Things have gotten worse, and I believe the compiler is probably the issue:
`time dmd -O -inline -release -noboundscheck -unittest` takes `0m30.388s`
`time dmd -O -inline -release -noboundscheck` takes `0m11.597s`
`time dmd -... |
37,635,784 | I have Googled a number of possibilities on how to get the item which is clicked in a recycler view but none of them seem to work. The code below should work but I dont understand why its not. In android studio, the getPosition() method is crossed out. I am running out of ideas, Is there a way i can at least toast the ... | 2016/06/04 | [
"https://Stackoverflow.com/questions/37635784",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5064891/"
] | You can get the current credentials via the Portal or PowerShell/CLI.
Azure Portal
------------
On the portal, there is a button at the top of the webapp blade to download the publish profile (not the deployment credentials blade, but the main web app blade).
[.
```
az webapp deployment list-publishing-profiles --name your_web_app_name --resource-group your_resource_group
`... |
25,159,287 | i am trying to achieve a MANY\_TO\_MANY relationship between two entities with an additional attribute in the join table.
i found the following answer:
[how-to-do-a-many-to-many-relationship-in-spring-roo-with-attributes-within-de-relationship](https://stackoverflow.com/questions/7286833/how-to-do-a-many-to-many-relati... | 2014/08/06 | [
"https://Stackoverflow.com/questions/25159287",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3913423/"
] | Try to add the [@OrderBy](http://docs.oracle.com/javaee/6/api/javax/persistence/OrderBy.html) annotation to entity field (in *.java* file). By example:
```
@ManyToMany
@OrderBy("lastName ASC, firstName ASC")
private List<Author> authors;
``` | i found a more or less working solution for my problem, but it still has some drawbacks. it is mostly derived from the above mentioned answer:
[How to do a many-to-many relationship in spring Roo, with attributes within de relationship?](https://stackoverflow.com/questions/7286833/how-to-do-a-many-to-many-relationship-... |
123,293 | I'm a citizen in my brother's town, and he's the mayor. Both of us have paid off our mortgage, but he can get to the island while I can't.
I've waited a day and nobody gave me an invite. Am I just not able to go to the island? | 2013/07/09 | [
"https://gaming.stackexchange.com/questions/123293",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/51563/"
] | Citizens (even visitors) can go to the Island, but I'll bet the Mayor has to actually unlock the island (the mayor needs to do certain tasks, and the Island unlock is part of the "tutorial" that's unique to the mayor).
Have your brother check in and Tortimer should appear outside his house a day or two after paying of... | To get to your village's island, you will require a mayor of the town. To do this, the player who needs to be mayor must have a house (so they have to pay off their mortgage and upgrade from their tent), and get citizens approval. You can get this via doing certain tasks. My preferred way of doing this is: collecting f... |
39,699,901 | I try to send email and take text for it from several `EditText`s. But when I click the button, I see only the last one `EditText` in a body of email.
Whats' wrong with it?
```
private View.OnClickListener myListener = new View.OnClickListener() {
public void onClick(View v) {
Intent emailIntent = new Int... | 2016/09/26 | [
"https://Stackoverflow.com/questions/39699901",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6881584/"
] | Try like below, it will work for you
by merging strings in one you can achieve what you exactly want
```
private View.OnClickListener myListener = new View.OnClickListener() {
public void onClick(View v) {
Intent emailIntent = new Intent(Intent.ACTION_SEND_MULTIPLE);
em... | You need to use `StringBuilder` in your case as each time the `EXTRA_TEXT` is replaced when you set a new value to it.
You might do something like this.
```
StringBuilder sb;
sb.append("Имя клиента: " + getOrderName());
sb.append('\n');
sb.append("Номер телефона : " + getOrderPhone());
sb.append('\n');
sb.append("... |
39,699,901 | I try to send email and take text for it from several `EditText`s. But when I click the button, I see only the last one `EditText` in a body of email.
Whats' wrong with it?
```
private View.OnClickListener myListener = new View.OnClickListener() {
public void onClick(View v) {
Intent emailIntent = new Int... | 2016/09/26 | [
"https://Stackoverflow.com/questions/39699901",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6881584/"
] | Try like below, it will work for you
by merging strings in one you can achieve what you exactly want
```
private View.OnClickListener myListener = new View.OnClickListener() {
public void onClick(View v) {
Intent emailIntent = new Intent(Intent.ACTION_SEND_MULTIPLE);
em... | Extra Text which you are trying to send is a one key identifier. So, it will get replaced everytime when you putExtra. This is the reason why only your last putExtra is getting added.
Try to concatenate your message string and then add it to putExtra. |
39,699,901 | I try to send email and take text for it from several `EditText`s. But when I click the button, I see only the last one `EditText` in a body of email.
Whats' wrong with it?
```
private View.OnClickListener myListener = new View.OnClickListener() {
public void onClick(View v) {
Intent emailIntent = new Int... | 2016/09/26 | [
"https://Stackoverflow.com/questions/39699901",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6881584/"
] | Try like below, it will work for you
by merging strings in one you can achieve what you exactly want
```
private View.OnClickListener myListener = new View.OnClickListener() {
public void onClick(View v) {
Intent emailIntent = new Intent(Intent.ACTION_SEND_MULTIPLE);
em... | May be this will help.
Create a string "email\_body" and put whole body part of email in it and then pass it in Intent.
```
String email_body="Имя клиента: "+getOrderName()+"\nНомер телефона : "+getOrderPhone()+.......+ getOrderTime();
```
And then in your click listener do this.
```
Intent emailIntent = new In... |
39,699,901 | I try to send email and take text for it from several `EditText`s. But when I click the button, I see only the last one `EditText` in a body of email.
Whats' wrong with it?
```
private View.OnClickListener myListener = new View.OnClickListener() {
public void onClick(View v) {
Intent emailIntent = new Int... | 2016/09/26 | [
"https://Stackoverflow.com/questions/39699901",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6881584/"
] | You need to use `StringBuilder` in your case as each time the `EXTRA_TEXT` is replaced when you set a new value to it.
You might do something like this.
```
StringBuilder sb;
sb.append("Имя клиента: " + getOrderName());
sb.append('\n');
sb.append("Номер телефона : " + getOrderPhone());
sb.append('\n');
sb.append("... | May be this will help.
Create a string "email\_body" and put whole body part of email in it and then pass it in Intent.
```
String email_body="Имя клиента: "+getOrderName()+"\nНомер телефона : "+getOrderPhone()+.......+ getOrderTime();
```
And then in your click listener do this.
```
Intent emailIntent = new In... |
39,699,901 | I try to send email and take text for it from several `EditText`s. But when I click the button, I see only the last one `EditText` in a body of email.
Whats' wrong with it?
```
private View.OnClickListener myListener = new View.OnClickListener() {
public void onClick(View v) {
Intent emailIntent = new Int... | 2016/09/26 | [
"https://Stackoverflow.com/questions/39699901",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6881584/"
] | Extra Text which you are trying to send is a one key identifier. So, it will get replaced everytime when you putExtra. This is the reason why only your last putExtra is getting added.
Try to concatenate your message string and then add it to putExtra. | May be this will help.
Create a string "email\_body" and put whole body part of email in it and then pass it in Intent.
```
String email_body="Имя клиента: "+getOrderName()+"\nНомер телефона : "+getOrderPhone()+.......+ getOrderTime();
```
And then in your click listener do this.
```
Intent emailIntent = new In... |
46,721,624 | ```
public static int[][] shift(final int[][] original, final int amount) {
int[][] shifted = new int[original.length][original[0].length];
for (int col = 0; col < original.length; col++) {
for (int row = 0; row < original[col].length; row++) {
shifted[col][row] = FILL_VALUE;
}... | 2017/10/13 | [
"https://Stackoverflow.com/questions/46721624",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8167749/"
] | I believe it's because in your second outer for loop, the condition is cols < length + amount, so it will continue past the edge of the array if amount > 0. You could step through your code with a debugger and see exactly where it's going out of bounds. | The error is occurring because of following line:
shifted[cols][rows] = original[cols - amount][rows];
When cols=0, rows=0, amount=2 (say), it is trying to access original[-2][0] which does not exist.
Instead you may use following:
```
public class overflow1 {
static int a[][] = {{1,2,3,4,5,6},{2,3,4,5,6,7},{3... |
55,594 | I have an x64 machine that regularly needs about 10 aliases changed in the SQL Server Client Network Utility (cliconfig) for both the x64 and x86 sides of the registry. Is there a way I could do this with a powershell script? | 2009/08/18 | [
"https://serverfault.com/questions/55594",
"https://serverfault.com",
"https://serverfault.com/users/40367/"
] | cliconfig.exe is used in SQL Server 2000, the right tool to be using for SQL Server 2008 is SQL Server Configuration Manager. Nonetheless they both seem to manipulate the same registry keys.
For x86:
>
> HKLM\SOFTWARE\Microsoft\MSSQLServer\Client\ConnectTo
>
>
>
For x64:
>
> HKLM:\Software\Wow6432Node\Microsof... | I believe you should use WMI for doing this. In root\Microsoft\SqlServer\ComputerManagement namespace there is an object of type SqlServerAlias which corresponds to server alias. Try using it - as far as I know using WMI is a recommended way of performing such tasks. |
133,310 | I can create "whitelist" functionality for blocking all sites and allowing some via the GP setting: `User Configuration > Windows Settings > Internet Explorer Maintenance > Connection/Proxy Settings > Exceptions - Do not use proxy server for addresses beginning with`.
Can I create also a blacklist option like this (or... | 2010/04/17 | [
"https://serverfault.com/questions/133310",
"https://serverfault.com",
"https://serverfault.com/users/8543/"
] | A great way to manage this would be with your internal DNS server. You can setup DNS BlackHoles. Which you can set to go to 127.0.0.1 or whatever IP address you want.
This is a lot more manageable and scalable.
You can read up a bit more about it here:
<http://www.malwaredomains.com/bhdns.html> | A hack way to do this would be to keep a HOSTS file on your Netlogon share, and have a Group Policy run a logon script for the users to copy the HOSTS file to their `C:\Windows\System32\drivers\etc` folder.
The contents of the HOSTS file would contain a list of domains and bogus IP addresses:
```
google.com 127.0.... |
170,681 | Please help me understand the following definition:
>
> Let $(X,d)$ be a metric space, a subset $S \in X$ is called *compact*, if any infinite sequence $\{x\_{n}\}\_{n\in\Bbb N}\in S$ has a sub-sequence with a limit in S.
>
>
>
1. What does "if any infinite sequence" mean? Maybe: At least one, all?
2. What does "... | 2012/07/14 | [
"https://math.stackexchange.com/questions/170681",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/6857/"
] | The definition can be reformulated as follows - "Let $(X,d)$ be a metric space, a subset $S∈X$ is called compact, if for all infinte sequences $\{ x\_{n}\}\_{n=1}^{∞}\subseteq S$ the following holds: $\{ x\_{n}\}\_{n=1}^{∞}$ has a concentration point and if $\bar{x}$ is a concentration point of $\{x\_{n}\}\_{n=1}^{∞}$ ... | The definition that you quoted is in fact that of *sequential compactness*. A subset $K$ of a topological space $X$ is called compact (see [I J Maddox](http://books.google.co.uk/books/about/Elements_of_Functional_Analysis.html?id=ZZk4AAAAIAAJ&redir_esc=y), p.62) if any open cover has a finite sub cover. Precisely, if $... |
170,681 | Please help me understand the following definition:
>
> Let $(X,d)$ be a metric space, a subset $S \in X$ is called *compact*, if any infinite sequence $\{x\_{n}\}\_{n\in\Bbb N}\in S$ has a sub-sequence with a limit in S.
>
>
>
1. What does "if any infinite sequence" mean? Maybe: At least one, all?
2. What does "... | 2012/07/14 | [
"https://math.stackexchange.com/questions/170681",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/6857/"
] | The definition can be reformulated as follows - "Let $(X,d)$ be a metric space, a subset $S∈X$ is called compact, if for all infinte sequences $\{ x\_{n}\}\_{n=1}^{∞}\subseteq S$ the following holds: $\{ x\_{n}\}\_{n=1}^{∞}$ has a concentration point and if $\bar{x}$ is a concentration point of $\{x\_{n}\}\_{n=1}^{∞}$ ... | Compactness is a subtle "finiteness" property. Unfortunately there is no simple way to characterize resp. to define it in general. Only for subsets $S\subset {\mathbb R}^n$ there is a simple characterization: $S$ has to be closed and bounded. *Bounded* means, of course, that $S$ should fit in a ball of finite radius, w... |
144,880 | I am using this code to upload an image. Please review it and give your feedback regarding performance, security, and quality. This also works in PDO project.
```
<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<form action="" method="post" enctype="multipart/form-data">
<h2>Upload File</h2>
<label for=... | 2016/10/21 | [
"https://codereview.stackexchange.com/questions/144880",
"https://codereview.stackexchange.com",
"https://codereview.stackexchange.com/users/118314/"
] | You should invert the order of your PHP processing and your HTML output. When working in PHP, always strive to adhere to this approach, as it will help you as you start working on more complex logic. You will inevitably find yourself needing to set HTTP response readers, cookie values, etc. in your responses. You need ... | In term of security, your code is in bad quality.
you have to spend some time to read some thing about php code security (<https://www.owasp.org/index.php/PHP_Security_Cheat_Sheet>), spend some on that web site.
```
echo "Error: " . $_FILES["photo"]["error"] . "<br>"; no good, need escape
$filename = $_FILES["photo"]... |
144,880 | I am using this code to upload an image. Please review it and give your feedback regarding performance, security, and quality. This also works in PDO project.
```
<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<form action="" method="post" enctype="multipart/form-data">
<h2>Upload File</h2>
<label for=... | 2016/10/21 | [
"https://codereview.stackexchange.com/questions/144880",
"https://codereview.stackexchange.com",
"https://codereview.stackexchange.com/users/118314/"
] | The first thing I saw when I looked at your code was the **obvious** disregard to any kind of indentation!
It is nearly unreadable! There's no excuse to have a code without any indentation.
Throwing the code into any PHP online formatter should suffice.
---
Besides of having no indentation, your html is **inval... | You should invert the order of your PHP processing and your HTML output. When working in PHP, always strive to adhere to this approach, as it will help you as you start working on more complex logic. You will inevitably find yourself needing to set HTTP response readers, cookie values, etc. in your responses. You need ... |
144,880 | I am using this code to upload an image. Please review it and give your feedback regarding performance, security, and quality. This also works in PDO project.
```
<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<form action="" method="post" enctype="multipart/form-data">
<h2>Upload File</h2>
<label for=... | 2016/10/21 | [
"https://codereview.stackexchange.com/questions/144880",
"https://codereview.stackexchange.com",
"https://codereview.stackexchange.com/users/118314/"
] | The first thing I saw when I looked at your code was the **obvious** disregard to any kind of indentation!
It is nearly unreadable! There's no excuse to have a code without any indentation.
Throwing the code into any PHP online formatter should suffice.
---
Besides of having no indentation, your html is **inval... | In term of security, your code is in bad quality.
you have to spend some time to read some thing about php code security (<https://www.owasp.org/index.php/PHP_Security_Cheat_Sheet>), spend some on that web site.
```
echo "Error: " . $_FILES["photo"]["error"] . "<br>"; no good, need escape
$filename = $_FILES["photo"]... |
11,587,902 | Assume that I have the following string:
```
"present present present presenting presentation do do doing "
```
And I'm counting the words inside the string according to their frequency in descending order:
```
I'm using GroupBy count
present 3
do 2
doing 1
presenting 1
presentation 1
```
Then,... | 2012/07/20 | [
"https://Stackoverflow.com/questions/11587902",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1375455/"
] | //Using List instead of Dictionary to allow keys multiplicity:
List> words = new List< KeyValuePair>();
```
string text = "present present present presenting presentation do do doing";
var ws = text.Split(' ');
//Passing the words into the list:
words = (from w in ws
... | LINQ GroupBy or Aggregate are good methods to compute such counts.
If you want to do it by hand... It looks like you want to have 2 sets of results: one of non-stemmed words, another stemmed:
```
void incrementCount(Dictionary<string, int> counts, string word)
{
if (counts.Contains(word))
{
counts[word]++;
... |
51,584,661 | I am developing a web-based application in Spring boot and Mongo DB. Now I want to use Apache Shiro for Authentication and Authorisation. Can somebody explain to me the procedure and how to establish a mongo db realm and where to mention the permission-user mapping? Thank You. | 2018/07/29 | [
"https://Stackoverflow.com/questions/51584661",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3215098/"
] | Here's an easier way:
Step 1: Log in to your WordPress with your admin account.
Step 2: Click on Settings - General
Step 3: Change the URL from options-general.php to just options.php
Step 4: Find the admin email field, change it, and save it.
Done! | You can change it from database:
>
> ->Login to your database
>
>
> ->go to users table
> ->search for admin
> ->open admin and look for email address
> ->change the email address and save it
> |
32,798,260 | I have used Bootstrap-Form-Helpers to display the countries and the flags through a drop down box. I have used the following Html,
```
<div class="bfh-selectbox bfh-countries" data-country="US" data-flags="true">
<input type="hidden" value="">
<a class="bfh-selectbox-toggle" role="button" data-toggle="bfh-sele... | 2015/09/26 | [
"https://Stackoverflow.com/questions/32798260",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4101746/"
] | The input field your getting is **overwriting** by the ***form helper function***
Try the below code
```
<?php
session_start();
require_once ("includes/db.php");
print_r($_POST);
if (isset($_POST['btn_signup'])) {
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$email = $_POST['email'];
$username... | Assuming you're using at least version 2.3 of the formhelpers library, You should be able to replace this:
```
<div class="bfh-selectbox bfh-countries" data-country="US" data-flags="true">
<input type="hidden" id="country" name="country" value="">
<a class="bfh-selectbox-toggle" role="button" d... |
32,798,260 | I have used Bootstrap-Form-Helpers to display the countries and the flags through a drop down box. I have used the following Html,
```
<div class="bfh-selectbox bfh-countries" data-country="US" data-flags="true">
<input type="hidden" value="">
<a class="bfh-selectbox-toggle" role="button" data-toggle="bfh-sele... | 2015/09/26 | [
"https://Stackoverflow.com/questions/32798260",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4101746/"
] | The input field your getting is **overwriting** by the ***form helper function***
Try the below code
```
<?php
session_start();
require_once ("includes/db.php");
print_r($_POST);
if (isset($_POST['btn_signup'])) {
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$email = $_POST['email'];
$username... | You can use **data-name="country"** in below div tag. Then you can get in selected country in the $\_POST.
```
<div class="bfh-selectbox bfh-countries" data-country="US" data-name="country" data-flags="true"> ..............remaining code here.............. </div>
$country = $_POST['country'];
```
Let me know if thi... |
32,798,260 | I have used Bootstrap-Form-Helpers to display the countries and the flags through a drop down box. I have used the following Html,
```
<div class="bfh-selectbox bfh-countries" data-country="US" data-flags="true">
<input type="hidden" value="">
<a class="bfh-selectbox-toggle" role="button" data-toggle="bfh-sele... | 2015/09/26 | [
"https://Stackoverflow.com/questions/32798260",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4101746/"
] | You can use **data-name="country"** in below div tag. Then you can get in selected country in the $\_POST.
```
<div class="bfh-selectbox bfh-countries" data-country="US" data-name="country" data-flags="true"> ..............remaining code here.............. </div>
$country = $_POST['country'];
```
Let me know if thi... | Assuming you're using at least version 2.3 of the formhelpers library, You should be able to replace this:
```
<div class="bfh-selectbox bfh-countries" data-country="US" data-flags="true">
<input type="hidden" id="country" name="country" value="">
<a class="bfh-selectbox-toggle" role="button" d... |
4,724,007 | My maven java project uses the maven-antrun-plugin to execute a deploy.xml ant script that deploys my app. The deploy.xml uses the `<if>` task and this seems to be causing the problem;
>
> [INFO] Executing tasks
>
> [taskdef] Could not load definitions from resource net/sf/antcontrib/antlib.xml. It could not be fo... | 2011/01/18 | [
"https://Stackoverflow.com/questions/4724007",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/443515/"
] | I think it is not a very good idea to add ant to compile classpath in order to run maven plugin.
I use Maven 3.0.4 and it worked by specifying namespace for ant-contrib tags, for example:
```
<configuration>
<target>
<echo message="The first five letters of the alphabet are:"/>
<ac:for list="a,b,c,d,e" para... | OK, I've solved it.
Moving the dependencies out of the `<build><plugin>` tag and putting them in with the other project dependencies seems to have done the trick. |
4,724,007 | My maven java project uses the maven-antrun-plugin to execute a deploy.xml ant script that deploys my app. The deploy.xml uses the `<if>` task and this seems to be causing the problem;
>
> [INFO] Executing tasks
>
> [taskdef] Could not load definitions from resource net/sf/antcontrib/antlib.xml. It could not be fo... | 2011/01/18 | [
"https://Stackoverflow.com/questions/4724007",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/443515/"
] | OK, I've solved it.
Moving the dependencies out of the `<build><plugin>` tag and putting them in with the other project dependencies seems to have done the trick. | another solution would be: keep the ant-contrib-1.0b3.jar to a path and then define it like this
```
<property name="runningLocation" location="" />
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="${runningLocation}/ant-contrib-1.0b3.jar" />
</classpath>
... |
4,724,007 | My maven java project uses the maven-antrun-plugin to execute a deploy.xml ant script that deploys my app. The deploy.xml uses the `<if>` task and this seems to be causing the problem;
>
> [INFO] Executing tasks
>
> [taskdef] Could not load definitions from resource net/sf/antcontrib/antlib.xml. It could not be fo... | 2011/01/18 | [
"https://Stackoverflow.com/questions/4724007",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/443515/"
] | OK, I've solved it.
Moving the dependencies out of the `<build><plugin>` tag and putting them in with the other project dependencies seems to have done the trick. | I found that you need to include the ant-contrib dependency inside the plugin which will enable the taskdef tag to find antcontrib.properties
```
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<dependencies>
<depen... |
4,724,007 | My maven java project uses the maven-antrun-plugin to execute a deploy.xml ant script that deploys my app. The deploy.xml uses the `<if>` task and this seems to be causing the problem;
>
> [INFO] Executing tasks
>
> [taskdef] Could not load definitions from resource net/sf/antcontrib/antlib.xml. It could not be fo... | 2011/01/18 | [
"https://Stackoverflow.com/questions/4724007",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/443515/"
] | I think it is not a very good idea to add ant to compile classpath in order to run maven plugin.
I use Maven 3.0.4 and it worked by specifying namespace for ant-contrib tags, for example:
```
<configuration>
<target>
<echo message="The first five letters of the alphabet are:"/>
<ac:for list="a,b,c,d,e" para... | another solution would be: keep the ant-contrib-1.0b3.jar to a path and then define it like this
```
<property name="runningLocation" location="" />
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="${runningLocation}/ant-contrib-1.0b3.jar" />
</classpath>
... |
4,724,007 | My maven java project uses the maven-antrun-plugin to execute a deploy.xml ant script that deploys my app. The deploy.xml uses the `<if>` task and this seems to be causing the problem;
>
> [INFO] Executing tasks
>
> [taskdef] Could not load definitions from resource net/sf/antcontrib/antlib.xml. It could not be fo... | 2011/01/18 | [
"https://Stackoverflow.com/questions/4724007",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/443515/"
] | I think it is not a very good idea to add ant to compile classpath in order to run maven plugin.
I use Maven 3.0.4 and it worked by specifying namespace for ant-contrib tags, for example:
```
<configuration>
<target>
<echo message="The first five letters of the alphabet are:"/>
<ac:for list="a,b,c,d,e" para... | I found that you need to include the ant-contrib dependency inside the plugin which will enable the taskdef tag to find antcontrib.properties
```
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<dependencies>
<depen... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.