user_path in User model
Can Rails Routing Helpers (i.e. mymodel_path(model)) be Used in Models?
I deleted an answer which had no upvotes or downvotes, but after some time I saw that my reputation was -2 and the reason is linked to my search engine.    I want to know why this happened and what "linked to my serach engine" means? Removing control chars (including console codes / colours) from script output I can use the "script" command to record an interactive session at the command line.  However, this includes all control characters and colour codes.  I can remove control characters (like backspace) with "col -b", but I can't find a simple way to remove the colour codes.  Note that I want to use the command line in the normal way, so don't want to disable colours there - I just want to remove them from the script output.  Also, I know can play around and try find a regexp to fix things up, but I am hoping there is a simpler (and more reliable - what if there's a code I don't know about when I develop the regexp?) solution.  To show the problem:   spl62 tmp: script Script started, file is typescript spl62 lepl: ls add-licence.sed  build-example.sh  commit-test         push-docs.sh add-licence.sh   build.sh          delete-licence.sed  setup.py asn              build-test.sh     delete-licence.sh   src build-doc.sh     clean             doc-src             test.ini spl62 lepl: exit Script done, file is typescript spl62 tmp: cat -v typescript Script started on Thu 09 Jun 2011 09:47:27 AM CLT spl62 lepl: ls^M ^[[0m^[[00madd-licence.sed^[[0m  ^[[00;32mbuild-example.sh^[[0m  ^[[00mcommit-test^[[0m         ^[[00;32mpush-docs.sh^[[0m^M ^[[00;32madd-licence.sh^[[0m   ^[[00;32mbuild.sh^[[0m          ^[[00mdelete-licence.sed^[[0m  ^[[00msetup.py^[[0m^M ^[[01;34masn^[[0m              ^[[00;32mbuild-test.sh^[[0m     ^[[00;32mdelete-licence.sh^[[0m   ^[[01;34msrc^[[0m^M ^[[00;32mbuild-doc.sh^[[0m     ^[[00;32mclean^[[0m             ^[[01;34mdoc-src^[[0m             ^[[00mtest.ini^[[0m^M spl62 lepl: exit^M  Script done on Thu 09 Jun 2011 09:47:29 AM CLT spl62 tmp: col -b &lt; typescript  Script started on Thu 09 Jun 2011 09:47:27 AM CLT spl62 lepl: ls 0m00madd-licence.sed0m  00;32mbuild-example.sh0m  00mcommit-test0m         00;32mpush-docs.sh0m 00;32madd-licence.sh0m   00;32mbuild.sh0m          00mdelete-licence.sed0m  00msetup.py0m 01;34masn0m              00;32mbuild-test.sh0m     00;32mdelete-licence.sh0m   01;34msrc0m 00;32mbuild-doc.sh0m     00;32mclean0m             01;34mdoc-src0m             00mtest.ini0m spl62 lepl: exit  Script done on Thu 09 Jun 2011 09:47:29 AM CLT Embedding $S_n$ into $A_{n+2}$ What does it mean for two objects to "touch"? How to interpret autocorrelation plot in MCMC I am getting familiar with Bayesian statistics by reading the book Doing Bayesian Data Analysis, by John K. Kruschke also known as the "puppy book". In chapter 9, hierarchical models are introduced with this simple example: \begin{align} y_{ji}   &amp;\sim {\rm Bernoulli}(\theta_j)  \\ \theta_j &amp;\sim {\rm Beta}(\mu\kappa, (1-\mu)\kappa)  \\ \mu      &amp;\sim {\rm Beta}(A_\mu, B_\mu)   \\ \kappa   &amp;\sim {\rm Gamma}(S_\kappa, R_\kappa) \end{align} and the Bernoulli observations are 3 coins, each 10 flips. One shows 9 heads, the other 5 heads and the other 1 head.  I have used pymc to infer the hyperparamteres.  with pm.Model() as model: # define the          mu = pm.Beta('mu', 2, 2)     kappa = pm.Gamma('kappa', 1, 0.1)     # define the prior     theta = pm.Beta('theta', mu * kappa, (1 - mu) * kappa, shape=len(N))     # define the likelihood     y = pm.Bernoulli('y', p=theta[coin], observed=y)      # Generate a MCMC chain     step = pm.Metropolis()     trace = pm.sample(5000, step, progressbar=True)     trace = pm.sample(5000, step, progressbar=True)   burnin = 2000  # posterior samples to discard thin = 10  # thinning  pm.autocorrplot(trace[burnin::thin], vars =[mu, kappa])   My question is regarding the autocorrelation. How shall I interpret autocorrelation? Could you please help me to interpret the autocorrelation plot?    It says as the samples gets further from each other the correlation between them reduces. right? Can we use this to plot to find the optimum thinning? Does the thinning affect the posterior samples? after all, what is the use of this plot? If we look at light as a collection of little particles, we can say that dimmer light has its photons more spread out.  But if we look at light as a wave, then there no gaps unless specifically placed there on purpose.  So how can one interpret the formation of gaps between the photons? If $a^\phi = 1$ then the order of $a$ divides $\phi$ I know that electric current is the flow of electrons but electrons have a very slow drift speed (about 2mm/s). How is it that electric current reaches its destination at almost the speed of light? What is the solution of $\cos(x)=x$? There is an unique solution with $x$ being approximately $0.739085$. But is there also a closed form solution? Combining randomForests in R, why are the err.rate, mse and rsq components NULL From ?combine in :     The confusion, err.rate, mse and rsq components (as well as the   corresponding components in the test compnent, if exist) of the   combined object will be NULL.   Why are the err.rate, mse and rsq components for the combined NULL? Is there an efficient way to re-calculate these metrics?  I ask because I would like to figure out a way to use the oob re-sampling method with the parRF model in . How to fix "Package is in a very bad inconsistent state" error? I can't update my system because it freezes while installing a third-party update (zramswap-enabler)! Sometimes I get the following message in Update manager:  Could not initialize the package information An unresolvable problem occurred while initializing the package information. Please report this bug against the 'update-manager' package and include the following error message: E:The package zramswap-enabler needs to be reinstalled, but I can't find an archive for it.  I tried to remove the zramswap-enabler, but it's impossible because I get the following message: dpkg: error processing zramswap-enabler (--remove):  Package is in a very bad inconsistent state - you should  reinstall it before attempting a removal. Errors were encountered while processing:  zramswap-enabler E: Sub-process /usr/bin/dpkg returned an error code (1)  Actually I would really reinstall that package, but it is unable to do it! If I remove this third-party PPA then the system is warning me about a very very serious problem. So why can I not install/reinstall/remove/update this package and why freezes the updater if I try to update? What are the differences between 2.5" and 3.5" hard disks? What does the 2.5"/3.5" value indicate? The thickness?  I want one of my friends to buy 1TB hard disk for me. I know I want a 1TB capacity and 7200rpm, but don't know how to choose between 2.5" and 3.5"; I am worried that the 3.5" drive may be physically too big.  Also, aside from the measurements, are there any other differences that may cause compatibility or usability concerns? How does the twitter bot work? I heard that there was a twitter bot which automatically posted questions and asked for answers for specific questions on every site. How do they work? Is there an algorithm for doing this or is it purely random? I know that it doesn't tweet closed questions, but that's it. Rack Mount Servers - Build them or Buy them? This is the  for "Should I build coomputing hardware myself?" questions.   I have put together countless PCs, but never a large server. The geek in me says build it, but the realist in me says let the manufacturer handle it when there is a problem. Ignoring the time penalty involved with the initial assembly time of a built one, which is a better solution? Have you ever run into a problem with a home build server that would have been solved easier/quicker/cheaper by going with a manufacturer? Are there any features that manufacturers give that aren't easily attainable with a home built server? Books for starting with analysis I am interested in self-studying real analysis, and I was wondering which textbook I should pick up. I know all high school mathematics, I have read  (I did most of the exercises).  I have completed a computational calculus course which covered everything up to and including integration by parts (including the substitution method and Riemann sums) I am currently considering:    From what I have heard this is not very well suited for self-study and that while the exercises are extremely difficult, if you take the time they are worth the effort.    I have heard that while Spivak explains proofs in much more detail than Principles, it doesn't cover all of the material in the latter.    I don't know much about this. I have only seen some comments saying that it is an excellent introduction to analysis.    Extra clarification edit: I would prefer a book not to ''dumb down'' the material, something that would not hold my hand through every step, something that would force me to fill in the gaps myself instead of explaining every single step. That is why I am currently leaning towards Rudin, but before I decide I would still like some information on the book by Apostol. Can't install Ubuntu 18.10 on XPS 15 - EFI\BOOT\mmx64.efi not found I tried to install Ubuntu 18.10 on my XPS 15 9570 earlier. Everything was working fine until I got to the partition selection part of the installation. That's when the installer crashed and I had to shut down my machine. I think it's because I had my SATA configuration set to RAID ON instead of AHCI, which is now fixed.  Now when I try to run the installer from my bootable USB I get the following error  Failed to open \EFI\BOOT\mmx64.efi - Not Found Failed to load image \EFI\BOOT\mmx64.efi: Not Found Failed to start MokManager: Not Fond Something has gone seriously wrong: import_mok_state() failed   Hoping someone might have some idea as to what is going on Ppening an HTML file on localhost in XAMMP/apache 2.2 using subdirectories under htdocs I have a site directory for html (dreamweaver CSS3) with lots of subdirectories that contain HTML files for a number of drop down menus. They work fine where they are, but they all have menus that are JavaScript and could be kept in a separate file. So, I want to use Include. I don't want to have to FTP my files to HostGator every time I want to test the includes. I want to have this on my local machine. So, I am attempting for the first time to setup XAMMP and then run my html files (site) on localhost, so I can see what they look like before ftping everything to HostGator and putting it live.  I tried copying the main site folder to htdocs, and then copying the path to the file I want to run in front of the localhost in Firefox, but it gave me file not found:   Do I have too many subdirectories? Why isn't the file being found? It is there.  Tried this too:   No go. Rational + irrational = always irrational? I had a little back and forth with my logic professor earlier today about proving a number is irrational. I proposed that 1 + an irrational number is always irrational, thus if I could prove that 1 + irrational number is irrational, then it stood to reason that was also proving that the number in question was irrational.  Eg. $\sqrt2 + 1$ can be expressed as a continuous fraction, and through looking at the fraction, it can be assumed $\sqrt2 + 1$ is irrational. I suggested that because of this, $\sqrt2$ is also irrational.  My professor said this is not always true, but I can't think of an example that suggests this.  If $x+1$ is irrational, is $x$ always irrational?   Actually, a better question is: if $x$ is irrational, is $x+n$ irrational, provided $n$ is a rational number? ls: cannot access .gvfs: Permission denied How can I have a pointer to the next struct in the definition of this struct:  typedef struct A {   int a;   int b;   A*  next; } A;   this is how I first wrote it but it does not work.