identifier

Getting User's Token Subject Identifier (sub) From Within Azure AD

余生颓废 提交于 2019-11-30 14:14:05
问题 My web app is using multiple OAuth 2.0 Identity Providers, and would like to retrieve the ' sub ' from the id_token of the Access Token Response and match it with one stored in my app's DB, since ' sub ' is an unique id across whatever system the user is at, and it's a stand field in the id_token. My question is: Is there an obvious/convenient way to retrieve a user's Token Subject Identifier (aka sub ) from within Azure AD portal? I know ' Object ID ' (aka Object Identifier or oid ) is part

Select multiple columns with dplyr::select() with numbers as names

时间秒杀一切 提交于 2019-11-30 13:56:36
Let's say I have the following data frame: a <- runif(10) dd <- as.data.frame(t(a)) names(dd) <- c("ID", "a", "a2", "b", "b2", "f", "XXX", "1", "4", "8") In dplyr , there is a nice way to select a number of columns. For example, to select the columns between column a and column f , I can use dd %>% dplyr::select(a:f) In my problem, the columns of the last part of the data frame may vary, yet they always have as name a number between 1 and 99. However, I can not seem to be able to do the same trick as above: > dd %>% select(1:99) Error: Position must be between 0 and n > dd %>% select("1":"99")

Best method to generate unique filenames when uploading files PHP [duplicate]

北慕城南 提交于 2019-11-30 11:08:55
This question already has an answer here: Unique and temporary file names in PHP? 9 answers Can any one suggest the best practice to generate unique file names for file uploads to avoid duplicate Entries? Thanks In Advance. I usually either create a UID using uniqid() function for the filename or create a folder with the name of the username who is uploading the file and leave the original filename. The disadvantage of the first one is that you will have to save the original filename somewhere to show to the user. This function may help: http://php.net/manual/en/function.uniqid.php You may

Getting User's Token Subject Identifier (sub) From Within Azure AD

♀尐吖头ヾ 提交于 2019-11-30 10:20:26
My web app is using multiple OAuth 2.0 Identity Providers, and would like to retrieve the ' sub ' from the id_token of the Access Token Response and match it with one stored in my app's DB, since ' sub ' is an unique id across whatever system the user is at, and it's a stand field in the id_token. My question is: Is there an obvious/convenient way to retrieve a user's Token Subject Identifier (aka sub ) from within Azure AD portal? I know ' Object ID ' (aka Object Identifier or oid ) is part of the user profile at the Azure AD portal. However, ' oid ' is not a standard field in the JWT id

Remove first levels of identifier in array

两盒软妹~` 提交于 2019-11-30 07:04:22
问题 I think this has been up before, but could'nt find any answer to it. If it's already answered please point me in the right direction with a link. I have an array that I wan't to remove the first levels of identifier. I think there is a function for this? Example of how it is: [0] => Array ( [8] => Röd ) [1] => Array ( [8] => Blå ) [2] => Array ( [6] => Bobo ) [3] => Array ( [8] => Grön ) [4] => Array ( [7] => Sten ) [5] => Array ( [8] => Vit ) [6] => Array ( [7] => Guld ) [7] => Array ( [6] =

Python globals, locals, and UnboundLocalError

别来无恙 提交于 2019-11-30 07:00:54
问题 I ran across this case of UnboundLocalError recently, which seems strange: import pprint def main(): if 'pprint' in globals(): print 'pprint is in globals()' pprint.pprint('Spam') from pprint import pprint pprint('Eggs') if __name__ == '__main__': main() Which produces: pprint is in globals() Traceback (most recent call last): File "weird.py", line 9, in <module> if __name__ == '__main__': main() File "weird.py", line 5, in main pprint.pprint('Spam') UnboundLocalError: local variable 'pprint'

Ways to create a unique user fingerprint in PHP

会有一股神秘感。 提交于 2019-11-30 06:31:15
问题 What is the best way to generate a 'fingerprint' of user unique-ness in PHP? For example: I could use a user's IP address as the 'fingerprint', however, there could be multiple other users on the same IP I could use the user's IP + user agent as the 'fingerprint', however, a single user could simply swap from safari to firefox and again be seen as being unique Ideally, the fingerprint so label the 'machine' rather than browser or 'ip' but I can't think of how this is achievable. Open to ideas

Python underscore as a function parameter

丶灬走出姿态 提交于 2019-11-30 06:13:47
I have a python specific question. What does a single underscore _ as a parameter means? I have a function calling hexdump(_) . The _ was never defined, so I guess it has some special value, I could not find a reference telling me what it means on the net. I would be happy if you could tell me. In Python shells, the underscore ( _ ) means the result of the last evaluated expression in the shell: >>> 2+3 5 >>> _ 5 There's also _2 , _3 and so on in IPython but not in the original Python interpreter. It has no special meaning in Python source code as far as I know, so I guess it is defined

Can't change bundle ID in project, greyed out

你离开我真会死。 提交于 2019-11-30 05:36:11
I'm having a problem with bundle identifiers. In the Summary section of my project in Xcode and under 'Identifiers', I can't seem to change the name of my bundle ID as it is greyed out. For example, my project name is 'My App'. In the identifier text box in Summary, it says this 'My-App' and is greyed out. However, my bundle id in my provisioning profile is this, 'com.mycompany.myapp'. I would like to change my bundle ID in my project to that but I can't seem to be able to. Any ideas why it is greyed out? Thanks! Not sure why this is happening to you, but try to change in the info.plist file.

How to check if a string is a valid python identifier? including keyword check?

浪子不回头ぞ 提交于 2019-11-30 04:42:09
Does anyone know if there is any builtin python method that will check if something is a valid python variable name, INCLUDING a check against reserved keywords? (so, ie, something like 'in' or 'for' would fail...) Failing that, does anyone know of where I can get a list of reserved keywords (ie, dyanamically, from within python, as opposed to copy-and-pasting something from the online docs)? Or, have another good way of writing your own check? Surprisingly, testing by wrapping a setattr in try/except doesn't work, as something like this: setattr(myObj, 'My Sweet Name!', 23) ...actually works!