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
14,929
We have the following problem in the office: there is a colleague who, I think is nice enough once you get to know him a bit more closely. The thing is, most of the time he looks really grumpy or depressed. I don't really know how to read his face. He talks very little. We could deal with that (there are seven persons...
2018/05/25
[ "https://interpersonal.stackexchange.com/questions/14929", "https://interpersonal.stackexchange.com", "https://interpersonal.stackexchange.com/users/18238/" ]
It's beyond simple: The phrase you're looking for is "Do you mind" or "Would you mind" not letting the door close so noisily. The title of the question is asking for "the right way". This is it. Absent other factors which haven't been mentioned here, like previous interactions which would make this a touchy or diffic...
Perhaps your colleague "looks really grumpy or depressed. ... talks very little" because of something at home or elsewhere, that's probably not your business. > > "... he has this habit of slamming the door real hard. Not like some people do out of negligence, letting the door fall shut behind them. It's a glass door...
14,929
We have the following problem in the office: there is a colleague who, I think is nice enough once you get to know him a bit more closely. The thing is, most of the time he looks really grumpy or depressed. I don't really know how to read his face. He talks very little. We could deal with that (there are seven persons...
2018/05/25
[ "https://interpersonal.stackexchange.com/questions/14929", "https://interpersonal.stackexchange.com", "https://interpersonal.stackexchange.com/users/18238/" ]
If he enters the room and slams the door, ask him immediately like "don't you think that was too hard?". Or if he isn't afraid to destroy the door. Reminding someone of this shouldn't yet be offending. Start with a hint to make him think about that. If this doesn't help, slowly become more direct. Try to not say th...
I tend to agree with the answer Val provided. The simplest way to deal with this is to talk to the person. If talking to the person, for whatever reason, is out of the question or uncomfortable, you could try posting a sign on the door asking that people be cautious when closing the door so as not to disrupt the offic...
52,551,248
I have an HTML page where the code is ``` <!DOCTYPE html> <html> <body> <script> function myFunction(event) { if (event.keyCode == 13) { console.log(5 + 6); return false; } } </script> <a href="#" id="descRef" onkeydown='myFunction(event)'><b>Search Description222</b></a> </body> </html> ``...
2018/09/28
[ "https://Stackoverflow.com/questions/52551248", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5728426/" ]
You have to understand the difference between a screen reader's "browse mode" vs "forms mode". In "browse mode", the screen reader user can "browse" the DOM by using screen reader shortcut keys. For example, "H" will move the screen reader focus to the next heading, "B" will move to the next button, "L" will move to th...
I found this answer: [Make onKeyDown trigger an HTML button's onClick event](https://stackoverflow.com/questions/10355895/make-onkeydown-trigger-an-html-buttons-onclick-event). Try to use Jquery syntax for passing a keyboard value in the a tag. look at the next code: ``` <!DOCTYPE html> <html> <head> <script src="//aj...
52,551,248
I have an HTML page where the code is ``` <!DOCTYPE html> <html> <body> <script> function myFunction(event) { if (event.keyCode == 13) { console.log(5 + 6); return false; } } </script> <a href="#" id="descRef" onkeydown='myFunction(event)'><b>Search Description222</b></a> </body> </html> ``...
2018/09/28
[ "https://Stackoverflow.com/questions/52551248", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5728426/" ]
You have to understand the difference between a screen reader's "browse mode" vs "forms mode". In "browse mode", the screen reader user can "browse" the DOM by using screen reader shortcut keys. For example, "H" will move the screen reader focus to the next heading, "B" will move to the next button, "L" will move to th...
When Space or Enter is pressed while a link has focus, JAWS catches the keystroke, prevents the default behaviour and simulates a click instead. That's why KeyDown isn't working. The expected behaviour for links is to load a new page or move the focus to a new place on the same page. Can you change the link to a butto...
6,253,576
I'm actively developing desktop applications, local and network services, some classic ASP.NET, etc., so I'm used to static compilation and static code analysis. Now that I'm (finally) learning [ASP.NET MVC 3.0](http://en.wikipedia.org/wiki/ASP.NET_MVC_Framework#Release_history) I'm seeing that many of the ASP.NET MVC ...
2011/06/06
[ "https://Stackoverflow.com/questions/6253576", "https://Stackoverflow.com", "https://Stackoverflow.com/users/382783/" ]
Views are compiled at runtime by default. You can modify your project file (csproj) to compile the views when the application builds by setting the following property: ``` <MvcBuildViews>true</MvcBuildViews> ``` Downside of this approach is that your buildtime will increase significantly. You should consider only se...
It is possible to setup your project so that it includes views in your compilation. This would be where static typing is useful. Another place would be in runtime, if you try to pass in a model that does not match the expected model you will immediately get an exception. If you were to type views dynamically then you w...
6,253,576
I'm actively developing desktop applications, local and network services, some classic ASP.NET, etc., so I'm used to static compilation and static code analysis. Now that I'm (finally) learning [ASP.NET MVC 3.0](http://en.wikipedia.org/wiki/ASP.NET_MVC_Framework#Release_history) I'm seeing that many of the ASP.NET MVC ...
2011/06/06
[ "https://Stackoverflow.com/questions/6253576", "https://Stackoverflow.com", "https://Stackoverflow.com/users/382783/" ]
Views are compiled at runtime by default. You can modify your project file (csproj) to compile the views when the application builds by setting the following property: ``` <MvcBuildViews>true</MvcBuildViews> ``` Downside of this approach is that your buildtime will increase significantly. You should consider only se...
model is new dynamic type in .net 4.0, so these types get resolved at runtime not at compilation time.
3,419
I was reading a response on the meta here about how "clickbait" titles are annoying to that user (sorry about this one's title, friend). I find that nonstandard titles are better at getting eyes on a question and subsequently get more and better answers, which has lead me to trying to sensationalize my question titles ...
2016/03/24
[ "https://worldbuilding.meta.stackexchange.com/questions/3419", "https://worldbuilding.meta.stackexchange.com", "https://worldbuilding.meta.stackexchange.com/users/18534/" ]
As I feel that I am the "that user" mentioned :), I'll explain my views on the subject. We all know that reputation is a bunch of virtual points on an internet site. Nevertheless, we all like to accumulate them. As such we want our questions to be popular. Furthermore, as you mention, you want to attract enough people...
I think the best "clickbait" is to **develop a reputation for asking well-framed, thought-provoking, and interesting questions**. That will lead to people from WB who know of you and your questions to say, "Ah, another `JGaines` question, this should be interesting!" (click) That will lead to your question getting lot...
3,419
I was reading a response on the meta here about how "clickbait" titles are annoying to that user (sorry about this one's title, friend). I find that nonstandard titles are better at getting eyes on a question and subsequently get more and better answers, which has lead me to trying to sensationalize my question titles ...
2016/03/24
[ "https://worldbuilding.meta.stackexchange.com/questions/3419", "https://worldbuilding.meta.stackexchange.com", "https://worldbuilding.meta.stackexchange.com/users/18534/" ]
As I feel that I am the "that user" mentioned :), I'll explain my views on the subject. We all know that reputation is a bunch of virtual points on an internet site. Nevertheless, we all like to accumulate them. As such we want our questions to be popular. Furthermore, as you mention, you want to attract enough people...
Although clickbait titles may be entertaining, they don't really get the gist of the question across unless you actually make the effort to read the whole question. By your logic, I feel like you're doing the opposite of what you want to do: you're pushing potentially useful answers with a title that might seem random....
3,419
I was reading a response on the meta here about how "clickbait" titles are annoying to that user (sorry about this one's title, friend). I find that nonstandard titles are better at getting eyes on a question and subsequently get more and better answers, which has lead me to trying to sensationalize my question titles ...
2016/03/24
[ "https://worldbuilding.meta.stackexchange.com/questions/3419", "https://worldbuilding.meta.stackexchange.com", "https://worldbuilding.meta.stackexchange.com/users/18534/" ]
As I feel that I am the "that user" mentioned :), I'll explain my views on the subject. We all know that reputation is a bunch of virtual points on an internet site. Nevertheless, we all like to accumulate them. As such we want our questions to be popular. Furthermore, as you mention, you want to attract enough people...
The purpose of the question title is to **accurately and succintly summarize the most important parts of the question** in order to establish context for the question body. The title itself cannot cover all the ground that the question text itself does. That's just not practical, let alone that it isn't the purpose of...
3,419
I was reading a response on the meta here about how "clickbait" titles are annoying to that user (sorry about this one's title, friend). I find that nonstandard titles are better at getting eyes on a question and subsequently get more and better answers, which has lead me to trying to sensationalize my question titles ...
2016/03/24
[ "https://worldbuilding.meta.stackexchange.com/questions/3419", "https://worldbuilding.meta.stackexchange.com", "https://worldbuilding.meta.stackexchange.com/users/18534/" ]
I think the best "clickbait" is to **develop a reputation for asking well-framed, thought-provoking, and interesting questions**. That will lead to people from WB who know of you and your questions to say, "Ah, another `JGaines` question, this should be interesting!" (click) That will lead to your question getting lot...
Although clickbait titles may be entertaining, they don't really get the gist of the question across unless you actually make the effort to read the whole question. By your logic, I feel like you're doing the opposite of what you want to do: you're pushing potentially useful answers with a title that might seem random....
3,419
I was reading a response on the meta here about how "clickbait" titles are annoying to that user (sorry about this one's title, friend). I find that nonstandard titles are better at getting eyes on a question and subsequently get more and better answers, which has lead me to trying to sensationalize my question titles ...
2016/03/24
[ "https://worldbuilding.meta.stackexchange.com/questions/3419", "https://worldbuilding.meta.stackexchange.com", "https://worldbuilding.meta.stackexchange.com/users/18534/" ]
I think the best "clickbait" is to **develop a reputation for asking well-framed, thought-provoking, and interesting questions**. That will lead to people from WB who know of you and your questions to say, "Ah, another `JGaines` question, this should be interesting!" (click) That will lead to your question getting lot...
The purpose of the question title is to **accurately and succintly summarize the most important parts of the question** in order to establish context for the question body. The title itself cannot cover all the ground that the question text itself does. That's just not practical, let alone that it isn't the purpose of...
2,296,856
I want to connect two devices using the GKSession, starting one as a server and the other one as a client. Using this configuration I can't use the GKPeerPickerController. I'm having problems for connecting the two devices: * Using only bluetooth: impossible * using WiFi: at least there are some data exchange between...
2010/02/19
[ "https://Stackoverflow.com/questions/2296856", "https://Stackoverflow.com", "https://Stackoverflow.com/users/266276/" ]
I think you miss to accept connection with client. After you receive the "didReceiveConnectionRequestFromPeer" callback, you need to accept connection with client like this: ``` -(void)session:(GKSession *)session didReceiveConnectionRequestFromPeer:(NSString *)peerID { NSLog(@"Someone is trying to connect"); NSE...
I had similar problems, but from the description above I think you are making some errors: GKSession only implements BT; if you use the picker, then you can provide separate methods for dealing with WiFi connections. The "didReceiveConnectionRequestFromPeer" method should *call* the "acceptConnectionFromPeer" method ...
3,517,943
This is pretty self explanatory. How can I target only iphone for a popup.
2010/08/19
[ "https://Stackoverflow.com/questions/3517943", "https://Stackoverflow.com", "https://Stackoverflow.com/users/424680/" ]
For Javascript and/or PHP: <http://davidwalsh.name/detect-iphone>
[How do I detect Mobile Safari server side using PHP?](https://stackoverflow.com/questions/186734/how-do-i-detect-mobile-safari-server-side-using-php) Will work with all web technologies -- not just php.
39,245,973
I'm writing signal processing library, and I want to make this kind of hierarchy. First, I defined `abstract class` that define only "this wrapper class has one `double[]` field" i.e. ``` public abstract class DoubleArray{ private final double[] array; DoubleArray(double[] array){ this.array...
2016/08/31
[ "https://Stackoverflow.com/questions/39245973", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You could extract the checking logic to a separate `check` method which the base constructor can execute prior to the assignment : ``` public abstract class DoubleArray{ private final double[] array; protected abstract void check (double[] array); DoubleArray(double[] array){ check(array); ...
Since you are writing a library, it means that your library could be used in some cases you can't predict now. That's why I would avoid using inheritance because with inheritance you are scealing (enforcing) what you think is right in order to validate a signal by this static inheritance chain: `OneAmplitudeSignal` > `...
20,286,540
I have written a simple function to toggle Fullscreen Mode on a web application. The application is only required to run in Chrome (eventually deployed under Kiosk mode), but there seems to be some strange behaviour with `cancelFullScreen` and `webkitCancelFullScreen`. For example, here is the stripped down `toggleFu...
2013/11/29
[ "https://Stackoverflow.com/questions/20286540", "https://Stackoverflow.com", "https://Stackoverflow.com/users/367401/" ]
With the help of @Tom Chung, and after playing around, it turns out that `cancelFullScreen` (and similarly `webkitCancelFullScreen` needs to be called on `document`, whereas `requestFullscreen` needs to be called on `document.documentElement`. As such, the updated code as follows works fine: ``` function toggleFullSc...
``` function toggleFullScreen() { //Post author DID NOT provide standards-compliant method at all. //Standards compliant approaches should detect first. //Prefixes are eventually removed / performance. if ()//standards here { //standards here } else if (document.documentElement.webkitRequestFullScreen) { d...
20,286,540
I have written a simple function to toggle Fullscreen Mode on a web application. The application is only required to run in Chrome (eventually deployed under Kiosk mode), but there seems to be some strange behaviour with `cancelFullScreen` and `webkitCancelFullScreen`. For example, here is the stripped down `toggleFu...
2013/11/29
[ "https://Stackoverflow.com/questions/20286540", "https://Stackoverflow.com", "https://Stackoverflow.com/users/367401/" ]
With the help of @Tom Chung, and after playing around, it turns out that `cancelFullScreen` (and similarly `webkitCancelFullScreen` needs to be called on `document`, whereas `requestFullscreen` needs to be called on `document.documentElement`. As such, the updated code as follows works fine: ``` function toggleFullSc...
I am one of the developers working on [H5P](https://h5p.org), which supports fullscreen for all browsers supporting it. Below I have copied the parts of the code needed to exit fullscreen. First we need to figure out the browser prefix ``` var fullScreenBrowserPrefix; // Detect if we support fullscreen, and what pre...
9,432,884
We are using PostgreSQL with JPA which maps large strings to columns with type `TEXT`. While programmatically we are able to read and write the data, pgAdmin and psql just show me the object ID when I select the data. Is there a way/tool to quickly select the data without having to use some API (e.g., JDBC)? An exam...
2012/02/24
[ "https://Stackoverflow.com/questions/9432884", "https://Stackoverflow.com", "https://Stackoverflow.com/users/387981/" ]
Perhaps one of "the usual suspects" (i.e. JPA / Hibernate / PostgreSQL JDBC driver) mapped the column into the "Large Object" system of PostgreSQL. A quick test in the `psql` shell: ``` db=> \lo_export 282878 /tmp/x.txt lo_export ``` would export the stuff referenced by the first id from your example into the file ...
In pgAdmin III, I use: ``` select dType, id, loread(lo_open(docxml::::int, 131072), 999999999) from XmlPadraoNFe ``` See: [pgAdmin III: How to view a blob?](https://stackoverflow.com/questions/14875748/pgadmin-iii-how-to-view-a-blob)
32,926,452
Assume there is a queue like this (the lines are only for clarity. They don't represent anything): ``` [1,1,1, 2,2,2, 3,3, 4, 5] ``` I want to sort it into this: ``` [1,2,3,4,5, 1,2,3, 1,2] ``` Is there an algorithm that solves this and if so, how is it called?
2015/10/03
[ "https://Stackoverflow.com/questions/32926452", "https://Stackoverflow.com", "https://Stackoverflow.com/users/238971/" ]
If you're writing in Python, check out the [Counter](https://docs.python.org/3.4/library/collections.html#collections.Counter) class which turns a list into a type of histogram: ``` from collections import Counter l = [1, 1, 1, 2, 2, 2, 3, 3, 4, 5] c = Counter(l) result = [] for i in range(max(c.v...
There isn't any need to take the approach of counting occurrences described in [the levis501s approach](https://stackoverflow.com/questions/32926452/algorithm-name-for-sorting-of-numbers-into-ascending-groups/32926545#32926545) although it could well be argued that his code is more concise or more appropriate for Pytho...
32,926,452
Assume there is a queue like this (the lines are only for clarity. They don't represent anything): ``` [1,1,1, 2,2,2, 3,3, 4, 5] ``` I want to sort it into this: ``` [1,2,3,4,5, 1,2,3, 1,2] ``` Is there an algorithm that solves this and if so, how is it called?
2015/10/03
[ "https://Stackoverflow.com/questions/32926452", "https://Stackoverflow.com", "https://Stackoverflow.com/users/238971/" ]
If you're writing in Python, check out the [Counter](https://docs.python.org/3.4/library/collections.html#collections.Counter) class which turns a list into a type of histogram: ``` from collections import Counter l = [1, 1, 1, 2, 2, 2, 3, 3, 4, 5] c = Counter(l) result = [] for i in range(max(c.v...
This answer is based on [levis501s'](https://stackoverflow.com/questions/32926452/algorithm-name-for-sorting-of-numbers-into-ascending-groups/32926545#32926545), but this seems simpler (or at least different). As with his answer, this uses Python although similar functionality can be implemented without too much effort...
32,926,452
Assume there is a queue like this (the lines are only for clarity. They don't represent anything): ``` [1,1,1, 2,2,2, 3,3, 4, 5] ``` I want to sort it into this: ``` [1,2,3,4,5, 1,2,3, 1,2] ``` Is there an algorithm that solves this and if so, how is it called?
2015/10/03
[ "https://Stackoverflow.com/questions/32926452", "https://Stackoverflow.com", "https://Stackoverflow.com/users/238971/" ]
This answer is based on [levis501s'](https://stackoverflow.com/questions/32926452/algorithm-name-for-sorting-of-numbers-into-ascending-groups/32926545#32926545), but this seems simpler (or at least different). As with his answer, this uses Python although similar functionality can be implemented without too much effort...
There isn't any need to take the approach of counting occurrences described in [the levis501s approach](https://stackoverflow.com/questions/32926452/algorithm-name-for-sorting-of-numbers-into-ascending-groups/32926545#32926545) although it could well be argued that his code is more concise or more appropriate for Pytho...
45,552,444
Hey I'm trying display a set of "tags" in a view controller using collection view cells but I'm having trouble finding a way to make them be able to dynamically resizable depending on the length of the string. Right now the individual cells are statically sized so whenever a String that populates the cell with charac...
2017/08/07
[ "https://Stackoverflow.com/questions/45552444", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8303592/" ]
You need unambiguous constraints between your label and the cell (e.g. leading, trailing, top, and bottom constraints): [![enter image description here](https://i.stack.imgur.com/uS8of.png)](https://i.stack.imgur.com/uS8of.png) Then you can use `UICollectionViewFlowLayoutAutomaticSize` for the `itemSize` of your `col...
You can calculate the lengths of the texts ahead of time, feed them into an array accessible by your collectionView and use them them to construct the size of the cell. ``` //Create vars NSArray * texts = @[@"Short",@"Something Long",@"Something Really Long"]; NSMutableArray * lengths = [NSMutableArray new]; float pa...
22,791,677
I want the program to draw a circle whenever the screen gets touched and if the screen gets touched on another position I want the program to draw a circle again but without deleting the old one! Now my problem is that it doesn't just draw a new circle in addition to the old one. It draws a new circle and deletes the ...
2014/04/01
[ "https://Stackoverflow.com/questions/22791677", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3485877/" ]
You can achieve it by maintaining a list of points as a private instance variable: ``` private List<Point> points = new ArrayList<Point>; ``` Then you can add new points to this list every time a new touch event occurs: ``` Point p = new Point(); p.x = event.getX(); p.y = event.getY(); points.add(p); invalidate(); ...
Why not make a circle object which stores the coordinates of where to paint the circle, then add these objects to an array. Then in your paint method iterate through the array get the coordinates from each object and paint the circle using the coordinates? So in your onclick method create a new circle object with the...
22,791,677
I want the program to draw a circle whenever the screen gets touched and if the screen gets touched on another position I want the program to draw a circle again but without deleting the old one! Now my problem is that it doesn't just draw a new circle in addition to the old one. It draws a new circle and deletes the ...
2014/04/01
[ "https://Stackoverflow.com/questions/22791677", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3485877/" ]
You can achieve it by maintaining a list of points as a private instance variable: ``` private List<Point> points = new ArrayList<Point>; ``` Then you can add new points to this list every time a new touch event occurs: ``` Point p = new Point(); p.x = event.getX(); p.y = event.getY(); points.add(p); invalidate(); ...
one of my changing circle classes: ``` public class GrowCircle { float x, y;int radius; Paint myp = new Paint(); int colr,colg,colb; int redvar=1; int bluevar=5; int greenvar=2; int tripper=10; int change=2; Random rand = new Random(); public GrowCircle(float x, float y){ this.x=x; this.y=y; this.radius=2...
47,184,745
Angular5 introduced a new way of upgrating app from AngularJS to Angular - `downgradeModule`. It should resolve an issue with to eager change detection in this kind of hybrid application. So far, in Angular4 I used `UpgradeModule` successfully, but it caused some performance issue because of change detections. Now I'm...
2017/11/08
[ "https://Stackoverflow.com/questions/47184745", "https://Stackoverflow.com", "https://Stackoverflow.com/users/585773/" ]
I will self answer: for NSMutableArray there is no literal syntax, so you have to write: ``` self.box = [@[ [@[ _imageView1, _imageView2, _imageView3 ] mutableCopy], [@[ _imageView4, _imageView5, _imageView6 ] mutableCopy], [@[ _imageView7, _imageView8, _imageView9 ] mutableCopy] ] mutableCopy]; `...
If you wish to do it with fewer brackets than your own answer you can use: ``` self.box = @[ @[_imageView1, _imageView2, _imageView3].mutableCopy, @[_imageView4, _imageView5, _imageView6].mutableCopy, @[_imageView7, _imageView8, _imageView9].mutableCopy ].mutableCopy; ...
48,189,688
Im trying to find if a .xlsx file contains a @. I have used pandas, which work great, unless if the excel sheet have the first column empty, then it fails.. any ideas how to rewrite the code to handle/skip empty columns? the code: ``` df = pandas.read_excel(open(path,'rb'), sheetname=0) out = 'False' for col in df.co...
2018/01/10
[ "https://Stackoverflow.com/questions/48189688", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1495850/" ]
Take a look at the [json module](https://docs.python.org/3/library/json.html). More specifically the 'Decoding JSON:' section. ``` import json import requests response = requests.get() # api call users = json.loads(response.text) for user in users: print(user['id']) ```
It seems what you are looking for is the [json](https://docs.python.org/2/library/json.html) module. with it you can use this to parse a string into json format: ``` import json output=json.loads(myJsonString) ```
48,189,688
Im trying to find if a .xlsx file contains a @. I have used pandas, which work great, unless if the excel sheet have the first column empty, then it fails.. any ideas how to rewrite the code to handle/skip empty columns? the code: ``` df = pandas.read_excel(open(path,'rb'), sheetname=0) out = 'False' for col in df.co...
2018/01/10
[ "https://Stackoverflow.com/questions/48189688", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1495850/" ]
Take a look at the [json module](https://docs.python.org/3/library/json.html). More specifically the 'Decoding JSON:' section. ``` import json import requests response = requests.get() # api call users = json.loads(response.text) for user in users: print(user['id']) ```
use python 3 and import urlib ``` import urllib.request import json url = link of the server #Taking response and request from url r = urllib.request.urlopen(url) #reading and decoding the data data = json.loads(r.read().decode(r.info().get_param('charset') or 'utf-8')) for json_inner_array in data: for j...
48,189,688
Im trying to find if a .xlsx file contains a @. I have used pandas, which work great, unless if the excel sheet have the first column empty, then it fails.. any ideas how to rewrite the code to handle/skip empty columns? the code: ``` df = pandas.read_excel(open(path,'rb'), sheetname=0) out = 'False' for col in df.co...
2018/01/10
[ "https://Stackoverflow.com/questions/48189688", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1495850/" ]
Take a look at the [json module](https://docs.python.org/3/library/json.html). More specifically the 'Decoding JSON:' section. ``` import json import requests response = requests.get() # api call users = json.loads(response.text) for user in users: print(user['id']) ```
You can try like below to get the values from json response: ``` import json content=[{ "username": "admin", "first_name": "", "last_name": "", "roles": "system_admin system_user", "locale": "en", "delete_at": 0, "update_at": 1511335509393, "create_at": 1511335500662, "auth_service...
48,189,688
Im trying to find if a .xlsx file contains a @. I have used pandas, which work great, unless if the excel sheet have the first column empty, then it fails.. any ideas how to rewrite the code to handle/skip empty columns? the code: ``` df = pandas.read_excel(open(path,'rb'), sheetname=0) out = 'False' for col in df.co...
2018/01/10
[ "https://Stackoverflow.com/questions/48189688", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1495850/" ]
You can try like below to get the values from json response: ``` import json content=[{ "username": "admin", "first_name": "", "last_name": "", "roles": "system_admin system_user", "locale": "en", "delete_at": 0, "update_at": 1511335509393, "create_at": 1511335500662, "auth_service...
It seems what you are looking for is the [json](https://docs.python.org/2/library/json.html) module. with it you can use this to parse a string into json format: ``` import json output=json.loads(myJsonString) ```
48,189,688
Im trying to find if a .xlsx file contains a @. I have used pandas, which work great, unless if the excel sheet have the first column empty, then it fails.. any ideas how to rewrite the code to handle/skip empty columns? the code: ``` df = pandas.read_excel(open(path,'rb'), sheetname=0) out = 'False' for col in df.co...
2018/01/10
[ "https://Stackoverflow.com/questions/48189688", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1495850/" ]
You can try like below to get the values from json response: ``` import json content=[{ "username": "admin", "first_name": "", "last_name": "", "roles": "system_admin system_user", "locale": "en", "delete_at": 0, "update_at": 1511335509393, "create_at": 1511335500662, "auth_service...
use python 3 and import urlib ``` import urllib.request import json url = link of the server #Taking response and request from url r = urllib.request.urlopen(url) #reading and decoding the data data = json.loads(r.read().decode(r.info().get_param('charset') or 'utf-8')) for json_inner_array in data: for j...
70,464,882
I want to know if a variable content can be used as variable name. Example below: ``` int a; string b = "nombre"; ``` I'm asking if "nombre" can replace "a" as variable name. I'm trying to rename an object(like we rename files and folders).
2021/12/23
[ "https://Stackoverflow.com/questions/70464882", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16421863/" ]
If you want to be able to map strings to numeric values, you could create a map object: ``` #include <unordered_map> #include <string> #include <iostream> int main() { std::unordered_map<std::string, int> vars { { "nombre", 5 }, { "otro_nombre", 3 }, }; std::cout << vars["nombre"] << ...
You can use references to create an alias for an already existing variables, if this is what you're looking for. ``` int a = 5; int& nombre = a; //nombre is now an alias for a ```
4,028,676
[Roughly speaking, the following question considers a special setting in which we want to prove a property in the form of $ord(g \sigma)\ |\ p^k$.] **The Problem in Detail:** Let $G$ be a finite group, and $H \leq G$ any subgroup with order $|H|=p^k$ (where $p$ is a prime, and $k \in \mathbb{N}$. Note that $H$ may ...
2021/02/17
[ "https://math.stackexchange.com/questions/4028676", "https://math.stackexchange.com", "https://math.stackexchange.com/users/846763/" ]
I have found a reference for proving this claim. My claim is in fact a weaker version of the first lemma given in the article "On A Theorem of Frobenius" by Richard Brauer in 1969. Since the proof is clearly presented in the original article (which can be easily accessed). I would not copy it down here :)
Sorry to disappoint you, but your conjecture is false. One counterexample I could come up with is the following: Let $G:=S\_4$ be the symmetric group on four points, let $H:=\langle\,(1,2,3,4),(1,3)\,\rangle$ be a Sylow $2$-subgroup. Now choose $g:=(1,4)$ and $\sigma:=(1,2)(3,4)$. Then $g\not\in H$, and $g^n\sigma g^...
23,247,923
I know this is a noob error but I really can't discover why it's coming up as I am accessing an object that is set. The `xloc` and `yloc` both being local variables. ``` gameBorder.FormInstance.tableLayoutPanel1.GetControlFromPosition(xloc, yloc).BackgroundImage = Properties.Resources.Image; ``` However this has be...
2014/04/23
[ "https://Stackoverflow.com/questions/23247923", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3375561/" ]
If you are sure that `tableLayoutPanel1` exists and is not null, then change your code to this and see what happens: ``` var control = gameBorder.FormInstance.tableLayoutPanel1.GetControlFromPosition (xloc, yloc); if (control == null) throw new NullReferenceException( "No control at those coordina...
The way you chain members and method results makes it hard to determine at a glance what causes the `NullReferenceException` to be thrown. `FormInstance` could be `null` if it's accessed before any `gameBorder` instances ever get created. Although unlikely, `tableLayoutPanel` could be `null` as well. The result of `Get...
69,218,168
So I have some question abaout how to correctly use FutureBuilder. I read somewhere that we should store the future in a variable and call that variable in the FutureBuilder instead of the future service. But how do we initalize the initial value of that variable? When I tired this, it always gives `LateInitializationE...
2021/09/17
[ "https://Stackoverflow.com/questions/69218168", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11214886/" ]
Get the answer, because I need the data from SharedPreferences, I need to wait for the function to finish first ``` _getService() async { await getUserPrefs(); return await transaksiService.getTransaksi(user[2]); } ``` Then calling it in `iniState` and save it in a variable ``` _dataFuture = _getServic...
* **FutureBuilder** removes boilerplate code. * FutureBuilder Widget is used to create widgets based on the latest snapshot of interaction with a Future. It is necessary for Future to be obtained earlier either through a change of state or change in dependencies. If you get data from API refer my answer [here](https:/...
74,021,821
I have a large pandas dataframe with common sentences 'S', which I'd like to learn, and their counts 'C', like this: ```py df = pd.DataFrame({"S": ["Yes.", "Yes!", "Yes?", "No?", "No.", "What?"], "C": [100, 50, 40, 30, 10, 5]}) df S C 0 Yes. 100 1 Yes! 50 2 Ye...
2022/10/11
[ "https://Stackoverflow.com/questions/74021821", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13466303/" ]
Your Lambda will be running in a serverless compute environment, not in your EC2. That means the `log` directory that you are traversing is in the serverless Lambda environment, not the `log` directory in your EC2 instance. My guess is, the Lambda `log` directory contains no log files. Hence, the code ran successfully ...
you probably miss to install in your ec2 the cloudwatch agent. <https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Install-CloudWatch-Agent.html> Furthermore, there is no need to "move" log between services, because AWS provide automatic logging for everything, with Cloudwatch and Cloudtrail services
48,474,941
I want to make `QLabel` with the image circle: **Code:** ``` QLabel *label = new QLabel(this); QPixmap avatarPixmap(":/Icon/default_avatar.png"); label->setPixmap(avatarPixmap); label->setStyleSheet("border: 0.5px solid red; border-radius: 50%; background-clip: padding;"); ``` ![0_1517048799005_2018-01-27_122604.pn...
2018/01/27
[ "https://Stackoverflow.com/questions/48474941", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3731050/" ]
try to set mask on the label like: ``` int w = // set the width here int h = // set the height here QRect *rct = new QRect(0, 0, w, h); QRegion *reg = new QRegion(*rct, QRegion::Ellipse); label->setMask(*reg); ``` see: <http://doc.qt.io/archives/qt-4.8/qwidget.html#setMask>
The solution by overriding `QLabel` `paintEvent` method. **Code:** ``` void AccountImage::paintEvent(QPaintEvent *event) { QPixmap pixmap(":/Icon/my_avatar.png"); QPixmap scaled = pixmap.scaled(width(), height(), Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation); QBrush brush(scaled); QPainter...
43,136,026
I am new to python with great desire to learn the language. However, right now i need someone help with a code i am currently working on which keep flagging this error : Oops, try again. get\_average(alice) returned None instead of the expected 91.15 This is the question with my solution below also: Write a function ...
2017/03/31
[ "https://Stackoverflow.com/questions/43136026", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7796550/" ]
Alternatively, you can also try this: ``` import numpy as np def weighted_average(d): """Returns weighted average of values corresponding to keys homework, tests & quizzes of a dictionary d""" # bind dict keys to variables homework, test, quiz homework, test, quiz = [d["homework"]], [d["tests"]], [d["q...
I've tested your code, fixed the missing opening bracket at line 4 (looyd quizzes) and it's working well. ``` lloyd = { "name": "Lloyd", "homework": [90.0, 97.0, 75.0, 92.0], "quizzes": [88.0, 40.0, 94.0], "tests": [75.0, 90.0] } alice = { "name": "Alice", "homework": [100.0, 92.0, ...
1,644,635
Prove that: $n^n (\frac{n+1}{2})^{2n}$ 1. Greater than or equal to $(\frac{n+1}{2})^3$ 2. Greater than or equal to $(n!)^3$ Here $n\in \mathbb{N}$ How to prove this? It seems too complicated. Please suggest as how to initiate the solution?
2016/02/07
[ "https://math.stackexchange.com/questions/1644635", "https://math.stackexchange.com", "https://math.stackexchange.com/users/290994/" ]
Using $\bf{A.M\geq G.M}\;,$ We get $$\frac{1^3+2^3+3^3+.........+n^3}{n}\geq \left(1^3\cdot 2^3\cdot 3^3\cdot.......n^3\right)^{\frac{1}{n}}$$ So $$\frac{n^2(n+1)^2}{4n}\geq \left(n!\right)^{\frac{1}{n}}\Rightarrow n^n\cdot \left(\frac{n+1}{2}\right)^{2n}\geq (n!)^3$$
Part 1. For $n\in N$, we have: $n\geq \frac{n+1}{2}$ $n (\frac{n+1}{2})^2\geq (\frac{n+1}{2})^3$ $n^n (\frac{n+1}{2})^{2n}\geq (\frac{n+1}{2})^3$
5,576,500
How to make three column layout having equal height using only css and html (no js)
2011/04/07
[ "https://Stackoverflow.com/questions/5576500", "https://Stackoverflow.com", "https://Stackoverflow.com/users/690854/" ]
Easiest way is to use [faux column background technique](http://www.alistapart.com/articles/fauxcolumns/). You can also try giving three divs massive bottom paddings with massive bottom margins with a container with `overflow: hidden`. It doesn't play nice with inline anchors though.
``` <html><body> ``` `<div>` ``` <div style="float:left;height: 33.33%;width:10%;background-color:red">zdfsfs</div> <div style="float:left;height: 33.33%;width:10%;background-color:blue">zgfsgsgfsgf</div> <div style="float:left;height: 33.33%;width:10%;background-color:cyan">zvgzcxgvxz</div> </div></body></html> ``...
5,576,500
How to make three column layout having equal height using only css and html (no js)
2011/04/07
[ "https://Stackoverflow.com/questions/5576500", "https://Stackoverflow.com", "https://Stackoverflow.com/users/690854/" ]
Easiest way is to use [faux column background technique](http://www.alistapart.com/articles/fauxcolumns/). You can also try giving three divs massive bottom paddings with massive bottom margins with a container with `overflow: hidden`. It doesn't play nice with inline anchors though.
``` div {display : table-cell;} ``` This Could Be Another Solution To The Problem! For More Information, Please See This Link: [Is there a disadvantage of using `display:table-cell`on divs?](https://stackoverflow.com/questions/6307934/is-there-a-disadvantage-of-using-displaytable-cellon-divs)
17,261,551
I have a sql like: ``` DBSession().query(Model).filter(***) ``` and I want to explain this sql using `SQLAlchemy`.
2013/06/23
[ "https://Stackoverflow.com/questions/17261551", "https://Stackoverflow.com", "https://Stackoverflow.com/users/744916/" ]
You want to [compile your SQLAlchemy query into a string](https://docs.sqlalchemy.org/faq/sqlexpressions.html#how-do-i-render-sql-expressions-as-strings-possibly-with-bound-parameters-inlined); use the correct dialect and use literal values for bind parameters ``` query = DBSession().query(Model).filter(***) # you sho...
You can prepare your explain sql string like this: ``` 'EXPLAIN' + query.compile( compile_kwargs={"literal_binds": True}, dialect=mysql.dialect() ) ``` Advantage is query has parameters filled in.
30,476,296
I am working on an android project where Android support library v7-appcompat is being added by eclipse.Now after following android developers website, I have added dependency for this support library.My project is free of errors but while running the project i am getting the error **"The Import android.support.v7 cann...
2015/05/27
[ "https://Stackoverflow.com/questions/30476296", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4080963/" ]
Just delete `android-support-v4.jar` from libs folder of your project. Rest of the things/errors will be gone. Eclipse will handle rest of the things. if error still exist then try to remove unused imports & clean your project or restart your eclipse.
I think you have not added the App compact-v7 into uild path and also , please right click on your project and then navigate to the Properties , now in new dialog box click to android , select the appropriate android version and in down below in Library section add appcompact-v7 library . Hit apply and ok. Clean your ...
4,935,869
I am using php-ldap to manage posix accounts on a linux machine. I am able to search the database in php. And I am able to add users via the command line "ldapadd". However, when I try to add a user via PHP ldap\_add, I get an "Object class violation" error (errno 65). I have tried everything I can think of, but the e...
2011/02/08
[ "https://Stackoverflow.com/questions/4935869", "https://Stackoverflow.com", "https://Stackoverflow.com/users/110129/" ]
I figured out how to dig deeper. I am using Ubuntu which was dumping logs to /var/log/{debug,syslog} In order to get more info I had to increase the log level to 424 in /etc/ldap/slapd.d/cn=config.ldif Then I was able to see the error in the logs which told me what I was doing wrong... using a dc attribute with an in...
PosixAccount (the class that is needed for Linux users) has some mandatory attributes. You must provide in the same operation the: * uid * uidNumber * gidNumber * homeDirectory Perhaps in one approach you are, one you are not?
4,935,869
I am using php-ldap to manage posix accounts on a linux machine. I am able to search the database in php. And I am able to add users via the command line "ldapadd". However, when I try to add a user via PHP ldap\_add, I get an "Object class violation" error (errno 65). I have tried everything I can think of, but the e...
2011/02/08
[ "https://Stackoverflow.com/questions/4935869", "https://Stackoverflow.com", "https://Stackoverflow.com/users/110129/" ]
Object class violation always means the object you created violated the expectations of the schema. slapd provides a metric ton of logging if you simply set the debug level to some arbitarily high number.
PosixAccount (the class that is needed for Linux users) has some mandatory attributes. You must provide in the same operation the: * uid * uidNumber * gidNumber * homeDirectory Perhaps in one approach you are, one you are not?
4,935,869
I am using php-ldap to manage posix accounts on a linux machine. I am able to search the database in php. And I am able to add users via the command line "ldapadd". However, when I try to add a user via PHP ldap\_add, I get an "Object class violation" error (errno 65). I have tried everything I can think of, but the e...
2011/02/08
[ "https://Stackoverflow.com/questions/4935869", "https://Stackoverflow.com", "https://Stackoverflow.com/users/110129/" ]
PosixAccount (the class that is needed for Linux users) has some mandatory attributes. You must provide in the same operation the: * uid * uidNumber * gidNumber * homeDirectory Perhaps in one approach you are, one you are not?
We had the same problems, so we used the following bash command: ``` sudo tail -f syslog |grep slapd ``` So you will have an real time window to show you the detail reactions on your LDAP manipulations.
4,935,869
I am using php-ldap to manage posix accounts on a linux machine. I am able to search the database in php. And I am able to add users via the command line "ldapadd". However, when I try to add a user via PHP ldap\_add, I get an "Object class violation" error (errno 65). I have tried everything I can think of, but the e...
2011/02/08
[ "https://Stackoverflow.com/questions/4935869", "https://Stackoverflow.com", "https://Stackoverflow.com/users/110129/" ]
I figured out how to dig deeper. I am using Ubuntu which was dumping logs to /var/log/{debug,syslog} In order to get more info I had to increase the log level to 424 in /etc/ldap/slapd.d/cn=config.ldif Then I was able to see the error in the logs which told me what I was doing wrong... using a dc attribute with an in...
Object class violation always means the object you created violated the expectations of the schema. slapd provides a metric ton of logging if you simply set the debug level to some arbitarily high number.
4,935,869
I am using php-ldap to manage posix accounts on a linux machine. I am able to search the database in php. And I am able to add users via the command line "ldapadd". However, when I try to add a user via PHP ldap\_add, I get an "Object class violation" error (errno 65). I have tried everything I can think of, but the e...
2011/02/08
[ "https://Stackoverflow.com/questions/4935869", "https://Stackoverflow.com", "https://Stackoverflow.com/users/110129/" ]
I figured out how to dig deeper. I am using Ubuntu which was dumping logs to /var/log/{debug,syslog} In order to get more info I had to increase the log level to 424 in /etc/ldap/slapd.d/cn=config.ldif Then I was able to see the error in the logs which told me what I was doing wrong... using a dc attribute with an in...
We had the same problems, so we used the following bash command: ``` sudo tail -f syslog |grep slapd ``` So you will have an real time window to show you the detail reactions on your LDAP manipulations.
4,935,869
I am using php-ldap to manage posix accounts on a linux machine. I am able to search the database in php. And I am able to add users via the command line "ldapadd". However, when I try to add a user via PHP ldap\_add, I get an "Object class violation" error (errno 65). I have tried everything I can think of, but the e...
2011/02/08
[ "https://Stackoverflow.com/questions/4935869", "https://Stackoverflow.com", "https://Stackoverflow.com/users/110129/" ]
I figured out how to dig deeper. I am using Ubuntu which was dumping logs to /var/log/{debug,syslog} In order to get more info I had to increase the log level to 424 in /etc/ldap/slapd.d/cn=config.ldif Then I was able to see the error in the logs which told me what I was doing wrong... using a dc attribute with an in...
A [comment](https://secure.php.net/manual/en/function.ldap-error.php#121881) under ldap\_error documentation says that to obtain additional info you can call this: ``` ldap_get_option($conn, LDAP_OPT_DIAGNOSTIC_MESSAGE, $err); // $err now contains the additional info ```
4,935,869
I am using php-ldap to manage posix accounts on a linux machine. I am able to search the database in php. And I am able to add users via the command line "ldapadd". However, when I try to add a user via PHP ldap\_add, I get an "Object class violation" error (errno 65). I have tried everything I can think of, but the e...
2011/02/08
[ "https://Stackoverflow.com/questions/4935869", "https://Stackoverflow.com", "https://Stackoverflow.com/users/110129/" ]
Object class violation always means the object you created violated the expectations of the schema. slapd provides a metric ton of logging if you simply set the debug level to some arbitarily high number.
We had the same problems, so we used the following bash command: ``` sudo tail -f syslog |grep slapd ``` So you will have an real time window to show you the detail reactions on your LDAP manipulations.
4,935,869
I am using php-ldap to manage posix accounts on a linux machine. I am able to search the database in php. And I am able to add users via the command line "ldapadd". However, when I try to add a user via PHP ldap\_add, I get an "Object class violation" error (errno 65). I have tried everything I can think of, but the e...
2011/02/08
[ "https://Stackoverflow.com/questions/4935869", "https://Stackoverflow.com", "https://Stackoverflow.com/users/110129/" ]
Object class violation always means the object you created violated the expectations of the schema. slapd provides a metric ton of logging if you simply set the debug level to some arbitarily high number.
A [comment](https://secure.php.net/manual/en/function.ldap-error.php#121881) under ldap\_error documentation says that to obtain additional info you can call this: ``` ldap_get_option($conn, LDAP_OPT_DIAGNOSTIC_MESSAGE, $err); // $err now contains the additional info ```
4,935,869
I am using php-ldap to manage posix accounts on a linux machine. I am able to search the database in php. And I am able to add users via the command line "ldapadd". However, when I try to add a user via PHP ldap\_add, I get an "Object class violation" error (errno 65). I have tried everything I can think of, but the e...
2011/02/08
[ "https://Stackoverflow.com/questions/4935869", "https://Stackoverflow.com", "https://Stackoverflow.com/users/110129/" ]
A [comment](https://secure.php.net/manual/en/function.ldap-error.php#121881) under ldap\_error documentation says that to obtain additional info you can call this: ``` ldap_get_option($conn, LDAP_OPT_DIAGNOSTIC_MESSAGE, $err); // $err now contains the additional info ```
We had the same problems, so we used the following bash command: ``` sudo tail -f syslog |grep slapd ``` So you will have an real time window to show you the detail reactions on your LDAP manipulations.
68,992,767
I'm trying to implement selection sort in python using a list. But the implementation part is correct and is as per my algorithm but it is not resulting in correct output. Adding my code: ``` my_list = [64, 25, 12, 11, 32] def selection_sort(element_list): for element in range(len(element_list)): mindex =...
2021/08/31
[ "https://Stackoverflow.com/questions/68992767", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12116796/" ]
``` my_list = [64, 25, 12, 11, 32] def selection_sort(element_list): for element in range(len(element_list)): mindex = element for compare_index in range(element+1, len(element_list)): if element_list[mindex] > element_list[compare_index]: mindex = compare_index ...
Your algorithm is almost correct but `element_list[compare_index], element_list[mindex] = element_list[mindex], element_list[compare_index]` in this line you made the mistake. It shouldn't be `compare_index`, it should be `element`. Please check the correct algorithm below ``` my_list = [64, 25, 12, 11, 32] def selec...
68,992,767
I'm trying to implement selection sort in python using a list. But the implementation part is correct and is as per my algorithm but it is not resulting in correct output. Adding my code: ``` my_list = [64, 25, 12, 11, 32] def selection_sort(element_list): for element in range(len(element_list)): mindex =...
2021/08/31
[ "https://Stackoverflow.com/questions/68992767", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12116796/" ]
``` my_list = [64, 25, 12, 11, 32] def selection_sort(element_list): for element in range(len(element_list)): mindex = element for compare_index in range(element+1, len(element_list)): if element_list[mindex] > element_list[compare_index]: mindex = compare_index ...
``` my_list = [64, 25, 12, 11, 32] def selection_sort(element_list): for element in range(len(element_list)): mindex = element for compare_index in range(element+1, len(element_list)): if element_list[mindex] > element_list[compare_index]: min...
68,992,767
I'm trying to implement selection sort in python using a list. But the implementation part is correct and is as per my algorithm but it is not resulting in correct output. Adding my code: ``` my_list = [64, 25, 12, 11, 32] def selection_sort(element_list): for element in range(len(element_list)): mindex =...
2021/08/31
[ "https://Stackoverflow.com/questions/68992767", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12116796/" ]
``` my_list = [64, 25, 12, 11, 32] def selection_sort(element_list): for element in range(len(element_list)): mindex = element for compare_index in range(element+1, len(element_list)): if element_list[mindex] > element_list[compare_index]: mindex = compare_index ...
I think the problem lies in the line `element_list[compare_index], element_list[mindex] = element_list[mindex], element_list[compare_index]` Here I believe you want to exchange the position of the bigger and the smaller number in the array, but the problem is that you are exchanging the positions of the elements with...
68,992,767
I'm trying to implement selection sort in python using a list. But the implementation part is correct and is as per my algorithm but it is not resulting in correct output. Adding my code: ``` my_list = [64, 25, 12, 11, 32] def selection_sort(element_list): for element in range(len(element_list)): mindex =...
2021/08/31
[ "https://Stackoverflow.com/questions/68992767", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12116796/" ]
Your algorithm is almost correct but `element_list[compare_index], element_list[mindex] = element_list[mindex], element_list[compare_index]` in this line you made the mistake. It shouldn't be `compare_index`, it should be `element`. Please check the correct algorithm below ``` my_list = [64, 25, 12, 11, 32] def selec...
I think the problem lies in the line `element_list[compare_index], element_list[mindex] = element_list[mindex], element_list[compare_index]` Here I believe you want to exchange the position of the bigger and the smaller number in the array, but the problem is that you are exchanging the positions of the elements with...
68,992,767
I'm trying to implement selection sort in python using a list. But the implementation part is correct and is as per my algorithm but it is not resulting in correct output. Adding my code: ``` my_list = [64, 25, 12, 11, 32] def selection_sort(element_list): for element in range(len(element_list)): mindex =...
2021/08/31
[ "https://Stackoverflow.com/questions/68992767", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12116796/" ]
``` my_list = [64, 25, 12, 11, 32] def selection_sort(element_list): for element in range(len(element_list)): mindex = element for compare_index in range(element+1, len(element_list)): if element_list[mindex] > element_list[compare_index]: min...
I think the problem lies in the line `element_list[compare_index], element_list[mindex] = element_list[mindex], element_list[compare_index]` Here I believe you want to exchange the position of the bigger and the smaller number in the array, but the problem is that you are exchanging the positions of the elements with...
510,665
After learning mesh-current method for solving circuits, I started reading the wikipedia article on linearity to understand more on the "why?" [Reference.](https://www.khanacademy.org/science/electrical-engineering/ee-circuit-analysis-topic/ee-dc-circuit-analysis/a/ee-superposition) In this article, I sort of get why...
2020/07/16
[ "https://electronics.stackexchange.com/questions/510665", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/236654/" ]
Some with a sense of humor said "On a small enough scale, all behaviors are linear." In circuit design, we do not have exact polynomial descriptions for any component, so we go with "it is linear". And somewhat later, we learn about Taylor Series approximations to the Exponential Diode behaviors. And we learn about...
> > *What exactly is the intuition behind physical circuits being linear?* > > > One simple rule that I think of when judging if a circuit is linear is to consider if there might be harmonics produced when driving the circuit with a sine wave. If harmonics are produced with a sinusoidal input, then the circuit is ...
510,665
After learning mesh-current method for solving circuits, I started reading the wikipedia article on linearity to understand more on the "why?" [Reference.](https://www.khanacademy.org/science/electrical-engineering/ee-circuit-analysis-topic/ee-dc-circuit-analysis/a/ee-superposition) In this article, I sort of get why...
2020/07/16
[ "https://electronics.stackexchange.com/questions/510665", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/236654/" ]
> > *What exactly is the intuition behind physical circuits being linear?* > > > One simple rule that I think of when judging if a circuit is linear is to consider if there might be harmonics produced when driving the circuit with a sine wave. If harmonics are produced with a sinusoidal input, then the circuit is ...
For every electronic system, the output voltage or current is limited. So if the response gets very close to those limitations, the system is not linear. A system may be linear if the response is much smaller than those limits.
510,665
After learning mesh-current method for solving circuits, I started reading the wikipedia article on linearity to understand more on the "why?" [Reference.](https://www.khanacademy.org/science/electrical-engineering/ee-circuit-analysis-topic/ee-dc-circuit-analysis/a/ee-superposition) In this article, I sort of get why...
2020/07/16
[ "https://electronics.stackexchange.com/questions/510665", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/236654/" ]
Some with a sense of humor said "On a small enough scale, all behaviors are linear." In circuit design, we do not have exact polynomial descriptions for any component, so we go with "it is linear". And somewhat later, we learn about Taylor Series approximations to the Exponential Diode behaviors. And we learn about...
I'm not sure what the problem is. If you do the exact same thing you did for the resistor with the inductor and capacitor, you'll find that the inductor and capacitor are linear as well. $$ v=L\frac{di}{dt}$$ If \$ i=i\_1+i\_2\$, then \$ v=L\frac{d}{dt}(i\_1+i\_2)=L\frac{di\_1}{dt}+L\frac{di\_2}{dt}\$. If you multipl...
510,665
After learning mesh-current method for solving circuits, I started reading the wikipedia article on linearity to understand more on the "why?" [Reference.](https://www.khanacademy.org/science/electrical-engineering/ee-circuit-analysis-topic/ee-dc-circuit-analysis/a/ee-superposition) In this article, I sort of get why...
2020/07/16
[ "https://electronics.stackexchange.com/questions/510665", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/236654/" ]
I'm not sure what the problem is. If you do the exact same thing you did for the resistor with the inductor and capacitor, you'll find that the inductor and capacitor are linear as well. $$ v=L\frac{di}{dt}$$ If \$ i=i\_1+i\_2\$, then \$ v=L\frac{d}{dt}(i\_1+i\_2)=L\frac{di\_1}{dt}+L\frac{di\_2}{dt}\$. If you multipl...
For every electronic system, the output voltage or current is limited. So if the response gets very close to those limitations, the system is not linear. A system may be linear if the response is much smaller than those limits.
510,665
After learning mesh-current method for solving circuits, I started reading the wikipedia article on linearity to understand more on the "why?" [Reference.](https://www.khanacademy.org/science/electrical-engineering/ee-circuit-analysis-topic/ee-dc-circuit-analysis/a/ee-superposition) In this article, I sort of get why...
2020/07/16
[ "https://electronics.stackexchange.com/questions/510665", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/236654/" ]
Some with a sense of humor said "On a small enough scale, all behaviors are linear." In circuit design, we do not have exact polynomial descriptions for any component, so we go with "it is linear". And somewhat later, we learn about Taylor Series approximations to the Exponential Diode behaviors. And we learn about...
For every electronic system, the output voltage or current is limited. So if the response gets very close to those limitations, the system is not linear. A system may be linear if the response is much smaller than those limits.
125,169
``` function _mint(string memory _name, bool _isOnSale, uint _price) public{ MyNft storage nft = fetchNft[_name]; require(!nft.exists, "The Nft already Exists"); uint counter; nft.id += counter++; nft.name = _name; nft.isOnSale = _isOnSale; nft.owner = msg.sender; nft.price = _pr...
2022/04/01
[ "https://ethereum.stackexchange.com/questions/125169", "https://ethereum.stackexchange.com", "https://ethereum.stackexchange.com/users/90519/" ]
This is a value unique to each domain that is ‘mixed in’ the signature. It makes signatures from different domains incompatible because **is designed to include bits of DApp unique information such as the name of the DApp, the intended validator contract address, the expected DApp domain name, etc.** Source:<https://e...
> > It is possible that two DApps come up with an identical structure like > Transfer(address from,address to,uint256 amount) that should not be > compatible. By introducing a domain separator the dApp developers are > guaranteed that there can be no signature collision. > > > You can see a practical example of ho...
15,898,011
IF I set the deployment target for my app to iOS 6 and when submitting to app store, will users with iOS 4.3 (or ios5) be not able to download install the app itself?how can i deploy app that work on ios4.3 to ios6 .please help.
2013/04/09
[ "https://Stackoverflow.com/questions/15898011", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1764589/" ]
With your query, you are trying to insert a phone number in a column that doesn't exist in the table `ng_school`. `ng_school` only contains a REFERENCE to a phone number(`phone_id`) , but not the phone number itself. What you'll need to do is insert the phone number first in `ng_phone_number`, get the `PHONE_NUMBER_ID...
``` INSERT INTO ng_school (SCHOOL_ID, SCHOOL_SYSTEM_ID, NAME, ZIP, CITY, **PHONE**, LEAGUE_NAME, MINIMUM_GRADE_ID, MAXIMUM_GRADE_ID) VALUES ('testSchoolA','testSchoolSystem1','Elementary School A','90210','City of Los Angeles','213 555 1000','School A Athletic','K','GRADE6'); ``` Cause you don't have phone column in...
47,364,102
I have a simple model below: ``` class Ingredient(models.Model): name = models.CharField(max_length=30) ``` I am using django rest framework for api endpoints. ``` class IngredientListAPIView(ListAPIView): queryset = Ingredient.objects.all() serializer_class = IngredientListSerializer filter_backend...
2017/11/18
[ "https://Stackoverflow.com/questions/47364102", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2897115/" ]
I suggest having a specific class attribute for case insensitive fields ``` class IngredientListAPIView(ListAPIView): queryset = Ingredient.objects.all().order_by(Lower('name')) serializer_class = IngredientListSerializer filter_backends = [CaseInsensitiveOrderingFilter] ordering_fields = () # include ...
**views.py** ``` class IngredientListAPIView(ListAPIView): queryset = Ingredient.objects.all() serializer_class = IngredientListSerializer def filter_queryset(self, queryset): if "name" in self.request.query_params.get("ordering"): return CaseInsensitiveOrderingFilter().filter_queryset...
47,364,102
I have a simple model below: ``` class Ingredient(models.Model): name = models.CharField(max_length=30) ``` I am using django rest framework for api endpoints. ``` class IngredientListAPIView(ListAPIView): queryset = Ingredient.objects.all() serializer_class = IngredientListSerializer filter_backend...
2017/11/18
[ "https://Stackoverflow.com/questions/47364102", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2897115/" ]
I suggest having a specific class attribute for case insensitive fields ``` class IngredientListAPIView(ListAPIView): queryset = Ingredient.objects.all().order_by(Lower('name')) serializer_class = IngredientListSerializer filter_backends = [CaseInsensitiveOrderingFilter] ordering_fields = () # include ...
Here is fixed ordering class from answer by @Gabriel Muj ``` class MyOrderingFilter(filters.OrderingFilter): def filter_queryset(self, request, queryset, view): ordering = self.get_ordering(request, queryset, view) insensitive_ordering = getattr(view, 'ordering_case_insensitive_fields', ()) ...
50,934,897
When discussing the syntax of an enum, I want to know the names of the two halves that make up its syntax. ``` public enum Suits { Diamonds, Clubs, Hearts, Spades} ... Suits card = Suits.Clubs; ``` My guess is that the `Suits` to the left of the period would be called the enum type and the `Clubs` after the period...
2018/06/19
[ "https://Stackoverflow.com/questions/50934897", "https://Stackoverflow.com", "https://Stackoverflow.com/users/439320/" ]
[Microsoft wording](https://learn.microsoft.com/en-US/dotnet/csharp/language-reference/keywords/enum): > > The enum keyword is used to declare an enumeration, a distinct type that consists of a set of named constants called the enumerator list. > > > So `Suits` is the *type name*, `Diamonds, Clubs, Hearts, Spades...
According to the [Official documentation](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/enum) you could call: * Suits: The Enumeration or Enumerator list. * Clubs: An Enumerator. > > The enum keyword is used to declare an enumeration, a distinct type > that consists of a set of named c...
1,315,771
So right now I'm bashing my head - at the moment we use an element for a button to give it our own custom font, fine - this works, but as we're using Cufon on the rest of the site, we're wondering if it's possible to get Cufon working on a button. So far I've changed the button to an and using standard css styles on a...
2009/08/22
[ "https://Stackoverflow.com/questions/1315771", "https://Stackoverflow.com", "https://Stackoverflow.com/users/159131/" ]
Using the element in the following way: ``` <button type="buton">value</button> ``` worked when applying the Cufon style: ``` Cufon.replace('button', {color: '-linear-gradient(#999, 0.45=#666, 0.45=#555, #999)'}); ``` Thanks very much :)
The only solution I found to use Cufon on `<input type="submit"/>` buttons was to use Javascript (jQuery personally). 1. Copy the input button's text (the "value" attribute) to a span . 2. Replace the span using Cufon.replace() 3. Remove the input button's text 4. Position the span over the button 5. Propagate the cli...
1,315,771
So right now I'm bashing my head - at the moment we use an element for a button to give it our own custom font, fine - this works, but as we're using Cufon on the rest of the site, we're wondering if it's possible to get Cufon working on a button. So far I've changed the button to an and using standard css styles on a...
2009/08/22
[ "https://Stackoverflow.com/questions/1315771", "https://Stackoverflow.com", "https://Stackoverflow.com/users/159131/" ]
Using the element in the following way: ``` <button type="buton">value</button> ``` worked when applying the Cufon style: ``` Cufon.replace('button', {color: '-linear-gradient(#999, 0.45=#666, 0.45=#555, #999)'}); ``` Thanks very much :)
I believe there is no way to make Cufon work with `<input type="submit" />`. Main reason being that there is no place to insert the canvas... However you could simply switch to the more semantically fit `<button>`, that need closure `</button>` and thus creates the place for the canvas. Very important though, make su...
1,315,771
So right now I'm bashing my head - at the moment we use an element for a button to give it our own custom font, fine - this works, but as we're using Cufon on the rest of the site, we're wondering if it's possible to get Cufon working on a button. So far I've changed the button to an and using standard css styles on a...
2009/08/22
[ "https://Stackoverflow.com/questions/1315771", "https://Stackoverflow.com", "https://Stackoverflow.com/users/159131/" ]
Using the element in the following way: ``` <button type="buton">value</button> ``` worked when applying the Cufon style: ``` Cufon.replace('button', {color: '-linear-gradient(#999, 0.45=#666, 0.45=#555, #999)'}); ``` Thanks very much :)
``` $('.input-button').each(function(){ $(this).hide().after('<span class="input-button">').next('span.input-button').text($(this).val()).click(function(){ $(this).prev('input.input-button').click(); }); }); ``` I used the above code to copy my inputs value into a span, which allows me to use cufon. I...
1,315,771
So right now I'm bashing my head - at the moment we use an element for a button to give it our own custom font, fine - this works, but as we're using Cufon on the rest of the site, we're wondering if it's possible to get Cufon working on a button. So far I've changed the button to an and using standard css styles on a...
2009/08/22
[ "https://Stackoverflow.com/questions/1315771", "https://Stackoverflow.com", "https://Stackoverflow.com/users/159131/" ]
I believe there is no way to make Cufon work with `<input type="submit" />`. Main reason being that there is no place to insert the canvas... However you could simply switch to the more semantically fit `<button>`, that need closure `</button>` and thus creates the place for the canvas. Very important though, make su...
The only solution I found to use Cufon on `<input type="submit"/>` buttons was to use Javascript (jQuery personally). 1. Copy the input button's text (the "value" attribute) to a span . 2. Replace the span using Cufon.replace() 3. Remove the input button's text 4. Position the span over the button 5. Propagate the cli...
1,315,771
So right now I'm bashing my head - at the moment we use an element for a button to give it our own custom font, fine - this works, but as we're using Cufon on the rest of the site, we're wondering if it's possible to get Cufon working on a button. So far I've changed the button to an and using standard css styles on a...
2009/08/22
[ "https://Stackoverflow.com/questions/1315771", "https://Stackoverflow.com", "https://Stackoverflow.com/users/159131/" ]
``` $('.input-button').each(function(){ $(this).hide().after('<span class="input-button">').next('span.input-button').text($(this).val()).click(function(){ $(this).prev('input.input-button').click(); }); }); ``` I used the above code to copy my inputs value into a span, which allows me to use cufon. I...
The only solution I found to use Cufon on `<input type="submit"/>` buttons was to use Javascript (jQuery personally). 1. Copy the input button's text (the "value" attribute) to a span . 2. Replace the span using Cufon.replace() 3. Remove the input button's text 4. Position the span over the button 5. Propagate the cli...
1,315,771
So right now I'm bashing my head - at the moment we use an element for a button to give it our own custom font, fine - this works, but as we're using Cufon on the rest of the site, we're wondering if it's possible to get Cufon working on a button. So far I've changed the button to an and using standard css styles on a...
2009/08/22
[ "https://Stackoverflow.com/questions/1315771", "https://Stackoverflow.com", "https://Stackoverflow.com/users/159131/" ]
``` $('.input-button').each(function(){ $(this).hide().after('<span class="input-button">').next('span.input-button').text($(this).val()).click(function(){ $(this).prev('input.input-button').click(); }); }); ``` I used the above code to copy my inputs value into a span, which allows me to use cufon. I...
I believe there is no way to make Cufon work with `<input type="submit" />`. Main reason being that there is no place to insert the canvas... However you could simply switch to the more semantically fit `<button>`, that need closure `</button>` and thus creates the place for the canvas. Very important though, make su...
70,641,367
I want to fetch array from the product file but it is showing `'Uncaught TypeError: _product__WEBPACK_IMPORTED_MODULE_1___default(...).map is not a function'` I have even tried using key in Col but still it is showing the same. My react code is ``` import product from '../product' export default function HomeScreen()...
2022/01/09
[ "https://Stackoverflow.com/questions/70641367", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16777689/" ]
For Japanese you should use the wider ideographic space (U+3000) instead normal space. That is, `?right_pad(12, '\x3000')`. If you need a similarly wide dash, that's U+30FC, so like `?right_pad(12, '\x30FC')`. All these can of course be typed directly as well, like `?right_pad(12, 'ー')`, but in that case be careful w...
It is not ending at the same place because the length of a Japanese character is different from the length of the `-`. The solution would be to use a Japanese character with the same width as a kanji, and the same meaning as the dash. I don't know if such a character exists (maybe U+30FB: `・` )
26,842,477
I am using below command to join two files using first two columns. ``` awk 'NR==FNR{a[$1,$2]=substr($0,3);next} ($1,$2) in a{print $0, a[$1,$2] > "br0102_3.txt"}' br01.txt br02.txt ``` Now, by default AWk command uses whitespaces as the separators. But my file may contain single space between two words, e.g. Fil...
2014/11/10
[ "https://Stackoverflow.com/questions/26842477", "https://Stackoverflow.com", "https://Stackoverflow.com/users/960778/" ]
awk supports a regular expression as the value of `FS` so you can specify a regular expression that matches at least two spaces. Something like `-F '[[:space:]][[:space:]]+'`. ``` $ awk '{print NF}' File2 4 3 4 $ awk -F '[[:space:]][[:space:]]+' '{print NF}' File2 3 3 3 ```
You are using fixed width fields so you should be using gnu awk FIELDWIDTHS (or similar) to separate the fields, e.g. if the 2nd field is the 15 chars from char 8 to char 23 inclusive in this file: ``` $ cat file abc def ghi klm AAAAAAAB C D E F G H IJJJJ abc def ghi klm $ awk -v FIELDWIDTHS="7 15...
26,842,477
I am using below command to join two files using first two columns. ``` awk 'NR==FNR{a[$1,$2]=substr($0,3);next} ($1,$2) in a{print $0, a[$1,$2] > "br0102_3.txt"}' br01.txt br02.txt ``` Now, by default AWk command uses whitespaces as the separators. But my file may contain single space between two words, e.g. Fil...
2014/11/10
[ "https://Stackoverflow.com/questions/26842477", "https://Stackoverflow.com", "https://Stackoverflow.com/users/960778/" ]
awk supports a regular expression as the value of `FS` so you can specify a regular expression that matches at least two spaces. Something like `-F '[[:space:]][[:space:]]+'`. ``` $ awk '{print NF}' File2 4 3 4 $ awk -F '[[:space:]][[:space:]]+' '{print NF}' File2 3 3 3 ```
awk automatically detects multiple spaces if `field seperator` is set to " " Thus, this simply works: ``` awk -F' ' '{ print $2 }' ``` to get the second column if you have a table like the one mentioned.
26,842,477
I am using below command to join two files using first two columns. ``` awk 'NR==FNR{a[$1,$2]=substr($0,3);next} ($1,$2) in a{print $0, a[$1,$2] > "br0102_3.txt"}' br01.txt br02.txt ``` Now, by default AWk command uses whitespaces as the separators. But my file may contain single space between two words, e.g. Fil...
2014/11/10
[ "https://Stackoverflow.com/questions/26842477", "https://Stackoverflow.com", "https://Stackoverflow.com/users/960778/" ]
You are using fixed width fields so you should be using gnu awk FIELDWIDTHS (or similar) to separate the fields, e.g. if the 2nd field is the 15 chars from char 8 to char 23 inclusive in this file: ``` $ cat file abc def ghi klm AAAAAAAB C D E F G H IJJJJ abc def ghi klm $ awk -v FIELDWIDTHS="7 15...
awk automatically detects multiple spaces if `field seperator` is set to " " Thus, this simply works: ``` awk -F' ' '{ print $2 }' ``` to get the second column if you have a table like the one mentioned.
15,616,415
Recently, we are facing a strange problem where some XHR requests, sent from Passenger to our application server, fail to execute properly. Please have look at following chain of events: 1. LB Passenger sends a request to the application server. 2. Rails returns a NoMethodError exception when trying to figure out whi...
2013/03/25
[ "https://Stackoverflow.com/questions/15616415", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1903272/" ]
Found out a workaround. (*note target browser*) Mesh(grid/skeleton) of table is not shown when popupPanel is hidden only when table has style attribute: ``` style="border-collapse:separate" ```
Thanks for your workaround! However, the table afterwards has some gaps between the table cells. In order to get the same appearance of the table back, you may also want to use a simple jQuery function to remove the style when the popup is first shown: ``` <a4j:commandButton id="showPopupButton" value="Show Details"...
18,411,554
I’m fairly new to TypeScript and trying to setup some unit tests for my TypeScript code base. The problem is that my code depends on other's work and all these references are done in the form of hard coded relative paths like “......\somefile.d.ts”. When come to unit test, I want to fake out some of the dependencies bu...
2013/08/23
[ "https://Stackoverflow.com/questions/18411554", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1471031/" ]
Check out grunt-ts reference file generation : <https://github.com/basarat/grunt-ts#reference-file-generation> What you can do is that have seperate targets, one for dev and one for test : ``` dev: { src: ["app/**/*.ts", "!app/**/*.spec.ts"], // Exclude your spec files ...
Instead of loading different files have you considered using a test or spy framework to swap out the implementation for a test implementation? In our TypeScript projects we used jasmine spies (<https://github.com/pivotal/jasmine/wiki/Spies>, <http://tobyho.com/2011/12/15/jasmine-spy-cheatsheet/>) to fake out dependen...
48,147,422
Pointer arithmetics between consecutive members of same type in a struct used to be a common practice while pointer arithmetics is only valid inside an array. In C++ it would be explicitely Undefined Behaviour because an array can only be created by a declaration or a new expression. But C language defines an array as ...
2018/01/08
[ "https://Stackoverflow.com/questions/48147422", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3545273/" ]
The problem here is your definition of *contiguously allocated*: "we can make sure that that the members are consecutive (meaning no padding between them)". Although that is a corollary of being contiguously allocated, it does not define the property. Your structure members are separate variables with automatic stora...
To start with - Quoting `C11`, chapter [§6.5.2.1p2](http://port70.net/~nsz/c/c11/n1570.html#6.5.2.1p2) > > A postfix expression followed by an expression in square brackets `[]` is a subscripted designation of an element of an array object. The definition of the subscript operator `[]` is that `E1[E2]` is identical...
48,147,422
Pointer arithmetics between consecutive members of same type in a struct used to be a common practice while pointer arithmetics is only valid inside an array. In C++ it would be explicitely Undefined Behaviour because an array can only be created by a declaration or a new expression. But C language defines an array as ...
2018/01/08
[ "https://Stackoverflow.com/questions/48147422", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3545273/" ]
The problem here is your definition of *contiguously allocated*: "we can make sure that that the members are consecutive (meaning no padding between them)". Although that is a corollary of being contiguously allocated, it does not define the property. Your structure members are separate variables with automatic stora...
It would be UB. As established in [that other question](https://stackoverflow.com/q/48148477/3545273), the static\_assert can test for possible padding in a conformant way. So yes the 4 members of the struct are indeed consecutively allocated. But the real problem is that consecutive allocation is necessary but not en...
48,147,422
Pointer arithmetics between consecutive members of same type in a struct used to be a common practice while pointer arithmetics is only valid inside an array. In C++ it would be explicitely Undefined Behaviour because an array can only be created by a declaration or a new expression. But C language defines an array as ...
2018/01/08
[ "https://Stackoverflow.com/questions/48147422", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3545273/" ]
I'm gonna argue UB. First and foremost, the mandatory quote from **6.5.6 Additive operators**: > > When an expression that has integer type is added to or subtracted > from a pointer, the result has the type of the pointer operand. If the > pointer operand points to an element of an **array object**, and the array ...
To start with - Quoting `C11`, chapter [§6.5.2.1p2](http://port70.net/~nsz/c/c11/n1570.html#6.5.2.1p2) > > A postfix expression followed by an expression in square brackets `[]` is a subscripted designation of an element of an array object. The definition of the subscript operator `[]` is that `E1[E2]` is identical...
48,147,422
Pointer arithmetics between consecutive members of same type in a struct used to be a common practice while pointer arithmetics is only valid inside an array. In C++ it would be explicitely Undefined Behaviour because an array can only be created by a declaration or a new expression. But C language defines an array as ...
2018/01/08
[ "https://Stackoverflow.com/questions/48147422", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3545273/" ]
I'm gonna argue UB. First and foremost, the mandatory quote from **6.5.6 Additive operators**: > > When an expression that has integer type is added to or subtracted > from a pointer, the result has the type of the pointer operand. If the > pointer operand points to an element of an **array object**, and the array ...
It would be UB. As established in [that other question](https://stackoverflow.com/q/48148477/3545273), the static\_assert can test for possible padding in a conformant way. So yes the 4 members of the struct are indeed consecutively allocated. But the real problem is that consecutive allocation is necessary but not en...
48,147,422
Pointer arithmetics between consecutive members of same type in a struct used to be a common practice while pointer arithmetics is only valid inside an array. In C++ it would be explicitely Undefined Behaviour because an array can only be created by a declaration or a new expression. But C language defines an array as ...
2018/01/08
[ "https://Stackoverflow.com/questions/48147422", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3545273/" ]
No, it isn't legal to alias a `struct` and array like this, it violates strict aliasing. The work-around is to wrap the struct in a union, which contains both an array and the individual members: ``` union something { struct quad { int x; int y; int z; int t; }; int array [4]; }; ``` This dodg...
To start with - Quoting `C11`, chapter [§6.5.2.1p2](http://port70.net/~nsz/c/c11/n1570.html#6.5.2.1p2) > > A postfix expression followed by an expression in square brackets `[]` is a subscripted designation of an element of an array object. The definition of the subscript operator `[]` is that `E1[E2]` is identical...
48,147,422
Pointer arithmetics between consecutive members of same type in a struct used to be a common practice while pointer arithmetics is only valid inside an array. In C++ it would be explicitely Undefined Behaviour because an array can only be created by a declaration or a new expression. But C language defines an array as ...
2018/01/08
[ "https://Stackoverflow.com/questions/48147422", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3545273/" ]
No, it isn't legal to alias a `struct` and array like this, it violates strict aliasing. The work-around is to wrap the struct in a union, which contains both an array and the individual members: ``` union something { struct quad { int x; int y; int z; int t; }; int array [4]; }; ``` This dodg...
It would be UB. As established in [that other question](https://stackoverflow.com/q/48148477/3545273), the static\_assert can test for possible padding in a conformant way. So yes the 4 members of the struct are indeed consecutively allocated. But the real problem is that consecutive allocation is necessary but not en...
27,648,391
**HTML** ``` <body> <div class="wordsmith"> <p>WORDSMITH: dummy text here.</p> </div> <div class="menu"> <ul> <li><a id="wordsmith">The Wordsmith</a></li> <li><a id="tracksmith">The Tracksmith</a></li> <li><a id="nerdsmith">The Nerdsmith</a></li> <li><a id="family">The Family ...
2014/12/25
[ "https://Stackoverflow.com/questions/27648391", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2525633/" ]
AFAIK the are no predecessor or ancestor combinators/selectors so this is not possible in CSS. [`~`](http://www.w3.org/TR/css3-selectors/#general-sibling-combinators) is the general sibling combinator and `#wordsmith` and `.wordsmith` are not siblings, `.wordsmith` is a predecessor of an ancestor of `#wordsmith`. If...
demo - <http://jsfiddle.net/n5fzB/229/> with jQuery you can do this ```js $("#f").hover( function() { $('.ab').css('display', 'block'); $('.a').css('display', 'none'); }, function() { $('.ab').css('display', 'none'); $('.a').css('display', 'block'); } ); $("#s").hover( function() ...
27,648,391
**HTML** ``` <body> <div class="wordsmith"> <p>WORDSMITH: dummy text here.</p> </div> <div class="menu"> <ul> <li><a id="wordsmith">The Wordsmith</a></li> <li><a id="tracksmith">The Tracksmith</a></li> <li><a id="nerdsmith">The Nerdsmith</a></li> <li><a id="family">The Family ...
2014/12/25
[ "https://Stackoverflow.com/questions/27648391", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2525633/" ]
AFAIK the are no predecessor or ancestor combinators/selectors so this is not possible in CSS. [`~`](http://www.w3.org/TR/css3-selectors/#general-sibling-combinators) is the general sibling combinator and `#wordsmith` and `.wordsmith` are not siblings, `.wordsmith` is a predecessor of an ancestor of `#wordsmith`. If...
Musa is right, you can't target `#wordsmith` and do something with another element that isn't a sibling or child. But you can do something else. (disclaimer: I don't love using `absolute` positioning and I treat it as a last result) But if this *has* to be done with CSS only...you could put the text inside the `li` and...
1,504,459
I need to find the screen resolution of a users screen who visits my website?
2009/10/01
[ "https://Stackoverflow.com/questions/1504459", "https://Stackoverflow.com", "https://Stackoverflow.com/users/131637/" ]
Use JavaScript (`screen.width` and `screen.height` IIRC, but I may be wrong, haven't done JS in a while). PHP cannot do it.
The quick answer is no, then you are probably asking why can't I do that with php. OK here is a longer answer. PHP is a serverside scripting language and therefor has nothing to do with the type of a specific client. Then you might ask "why can I then get the browser agent from php?", thats because that information is ...
1,504,459
I need to find the screen resolution of a users screen who visits my website?
2009/10/01
[ "https://Stackoverflow.com/questions/1504459", "https://Stackoverflow.com", "https://Stackoverflow.com/users/131637/" ]
I don't think you can detect the screen size purely with PHP but you can detect the user-agent.. ``` <?php if ( stristr($ua, "Mobile" )) { $DEVICE_TYPE="MOBILE"; } if (isset($DEVICE_TYPE) and $DEVICE_TYPE=="MOBILE") { echo '<link rel="stylesheet" href="/css/mobile.css" />' } ?> ``` H...
The quick answer is no, then you are probably asking why can't I do that with php. OK here is a longer answer. PHP is a serverside scripting language and therefor has nothing to do with the type of a specific client. Then you might ask "why can I then get the browser agent from php?", thats because that information is ...
1,504,459
I need to find the screen resolution of a users screen who visits my website?
2009/10/01
[ "https://Stackoverflow.com/questions/1504459", "https://Stackoverflow.com", "https://Stackoverflow.com/users/131637/" ]
I found using CSS inside my html inside my php did the trick for me. ``` <?php echo '<h2 media="screen and (max-width: 480px)">'; echo 'My headline'; echo '</h2>'; echo '<h1 media="screen and (min-width: 481px)">'; echo 'My headline'; echo '</h1>'; ?> ``` This will outp...
PHP works only on server side, not on user host. Use JavaScript or jQuery to get this info and send via AJAX or URL (?x=1024&y=640).
1,504,459
I need to find the screen resolution of a users screen who visits my website?
2009/10/01
[ "https://Stackoverflow.com/questions/1504459", "https://Stackoverflow.com", "https://Stackoverflow.com/users/131637/" ]
Directly with PHP is not possible but... I write this simple code to save screen resolution on a PHP session to use on an image gallery. ``` <?php session_start(); if(isset($_SESSION['screen_width']) AND isset($_SESSION['screen_height'])){ echo 'User resolution: ' . $_SESSION['screen_width'] . 'x' . $_SESSION['sc...
I don't think you can detect the screen size purely with PHP but you can detect the user-agent.. ``` <?php if ( stristr($ua, "Mobile" )) { $DEVICE_TYPE="MOBILE"; } if (isset($DEVICE_TYPE) and $DEVICE_TYPE=="MOBILE") { echo '<link rel="stylesheet" href="/css/mobile.css" />' } ?> ``` H...
1,504,459
I need to find the screen resolution of a users screen who visits my website?
2009/10/01
[ "https://Stackoverflow.com/questions/1504459", "https://Stackoverflow.com", "https://Stackoverflow.com/users/131637/" ]
I found using CSS inside my html inside my php did the trick for me. ``` <?php echo '<h2 media="screen and (max-width: 480px)">'; echo 'My headline'; echo '</h2>'; echo '<h1 media="screen and (min-width: 481px)">'; echo 'My headline'; echo '</h1>'; ?> ``` This will outp...
In PHP there is no standard way to get this information. However, it is possible if you are using a 3rd party solution. 51Degrees device detector for PHP has the properties you need: * [$\_51d['ScreenPixelsHeight']](https://51degrees.com/Resources/Property-Dictionary#ScreenPixelsHeight) * [$\_51d['ScreenPixelsWidth']]...
1,504,459
I need to find the screen resolution of a users screen who visits my website?
2009/10/01
[ "https://Stackoverflow.com/questions/1504459", "https://Stackoverflow.com", "https://Stackoverflow.com/users/131637/" ]
This is a very simple process. Yes, you cannot get the width and height in PHP. It is true that JQuery can provide the screen's width and height. First go to <https://github.com/carhartl/jquery-cookie> and get jquery.cookie.js. Here is example using php to get the screen width and height: ``` <!DOCTYPE html> <...
For get the width screen or the height screen 1- Create a PHP file (getwidthscreen.php) and write the following commands in it **PHP (getwidthscreen.php)** ```php <div id="widthscreenid"></div> <script> document.getElementById("widthscreenid").innerHTML=screen.width; </script> ``` 2- Get the width screen thro...
1,504,459
I need to find the screen resolution of a users screen who visits my website?
2009/10/01
[ "https://Stackoverflow.com/questions/1504459", "https://Stackoverflow.com", "https://Stackoverflow.com/users/131637/" ]
PHP is a server side language - it's executed on the server only, and the resultant program output is sent to the client. As such, there's no "client screen" information available. That said, you can have the client tell you what their screen resolution is via JavaScript. Write a small scriptlet to send you screen.wid...
Here is the Javascript Code: (index.php) ``` <script> var xhttp = new XMLHttpRequest(); xhttp.open("POST", "/sqldb.php", true); xhttp.send("screensize=",screen.width,screen.height); </script> ``` Here is the PHP Code: (sqldb.php) ``` $data = $_POST['screensize']; $pdo = new PDO('mysql:host=localhost;d...
1,504,459
I need to find the screen resolution of a users screen who visits my website?
2009/10/01
[ "https://Stackoverflow.com/questions/1504459", "https://Stackoverflow.com", "https://Stackoverflow.com/users/131637/" ]
I don't think you can detect the screen size purely with PHP but you can detect the user-agent.. ``` <?php if ( stristr($ua, "Mobile" )) { $DEVICE_TYPE="MOBILE"; } if (isset($DEVICE_TYPE) and $DEVICE_TYPE=="MOBILE") { echo '<link rel="stylesheet" href="/css/mobile.css" />' } ?> ``` H...
``` <script type="text/javascript"> if(screen.width <= 699){ <?php $screen = 'mobile';?> }else{ <?php $screen = 'default';?> } </script> <?php echo $screen; ?> ```
1,504,459
I need to find the screen resolution of a users screen who visits my website?
2009/10/01
[ "https://Stackoverflow.com/questions/1504459", "https://Stackoverflow.com", "https://Stackoverflow.com/users/131637/" ]
You can check it like below: ``` if(strstr(strtolower($_SERVER['HTTP_USER_AGENT']), 'mobile') || strstr(strtolower($_SERVER['HTTP_USER_AGENT']), 'android')) { echo "mobile web browser!"; } else { echo "web browser!"; } ```
PHP works only on server side, not on user host. Use JavaScript or jQuery to get this info and send via AJAX or URL (?x=1024&y=640).
1,504,459
I need to find the screen resolution of a users screen who visits my website?
2009/10/01
[ "https://Stackoverflow.com/questions/1504459", "https://Stackoverflow.com", "https://Stackoverflow.com/users/131637/" ]
This is a very simple process. Yes, you cannot get the width and height in PHP. It is true that JQuery can provide the screen's width and height. First go to <https://github.com/carhartl/jquery-cookie> and get jquery.cookie.js. Here is example using php to get the screen width and height: ``` <!DOCTYPE html> <...
You can try RESS (RESponsive design + Server side components), see this tutorial: <http://www.lukew.com/ff/entry.asp?1392>
58,607
As you can see in the picture, I'm selecting the "Ads" object, it is at the top of the screen, but the position is (0,-82). If I change by manual, mean I change -82 to 0, the "Ads"object will move down by 82 pixel, which is wrong. How I can set my position number to normal ( which is 0,0)? Thank you fro your help [!...
2015/08/25
[ "https://graphicdesign.stackexchange.com/questions/58607", "https://graphicdesign.stackexchange.com", "https://graphicdesign.stackexchange.com/users/48878/" ]
What you're seeing is actually correct. In software like Sketch, Photoshop, and Illustrator (0,0) is considered to be the top left corner of your canvas or artboard, and anything positioned above or to the left of that goes into negative values. If you turn on your rulers (View > Canvas > Show Rulers) it might make m...
It seems that it is a bug in Sketch, try to reload it. Positions of shapes inside artboards are calculated from top left corner of the artboard not canvas. Also, there is a good practice to start your design workflow from positioning your first artboard at (0, 0).
58,607
As you can see in the picture, I'm selecting the "Ads" object, it is at the top of the screen, but the position is (0,-82). If I change by manual, mean I change -82 to 0, the "Ads"object will move down by 82 pixel, which is wrong. How I can set my position number to normal ( which is 0,0)? Thank you fro your help [!...
2015/08/25
[ "https://graphicdesign.stackexchange.com/questions/58607", "https://graphicdesign.stackexchange.com", "https://graphicdesign.stackexchange.com/users/48878/" ]
What you're seeing is actually correct. In software like Sketch, Photoshop, and Illustrator (0,0) is considered to be the top left corner of your canvas or artboard, and anything positioned above or to the left of that goes into negative values. If you turn on your rulers (View > Canvas > Show Rulers) it might make m...
I think what's causing this is that you've accidentally changed the ruler's point of origin. (I find that this happens quite easily when adding smart guides.) To solve this, turn on your rulers, as suggested above, (View > Canvas > Show Rulers) and double-click the empty square in the top left corner of the canvas. (Se...
58,607
As you can see in the picture, I'm selecting the "Ads" object, it is at the top of the screen, but the position is (0,-82). If I change by manual, mean I change -82 to 0, the "Ads"object will move down by 82 pixel, which is wrong. How I can set my position number to normal ( which is 0,0)? Thank you fro your help [!...
2015/08/25
[ "https://graphicdesign.stackexchange.com/questions/58607", "https://graphicdesign.stackexchange.com", "https://graphicdesign.stackexchange.com/users/48878/" ]
I think what's causing this is that you've accidentally changed the ruler's point of origin. (I find that this happens quite easily when adding smart guides.) To solve this, turn on your rulers, as suggested above, (View > Canvas > Show Rulers) and double-click the empty square in the top left corner of the canvas. (Se...
It seems that it is a bug in Sketch, try to reload it. Positions of shapes inside artboards are calculated from top left corner of the artboard not canvas. Also, there is a good practice to start your design workflow from positioning your first artboard at (0, 0).
35,893,550
im trying to get a function to find the max item in a sequence using recursion but I keep getting an error,like when i try Max(range(100)): ``` TypeError: unorderable types: int() > list() ``` Im a programming newbie btw so any help is much appreciated. ``` def Max(s) if len(s) == 1: return s[0] e...
2016/03/09
[ "https://Stackoverflow.com/questions/35893550", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3975231/" ]
You seem to forget to put the index: ``` def Max(s): if len(s) == 1: return s[0] else: m = Max(s[1:]) if m > s[0]: #put index 0 here return m else: return s[0] ``` `m` is a single number, therefore it cannot be compared with `s` which is a `list`. Thus ...
This variant will reduce the stack size by slicing the problem in half at each level of the recursion, and recursively solving for both halves. This allows you to evaluate lists with thousands of elements, where the approach of reducing the problem size by one would cause stack overflows. ``` def Max(lst): l = len...
71,044,718
I am new to Blazor and trying to show File Saveas Dialog as shown in following link on a button click. [Save as Image](https://i.stack.imgur.com/OWOJo.png) The requirement is - **upon clicking the Saveas button above Saveas dialog should be popped up where user can choose the destination of file and file name**. I ha...
2022/02/09
[ "https://Stackoverflow.com/questions/71044718", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15831663/" ]
Yes, it's called `flexible array member`. It's usually used with dynamically allocated objects. However, you cannot return `Minefield` by value. The compiler will copy only `sizeof(Minefield)` data what is the size of object if length of array `Minefield::field` was `0`. You can do: ``` Minefield* NewGame(int columns...
Unfortunately, C doesn't have any built-in dynamic array like python. However, if you want to use some dynamic array either you can implement your self or you can see the answer to that link [C dynamically growing array](https://stackoverflow.com/questions/3536153/c-dynamically-growing-array) which explains that you ne...