hello everyone
i have a series of PDF byte arrays in a arraylist files that i wish to concatenate into one file,
currently when the PDF application trys to open the file is it corrupted:
foreach (byte[] array in files)
{
using (Stream s = new MemoryStream(downloadbytes))
{
s.Write(array, 0, array.Length);
}
}
downloadbytes is the resultant concatenated array of bytes below is another implementation which also failed
foreach (byte[] array in files)
{
System.Buffer.BlockCopy(array, 0, downloadbytes, offset, array.Length);
offset += array.Length;
}
any pointers?
This may be a bit of an easy, headesk sort of question, but my first attempt surprisingly completely failed to work. I wanted to take an array of primitive longs and turn it into a list, which I attempted to do like this:
long[] input = someAPI.getSomeLongs();
List<Long> = Arrays.asList(input); //Total failure to even compile!
What's the right way to do this?
What language is smart so that it could understand 'variable a = 0 , 20, ..., 300' ? so you could esely create arrays with it giving step start var last var (or, better no last variable (a la infinit array)) and not only for numbers (but even complex numbers...)
I'm looking for a C library that provides generic collection data structures such as lists, associative arrays, sets, etc. The library should be stable and well tested. I'm basically looking for something better than the crappy C standard library.
What C libraries fit this description?
EDIT: I'd prefer that the library was cross-platform, but failing that, anything that works on Mac/Linux.
Is there significant cpu/memory overhead associated with using automatic arrays with g++/Intel on 64-bit x86 linux platform?
int function(int N) {
double array[N];
overhead compared to allocating array before hand (assuming function is called multiple times)
overhead compared to using new
overhead compared to using malloc
The range of N may be from 1kb to 16kb roughly, stack overrun is not a problem.
Is there a way to import data from a JSON file into R? More specifically, the file is an array of JSON objects with string fields, objects, and arrays. The RJSON Package isn't very clear on how to deal with this http://cran.r-project.org/web/packages/rjson/rjson.pdf.
i want to add the current string in a textview view to a string array in arrays.xml.then display the last/previous added string of that array in a textview (setText).
Hello,
I am looking for some recommendations about compressing data in .NET, aside from using the GZipStream class.
I am looking for fast and high compression of byte arrays to be able to send them via tcp.
Thank you.
My project currently contains two largish property lists. One is currently 20KB; another is 8KB. So far, I have been maintaining them with xCode's property list editor. This is manageable but also a bit clunky. I am wondering if other people have better ways of doing this?
So far, my lists consist of nested arrays of strings. The depth is not uniform.
What is the most concise way of converting a java.util.List into a normal
JavaFX sequence (in JavaFX)?
e.g.
def myList = java.util.Arrays.asList(1, 2, 3);
def mySequence = ... // a sequence containing [1, 2, 3]
I'm writing an application which reads large arrays of floats and performs some simple operations with them. I'm using floats because I thought it'd be faster than doubles, but after doing some research I've found that there's some confusion about this topic. Can anyone elaborate on this?
Thanks.
Hi everyone,
I am in the middle of building a cache layer for the Redis DB to my application and I have come to the point where's it's about to take care of arrays.
I wonder if there's any good (high performance!) way of controlling an string to be serialized or not with PHP?
Thanks a lot!
In what cases I should use Array(Buffer) and List(Buffer). Only one difference that I know is that arrays are nonvariant and lists are covariant. But what about performance and some other characteristics?
array_key_exists is not working for large multidimensional array. For ex
$arr=array( '1'=>10,
'2'=>array('21'=>21,
'22'=>22,
'23'=>array('test'=>100,
'231'=>231),
),
'3'=>30,
'4'=>40
);
array_key_exists('test',$arr) returns 'false' but it works with some simple arrays.
I'm working on a web based form builder that uses a mix of Jquery and PHP server side interaction. While the user is building the form I'm trying to determine the best method to store each of one of the form items before all the data is sent to the server. I've looked at the following methods
Javascript arrays
XML document
Send each form item to the server side to be stored in a session
I am looking for the best way to augment multiple javascript associative arrays.
For example the following code
a = { "one" : 1, "two" : 2 };
b = { "three" : 3 };
c = { "four" : 4, "five" : 5 };
d = Collect(a,b,c)
Should result in value of d being:
{ "one" : 1, "two" : 2, "three" : 3, "four" : 4, "five" : 5 };
What is the best way to do this?
System.out.println(
Arrays.deepToString(
"abc<def>ghi".split("(?:<)|(?:>)")
)
);
This prints [abc, def, ghi], as if I had split on "<|>". I want it to print [abc, <def>, ghi]. Is there a way to work some regex magic to accomplish what I want here?
If I have an array of buttons, how can I tell which button was clicked?
example below
var i=0
CreateButton = new function () {
savebutton[i]=NewButton()
i++
}
every time a user runs the function a new button is generated.
the first button is savebutton[0] the second is savebutton[1] and so on potentially infinity times.
when later the user presses the button I want the screen to alert it's index number (or 'i').
is there any way to make this work in arrays?
How can I find the dimensions of a matrix in Python. Len(A) returns only one variable.
Edit:
Hi Thanks.
close = dataobj.get_data(timestamps, symbols, closefield)
Is (I assume) generating a matrix of integers (less likely strings). I need to find the size of that matrix, so I can run some tests without having to iterate through all of the elements. As far as the data type goes, I assume it's an array of arrays (or list of lists).
Hi, I'm trying to output lists of objects as json and would like to know if there's a way to make objects usable to json_encode? The code I've got looks something like
$related = $user->getRelatedUsers();
echo json_encode($related);
Right now, I'm just iterating through the array of users and individually exporting them into arrays for json_encode to turn into usable json for me. I've already tried making the objects iterable, but json_encode just seems to skip them anyway.
Yes, I know, most of you are thinking I'm an idiot, butt (kidding) I'm not. I've been searching everywhere for something on how to fully make a navigation-based iphone app, but all I've found is how to set up table views or navigation controllers. I haven't found anything on how to create a data model (something simple from arrays and dictionaries, SQLite and CoreData are a bit out of my scope) or navigate it. Does anyone know of any tutorials or anything like that? Thanks.
Let's say I have an array in Matlab:
x = [1 1 1 2 2 2 3 3 3 3 2 2 3 3 3 1 1 1 1 1 2 2 2 2 3 3 3]
I want the indices of the most recent set of consecutive '1's. In this case, I want the answer:
answer = [16 17 18 19 20] % (which should correspond to the last sequence of 1's)
I need an automated way to do this in Matlab, that will work with any size arrays, always giving me the indices for the last set of consecutive 1s.
Any suggestions?
I am having difficulty for using array model binding.
Actually I can see that the values sent from the views are not binded to the model and the arrays still have the values already instantiated. How can I solve this problem?