qid int64 1 74.7M | question stringlengths 0 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 2 48.3k | response_k stringlengths 2 40.5k |
|---|---|---|---|---|---|
8,211,128 | Is there any way to have multiple distinct HTML pages contained within a single HTML file? For example, suppose I have a website with two pages:
```
Page 1 : click here for page 2
```
and
```
Page 2 : click here for page 1
```
Can I create a single HTML file that embeds simple static HTML for both pages but only ... | 2011/11/21 | [
"https://Stackoverflow.com/questions/8211128",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/674683/"
] | [Screen Rec](https://a.pomf.cat/kyyeea.webm)
You could use [Colker](https://www.reddit.com/r/web_design/comments/6ta3b1/a_single_html_file_which_uses_url_parameters_to/), which is built for this, but you'll have to remove the search box, and search feature code, because searching isn't compatible with the type of cont... | ```html
<html>
<head>
<script>
function show(shown, hidden) {
document.getElementById(shown).style.display='block';
document.getElementById(hidden).style.display='none';
return false;
}
</script>
</head>
<body>
<a href="#" onclick="return show('Page1','Page2');">Show page 1</a>
<a href="#" onclick="return... |
8,211,128 | Is there any way to have multiple distinct HTML pages contained within a single HTML file? For example, suppose I have a website with two pages:
```
Page 1 : click here for page 2
```
and
```
Page 2 : click here for page 1
```
Can I create a single HTML file that embeds simple static HTML for both pages but only ... | 2011/11/21 | [
"https://Stackoverflow.com/questions/8211128",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/674683/"
] | JQuery Mobile has [multipage](http://jquerymobile.com/demos/1.2.0-pre/docs/pages/page-anatomy.html) feature. But I am not sure about Desktop Web Applications. | going along with @binz-nakama, here's an update on his jsfiddle with a very small amount of javascript. also incoporates this [very good article on css navigation](http://css-snippets.com/simple-horizontal-navigation/ "very good article")
[update on the jsfiddle](https://jsfiddle.net/seanmcdon/x2ybsvz6/ "jsfiddle")
... |
8,211,128 | Is there any way to have multiple distinct HTML pages contained within a single HTML file? For example, suppose I have a website with two pages:
```
Page 1 : click here for page 2
```
and
```
Page 2 : click here for page 1
```
Can I create a single HTML file that embeds simple static HTML for both pages but only ... | 2011/11/21 | [
"https://Stackoverflow.com/questions/8211128",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/674683/"
] | Well, you *could*, but you probably just want to have two sets of content in the same page, and switch between them. Example:
```html
<html>
<head>
<script>
function show(shown, hidden) {
document.getElementById(shown).style.display='block';
document.getElementById(hidden).style.display='none';
return false;
}
<... | This is kind of overriding the thing of one page, but... You could use iframes in HTML.
```
<html>
<body>
<iframe src="page1.html" border="0"></iframe>
</body>
</html>
```
And page1.html would be your base page. Your still making multiple pages, but your browser just doesn't move. So lets say thats your index.html. ... |
8,211,128 | Is there any way to have multiple distinct HTML pages contained within a single HTML file? For example, suppose I have a website with two pages:
```
Page 1 : click here for page 2
```
and
```
Page 2 : click here for page 1
```
Can I create a single HTML file that embeds simple static HTML for both pages but only ... | 2011/11/21 | [
"https://Stackoverflow.com/questions/8211128",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/674683/"
] | [Twine](https://twinery.org/) is an open-source tool for telling interactive, nonlinear stories.
It generates a single html with multiples pages.
Maybe it is not the right tool for you but it could be useful for someone else looking for something similar. | going along with @binz-nakama, here's an update on his jsfiddle with a very small amount of javascript. also incoporates this [very good article on css navigation](http://css-snippets.com/simple-horizontal-navigation/ "very good article")
[update on the jsfiddle](https://jsfiddle.net/seanmcdon/x2ybsvz6/ "jsfiddle")
... |
8,211,128 | Is there any way to have multiple distinct HTML pages contained within a single HTML file? For example, suppose I have a website with two pages:
```
Page 1 : click here for page 2
```
and
```
Page 2 : click here for page 1
```
Can I create a single HTML file that embeds simple static HTML for both pages but only ... | 2011/11/21 | [
"https://Stackoverflow.com/questions/8211128",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/674683/"
] | Have you considered [iframes](https://developer.mozilla.org/en/HTML/Element/iframe) or segregating your content and using a simple show/hide?
**Edit** If you want to use an iframe, you can have the contents of page1 and page2 in one html file. Then you can decide what to show or hide by reading the `location.search` p... | going along with @binz-nakama, here's an update on his jsfiddle with a very small amount of javascript. also incoporates this [very good article on css navigation](http://css-snippets.com/simple-horizontal-navigation/ "very good article")
[update on the jsfiddle](https://jsfiddle.net/seanmcdon/x2ybsvz6/ "jsfiddle")
... |
8,211,128 | Is there any way to have multiple distinct HTML pages contained within a single HTML file? For example, suppose I have a website with two pages:
```
Page 1 : click here for page 2
```
and
```
Page 2 : click here for page 1
```
Can I create a single HTML file that embeds simple static HTML for both pages but only ... | 2011/11/21 | [
"https://Stackoverflow.com/questions/8211128",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/674683/"
] | [Screen Rec](https://a.pomf.cat/kyyeea.webm)
You could use [Colker](https://www.reddit.com/r/web_design/comments/6ta3b1/a_single_html_file_which_uses_url_parameters_to/), which is built for this, but you'll have to remove the search box, and search feature code, because searching isn't compatible with the type of cont... | Solution 1
==========
One solution for this, not requiring any JavaScript, is simply to create a single page in which the multiple pages are simply regular content that is separated by a lot of white space. They can be wrapped into `div` containers, and an inline style sheet can endow them with the margin:
```
<style... |
8,211,128 | Is there any way to have multiple distinct HTML pages contained within a single HTML file? For example, suppose I have a website with two pages:
```
Page 1 : click here for page 2
```
and
```
Page 2 : click here for page 1
```
Can I create a single HTML file that embeds simple static HTML for both pages but only ... | 2011/11/21 | [
"https://Stackoverflow.com/questions/8211128",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/674683/"
] | have all the pages in distinct div areas
```
<div style="" id="page1">
First Page Contents
</div>
<div style="display:none" id="page2">
Second Page Contents
</div>
```
then use a js script to workout what you are viewing (like within an hashtag style) to navigate. Either that, or ajax to get the response from a spe... | It is, in theory, possible using `data:` scheme URIs and frames, but that is rather a long way from practical.
You can fake it by hiding some content with JS and then revealing it when something is clicked (in the style of [tabtastic](http://phrogz.net/js/tabtastic/index.html)). |
45,471,370 | I'm currently working with an action package that declares it will handle the following intents:
* actions.intent.MAIN
* actions.intent.TEXT
* actions.intent.OPTION
I've started with the first two, and proxying this to my own NLP/response gathering I'm able to get basic functionality working. I'm now trying to move ... | 2017/08/02 | [
"https://Stackoverflow.com/questions/45471370",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4131557/"
] | You don't have to actually modify the data permanently, but you do have to adjust it for the join. One way would be to replace `/articles/` with `''` for example:
```
SELECT ...
FROM articles a
JOIN log l ON REPLACE(l.paths, '/articles/', '') = a.slugs
```
This won't use indexes and is not ideal, but works perfectly... | You can just do:
```
SELECT
a.slugs /*, l.visited_at */
FROM
articles a
JOIN logs l ON substr(l.path, length('/articles/')+1) = a.slugs ;
```
The `substr` function should be quite fast to execute. You can obviously change `length('/articles/')+1` by the constant `11`; but I think that leaving it there is... |
249,029 | Can I just omit the subject directly in informal sentence,or I should omit it and start with ing?
`For example: (I) Sing in the middle of storms/ Singing in the middle of storms.` | 2020/05/30 | [
"https://ell.stackexchange.com/questions/249029",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/113404/"
] | An English sentence with a root verb but without an **explicit** subject is an order to someone unspecified who is not the person speaking. So
>
> Sing in the middle of storms
>
>
>
is grammatical and means that someone **other then the speaker** must sing during storms. If that is what you want to say, then the... | Unlike some other languges, in English you can’t omit the subject in the sentence “I sing in the middle of the storms” without changing the meaning. Without the subject, it becomes imperative. It will be understood as an order “(you must) sing in the middle of the storms”. |
249,029 | Can I just omit the subject directly in informal sentence,or I should omit it and start with ing?
`For example: (I) Sing in the middle of storms/ Singing in the middle of storms.` | 2020/05/30 | [
"https://ell.stackexchange.com/questions/249029",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/113404/"
] | In short isolated sentences in informal conversation, we often omit an initial subject pronoun and a following auxiliary:
>
> Going out?
>
>
> Got some!
>
>
> Don't know.
>
>
> See any?
>
>
> Spoken to him?
>
>
> Heard it.
>
>
>
So if you were writing down a conversation like this (which can happen ... | Unlike some other languges, in English you can’t omit the subject in the sentence “I sing in the middle of the storms” without changing the meaning. Without the subject, it becomes imperative. It will be understood as an order “(you must) sing in the middle of the storms”. |
249,029 | Can I just omit the subject directly in informal sentence,or I should omit it and start with ing?
`For example: (I) Sing in the middle of storms/ Singing in the middle of storms.` | 2020/05/30 | [
"https://ell.stackexchange.com/questions/249029",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/113404/"
] | An English sentence with a root verb but without an **explicit** subject is an order to someone unspecified who is not the person speaking. So
>
> Sing in the middle of storms
>
>
>
is grammatical and means that someone **other then the speaker** must sing during storms. If that is what you want to say, then the... | In short isolated sentences in informal conversation, we often omit an initial subject pronoun and a following auxiliary:
>
> Going out?
>
>
> Got some!
>
>
> Don't know.
>
>
> See any?
>
>
> Spoken to him?
>
>
> Heard it.
>
>
>
So if you were writing down a conversation like this (which can happen ... |
60,665,715 | I'm using angular's getLocaleDateTimeFormat function to display selected date-time in the input field.
`getLocaleDateTimeFormat(this.injector.get(LOCALE_ID), FormatWidth.Short)` function shows `{1}, {0}`
but when i use
`getLocaleDateFormat(this.injector.get(LOCALE_ID), FormatWidth.Short)` and `getLocaleTimeFormat(... | 2020/03/13 | [
"https://Stackoverflow.com/questions/60665715",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12224228/"
] | MongoDB is very fast in the execution of queries. But it also depends on how you write your query. For getting the first 10 documents and sort it descending order to the \_id from a collection. You need to use `limit` & `sort` in your query.
```
db.collectionName.find({}).limit(10).sort({_id:-1})
``` | Make sure it's not a connection issue. Try to run your query from MongoDB shell
```
mongo mongodb+srv://${process.env.MONGO_USER}:${process.env.MONGO_PASSWORD}@cluster0-vuauc.mongodb.net/${process.env.MONGO_DB}?retryWrites=true&w=majority
db.collection.find({condition}).limit(10)
```
If in MongoDB shell it responds ... |
60,665,715 | I'm using angular's getLocaleDateTimeFormat function to display selected date-time in the input field.
`getLocaleDateTimeFormat(this.injector.get(LOCALE_ID), FormatWidth.Short)` function shows `{1}, {0}`
but when i use
`getLocaleDateFormat(this.injector.get(LOCALE_ID), FormatWidth.Short)` and `getLocaleTimeFormat(... | 2020/03/13 | [
"https://Stackoverflow.com/questions/60665715",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12224228/"
] | MongoDB is very fast in the execution of queries. But it also depends on how you write your query. For getting the first 10 documents and sort it descending order to the \_id from a collection. You need to use `limit` & `sort` in your query.
```
db.collectionName.find({}).limit(10).sort({_id:-1})
``` | **Use Projections to Return Only Necessary Data**
When you need only a subset of fields from documents, you can achieve better performance by returning only the fields you need:
For example, if in your query to the posts collection, you need only the timestamp, title, author, and abstract fields, you would issue the f... |
60,665,715 | I'm using angular's getLocaleDateTimeFormat function to display selected date-time in the input field.
`getLocaleDateTimeFormat(this.injector.get(LOCALE_ID), FormatWidth.Short)` function shows `{1}, {0}`
but when i use
`getLocaleDateFormat(this.injector.get(LOCALE_ID), FormatWidth.Short)` and `getLocaleTimeFormat(... | 2020/03/13 | [
"https://Stackoverflow.com/questions/60665715",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12224228/"
] | **Use Projections to Return Only Necessary Data**
When you need only a subset of fields from documents, you can achieve better performance by returning only the fields you need:
For example, if in your query to the posts collection, you need only the timestamp, title, author, and abstract fields, you would issue the f... | Make sure it's not a connection issue. Try to run your query from MongoDB shell
```
mongo mongodb+srv://${process.env.MONGO_USER}:${process.env.MONGO_PASSWORD}@cluster0-vuauc.mongodb.net/${process.env.MONGO_DB}?retryWrites=true&w=majority
db.collection.find({condition}).limit(10)
```
If in MongoDB shell it responds ... |
29,886,323 | I'm installing and configuring the Android SDK. I follow this guide:
<https://www.digitalocean.com/community/tutorials/how-to-build-android-apps-with-jenkins>
First of all I did not found the /etc/profile.d/android.sh. That file did nog exist. But I had to add env-variables. So I made the android.sh manually.
I hope t... | 2015/04/27 | [
"https://Stackoverflow.com/questions/29886323",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4525448/"
] | Even with sudo it did not work but I found a solution:
I had to change my permission with `sudo chmod -R 777 /opt/android-sdk-linux`
After that I changed it back so my Jenkins could use it | Do you use root account to execute Android command?
I suggest you use root account to do it. |
29,886,323 | I'm installing and configuring the Android SDK. I follow this guide:
<https://www.digitalocean.com/community/tutorials/how-to-build-android-apps-with-jenkins>
First of all I did not found the /etc/profile.d/android.sh. That file did nog exist. But I had to add env-variables. So I made the android.sh manually.
I hope t... | 2015/04/27 | [
"https://Stackoverflow.com/questions/29886323",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4525448/"
] | Even with sudo it did not work but I found a solution:
I had to change my permission with `sudo chmod -R 777 /opt/android-sdk-linux`
After that I changed it back so my Jenkins could use it | Try `sudo android update sdk --no-ui` or update it on the SDK Manager into the Android Studio. |
50,308,709 | I am trying to have hello.jsp page as an output but it goes to index.jsp page all the time. I tried searching various other things but failed, so finally decided to post here so any one of you can help. Below I have attached my project structure and all the files...and also the output what I am seeing when I run on tom... | 2018/05/12 | [
"https://Stackoverflow.com/questions/50308709",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5774948/"
] | In C a value of 0 is considered "false", and any other (nonzero) value is considered "true". So one, very explicit way to convert an arbitrary `int` value to an explicitly true-or-false Boolean value is to use the (C99 and later) `bool` type:
```
#include <stdbool.h>
int i;
bool b;
b = (i != 0) ? true : false;
```
... | Adding to Summit's answer, you can also do this:
```
#define TRUE ~0U
#define FALSE 0U
#ifndef BOOL
#define BOOL unsigned int;
#endif
int main() {
BOOL var = TRUE;
var = ~var; //Negate var and set it to false.
var = ~var; //Negate var again and set it to true.
return EXIT_SUCCESS;
}
```
If you are ... |
50,308,709 | I am trying to have hello.jsp page as an output but it goes to index.jsp page all the time. I tried searching various other things but failed, so finally decided to post here so any one of you can help. Below I have attached my project structure and all the files...and also the output what I am seeing when I run on tom... | 2018/05/12 | [
"https://Stackoverflow.com/questions/50308709",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5774948/"
] | I posted one answer, but I may have misread the question. If you have an integer variable -- it might be `int`, `short int`, or `char` -- and you want to have it cycle back and forth 0, 1, 0, 1 (which you can interpret as false, true, false, true), there are two about equally good ways to do it. You could do:
```
i = ... | Adding to Summit's answer, you can also do this:
```
#define TRUE ~0U
#define FALSE 0U
#ifndef BOOL
#define BOOL unsigned int;
#endif
int main() {
BOOL var = TRUE;
var = ~var; //Negate var and set it to false.
var = ~var; //Negate var again and set it to true.
return EXIT_SUCCESS;
}
```
If you are ... |
26,067,811 | The following bash and Perl scripts mysteriously give different results. Why?
```
#!/bin/bash
hash=`echo -n 'abcd' | /usr/bin/shasum -a 256`;
echo $hash;
#!/usr/bin/perl
$hash = `e... | 2014/09/26 | [
"https://Stackoverflow.com/questions/26067811",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/398461/"
] | Summary: In your Perl script, `-n` is being treated as an argument to include in the output of `echo`, not a flag to suppress the newline. ( Try
```
$hash = `echo -n 'abcd'`;
```
to confirm). Use `printf` instead.
---
Perl uses `/bin/sh` to execute code in back tics. Even if `/bin/sh` is a link to `bash`, it will... | If you do:
```
printf "%s" 'abcd' | /usr/bin/shasum -a 256
```
you get the 88d...589 hash. If you do:
```
printf "%s\n" '-n abcd' | /usr/bin/shasum -a 256
```
you get the 617...403 hash.
Therefore, I deduce that Perl is somehow running a different `echo` command, perhaps `/bin/echo` or `/usr/bin/echo` instead of... |
12,853,772 | I'm trying to change from load-time-weaving to compile-time-weaving with my Spring 2.5 app.
To do this, I did the following:
1. In my ant build file, I added
```
<path id="aspectPath">
<pathelement location="${lib.home}/spring-aspects.jar"/>
</path>
<taskdef resource="org/aspectj/tools/ant/taskdefs/aspectjTask... | 2012/10/12 | [
"https://Stackoverflow.com/questions/12853772",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/529806/"
] | Yes, you have to release for the Above two cases.
**Case 1:**
```
SelectFrame *obj=[[SelectFrame alloc]initWithNibName:@"SelectFrame" bundle:nil];
[[self navigationController] pushViewController:obj animated:YES];
[obj release];
```
**Case 2:**
```
UIView *barView=[[UIView alloc]initWithFrame:CGRectMake(0, 500, 20... | If using **ARC** in 3 cases then **no need to release** anything just use wisely (alloc if needed)
If not using ARC then its needed to release
Now case 1 :
```
SelectFrame *obj=[[SelectFrame alloc]initWithNibName:@"SelectFrame" bundle:nil];
[[self navigationController] pushViewController:obj animated:YES];
[obj rel... |
36,286,704 | Given the following pseudo C# code:
```
public abstract class Worker
{
public void DoWork()
{
Prepare();
Work();
Cleanup();
}
protected abstract void Work();
}
```
With this design, it is possible, that a derived class (which overrides the `Work()` method) calls the `Work(... | 2016/03/29 | [
"https://Stackoverflow.com/questions/36286704",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2879579/"
] | Thanks to Eris and Corey I think I figured it out. What about this way:
```
public abstract class Worker
{
public void DoWork()
{
if (Work != null)
{
Prepare();
Work();
Cleanup();
}
}
protected Action Work { private get; set; }
}
publi... | If the Work is done using a resource (e.g. remote server, database connection), or it can be changed to be like that, then you could do it like this:
```
public interface IResource
{
}
public abstract class Worker
{
private class TheResource : IResource
{
// implement
}
public void DoWork()
... |
36,286,704 | Given the following pseudo C# code:
```
public abstract class Worker
{
public void DoWork()
{
Prepare();
Work();
Cleanup();
}
protected abstract void Work();
}
```
With this design, it is possible, that a derived class (which overrides the `Work()` method) calls the `Work(... | 2016/03/29 | [
"https://Stackoverflow.com/questions/36286704",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2879579/"
] | Thanks to Eris and Corey I think I figured it out. What about this way:
```
public abstract class Worker
{
public void DoWork()
{
if (Work != null)
{
Prepare();
Work();
Cleanup();
}
}
protected Action Work { private get; set; }
}
publi... | This is somewhat of a hack, but you could change the method to be virtual, add a body which calls the new method, and then add an [ObsoleteAttribute](https://msdn.microsoft.com/en-us/library/22kk2b44(v=vs.90).aspx) to it.
```
protected void DoWork()
{
// New method
}
[Obsolete("This method is ... |
41,863,595 | I have some code that calls into AWS's Rekognition service. Sometimes it throws this exception:
```
An error occurred (InvalidParameterException) when calling the DetectLabels operation: Request has Invalid Parameters
```
I can't find the `InvalidParameterException` anywhere in the documentation or code, though, so ... | 2017/01/25 | [
"https://Stackoverflow.com/questions/41863595",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/442945/"
] | I found it in [`boto/cognito/identity/exceptions.py`](https://github.com/boto/boto/blob/master/boto/cognito/identity/exceptions.py):
```
from boto.exception import BotoServerError
class InvalidParameterException(BotoServerError):
pass
``` | In Python3 with boto3 you can do:
```
from botocore.exceptions import ClientError
catch ClientError as e:
``` |
41,863,595 | I have some code that calls into AWS's Rekognition service. Sometimes it throws this exception:
```
An error occurred (InvalidParameterException) when calling the DetectLabels operation: Request has Invalid Parameters
```
I can't find the `InvalidParameterException` anywhere in the documentation or code, though, so ... | 2017/01/25 | [
"https://Stackoverflow.com/questions/41863595",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/442945/"
] | I found it in [`boto/cognito/identity/exceptions.py`](https://github.com/boto/boto/blob/master/boto/cognito/identity/exceptions.py):
```
from boto.exception import BotoServerError
class InvalidParameterException(BotoServerError):
pass
``` | This is a misleading error by AWS, this error comes when the source image did not contain any detectable faces. Make sure your source image has a detectable face. |
41,863,595 | I have some code that calls into AWS's Rekognition service. Sometimes it throws this exception:
```
An error occurred (InvalidParameterException) when calling the DetectLabels operation: Request has Invalid Parameters
```
I can't find the `InvalidParameterException` anywhere in the documentation or code, though, so ... | 2017/01/25 | [
"https://Stackoverflow.com/questions/41863595",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/442945/"
] | I found it in [`boto/cognito/identity/exceptions.py`](https://github.com/boto/boto/blob/master/boto/cognito/identity/exceptions.py):
```
from boto.exception import BotoServerError
class InvalidParameterException(BotoServerError):
pass
``` | jarmod's answer should work perfect, if you use boto3.
To more explicitly answer the question regarding where the `InvalidParameterException` lives (in `boto3`): It can be acessed via a class instance of the `boto3` rekognition client:
```
import boto3
client = boto3.client('rekognition')
```
Now, the exception can... |
41,863,595 | I have some code that calls into AWS's Rekognition service. Sometimes it throws this exception:
```
An error occurred (InvalidParameterException) when calling the DetectLabels operation: Request has Invalid Parameters
```
I can't find the `InvalidParameterException` anywhere in the documentation or code, though, so ... | 2017/01/25 | [
"https://Stackoverflow.com/questions/41863595",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/442945/"
] | This is a misleading error by AWS, this error comes when the source image did not contain any detectable faces. Make sure your source image has a detectable face. | In Python3 with boto3 you can do:
```
from botocore.exceptions import ClientError
catch ClientError as e:
``` |
41,863,595 | I have some code that calls into AWS's Rekognition service. Sometimes it throws this exception:
```
An error occurred (InvalidParameterException) when calling the DetectLabels operation: Request has Invalid Parameters
```
I can't find the `InvalidParameterException` anywhere in the documentation or code, though, so ... | 2017/01/25 | [
"https://Stackoverflow.com/questions/41863595",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/442945/"
] | If you saw this exception in response to calling `search_faces_by_image` then it probably indicates that there were no detectable faces in the image that you provided. You can review a list of possible exceptions at [API\_SearchFacesByImage](https://docs.aws.amazon.com/rekognition/latest/dg/API_SearchFacesByImage.html)... | In Python3 with boto3 you can do:
```
from botocore.exceptions import ClientError
catch ClientError as e:
``` |
41,863,595 | I have some code that calls into AWS's Rekognition service. Sometimes it throws this exception:
```
An error occurred (InvalidParameterException) when calling the DetectLabels operation: Request has Invalid Parameters
```
I can't find the `InvalidParameterException` anywhere in the documentation or code, though, so ... | 2017/01/25 | [
"https://Stackoverflow.com/questions/41863595",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/442945/"
] | If you saw this exception in response to calling `search_faces_by_image` then it probably indicates that there were no detectable faces in the image that you provided. You can review a list of possible exceptions at [API\_SearchFacesByImage](https://docs.aws.amazon.com/rekognition/latest/dg/API_SearchFacesByImage.html)... | This is a misleading error by AWS, this error comes when the source image did not contain any detectable faces. Make sure your source image has a detectable face. |
41,863,595 | I have some code that calls into AWS's Rekognition service. Sometimes it throws this exception:
```
An error occurred (InvalidParameterException) when calling the DetectLabels operation: Request has Invalid Parameters
```
I can't find the `InvalidParameterException` anywhere in the documentation or code, though, so ... | 2017/01/25 | [
"https://Stackoverflow.com/questions/41863595",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/442945/"
] | This is a misleading error by AWS, this error comes when the source image did not contain any detectable faces. Make sure your source image has a detectable face. | jarmod's answer should work perfect, if you use boto3.
To more explicitly answer the question regarding where the `InvalidParameterException` lives (in `boto3`): It can be acessed via a class instance of the `boto3` rekognition client:
```
import boto3
client = boto3.client('rekognition')
```
Now, the exception can... |
41,863,595 | I have some code that calls into AWS's Rekognition service. Sometimes it throws this exception:
```
An error occurred (InvalidParameterException) when calling the DetectLabels operation: Request has Invalid Parameters
```
I can't find the `InvalidParameterException` anywhere in the documentation or code, though, so ... | 2017/01/25 | [
"https://Stackoverflow.com/questions/41863595",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/442945/"
] | If you saw this exception in response to calling `search_faces_by_image` then it probably indicates that there were no detectable faces in the image that you provided. You can review a list of possible exceptions at [API\_SearchFacesByImage](https://docs.aws.amazon.com/rekognition/latest/dg/API_SearchFacesByImage.html)... | jarmod's answer should work perfect, if you use boto3.
To more explicitly answer the question regarding where the `InvalidParameterException` lives (in `boto3`): It can be acessed via a class instance of the `boto3` rekognition client:
```
import boto3
client = boto3.client('rekognition')
```
Now, the exception can... |
69,148,777 | I was just wondering how this code works, I'm pretty new to coding and I was wondering how it works.
```
for (int x = 0; x < 53; x++)
{
int h = rand() % 52;
int j = rand() % 52;
// Randomize/shuffle deck
Deck[52].face = Deck[h].face;
Deck[52].suit = Deck[h].suit;
... | 2021/09/12 | [
"https://Stackoverflow.com/questions/69148777",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16889981/"
] | Indexing starts at 0, so the bottom of the deck is Deck[51]. They're using position 52 as an ancillary container to make the switch between Deck[e] and Deck[i]. | D. Kupra has given an answer which is the technical core of how doublicating cards is avoided. I add an answer which tries to help you visualise "what's happening in the background", because it might help you seeing beyond array indexes and variable assignments.
It works by doing 53 times a swap of two cards, in a spr... |
1,486,880 | I need to open multiple files at one go on my linux shell and hence thought of passing the sequence value as the fd value as below:
in my pwd i have files named as nile.300, nile.301,....nile.500
So I want to open nile.300 using fd 300, nile.301 as fd 301 and so on
```
#!/bin/bash
for i in {300..500};do FILENAME=nil... | 2019/09/27 | [
"https://superuser.com/questions/1486880",
"https://superuser.com",
"https://superuser.com/users/1086623/"
] | Unless you are planning to work on all the open files at the same time, you might be better of processing one file at a time.
This approach eliminate the need to have hundreds of open files at the same time, potentially running into the open file limit.
```
for i in {300..500};do
FILENAME=nile.$i
exec 3<>$FI... | The correct syntax is `{variable}` if it's on the left-hand side:
```
exec {i}<>"$FILENAME"
echo "Today is $(date)" >&$i
exec {i}>&-
``` |
14,708,195 | How I will convert this SQL query in Linq, sorry but I am not that much expert in LINQ
```
select ConnectionId
from LearnerConnections
where LearnerId = 1
union
select LearnerId
from LearnerConnections
where ConnectionId = 1
```
also can I write the DataTable methode to get the result (like DataTable.Select() method... | 2013/02/05 | [
"https://Stackoverflow.com/questions/14708195",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/337033/"
] | something like that
```
LearnerConnections.Where(x => x.LearnerId == 1)
.Select(m => m.ConnectionId)
.Union(LearnerConnections.Where(l => l.ConnectionId ==1)
.Select(lc => lc.LearnerId)
);
```
with a datatable, it shoul... | May this will helpful
```
var results = (from l in LearnerConnections where l.LearnerId == 1
select l.ConnectionId).Union(from a in LearnerConnections
where a.ConnectionId == 1 select l.LeaenerId);
``` |
14,708,195 | How I will convert this SQL query in Linq, sorry but I am not that much expert in LINQ
```
select ConnectionId
from LearnerConnections
where LearnerId = 1
union
select LearnerId
from LearnerConnections
where ConnectionId = 1
```
also can I write the DataTable methode to get the result (like DataTable.Select() method... | 2013/02/05 | [
"https://Stackoverflow.com/questions/14708195",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/337033/"
] | something like that
```
LearnerConnections.Where(x => x.LearnerId == 1)
.Select(m => m.ConnectionId)
.Union(LearnerConnections.Where(l => l.ConnectionId ==1)
.Select(lc => lc.LearnerId)
);
```
with a datatable, it shoul... | ```
var result = (from lc in LearnerConnections
where lc.LearnerId == 1
select lc.ConnectionId)
.Union
(from lc in LearnerConnections
where lc.ConnectionId == 1
select lc.LearnerId);
```
If you are using DataTables, this involves the u... |
20,052,591 | Is there anyway I can hide a footer and/or header in a repeater?
Basically I have two repeaters bound to different datasources one on top of the other:
```
<asp:Repeater runat="server" ID="rptAdditionalCosts">
<HeaderTemplate>
<table id="optionalExtrasPriceBreakdown" cellpadding="0" cellspacing="0... | 2013/11/18 | [
"https://Stackoverflow.com/questions/20052591",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/542251/"
] | In the end I managed to get something working using the `ItemDataBound` event of the repeater:
```
void rptAdditionalCosts_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Footer)
{
if (optionalVisible && additionalVisible)
e.Item.Visible = false;
... | Try setting the header and footer templates, respectively, to `null` like this:
```
if (optionalVisible && additionalVisible)
{
//hide rptAdditionalCosts footer
//and
//hide rptPerBookingOptionalExtras header
rptAdditionalCosts.FooterTemplate = null;
rptPerBookingOptionalExtras.HeaderTemplate = nul... |
20,052,591 | Is there anyway I can hide a footer and/or header in a repeater?
Basically I have two repeaters bound to different datasources one on top of the other:
```
<asp:Repeater runat="server" ID="rptAdditionalCosts">
<HeaderTemplate>
<table id="optionalExtrasPriceBreakdown" cellpadding="0" cellspacing="0... | 2013/11/18 | [
"https://Stackoverflow.com/questions/20052591",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/542251/"
] | I have had issues with setting the templates to null interfering with repeater commands. I suggest setting to a new BindableTemplateBuilder instead.
```
if (optionalVisible && additionalVisible)
{
//hide rptAdditionalCosts footer
//and
//hide rptPerBookingOptionalExtras header
rptAdditionalCosts.Footer... | Try setting the header and footer templates, respectively, to `null` like this:
```
if (optionalVisible && additionalVisible)
{
//hide rptAdditionalCosts footer
//and
//hide rptPerBookingOptionalExtras header
rptAdditionalCosts.FooterTemplate = null;
rptPerBookingOptionalExtras.HeaderTemplate = nul... |
20,052,591 | Is there anyway I can hide a footer and/or header in a repeater?
Basically I have two repeaters bound to different datasources one on top of the other:
```
<asp:Repeater runat="server" ID="rptAdditionalCosts">
<HeaderTemplate>
<table id="optionalExtrasPriceBreakdown" cellpadding="0" cellspacing="0... | 2013/11/18 | [
"https://Stackoverflow.com/questions/20052591",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/542251/"
] | In the end I managed to get something working using the `ItemDataBound` event of the repeater:
```
void rptAdditionalCosts_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Footer)
{
if (optionalVisible && additionalVisible)
e.Item.Visible = false;
... | I have had issues with setting the templates to null interfering with repeater commands. I suggest setting to a new BindableTemplateBuilder instead.
```
if (optionalVisible && additionalVisible)
{
//hide rptAdditionalCosts footer
//and
//hide rptPerBookingOptionalExtras header
rptAdditionalCosts.Footer... |
48,504,451 | I have following scenario:
1. I have one data flow task with OLEDB source, taking data from source tables using query with inner join. One of the column is varchar(8) and few values are float, rest are int into this column.
2. The OLEDB destination is storing above data into a table where corresponding column is INT.
... | 2018/01/29 | [
"https://Stackoverflow.com/questions/48504451",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5007906/"
] | You should use $builder->addEventListener. For multiple fields all you need to do is to have dynamic fields inside FormEvents::PRE\_SET\_DATA event handler. Also, use parent field data, as explained in the doc to fetch child field choices.
I have used this approach, for generating Country, City and District Entities i... | I believe that sometimes ajax call after ajax call doesn't work as it looses the contact with jquery event listeners.
Create a function for `$sport2.change` event listener and name it something e.g. `sport2Change`. And try to call that function on an `onchange` event of the the element with id - `new_address_form_City... |
52,744 | Modular forms are defined here:
<http://en.wikipedia.org/wiki/Modular_form#General_definitions>
Maass forms are defined here:
<http://en.wikipedia.org/wiki/Maass_wave_form>
I wonder if modular forms can be transfered into Maass forms.
Or they two are different categories of automorphic forms. | 2011/01/21 | [
"https://mathoverflow.net/questions/52744",
"https://mathoverflow.net",
"https://mathoverflow.net/users/2666/"
] | In the more common terminology modular forms on the upper half-plane fall into two categories: holomorphic forms and Maass forms. In fact there is a notion of Maass forms with weight and nebentypus, which includes holomorphic forms as follows: if $f(x+iy)$ is a weight $k$ holomorphic form, then $y^{k/2}f(x+iy)$ is a we... | I'm not a specialist in the field, but recently it happened to me to read the beautiful paper by Ono "The last words of a genius" on the [Notices of the AMS, December 2010](http://www.ams.org/notices/201011/index.html), which seems related to your question.
Let $M \colon \mathbb{H} \to \mathbb{C}$ be a *smooth* functi... |
52,744 | Modular forms are defined here:
<http://en.wikipedia.org/wiki/Modular_form#General_definitions>
Maass forms are defined here:
<http://en.wikipedia.org/wiki/Maass_wave_form>
I wonder if modular forms can be transfered into Maass forms.
Or they two are different categories of automorphic forms. | 2011/01/21 | [
"https://mathoverflow.net/questions/52744",
"https://mathoverflow.net",
"https://mathoverflow.net/users/2666/"
] | Automorphic forms correspond to representations that occur in $L^2(G/\Gamma)$. In the case when $G$ is $SL\_2$, holomorphic modular forms correspond to (highest weight vectors of) discrete series representations of $G$, while Maass wave forms correspond to (spherical vectors of) continuous series representations of $G$... | I'm not a specialist in the field, but recently it happened to me to read the beautiful paper by Ono "The last words of a genius" on the [Notices of the AMS, December 2010](http://www.ams.org/notices/201011/index.html), which seems related to your question.
Let $M \colon \mathbb{H} \to \mathbb{C}$ be a *smooth* functi... |
52,744 | Modular forms are defined here:
<http://en.wikipedia.org/wiki/Modular_form#General_definitions>
Maass forms are defined here:
<http://en.wikipedia.org/wiki/Maass_wave_form>
I wonder if modular forms can be transfered into Maass forms.
Or they two are different categories of automorphic forms. | 2011/01/21 | [
"https://mathoverflow.net/questions/52744",
"https://mathoverflow.net",
"https://mathoverflow.net/users/2666/"
] | In the more common terminology modular forms on the upper half-plane fall into two categories: holomorphic forms and Maass forms. In fact there is a notion of Maass forms with weight and nebentypus, which includes holomorphic forms as follows: if $f(x+iy)$ is a weight $k$ holomorphic form, then $y^{k/2}f(x+iy)$ is a we... | Automorphic forms correspond to representations that occur in $L^2(G/\Gamma)$. In the case when $G$ is $SL\_2$, holomorphic modular forms correspond to (highest weight vectors of) discrete series representations of $G$, while Maass wave forms correspond to (spherical vectors of) continuous series representations of $G$... |
68,915,200 | The data that I want to use has this structure:
```
{
"1": {
"id": 1,
"name": "Bulbasaur"
},
"2": {
"id": 2,
"name": "Ivysaur"
},
"3": {
"id": 3,
"name": "Venusaur"
}
}
```
**Note:**
The number labeling each object matches the id of the Pokémon,... | 2021/08/24 | [
"https://Stackoverflow.com/questions/68915200",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11752124/"
] | When parsing Json to Object with this special case, you should custom Json Deserializer yourself.
Here I use Gson library to parse Json to Object.
First, create a custom Json Deserializer with Gson. As follows:
*PokemonResponse.kt*
```
data class PokemonResponse(
val pokemonMap: List<StringReleasedPokemonModel>... | The problem is that there's no JSON array there. it's literally one JSON object with each Pokemon listed as a property. I would recommend that you reformat the JSON beforehand to look like this:
```
[
{
"id": 1,
"name": "Bulbasaur"
},
{
"id": 2,
"name": "Ivysaur"
},
... |
68,915,200 | The data that I want to use has this structure:
```
{
"1": {
"id": 1,
"name": "Bulbasaur"
},
"2": {
"id": 2,
"name": "Ivysaur"
},
"3": {
"id": 3,
"name": "Venusaur"
}
}
```
**Note:**
The number labeling each object matches the id of the Pokémon,... | 2021/08/24 | [
"https://Stackoverflow.com/questions/68915200",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11752124/"
] | When parsing Json to Object with this special case, you should custom Json Deserializer yourself.
Here I use Gson library to parse Json to Object.
First, create a custom Json Deserializer with Gson. As follows:
*PokemonResponse.kt*
```
data class PokemonResponse(
val pokemonMap: List<StringReleasedPokemonModel>... | You can use Map to store the key like the following
```
data class PokemonResponse(
val pokemonMap:Map<String,ReleasedPokemonModel>
)
data class ReleasedPokemonModel(
val id: Int,
val name: String
)
``` |
47,082,847 | I have my project in visual studio and i am using installshield as my windows installer. When I am installing new updated version of my application it will shows
>
> Another version of this product is automatically installed like this...
>
>
>
How can I install new version by overwriting my old version?
Is there... | 2017/11/02 | [
"https://Stackoverflow.com/questions/47082847",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8204957/"
] | The error that you're getting is because the ProductCode has not been changed. This code is what makes your product/installer unique. Generally to author the upgrade you'll need to change this code and make sure the UpgradeCode is the same so that it recognizes what is already installed.
Authoring upgrades is a much w... | Under The `Upgrade Paths`, create a new path. Leave the min version blank (unless you need it), include min version yes, Max version should be set to the version You are installing now. Include max version to yes.
Each time you are installing an update, Increase the Product version(If u want to change) in the General ... |
47,082,847 | I have my project in visual studio and i am using installshield as my windows installer. When I am installing new updated version of my application it will shows
>
> Another version of this product is automatically installed like this...
>
>
>
How can I install new version by overwriting my old version?
Is there... | 2017/11/02 | [
"https://Stackoverflow.com/questions/47082847",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8204957/"
] | The error that you're getting is because the ProductCode has not been changed. This code is what makes your product/installer unique. Generally to author the upgrade you'll need to change this code and make sure the UpgradeCode is the same so that it recognizes what is already installed.
Authoring upgrades is a much w... | Every upgraded version of install should have a different ProductCode. UpgradeCode is what tells the install package that this product has been installed. If ProductCode is also the same, install assumes you are installing the same product again. ProductCode needs to be different for each of the updated packages. |
47,082,847 | I have my project in visual studio and i am using installshield as my windows installer. When I am installing new updated version of my application it will shows
>
> Another version of this product is automatically installed like this...
>
>
>
How can I install new version by overwriting my old version?
Is there... | 2017/11/02 | [
"https://Stackoverflow.com/questions/47082847",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8204957/"
] | Under The `Upgrade Paths`, create a new path. Leave the min version blank (unless you need it), include min version yes, Max version should be set to the version You are installing now. Include max version to yes.
Each time you are installing an update, Increase the Product version(If u want to change) in the General ... | Every upgraded version of install should have a different ProductCode. UpgradeCode is what tells the install package that this product has been installed. If ProductCode is also the same, install assumes you are installing the same product again. ProductCode needs to be different for each of the updated packages. |
1,214,216 | I have a standard menu using ul and li tags. And in my database, I have a table Users with a field 'certificate' and depending the value of this 'certificate', the user will see or not some items of the menu.
I was reading some texts and I think I will have to use `ActionFilters`. Is this right?
So, how can I render ... | 2009/07/31 | [
"https://Stackoverflow.com/questions/1214216",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/60286/"
] | .toFixed converts the object from a Number to a String.
Leave the full values in place and only convert using .toFixed at the very end
```
$(".total").text(total.toFixed(2));
```
Alternatively, convert the string back to a number.
```
total = total + + tmp;
``` | Just FYI, there is an excellent mathematical aggregation plugin for jQuery: [jQuery Calculation](http://www.pengoworks.com/workshop/jquery/calculation/calculation.plugin.htm)
Using that plugin may also indirectly solve your issue.
It's usage would reduce your script to:
```
$('.total').text($('.amount').sum());
``` |
1,214,216 | I have a standard menu using ul and li tags. And in my database, I have a table Users with a field 'certificate' and depending the value of this 'certificate', the user will see or not some items of the menu.
I was reading some texts and I think I will have to use `ActionFilters`. Is this right?
So, how can I render ... | 2009/07/31 | [
"https://Stackoverflow.com/questions/1214216",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/60286/"
] | .toFixed converts the object from a Number to a String.
Leave the full values in place and only convert using .toFixed at the very end
```
$(".total").text(total.toFixed(2));
```
Alternatively, convert the string back to a number.
```
total = total + + tmp;
``` | You are converting the parseFloat into a string, then adding it to total. Only add .toFixed(2) to the final line, once things have been added.
```
var total = 0;
$(".amount").each(function() {
var value = $(this).val();
value = (value.length < 1) ? 0 : value;
var tmp = parseFloat(value);
total += tmp;
... |
1,214,216 | I have a standard menu using ul and li tags. And in my database, I have a table Users with a field 'certificate' and depending the value of this 'certificate', the user will see or not some items of the menu.
I was reading some texts and I think I will have to use `ActionFilters`. Is this right?
So, how can I render ... | 2009/07/31 | [
"https://Stackoverflow.com/questions/1214216",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/60286/"
] | Just FYI, there is an excellent mathematical aggregation plugin for jQuery: [jQuery Calculation](http://www.pengoworks.com/workshop/jquery/calculation/calculation.plugin.htm)
Using that plugin may also indirectly solve your issue.
It's usage would reduce your script to:
```
$('.total').text($('.amount').sum());
``` | You are converting the parseFloat into a string, then adding it to total. Only add .toFixed(2) to the final line, once things have been added.
```
var total = 0;
$(".amount").each(function() {
var value = $(this).val();
value = (value.length < 1) ? 0 : value;
var tmp = parseFloat(value);
total += tmp;
... |
36,902,209 | i'm having problems with my page I created .the message i get is above.this is my articles controller.rb page code.learning ruby and the challenges it brings.i'm stuck in this section. And i've been having issues with section.once i post up my code.i don't know if i messed up my codes or something like that.
class Art... | 2016/04/27 | [
"https://Stackoverflow.com/questions/36902209",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5931828/"
] | Yip, as Alfie said above, you're missing your article\_params.
In rails 4 (which I assume is what you're using) there is the concept of strong paramaters, which is a way of only allowing the fields you're expecting through.
Depending on what fields are in your "article" object, you need to add something like this:
`... | You need to define your `article_params` in your controller |
36,902,209 | i'm having problems with my page I created .the message i get is above.this is my articles controller.rb page code.learning ruby and the challenges it brings.i'm stuck in this section. And i've been having issues with section.once i post up my code.i don't know if i messed up my codes or something like that.
class Art... | 2016/04/27 | [
"https://Stackoverflow.com/questions/36902209",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5931828/"
] | Yip, as Alfie said above, you're missing your article\_params.
In rails 4 (which I assume is what you're using) there is the concept of strong paramaters, which is a way of only allowing the fields you're expecting through.
Depending on what fields are in your "article" object, you need to add something like this:
`... | You forgot to pass article\_params to update.
```
def update
@article = Article.find(params[:id])
if @article.update(article_params)
flash[:notice] = 'Article was successfully updated'
redirect_to article_path(@article)
else
redirect 'edit'
end
end
``` |
56,580,342 | So I know how to get the sum of a single list so say,
>
>
> >
> > a=[1,2,3,4]
> >
> >
> > sum(a)
> >
> >
> > 10
> >
> >
> >
>
>
>
How would I go about trying to sum lists in a list of lists? So, from:
>
>
> >
> > [[1,2],[2,3],[3,42]] to
> >
> >
> > [3,5,45]?
> >
> >
> >
>
>
> | 2019/06/13 | [
"https://Stackoverflow.com/questions/56580342",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11138835/"
] | **Code:**
```
l = [[1,2],[2,3],[3,42]]
print([sum(i) for i in l])
```
**Output:**
```
[3, 5, 45]
``` | You should use `sum()` in list comprehension for other lists
```
In [12]: a = [[1,2],[2,3],[3,42]] ... |
56,580,342 | So I know how to get the sum of a single list so say,
>
>
> >
> > a=[1,2,3,4]
> >
> >
> > sum(a)
> >
> >
> > 10
> >
> >
> >
>
>
>
How would I go about trying to sum lists in a list of lists? So, from:
>
>
> >
> > [[1,2],[2,3],[3,42]] to
> >
> >
> > [3,5,45]?
> >
> >
> >
>
>
> | 2019/06/13 | [
"https://Stackoverflow.com/questions/56580342",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11138835/"
] | **Code:**
```
l = [[1,2],[2,3],[3,42]]
print([sum(i) for i in l])
```
**Output:**
```
[3, 5, 45]
``` | ```
intial_list = [[1,2],[2,3],[3,42]]
res = list(map(sum, intial_list))
print(res)
```
output
```
[3,5,45]
``` |
56,580,342 | So I know how to get the sum of a single list so say,
>
>
> >
> > a=[1,2,3,4]
> >
> >
> > sum(a)
> >
> >
> > 10
> >
> >
> >
>
>
>
How would I go about trying to sum lists in a list of lists? So, from:
>
>
> >
> > [[1,2],[2,3],[3,42]] to
> >
> >
> > [3,5,45]?
> >
> >
> >
>
>
> | 2019/06/13 | [
"https://Stackoverflow.com/questions/56580342",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11138835/"
] | You should use `sum()` in list comprehension for other lists
```
In [12]: a = [[1,2],[2,3],[3,42]] ... | ```
intial_list = [[1,2],[2,3],[3,42]]
res = list(map(sum, intial_list))
print(res)
```
output
```
[3,5,45]
``` |
42,229,923 | The admin returns this error when trying to add an instance to one of my models. The model itself has a correct **str**() method and contains no instances yet. Also tried replacing the **str**() method with a static method or removing it altogether. No luck.
The error seems to point towards something going wrong in th... | 2017/02/14 | [
"https://Stackoverflow.com/questions/42229923",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/470917/"
] | I had a similar issue. The problem was that the primary key for one row was null ( I dont know how that happened). I couldnt delete the row because of cascade issues. so I had to change the **str** mmethod to somthing like this.
```
def __str__(self):
if self.customerName==None:
return "ERROR-CUSTOMER NAME... | that's works for me:
```
def __str__(self):
return f"{self.category}"
```
Just use "f" string |
42,229,923 | The admin returns this error when trying to add an instance to one of my models. The model itself has a correct **str**() method and contains no instances yet. Also tried replacing the **str**() method with a static method or removing it altogether. No luck.
The error seems to point towards something going wrong in th... | 2017/02/14 | [
"https://Stackoverflow.com/questions/42229923",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/470917/"
] | There was one of the foreign reference which was returning non string field. I changed it to string field or you can change to str(foreign-key-return-element)
name = models.CharField(max\_length=200, unique=True) # name of the article
parent = models.ForeignKey('self',on\_delete=models.DO\_NOTHING,related\_name='catego... | In my case, I had a different model that was called by another one that had the default snippet from VSCode as:
```
def __str__(self):
return
```
This was causing the error, even when it was showing in the log another place. |
42,229,923 | The admin returns this error when trying to add an instance to one of my models. The model itself has a correct **str**() method and contains no instances yet. Also tried replacing the **str**() method with a static method or removing it altogether. No luck.
The error seems to point towards something going wrong in th... | 2017/02/14 | [
"https://Stackoverflow.com/questions/42229923",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/470917/"
] | If you are trying to use `__str__()` to return the value of a `ForeignKey` or a `OneToOneField` this would return error
Example:
```
def __str__():
return self.user # where user is a key to other model class
```
It should be:
```
def __str__():
return self.user.__str__()
# Or basically any other way ... | Toto\_tico is right, although the above error can also occur when you fail to return a str property of your django model within the **str**(self) method:
```
Class model and(models.Model):
Class Meta:
verbose_name = "something"
title = models.CharField(max_length=100)
email = models.CharField(max_l... |
42,229,923 | The admin returns this error when trying to add an instance to one of my models. The model itself has a correct **str**() method and contains no instances yet. Also tried replacing the **str**() method with a static method or removing it altogether. No luck.
The error seems to point towards something going wrong in th... | 2017/02/14 | [
"https://Stackoverflow.com/questions/42229923",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/470917/"
] | I had a similar issue. The problem was that the primary key for one row was null ( I dont know how that happened). I couldnt delete the row because of cascade issues. so I had to change the **str** mmethod to somthing like this.
```
def __str__(self):
if self.customerName==None:
return "ERROR-CUSTOMER NAME... | For this error you can use two solutions
**first solution**: you can comment it out below code
```
def __str__(self):
return self.id
```
to
```
#def __str__(self):
# return self.id
```
**secound solution**: you can return the string from the object
```
def __str__(self):
return str(self.id)
``` |
42,229,923 | The admin returns this error when trying to add an instance to one of my models. The model itself has a correct **str**() method and contains no instances yet. Also tried replacing the **str**() method with a static method or removing it altogether. No luck.
The error seems to point towards something going wrong in th... | 2017/02/14 | [
"https://Stackoverflow.com/questions/42229923",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/470917/"
] | Check out the class that you have referred to in
```
models.ForeignKey
```
The problem lies in the
```
__str__()
```
method of one of those classes.
Then, add
```
or ''
```
in the return statement of that class like this.
```
def __str__(self):
... | Toto\_tico is right, although the above error can also occur when you fail to return a str property of your django model within the **str**(self) method:
```
Class model and(models.Model):
Class Meta:
verbose_name = "something"
title = models.CharField(max_length=100)
email = models.CharField(max_l... |
42,229,923 | The admin returns this error when trying to add an instance to one of my models. The model itself has a correct **str**() method and contains no instances yet. Also tried replacing the **str**() method with a static method or removing it altogether. No luck.
The error seems to point towards something going wrong in th... | 2017/02/14 | [
"https://Stackoverflow.com/questions/42229923",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/470917/"
] | There was one of the foreign reference which was returning non string field. I changed it to string field or you can change to str(foreign-key-return-element)
name = models.CharField(max\_length=200, unique=True) # name of the article
parent = models.ForeignKey('self',on\_delete=models.DO\_NOTHING,related\_name='catego... | Toto\_tico is right, although the above error can also occur when you fail to return a str property of your django model within the **str**(self) method:
```
Class model and(models.Model):
Class Meta:
verbose_name = "something"
title = models.CharField(max_length=100)
email = models.CharField(max_l... |
42,229,923 | The admin returns this error when trying to add an instance to one of my models. The model itself has a correct **str**() method and contains no instances yet. Also tried replacing the **str**() method with a static method or removing it altogether. No luck.
The error seems to point towards something going wrong in th... | 2017/02/14 | [
"https://Stackoverflow.com/questions/42229923",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/470917/"
] | Turns out that there was an unexpected empty CharField in a related model. Leaving this an an answer, because it might help others.
**Troubleshoot the issue** by systematically commenting out the `__str__()` methods of your models until you find the offending model. Work from there to identify the offending record(s). | that's works for me:
```
def __str__(self):
return f"{self.category}"
```
Just use "f" string |
42,229,923 | The admin returns this error when trying to add an instance to one of my models. The model itself has a correct **str**() method and contains no instances yet. Also tried replacing the **str**() method with a static method or removing it altogether. No luck.
The error seems to point towards something going wrong in th... | 2017/02/14 | [
"https://Stackoverflow.com/questions/42229923",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/470917/"
] | Check out the class that you have referred to in
```
models.ForeignKey
```
The problem lies in the
```
__str__()
```
method of one of those classes.
Then, add
```
or ''
```
in the return statement of that class like this.
```
def __str__(self):
... | that's works for me:
```
def __str__(self):
return f"{self.category}"
```
Just use "f" string |
42,229,923 | The admin returns this error when trying to add an instance to one of my models. The model itself has a correct **str**() method and contains no instances yet. Also tried replacing the **str**() method with a static method or removing it altogether. No luck.
The error seems to point towards something going wrong in th... | 2017/02/14 | [
"https://Stackoverflow.com/questions/42229923",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/470917/"
] | ```
def __str__(self):
return str(self.topic)
```
Use str to make it type string.
Then it's not not-string type. | There was one of the foreign reference which was returning non string field. I changed it to string field or you can change to str(foreign-key-return-element)
name = models.CharField(max\_length=200, unique=True) # name of the article
parent = models.ForeignKey('self',on\_delete=models.DO\_NOTHING,related\_name='catego... |
42,229,923 | The admin returns this error when trying to add an instance to one of my models. The model itself has a correct **str**() method and contains no instances yet. Also tried replacing the **str**() method with a static method or removing it altogether. No luck.
The error seems to point towards something going wrong in th... | 2017/02/14 | [
"https://Stackoverflow.com/questions/42229923",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/470917/"
] | ```
def __str__(self):
return str(self.topic)
```
Use str to make it type string.
Then it's not not-string type. | You can also delete the instances in the model causing this problem from the django shell `python manage.py shell` . This helps when you are dealing with a model with lots of related models like mine.
>
> Typically this problem is caused by altering model fields and
> migrating, such that the instances are incompati... |
24,201,932 | So I have a text field where the user can type in anything. I use the following code to assign the input an NSString value:
```
NSString *input = _inputTextField.text;
```
If the user has the word "smart" anywhere in the input, than it will replace it with "clever". Likewise, if they have "smarter" it will replace i... | 2014/06/13 | [
"https://Stackoverflow.com/questions/24201932",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3705492/"
] | We can iterate over the list with `enumerate` and replace the old value with new value, like this
```
myl = [1, 2, 3, 4, 5, 4, 4, 4, 6]
for idx, item in enumerate(myl):
if item == 4:
myl[idx] = 44
print myl
# [1, 2, 3, 44, 5, 44, 44, 44, 6]
``` | ```
for item in myl:
if item ==4:
myl[myl.index(item)]=44
``` |
24,201,932 | So I have a text field where the user can type in anything. I use the following code to assign the input an NSString value:
```
NSString *input = _inputTextField.text;
```
If the user has the word "smart" anywhere in the input, than it will replace it with "clever". Likewise, if they have "smarter" it will replace i... | 2014/06/13 | [
"https://Stackoverflow.com/questions/24201932",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3705492/"
] | We can iterate over the list with `enumerate` and replace the old value with new value, like this
```
myl = [1, 2, 3, 4, 5, 4, 4, 4, 6]
for idx, item in enumerate(myl):
if item == 4:
myl[idx] = 44
print myl
# [1, 2, 3, 44, 5, 44, 44, 44, 6]
``` | ```
while True:
try:
myl[myl.index(4)] = 44
except:
break
```
The `try-except` approach, although more **pythonic**, is less efficient. This [timeit program on ideone](http://ideone.com/fC6oA5) compares at least two of the answers provided herein. |
24,201,932 | So I have a text field where the user can type in anything. I use the following code to assign the input an NSString value:
```
NSString *input = _inputTextField.text;
```
If the user has the word "smart" anywhere in the input, than it will replace it with "clever". Likewise, if they have "smarter" it will replace i... | 2014/06/13 | [
"https://Stackoverflow.com/questions/24201932",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3705492/"
] | ```
myl[:] = [x if x != 4 else 44 for x in myl]
```
Perform the replacement not-in-place with a list comprehension, then slice-assign the new values into the original list if you really want to change the original. | ```
for item in myl:
if item ==4:
myl[myl.index(item)]=44
``` |
24,201,932 | So I have a text field where the user can type in anything. I use the following code to assign the input an NSString value:
```
NSString *input = _inputTextField.text;
```
If the user has the word "smart" anywhere in the input, than it will replace it with "clever". Likewise, if they have "smarter" it will replace i... | 2014/06/13 | [
"https://Stackoverflow.com/questions/24201932",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3705492/"
] | ```
myl[:] = [x if x != 4 else 44 for x in myl]
```
Perform the replacement not-in-place with a list comprehension, then slice-assign the new values into the original list if you really want to change the original. | ```
while True:
try:
myl[myl.index(4)] = 44
except:
break
```
The `try-except` approach, although more **pythonic**, is less efficient. This [timeit program on ideone](http://ideone.com/fC6oA5) compares at least two of the answers provided herein. |
1,387,239 | >
> Prove that $2730$ divides $n^{13} - n$ for all integers $n$.
>
>
>
What I attempted is breaking $2730$ into $2, 3, 5$, and $7, 13$. Thus if I prove each prime factor divides by $n^{13} - n$ for all integers $n$, it will prove the original problem.
I already proved $2, 3$, and $5$ work. Struggling with how to... | 2015/08/06 | [
"https://math.stackexchange.com/questions/1387239",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/257731/"
] | As pointed out in a comment $91$ is not prime but the product of $7$ and $13$. You can then deal with these two as you likely dealt with the other factors, via using Fermat's Little Theorem. | >
> Let $k>1$ be an integer. Write $D(k)$ for the set of all prime natural numbers $p$ such that $p-1$ divides $k-1$. Then, $\displaystyle\underset{n\in\mathbb{N}}{\gcd}\left(n^k-n\right)$ is the product $\prod\_{p \in D(k)}\,p$.
>
>
>
Let $d\_k$ be the number $\displaystyle\underset{n\in\mathbb{N}}{\gcd}\left(n^k... |
1,387,239 | >
> Prove that $2730$ divides $n^{13} - n$ for all integers $n$.
>
>
>
What I attempted is breaking $2730$ into $2, 3, 5$, and $7, 13$. Thus if I prove each prime factor divides by $n^{13} - n$ for all integers $n$, it will prove the original problem.
I already proved $2, 3$, and $5$ work. Struggling with how to... | 2015/08/06 | [
"https://math.stackexchange.com/questions/1387239",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/257731/"
] | $2730 = 2\times 3\times 5\times 7\times 13$
Let's consider two cases:
First case:
if n is divisible by 2730 then $n\equiv 0[2730]$ so ${ n }^{ 13 }\equiv 0[2730]$ which means ${ n }^{ 13 }\equiv n[2730]$.
Second case $\gcd(2730,n)=1$:
Then all the prime divisors of $2730$ will be coprime with n.
Using Fermat litt... | As pointed out in a comment $91$ is not prime but the product of $7$ and $13$. You can then deal with these two as you likely dealt with the other factors, via using Fermat's Little Theorem. |
1,387,239 | >
> Prove that $2730$ divides $n^{13} - n$ for all integers $n$.
>
>
>
What I attempted is breaking $2730$ into $2, 3, 5$, and $7, 13$. Thus if I prove each prime factor divides by $n^{13} - n$ for all integers $n$, it will prove the original problem.
I already proved $2, 3$, and $5$ work. Struggling with how to... | 2015/08/06 | [
"https://math.stackexchange.com/questions/1387239",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/257731/"
] | $2730 = 2\times 3\times 5\times 7\times 13$
Let's consider two cases:
First case:
if n is divisible by 2730 then $n\equiv 0[2730]$ so ${ n }^{ 13 }\equiv 0[2730]$ which means ${ n }^{ 13 }\equiv n[2730]$.
Second case $\gcd(2730,n)=1$:
Then all the prime divisors of $2730$ will be coprime with n.
Using Fermat litt... | >
> Let $k>1$ be an integer. Write $D(k)$ for the set of all prime natural numbers $p$ such that $p-1$ divides $k-1$. Then, $\displaystyle\underset{n\in\mathbb{N}}{\gcd}\left(n^k-n\right)$ is the product $\prod\_{p \in D(k)}\,p$.
>
>
>
Let $d\_k$ be the number $\displaystyle\underset{n\in\mathbb{N}}{\gcd}\left(n^k... |
1,387,239 | >
> Prove that $2730$ divides $n^{13} - n$ for all integers $n$.
>
>
>
What I attempted is breaking $2730$ into $2, 3, 5$, and $7, 13$. Thus if I prove each prime factor divides by $n^{13} - n$ for all integers $n$, it will prove the original problem.
I already proved $2, 3$, and $5$ work. Struggling with how to... | 2015/08/06 | [
"https://math.stackexchange.com/questions/1387239",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/257731/"
] | $\phi(2),\phi(3),\phi(5),\phi(7)$ and $\phi(13)$ all divide $\phi(13)=12$, hence for any prime $p\in\{2,3,5,7,13\}$ we have:
$$ n^{13}\equiv n\pmod{p} $$
and that implies $2\cdot 3\cdot 5\cdot 7\cdot 13\mid (n^{13}-n)$. | >
> Let $k>1$ be an integer. Write $D(k)$ for the set of all prime natural numbers $p$ such that $p-1$ divides $k-1$. Then, $\displaystyle\underset{n\in\mathbb{N}}{\gcd}\left(n^k-n\right)$ is the product $\prod\_{p \in D(k)}\,p$.
>
>
>
Let $d\_k$ be the number $\displaystyle\underset{n\in\mathbb{N}}{\gcd}\left(n^k... |
1,387,239 | >
> Prove that $2730$ divides $n^{13} - n$ for all integers $n$.
>
>
>
What I attempted is breaking $2730$ into $2, 3, 5$, and $7, 13$. Thus if I prove each prime factor divides by $n^{13} - n$ for all integers $n$, it will prove the original problem.
I already proved $2, 3$, and $5$ work. Struggling with how to... | 2015/08/06 | [
"https://math.stackexchange.com/questions/1387239",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/257731/"
] | $2730 = 2\times 3\times 5\times 7\times 13$
Let's consider two cases:
First case:
if n is divisible by 2730 then $n\equiv 0[2730]$ so ${ n }^{ 13 }\equiv 0[2730]$ which means ${ n }^{ 13 }\equiv n[2730]$.
Second case $\gcd(2730,n)=1$:
Then all the prime divisors of $2730$ will be coprime with n.
Using Fermat litt... | $\phi(2),\phi(3),\phi(5),\phi(7)$ and $\phi(13)$ all divide $\phi(13)=12$, hence for any prime $p\in\{2,3,5,7,13\}$ we have:
$$ n^{13}\equiv n\pmod{p} $$
and that implies $2\cdot 3\cdot 5\cdot 7\cdot 13\mid (n^{13}-n)$. |
52,486,797 | I am trying to produce JSON from an SQLSRV query. I believe the best way to do this is retrieve the data and build a valid array which can then be run through json\_endode().
I am having problems building the array.
I have the following SQL Statement. It is a classic one to many SELECT.
```
SELECT
OrderHeader.Si... | 2018/09/24 | [
"https://Stackoverflow.com/questions/52486797",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Neo4j has a limited [property type](https://neo4j.com/docs/developer-manual/current/cypher/syntax/values/) set.
You should store the values as properties of the node, instead of craming them into one property.
```
// You need the `` around the property name to escape the period
CREATE (c1:Config) set c1.`properties.n... | One way to create nested properties is using `JSON` property as string property, you can dump and encode data in write and load and decode when read.
One example of this is [neomodel](https://neomodel.readthedocs.io/en/latest/module_documentation.html#neomodel.properties.JSONProperty) json property in python.
This ... |
30,968,679 | I would like to access a variable from my rootViewController from within a different viewController (it‘s a CollectionViewCell).
```
window!.rootViewController = ViewController()
```
I declare the var like so:
```
import UIKit
class ViewController: UIViewController {
var testString : String = "Test";
ove... | 2015/06/21 | [
"https://Stackoverflow.com/questions/30968679",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3808543/"
] | ViewPostImeInputStage ACTION\_DOWN is a bug that occurs stemming from the rare instance where your layout is rejected and you are no longer able to click on any clickable items, and what occurs instead is a ViewPostImeInputStage ACTION\_DOWN with every button press (and no action). The solution for this is simple, wrap... | I got the same problem as yours,and I tried portfoliobuilder's way but it didn't work.
And then I just make some changes on my code,then it worked.
I just set every instance of my button an OnlickListener interface instead of letting my Class inplements the View.OnClickListener~
```
button.setOnclickListener(new View.... |
30,968,679 | I would like to access a variable from my rootViewController from within a different viewController (it‘s a CollectionViewCell).
```
window!.rootViewController = ViewController()
```
I declare the var like so:
```
import UIKit
class ViewController: UIViewController {
var testString : String = "Test";
ove... | 2015/06/21 | [
"https://Stackoverflow.com/questions/30968679",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3808543/"
] | ViewPostImeInputStage ACTION\_DOWN is a bug that occurs stemming from the rare instance where your layout is rejected and you are no longer able to click on any clickable items, and what occurs instead is a ViewPostImeInputStage ACTION\_DOWN with every button press (and no action). The solution for this is simple, wrap... | I have faced the same issue which was corrected when I made the relative layout clickable(in properties).
cheers |
30,968,679 | I would like to access a variable from my rootViewController from within a different viewController (it‘s a CollectionViewCell).
```
window!.rootViewController = ViewController()
```
I declare the var like so:
```
import UIKit
class ViewController: UIViewController {
var testString : String = "Test";
ove... | 2015/06/21 | [
"https://Stackoverflow.com/questions/30968679",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3808543/"
] | ViewPostImeInputStage ACTION\_DOWN is a bug that occurs stemming from the rare instance where your layout is rejected and you are no longer able to click on any clickable items, and what occurs instead is a ViewPostImeInputStage ACTION\_DOWN with every button press (and no action). The solution for this is simple, wrap... | I had this happen to me on the first click of a CardView inside a RecyclerView. It turns out the CardView XML set:
```
android:focusable="true"
android:focusableInTouchMode="true"
```
Once I removed that, the first click (and subsequent clicks) worked fine, and I no longer had the error with ACTION\_DOWN. |
30,968,679 | I would like to access a variable from my rootViewController from within a different viewController (it‘s a CollectionViewCell).
```
window!.rootViewController = ViewController()
```
I declare the var like so:
```
import UIKit
class ViewController: UIViewController {
var testString : String = "Test";
ove... | 2015/06/21 | [
"https://Stackoverflow.com/questions/30968679",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3808543/"
] | ViewPostImeInputStage ACTION\_DOWN is a bug that occurs stemming from the rare instance where your layout is rejected and you are no longer able to click on any clickable items, and what occurs instead is a ViewPostImeInputStage ACTION\_DOWN with every button press (and no action). The solution for this is simple, wrap... | I was getting `ViewPostImeInputStage ACTION_DOWN` message when a line of my code had -->
```
if(button.getText().equals("word"))
```
I got the desired output after correcting the if statement to -->
```
if(button.getText().toString().equals("word"))
```
Hope it helps someone. |
30,968,679 | I would like to access a variable from my rootViewController from within a different viewController (it‘s a CollectionViewCell).
```
window!.rootViewController = ViewController()
```
I declare the var like so:
```
import UIKit
class ViewController: UIViewController {
var testString : String = "Test";
ove... | 2015/06/21 | [
"https://Stackoverflow.com/questions/30968679",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3808543/"
] | ViewPostImeInputStage ACTION\_DOWN is a bug that occurs stemming from the rare instance where your layout is rejected and you are no longer able to click on any clickable items, and what occurs instead is a ViewPostImeInputStage ACTION\_DOWN with every button press (and no action). The solution for this is simple, wrap... | None of the solutions above worked to me. Pretty strange bug, wondering if some view is intercepting the touch events and broking it, maybe some appcompat stuff, there is a lot of touch intercepts over there…
Anyway, I workarounded the problem adding a transparent `View` over my real broken button and adding the click... |
30,968,679 | I would like to access a variable from my rootViewController from within a different viewController (it‘s a CollectionViewCell).
```
window!.rootViewController = ViewController()
```
I declare the var like so:
```
import UIKit
class ViewController: UIViewController {
var testString : String = "Test";
ove... | 2015/06/21 | [
"https://Stackoverflow.com/questions/30968679",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3808543/"
] | I got the same problem as yours,and I tried portfoliobuilder's way but it didn't work.
And then I just make some changes on my code,then it worked.
I just set every instance of my button an OnlickListener interface instead of letting my Class inplements the View.OnClickListener~
```
button.setOnclickListener(new View.... | I have faced the same issue which was corrected when I made the relative layout clickable(in properties).
cheers |
30,968,679 | I would like to access a variable from my rootViewController from within a different viewController (it‘s a CollectionViewCell).
```
window!.rootViewController = ViewController()
```
I declare the var like so:
```
import UIKit
class ViewController: UIViewController {
var testString : String = "Test";
ove... | 2015/06/21 | [
"https://Stackoverflow.com/questions/30968679",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3808543/"
] | I got the same problem as yours,and I tried portfoliobuilder's way but it didn't work.
And then I just make some changes on my code,then it worked.
I just set every instance of my button an OnlickListener interface instead of letting my Class inplements the View.OnClickListener~
```
button.setOnclickListener(new View.... | I had this happen to me on the first click of a CardView inside a RecyclerView. It turns out the CardView XML set:
```
android:focusable="true"
android:focusableInTouchMode="true"
```
Once I removed that, the first click (and subsequent clicks) worked fine, and I no longer had the error with ACTION\_DOWN. |
30,968,679 | I would like to access a variable from my rootViewController from within a different viewController (it‘s a CollectionViewCell).
```
window!.rootViewController = ViewController()
```
I declare the var like so:
```
import UIKit
class ViewController: UIViewController {
var testString : String = "Test";
ove... | 2015/06/21 | [
"https://Stackoverflow.com/questions/30968679",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3808543/"
] | I got the same problem as yours,and I tried portfoliobuilder's way but it didn't work.
And then I just make some changes on my code,then it worked.
I just set every instance of my button an OnlickListener interface instead of letting my Class inplements the View.OnClickListener~
```
button.setOnclickListener(new View.... | I was getting `ViewPostImeInputStage ACTION_DOWN` message when a line of my code had -->
```
if(button.getText().equals("word"))
```
I got the desired output after correcting the if statement to -->
```
if(button.getText().toString().equals("word"))
```
Hope it helps someone. |
30,968,679 | I would like to access a variable from my rootViewController from within a different viewController (it‘s a CollectionViewCell).
```
window!.rootViewController = ViewController()
```
I declare the var like so:
```
import UIKit
class ViewController: UIViewController {
var testString : String = "Test";
ove... | 2015/06/21 | [
"https://Stackoverflow.com/questions/30968679",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3808543/"
] | I got the same problem as yours,and I tried portfoliobuilder's way but it didn't work.
And then I just make some changes on my code,then it worked.
I just set every instance of my button an OnlickListener interface instead of letting my Class inplements the View.OnClickListener~
```
button.setOnclickListener(new View.... | None of the solutions above worked to me. Pretty strange bug, wondering if some view is intercepting the touch events and broking it, maybe some appcompat stuff, there is a lot of touch intercepts over there…
Anyway, I workarounded the problem adding a transparent `View` over my real broken button and adding the click... |
15,779,826 | Below I have a snippet of code that I won't work. I get input in my main method then pass that input into another method to check for validation. But it doesn't really check correctly. If I input `99` for `month` and `day` I expect it to give me the message `Check Month`.
Instead I get:
`THIS
THIS`
If I input `02`... | 2013/04/03 | [
"https://Stackoverflow.com/questions/15779826",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2094247/"
] | You should use the equals method for comparing Strings. When using the `==` operator, you compare the Strings' addresses, and not their content. | This `month == "01"` is not the correct way to compare `String`s in Java.
You are trying to compare memory locations of the two variables, which aren't likely to be equal.
Instead you should be using `month.equals("01")`. |
15,779,826 | Below I have a snippet of code that I won't work. I get input in my main method then pass that input into another method to check for validation. But it doesn't really check correctly. If I input `99` for `month` and `day` I expect it to give me the message `Check Month`.
Instead I get:
`THIS
THIS`
If I input `02`... | 2013/04/03 | [
"https://Stackoverflow.com/questions/15779826",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2094247/"
] | While the answers explaining the reason it's *currently* not working - using `==` rather than `equals` - I would suggest you *don't* just start using `equals`.
Instead, parse the user input into numbers first, and then validate those... it's much easier to perform numeric comparisons with *numbers* rather than strings... | This `month == "01"` is not the correct way to compare `String`s in Java.
You are trying to compare memory locations of the two variables, which aren't likely to be equal.
Instead you should be using `month.equals("01")`. |
15,779,826 | Below I have a snippet of code that I won't work. I get input in my main method then pass that input into another method to check for validation. But it doesn't really check correctly. If I input `99` for `month` and `day` I expect it to give me the message `Check Month`.
Instead I get:
`THIS
THIS`
If I input `02`... | 2013/04/03 | [
"https://Stackoverflow.com/questions/15779826",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2094247/"
] | This `month == "01"` is not the correct way to compare `String`s in Java.
You are trying to compare memory locations of the two variables, which aren't likely to be equal.
Instead you should be using `month.equals("01")`. | It would be MUCH more efficient and easier to read/write/test to convert your string to integer and then check that (e.g.use `int monthVal = Integer.parseInt(month);` thenyou can check if (a) it parsed properly,with a try/catch around it and (b) test the value with `if (monthVal > 0 && monthVal< 13) { /* month is good ... |
15,779,826 | Below I have a snippet of code that I won't work. I get input in my main method then pass that input into another method to check for validation. But it doesn't really check correctly. If I input `99` for `month` and `day` I expect it to give me the message `Check Month`.
Instead I get:
`THIS
THIS`
If I input `02`... | 2013/04/03 | [
"https://Stackoverflow.com/questions/15779826",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2094247/"
] | You should use the equals method for comparing Strings. When using the `==` operator, you compare the Strings' addresses, and not their content. | It would be MUCH more efficient and easier to read/write/test to convert your string to integer and then check that (e.g.use `int monthVal = Integer.parseInt(month);` thenyou can check if (a) it parsed properly,with a try/catch around it and (b) test the value with `if (monthVal > 0 && monthVal< 13) { /* month is good ... |
15,779,826 | Below I have a snippet of code that I won't work. I get input in my main method then pass that input into another method to check for validation. But it doesn't really check correctly. If I input `99` for `month` and `day` I expect it to give me the message `Check Month`.
Instead I get:
`THIS
THIS`
If I input `02`... | 2013/04/03 | [
"https://Stackoverflow.com/questions/15779826",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2094247/"
] | You should use the equals method for comparing Strings. When using the `==` operator, you compare the Strings' addresses, and not their content. | There are two big mistakes
1. you are comparing string with equals equals which will compare memory not content so
the line `if(month == "01")` should be `if("01".equals(month))`
2. The condition for checking valid date `if (main.isValidDate(month, day, year) == true)` should be like `if (main.isValidDate(month, day,... |
15,779,826 | Below I have a snippet of code that I won't work. I get input in my main method then pass that input into another method to check for validation. But it doesn't really check correctly. If I input `99` for `month` and `day` I expect it to give me the message `Check Month`.
Instead I get:
`THIS
THIS`
If I input `02`... | 2013/04/03 | [
"https://Stackoverflow.com/questions/15779826",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2094247/"
] | While the answers explaining the reason it's *currently* not working - using `==` rather than `equals` - I would suggest you *don't* just start using `equals`.
Instead, parse the user input into numbers first, and then validate those... it's much easier to perform numeric comparisons with *numbers* rather than strings... | It would be MUCH more efficient and easier to read/write/test to convert your string to integer and then check that (e.g.use `int monthVal = Integer.parseInt(month);` thenyou can check if (a) it parsed properly,with a try/catch around it and (b) test the value with `if (monthVal > 0 && monthVal< 13) { /* month is good ... |
15,779,826 | Below I have a snippet of code that I won't work. I get input in my main method then pass that input into another method to check for validation. But it doesn't really check correctly. If I input `99` for `month` and `day` I expect it to give me the message `Check Month`.
Instead I get:
`THIS
THIS`
If I input `02`... | 2013/04/03 | [
"https://Stackoverflow.com/questions/15779826",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2094247/"
] | While the answers explaining the reason it's *currently* not working - using `==` rather than `equals` - I would suggest you *don't* just start using `equals`.
Instead, parse the user input into numbers first, and then validate those... it's much easier to perform numeric comparisons with *numbers* rather than strings... | There are two big mistakes
1. you are comparing string with equals equals which will compare memory not content so
the line `if(month == "01")` should be `if("01".equals(month))`
2. The condition for checking valid date `if (main.isValidDate(month, day, year) == true)` should be like `if (main.isValidDate(month, day,... |
15,779,826 | Below I have a snippet of code that I won't work. I get input in my main method then pass that input into another method to check for validation. But it doesn't really check correctly. If I input `99` for `month` and `day` I expect it to give me the message `Check Month`.
Instead I get:
`THIS
THIS`
If I input `02`... | 2013/04/03 | [
"https://Stackoverflow.com/questions/15779826",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2094247/"
] | There are two big mistakes
1. you are comparing string with equals equals which will compare memory not content so
the line `if(month == "01")` should be `if("01".equals(month))`
2. The condition for checking valid date `if (main.isValidDate(month, day, year) == true)` should be like `if (main.isValidDate(month, day,... | It would be MUCH more efficient and easier to read/write/test to convert your string to integer and then check that (e.g.use `int monthVal = Integer.parseInt(month);` thenyou can check if (a) it parsed properly,with a try/catch around it and (b) test the value with `if (monthVal > 0 && monthVal< 13) { /* month is good ... |
70,829,973 | I want to say
>
> for f in x: do certain thing.
>
>
>
but i dont want to connect them to each other.
first do a work for x[0] then for x[1] then etc.
```
x = ['ABCED', 'BACF', 'BCD']
```
for exmple, it cant seprate them by the index, it just repeate print part for all q in x.
how can i fix it?
```
for f in ... | 2022/01/24 | [
"https://Stackoverflow.com/questions/70829973",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14676981/"
] | Use `list` on `str` create a list of each character:
```
out = [list(i) for i in x]
print(out)
# Output
[['A', 'B', 'C', 'E', 'D'], ['B', 'A', 'C', 'F'], ['B', 'C', 'D']]
``` | ```
x = ['ABCED', 'BACF', 'BCD']
new_list= [list(i) for i in x]
```
or:
```
list(map(list, x))
```
output:
```
[['A', 'B', 'C', 'E', 'D'], ['B', 'A', 'C', 'F'], ['B', 'C', 'D']]
``` |
26,559,840 | I'm using Visual Studio 2010 and SQL Server 2012. When I try to connect to SQL Server through Visual Studio, I don't get my server name on Add connection drop down menu. | 2014/10/25 | [
"https://Stackoverflow.com/questions/26559840",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3786234/"
] | Go to SQL Server Management Studio to look for the correct `Server Name` and copy the value. Make all the configurations by yourself at the end just click `Test connection` button. If the connection is test successfully proceed with your work. | If the database is in your local machine, Just put a . (Dot) in Server Name and select the database.
 |
26,559,840 | I'm using Visual Studio 2010 and SQL Server 2012. When I try to connect to SQL Server through Visual Studio, I don't get my server name on Add connection drop down menu. | 2014/10/25 | [
"https://Stackoverflow.com/questions/26559840",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3786234/"
] | If the database is in your local machine, Just put a . (Dot) in Server Name and select the database.
 | Insert machine\_name/SqlServerName |
26,559,840 | I'm using Visual Studio 2010 and SQL Server 2012. When I try to connect to SQL Server through Visual Studio, I don't get my server name on Add connection drop down menu. | 2014/10/25 | [
"https://Stackoverflow.com/questions/26559840",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3786234/"
] | If the database is in your local machine, Just put a . (Dot) in Server Name and select the database.
 | run services.msc
find " SQL server browser " , it might be disabled , start that service and set it to automatic. |
26,559,840 | I'm using Visual Studio 2010 and SQL Server 2012. When I try to connect to SQL Server through Visual Studio, I don't get my server name on Add connection drop down menu. | 2014/10/25 | [
"https://Stackoverflow.com/questions/26559840",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3786234/"
] | If the database is in your local machine, Just put a . (Dot) in Server Name and select the database.
 | For people using sql server 2014+ and using the local db on your pc. simply set the server name to be (localdb)\ name of your database. It worked for me. |
26,559,840 | I'm using Visual Studio 2010 and SQL Server 2012. When I try to connect to SQL Server through Visual Studio, I don't get my server name on Add connection drop down menu. | 2014/10/25 | [
"https://Stackoverflow.com/questions/26559840",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3786234/"
] | Go to SQL Server Management Studio to look for the correct `Server Name` and copy the value. Make all the configurations by yourself at the end just click `Test connection` button. If the connection is test successfully proceed with your work. | Insert machine\_name/SqlServerName |
26,559,840 | I'm using Visual Studio 2010 and SQL Server 2012. When I try to connect to SQL Server through Visual Studio, I don't get my server name on Add connection drop down menu. | 2014/10/25 | [
"https://Stackoverflow.com/questions/26559840",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3786234/"
] | Go to SQL Server Management Studio to look for the correct `Server Name` and copy the value. Make all the configurations by yourself at the end just click `Test connection` button. If the connection is test successfully proceed with your work. | run services.msc
find " SQL server browser " , it might be disabled , start that service and set it to automatic. |
26,559,840 | I'm using Visual Studio 2010 and SQL Server 2012. When I try to connect to SQL Server through Visual Studio, I don't get my server name on Add connection drop down menu. | 2014/10/25 | [
"https://Stackoverflow.com/questions/26559840",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3786234/"
] | Go to SQL Server Management Studio to look for the correct `Server Name` and copy the value. Make all the configurations by yourself at the end just click `Test connection` button. If the connection is test successfully proceed with your work. | For people using sql server 2014+ and using the local db on your pc. simply set the server name to be (localdb)\ name of your database. It worked for me. |
26,559,840 | I'm using Visual Studio 2010 and SQL Server 2012. When I try to connect to SQL Server through Visual Studio, I don't get my server name on Add connection drop down menu. | 2014/10/25 | [
"https://Stackoverflow.com/questions/26559840",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3786234/"
] | run services.msc
find " SQL server browser " , it might be disabled , start that service and set it to automatic. | Insert machine\_name/SqlServerName |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.