I have a many to many association such as   class User &lt; ActiveRecord::Base   has_many :working_groups   has_many :groups, :through =&gt; :working_groups  class Group &lt; ActiveRecord::Base   has_many :working_groups   has_many :users, :through =&gt; :working_groups  class WorkingGroup &lt; ActiveRecord::Base     belongs_to :user     belongs_to :group   And the Working_Groups association has some additional info about each relationship (such as order and type of membership):  create_table "working_groups", :force =&gt; true do |t|     t.integer  "group_id"     t.integer  "user_id"     t.integer  "position"     t.string   "role"     t.datetime "created_at", :null =&gt; false     t.datetime "updated_at", :null =&gt; false   In the user view, I'm trying to display a list of all the groups the user belong toand their type of membership (which is stored in the join table). The only way I found to get this done is something like this, that looks extremely ugly and not the most efficient thing ever...                Name         Role                                                                                                                                                                                                                                                  Is there a better way to do this? There must be a better way...
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)?
I'm trying to understand an algorithm that tries to map points from a lie group to its lie algebra using the exponential map. The background is the representation of 3d coordinate transformations as a lie group.  I can imagine, how one can map points on a manifold (eg a sphere) to the tangent space (tangent plane) at some point x on the sphere. I can imagine to create the tangent space by computing derivatives at that point x. But I cannot imagine how the exponential of some matrix is giving me that tangent space?  How can I envision the exponential of a matrix? Is there some picture or analogy I can use as intuition? Continuity of a convex function I'm trying to solve the following problem:  Let $f:K\rightarrow \mathbb{R} $, $f$ convex and $K \subseteq \mathbb{R}^n$ convex. Then $f$ is continuous on $K$.   I have proved the only case $n=1$, but for an arbitrary $n$?? How to apply layer style to one object and apply it to multiple layers Deleting Objects in JavaScript Is it worth using Python's re.compile? Why is the light in an airplane turned off during take off and landing? What does the tilde at the end of a file name stand for? In Windows, I believe that files with a tilde in the file name represent files that are currently open in an application. For example, Microsoft Word creates a file with almost the same name as the file you currently have open, but with a tilde in the name. It's icon is also partially faded. As far as I'm aware, this signifies a temporary file that exists   in case the application crashes and you didn't get a chance to save your file, or to allow the original file to remain unlocked by the file system and accessible to other applications.   In Linux, I ran into a *.log file with a tilde at the end of the file name (scan.log~). Does that mean the log file is currently open in another application that is potentially writing to it? How to modify existing, unpushed commit messages? I need to find limit points of the set $\{  \frac{1}{n} +\frac{1}{m} \mid n, m = 1,2,3,\dots \}$.  My try :   If both $m$ and $n$ tend to very large values say $\infty$ then the value of $\{ \frac{1}{n} +\frac{1}{m} \}$ tends to $0$, and if only one of $m$ or $n$ tends to very large values, then the set $\{ \frac{1}{n} \mid n=1,2,3,\dots\} $ acts as limit points.   So is it true that a set of limit points is $\{0\}$ $\cup$  $\{\frac{1}{k} \mid k=1,2,3,\dots \}$?  How should I write this proof rigorously? Resetting Ubuntu to factory settings I've had a lot of problems lately and now I'm having problems logging in at the login screen. I'm giving up and just want to reset and start over. How can I "factory reset" Ubuntu, in this situation, or, for future reference, in general? Predicting the number of decimal digits needed to express a rational number The number $1/6$ can be expressed with only two digits (and a repeat sign denoted as $^\overline{}$), $$ \frac{1}{6} = \,.1\overline{6}$$  Meanwhile, it takes 49 digits to express the number $1/221$, since a string of 49 digits repeats: $$\frac{1}{221} = .\overline{004524886877828054298642533936651583710407239819}$$ Yet for $1/223$, 222 digits repeat, giving a total of 224 digits needed to express the number.  If $f:\mathbb{Q}\rightarrow\mathbb{N}$ is a function that gives the smallest number of digits needed to express a rational number in decimal notation, what can we say about $f$?  For example, if we do not consider the negative sign to be a digit, then $f$ is an odd function.  Other than that, is there any pattern to it at all? A Regular Tetrahedron is a cool Polyhedron. A regular tetrahedron has this property:  For any two of its vertices exists a third vertex, which forms a regular triangle with these 2 vertices.(It doesn't necessarily have to be a face of it).  Are there any other polyhedrons that have the same property?  I think there isn't such a polyhedron. But not sure how to prove it. I've tried proving that there isn't an irregular tetrahedron with this property, assuming that there is a pair of unequal sides.   Current answers are a little confused with the conditions of the problem. Which words in a title should be capitalized? What is the difference between "I've been to China" and "I've gone to China"? Both are in the present perfect, but one uses the verb 'to go' and the other 'to be'. Is there a rule for this?  Is there any chance that the differences between "I have been" vs. "I have gone", are differences in English dialect (I don't know if this is the right word).  Edit Could I say that North American English speakers use "I have gone", and maybe U.K speakers say "I've been"? Or vice versa. What is the simplest way to convert char[] to/from tchar[] in C/C++(ms)? This seems like a pretty softball question, but I always have a hard time looking up this function because there seem there are so many variations regarding the referencing of char and tchar. %AX = (%AH + %AL)  So why not %EAX = (%SOME_REGISTER + %AX) for some register %SOME_REGISTER? In Harry Potter and the Cursed Child, why would anyone believe this rumor? From Harry Potter and the Cursed Child - Part I:     Scorpius Malfoy is talking with his best friend Albus Potter: SCORPIUS: So your dad thinks the rumors are true -- I am the son of Voldemort? ALBUS (nods): His department are currently investigating it. SCORPIUS: Good. Let them. Sometimes -- sometimes I find myself thinking -- maybe they're true too. ALBUS: No. They're not true. [...] Harry Potter and the Cursed Child, Part I - Act Two, Scene Sixteen, Hogwarts Library - Page 143 - Scholastic    Harry Potter and the Cursed Child picks up right at the point where Harry Potter and the Deathly Hallows leaves off, at the epilogue. It is nineteen years post-Hogwarts, and Scorpius Malfoy and Albus Potter are eleven-year-old first-years.   I'm about as good at math as J.K. Rowling (meaning I'm terrible at it!), so correct me if I'm wrong. Voldemort was killed at the Battle of Hogwarts in May of 1998. At least eight years post-Battle had to have passed before Albus and Scorpius were born (I'm estimating the boys were born in 2006). Voldemort would have had to have been alive in 2005/2006 in order to have ...      ... fathered Scorpius Malfoy.   As the wizarding world was fully aware of Voldemort's death in 1998, why would anyone even remotely believe that Voldemort is ...      ... Scorpius Malfoy's father?   I can understand the possibility of Harry believing the rumor because ...     ... his scar hurt, and his scar is Harry's connection to Voldemort.   But other than Harry, it doesn't make sense to me why anyone would believe such a ridiculous rumor. So, why? I use a Full HD 24" external display besides my 15" MacBook Pro Retina, on which I use the option for most screen estate regarding the Retina display. In the display arrangement screen, the MacBook Pro is therefore a bigger rectangle than the external display. Is there a way to size these rectangles regarding their "real world size" instead of resolution? I'm annoyed by my cursor teleporting vertically whenever I move from one display to another. Proving the convergence of $\sum_{n\geq 2}\log\left(1-\frac{1}{n^2}\right)$ How to prove that the series $$\sum_{n\geq 2}\log\left(1-\frac{1}{n^2}\right)$$ is convergent? What about finding the sum?  My attempt: $$\ln (1-1/n^2)= \ln(n-1) -2\ln n + \ln(n+1)$$ The term in the log is decreasing so I get the feeling that the series converges but confused how to prove this and also find the sum. Is it possible to log back into a Pokemon Go account?