Say i have a class, TestClass. What I want to do is to have a function which i can pass a instance of TestClass into, which will set the attribute test_function of the object to a new function, which takes in self as the first parameter. How would I do this? Example: class TestClass:     def __init__(self):         self.t = &quot;t&quot; #irrelevant  object = TestClass()  def assign_function(object):     object.test_function = #????????  assign_function(object)  object.test_function() #I want this line to be able to run and for test_function to be able to access the attributes of object  I've already tried some options but I can't seem to find anything that works. For most of my solutions, the function requires an extra parameter, so for a function like def func(self, text):     print(text)  I would still have to pass something in as self, rather than it being done automatically like class functions are
I've read that it is possible to add a method to an existing object (i.e., not in the class definition) in Python.   I understand that it's not always good to do so. But how might one do this?
How do I fix a "Unknown configuration key `foreign-architecture' found in your `dpkg' configuration files." error? How do I reset the Windows XP Administrator password? I have forgotten the Administrator password of my Windows XP installation and locked out. Is there a way to reset it? I do have physical access to the PC. I am trying to monitor multiple JVMs running on different servers through an ssh tunnel.  Thanks to one of the UNIX gurus here, I have managed to get this running for a single server by:   Run jstatd on the target server Set up Visual VM to use 9696 as its socks proxy port. On my local PC, run:  ssh -L 2222:server1:22 bastion-host  On my local PC, run:  ssh -o port=2222 -D 9696 -L 1099:localhost:1099 localhost    This does the trick. Now when I try and tunnel to a second server I try:   On my local PC, run:  ssh -L 3333:server2:22 bastion-host  On my local PC, run:  ssh -o port=3333 -D 9696 -L 2099:localhost:1099 localhost    However, the last step complains with:  bind: Address already in use channel_setup_fwd_listener: cannot listen to port: 9696   Has anyone managed to do something similar?  Update:  The reason this is so complex is that jstatd is an RMI server application:    As with RMI applications, these register with an rmiregistry. Using rmi through a firewall requires me to use SOCKS as described here:    Unfortunately, visualvm only lets me set the SOCKS proxy port once, and the -D option won't allow me to forward the same local port to both servers... Finding the internal name and display name for a list column I am using SharePoint Server 2007 Enterprise with Windows Server 2008 Enterprise, and I am using publishing portal template. I heard for SharePoint list/list column, it has an internal name which could be used for programming (as identifier for list/list column), and also has a display name (which is showed for end user for list name or list column name).  How to find and set such internal name and display name for list/list column? How to animate A curve segment? How can I test for POSIX compliance of shell scripts? Considering that POSIX is the closest thing to a common standard among all unices, I'm interested in knowing if there's a shell that supports it exclusively. While most modern shells provide support for POSIX (and will run POSIX compliant scripts without any problem), they don't do a good job at pointing out non compliant features.  Is there any shell that implements POSIX and POSIX only, in such a way that it'd throw an error for any non compliant feature?  EDIT I want to clarify that I'm not asking for general tips for writing portable shell scripts. The related question mentionned in the comments already covered this. I thought of this question when I found out that bash has a --posix option but only to discover that it only affects some intialization behaviors which is not exactly what I'm looking for. Let $W^{1,p}(U)$ be the Sobolev space. Suppose that $U$ is connected bounded domain in $\mathbb{R}^n$ and $u \in W^{1,p}(U)$ satisfies $Du=0$ a.e. in $U$. How can I prove that $u$ is constant a.e. in $U$? UK Visa Refusal: Provenance of funds/parking Why not use a WAMP stack? This is a  about  the use of a *AMPP's stack.    I recently had a talk with some experienced people and they suggested to me not to use a WAMP stack, and instead install apache, mysql and php separately.  I don't understand why they have suggested this, though, so can anyone tell me?  Is there a particular disadvantage of WAMP, or a particular advantage to installing all of them separately?  Since a WAMP stack itself is composed of apache, mysql and php, then what's the difference between using the WAMP stack and installing them all separately? What I want is to create a bootable pen drive that shows GRUB menu and I can select any of the several bootable systems from there to install/run. I have several ISO images that I want to install in the USB like Ubuntu, Fedora, System Rescue CD, Windows XP and Windows 7 (The windows versions are optional, mostly am looking for a multi installer for Linux distros, specially Ubuntu version)  The default Startup Disk Creator only works with Linux Images and only 1 at a time (At least for the mean time. If it allows more systems and multiple ISOs it would be awesome)  What method exists that I can use step by step to create a bootable USB Drive with multiple images than can be booted from the USB and selected from GRUB. It must support Windows Images and Linux Images.  Alternatively, is there also a way to have multiple versions of the Ubuntu installation ISO on same USB Drive, such as, when booting from it, I get to choose what Ubuntu version and architecture to install, for example:     BOOT MENU   Ubuntu 12.04 32 Bit   Ubuntu 12.04 64 Bit   Ubuntu 12.10 32 Bit   Ubuntu 12.10 64 Bit   UPDATE: Wanted to add that the English version for the post mentioned by daithib8 is here: Why does the addition of a \left and \right introduces an extra space around the formula? Specifically, why do $\cos(\theta)$ and $\cos\left(\theta\right)$ render differently?  Is there a way to use resizable delimiters without introducing the spurious spaces?  Why did Knuth design it like this?  Edit: This occurs too, if \operatorname{MYOP} or some other operator, like \lim, \min etc. is used. (This edit is basically to make it easier to find this answer.) Which of these two is more correct and why?   The sun shines on my little tree. The sun shines upon my little tree.   From what I've read in dictionaries both are acceptable, however I would like to know if there are subtleties that might arise due to, for example, the context. Why is the order of $\mathbb{Z}[i]/\langle 3+i\rangle$ equal to 10? The reasoning my book uses is as follows:   Since $(3+i)(3-i) = 10$, $10 + \langle 3+i\rangle = 0 + \langle 3+i\rangle $. Also, $i + \langle 3+i\rangle = -3 + \langle 3+i\rangle = 7 + \langle 3+i\rangle$. So, $\mathbb{Z}[i]/\langle 3+i\rangle = \{k + \langle 3+i\rangle \mid k = 0,1,\ldots ,9\}$, since $1 + \langle3+i\rangle$ has additive order $10$.   I do not understand why the additive order of $1 + \langle 3+i\rangle$ is $10$, or why the fact that $(3+i)(3-i) = 10$, shows the additive order or $1 + \langle 3+i\rangle$  is $10$. If someone could please explain this I would greatly appreciate it.   Note: I apologize for not using MathJax to write this post. I intend to learn it over the coming weekend. I have an Ubuntu 14.04 server that has no external monitor connected.  I use NoMachine to remote control the machine.  When I do so, the Unity/Gnome interface doesn't see any monitors connected, so I can only use 800x600 when connecting with NoMachine.  If I plug in a monitor, I can set the resolution to whatever size the NoMachine window is on the remote computer.  Is there a way to create a "fake" monitor device on Ubuntu so I can set a desktop resolution in Unity/Gnome? Package pgfplots Error: CRITICAL: shader=interp: got unsupported pdf shading type '0' For the set of data , the following code can't compile showing the error     Package pgfplots Error: CRITICAL: shader=interp: got unsupported pdf   shading type '0'. This may corrupt your pdf!.   \documentclass[border= 5mm]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=newest} \begin{document}     \begin{tikzpicture}     \begin{axis}[unbounded coords=jump, view={70}{40}]     \addplot3 [surf,shader=interp]      table [x index={0}, y index={1}, col sep=tab] {mySurfaceData.txt};     \end{axis}     \end{tikzpicture} \end{document}    So, what went wrong to cause this?  P.S. the original data without NaN is available , where I would like to skip plotting those points of z=1. What is the point of stacking favorite notifications? I noticed I have more notifications than favorites, which means that the notifications are stacked (in other words, there can be more than 1 notification per question).    Here is my reasoning:   Why do they add up?, I don't know where is the benefit of knowing that some of the questions had multiple changes if we are not able to see which questions had how many changes   Since we don't know what questions had what amount of changes, the amount of notifications is just a meaningless number that don't help us too much. Here are some possible solutions:   Add a max of 1 notification per question Keep the same number, but allow us to see how many new changes there were on every question Why do proof authors use natural language sentences to write proofs? I haven't read very many proofs. The majority of the ones that I've read, I've read in my first-year proofs textbook. Nevertheless, its first chapter expatiates on the proper use of English in mathematical proofs, so I suspect that most proof authors do use both English (or another natural language) and formal proof systems for writing their proofs. However, I can't imagine many circumstances where mathematical notation and a formal proof system wouldn't suffice to convey the author's pertinent thoughts.   I suspect that proof authors have good reasons for making use of both English and formal expressions in their proofs, but I can't think of what those reasons are. Why do proof authors use English and formal expressions to write proofs? Are there stylistic rules (or guidelines) that state how, and in what parts of the proof, an author should, and shouldn't, use English? View/edit ID3 data for MP3 files What's a quick and easy way to view and edit ID3 tags (artist, album, etc.) using C#? Limit of $L^p$ norm Could someone help me prove that given a finite measure space $(X, \mathcal{M}, \sigma)$ and a measurable function $f:X\to\mathbb{R}$ in $L^\infty$ and some $L^q$, $\displaystyle\lim_{p\to\infty}\|f\|_p=\|f\|_\infty$?    I don't know where to start. There are two syntaxes for command substitution: with dollar-parentheses and with backticks. Running top -p $(pidof init) and top -p `pidof init` gives the same output. Are these two ways of doing the same thing, or are there differences?