FAQ Database Discussion Community

Converting an Array of Hexadecimal Strings to Numbers

I have an application in which a server is sending a lot of data every second to clients that request it. In this data set are several (large) arrays that contain numbers (in some cases 16-bit integers and in others double precision floats). In order to reduce the packet size,...

TypedArray is empty after obtainTypedArray call

I have a simple google maps implementation, I'm filling two typed arrays with doubles from my strings.xml so I can use them to fill in as longitudes and latitudes. Here is the method: @Override public void onMapReady(GoogleMap map) { map.setMyLocationEnabled(true); TypedArray lats = getResources().obtainTypedArray(R.array.Lats); TypedArray longs = getResources().obtainTypedArray(R.array.Longs); int length...

Getresource id Error

I am getting "Null pointer exception for getResourceID()". If someone suggest me where i am going wrong in coding. Error message: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.content.res.TypedArray.getResourceId(int, int)' on a null object reference at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2325) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2390) at android.app.ActivityThread.access$800(ActivityThread.java:151) at...

sum of uint8array javascript

I'm trying to sum and then average a stream of data, some code here. var getAverage = function(dataArray){ var total, sample = dataArray.length, eArray = Array.prototype.slice.call(dataArray); for (var i = 0; i< sample; i++) { total+= eArray[i]; } return total; } var output = function(){ //source data var dataArray =...

Fastest way to aggregate two typed arrays in javascript [duplicate]

This question already has an answer here: How can I merge TypedArrays in JavaScript? 2 answers Hello everyone I'm trying to figure out the fastest way to aggregate two typed arrays into a single array. Imagine data looks like this [Int8Array, Int8Array] and I want to end up with...

The best performant way to push items into array?

In my website i have many arrays with data. for example: vertices array, colors array, sizes array... I'm working with big amounts of items. Up to tens of millions. Before adding the data into the arrays I need to process it. Until now, I did it in the main thread...

Fill a typed array with .bin file content in Node.js

On my server file system I have a directory which contains some .bin file filled with 16 bit integers. How can I load a Uint16Array variable with the content of a specific .bin file in Node.js? I already tried: var arrayFromBinFile = new Uint16Array('./myDirectoryContainingBinFiles/selectedFile.bin') By using console.log in node.js all...

Store typed array in ArrayBuffer

I have an ArrayBuffer of data which is composed of Uint8s. Each is in network byte order (big-endian). My goal is to convert each Uint8 into little-endian order, but then put them back in the ArrayBuffer. I know I can easily separate the individual Uints by using a typed array,...

Why does Node sometimes hang when allocating Int8Array?

Consider the following two programs: // works.js var buffer = new ArrayBuffer(16777216); var HEAP8 = new Int8Array(buffer); and // fails.js var HEAP8; var buffer = new ArrayBuffer(16777216); HEAP8 = new Int8Array(buffer); Run node then enter .load works.js. Everything seems happy. Now exit node. Run node again and enter .load fails.js....

What is UInt8Array() max value?

I've been experimenting with UInt8Array() method in Javascript to create random numbers, and it works even better than Math.random(). However I would like to know what's the max value this method could generate, so I was wondering if someone more experienced could give this information and perhaps explain me how...

Convert Uint8ClampedArray to regular array

How can I convert a Uint8ClampedArray (like one used for storing HTML5 canvas image data) to a regular array, in which values won't be constrained to 0-255?

google places autocomplete api not working in android

I am using Google Places Autocomplete API in my android application. But the app doesn't work . The logcat is filled with these warnings. There is this warning regarding TypedArray which I think is creating the problem.Can anyone explain what may be the issue.The logcat content is given below. 02-02...