Essentially I want to do something like this:  class foo:     x = 4     @property     @classmethod     def number(cls):         return x   Then I would like the following to work:      &gt;&gt;&gt; foo.number 4   Unfortunately, the above doesn't work. Instead of given me 4 it gives me &lt;property object at 0x101786c58&gt;. Is there any way to achieve the above?
I have a class with two class methods (using the classmethod() function) for getting and setting what is essentially a static variable.  I tried to use the property() function with these, but it results in an error.  I was able to reproduce the error with the following in the interpreter: class Foo(object):     _var = 5     @classmethod     def getvar(cls):         return cls._var     @classmethod     def setvar(cls, value):         cls._var = value     var = property(getvar, setvar)  I can demonstrate the class methods, but they don't work as properties: &gt;&gt;&gt; f = Foo() &gt;&gt;&gt; f.getvar() 5 &gt;&gt;&gt; f.setvar(4) &gt;&gt;&gt; f.getvar() 4 &gt;&gt;&gt; f.var Traceback (most recent call last):   File &quot;&lt;stdin&gt;&quot;, line 1, in ? TypeError: 'classmethod' object is not callable &gt;&gt;&gt; f.var=5 Traceback (most recent call last):   File &quot;&lt;stdin&gt;&quot;, line 1, in ? TypeError: 'classmethod' object is not callable  Is it possible to use the property() function with @classmethod decorated functions?
Block of equations with only some being subequations I'm trying to make a block of equations where the first two are standalone equations, and the second two are subequations, ie  X=XXXX (1)  X=XXXX (2)  X=XXXX (3a)  =XXXX (3b)  I'm using the amsmath package, with align and subequation, but I can't figure out how to do this without making a separate block for Eqs 1-2 and one for Eqs 3a-3b. That solution is unsatisfactory, because then there is a big vertical gap between the two blocks, and I want them to appear all as one.  Here's the code I have so far, in case it's unclear.  \begin{align} T(x) &amp;= \frac{m}{2{k_{B}}} \left\langle \mathbf{\tilde{v}}{(\mathbf{x}_{i},t)}^{2} \right\rangle\\  \mathbf{u}(x) &amp;= \left\langle \mathbf{v}_{i}(\mathbf{x}_{i},t) \right\rangle \end{align} \begin{subequations}  \begin{align} P_{xy}(x) &amp;= \frac{1}{A} \left\langle \sum\limits_{i} {m \tilde{v}_{i,x} \tilde{v}_{i,y}} + \frac{1}{2} \sum\limits_{i} {\sum\limits_{j\ne i} {r_{ij,y} F_{ij,x}}} \right\rangle \\ \begin{split}  &amp;=\frac{m}{A} \Bigg\langle \sum\limits_{i}{{{{\tilde{v}}}_{i,x}}{{{\tilde{v}}}_{i,y}}} + \frac{a^3\omega _{pd}^2}{4} \\  &amp;\quad \times \sum\limits_{i}{\sum\limits_{j\ne i}{r_{ij,y}{\left\{ \frac{e^{(-{{r}_{ij}}/\lambda )}}{{{r}_{ij}}}\left( \frac{1}{r_{ij}}+\frac{1}{\lambda} \right) \right\}_{x}}}} \Bigg\rangle \end{split} \end{align} \end{subequations}   Any suggestions would be greatly appreciated! What is a word that means "someone who pretends to be your friend but is actually your enemy?" What do you call someone who pretends to be your friend but is actually your enemy?  A friend suggested spy for me, but that does not nearly describe the word I need for an English project. The character is very good at manipulating how people see him. He's a good liar. And pretends to be your friend but actually is your enemy. Why did Harry's father emerge before his mother in HP and the Goblet of Fire? In Harry Potter book 4 (Goblet of Fire) Harry's wand 'links' with Voldemort's during their duel, and Voldemort's wand begins 'spitting out' each spell it had cast, in reverse order.  This produces false 'ghosts' of people he had killed with .  In the US printing, James Potter appears, followed by Lily.  If the spell order was supposed to be reversed, why did Harry's father's "ghost" emerge before his mother's, since it's repeatedly stated (before and after) that he died first? Custom post type - posts list - white screen of death i am getting a weird error - white screen in the list of posts for a specific Custom post type (just for that one)   tried deactivating all the plugins tried checking for error (debugging = true)   Still nothing the page just doesnt echos anything... (nothing in source too)  I am talking about such a url in the admin:     Here is register_post_type part i am using:    function register_submodelcpt() {     $labels = array(         'name'                  =&gt; __('Sub Models', THEME_NAME),         'singular_name'         =&gt; __('Sub Models', THEME_NAME),         'add_new'               =&gt; __('New Model', THEME_NAME),         'add_new_item'          =&gt; __('Add new Model', THEME_NAME),         'edit_item'             =&gt; __('Edit Model', THEME_NAME),         'new_item'              =&gt; __('New Model', THEME_NAME),         'all_items'             =&gt; __('All Sub Models', THEME_NAME),         'view_item'             =&gt; __('Watch Model', THEME_NAME),         'search_items'          =&gt; __('Search Models', THEME_NAME),         'not_found'             =&gt;  __('No Models found', THEME_NAME),         'not_found_in_trash'    =&gt; __('No Models found in trash', THEME_NAME),          'parent_item_colon'     =&gt; '',         'menu_name'             =&gt; __('Sub Models', THEME_NAME),      );      $args = array(         'labels'                =&gt; $labels,         'public'                =&gt; true,         'publicly_queryable'    =&gt; true,         'show_ui'               =&gt; true,          'show_in_menu'          =&gt; true,          'query_var'             =&gt; true,         'rewrite'               =&gt; array('slug' =&gt; 'submodels'),         'capability_type'       =&gt; 'post',         'has_archive'           =&gt; true,          'hierarchical'          =&gt; true,         'menu_position'         =&gt; 5,         'menu_icon'             =&gt; get_stylesheet_directory_uri().'/images/cpt/subcars.png',                     'supports'              =&gt; array('title', 'thumbnail', 'revisions', 'page-attributes')     );      register_post_type('submodelscpt',$args); } add_action('init', 'register_submodelcpt');   Did anyone encounter such an issuse? can you think of a reason this might happen?   Another weird thing when i change this:    To this:     The posts list loads correctly... What characters/symbols are allowed within the CSS class selectors? I know that the following characters are invalid, but what characters are valid?  ~ ! @ $ % ^ &amp; * ( ) + = , . / ' ; : " ? &gt; &lt; [ ] \ { } | ` # Do I have to use “do” in any “wh-” question? Since a while, 2 weeks, Dropbox does not startup anymore on my laptop running Ubuntu 12.04 LTS with GNOME shell.  When I run dropbox start -i in the console I get the following output.    Starting Dropbox...Traceback (most recent call last):   File "/usr/bin/dropbox", line 1387, in &lt;module&gt;     ret = main(sys.argv)   File "/usr/bin/dropbox", line 1376, in main     result = commands[argv[i]](argv[i+1:])   File "/usr/bin/dropbox", line 1247, in start     if not start_dropbox():   File "/usr/bin/dropbox", line 731, in start_dropbox     stderr=sys.stderr, stdout=f, close_fds=True)   File "/usr/lib/python2.7/subprocess.py", line 679, in __init__     errread, errwrite)   File "/usr/lib/python2.7/subprocess.py", line 1249, in _execute_child     raise child_exception   OSError: [Errno 8] Exec format error   I already removed Dropbox and reinstalled it. What should I do to fix this? Is it possible/sensible to add a suspension fork to an old mountain bike? I have a ~1993 Giant mountain bike.  It's not great, but I am a very new and casual rider.    The bike has a solid fork and it makes for the predictable rough trail ride.  The trails are generally fairly modest (I live in North Texas, a 100' change in altitude makes our ears pop here) and the surface is generally dirt (very few rocky areas).  So, I am thinking that it would be very nice to have a suspension bike.  And seeing that a modest fork can be purchased for a modest price, I am wondering if it makes sense to add a fork to this bike.   asked about going the other direction, and there were some cautionary words about changing steering geometry.  So, on balance, is this something that I would be best off to avoid?  I suspect that if I have to replace a bunch of steering parts, the cost will quickly approach that of a new low end bike. How do I get my device detected by ADB on Linux? I just got my shiny new Wileyfox Swift – and before putting it to use I want to oem unlock and root it (as I usually do with new devices ;) Trouble is, though  is enabled on the device, and a corresponding line in /etc/udev/rules.d/51-android.rules exists, the device is not seen by adb devices.  I know there are several answers scattered around this site, but they are either hard to find, just cover a specific device, or don't cover all steps I finally needed. So I take this as a chance for a canonical, device-independent question and give it a detailed answer below:  How can I get my Android device seen and used by adb on Linux? Here is my question:  Is a homeomorphism, that is, a continuos function whose inverse function is also continuous, always bijective? Combinations of fields to be unique I have a custom object. I want to put in a business rule so that a combination of two fields must be unique.   So I have Field1 and Field2 and want the combination to be unique:  Field1=4, Field2=7 Field1=4, Field2=8   is ok  But,   Field1=4, Field2=7 Field1=4, Field2=7   is not ok  What is the easiest / best way to do this? Thanks. File being used by another process after using File.Create() I have an accompanied visa with my grandparents but because of some reason they cannot travel with me. I am above 17 years. Can I travel alone and will I be allowed to enter UK as my real aunt puts up there? java.lang.LinkageError: javax.servlet.jsp.JspApplicationContext.getExpressionFactory Prove that the square root of a positive integer is either an integer or irrational Is my proof that the square root of a positive integer is either an integer or an irrational number correct?  The proof goes like this:  Suppose an arbitrary number n, where n is non-negative. If $\sqrt{n}$ is an integer, then $\sqrt{n}$ must be rational. Since $\sqrt{n}$ is an integer, we can conclude that n is a square number, that is  for some integer a.  Therefore, if n is a square number, then $\sqrt{n}$ is rational.  Suppose now that n is not a square number, we want to show that the square root of any non-square number is irrational.  We prove by contradiction. That is, we suppose that the square root of any non-square number is rational. So $\sqrt{n} = \frac{a}{b}$, where $a,b \in Z^+, b \neq 0$. We also suppose that $a \neq 0$, otherwise $\frac ab = 0$ , and n will be a square number, which is rational.   Hence $n = \frac {a^2}{b^2}$, so $nb^2 = a^2$.    Suppose $b=1$. Then $\sqrt n = a$ , which shows that n is a square number. So $b \neq 1$. Since $\sqrt n &gt; 1$, then $a&gt;b&gt;1$.  By the unique factorization of integers theorem, every positive integer greater than $1$ can be expressed as the product of its primes.  Therefore, we can write $a$ as a product of primes and for every prime number that exists in $a$, there will be an even number of primes in $a^2$. Similarly, we can express $b$ as a product of primes and for every prime number that exists in $b$, there will be an even number of primes in $b^2$.  However, we can also express $n$ as a product of primes. Since $n$ is not a square number, then there exist at least one prime number that has an odd number of primes.  Therefore, there exists at least one prime in the product of $nb^2$  that has an odd number of primes. Since $nb^2=a^2$ , then this contradicts the fact that there is an even number of primes in $a^2$ since a number can neither be even and odd.  Therefore, this contradicts the fact that $\sqrt n$ is rational. Therefore, $\sqrt n$ must be irrational.  Is this sufficient? Or is there any parts I did not explain well? Isomorphism of a product $C_n \times C_m$ of cyclic groups with the cyclic group $C_{mn}$ Will I lose previous purchases when I change country in iTunes I think the term "back and forth" gets thrown around a lot without much thought.  From Dictionary.com:         [fawrth, fohrth]      adverb    1.  onward or outward in place or space; forward: to come forth; go forth.   Wouldn't the term be more meaningful if "forth" was used first since you have to have a starting place before you can go "back"?  Examples:        I've been going back and forth from Houston to New York.   I've been going forth and back from Houston to New York.      Which is more correct? What are the dangers of accepting gifts from unknown accounts on Steam? A user named 'steamfairy1' gifted me a game on Steam. I don't know this user, their profile shows no games, no friends and zero hours played. The profile of 'steamfairy1' was created the day I received the gift.  It very much looks like a scam, but I can't figure out how the scam is supposed to work. What's the worst thing that could happen if I accept the gift? Any idea what the trick here is? It could be just a random act of kindness and I'm just paranoid…  I contacted the Steam support, but they were unhelpful as usual: responding in the wrong language and with a canned one-liner that didn't make a whole lot of sense or had much to do with my question.  Keywords (not really tags, but I want this to be searchable): steamfairy, steam fairy New to both Ruby and Rails but I'm book educated by now (which apparently means nothing, haha).  I've got two models, Event and User joined through a table EventUser  class User &lt; ActiveRecord::Base   has_many :event_users   has_many :events, :through =&gt; :event_users end  class EventUser &lt; ActiveRecord::Base   belongs_to :event   belongs_to :user    #For clarity's sake, EventUser also has a boolean column "active", among others end  class Event &lt; ActiveRecord::Base   has_many :event_users   has_many :users, :through =&gt; :event_users end   This project is a calendar, in which I have to keep track of people signing up and scratching their name out for a given event. I figure the many to many is a good approach, but I can't do something like this:  u = User.find :first active_events = u.events.find_by_active(true)   Because events don't actually HAVE that extra data, the EventUser model does.  And while I could do:  u = User.find :first active_events = [] u.event_users.find_by_active(true).do |eu|   active_events &lt;&lt; eu.event end   This seems to be contrary to "the rails way".  Can anyone enlighten me, this has been bugging me for a long time tonight (this morning)?