Hello,
I want to be able to read any random RSS/ATOM XML file. That would mean I would not not know the tags, start the loop and the fields. How do I go about doing it in PHP.
Thanks
Jean
I am making a hangman game and am having trouble with part of it.
I have selected a random word from a file, but I want to display the word as a series of undersocres __ and then match the letter chosen to a position in the undersocres.
Can anyone help me?
cout <<"1. Select to play the game\n";
cout <<"2. Ask for help\n";
cout <<"3. Select to quit the game\n";
cout << "Enter a selection: ";
int number;
cin >> number;
while(number < 1 || number > 3 || cin.fail())
{
if(cin.fail())
{
cin.sync();
cin.clear();
cout << "You have not entered a number, please enter a menu selection between 1 and 3\n";
cin >> number;
}
else
{
cout << "Your selection must be between 1 and 3!\n";
cin >> number;
}
}
switch (number)
{
case 1:
{
string word;
string name;
cout << " Whats your name? ";
cin >> name;
Player player();
ifstream FileReader;
FileReader.open("words.txt");
if(!FileReader.is_open())
cout << "Error";
//this is for the random selection of words
srand(time(0));
int randnum = rand()%10+1;
for(int counter = 0; counter < randnum; counter++)
{
getline(FileReader, word, '\n');
}
cout << "my word: " << word << "\n";
// get length of word
int length;
//create for loop
for(int i = 0; i < length; i++)
cout << "_";
//_ _ _ _ _
SetCursorPos(2,10);
FileReader.close();
break;
I swear this should be so easy... Why is it not? :(
In fact, I want to combine 2 parts of the same array to make a complex array:
Data[:,:,:,0] , Data[:,:,:,1]
These don't work:
x = np.complex(Data[:,:,:,0], Data[:,:,:,1])
x = complex(Data[:,:,:,0], Data[:,:,:,1])
Am I missing something? Does numpy not like performing array functions on complex numbers? Here's the error:
TypeError: only length-1 arrays can be converted to Python scalars
Cheers
Hello,
In my table I have a serial number field, which is represneted by string.. It has a prefix and some numbers follow. Eg: ABC1234, ABC2345 etc. How to retrieve the largest value (max equivalent of int type) from this column. In my case it would be ABC2345. I probably could retrieve all the data,, sort it and get the same, but that would be slow.
thanks in advance..
I have a variable in Python containing a floating point number (e.g. num = 24654.123), and I'd like to determine the number's precision and scale values (in the Oracle sense), so 123.45678 should give me (8,5), 12.76 should give me (4,2), etc.
I was first thinking about using the string representation (via str or repr), but those fail for large numbers:
>>> num = 1234567890.0987654321
>>> str(num) = 1234567890.1
>>> repr(num) = 1234567890.0987654
What is the most common song lyrics used for check-in notes in a version control system? I usually fall back on David Bowie's Changes lyrics, but I've seen check-in descriptions from another programmer who liked to use random Nine Inch Nails and Stabbing Westward lyrics.
There are several different methods for converting floating point numbers to Integers in JavaScript. My question is what method gives the best performance, is most compatible, or is considered the best practice?
Here are a few methods that I know of:
var a = 2.5;
window.parseInt(a); // 2
Math.floor(a); // 2
a | 0; // 2
I'm sure there are others out there. Suggestions?
I have a file with the following expressions:
something[0]
Where instead of 0 there could be different numbers. I want to replace all these occurances with
somethingElse0
Where the number should be the same as in the expression I replaced. How do I do that?
Why do I get a syntax error running this code? If I remove the highlighted section (return cards[i]) I get the error highlighting the function call instead.
Please help :)
def dealcards():
for i in range(len(cards)):
cards[i] = ''
for j in range(8):
cards[i] = cards[i].append(random.randint(0,9)
return cards[i]
print (dealcards())
I know about hashing algorithm and hashCode() to convert "key" into an equivalent integer (using some mathematically random expression) that is then compressed and stored into buckets.
But can someone point me to an implementation or at least data structure that should be used as baseline?
I haven't found it anywhere on the web.
Hi there:
What does the word "dead beef" mean? I read it from a interview question. It has something to do with ipv6. I figured it could be a random hex number used for examples, like "The quick brown fox jumps over the lazy dog".
Is my understanding correct? Or it has more significant meaning?
Thanks!
There's various activation functions: sigmoid, tanh, etc. And there's also a few initializer functions: Nguyen and Widrow, random, normalized, constant, zero, etc. So do these have much effect on the outcome of a neural network specialising in face detection? Right now I'm using the Tanh activation function and just randomising all the weights from -0.5 to 0.5. I have no idea if this is the best approach though, and with 4 hours to train the network each time, I'd rather ask on here than experiment!
I saw a piece of code which was written like this:
if (from n in numbers select n where n = 5)
However, I tried writing something like this but came across errors (bare in mind the code sample may not be exactly as above as I am typing from memory). How can I write code like the above?
Thanks
Input : {5, 13, 6, 5, 13, 7, 8, 6, 5}
Output : {5, 5, 5, 13, 13, 6, 6, 7, 8}
Question is to arrange the numbers in the array in decreasing order of their frequency preserving the order of their occurrence.
If their is a tie, for example, here 13 and 6 then the number occurring first in input array would come first in output array.
I would like to test if an instance variable lies in a range of numbers. I solved the problem by using assert_in_delta but would like to know if there is a formal assertion for this.
#part of the tested class
def initialize(value = 70 + rand(30))
@value = value
end
#test_value.rb
class ValueTestCase < Test::Unit::TestCase
def test_if_value_in_range
assert_in_delta(85, p.value, 15)
end
end
I want to define a method that take an integer as input and creates dynamically a list of all descending integer numbers to zero. I find trouble into calling method for the n-1 element
Is there any way to determine what should be your available bandwidth on EC2? Documentation seems to indicate that it should be based on your instance size, but I'm having a bit of trouble finding any specific numbers.
When I read a sheet into a DataTable using the OleDbDataReader, floating point numbers loose their precision.
I tried forcing OleDb to read the excel data as string, but although the data is now contained in a DataRow with each Column defined as System.String it looses precision (18.125 - 18.124962832).
Any idea how to avoid this behaviour?
If I want to pass a number of values for the ParamArray arglist via an array, how do I do it? From what I've read so far, on VBA, it appears that I need to explicitly list the values that I want to pass. But what if there are potentially different numbers of values to pass, so I do not know in advance how many I'll want to pass to the function? Is there not some way of using an array (a one-dimensional array) with a variable dimension?
how do you get source ip, username, password, etc... of the client machine that sends a soap request? is there any of these details that one can pull for logging purposes?
I am using Java to handle the incoming SOAP requests. The service simply adds 2 numbers and is working, but I just need to get some client details.
Thanks, Lavanya
I am currently working on an ASP.NET 3.5 and C# web application which deals with users secure information like credit card numbers. What are some of the security measures which I need to take from an application development stand point so that I can sleep peacefully at night :)
Is it possible to create new variable names on the fly?
I'd like to read data frames from a list into new variables with numbers at the end. Something like orca1, orca2, orca3...
If I try something like
paste("orca",i,sep="")=list_name[[i]]
I get this error
target of assignment expands to non-language object
Is there another way around this?
I'm trying to stop a non-css animation:
http://jsbin.com/aqute4/4/edit
Button 1 starts the animation nicely, totally lost on how to stop it though, since .stop() seems to need a DOM element... rather than a random object.
Thanks in advance.
PS: Original code comes from: http://james.padolsey.com/javascript/fun-with-jquerys-animate/
print_r($pages);
print max($pages);
print min($pages);
shows me
Array ( [0] => 1 [1] => 2 [2] => 3 ) 1 2
While I was expecting the last two numbers to be 3 and 1. How come?
My program takes a data.frame and crunches the numbers. At one point, values from j-th column are multiplied by a predefined values that depends on the column name (species name, actually - it's en ecological index). So far, I've been providing these values via a second data.frame by matching column names. What would be an efficient way of integrating fixed variable values within a function? I would like my program to be as portable as possible, without the need for a second data.frame file.