For a simple simulation in C, I need to generate exponential random variables. I remember reading somewhere (but I can't find it now, and I don't remember why) that using the rand() function to generate random integers in a fixed range would generate non-uniformly distributed integers. Because of this, I'm wondering if this code might have a similar problem:
//generate u ~ U[0,1]
u = ( (double)rand() / ((double)(RAND_MAX));
//inverse of exponential CDF to get exponential random variable
expon = -log(1-u) * mean;
Thank you!
After adding the new facebook like button to my page, it no longer validates using XHTML strict. The two errors I come across are:
All of the "meta property" tags say that "there is no attribute "property""
All of the variables used in the like button line are listed that there are no attributes for it. The line is as follows:
<fb:like href="http://www.pampamanta.org" layout="button_count" show_faces="false" width="120" action="like" font="arial" colorscheme="light"></fb:like>
Hi Everyone,
Are there any ways to retrieve the database connection string where my ruby is connected? what i would like to get is the:
1) Database name where the ruby is connected
2) The username of the SQL Server
3) Password of the SQL Server
4) Server name
I want to store it in session variables.
(I'am using MS SQL Server.)
Please help! thanks!
For most programmers using procedural or object-oriented languages there is a language-feature lowest common denominator: variables, procedures, standard control structures, and classes.
However, almost all languages add features on top of this. Recent C# versions have LINQ and delegates. C++ has template metaprogramming. Java has annotations. What features such as these do you use every day?
Hi
I've got a Flex 3 project. I'm having a problem with XML in Internet Explorer only. Pls see the problem lines below:
_clickURL = [email protected]();
_mediaSource = [email protected]();
These variables are coming up "" in IE. But, they grab the data in Safari and Firefox.
Any suggestions as to what the problem might be? Possible solution?
Thank you.
-Laxmidi
I have a Fitnesse test that I want to run twice. Once in firefox and once in ie. The test is below. The problem I am having is that only the second test is being executed by fitnesse
!define COMMAND_PATTERN {%m %p}
!define TEST_RUNNER {dotnet2\FitServer.exe}
!****>Global Variables
!define testUrl {http://localhost:1516/Web.App/Login.aspx}
*****!
!define browserToUse (IE)
!include -c -seamless .FrontPage.LoginTests
!define browserToUse (FireFox)
!include -c -seamless .FrontPage.LoginTests
Scala has symbols - names that start with a single quote ' and which are a kind of string constants.
I know symbols from Ruby (where they start with a colon). In Ruby they are used for some meta-programming tasks, like generating getters and setters for member variables (for example attr_reader :name to generate a getter for name).
I haven't seen a lot of use of symbols in Scala code yet. What are practical uses for symbols in Scala?
I installed ghostscript and updated the appropriate path variables ... however, I'm getting an error when I try to execute this command:
C:\PROGRA~1\gs\gs8.64\lib>pdf2ps mydocument.pdf mydocument.ps
Access is denied.
Unable to open command line file _.at
Is this the right command? did I miss some configuration or path setting? Otherwise, is there a sane method of doing this conversion?
Thanks!
What debugging tools are available for directshow filters? Presently, I have a project that compiles and registers a video source filter that I then setup a graph in GraphEdit. I am using c++ in visual studio 2008. Is it possible to get a debugger attached to the filter in any way where I could set break points, inspect variables, etc? Barring that is there a way to log diagnostic information somewhere that I can view in real time?
I have an app that is a TableView that drills down to a Detail View (UIView). On the detail view, I have three buttons that each add a different view to the stack. But I also want to pass some of the NSString variables from the detail view to the newly added views. How do I do that?
Hi All,
I was writing a C program where I use 6 variables a,b,c,d,e,f
a,b,c are constant values which I should pass as an argument(command line)
d,e,f are going to be size of arrays(which are a part of a structure)
typedef struct
{
blah blah
} ex;
ex ex0[d];
I am very confused about how to pass all these as argument. Right now I have hard coded these values,which apparently I should not be doing.
I am trying to pass a variable from one page, load another and enter that information.
something Like this:
When 127.0.0.1/test.html&ID=1234
location.href = "127.0.0.1/newpage.html"
if (location.href == newpage.html){
var e = document.GetElementById("Loginbx");
e.Value = ID
}
I don't have access to modify 127.0.0.1/test.html nor newpage.html but would like to pass variables to them from another. Is this possible?
is it possible in some way to compare multiple variables to one constant in a if statement? It would be very helpful if instead of
if ( col.Name != "Organization" && col.Name != "Contacts" && col.Name != "Orders" ) { }
I could just say
if ( col.Name != "Organization" || "Contacts" || "Orders" ) { }
And I know I could use a list but in some instances I dont want to... Thanks!
I'm writing a Debugger in Eclipse. Normal, Stack Frames are still show in DebugView.
But when I double-click in another View(BreakPoint View, Variables View...) to full size this view , then I double-click again.
Now , Stack Frames aren't show
Who can help me this problem?
Or help me disable event double-click in tab View ?
Thanks
If i make java core dump with gcore then what is the best tool to analyze it? I need to be able make jmap, jstack, jstat etc and also i need to see values of all variables.
Something that can take core dump as frozen JVM.
I've had geben running perfectly on previous versions of Ubuntu. After the upgrade, and installing the latest version of geben (0.26), it only half works. Specifically, when in context mode, localvariables are always marked as undefined.
Has anybody successfully gotten geben up and running under Ubuntu 10.04, or is this a bug in geben (I've reported it as one, but thought I'd check here just in case there is a workaround).
geben 0.26
xdebug 2.0.5
emacs 23.1.1
5.3.2-1ubuntu4.1
Thanks!
I am using a custom database (MongoDB) with TG 2.1 and i am wondering where the proper place to store the PyMongo connection/database instances would be?
Eg, at the moment they are getting created inside of my inherited instance of AppConfig. Is there a standard location to store this? Would shoving the variables into the project.model.__init__ be the best location, given that under SQLAlchemy, the database seems to commonly be retrieved via:
from project.model import DBSession, metadata
Anyway, just curious what the best practice is.
Given an environment object e:
> e
<environment: 0x10f0a6e98>
> class(e)
[1] "environment"
How do you access the variables inside the environment?
Just in case you're curious, I have found myself with this environment object. I didn't make it, a package in Bioconductor made it. You can make it, too, using these commands:
library('GEOquery')
eset <- getGEO("GSE4142")[[1]]
e <- assayData(eset)
How can I distinguish in makefile, which targets and how(when) they are called internally? I have a makefile with number of targets which are actually variables.
UPD: here is an example
http://pastebin.com/inaEsGnW
i try to write simplest possible server app in Java, displaying html form with textarea input, which after submitting gives me possibility to parse xml typed in that textarea. For now i build simple serversocket based server like that:
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;
public class WebServer {
protected void start() {
ServerSocket s;
String gets = "";
System.out.println("Start on port 80");
try {
// create the main server socket
s = new ServerSocket(80);
} catch (Exception e) {
System.out.println("Error: " + e);
return;
}
System.out.println("Waiting for connection");
for (;;) {
try {
// wait for a connection
Socket remote = s.accept();
// remote is now the connected socket
System.out.println("Connection, sending data.");
BufferedReader in = new BufferedReader(new InputStreamReader(
remote.getInputStream()));
PrintWriter out = new PrintWriter(remote.getOutputStream());
String str = ".";
while (!str.equals("")) {
str = in.readLine();
if (str.contains("GET")){
gets = str;
break;
}
}
out.println("HTTP/1.0 200 OK");
out.println("Content-Type: text/html");
out.println("");
// Send the HTML page
String method = "get";
out.print("<html><form method="+method+">");
out.print("<textarea name=we></textarea></br>");
out.print("<input type=text name=a><input type=submit></form></html>");
out.println(gets);
out.flush();
remote.close();
} catch (Exception e) {
System.out.println("Error: " + e);
}
}
}
public static void main(String args[]) {
WebServer ws = new WebServer();
ws.start();
}
}
After form (textarea with xml and one additional text input) is submitted in 'gets' String-type variable I have Urlencoded values of my variables (also displayed on the screen, it looks like that:
gets = GET /?we=%3Cnetwork+ip_addr%3D%2210.0.0.0%2F8%22+save_ip%3D%22true%22%3E%0D%0A%3Csubnet+interf_used%3D%22200%22+name%3D%22lan1%22+%2F%3E%0D%0A%3Csubnet+interf_used%3D%22254%22+name%3D%22lan2%22+%2F%3E%0D%0A%3C%2Fnetwork%3E&a=fooBar HTTP/1.1
What can i do to change GET to POST method (if i simply change it in form and than put " if (str.contains("POST")){" it gives me string like
gets = POST / HTTP/1.1
with no variables. And after that, how i can use xml from my textarea field (called 'we')?
I would like to have a FORTRAN write statement formatted to depend on some variable.
For example, I could write:
write(*,'(3f15.3,3f9.2)') x,y,z,(var(i),i=1,nvari)
where nvari = 3
But, what if, in some cases, I actually have 4 variables (i.e. nvari = 4)
I would like to write something like this:
write(*,'(3f15.3,nvari(f9.2))') x,y,z,(var(i),i=1,nvari)
Now, nvari can be anything and the output will work as I like.
How can I make something like this work?
Has anyone gotten watchpoints to work when debugging PHP with xDebug and Eclipse? The way I understand it, I'm supposed to be able to select a watched variable in the expressions view or select a variable in the Variables view during debugging, and then select Run-Toggle Watchpoint. But Toggle Watchpoint is constantly greyed out. All my other debugging functions work fine: breakpoints, step in, out, over, etc. Just can't get a watchpoint working.
I would like to mimic the Run command in Windows in my program. In other words, I would like to give the user the ability to "run" an arbitrary piece of text exactly as would happen if they typed it into the run box.
While System.Diagnostics.Process.Start() gets me close, I can't seem to get certain things like environment variables such as %AppData% working. I just keep getting the message "Windows cannot find '%AppData%'..."
In Perl we can get the name of the current package and current line number Using the predefined variables like __PACKAGE__ and __LINE__.
Like this I want to get the name of the current subroutine:
use strict;
use warnings;
print __PACKAGE__;
sub test()
{
print __LINE__;
}
&test();
In the above code I want to get the name of the subroutine inside the function test.