I have been told that I should avoid to use self.__dict__ in my code but I can't find another way around for what I am trying to do. I just begin to work with classes so not too sure how to do this.  class variable( object ):     def __init__( self, json_fn, *args, **kwargs ):          self.metrics = self.getmetrics(json_fn)         for metric in self.metrics :             self.__dict__[metric] = self.get_metric_dataframes(metric)      def get_metric_dataframes( self , metric_name ):         '''extract and return the dataframe for a metric'''   So my object "variable" has different dataframes for different metrics stored in the json. I wanted to be able to do variable.temperature, variable.pressure , variable.whatever without having to write :  self.temperature = self.get_metric_dataframes(temperature) self.pressure = self.get_metric_dataframes(pressure) self.whatever = self.get_metric_dataframes(whatever)   Since all the dataframes are extracted with the same function taking the metric as arguments. Which is why I looped through the metrics and use   self.__dict__[metric] = self.get_metric_dataframes(metric)  So Knowing that I will never update any of those dataframes (I use copies of them in the code but don't want to update the values of the object).  Is there another solution?  The other way i could do would be to build a dictionnary with all the metric as key and dataframe as values and store it in self.metric, I could then call it with object.metric['temperature'] but I would rather do object.temperature right away and I am kind of curious to know if that can be done.  Thank you for your help!
Suppose I have a python object x and a string s, how do I set the attribute s on x? So:  &gt;&gt;&gt; x = SomeObject() &gt;&gt;&gt; attr = 'myAttr' &gt;&gt;&gt; # magic goes here &gt;&gt;&gt; x.myAttr 'magic'   What's the magic? The goal of this, incidentally, is to cache calls to x.__getattr__().
Unsized array declaration in a struct How do you prove that these four definitions of the operator norm are equivalent? $$\begin{align*} \lVert A\rVert_{\mathrm{op}} &amp;= \inf\{ c\;\colon\; \lVert Av\rVert\leq c\lVert v\rVert \text{ for all }v\in V\}\\ &amp;=\sup\{ \lVert Av\rVert\;\colon\; v\in V\text{ with }\lVert v\rVert\leq 1\}\\ &amp;=\sup\{\lVert Av\rVert\;\colon\; v\in V\text{ with }\lVert v\rVert = 1 \}\\ &amp;=\sup\left\{ \frac{\lVert Av\rVert}{\lVert v\rVert}\;\colon\; v\in V\text{ with }v\neq 0\right\}. \end{align*}$$ How do I put /home in a different partition? Yeah, so I have 2 hard drives, on with 2 partitions(backups and windows), and I have another that also has 2 partitions with only one used. I have Ubuntu on hard drive 2:partition one, but I have come to a point when the /home folder can't hold any more files, but the partition is only about 15% filled up. So I did some researching and figured out that you can put it on a separate partition, but most of the guides were vague on what I needed to do. Could someone give me step-by-step instructions on what I need to do, or even tell me a, easier or different way to fix this /home folder capacity problem? Why is len(Posts.body) incorrect on answers in data.SE? I was trying to find a longest answer on a site, and ran into a weird discrepancy:  shows that  has a length of 36388 (length in the query is defined as LEN(Posts.Body)) Yet, the post clearly only has ~26000 characters, as measured 2 ways:  Copy/pasting full text of the answer in my text editor gives me 26040 characters (the source of the answer with all the markdown, not the rendered text which is even smaller).  Trying to post a new answer that consists of this answer's text twice gives me an error &quot;Body is limited to 30000 characters; you entered 52258&quot; - meaning that the length is under 26100 (not 100% sure where the difference in counts comes from as far as two methods)   Another example from same query:  shows len(body) of 33738 whereas the text of the answer has only 29000 characters. This clearly isn't showing rendered characters, as the rendered character count is LOWER than actual answer text when editing (e.g. links add characters, as do images). How can this data.SE discrepancy be explained? I want to render an image as a background image via an inline style in twig. I created a field called bg_image and attached it to the standard plain page.  After fiddling around for hours I was able to get the Image URL in node.html.twig  {{ file_url(node.field_bg_image.0.entity.uri.value) }}   but I could not get it to work inside field--field-bg_image.html.twig  Can I get the node from there anyhow, so I can then get the image?  How can I get the image URL to use as inline style? I thought maybe I can pass a variable from field--field-bg_image.html.twig to image.html.twig and then just render  {{ uri }}   instead of  &lt;img{{ attributes.addClass(classes) }} /&gt;   but I could not get it to pass the variable there unless I use includes  {% include 'image.html.twig' with {'image': image, 'isFromField': isFromField} %}   (isFromField is true, when it comes from the field--field-bg_image.html.twig) But that didn't work either. The Image was never rendered that way.  Would be very glad if you can help - my php knowledge is very basic. Thanks After upgrading from Ubuntu 13.04 server, the www pages won't display themselves.     Error 403 Forbidden You don't have permission to access / on this server.   I've changed access control saves from apache2.2 to apache2.4, but that didn't work. What else could I do? Nautilus bookmarks are missing since upgrade to 13.04 My bookmarks are not shown anymore after upgrading to 13.04 Raring ringtails and I can't add any new bookmarks. The function is not shown and the shortcut Ctrl+D isn't working either. Is this functionality just gone for some reason (as the split screen with F3) or is there something wrong with my upgrade?  Thanks for any hints. Tight bound for $T(n) = T(n^{1/2}) + 1$ Word for the behavior of people who complain at everything you do Chrome's default search engine is .  How we can force chrome to use  without https?  I need a solution that allows proxies to rewrite my URLs, but https currently makes this impossible... How to update a pull request from forked repo? Anonymous Types - Are there any distingushing characteristics? Is there anything to use, to determine if a type is actually a anonymous type? For example an interface, etc?  The goal is to create something like the following...  //defined like... public static T Get&lt;T&gt;(this IAnonymous obj, string prop) {     return (T)obj.GetType().GetProperty(prop).GetValue(obj, null); } //...  //And then used like... var something = new { name = "John", age = 25 }; int age = something.Get&lt;int&gt;("age");   Or is that just the beauty of an anonymous type? Nothing to identify it self because it takes a new shape?  Note - I realize that you can write an extension method for the object class, but that seems like a little overkill, in my opinion. If $\tan(\frac{\pi}{4}+\frac{y}{2})=\tan^3(\frac{\pi}{4}+\frac{x}{2})$,then prove that $\sin y=\frac{\sin x(3+\sin^2 x)}{(1+3\sin^2 x)}$ If $\tan(\frac{\pi}{4}+\frac{y}{2})=\tan^3(\frac{\pi}{4}+\frac{x}{2})$,then prove that $\sin y=\frac{\sin x(3+\sin^2 x)}{(1+3\sin^2 x)}$    $\tan(\frac{\pi}{4}+\frac{y}{2})=\tan^3(\frac{\pi}{4}+\frac{x}{2})$ $\frac{1+\tan\frac{y}{2}}{1-\tan\frac{y}{2}}=(\frac{1+\tan\frac{x}{2}}{1-\tan\frac{x}{2}})^3$ Applying componendo and dividendo rule on both sides, $\tan\frac{y}{2}=\frac{\tan\frac{x}{2}(3+\tan^2\frac{x}{2})}{(1+3\tan^2\frac{x}{2})}$ I am stuck here. Homeomorphism between the unit disc and the unit square I know that the function that describes the homeomorphism is: $f(x,y) =       \begin{cases}     \frac{x^{2}+y^{2}}{\max(|x|,|y|)}(x,y) &amp;\quad\text{if } (x,y)\ne  (0,0) \\       \text{} (0,0) &amp;\quad\text{if } (x,y) =  (0,0) \\       \end{cases}$  But it's impossible to me to show that $f(x,y)$ is an homeomorphism. Mostly i can't see the injectivity. Reese's boyfriend seems to constantly be asleep. When I try and talk to him, she warns me that he's been hard at work all night, but I can't actually enter the shop at night.   Is there any way to talk to him or any benefit for doing so? I've tried to talk to him daily for a week (thinking it was something akin to talking to Sable) but I've had no luck. Trying to come in after-hours doesn't work. Question:     Let $f$ be differentiable on $[0,+\infty)$, such as$$\lim_{x\to+\infty}\left([f'(x)]^2+f^3(x)\right)=0$$show that $$\lim_{x\to\infty}f(x)=\lim_{x\to\infty}f'(x)=0$$   I think this problem is similar to  and (the  background)  For my problem I guess that if  $$\lim_{x\to+\infty}\left([f'(x)]^{2m}+f^{2n+1}(x)\right)=0,m,n\in N^{+},n,m&gt;1$$ then we have $\lim_{x\to\infty}f(x)=\lim_{x\to\infty}f'(x)=0$. If a quadrilateral has a pair of equal opposite sides, and a pair of equal opposite angles, then is it necessarily a parallelogram? I’m sorry I couldn’t upload a photo, so I’ll try to explain it as best as I can.     The quadrilateral has a pair of opposite and equal sides, and has a pair of opposite equal angles (85 degrees in the question).   Can I say this is a parallelogram or not?    I tried drawing a shape with those conditions that is not a parallelogram and I failed. Thanks in advance, and again sorry for not having a photo and I hope I explained it well enough. font-not-found error: font "HoeflerText" cannot be found -- LuaLaTex error! I am running this CV/Resume example from :   Here is a relevant fraction of the code:  \documentclass[10pt]{article} %!TEX encoding =  UTF-16 % See geometry.pdf to learn the layout options. There are lots. \usepackage[hmargin=1.25cm, vmargin=1.5cm]{geometry} %symbols - the ones you see on the left of the email and of the phone \usepackage{bbding} \usepackage{amssymb} \usepackage{eurosym} %Colors/Graphics \usepackage{color,graphicx} \usepackage[usenames,dvipsnames]{xcolor}  %Fonts and Tweaks for XeLaTeX \usepackage{fontspec,xltxtra,xunicode} \defaultfontfeatures{Mapping=tex-text} \setromanfont[Mapping=tex-text]{Hoefler Text} ...   So... when compiling with LuaLaTeX (part of MiKTeX on Windwos XP x64), I am getting the following error:  ... luaotfload | Font names database loaded: C:/Documents and Settings/Ampleforth/L ocal Settings/Application Data/MiKTeX/2.9/luatex-cache/generic/names/otfl-names .lua luaotfload | Updating the font names database: luaotfload | Scanning TEXMF and OS fonts... luaotfload | Font names database saved: %s  : C:/Documents and Settings/Ampleforth/Local Settings/Application Data/MiKTeX/2 .9/luatex-cache/generic/names/otfl-names.lua  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !  ! fontspec error: "font-not-found" !  ! The font "HoeflerText" cannot be found. !  ! See the fontspec documentation for further information. ! For immediate help type H &lt;return&gt;. !...............................................    l.28 \setromanfont[Mapping=tex-text]{Hoefler Text}   What is wrong? How can I install this font so LuaLaTeX is picking it up? Where to download? Any other thoughts about this? This problem comes from , who do not rigorously demonstrate (in their solution key) that the statistic is not sufficient.  Let $X_1,\dots,X_n$ be a random sample from a population with PDF $f(x|\theta)=\theta x^{\theta-1} \cdot 1_{\{x\in(0,1)\}}$ for $\theta&gt;0$. Show that $\sum_i X_i$ is not sufficient for $\theta$.  If you write out the PDF $p(\vec{x}|\theta)$ of the random sample, it is clear by the factorization theorem that $\prod_i X_i$ or $\sum_i \log(X_i)$ are sufficient for $\theta$; the PDF $p$ also suggests $\sum_i X_i$ is not sufficient for $\theta$. However, to rigorously demonstrate this, we need to analyze $p(\vec{x},\theta)/q(T(\vec{x},\theta)$, where $p$ is the distribution of sample $\vec{x}$, $q$ is the distribution of the statistic $T(\vec{X})=\sum_i X_i$. But finding the distribution of $T(X)=\sum_i X_i$ seems impractical. I have observed that $f$ is the PDF of a Beta($\theta$,1) distribution, but checking online, the distribution of the sum of Beta random variables doesn't appear to have a closed form. Are there any alternative routes (e.g., showing there is no factorization involving $T(\vec{X})$)? Did C&amp;B leave out a full explanation that $\sum_i X_i$ is not sufficient because none actually exist? In low-cost mass-produced items I often run into black blobs of what looks like resin applied directly on top of something on the PCB. What are these things exactly? I suspect this is some kind of custom IC that is layed out directly on the PCB to save on the plastic  housing/connector pins. Is this correct? If so, what is this technique called?    This is a photograph of the inside of a cheap digital multimeter. The black blob is the only non-basic piece of circuitry present, along with an op-amp (top) and a single bipolar junction transistor.