qid
int64
1
74.7M
question
stringlengths
15
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
4
30.2k
response_k
stringlengths
11
36.5k
60,040,025
I am using App ID as an Identity Provider and Authorization Server to protect some back-end spring-boot applications. I have managed to set up the whole OAuth 2.0 Authorization Code flow to work but cannot manage to include custom scopes into the access token. The only scopes that appear in the access token are the App...
2020/02/03
[ "https://Stackoverflow.com/questions/60040025", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12831835/" ]
In order to see the application configured scopes in the token, you need to authenticate with the application that you configured scopes to and with the user you assigned the role to. Meaning you should use `username : client ID` and `password : secret` of the application in the request authorization header, and authe...
I have an App ID instance in us-south, and scopes are working fine for me with default Cloud Directory. 1. create a new application (define your scopes) 2. create a role and associate your application scope 3. assign the role to a user 4. call `/token` endpoint
60,040,025
I am using App ID as an Identity Provider and Authorization Server to protect some back-end spring-boot applications. I have managed to set up the whole OAuth 2.0 Authorization Code flow to work but cannot manage to include custom scopes into the access token. The only scopes that appear in the access token are the App...
2020/02/03
[ "https://Stackoverflow.com/questions/60040025", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12831835/" ]
In order to see the application configured scopes in the token, you need to authenticate with the application that you configured scopes to and with the user you assigned the role to. Meaning you should use `username : client ID` and `password : secret` of the application in the request authorization header, and authe...
It happened to me before, I found that one way to solve it would be to inject the roles into the token claim and then instruct Spring Security to extract them. [I wrote about it here in detail](https://blog.pingfrommorocco.com/2021/11/using-ibm-app-id-roles-with-spring.html). [The documentation](https://cloud.ibm.com/d...
48,700,688
I am beginner in CI. I am getting an error in insert\_batch function in CodeIgniter. When I insert array into insert\_batch I get this error **Unknown column 'Array' in 'field list'** and **Array to string conversion** I've done many solutions but still get this error, Can anyone give me an idea? thanks in advance...
2018/02/09
[ "https://Stackoverflow.com/questions/48700688", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6386369/" ]
Your directive should listen `keyup` of the input element to achieve what you need: ``` Vue.directive('numericOnly', { bind(el) { el.addEventListener('keyup', () => { let regex = /^[0-9]*$/ if (!regex.test(el.value)) { el.value = el.value.slice(0, -1) } }) } }) ```
``` import Vue from 'vue' Vue.directive('numericOnly', { bind(el, binding, vnode) { el.addEventListener('keydown', (e) => { if ([46, 8, 9, 27, 13, 110, 190].indexOf(e.keyCode) !== -1 || // Allow: Ctrl+A (e.keyCode === 65 && e.ctrlKey === true) || // Allow: Ctrl+C ...
231,963
I wrote a Keylogger in Python who transfers the Key Strokes to an S3 storage. What do you think about the Code? I would add the file saving in an other place and make it more legible. Feel free to copy the code and use it for your own. To run and compile it you need: * Python 3.7.5 * boto3 * pynput * pyinstaller Gre...
2019/11/06
[ "https://codereview.stackexchange.com/questions/231963", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/212770/" ]
Honestly, I didn't run it, but there's some things I can point out. In `upload_to_aws`, you have ``` try: s3.upload_file(local_file, bucket, s3_file) return True except FileNotFoundError: return False except NoCredentialsError: return False ``` `except`s can actually [be combined though](https://sta...
Can't help but take the low hanging fruit: `awsname` should be `aws_name` or `awsName`. Words are always separated somehow. `awsuploading` should be renamed to `aws_uploading` to match your other method names. I can't review more than that as I don't know Python. The title of this post is what caught my attention.
653,864
I am new to Linux and Ubuntu. I would like to install Ubuntu on a computer that runs Windows XP. My question is to know whether dual boot is better than VMware. Also I just found out that there is VMware and VMBoot? Can anybody explain the difference to me and which one is better? Thank you, Simon
2015/07/28
[ "https://askubuntu.com/questions/653864", "https://askubuntu.com", "https://askubuntu.com/users/434206/" ]
A VM is easer to play around with and can be quicker to set up because you do not need to find all divers and if you make any mistakes, and everyone does, it is a lot easer to clean-up after. There are benefits to Dual Booting however, with the big one, for me at least, is that you have access to all the RAM of your co...
The problem to answer is that who knows the criterion of "being better"? If you install Ubuntu in as a virtual machine, it will not use all capabilities of your computer and will work sufficiently slower. But the installation may be easier and you wont't need to worry about drivers in some cases. I vote to close as ...
50,928,631
The task is to retrieve data from the database for certain list of columns and return as custom already existing class. I tried to resolve this task with following code: ``` public List<EntityOne> getServiceProviders(EntityTwo EntityTwo) { Criteria criteria = createCriteria(EntityOne.class); criteria....
2018/06/19
[ "https://Stackoverflow.com/questions/50928631", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2701230/" ]
Your question is not very clear especially where you are attempting to use `Restrictions.eq("EntityTwo", EntityTwo)` as this will not give proper results. Hibernate however provides a means to return `EntityOne` as an Object from the Columns selected using Hibernate `Transformers` class. In your case, you will need to ...
You should use `Projections.groupProperty(propertyName);` ``` criteria.setProjection(Projections.groupProperty("propertyName")); ```
9,572,167
What event to listen when a accordion panel is clicked and becomes visible? Any code example will be great help. Thanks!
2012/03/05
[ "https://Stackoverflow.com/questions/9572167", "https://Stackoverflow.com", "https://Stackoverflow.com/users/506303/" ]
expand; see: <http://docs.sencha.com/ext-js/4-0/#!/api/Ext.panel.Panel-event-expand> Here is a working code snippet of mine you could substitute for the items in the example code above, that is working for me: ``` items: [{ title: 'Watch Folder', html: 'Watch Folder' },{ title: 'Saved Search', html: ...
In ExtJS, Accordion is a layout which we will be using on Panel. Here is a sample example from sencha docs.(As you didn't mention version of ExtJS, I am assuming v4.0) : ``` Ext.create('Ext.panel.Panel', { title: 'Accordion Layout', width: 300, height: 300, layout:'accordion', defaults: { // applied to each contai...
68,684,383
I want to delete a folder inside the Windows drive **'C'** but i get **PermissionError** I used the 'os' module as usual but I do not know exactly how to solve the **access** problem **Code:** ```py import os os.remove("C:\\Users\name\AppData\Local\Temp") ``` **Error:** ``` line 2, in <module> os.remove("C:\\...
2021/08/06
[ "https://Stackoverflow.com/questions/68684383", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15189401/" ]
You need to pass emit, along props to setup: ``` setup(props, { emit }) { function emitDate(){ emit('chosenDate', datepickerValue.value) } ```
The 1st parameter to `setup` is `props`. `context` comes after `setup`, see [setup arguments](https://v3.vuejs.org/guide/composition-api-setup.html#arguments): ``` setup(props, context){ .... function emitDate(){ context.emit('chosenDate', datepickerValue.value) } } ``` Or: ``` setup(props, { emit }){ .... fu...
2,269,066
Let $\mathcal{R}$ be an equivalent relation over $X$ such that $\forall x\in X$, its class $[x]$ is included in some connected component of $X$. Show that the connected components of $X/\mathcal{R}$ are the images of the connected components of $X$ via the quotient map. So far, denoting $\pi : X\to X/\mathcal{R}$ the...
2017/05/06
[ "https://math.stackexchange.com/questions/2269066", "https://math.stackexchange.com", "https://math.stackexchange.com/users/434862/" ]
If $q:X\to Y$ is a quotient map with the property that the fiber of each $y\in Y$ is contained in some component of $X$. Then, it maps each component of $X$ to a component of $Y$. Indeed, if $C$ is a component of $X$, then $q(C)$ is contained in a component $D$ of $Y$. Moreover, $q^{-1}(D)$ is connected. Seeking contra...
It is easier to think about connectedness in terms of the relative topology. You can restrict the domain $X$ to $\pi^{-1}(C\_{[x]})$ and assume that the quotient is connected (equal to $C\_{[x]}$). Let us show that the domain is also connected. Take a nonempty clopen set $F \subset X$. Since clopen sets are unions of ...
22,152,216
Hello so here is the problem i have a login/register system and when the user creates his account a new folder gets created with same name as he puts username so if the username is test123 a folder test123 gets created. Now the problem is i dont know how to move files that user uploads with the upload system to his dir...
2014/03/03
[ "https://Stackoverflow.com/questions/22152216", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3375194/" ]
For **OpenCart version 2.3** a valid url for callback is ``` index.php?route=extension/payment/my_controller/callback ``` because internal opencartv2.3 structure has next form: my\_site/catalog/controller/**extension/payment/my\_controller**.php For default success and fail (but opencart mean fail as return to chec...
Why are you trying to get the order info with an order\_id from the session and not from the data that you got back, there seems to lie the problem also from my point of view as the only possibility that your code will return a blank page from logical point of view is if not order info are specified, and the case that ...
22,152,216
Hello so here is the problem i have a login/register system and when the user creates his account a new folder gets created with same name as he puts username so if the username is test123 a folder test123 gets created. Now the problem is i dont know how to move files that user uploads with the upload system to his dir...
2014/03/03
[ "https://Stackoverflow.com/questions/22152216", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3375194/" ]
For **OpenCart version 2.3** a valid url for callback is ``` index.php?route=extension/payment/my_controller/callback ``` because internal opencartv2.3 structure has next form: my\_site/catalog/controller/**extension/payment/my\_controller**.php For default success and fail (but opencart mean fail as return to chec...
You can do some things to debug. \* You can put echo 'hello' or var\_dump('hello') inside your function to see if your function is even getting called and executed. \* If it is then you should put the echo/var\_dump after every line to see where the code stopped. Further, the url passed to the payment for call...
64,944,647
Ever since I started programming in React Native with Expo, I have been using an ios physical device together with Expo app. I never had any major issues. Now i wanted to start fixing any bugs on android, but when running the Expo app on my android physical device the Expo app crashes (shuts down) while downloading bu...
2020/11/21
[ "https://Stackoverflow.com/questions/64944647", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14030339/" ]
I'm running into the same issue right now. In my situation I've narrowed it down to the android adaptiveIcon configuration. If I use a path to a real png, the app crashes on bundle download. If I don't include adaptiveIcon under android, the app crashes. The only way it won't crash is to include adaptiveIcon linked to ...
My last expo project did not even have an android property, and my ios property only has supportsTablet as true. Try removing the android property altogether
64,944,647
Ever since I started programming in React Native with Expo, I have been using an ios physical device together with Expo app. I never had any major issues. Now i wanted to start fixing any bugs on android, but when running the Expo app on my android physical device the Expo app crashes (shuts down) while downloading bu...
2020/11/21
[ "https://Stackoverflow.com/questions/64944647", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14030339/" ]
My last expo project did not even have an android property, and my ios property only has supportsTablet as true. Try removing the android property altogether
I ran into this exact same problem. Changing your `foregroundImage` to a non-existent location works but it's not a good solution as you have to use a real image for your play store build. When you use the real image some of your users will experience the same immediate crashes you're seeing on the emulator. ``` // No...
64,944,647
Ever since I started programming in React Native with Expo, I have been using an ios physical device together with Expo app. I never had any major issues. Now i wanted to start fixing any bugs on android, but when running the Expo app on my android physical device the Expo app crashes (shuts down) while downloading bu...
2020/11/21
[ "https://Stackoverflow.com/questions/64944647", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14030339/" ]
I'm running into the same issue right now. In my situation I've narrowed it down to the android adaptiveIcon configuration. If I use a path to a real png, the app crashes on bundle download. If I don't include adaptiveIcon under android, the app crashes. The only way it won't crash is to include adaptiveIcon linked to ...
I just learnt the very hard way! I found that android is less tolerant of react native StyleSheet discrepancies. If your Expo Go app crashes on android and works well with ios, check at what navigation stage it is crashing. Then take a look closely at your StyleSheet props. In my case I had this causing the error: ```...
64,944,647
Ever since I started programming in React Native with Expo, I have been using an ios physical device together with Expo app. I never had any major issues. Now i wanted to start fixing any bugs on android, but when running the Expo app on my android physical device the Expo app crashes (shuts down) while downloading bu...
2020/11/21
[ "https://Stackoverflow.com/questions/64944647", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14030339/" ]
I'm running into the same issue right now. In my situation I've narrowed it down to the android adaptiveIcon configuration. If I use a path to a real png, the app crashes on bundle download. If I don't include adaptiveIcon under android, the app crashes. The only way it won't crash is to include adaptiveIcon linked to ...
I ran into this exact same problem. Changing your `foregroundImage` to a non-existent location works but it's not a good solution as you have to use a real image for your play store build. When you use the real image some of your users will experience the same immediate crashes you're seeing on the emulator. ``` // No...
64,944,647
Ever since I started programming in React Native with Expo, I have been using an ios physical device together with Expo app. I never had any major issues. Now i wanted to start fixing any bugs on android, but when running the Expo app on my android physical device the Expo app crashes (shuts down) while downloading bu...
2020/11/21
[ "https://Stackoverflow.com/questions/64944647", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14030339/" ]
I just learnt the very hard way! I found that android is less tolerant of react native StyleSheet discrepancies. If your Expo Go app crashes on android and works well with ios, check at what navigation stage it is crashing. Then take a look closely at your StyleSheet props. In my case I had this causing the error: ```...
I ran into this exact same problem. Changing your `foregroundImage` to a non-existent location works but it's not a good solution as you have to use a real image for your play store build. When you use the real image some of your users will experience the same immediate crashes you're seeing on the emulator. ``` // No...
26,445,461
I have a laravel built blog, and to comment on a post (if you're logged out) you must login. I put a link like this: ``` <a href="{{ URL::route('login') }}">login</a> to do this. ``` This redirects to the login form, which once filled out and user is authenticated, I have this: ``` return Redirect::intended('/'); ...
2014/10/18
[ "https://Stackoverflow.com/questions/26445461", "https://Stackoverflow.com", "https://Stackoverflow.com/users/485961/" ]
Actually, `Redirect::intended('/')` works if there is a key available in the session as `url.intended` otherwise it redirects to the default `URL` which is in your case '/', so definitely you didn't put the `URL` in the session. To accomplish this, you may put the `URL` in the session using something like this: ``` Se...
`Redirect::intended` requires two parts to work. The first is when the user tries to access a restricted page `/orders` but they aren't logged in you redirect them to the login page via: ``` redirect()->guest('/login'); ``` Then on your login post-back if authentication is successful you call: ``` redirect()->inten...
20,062,787
I am writing a program in c that outputs the html file, actually I am learning CGI programming. This program stops at run time when it executes the loop ('for' and 'while' both). The error returned is `Segmentation fault (core dumped)` The code(only the segment of program that is causing the problem) is: ``` void ma...
2013/11/19
[ "https://Stackoverflow.com/questions/20062787", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2867376/" ]
> > Why should I use &? Because I defined question\_no as int only not int pointer > > > That would be why. scanf needs a pointer in order to mutate the value. It expects a pointer, you pass it an int which is converted to a pointer which has some garbage value (address).
Change ``` scanf("%d",question_no); ``` to ``` scanf("%d",&question_no); ``` and see what happens... `scanf` takes a pointer to the memory location where to put the int value. So it tried to use `question_no` as an address and that caused the seg fault. `question_no` at that point had never been initialized so ...
20,062,787
I am writing a program in c that outputs the html file, actually I am learning CGI programming. This program stops at run time when it executes the loop ('for' and 'while' both). The error returned is `Segmentation fault (core dumped)` The code(only the segment of program that is causing the problem) is: ``` void ma...
2013/11/19
[ "https://Stackoverflow.com/questions/20062787", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2867376/" ]
Change ``` scanf("%d",question_no); ``` to ``` scanf("%d",&question_no); ``` and see what happens... `scanf` takes a pointer to the memory location where to put the int value. So it tried to use `question_no` as an address and that caused the seg fault. `question_no` at that point had never been initialized so ...
'scanf()' stores values, so it needs a place to store them.This is done by providing the addresses of where to store the values.'&' is used to refer addresses of variable in scanf statement.
20,062,787
I am writing a program in c that outputs the html file, actually I am learning CGI programming. This program stops at run time when it executes the loop ('for' and 'while' both). The error returned is `Segmentation fault (core dumped)` The code(only the segment of program that is causing the problem) is: ``` void ma...
2013/11/19
[ "https://Stackoverflow.com/questions/20062787", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2867376/" ]
> > Why should I use &? Because I defined question\_no as int only not int pointer > > > That would be why. scanf needs a pointer in order to mutate the value. It expects a pointer, you pass it an int which is converted to a pointer which has some garbage value (address).
Basically a segmentation faut is when your program attempts to access memory that it has not been assigned. You particular issue is this line, which invokes [undefined behavior](http://en.wikipedia.org/wiki/Undefined_behavior) since you are using `question_no` uninitialized here: ``` scanf("%d",question_no); ``` and...
20,062,787
I am writing a program in c that outputs the html file, actually I am learning CGI programming. This program stops at run time when it executes the loop ('for' and 'while' both). The error returned is `Segmentation fault (core dumped)` The code(only the segment of program that is causing the problem) is: ``` void ma...
2013/11/19
[ "https://Stackoverflow.com/questions/20062787", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2867376/" ]
> > Why should I use &? Because I defined question\_no as int only not int pointer > > > That would be why. scanf needs a pointer in order to mutate the value. It expects a pointer, you pass it an int which is converted to a pointer which has some garbage value (address).
`scanf` is a C function, and since C doesn't have 'references' like C++ has, passing a pointer to `scanf` is the only way `scanf` is able to store its results. If `scanf` doesn't have a pointer telling it where to store the result, then there is no way it can give its result back to the caller. Thus `scanf` is written...
20,062,787
I am writing a program in c that outputs the html file, actually I am learning CGI programming. This program stops at run time when it executes the loop ('for' and 'while' both). The error returned is `Segmentation fault (core dumped)` The code(only the segment of program that is causing the problem) is: ``` void ma...
2013/11/19
[ "https://Stackoverflow.com/questions/20062787", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2867376/" ]
> > Why should I use &? Because I defined question\_no as int only not int pointer > > > That would be why. scanf needs a pointer in order to mutate the value. It expects a pointer, you pass it an int which is converted to a pointer which has some garbage value (address).
'scanf()' stores values, so it needs a place to store them.This is done by providing the addresses of where to store the values.'&' is used to refer addresses of variable in scanf statement.
20,062,787
I am writing a program in c that outputs the html file, actually I am learning CGI programming. This program stops at run time when it executes the loop ('for' and 'while' both). The error returned is `Segmentation fault (core dumped)` The code(only the segment of program that is causing the problem) is: ``` void ma...
2013/11/19
[ "https://Stackoverflow.com/questions/20062787", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2867376/" ]
Basically a segmentation faut is when your program attempts to access memory that it has not been assigned. You particular issue is this line, which invokes [undefined behavior](http://en.wikipedia.org/wiki/Undefined_behavior) since you are using `question_no` uninitialized here: ``` scanf("%d",question_no); ``` and...
'scanf()' stores values, so it needs a place to store them.This is done by providing the addresses of where to store the values.'&' is used to refer addresses of variable in scanf statement.
20,062,787
I am writing a program in c that outputs the html file, actually I am learning CGI programming. This program stops at run time when it executes the loop ('for' and 'while' both). The error returned is `Segmentation fault (core dumped)` The code(only the segment of program that is causing the problem) is: ``` void ma...
2013/11/19
[ "https://Stackoverflow.com/questions/20062787", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2867376/" ]
`scanf` is a C function, and since C doesn't have 'references' like C++ has, passing a pointer to `scanf` is the only way `scanf` is able to store its results. If `scanf` doesn't have a pointer telling it where to store the result, then there is no way it can give its result back to the caller. Thus `scanf` is written...
'scanf()' stores values, so it needs a place to store them.This is done by providing the addresses of where to store the values.'&' is used to refer addresses of variable in scanf statement.
32,610,831
I am working with sailsjs(node.js), I have get all the data from mysql database and display the data in jtable but date format is coming like this: `YYYY-MM-DDTHH:mm:ss.000Z`. I need to convert this(YYYY-MM-DDTHH:mm:ss.000Z) format into `14-08-2015 04:36:04 PM In jtable i have used following format but not working. ...
2015/09/16
[ "https://Stackoverflow.com/questions/32610831", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3770187/" ]
This is a simple workaround using just javascript. This may not be the best way to do this but its simple and works. ``` var date = new Date("1994-11-05T08:15:30-05:00");//this is the format you have date.toLocaleDateString().split('/').join('-')+" "+date.toLocaleTimeString() //this converts it to necessary format OUT...
Sample code: ``` SELECT DATE_FORMAT('2007-10-04 22:23:00', '%d-%m-%Y %h:%i:%s %p') ``` Make following changes when selecting data from table: > > displayFormat: '%d-%m-%Y %h:%i:%s %p' > > >
25,434,159
I have a JSP page in which I am pulling timestamp stored in database as string which has the form `Thu Aug 21 2014 22:09:23 GMT+0530 (India Standard Time)`. Of Course, I am able to display it as it is in the page, however I was looking for a solution in javascript that would enable me convert this timestamp as per use...
2014/08/21
[ "https://Stackoverflow.com/questions/25434159", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3776061/" ]
I figured it out myself and I am able to accomplish what I needed. Passing the `timestamp` from database to var `new Date(timestamp)` get it converted to local time, it takes care of timezone and offsets as well. Thanks for your time experts! :)
You may try this ``` var timezone = new Date().getTimezoneOffset(); ``` From [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset) > > The time-zone offset is the difference, in minutes, between UTC and > local time. Note that this means that the offset is ...
25,434,159
I have a JSP page in which I am pulling timestamp stored in database as string which has the form `Thu Aug 21 2014 22:09:23 GMT+0530 (India Standard Time)`. Of Course, I am able to display it as it is in the page, however I was looking for a solution in javascript that would enable me convert this timestamp as per use...
2014/08/21
[ "https://Stackoverflow.com/questions/25434159", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3776061/" ]
I figured it out myself and I am able to accomplish what I needed. Passing the `timestamp` from database to var `new Date(timestamp)` get it converted to local time, it takes care of timezone and offsets as well. Thanks for your time experts! :)
If you are going to use AngularJS, it will be much more easier and straightforward to convert from 1408648665 to Thu, 21 Aug 2014 19:17:45 GMT ``` //html <div ng-controller="TimeCtrl"> Date: {{timeStamp + '000' | date: 'medium'}} </div> //js var app = angular.module('myApp', []); app.con...
57,020,431
So I have a stream of, let's say letters, and I need all letters in the right order to put them together into a word. Everything works fine until the user changes tab, minimize browser or switches application - behavior is almost the same as if I was using `setTimeout()` - messed up the order, lost items, etc. I tried ...
2019/07/13
[ "https://Stackoverflow.com/questions/57020431", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3159399/" ]
Since I have done similar pause/unpause thing in my [RxJS Snake Game](https://github.com/gogakoreli/angular-7-rxjs-snake-game), I will help you with your example. Idea is to have an `interval(1000)` as a source of truth, which means that everything will be based on it. So our goal becomes to make this interval pausabl...
a little confused on the use case, but this may solve it: first instead do this: ``` private isVisible$ = this.visibilityChange$.pipe( filter(() => document.visibilityState === 'visible'), distinctUntilChanged()); // just a safety operator ``` then do this: ``` const ...
3,440,871
is $[a,b]\supset(a,b)$ true or false? i'm saying it's true but my teacher said it is false, and he wants a german reference to accept it. Thank you.
2019/11/18
[ "https://math.stackexchange.com/questions/3440871", "https://math.stackexchange.com", "https://math.stackexchange.com/users/726561/" ]
The German wikipedia entry [here](https://de.wikipedia.org/wiki/Intervall_(Mathematik)) explains the notations of open, half-open, closed intervals. It agrees with the [English entry](https://en.wikipedia.org/wiki/Interval_(mathematics)). \begin{align} {\color{Red}(} a,b{\color{Red})} = \mathopen{\color{Red}]}a,b\math...
Are you sure your teacher asked for a german reference, and not for a germane justification? Was this a multiple choice question? Were you expected to provide any justification for your answer, any details explaining your thinking: If the answer is "yes", why it is so, and if the answer is "no", why "no"? There is ...
37,006,913
``` <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Login</title> <link rel="stylesheet" href="style.css" /> </head> <body> <?php require('databaseConnect.php'); session_start(); if (isset($_POST['username'])) { $username = $_POST['username']; $password = $_POST['password']; $query = "S...
2016/05/03
[ "https://Stackoverflow.com/questions/37006913", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6198406/" ]
Apart from the other issues (SQL injection, deprecated functions) that have been already mentioned before: * Setting a header will not work if you output anything before issueing it. So you will have to move the HTML sequence at the beginning to after the PHP code block (or maybe use output buffering). * Moving functi...
You can use if condition to redirect e.g in your code ``` if($rows==1){ $_SESSION['username'] = $username; if($role == 1) { // here $role should be database value whatever you have taken //redirect page for admin }else header("Location: index.php"); // This will redirect the user to index....
37,006,913
``` <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Login</title> <link rel="stylesheet" href="style.css" /> </head> <body> <?php require('databaseConnect.php'); session_start(); if (isset($_POST['username'])) { $username = $_POST['username']; $password = $_POST['password']; $query = "S...
2016/05/03
[ "https://Stackoverflow.com/questions/37006913", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6198406/" ]
Apart from the other issues (SQL injection, deprecated functions) that have been already mentioned before: * Setting a header will not work if you output anything before issueing it. So you will have to move the HTML sequence at the beginning to after the PHP code block (or maybe use output buffering). * Moving functi...
You have an error in your code. replace with below ``` <?php if (isset($_POST['username'])) { $username = $_POST['username']; $password = $_POST['password']; $query = "SELECT * FROM `UserReg` WHERE username='$username' and password='" . md5($password) . "'"; $result = mysql_query($query) or die(mysql...
6,819,368
I've been trying to figure this one out for a while now. I have a JQuery list populated using a JSon array. Every item in the list is clickable and brings to a page called details with specific details for the item clicked. Everything works fine, but if the user clicks several times on an item link, the page will be ...
2011/07/25
[ "https://Stackoverflow.com/questions/6819368", "https://Stackoverflow.com", "https://Stackoverflow.com/users/821641/" ]
If you build your link as an object instead of just text, you can then bind to the click handler as you build it like this: ``` // here's the click handler you need itemLink.click(function(e) { console.log("item clicked"); if ($(this).data("clickCount") > 0) { console.log("click count r...
You can use jQuery's `one()` to implement this once-only action, for example: ``` $('a').one('click', function(){ alert('hi!'); return false; }); ``` [JS Fiddle demo](http://jsfiddle.net/davidThomas/dt6nk/). Or, without using `one()`, you could simply unbind the `...
6,819,368
I've been trying to figure this one out for a while now. I have a JQuery list populated using a JSon array. Every item in the list is clickable and brings to a page called details with specific details for the item clicked. Everything works fine, but if the user clicks several times on an item link, the page will be ...
2011/07/25
[ "https://Stackoverflow.com/questions/6819368", "https://Stackoverflow.com", "https://Stackoverflow.com/users/821641/" ]
You can use jQuery's `one()` to implement this once-only action, for example: ``` $('a').one('click', function(){ alert('hi!'); return false; }); ``` [JS Fiddle demo](http://jsfiddle.net/davidThomas/dt6nk/). Or, without using `one()`, you could simply unbind the `...
``` var currentValue=""; $('a').click(function(event) { event.preventDefault(); if(currentValue != $(this).attr("href")){ currentValue = $(this).attr("href"); // Your actions here } }); ``` Thus, the link just dies when its action is the latest, but can be reused. [jsFiddle test](http://j...
6,819,368
I've been trying to figure this one out for a while now. I have a JQuery list populated using a JSon array. Every item in the list is clickable and brings to a page called details with specific details for the item clicked. Everything works fine, but if the user clicks several times on an item link, the page will be ...
2011/07/25
[ "https://Stackoverflow.com/questions/6819368", "https://Stackoverflow.com", "https://Stackoverflow.com/users/821641/" ]
If you build your link as an object instead of just text, you can then bind to the click handler as you build it like this: ``` // here's the click handler you need itemLink.click(function(e) { console.log("item clicked"); if ($(this).data("clickCount") > 0) { console.log("click count r...
``` var currentValue=""; $('a').click(function(event) { event.preventDefault(); if(currentValue != $(this).attr("href")){ currentValue = $(this).attr("href"); // Your actions here } }); ``` Thus, the link just dies when its action is the latest, but can be reused. [jsFiddle test](http://j...
70,917,514
I have a rule for the target ``` data/processed/21.12.2021/experiment6/written_piv21122021.005.exp6.mp4 ``` in my makefile such that it has a dependency ``` data/raw/21.12.2021/experiment6/piv21122021.005.exp6.mov ``` Using `subst` functions, I'm trying to create the dependency by pattern matching as ``` %/writt...
2022/01/30
[ "https://Stackoverflow.com/questions/70917514", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6708910/" ]
> > What does explicitly-defaulted move constructor do? > > > It will initialize its member variables with the corresponding member variables in the *moved from* object after turning them into [xvalues](https://en.cppreference.com/w/cpp/language/value_category). This is the same as if you use [`std::move`](https:/...
> > What does explicitly-defaulted move constructor do? > > > A compiler generated move constructor moves each sub object. > > so after the move, foo(33) is destroyed, leaving an invalid foo object in the vector. > > > The destruction of the moved-from "foo(33)" has no effect on the moved-to "foo(33)" object...
13,893
I've been reading about the Pantanal (Brazil) and the information I have is that the two main cities in this area are Campo Grande and Cuiaba. The problem is that the blogs I've read state that the Pantanal must be visited with a tour or an independent guide and the budget for this is not less than 150 USD per day. I'm...
2013/02/23
[ "https://travel.stackexchange.com/questions/13893", "https://travel.stackexchange.com", "https://travel.stackexchange.com/users/1425/" ]
A friend of mine and I visited Cuiabá in the summer of 2007 with the intention of visiting the Pantanal. We were inundated by tour guides upon our arrival at the airport and the best deal we could find was a 3 day/2 night tour all inclusive for about *US$200 per person* from [Ecoverde Tours](http://www.ecoverdetours.co...
So I've not been, but I've heard talk about it too. Having a read on [Wikivoyage's article](http://en.wikivoyage.org/wiki/Pantanal) certainly seems like it's possible sans-tour. Getting in: > > There are daily flights from other Brazilian cities such as Campo > Grande and Cuiabá to the gateway city of Corumbá, from ...
13,893
I've been reading about the Pantanal (Brazil) and the information I have is that the two main cities in this area are Campo Grande and Cuiaba. The problem is that the blogs I've read state that the Pantanal must be visited with a tour or an independent guide and the budget for this is not less than 150 USD per day. I'm...
2013/02/23
[ "https://travel.stackexchange.com/questions/13893", "https://travel.stackexchange.com", "https://travel.stackexchange.com/users/1425/" ]
A friend of mine and I visited Cuiabá in the summer of 2007 with the intention of visiting the Pantanal. We were inundated by tour guides upon our arrival at the airport and the best deal we could find was a 3 day/2 night tour all inclusive for about *US$200 per person* from [Ecoverde Tours](http://www.ecoverdetours.co...
I suspect you've already been on your trip and, if so, had a great time. I've done the trip a few times before and its probably my favourite place for wildlife. You can see lots of animals and sights without a guide - travelling along the transpantaneira in a rental car, for example. [Pantanal Lodges](http://www.pantan...
4,020,906
In zsh you can qualify globs with file type assertions e.g. `*(/)` matches only directories, `*(.)` only normal files, is there a way to do the same thing in bash without resorting to find?
2010/10/26
[ "https://Stackoverflow.com/questions/4020906", "https://Stackoverflow.com", "https://Stackoverflow.com/users/473914/" ]
you can try ``` ls -ltrd */ #match directories using -d and the slash "/" ``` or ``` echo */ ``` or ``` for dir in */ do ... done ``` If you need to do it recursive, and you have Bash 4+ ``` $ shopt -s globstar $ for dir in **/*/; do echo $dir; done ```
I don't think that there's a way to do this directly, but don't forget that you can use the [test](http://linux.die.net/man/1/test) options `-d` and `-f` to determine whether name refers to a directory or a file. ``` for a in *; do if [ -d "$a" ]; then echo Directory: $a elif [ -f "$a" ]; then echo File: $...
36,235,554
I'm trying to count the number of vowels in a string by splitting the string into an array of letters and then map vowel letters to `1` and summing up the array. ``` def count_vowels(string) vowels = ['a','e', 'i', 'o', 'u'] return string.split("").map{ |n| vowels.include? n ? 1 : 0}.inject(0,:+) end ``` The...
2016/03/26
[ "https://Stackoverflow.com/questions/36235554", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2421141/" ]
The reason: ``` string.split("").map{ |n| vowels.include? n ? 1 : 0}.inject(0,:+) ``` does not work is because `n ? 1 : 0` is evaluated and passed as an argument to `include?` instead of `n`. You need to add some parentheses in `include?`: ``` string.split("").map{ |n| vowels.include?(n) ? 1 : 0}.inject(0,:+) ``` ...
In this case you need parantheses for `include?` method parameter. So ``` return string.split("").map{ |n| vowels.include?(n) }.inject(0) do |mem,x| ``` Anyway, your code might be better * `VOWELS = %w(a e i o u) # string's array` * you don't need return in your method, it's the last statement * `string.split("")` ...
36,235,554
I'm trying to count the number of vowels in a string by splitting the string into an array of letters and then map vowel letters to `1` and summing up the array. ``` def count_vowels(string) vowels = ['a','e', 'i', 'o', 'u'] return string.split("").map{ |n| vowels.include? n ? 1 : 0}.inject(0,:+) end ``` The...
2016/03/26
[ "https://Stackoverflow.com/questions/36235554", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2421141/" ]
The reason: ``` string.split("").map{ |n| vowels.include? n ? 1 : 0}.inject(0,:+) ``` does not work is because `n ? 1 : 0` is evaluated and passed as an argument to `include?` instead of `n`. You need to add some parentheses in `include?`: ``` string.split("").map{ |n| vowels.include?(n) ? 1 : 0}.inject(0,:+) ``` ...
You don't need `map`. ``` def count_vowels(string) vowels = %w[a e i o u] string.chars.select{|n| vowels.include? n}.size end ```
36,235,554
I'm trying to count the number of vowels in a string by splitting the string into an array of letters and then map vowel letters to `1` and summing up the array. ``` def count_vowels(string) vowels = ['a','e', 'i', 'o', 'u'] return string.split("").map{ |n| vowels.include? n ? 1 : 0}.inject(0,:+) end ``` The...
2016/03/26
[ "https://Stackoverflow.com/questions/36235554", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2421141/" ]
You don't need `map`. ``` def count_vowels(string) vowels = %w[a e i o u] string.chars.select{|n| vowels.include? n}.size end ```
In this case you need parantheses for `include?` method parameter. So ``` return string.split("").map{ |n| vowels.include?(n) }.inject(0) do |mem,x| ``` Anyway, your code might be better * `VOWELS = %w(a e i o u) # string's array` * you don't need return in your method, it's the last statement * `string.split("")` ...
207,191
Recently the idea struck my mind, that I wanted to build a simple but useful emergency light which can run off of any USB port (the specific use case would be to power it from an USB power bank). For that I wanted to design a simple circuit that drives 25 white LEDs (3.2 V, typ.) in parallel. The question I am facing ...
2015/12/21
[ "https://electronics.stackexchange.com/questions/207191", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/95044/" ]
You can use a backlight driver IC which steps the 5V up to 20V+ and power several LED strings (perhaps with I2C brightness control from a micro, such as with the Skyworks AAT1236), however I think your best bet is to simply use series resistors and keep it simple. Especially in keeping with the function of the unit.. p...
1) USB can only supply about 500 mA. You can get a single white LED that is rated for that amount of current. 2) If you put multiple LEDs directly in parallel, small variations in the LEDs themselves will cause them to run different currents in each LED. You basically have to 'ballast' each LED to swamp the difference...
207,191
Recently the idea struck my mind, that I wanted to build a simple but useful emergency light which can run off of any USB port (the specific use case would be to power it from an USB power bank). For that I wanted to design a simple circuit that drives 25 white LEDs (3.2 V, typ.) in parallel. The question I am facing ...
2015/12/21
[ "https://electronics.stackexchange.com/questions/207191", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/95044/" ]
I would never put the LEDs in parallel because there are chips that can do this job properly such as this one from Maxim: - [![enter image description here](https://i.stack.imgur.com/2V2na.gif)](https://i.stack.imgur.com/2V2na.gif)
1) USB can only supply about 500 mA. You can get a single white LED that is rated for that amount of current. 2) If you put multiple LEDs directly in parallel, small variations in the LEDs themselves will cause them to run different currents in each LED. You basically have to 'ballast' each LED to swamp the difference...
207,191
Recently the idea struck my mind, that I wanted to build a simple but useful emergency light which can run off of any USB port (the specific use case would be to power it from an USB power bank). For that I wanted to design a simple circuit that drives 25 white LEDs (3.2 V, typ.) in parallel. The question I am facing ...
2015/12/21
[ "https://electronics.stackexchange.com/questions/207191", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/95044/" ]
You can use a backlight driver IC which steps the 5V up to 20V+ and power several LED strings (perhaps with I2C brightness control from a micro, such as with the Skyworks AAT1236), however I think your best bet is to simply use series resistors and keep it simple. Especially in keeping with the function of the unit.. p...
"you are hereby also saying, that there is absolutely no way to power 25 LEDs more efficiently than through resistors" Well, no, not necessarily. It would be possible to control each LED separately with a switch-mode current regulator. Of course, this means that you would need 25 regulators. While this would be more ...
207,191
Recently the idea struck my mind, that I wanted to build a simple but useful emergency light which can run off of any USB port (the specific use case would be to power it from an USB power bank). For that I wanted to design a simple circuit that drives 25 white LEDs (3.2 V, typ.) in parallel. The question I am facing ...
2015/12/21
[ "https://electronics.stackexchange.com/questions/207191", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/95044/" ]
I would never put the LEDs in parallel because there are chips that can do this job properly such as this one from Maxim: - [![enter image description here](https://i.stack.imgur.com/2V2na.gif)](https://i.stack.imgur.com/2V2na.gif)
"you are hereby also saying, that there is absolutely no way to power 25 LEDs more efficiently than through resistors" Well, no, not necessarily. It would be possible to control each LED separately with a switch-mode current regulator. Of course, this means that you would need 25 regulators. While this would be more ...
25,848,665
In my application I am trying to parse data through JSON and trying to display in listview in android. But I am getting `java.lang.NoSuchMethodError:org.json.JSONArray` error while parsing data. This is the link that I am using for parsing data. <http://demo.tugain.com/tapme/RetriveAll.php?q=cat> For this, I used the ...
2014/09/15
[ "https://Stackoverflow.com/questions/25848665", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3519241/" ]
try this i have done some changes in your connect method ``` private void connect() { String data; JSONArray json; try { DefaultHttpClient client = new DefaultHttpClient(); HttpGet request = new HttpGet( "http://demo.tugain.com/tapme/RetriveAll.php?q=cat"); HttpRespo...
Try This code... ``` try { String data ="YOUR JSON ARRAY RESULT"; JSONObject obj=null; JSONArray jsonArr =new JSONArray(data).getJSONArray(0); for(int i=0;i<jsonArr.length();i++) { String name=jsonArr.getJSONObject(i).getString("...
36,083,945
I'm using Django's built in User model and this UserProfile model. ``` # this is model for user profile class UserProfile(models.Model): user = models.OneToOneField(User, related_name='profile') city = models.ForeignKey(City) . . . general attributes ``` How can I check if the logged in user has ...
2016/03/18
[ "https://Stackoverflow.com/questions/36083945", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5405436/" ]
If you do not need to fetch the profile, you can use `hasattr`, and avoid the need for exception handling. ``` user_has_profile = hasattr(user, 'profile') ``` In a view, `request.user` is the logged in user so you would do ``` user_has_profile = hasattr(request.user, 'profile') ```
You have set `related_name='profile'`. So you can do: ``` def has_profile(user): try: return user.profile is not None except UserProfile.DoesNotExist: return False ``` As a generic way to check if a model has a related, you can do: ``` from django.core.exceptions import ObjectDoesNotExist d...
59,828,192
I'm trying to learn about the Lambda function in Python by messing up the code to observe what errors Python would throw in various scenarios. Can anyone please explain what exactly is the meaning of following message displayed by the IDLE and how to interpret it? ```py def myfunc(n): return lambda a:a*n myfu...
2020/01/20
[ "https://Stackoverflow.com/questions/59828192", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12543598/" ]
I'll assume you mis-typed your indentation, and that the code snippet was ```py def myfunc(n): return lambda a:a*n myfunc(2) ``` the `lambda` operator here returns a function doing `x-> n*x`. So `myfunc` is essentially a function that returns another function. Your code is legit, and the output of python is o...
Looks like you're returning the entire lambda function rather than returning the result. To return the lambda function's value, surround it with parenthesis like so: ``` >>> def myfunc(n): return (lambda a: a*n)(n) >>> myfunc(2) 4 ```
59,828,192
I'm trying to learn about the Lambda function in Python by messing up the code to observe what errors Python would throw in various scenarios. Can anyone please explain what exactly is the meaning of following message displayed by the IDLE and how to interpret it? ```py def myfunc(n): return lambda a:a*n myfu...
2020/01/20
[ "https://Stackoverflow.com/questions/59828192", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12543598/" ]
I'll assume you mis-typed your indentation, and that the code snippet was ```py def myfunc(n): return lambda a:a*n myfunc(2) ``` the `lambda` operator here returns a function doing `x-> n*x`. So `myfunc` is essentially a function that returns another function. Your code is legit, and the output of python is o...
This means that your command ``` myfunc(2) ``` returned a function (namely, a lambda function in myfunc scope). `0x037800B8` is its address in memory.
59,828,192
I'm trying to learn about the Lambda function in Python by messing up the code to observe what errors Python would throw in various scenarios. Can anyone please explain what exactly is the meaning of following message displayed by the IDLE and how to interpret it? ```py def myfunc(n): return lambda a:a*n myfu...
2020/01/20
[ "https://Stackoverflow.com/questions/59828192", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12543598/" ]
Your defined function returns a lambda function. This isn't an error message, it is printing the lambda function object.
You should interpret this as a function object or a functor. `myfunc.<locals>.<lambda>` its just says that it is a local variable of `myfunc` and its a lambda function. ``` myfunc(2) # is a function object print(myfunc(2)(3)) # prints 6 which is 3 * 2 ``` This function stores the inner variable n = 2 and then return...
59,828,192
I'm trying to learn about the Lambda function in Python by messing up the code to observe what errors Python would throw in various scenarios. Can anyone please explain what exactly is the meaning of following message displayed by the IDLE and how to interpret it? ```py def myfunc(n): return lambda a:a*n myfu...
2020/01/20
[ "https://Stackoverflow.com/questions/59828192", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12543598/" ]
Your defined function returns a lambda function. This isn't an error message, it is printing the lambda function object.
This means that your command ``` myfunc(2) ``` returned a function (namely, a lambda function in myfunc scope). `0x037800B8` is its address in memory.
59,828,192
I'm trying to learn about the Lambda function in Python by messing up the code to observe what errors Python would throw in various scenarios. Can anyone please explain what exactly is the meaning of following message displayed by the IDLE and how to interpret it? ```py def myfunc(n): return lambda a:a*n myfu...
2020/01/20
[ "https://Stackoverflow.com/questions/59828192", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12543598/" ]
Your defined function returns a lambda function. This isn't an error message, it is printing the lambda function object.
Looks like you're returning the entire lambda function rather than returning the result. To return the lambda function's value, surround it with parenthesis like so: ``` >>> def myfunc(n): return (lambda a: a*n)(n) >>> myfunc(2) 4 ```
59,828,192
I'm trying to learn about the Lambda function in Python by messing up the code to observe what errors Python would throw in various scenarios. Can anyone please explain what exactly is the meaning of following message displayed by the IDLE and how to interpret it? ```py def myfunc(n): return lambda a:a*n myfu...
2020/01/20
[ "https://Stackoverflow.com/questions/59828192", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12543598/" ]
You should interpret this as a function object or a functor. `myfunc.<locals>.<lambda>` its just says that it is a local variable of `myfunc` and its a lambda function. ``` myfunc(2) # is a function object print(myfunc(2)(3)) # prints 6 which is 3 * 2 ``` This function stores the inner variable n = 2 and then return...
This means that your command ``` myfunc(2) ``` returned a function (namely, a lambda function in myfunc scope). `0x037800B8` is its address in memory.
59,828,192
I'm trying to learn about the Lambda function in Python by messing up the code to observe what errors Python would throw in various scenarios. Can anyone please explain what exactly is the meaning of following message displayed by the IDLE and how to interpret it? ```py def myfunc(n): return lambda a:a*n myfu...
2020/01/20
[ "https://Stackoverflow.com/questions/59828192", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12543598/" ]
I'll assume you mis-typed your indentation, and that the code snippet was ```py def myfunc(n): return lambda a:a*n myfunc(2) ``` the `lambda` operator here returns a function doing `x-> n*x`. So `myfunc` is essentially a function that returns another function. Your code is legit, and the output of python is o...
You are simply returning a reference to a function. Lambdas were born to make short functions, short to type, avoiding the boilerplate of writing "def function(): .." Try looking at the following tutorial to get the basics: <https://www.w3schools.com/python/python_lambda.asp>
59,828,192
I'm trying to learn about the Lambda function in Python by messing up the code to observe what errors Python would throw in various scenarios. Can anyone please explain what exactly is the meaning of following message displayed by the IDLE and how to interpret it? ```py def myfunc(n): return lambda a:a*n myfu...
2020/01/20
[ "https://Stackoverflow.com/questions/59828192", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12543598/" ]
Your defined function returns a lambda function. This isn't an error message, it is printing the lambda function object.
You are simply returning a reference to a function. Lambdas were born to make short functions, short to type, avoiding the boilerplate of writing "def function(): .." Try looking at the following tutorial to get the basics: <https://www.w3schools.com/python/python_lambda.asp>
59,828,192
I'm trying to learn about the Lambda function in Python by messing up the code to observe what errors Python would throw in various scenarios. Can anyone please explain what exactly is the meaning of following message displayed by the IDLE and how to interpret it? ```py def myfunc(n): return lambda a:a*n myfu...
2020/01/20
[ "https://Stackoverflow.com/questions/59828192", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12543598/" ]
You should interpret this as a function object or a functor. `myfunc.<locals>.<lambda>` its just says that it is a local variable of `myfunc` and its a lambda function. ``` myfunc(2) # is a function object print(myfunc(2)(3)) # prints 6 which is 3 * 2 ``` This function stores the inner variable n = 2 and then return...
Looks like you're returning the entire lambda function rather than returning the result. To return the lambda function's value, surround it with parenthesis like so: ``` >>> def myfunc(n): return (lambda a: a*n)(n) >>> myfunc(2) 4 ```
59,828,192
I'm trying to learn about the Lambda function in Python by messing up the code to observe what errors Python would throw in various scenarios. Can anyone please explain what exactly is the meaning of following message displayed by the IDLE and how to interpret it? ```py def myfunc(n): return lambda a:a*n myfu...
2020/01/20
[ "https://Stackoverflow.com/questions/59828192", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12543598/" ]
Your defined function returns a lambda function. This isn't an error message, it is printing the lambda function object.
I'll assume you mis-typed your indentation, and that the code snippet was ```py def myfunc(n): return lambda a:a*n myfunc(2) ``` the `lambda` operator here returns a function doing `x-> n*x`. So `myfunc` is essentially a function that returns another function. Your code is legit, and the output of python is o...
36,953,538
I'm currently working on a Windows OS and I have installed MySQL community server 5.6.30 and everything is fine. I have a script that initializes the DB and again, everything works fine. Now I'm trying to run this script on a Linux environment -- same MySQL version -- and I get the following error: > > ERROR 1074 (4...
2016/04/30
[ "https://Stackoverflow.com/questions/36953538", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3953799/" ]
According to the documentation: > > Although InnoDB supports row sizes larger than 65,535 bytes > internally, MySQL itself imposes a row-size limit of 65,535 for the > combined size of all columns: > > > > ``` > mysql> CREATE TABLE t (a VARCHAR(8000), b VARCHAR(10000), > -> c VARCHAR(10000), d VARCHAR(10000)...
please simply use TEXT to declare txt column ``` DROP TABLE IF EXISTS text; CREATE TABLE `texts` ( `id` BINARY(16) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0', `txt` TEXT DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=INNODB DEFAULT CHARSET=utf8; ```
36,953,538
I'm currently working on a Windows OS and I have installed MySQL community server 5.6.30 and everything is fine. I have a script that initializes the DB and again, everything works fine. Now I'm trying to run this script on a Linux environment -- same MySQL version -- and I get the following error: > > ERROR 1074 (4...
2016/04/30
[ "https://Stackoverflow.com/questions/36953538", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3953799/" ]
utf8 needs up to 3 bytes per character. utf8mb4: 4; latin1: 1; ascii: 1; etc. `VARCHAR(N)` is implemented as a 1- or 2-byte length in front of the bytes for the text. That is allowed to hold N *characters* (not bytes). So, if you say you want utf8, then 3\*N must be less than 65535, the max value for a 2-byte length. ...
please simply use TEXT to declare txt column ``` DROP TABLE IF EXISTS text; CREATE TABLE `texts` ( `id` BINARY(16) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0', `txt` TEXT DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=INNODB DEFAULT CHARSET=utf8; ```
36,953,538
I'm currently working on a Windows OS and I have installed MySQL community server 5.6.30 and everything is fine. I have a script that initializes the DB and again, everything works fine. Now I'm trying to run this script on a Linux environment -- same MySQL version -- and I get the following error: > > ERROR 1074 (4...
2016/04/30
[ "https://Stackoverflow.com/questions/36953538", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3953799/" ]
According to the documentation: > > Although InnoDB supports row sizes larger than 65,535 bytes > internally, MySQL itself imposes a row-size limit of 65,535 for the > combined size of all columns: > > > > ``` > mysql> CREATE TABLE t (a VARCHAR(8000), b VARCHAR(10000), > -> c VARCHAR(10000), d VARCHAR(10000)...
If you absolutely must use varchar - which is a bad solution to this problem! - then here's something you can try: ``` CREATE TABLE `texts` ( `id` BINARY(16) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0', `txt` VARCHAR(20000) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=INNODB DEFAULT CHARSET=utf8; CREATE TA...
36,953,538
I'm currently working on a Windows OS and I have installed MySQL community server 5.6.30 and everything is fine. I have a script that initializes the DB and again, everything works fine. Now I'm trying to run this script on a Linux environment -- same MySQL version -- and I get the following error: > > ERROR 1074 (4...
2016/04/30
[ "https://Stackoverflow.com/questions/36953538", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3953799/" ]
utf8 needs up to 3 bytes per character. utf8mb4: 4; latin1: 1; ascii: 1; etc. `VARCHAR(N)` is implemented as a 1- or 2-byte length in front of the bytes for the text. That is allowed to hold N *characters* (not bytes). So, if you say you want utf8, then 3\*N must be less than 65535, the max value for a 2-byte length. ...
If you absolutely must use varchar - which is a bad solution to this problem! - then here's something you can try: ``` CREATE TABLE `texts` ( `id` BINARY(16) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0', `txt` VARCHAR(20000) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=INNODB DEFAULT CHARSET=utf8; CREATE TA...
19,364,374
Eclipse says that the variable age, agirl and aboy may not have been initialized. I initialized the variables before the first if statement and they got values in the if-statement. When I want to use them in the next if-statement eclipse says the local variables may not have been initialized. Here is my code: ``` impo...
2013/10/14
[ "https://Stackoverflow.com/questions/19364374", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2879540/" ]
This line ``` int aboy, agirl, age; ``` contains declarations, not initializations. Java will not initialize a local variable for you, and there is an execution path (the `else`) where nothing is ever assigned to those variables, then you attempt to reference their nonexistent values. You must set values to them be...
*Initializing* is assigning the variable a value. *Declaring* is creating the variable. They are not the same. The reason you need to initialize the variables is because it is possible they will not be initialized. All the if statements could be false, thus you need to give them a default value.
19,364,374
Eclipse says that the variable age, agirl and aboy may not have been initialized. I initialized the variables before the first if statement and they got values in the if-statement. When I want to use them in the next if-statement eclipse says the local variables may not have been initialized. Here is my code: ``` impo...
2013/10/14
[ "https://Stackoverflow.com/questions/19364374", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2879540/" ]
Not only *may* you have an uninitialized variable, you're *guaranteed* to. Look at your control flow: You first ask for a value for `define`, and then you execute exactly one of the blocks. If `define` is `"boy"`, you don't initialize `agirl`; if `define` is `"girl"`, you don't initialize `aboy`, and if `define` doesn...
*Initializing* is assigning the variable a value. *Declaring* is creating the variable. They are not the same. The reason you need to initialize the variables is because it is possible they will not be initialized. All the if statements could be false, thus you need to give them a default value.
4,089,037
I'm looking for a class library or namespace that pretty fully represents the [HTML 4.0](http://www.w3.org/TR/html4) or [HTML 4.01](http://www.w3.org/TR/html401/) specification. Does anybody know of anything like this? System.Web.UI looked promising at a glance, but I'm not seeing what I'm looking for there.
2010/11/03
[ "https://Stackoverflow.com/questions/4089037", "https://Stackoverflow.com", "https://Stackoverflow.com/users/406732/" ]
You might want to have a look at the > > **[Html Agility Pack](http://html-agility-pack.net/?z=codeplex)** > > >
there are many thing you can find out on codeplex like HTML Agility pack System.HTML
55,359,880
I'm new to node.js and Stack Overflow and I'm having a little trouble: I want to read two files and do something with them in a specific order. Problem being that I don't know which one will finish being read first so I don't know how to make sure they will trigger in the right order. To give an example let's say that...
2019/03/26
[ "https://Stackoverflow.com/questions/55359880", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11260968/" ]
One of the reason (out of several) `Promise` and `async/await` exists is to solve exactly this kind of issue. You can create a wrapper to return `Promise`: ``` function readSomething(filePath) { return new Promise((resolve, reject) => { fs.readFile(filePath, (err, data) => { if (err) reject(err); el...
``` let file1 = fs.readFile('./file1') let file2 = fs.readFile('./file2'); file1 = await file1; file2 = await file2; res.write(file1) res.write(file2) ``` By this reading takes place in paralle, but if you know before hand that file1 is going to be comparatively big you can swap the await statements. And then you can...
45,021,210
I was trying to query values in a table where they started with 'a', 'b' or 'c'. I know in MS SQL you can make a [charlist] to do this: ( LIKE '[abc]%' ) I was wondering what the correct syntax was in other databases such as Oracle or mySQL. Thanks
2017/07/10
[ "https://Stackoverflow.com/questions/45021210", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8116665/" ]
PowerShell is not necessary. Here's one way: 1. Install the [Windows Server 2003 Resource Kit Tools](https://www.microsoft.com/en-us/download/details.aspx?id=17657) package somewhere and get the files `instsrv.exe` and `srvany.exe`. 2. Use `srvany.exe` to create the service using the `ssh.exe` program and its paramete...
To make something into a service, you would need to compile your script into an executable. This can be done via PS2EXE. What may work just as well for you is making a function in powershell, `Start-DbTunnel`, and making that import into your powershell session on start. You can do this by loading functions in the fol...
1,688,356
Given that the residual sum of squares (RSS) follows Chi Square distribution. $RSS ∼ σ^2χ^2\_{n-2}$ When I ran a program for n = 10, 50 (n=sample size) I noticed that the 'mean' of the RSS over 1,000 simulation runs is close to n − 2. I want to know the reason why the mean is always close to n-2?
2016/03/08
[ "https://math.stackexchange.com/questions/1688356", "https://math.stackexchange.com", "https://math.stackexchange.com/users/320955/" ]
*Note*: It turned out in the context of [this later question](https://math.stackexchange.com/questions/1705405) that this answer may not answer the question as intended, since I assume that all failed coins are reflipped, even if the first flip yielded the desired $k$ successes, whereas the intent may have been to stop...
See this poor answer as an illustration of the elegancy of the answer of @Joriki. Let $S=S\_{1}+S\_{2}$ where $S\_{i}$ denotes the number of successes at the $i$-th flip. Then: $$P\left(S=k\right)=\sum\_{x=0}^{k}P\left(S\_{2}=k-x\mid S\_{1}=x\right)P\left(S\_{1}=x\right)=\sum\_{x=0}^{k}\binom{n-x}{k-x}p^{k-x}\left(1-...
211,874
I am overriding cart item default template in custom module. Below are code of layout file and template file. It does not work. **app/code/Vendor/Custom/view/frontend/layout/checkout\_cart\_item\_renderers.xml** ``` <?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSch...
2018/02/01
[ "https://magento.stackexchange.com/questions/211874", "https://magento.stackexchange.com", "https://magento.stackexchange.com/users/45344/" ]
Referer Param has encoded url as value, the url from which customer was transferred to login page is added as referer, so after login customer can be redirected to the same page.
<https://prnt.sc/whb205> <https://prnt.sc/whb2fg> Please set 'Redirect Customer to Account Dashboard after Logging in' option as YES
211,874
I am overriding cart item default template in custom module. Below are code of layout file and template file. It does not work. **app/code/Vendor/Custom/view/frontend/layout/checkout\_cart\_item\_renderers.xml** ``` <?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSch...
2018/02/01
[ "https://magento.stackexchange.com/questions/211874", "https://magento.stackexchange.com", "https://magento.stackexchange.com/users/45344/" ]
This is a feature provided by Magento. It is used to redirect a user back to the page where he tried to login to resume his navigation. If a user is on a category page and clicks on login link, it will add category page as referrer in URL and will redirect the user back to the same category page after successful login....
<https://prnt.sc/whb205> <https://prnt.sc/whb2fg> Please set 'Redirect Customer to Account Dashboard after Logging in' option as YES
48,536,142
I had registered a user in `firebase` using `Firebase` phone number `authentication`.For testing that functionality again, I deleted the user account from `Firebase` console. Now, i am trying to register that number again, its directly going to the `onVerificationCompleted()` callback without sending the `OTP`.But the ...
2018/01/31
[ "https://Stackoverflow.com/questions/48536142", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6489135/" ]
Try to signout of your app or simply clear data or reinstall, it's possible there is a little glitch somewhere within the app. If the above instruction doesn't work, then the cause is a little deeper. Since the authentication worked the first time, it's most likely a network carrier issue; this happens mostly in cases...
As per my experience, Firebase creates a refresh token & a firebase user ID token after login, firebase user ID token expires every hour whereas refresh token is long-lived. this firebase user ID token resides in user device & refresh token is maintained on firebase servers. In your case after deleting user account...
48,536,142
I had registered a user in `firebase` using `Firebase` phone number `authentication`.For testing that functionality again, I deleted the user account from `Firebase` console. Now, i am trying to register that number again, its directly going to the `onVerificationCompleted()` callback without sending the `OTP`.But the ...
2018/01/31
[ "https://Stackoverflow.com/questions/48536142", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6489135/" ]
Try to signout of your app or simply clear data or reinstall, it's possible there is a little glitch somewhere within the app. If the above instruction doesn't work, then the cause is a little deeper. Since the authentication worked the first time, it's most likely a network carrier issue; this happens mostly in cases...
Worked for me . Sometimes Google is unable to verify the request coming from you app. In order to solve it. Generate your app's signing report and get your SHA-1 or SHA-256 fingerprints. Go to your firebase project setting and update those fingerprints. [How to add fingerprint](https://stackoverflow.com/questions/391...
48,536,142
I had registered a user in `firebase` using `Firebase` phone number `authentication`.For testing that functionality again, I deleted the user account from `Firebase` console. Now, i am trying to register that number again, its directly going to the `onVerificationCompleted()` callback without sending the `OTP`.But the ...
2018/01/31
[ "https://Stackoverflow.com/questions/48536142", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6489135/" ]
Try to signout of your app or simply clear data or reinstall, it's possible there is a little glitch somewhere within the app. If the above instruction doesn't work, then the cause is a little deeper. Since the authentication worked the first time, it's most likely a network carrier issue; this happens mostly in cases...
Hope this answer helps you. I have copied my files onto another laptop and tried debugging my project. I have faced the same problem and later realized that I have not updated my SHA-1 and SHA-256 fingerprints of my new laptop on firebase. Make sure that your SHA-1 and SHA-256 fingerprints are up-to-date
48,536,142
I had registered a user in `firebase` using `Firebase` phone number `authentication`.For testing that functionality again, I deleted the user account from `Firebase` console. Now, i am trying to register that number again, its directly going to the `onVerificationCompleted()` callback without sending the `OTP`.But the ...
2018/01/31
[ "https://Stackoverflow.com/questions/48536142", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6489135/" ]
As per my experience, Firebase creates a refresh token & a firebase user ID token after login, firebase user ID token expires every hour whereas refresh token is long-lived. this firebase user ID token resides in user device & refresh token is maintained on firebase servers. In your case after deleting user account...
Worked for me . Sometimes Google is unable to verify the request coming from you app. In order to solve it. Generate your app's signing report and get your SHA-1 or SHA-256 fingerprints. Go to your firebase project setting and update those fingerprints. [How to add fingerprint](https://stackoverflow.com/questions/391...
48,536,142
I had registered a user in `firebase` using `Firebase` phone number `authentication`.For testing that functionality again, I deleted the user account from `Firebase` console. Now, i am trying to register that number again, its directly going to the `onVerificationCompleted()` callback without sending the `OTP`.But the ...
2018/01/31
[ "https://Stackoverflow.com/questions/48536142", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6489135/" ]
As per my experience, Firebase creates a refresh token & a firebase user ID token after login, firebase user ID token expires every hour whereas refresh token is long-lived. this firebase user ID token resides in user device & refresh token is maintained on firebase servers. In your case after deleting user account...
Hope this answer helps you. I have copied my files onto another laptop and tried debugging my project. I have faced the same problem and later realized that I have not updated my SHA-1 and SHA-256 fingerprints of my new laptop on firebase. Make sure that your SHA-1 and SHA-256 fingerprints are up-to-date
39,127
Google Chrome has a [feature](https://support.google.com/chrome/answer/2364824?hl=en) that allows different users to use Chrome on the same computer in a completely separate space. The support page is quite light on information. Is there information available about the security of this particular feature? What sort of...
2013/07/18
[ "https://security.stackexchange.com/questions/39127", "https://security.stackexchange.com", "https://security.stackexchange.com/users/-1/" ]
It is not a true sandbox. It is more a way to keep several "profiles" in a way similar to what Mozilla/Firefox have always done: basically, each such "user" will have his own set of cookies and browsing history, but, at the OS level, there is just one Chrome and one user account. The normal Chrome "sandboxing" is activ...
As the page states (in the yellow box) this are only different profiles. So in one user folder several profiles are generated. This users are not really isolated against each other. To secure the users against each other you have to use different OS users.
496,421
I am using beamer representation. I want to keep the number of the lemma's same through different slides. I do not want to renumber the same lemma in different slide ``` \documentclass{beamer} %\usetheme{Boadilla} \usetheme{Madrid} \usepackage{bibentry} \usepackage[linesnumbered,ruled,vlined]{algorithm2e} \setbeamert...
2019/06/19
[ "https://tex.stackexchange.com/questions/496421", "https://tex.stackexchange.com", "https://tex.stackexchange.com/users/173138/" ]
Welcome to TeX-SE! IMHO there is no need to use two slides, `\pause` suffices, and if you really want the title only on the first frame, use `\frametitle<1>{Outline}`. ``` \documentclass{beamer} \usetheme{Madrid} \setbeamertemplate{theorems}[numbered] \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \begin{docum...
I would put both the lemma and the proof on one slide with overlays, and show the proof on the second subslide. ``` \documentclass{beamer} \usetheme{Madrid} \setbeamertemplate{theorems}[numbered] \begin{document} \frame{\frametitle{Outline} \begin{lemma} If $d$ is a $a$ then it is \end{lemma} \onslide<2>{% \begin{p...
496,421
I am using beamer representation. I want to keep the number of the lemma's same through different slides. I do not want to renumber the same lemma in different slide ``` \documentclass{beamer} %\usetheme{Boadilla} \usetheme{Madrid} \usepackage{bibentry} \usepackage[linesnumbered,ruled,vlined]{algorithm2e} \setbeamert...
2019/06/19
[ "https://tex.stackexchange.com/questions/496421", "https://tex.stackexchange.com", "https://tex.stackexchange.com/users/173138/" ]
Welcome to TeX-SE! IMHO there is no need to use two slides, `\pause` suffices, and if you really want the title only on the first frame, use `\frametitle<1>{Outline}`. ``` \documentclass{beamer} \usetheme{Madrid} \setbeamertemplate{theorems}[numbered] \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \begin{docum...
This resets the lemma number every time you start a new frame. BTW, finding the counter names for lemma and frame was not easy. ``` \documentclass{beamer} %\usetheme{Boadilla} \usetheme{Madrid} \usepackage{bibentry} \usepackage[linesnumbered,ruled,vlined]{algorithm2e} \setbeamertemplate{theorems}[numbered] %\usepac...
17,958,686
I have a list which may or may not be displayed on the screen. What I have to do now is check whether all the li in that list is visible or not. If the li indeed is visible then I want the iteration to stop and then get that particular element. My attempt:- ``` var getList = $("ul li").each(function(){ ...
2013/07/30
[ "https://Stackoverflow.com/questions/17958686", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1204312/" ]
You could simply do this: ``` var $firstVisible = $('ul li:visible').first(); ```
*edit* — do what @elclanrs answered for this particular problem; what's below is for when you can't do it with a clever built-in selector trick. --- You can have the callback set a variable: ``` var visibleOne; $("ul li").each(function(){ if ($(this).is(':visible')) { visibleOne = this; // or $(this) if you pr...
17,958,686
I have a list which may or may not be displayed on the screen. What I have to do now is check whether all the li in that list is visible or not. If the li indeed is visible then I want the iteration to stop and then get that particular element. My attempt:- ``` var getList = $("ul li").each(function(){ ...
2013/07/30
[ "https://Stackoverflow.com/questions/17958686", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1204312/" ]
You could simply do this: ``` var $firstVisible = $('ul li:visible').first(); ```
`$.is()` returns a boolean, so: `return $(this).is(":visible") ? false: true;` is unnecessary. If you wanted to return the element, form your conditional as follows: ``` $("ul li").each(function(){ if($(this).is(":visible")) { return $(this); } }); ``` Using `return` here will break the loop. It's a commo...
8,702,937
I am not a professional web-developer but I am designing one to help out a no-profit organization. I spent a couple of days searching the web for instructions and explanations on css, float, position, etc. Finally I managed to design the layout I wanted with the behaviour I wanted but there is still something that is n...
2012/01/02
[ "https://Stackoverflow.com/questions/8702937", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1126464/" ]
First of all, `position: absolute` can be a Very Bad Thing. Avoid it unless trying to take elements out of the flow of the page (having one element appear on top of another). Second, `height: 100%` does not do what, intuitively, you'd think it does. You're setting the height of the menu div to 100% of the *viewport's*...
I think that the easiest way to acomplish what you're trying to acomplish is to put everything in a wrapper div, like this: ``` <div class="wrapper"> <div class="Fascione">...</div> <div class="Menu">...</div> <div class="Contenuto">...</div> </div> ``` Then height: 100% on Menu and min-height on both ...
1,240,215
This code works on one machine but not the other: ``` puts 1.upto(5) ``` On the working machine, the code returns '#'. On the other machine, I get this error: test.rb:1:in `upto': no block given (LocalJumpError) from test.rb:1 Both machines have rails 2.2.2. The machine where this code works has ruby 1.8.7, whil...
2009/08/06
[ "https://Stackoverflow.com/questions/1240215", "https://Stackoverflow.com", "https://Stackoverflow.com/users/123254/" ]
Yes turns out in ruby 1.8.6 upto requires a block, while 1.8.7 a block is not necessary. So solution is either to upgrade to 1.8.7 or use a block or do 1...4.to\_a.
To get the 1.8.7+ behaviour in 1.8.6 you can do: ``` require 'enumerator' 1.enum_for(:upto, 5) ``` Which works the same on all versions and is functionally equivalent to 1.upto(5) without block in 1.8.7+ (though a little more verbose). Though in this specific case you can of course just use a range.
1,814,542
I'm trying to prove that the subfields of a Galois Field $GF$ of order $p^n$ are isomorphic to a Galois field of order $p^r$ where $r|n$, and that there exists a unique subfield for each such $r$. I see that generally people use the Frobenius automorphism to prove this, but in my text I am not given any real relation b...
2016/06/05
[ "https://math.stackexchange.com/questions/1814542", "https://math.stackexchange.com", "https://math.stackexchange.com/users/306685/" ]
If $r | n$, then the polynomial $x^{p^r}-x$ divides $x^{p^n}-x$, So, the set of zeros of $x^{p^r}-x$ is a subset of the set of zeros of $x^{p^n}-x$. The former set is $GF(p^r)$, and the latter set is $GF(p^n)$. This proves the existence of a subfield $GF(p^r)$ if $r | n$. For uniqueness the part, observe that if $GF(...
Hints (let me know if you want more than this): 1) For the order, consider that if $L$ is a finite field of order $p^n$ and $K$ is a subfield, then $L$ is a vector space over $K$ (of finite dimension since $L$ is finite!). What are the implications for $K$'s order? 2) For the existence of a subfield of given order $p...
11,485,610
I need to parse some large (2 Gb+) files into python. I have tried it with the json module but I get a memory error as its methods all load the files at once. I then moved on into installing ijson which suposedly implements a iterator-based way of parsing the file. However when I run: import ijson I get exception : ...
2012/07/14
[ "https://Stackoverflow.com/questions/11485610", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1525838/" ]
Check your HTML carefully and look for a mistyped `?>` where you intended a `/>`.
Rather than using curly braces, you may try using the colon notation as seen below. ``` <?php session_start(); if ($_SESSION['username']): ?> ... <?php else: header("location: index.php"); endif; ```
11,485,610
I need to parse some large (2 Gb+) files into python. I have tried it with the json module but I get a memory error as its methods all load the files at once. I then moved on into installing ijson which suposedly implements a iterator-based way of parsing the file. However when I run: import ijson I get exception : ...
2012/07/14
[ "https://Stackoverflow.com/questions/11485610", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1525838/" ]
Opening and closing curly brackets in between files is currently not possible. If you attempt to do this it will result in an "unexpected $end" syntax error. I'm not sure what exactly you are shooting for but based on your comments you should be doing something like the following. You should have 1 file you can name ...
Rather than using curly braces, you may try using the colon notation as seen below. ``` <?php session_start(); if ($_SESSION['username']): ?> ... <?php else: header("location: index.php"); endif; ```
11,485,610
I need to parse some large (2 Gb+) files into python. I have tried it with the json module but I get a memory error as its methods all load the files at once. I then moved on into installing ijson which suposedly implements a iterator-based way of parsing the file. However when I run: import ijson I get exception : ...
2012/07/14
[ "https://Stackoverflow.com/questions/11485610", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1525838/" ]
Opening and closing curly brackets in between files is currently not possible. If you attempt to do this it will result in an "unexpected $end" syntax error. I'm not sure what exactly you are shooting for but based on your comments you should be doing something like the following. You should have 1 file you can name ...
Check your HTML carefully and look for a mistyped `?>` where you intended a `/>`.
11,784,038
I have an image container with height 100% and an image fitting the height (made with display:inline). What I wanna do now is making the container width shrink to fit the resized image. The Problem: The container shrinks to the ORIGINAL Size of the image, not the resized version.
2012/08/02
[ "https://Stackoverflow.com/questions/11784038", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1176439/" ]
I suggest that it will be better to use `BufferedReader` instead of `InputStreamReader`. The parsing part of your task does not seem very hard now.
Patterns are great, but you should use them only when they make sense. No special pattern required here: just iterate over the files; for each file, read it, and do the inserts as required. The program should not take up more than 50 lines in a single file/class with a main[] method. Small, clean code is much better th...
62,686,737
I have a folder which contains XLSX file (TDMS file converted to XLSX). I want to replace comma by dot in column A. The data in column A have the following format : 2020/06/12 16:07:12,465 I want the format to change to be like this : 2020/06/12 16:07:12.465 In order to plot the data stored in these files using softwar...
2020/07/01
[ "https://Stackoverflow.com/questions/62686737", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13849963/" ]
When you write `Set wbSource = Workbooks.Open(myfile)`, myfile becomes the active workbook. The active worksheet will be whichever worksheet was active when the workbook was last saved. You next write `Columns("A").Replace ...` . This statement operates on the active worksheet. If the wrong worksheet is active, this s...
Ok I tried what you said and it worked. At first it replace all my data in column A by *.* I removed the "\*" character and seems to be better now. But it's still not doing what CTRL+H is doing to my data (preserving the formatting). I'll include screenshots so it's easier to understand what is happening. The file lo...
62,686,737
I have a folder which contains XLSX file (TDMS file converted to XLSX). I want to replace comma by dot in column A. The data in column A have the following format : 2020/06/12 16:07:12,465 I want the format to change to be like this : 2020/06/12 16:07:12.465 In order to plot the data stored in these files using softwar...
2020/07/01
[ "https://Stackoverflow.com/questions/62686737", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13849963/" ]
I solved my problem to convert XLSX file to CSV with the proper formatting I wanted for the Time column (column A). I did it in Python since Excel wasn't doing the job correctly using VBA. Here is the Python code that successfully convert XLSX which were initially TDMS file to CSV file for plotting in DatPlot or what...
When you write `Set wbSource = Workbooks.Open(myfile)`, myfile becomes the active workbook. The active worksheet will be whichever worksheet was active when the workbook was last saved. You next write `Columns("A").Replace ...` . This statement operates on the active worksheet. If the wrong worksheet is active, this s...
62,686,737
I have a folder which contains XLSX file (TDMS file converted to XLSX). I want to replace comma by dot in column A. The data in column A have the following format : 2020/06/12 16:07:12,465 I want the format to change to be like this : 2020/06/12 16:07:12.465 In order to plot the data stored in these files using softwar...
2020/07/01
[ "https://Stackoverflow.com/questions/62686737", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13849963/" ]
I solved my problem to convert XLSX file to CSV with the proper formatting I wanted for the Time column (column A). I did it in Python since Excel wasn't doing the job correctly using VBA. Here is the Python code that successfully convert XLSX which were initially TDMS file to CSV file for plotting in DatPlot or what...
Ok I tried what you said and it worked. At first it replace all my data in column A by *.* I removed the "\*" character and seems to be better now. But it's still not doing what CTRL+H is doing to my data (preserving the formatting). I'll include screenshots so it's easier to understand what is happening. The file lo...
26,273,252
Html code ``` <table id="tblRenewalsStatus" class="bor-bot" width="100%" cellspacing="0" cellpadding="0" border="0"> <tbody> <tr id="trVerifyPayment"> <tr id="trAssignAgent"> <tr id="trAssigned"> <tr id="trPayAgent" style="display: none;"> <tr id="trPaymentVerificationPending" style="display: none;"> <tr id="trInProgr...
2014/10/09
[ "https://Stackoverflow.com/questions/26273252", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2257288/" ]
``` List<WebElement> id_elements = driver.findElements(By.xpath("//table[@id='tblRenewalsStatus']//tr")); ArrayList<String> tr_id= new ArrayList<String>(); for(WebElement ele : id_elements) { String style = ele.getAttribute("style"); if(style==null||style=="") { Strin...
problem about finding element without some attribute is solved here: <https://stackoverflow.com/a/18774549/2131257> and for find all element**s** is used method ``` driver.findElements(By.id("element_id")) ``` which return list of elements instead of ``` driver.findElement(By.id("element_id")) ``` which retu...
26,273,252
Html code ``` <table id="tblRenewalsStatus" class="bor-bot" width="100%" cellspacing="0" cellpadding="0" border="0"> <tbody> <tr id="trVerifyPayment"> <tr id="trAssignAgent"> <tr id="trAssigned"> <tr id="trPayAgent" style="display: none;"> <tr id="trPaymentVerificationPending" style="display: none;"> <tr id="trInProgr...
2014/10/09
[ "https://Stackoverflow.com/questions/26273252", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2257288/" ]
``` WebElement RenewalTable = driver .findElement(By.id("tblRenewalsStatus")); List<WebElement> allRows = RenewalTable.findElements(By.tagName("tr")); ArrayList<String> enableRow = new ArrayList<String>(); for (WebElement eachElement : allRows) { String style = eachE...
problem about finding element without some attribute is solved here: <https://stackoverflow.com/a/18774549/2131257> and for find all element**s** is used method ``` driver.findElements(By.id("element_id")) ``` which return list of elements instead of ``` driver.findElement(By.id("element_id")) ``` which retu...
26,273,252
Html code ``` <table id="tblRenewalsStatus" class="bor-bot" width="100%" cellspacing="0" cellpadding="0" border="0"> <tbody> <tr id="trVerifyPayment"> <tr id="trAssignAgent"> <tr id="trAssigned"> <tr id="trPayAgent" style="display: none;"> <tr id="trPaymentVerificationPending" style="display: none;"> <tr id="trInProgr...
2014/10/09
[ "https://Stackoverflow.com/questions/26273252", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2257288/" ]
``` List<WebElement> id_elements = driver.findElements(By.xpath("//table[@id='tblRenewalsStatus']//tr")); ArrayList<String> tr_id= new ArrayList<String>(); for(WebElement ele : id_elements) { String style = ele.getAttribute("style"); if(style==null||style=="") { Strin...
``` WebElement RenewalTable = driver .findElement(By.id("tblRenewalsStatus")); List<WebElement> allRows = RenewalTable.findElements(By.tagName("tr")); ArrayList<String> enableRow = new ArrayList<String>(); for (WebElement eachElement : allRows) { String style = eachE...
17,450,085
I have been trying to think a way to traverse a single linked list. This is so far what I have done: ``` #include <iostream> typedef struct node { int data; // will store information node *next; // the reference to t...
2013/07/03
[ "https://Stackoverflow.com/questions/17450085", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1114357/" ]
Instead of `if (traverse->next == NULL)` try `if (traverse == NULL)` This way, you print the current node if it's an actual node with data in it. You then recurse. Ultimately, at the end you will recurse into a `NULL` pointer, which you can easily escape.
Why don't you interchange these statements? ``` traverse=traverse->next; printList(traverse); cout << traverse->data << endl; ``` This should be changed to: ``` cout << traverse->data << endl; traverse=traverse->next; printList(traverse); ``` This should work. And then, change ``` if(traverse->next==NULL) ``` ...
17,450,085
I have been trying to think a way to traverse a single linked list. This is so far what I have done: ``` #include <iostream> typedef struct node { int data; // will store information node *next; // the reference to t...
2013/07/03
[ "https://Stackoverflow.com/questions/17450085", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1114357/" ]
Instead of `if (traverse->next == NULL)` try `if (traverse == NULL)` This way, you print the current node if it's an actual node with data in it. You then recurse. Ultimately, at the end you will recurse into a `NULL` pointer, which you can easily escape.
As an answer to the second part, your code could look like this: ``` void printList_iter(node* node) { while (node) { cout << node->data << endl; node = node->next; } } ``` This will loop through the list, printing each element until it gets to a NULL node, which signifies the end of the ...
17,450,085
I have been trying to think a way to traverse a single linked list. This is so far what I have done: ``` #include <iostream> typedef struct node { int data; // will store information node *next; // the reference to t...
2013/07/03
[ "https://Stackoverflow.com/questions/17450085", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1114357/" ]
There are a few things here: --- In `main()` the **way you are creating the list** is incorrect. Draw what you're doing, you'll realize that your `head` is the last item in the list, i.e., it will probably have a value of 9. (Print out head's value just before you call printList to verify this). Let me explain (foll...
Instead of `if (traverse->next == NULL)` try `if (traverse == NULL)` This way, you print the current node if it's an actual node with data in it. You then recurse. Ultimately, at the end you will recurse into a `NULL` pointer, which you can easily escape.
17,450,085
I have been trying to think a way to traverse a single linked list. This is so far what I have done: ``` #include <iostream> typedef struct node { int data; // will store information node *next; // the reference to t...
2013/07/03
[ "https://Stackoverflow.com/questions/17450085", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1114357/" ]
There are a few things here: --- In `main()` the **way you are creating the list** is incorrect. Draw what you're doing, you'll realize that your `head` is the last item in the list, i.e., it will probably have a value of 9. (Print out head's value just before you call printList to verify this). Let me explain (foll...
Why don't you interchange these statements? ``` traverse=traverse->next; printList(traverse); cout << traverse->data << endl; ``` This should be changed to: ``` cout << traverse->data << endl; traverse=traverse->next; printList(traverse); ``` This should work. And then, change ``` if(traverse->next==NULL) ``` ...
17,450,085
I have been trying to think a way to traverse a single linked list. This is so far what I have done: ``` #include <iostream> typedef struct node { int data; // will store information node *next; // the reference to t...
2013/07/03
[ "https://Stackoverflow.com/questions/17450085", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1114357/" ]
There are a few things here: --- In `main()` the **way you are creating the list** is incorrect. Draw what you're doing, you'll realize that your `head` is the last item in the list, i.e., it will probably have a value of 9. (Print out head's value just before you call printList to verify this). Let me explain (foll...
As an answer to the second part, your code could look like this: ``` void printList_iter(node* node) { while (node) { cout << node->data << endl; node = node->next; } } ``` This will loop through the list, printing each element until it gets to a NULL node, which signifies the end of the ...
74,356,623
I have a component which has the following - ``` {tree[treeType].count > 0 ? tree[treeType].count : null} ``` The aim of it is to show the count only when count is greater than 0 but **it should be shown inside () these brackets** If the count is 0 nothing should be shown I have tried to go with - `({tree[treeType]...
2022/11/08
[ "https://Stackoverflow.com/questions/74356623", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13796424/" ]
This will print the next 10 odd number if value is even , and the next even numbers if the value is odd. ```js const evenOrOdd = () => { const value = parseInt(document.getElementById('evenField').value); if (value) { document.getElementById('console-log').innerHTML = "<br />" + `${value} is an ${ value % 2 ==...
Try this **:** ```js function evenOrOdd(val) { let value = parseInt(val); if(value%2==1){ console.log(`${value} is an odd number next 10 digit will be`); printNumbers(value); }else{ console.log(`${value} is an even number next 10 digit will be`); printNumbers(value); } } function printNumb...
41,054,140
I have created this row with bootstrap 3: ``` <div class="cart"> <div class="row border"> <div class="col-md-8 desc pad itemsheight"> <div class="col-md-12"> <!-- react-text: 141 -->Docos <!-- /react-text --> <!-- react-text: 142 -->channel package <!-- /react-text --> </div> <div...
2016/12/09
[ "https://Stackoverflow.com/questions/41054140", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5390873/" ]
I used flex display to vertical align the contents. ``` .vCenterItems { display: flex; align-items: center; } ``` Also removed height from each individual elements and applied to parent element only. This will be easier to change height. [See it in action](http://codepen.io/anon/pen/MbXdLy)
> > try this, may be this will help you > > > ```css /*************Cart******************/ .center-block { margin-left:auto; margin-right:auto; display:block; } // in case your dealing with a inline element apply this to the parent .text-center { text-align:center } .children{ position...
41,054,140
I have created this row with bootstrap 3: ``` <div class="cart"> <div class="row border"> <div class="col-md-8 desc pad itemsheight"> <div class="col-md-12"> <!-- react-text: 141 -->Docos <!-- /react-text --> <!-- react-text: 142 -->channel package <!-- /react-text --> </div> <div...
2016/12/09
[ "https://Stackoverflow.com/questions/41054140", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5390873/" ]
> > try this, may be this will help you > > > ```css /*************Cart******************/ .center-block { margin-left:auto; margin-right:auto; display:block; } // in case your dealing with a inline element apply this to the parent .text-center { text-align:center } .children{ position...
You may try with css property `display: table` to parent and `display: table-cell` to the child, Where we can achieve the content to align vertically centre and it also have an browser compatablity.