Hi,
How can i addition one + one matric (array data structure) and after it find the third smallest number in it in C language (not C++)? Thank you for the code.
Does Ruby have an equivalent to .NET's Encoding.ASCII.GetString(byte[])?
Encoding.ASCII.GetString(bytes[]) takes an array of bytes and returns a string after decoding the bytes using the ASCII encoding.
I have created an array of coordinates. The centre of an image should move through those coordinates. I have used TranslateAnimation to achieve it. But during the animation the image is moving within the last two coordinates.
Below is my code:
private void CreateAnimationAndRun() {
// move to the different coordinates one by one
for(int k=0; k
The above function is called on a button click.
Hi,
I need a C# function that takes 2 strings as an input and return an array of all possible combinations of strings.
private string[] FunctionName (string string1, string string2)
{
//code
}
The strings input will be in the following format:
String1 eg - basement
String2 eg - **a*f**a
Now what I need is all combinations of possible strings using the characters in String2 (ignoring the * symbols), and keeping them in the same character position.
Eg: baaement, baaefent, baaefena, basefent, basemena, etc
any help? :)
Is there any "python's Generator" equivalent in JavaScript?
PS:
Python's Generator is very memory efficient when we need to do one time iterate through a big array, hash...
"Generators are iterables, but you can only read them once. It's because they do not store all the values in memory, they generate the values on the fly"
(Python's Generator explained in this thread: The Python yield keyword explained )
Hello all!
I was thinking if there such a function for c language.
I have a char array with data from a text file and i need to convert it to hexadecimal format.
Thank you in advance!
I have upgraded my application from rails 2.3.8 to 3.0.3 . But I'm facing a problem. I was using 'find' but the overriding doesn't work in rails 3:
# override activerecord's find to allow us to find by name or id transparently
def self.find(*args)
if args.is_a?(Array) and args.first.is_a?(String) and (args.first.index(/[a-zA-Z\-_]+/) or args.first.to_i.eql?(0) )
find_by_login_slug(args)
else
super
end
end
I'm wondering if there is a way to make this work in rails 3 or even by using where instead.
thanks
I'm rubbish at Regular Expressions, really!
What I'd like is to split a string containing a CCS property value into an array of [string,value,unit].
For example: if I supplied the .split() method with 1px it'd return ["1px",1,"px"]. If I were to supply, similarly, 10% it'd return ["10%",10,"%"].
Can this be done?
I appreciate all your help!
For example, lets say I have this string:
"Name, Name2, <b>Name3</b>, Name4, <b>Name5</b>"
I am trying to get whatever value / name is inside the <b> tags. So when I search the char, I get the following in an array:
Name3
Name5
Any ideas? Thanks
what is the C++ equivilant to the c function fgets?
I have looked at getline from ifstream, but when it comes to a end of line character, '\n', it terminates at and discards it, I am looking for a function that just terminates at the end line character but adds the end of line character to the char array.
thanks in advance
I have several entries in a table with name and date. I'd like to fetchAll with Zend_Db then get a grouped-by-date array. It happens that if I use group(), Zend_Db_Select method, it excludes some entries and I need them all.
Actually, what I'm trying to do is to render several tables, one for each different date, with data inside. I have no ideia.
How do I do that?
Thx in advance
(void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
if (editingStyle == UITableViewCellEditingStyleDelete) {
NSLog(@"delet it");
// Delete the row from the data source.
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:YES];
}
else if (editingStyle == UITableViewCellEditingStyleInsert) {
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view.
}
}
why is this crashing my application
can anybody explain me what will be equivalent of this in java?
for (i =(sizeof(num)*8-1); i; i--)
num is given number not array i want reverse bits in integer
Hello,
is their any way to make this work, without sacrificing the cdef in cdef caller? (no use of cpdef either)
from array import *
from numpy import *
cdef class Agents:
cdef public caller(self):
print "caller"
A[2].called()
cdef called(self):
print "called"
A = [Agents() for i in range(2)]
def main():
A[1].caller()
Is there a way to add files to a zip file from another server with php's zip extension? ie. addFile(array('localfile.txt,'http://www.domain.com/remotefile.txt')) (that obviously does not work)
I suppose I can download the files to a temporal folder and then add them to the zip file, but I was looking for a more automated solution or a function already made
I run through a for loop, each time extracting certain elements of an array, say element1, element2, etc. How do I then pool all of the elements I've extracted together so that I have a list of them?
I have a largish array of string that I want to use as a lookup.
I a using in_array(), but I suspect its doing a simple loop through - does anyone know whether the in_array() algo uses a bsearch algo?
I am calling this function which is modifying an array by reference:
function addWord(&$words, $wordIndex, $word)
{
$words[$wordIndex] = $word;
}
At the function call,
addWord(&$words, $wordsIndex, $word);
($words is used only during the function call)
doesn't work. How do I make this or a similar functionality work? I want the addWord to be a separate function.
I really wish that Google was better at searching for syntax:
decades :: (RealFrac a) => a -> a -> [a] -> Array Int Int
decades a b = hist (0,9) . map decade
where decade x = floor ((x - a) * s)
s = 10 / (b - a)