EzDevInfo.com

Mu

A Node.js Mustache template engine (and compiler)

how can I add new user using buddypress plugin

I'm trying to develop a social network using buddypress plugin in wordpress. I installed the plugin and configured. Now the user is admin. I can change the name,avtar and also I can post status as admin.But now I can't get how to create new user?help me


Source: (StackOverflow)

Maildir is much larger than expected

I'm retrieving my email using offlineimap to a local maildir which I am indexing with mu (reading/writing is done using mu4e in emacs).

After loading all emails from the server my Maildir folder is about 1.1GB in size. However, the very same account takes much less space when downloaded with thunderbird (less than 500Mb).

I assume that the reduction in disk space is due to some compression so my question is

How can I reduce the disk usage of my Maildir setup without losing email history?


Source: (StackOverflow)

Advertisements

wordpress MU / network share the wp_options table between all sites

When setting up a "network" (previously an MU install) several new tables are created.

wp_3_commentmeta
wp_3_comments
wp_3_links
wp_3_options
wp_3_postmeta
wp_3_posts
wp_3_terms
wp_3_term_relationships
wp_3_term_taxonomy

What if you wanted to share the wp_options table amoungst all of your sites so that the same roles, admin settings, themes would be stored and managed all in the same place.

You could also manually copy all these settings into the new table but that seems like a heck of alot of unnescary coding.

Can you toggle whether a subsite uses it's own table or the parent table?

Can't seem to find this answer anywhere, any help would be greatly appreciated. THANKS!


Source: (StackOverflow)

Nodejs - Piping MU2 to HTTP?

Mu (Node.js Mustache engine) documents a method of using util.pump() to read its stream into the HTTP write stream. But util.pump() has been deprecated in favor of the pipe() method on the stream object.

So my test for doing this is:

var http = require('http');
var mu = require('mu2');

http.createServer(function(req, res) {
    mu.compileText("testname", "Hello world");
    var stream = mu.render("testname", {});
    stream.pipe(res);
    res.end();
}).listen(8888);

But it doesn't output anything. I also tried util.pump() and this didn't work either.

I am, however, able to attach an on-data event to mu::render() and write the data to the res this way.

What am I doing wrong when piping the the MU stream to HTTP?

I'm using node version 0.10.5 and mu2@0.5.17.


Source: (StackOverflow)

Confidence Interval for Mu in a Log normal Distributions in R

Suppose we have a random sample of size n = 8 from a lognormal distribution with parameters mu and sigma. Since it is a small sample, from a non-normal population I will be using the t confidence interval. I ran a simulation to determine the true (simulated) CI of a 90% t-CI in which mu=1 and sigma= 1.5

My problem is that my code below follows a NORMAL distribution and it needs to be a lognormal distribution. I know that rnorm has to become rlnorm so that the random variables come from the log distribution. But I need to change what mu and sigma are. Mu and sigma in normal distribution aren't the same in a log distribution.

Mu in the log distribution= exp(μ + 1/2 σ^2). And sigma is exp (2 (μ+sigma^2)) – exp2 (μ+sigma^2)

I'm just confused on how I can incorporate these two equations into my code.

BTW- if you didn't already guess, I am VERY new to R. Any help would be appreciated!


MC <- 10000 # Number of samples to simulate
result <- c(1:MC)
mu <- 1
sigma <- 1.5
n <- 8; # Sample size
alpha <- 0.1 # the nominal confidence level is 100(1-alpha) percent

    t_criticalValue <- qt(p=(1-alpha/2), df=(n-1))

    for(i in 1:MC){
    mySample <- rlnorm(n=n, mean=mu, sd=sigma)
    lowerCL <- mean(mySample)-t_criticalValue*sd(mySample)/sqrt(n)
    upperCL <- mean(mySample)+t_criticalValue*sd(mySample)/sqrt(n)
    result[i] <- ((lowerCL < mu) & (mu < upperCL))
    }

SimulatedConfidenceLevel <- mean(result)

EDIT: So I tried replacing mu and sd with their respective formulas...

(mu=exp(μ + 1/2 σ2) Sigma= exp(2μ + σ2)(exp(σ2) - 1)

and I got a simulatedconfidencelevel of 5000.


Source: (StackOverflow)

Libgdx Box2d friction - can't climb shallow slope - is friction like high-school mu?

firstly, is bod2d friction like mu in high-school physics?

I have a compound body with two wheels on revolute joints one of which has a motor. When I try to drive it up an 30 degree slope my driven wheel spins and i don't get up. I have set friction on all bodies as 0.9. If I remember my high school physics mu approx 1 should let me climb a slope of nearly 45 degrees but my wheels slip.

secondly as I increase friction towards 1 my model becomes increasingly unstable. i have some angular damping set but climbing the ramp the physics sometimes seems to enter some kind of positive feedback condition and the moving vehicle disappears up at a silly velocity, Anyone seen anything like this?

thanks!


Source: (StackOverflow)

Merging two class structures which each rely on complex inheritance c#

We have a massive code set, so each of the classes is of the form:

public class A :
        DPM<Time, Data, TypeAKindA,
            TypeAKindB, TypeAKindC,
            TypeAKindC, TypeAkindD, TypeAKindE>

public class B:
        DPM<Temp, Data, TypeBKindA,
            TypeBKindB, TypeBKindB,
            TypeBKindC, TypeBKindD, TypeBKindE>

So Time is specific struct for example which differs from Temp.

The problem, is for each of these classes I have an init, constructor, so for example in the init, I am doing this specific to the class name. I.e. A goes off and does something specific for each class.

This is a massive code-set so I cannot re-factor. I'd like to combine these, so I have one class call it C, that will basically either execute the functionality of each or somehow merge them. I cannot change class DPM, and this is a complex structure with plenty of where clauses in it.

It looks like this:

public abstract class DPM<TypeA, TypeB, TypeC, , ... > : ID

where ID is an interface.

An example of the issue is the class DPM inherited has a property called _xyz which is populated with different values in .init() depending on whether it is called from Class A or Class B. And I don't know the dependencies downstream - so where is called or used later in the code.

Any suggestions very welcome.


Source: (StackOverflow)

WP multi-site setup on IIS server

I just setup Multi-site on my IIS demo server but it is not working. Anyone give me the steps to setup wp multi-site on IIS.

FYI : Below are the link of the site and multi -site. http://medcells.wsisites.net/ Multi-site link : http://medcells.wsisites.net/arabic - Getting error while browsing this link.


Source: (StackOverflow)

Webkit not found on OSX

I'm trying to compile mu that uses the headers webkit/webkitwebview.h and webkit/webkitwebresource.h. The OSX version of webkit framework located in /System/Library/Frameworks doesn't seem to have it, the headers are different and use NS data types and stuff.

So I downloaded webkit-gtk with MacPorts (since it's not available through Homebrew) and pointed $PKG_CONFIG_PATH to webkit-1.0.pc. I verified and this version has the needed headers.

But the problem is, I still get an error, the configure file doesn't seem to be able to find it. checking for WEBKIT... no

I don't even know, actually, if webkit-1.0.pc is the package config it is looking for.

I had two other compilation problems prior to this, with glib.h and gtk.h but managed to go through. This is the last issue I need to resolve to have a fully functional email client in Emacs.

Help!


Source: (StackOverflow)

mu4e with org-mode: LaTeX and R in emails

I'm trying to reproduce this awesome email from this blog post for the fun of it. Emacs, mu4e, org-mode Rich-text HTML email.

He sends an email from Emacs with mu4e, with LaTeX formulas and R plots, relying on org-mode to export the message to HTML and shell out rendering the images.

The org-mode HTML conversion works, if I have the cursor in the header and press C-c C-c, it converts the org format and sends a HTML message.

But when I try to include the LaTeX formulas, the rendered LaTeX .png fragments are removed before mu4e sends the email, and so aborts saying:

mm-insert-file-contents: Opening input file: no such file or directory, /tmp/ltxpng/...png

How can I delay removing the temporary files, until mu4e finishes sending the email?


Source: (StackOverflow)

Error plotting an ellipse in R

I am trying to plot an ellipse in R but getting an error message. Here is my code:

library(mixtools)       ###I also tried library(ellipse)
mu<-c(.564,.603)
sigma<-matrix(c(0.0144,0.0117,0.0117,0.0146),2)
ellipse(mu,sigma,alpha=0.95,npoints=200,newplot=TRUE,type="l")

Result:

Error in ellipse(mu, sigma, alpha = 0.05, npoints = 200, newplot = TRUE,  : 
unused arguments (alpha = 0.05, npoints = 200, newplot = TRUE, type = "l")

Then I tried just this:

ellipse(mu, sigma)

Result:

Error in ellipse(mu, sigma) : argument "vec" is missing, with no default

I am not sure argument "vec" is missing unless i do not know what that means.

I then turned my "mu" into a matrix may be that will help but got same result.

mu<-matrix(c(.564,.603),ncol=1)
sigma<-matrix(c(0.0144,0.0117,0.0117,0.0146),2)
ellipse(mu,sigma,alpha=0.05,npoints=200,newplot=TRUE,type="l")

I uninstalled R and re-istalled the latest but to no avail.

I checked: ??ellipse

I seem to be writing the code correctly but with no success.

Your assistance is appreciated.


Source: (StackOverflow)

wordpress mu infiny loop on global admin

I'm working on a wordpress mu 4.0.1

I migrated it from a dev server to a prod server and now I'm having infinite 302 Moved Temporarily loop when accessing the global site admin menu. All path seem to be correct. Everything works fine in dev server. :/

here is the htacces file I use :

# disable directory browsing
Options All -Indexes 

# Stop access to sensitive files
<Files .htaccess> 
 Order Allow,Deny
 Deny from all
 Satisfy all
</Files>  

<Files readme.html> 
 Order Allow,Deny
 Deny from all
 Satisfy all
</Files> 

<Files wp-config.php> 
 Order Allow,Deny
 Deny from all
 Satisfy all
</Files> 

<Files php.ini> 
 Order Allow,Deny
 Deny from all
 Satisfy all
</Files>  

<FilesMatch "^(error_log)$"> 
 Order Allow,Deny
 Deny from all
 Satisfy all
</FilesMatch> 

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]

And here is the end of the wp-config.php file :

if ( !defined('ABSPATH') )
    define('ABSPATH', dirname(__FILE__) . '/');

define ('WP_ALLOW_MULTISITE', true);

define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', false);
define('DOMAIN_CURRENT_SITE', 'www.chs-yonne.fr');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);

/** Réglage des variables de WordPress et de ses fichiers inclus. */
require_once(ABSPATH . 'wp-settings.php');

Thanks for your watches !

Pierre.


Source: (StackOverflow)

T.test in R, mu value

I'm trying to run t.test in R, but the hypothesis I'm testing is whether the mean of y is equal to the mean of x, for a simulated dataset. Here's the code I have so far:

set.seed(1)
n <- 100
x <- rnorm(n,0,1)
epsilon <- rnorm(n,1,2)
y <- 0.1 + 2*x + epsilon
y

set.seed(1)
summary(x)
summary(y)
t.test(y,alternative="two.sided",mu=)

I'm not sure how to write my mu for having the mean of y equivalent to the mean of x to run the test. R keeps telling me that mu must be a single number, so I thought if I just did a summary and wrote in the mean values. But then I'm not sure how to write it up in code to make the two equivalent and not a mu value equal to one of them. And further, would this be considered a two samples t test at all?

Any suggestions?

Also, if I was just testing to see if the mean of y was different from 0, I would just write mu=0 in the R code, correct?

Thank you!


Source: (StackOverflow)

How to edit the notification email that admin receive when anyone register in the Wordpress MULTISITE

I am working on a wordpress MU site.I am using domain mapping plugin.Now I want to modify the content of the notification email that admin receives when anyone register on the sites.I have searched in the internet and found function in pluggable.php in wp-includes folder of the wp installation.But event if i am overriding the function the mail content is still the same. Here is the code:

if ( !function_exists('wp_new_user_notification') ) {
function wp_new_user_notification( $user_id, $plaintext_pass = '' ) {
    $user = new WP_User($user_id);

    $user_login = stripslashes($user->user_login);
    $user_email = stripslashes($user->user_email);

    $message  = sprintf(__('New user registration on your blog %s:'), get_option('blogname')) . "\r\n\r\n";
    $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";
    $message .= sprintf(__('E-mail: %s'), $user_email) . "\r\n";
    $message .= "Testing message" . "\r\n";

    @wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), get_option('blogname')), $message);

    if ( empty($plaintext_pass) )
        return;

    $message  = __('Hi there,') . "\r\n\r\n";
    $message .= sprintf(__("Welcome to %s! Here's how to log in:"), get_option('blogname')) . "\r\n\r\n";
    $message .= wp_login_url() . "\r\n";
    $message .= sprintf(__('Username: %s'), $user_login) . "\r\n";
    $message .= sprintf(__('Password: %s'), $plaintext_pass) . "\r\n\r\n";
    $message .= sprintf(__('If you have any problems, please contact me at %s.'), get_option('admin_email')) . "\r\n\r\n";
    $message .= __('Adios!');

    wp_mail($user_email, sprintf(__('[%s] Your username and password'), get_option('blogname')), $message);

}

}

Any help will be appriciated.Thanks!


Source: (StackOverflow)

How to solve Infinite redirect loop on user profile? WP v3.5.2 MU subdomains + bbpress as wp-plugin v2.3.2

I have a working installation of wp v3.5.1 + bbpress plugin v2.2.3 at http://www.robadadonne.it.

In dev-environment I enabled the MU subdomain feature and updated wp to 3.5.2 and bbpress to 2.3.2 nb: bbpress is enabled on all subdomains.

After this I have the following issue: http://mydomain.local/forums/users/51d19cefb9687 start to redirect to in a infinite loop http://mydomain.local/forums/users/51d19cefb9687/mydomain.local

The same page on a subdomain instead, for example http://kitchen.mydomain.local/forums/users/51d19cefb9687 works correctly.

nb: I suppose .htaccess is ok (on subdomain it works correctly)

Someone have the same issue?


Source: (StackOverflow)