Tuesday, 17 September 2013

How to run Dunnett C post hoc test in R?

How to run Dunnett C post hoc test in R?

I ran a two-way anova in r with my data set (unequal sample sizes, unequal
variance): 1 variable measured across 3 species (with males and females in
each species). This produces a significant result between species, so I
want to know which pairwise comparisons produce the significance. I know
that there are functions in packages for performing post hoc tests in R:
e.g.
Dunnett's post hoc test from
http://www.uwlax.edu/faculty/toribio/math305_fall09/multiple.txt
library(multcomp)
?glht
test.dunnett=glht(anova_results,linfct=mcp(method="Dunnett"))
confint(test.dunnett)
plot(test.dunnett)
But Dunett's test is designed to compare all groups to a control. Instead
I want to compare all groups to each other, the Dunnett C. Does anyone
know of a package that performs Dunnett C or knows how to code it?
(equation at:
http://pic.dhe.ibm.com/infocenter/spssstat/v21r0m0/index.jsp?topic=%2Fcom.ibm.spss.statistics.help%2Falg_posthoc_unequalvar.htm)

Sunday, 15 September 2013

Will the JVM detect orphaned cycles?

Will the JVM detect orphaned cycles?

"Orphaned cycles" may not be exactly the correct term for what I'm trying
to describe; I heard it from a co-worker, but it may have just been a
casual term. Here is an example of what I'm trying to describe in code:
public class Container {
private Container otherContainer;
public Container(Container otherContainer) {
this.otherContainer = otherContainer;
}
public void setContainer(Container otherContainer) {
this.otherContainer = otherContainer;
}
}
public class Main {
public static void main(String[] args) {
doStuff();
}
public static void doStuff() {
Container c1 = new Container(null);
Container c2 = new Container(c1);
c1.setContainer(c2);
// c1 and c2 now each hold a reference to each other; can they be
garbage-collected
// once this method exits?
}
}
Essentially, the question boils down to this - given a graph of references
containing a cycle, can the JVM collect the references once it would be
safe to do so, or is this a memory leak?

Social Plug-in and like button not working on Blogger

Social Plug-in and like button not working on Blogger

My blog is www.pqed.org
The social plugin was working fine until a couple of months ago. Now, it
says the data can't be scraped, the like button doesn't work, when I share
on Facebook, it doesn't give the title or the post image (just the URL and
sometimes a random image from the site). I removed it, but when I put it
in, sometimes it doesn't even show up.
I suspect there is a corrupt image but I can't find it. I have removed all
the widgets, reset the template, and tried everything.
If may also be an an absolute URL problem after the migration. Or it could
be both.
Please help. Will someone look at the code and see what's up?
I have spent maybe 100 hours on this and I think I've made it all worse
instead of better.
Thanks

This is one of the problems with cookie says the book

This is one of the problems with cookie says the book

The book says "A user often opens many tabs in the same browser window. If
the user browses the same site from multiple tabs, all of the site's
cookies are shared by the pages in each tab. this could be problematic in
web applications that allow the user to parchase in each tab."
Can somebody explain what the book is trying to say because I don't really
understand it.
//tony

Colossal memory usage/stack problems with ANTLR lexer/parser

Colossal memory usage/stack problems with ANTLR lexer/parser

I'm porting over a grammar from flex/bison, and mostly seem to have
everything up and running (in particular, my token stream seems fine, and
my parser grammar is compiling and running), but seem to be running into
problems of runaway stack/memory usage even with very small/moderate sized
inputs to my grammar. What is the preferred construct for chaining
together an unbounded sequence of the same nonterminal? In my Bison
grammar I had production rules of the form:
statements: statement | statement statements
words: | word words
In ANTLR, if I maintain the same rule setup, this seems to perform
admirably on small inputs (on the order of 4kB), but leads to stack
overflow on larger inputs (on the order of 100kB). In both cases the
automated parse tree produced is also rather ungainly.
I experimented with changing these production rules to have an explicitly
additive (rather than recursive form):
statements: statement+
words: word*
However this seems to have lead to absolutely horrific blowup in memory
usage (upwards of 1GB) on even very small inputs, and the parser has not
yet managed to return a parse tree after 20 minutes of letting it run.
Any pointers would be appreciated.

Incrementing list items in jinja2 templates (appengine)

Incrementing list items in jinja2 templates (appengine)

I have a list of values in my template, which I need to increment based on
some conditions. Something like this:
{% set samplelist=[0,0,0] %}
{% if condition %}
<p>some text</p>
{% set samplelist[0]=samplelist[0]+listpassedbymainfile[0]
{% endif %}
I keep getting this error when I try to run the above code:
TemplateSyntaxError: expected token '=', got '['
Is this not supported, if so, is there a work around ?

How to get a correct marked image using ROI with javacv

How to get a correct marked image using ROI with javacv

I have run this code and This code give the black image instead of the ROI
marked image,can I please know the wrong with this code please.
public class ROITest {
private static final String OUT_FILE = "img\\ROI.jpg";
public static void main(String[] args)
{
opencv_core.CvRect r =new opencv_core.CvRect();
args[0]="img\\2.jpg";
if (args.length != 1) {
System.out.println("Usage: run FaceDetection <input-file>");
return;
}
// preload the opencv_objdetect module to work around a known bug
// Loader.load(opencv_objdetect.class);
Loader.load(opencv_core.class);
// load an image
System.out.println("Loading image from " + args[0]);
IplImage origImg = cvLoadImage(args[0]);
// IplImage ROIimg = CvSetImageROI(origImg, opencv_core.cvRect(0, 0,
640, 480));
cvSetImageROI(origImg, cvRect(1,1, origImg.width(), origImg.height()));
IplImage ROIimg = IplImage.create(cvGetSize(origImg),origImg.depth(),
origImg.nChannels());
cvCopy(ROIimg,origImg);
cvSaveImage(OUT_FILE, ROIimg);
final IplImage image = cvLoadImage(OUT_FILE);
CanvasFrame canvas = new CanvasFrame("Region of Interest");
cvResetImageROI(image);
canvas.showImage(image);
canvas.setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE);
}
}
It gives a completely black image instead of marked image..