identifier

Is is safe to use a function accepts kwargs keyword arguments that are not identifiers?

梦想的初衷 提交于 2019-11-28 04:05:51
问题 In Python, is it safe to give keyword arguments that are not Python identifiers to a function? Here is an example: >>> '{x-y}'.format(**{'x-y': 3}) # The keyword argument is *not* a valid Python identifier '3' >>> '{x-y}'.format(x-y=3) File "<ipython-input-12-722afdf7cfa3>", line 1 SyntaxError: keyword can't be an expression I am asking this because it is more convenient for me to format with names that contain a dash (because the values correspond to command-line argument with dashes in

Device identifier of Android emulator

一世执手 提交于 2019-11-27 18:01:08
I want to test in the emulator an app that depends of the device identifier (ANDROID_ID). I currently obtain device identifier with the following code: final String deviceID = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID); When I run this in an emulator it returns null , which gives me all sort of problems. It seems that higher Android versions it returns something. Is there a way to get a device identifier in the Android emulator? Am I obtaining the device id wrongly? Maybe it's possible to set the device identifier of the emulator through the console? In

How to call on a function found on another file?

丶灬走出姿态 提交于 2019-11-27 17:26:27
I'm recently starting to pick up C++ and the SFML library, and I was wondering if I defined a Sprite on a file appropriately called "player.cpp" how would I call it on my main loop located at "main.cpp"? Here is my code (Be aware that this is SFML 2.0, not 1.6!). main.cpp #include "stdafx.h" #include <SFML/Graphics.hpp> #include "player.cpp" int main() { sf::RenderWindow window(sf::VideoMode(800, 600), "Skylords - Alpha v1"); while (window.isOpen()) { sf::Event event; while (window.pollEvent(event)) { if (event.type == sf::Event::Closed) window.close(); } window.clear(); window.draw(); window

How to get a device identifier using Phonegap

Deadly 提交于 2019-11-27 16:17:16
问题 I need to get any number, serial, key or whatever to identify every device where my phonegap app is running, I think uuid also changes when the app updates so it wouldn't work for me. The scenario here is that the user can synchronize data from the app, so I need to know which device has synchronized and which has not, or if it needs to update new data that maybe others devices have already done, etc any ideas? 回答1: <script type="text/javascript" charset="utf-8"> document.addEventListener(

Identifier normalization: Why is the micro sign converted into the Greek letter mu?

China☆狼群 提交于 2019-11-27 15:26:39
I just stumbled upon the following odd situation: >>> class Test: µ = 'foo' >>> Test.µ 'foo' >>> getattr(Test, 'µ') Traceback (most recent call last): File "<pyshell#4>", line 1, in <module> getattr(Test, 'µ') AttributeError: type object 'Test' has no attribute 'µ' >>> 'µ'.encode(), dir(Test)[-1].encode() (b'\xc2\xb5', b'\xce\xbc') The character I entered is always the µ sign on the keyboard, but for some reason it gets converted. Why does this happen? There are two different characters involved here. One is the MICRO SIGN , which is the one on the keyboard, and the other is GREEK SMALL LETTER

Are dollar-signs allowed in identifiers in C++03?

孤人 提交于 2019-11-27 14:40:45
What does the C++ standard say about using dollar signs in identifiers, such as Hello$World ? Are they legal? A c++ identifier can be composed of any of the following: _ (underscore), the digits 0-9, the letters a-z (both upper and lower case) and cannot start with a number. There are a number of exceptions as C99 allows extensions to the standard (e.g. visual studio ). They are illegal. The only legal characters in identifiers are letters, numbers, and _. Identifiers also cannot start with numbers. Arne Mertz In C++03, the answers given earlier are correct: they are illegal. In C++11 the

Hibernate error: ids for this class must be manually assigned before calling save():

╄→尐↘猪︶ㄣ 提交于 2019-11-27 12:38:23
问题 Caused by: org.springframework.orm.hibernate3.HibernateSystemException: ids for this class must be manually assigned before calling save(): com.rfid.model.Role; nested exception is org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save(): com.rfid.model.Role at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:676) at org.springframework.orm.hibernate3.HibernateAccessor

Xcode unable to dequeue a cell with identifier

萝らか妹 提交于 2019-11-27 11:56:47
问题 my work is about `UITableView. Each time I run my project, this error appears : Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'unable to dequeue a cell with identifier Cell1 - must register a nib or a class for the identifier or connect a prototype cell in a storyboard I checked a hundred times my cell identifier in my storyboard and in my code are the same. Code (defaut code from UITableViewController ) : - (UITableViewCell *)tableView:(UITableView *

Why class { int i; }; is not fully standard-conformant?

谁说我不能喝 提交于 2019-11-27 11:54:24
问题 This is a follow-up question. In the previous question, @JohannesSchaub-litb said that the following code is not fully standard-conformant: class { int i; }; //unnamed-class definition. § 9/1 allows this! and then he added, while it is grammatically valid, it breaks the rule that such a class must declare at least one name into its enclosing scope. I couldn't really understand this. What name is he talking about? Could anyone elaborate on this further (preferably quoting the Standard)? 回答1:

What is the difference between an identifier and variable?

本小妞迷上赌 提交于 2019-11-27 11:39:46
问题 I'm a bit confused about identifiers. In my textbook it says, "We use identifiers to name variables (and many other things) in Java." I'm not really sure what this means. Is it like assigning a variable...to a variable? What? So far, I'm getting this impression: int a, b, c; a = 2; b = 99; c = a + b; Is c an identifier? When it says, "Using identifiers to name variables," are identifiers like int , double , boolean , things used to categorize variables? Please provide some examples. 回答1: You