Is it possible to create a 2D array of VlcPlayerController Controller? - arrays

List<List<VlcPlayerController>> twoDList = List.generate(3, (i) => List.filled(3, '', growable: false), growable: false);
Is it possible to create a 2D array of VlcPlayerController?
I've tried
The argument type 'String' can't be assigned to the parameter type 'VlcPlayerController'. i get this error message.

Related

Converting Object with arrays to arrays with arrays - *ngfor usage

I have a form that creates a array with data, then i place that array in a object in my firebase Datatime.
When i get the data from that object, the data in object with 2 arrays.
The problem is to use *ngfor i need the object to be an array with arrays in it. Is it possible?
How can i make it?
The object:
{adeus: Array(1), olaaaaa: Array(2)}
how i call it from firebase:
listSearch(){
this.af.object("/list").query.once('value').then(data => {
console.log(data.val() as string);
this.teamsList = data.val() as string;
});
}
I get this error:
core.js:4197 ERROR Error: Cannot find a differ supporting object '[object Object]' of type 'object'. NgFor only supports binding to Iterables such as Arrays
So i need a way to convert that object to an array with two arrays.
Any help?
I not understand the solution that you want to made. But if you want to iterate into the properties of an object you can use Object.keys as follow
let object = { array1 : ['a','b'], array2 : ['c','d'] }
let arrayOfArrays = Object.keys(object).map(k => object[k])
the result will be
arrayOfArrays = [ ['a', 'b'], ['c', 'd'] ]
Hope this can help you

How to create an array with a specific type at a specified index?

type MyArray<T> = [data: T[] , count: number ]; // doesn't work
On the client side, I want to use MyArray type to map data from an API and to be able to call its 'data' or the 'count' property.
The API delivers the data in an array, at index 0 the array has the data and at index 1 it has a number.
You are looking for a tuple type:
type MyArray<T> = [T[], number];
Tuple members can't have names, they are only positional and are resented at runtime using arrays
Usage example:
type MyArray<T> = [T[], number];
let data : MyArray<string> = [["data1", "data2"], 2]
let arr = data[0] // string[]
let count = data[1] // number

Joomla JInput Array Only Int

I want to submit an array input
<input name="m[]" />
I know I can get the submitted values with JInput as
$input -> get('m', [], 'ARRAY')
I wonder if there is way to sanitate the retrieved data to get only integers, as it is done when we use
$input -> get('avar', 0, 'INT')
is it possible to do it with jInput or some other way arround?
thanks for your time.
As described in the documentation you need to specify the key and its filter as the parameter.
https://docs.joomla.org/Retrieving_request_data_using_JInput
$fooValues = $jinput->getArray(array(
'var1' => 'int',
'var2' => 'float',
'var3' => 'word'
));

Difficulties initializing an array in Perl

I have the following code:
print Dumper($dec_res->{repositories}[0]);
print Dumper($dec_res->{repositories}[1]);
my #repos = ($dec_res->{repositories});
print scalar #repos . "\n";
and the output is the following:
$VAR1 = {
'status' => 'OK',
'name' => 'apir',
'svnUrl' => 'https://url.whatever/svn/apir',
'id' => 39,
'viewvcUrl' => 'https://url.whatever/viewvc/apir/'
};
$VAR1 = {
'status' => 'OK',
'name' => 'CCDS',
'svnUrl' => 'https://url.whatever/svn/CCDS',
'id' => 26,
'viewvcUrl' => 'https://url.whatever/viewvc/CCDS/'
};
1
So my question is why $dec_res->{repositories} is clearly an array but #repos is not?
Here I printed the size but even trying to access elements with $repos[0] still returns an error.
Dumping $repos[0] actually print the whole structure... like dumping $dec_res->{repositories}
$dec_res->{repositories} is clearly an array
It isn't. It is an array reference.
but #repos is not?
It is an array.
You are creating a list that is one item long, and that item is the array reference. You then assign the list to the array, so the array holds that single item.
You need to dereference the array instead.
my #repos = #{$dec_res->{repositories}};
perlref explains more about references in Perl.

Laravel 4 updating all records with array gives me parameter mismatch error

Trying to update each row of a table with a multidimensional array created from querying another database.
The array:
Array
(
[0] => Array
(
[community_id] => ap
[floorplan_code] => ap1-1a
[name] => 33flat
[hidden] => 0
)
[1] => Array
(
[community_id] => ap...
Here is the code I'm using in an attempt to update:
$floorPlan = new Floorplan; //create new instance
$floorPlan->get(); //get all rows
$floorPlan->update($floorplanMappedArray); //map db columns to array and update
Error message: preg_replace(): Parameter mismatch, pattern is a string while replacement is an array.
The parameter mismatch came from the fact that I was trying to shove a multidimensional array into a single row. Therefore, I needed a foreach loop to index through the multidimensional array.
I thought that there was a magical way to use the update() method in the same way that the insert() method is used. Apparently, there is not.
Here is the code that solved the parameter mismatch error:
foreach ($floorplanMappedArray as $floorPlan) {
Floorplan::where('floorplan_code', $floorPlan['floorplan_code'])->update($floorPlan);
}

Resources