How to Sort array alphabetical and by strlen

I am looking for the cleanest ways to sort array alphabetically and by strlen in PHP. The cleanest way i came up with to sort by strlen is this: array_multisort(array_map('strlen', $array), $array); How would i extend this to sort alphabetically b...
more »

2017-10-04 18:10 (1) Answers

Symfony form validation pass array values

I'm new to Symfony. Here I'm trying to validate JSON parameters but I can't read array values. customer is my json object without array it's working. If I add array for bulk data insert I can't read array values. My code: $mydata = $request->ge...
more »

2017-10-04 12:10 (0) Answers

Adding objects to nsmutablearray swift

I added the string objects inside the mutablearray : let photoArray: NSMutableArray = [] for photo in media { photoArray.add("\(photo.fileName ?? "")") } Then I get an output like: <__NSSingleObjectArrayI 0x1c02069e0>( ( "Car", ...
more »

2017-10-04 06:10 (1) Answers

Get PHP class property from array

I have an array looking something like this: Array ( [0] => my_val_one [1] => my_val_two ) I then have an object looking something like this: stdClass Object ( [id] => 123123 [name] => my_name [m...
more »

2017-10-03 15:10 (2) Answers

How do i call a function within a function?

i'm creating a mini program in pascal to read music albums. The problem i'm facing is calling the readTracks() function within my readAlbum() function. Any help would be great, thank you :) The current error when executing the code is: Error: Incomp...
more »

2017-10-02 16:10 (2) Answers

How I can delete words if word have this letters

I must delete words if in word have letters "ц", "щ", "ы", "ь". I create this functions for need me but it works slow. public function CheckToInsert($text) { $xarfho = array("ц", "щ", "ы", "ь","қ","ӣ","ғ","ҷ","ҳ","ӯ","Қ","Ӣ","Ғ","...
more »

2017-10-02 13:10 (2) Answers

Caching related sequences in node js

I have an app that provides two types of operations : addSequence, matchSequence. addSequence => receives strings array (a1 => a2 => a3 ...) and store it in the database (neo4j) as a tree so that a1 will be the root and so on. when someone add ano...
more »

2017-10-02 12:10 (0) Answers

if==True;but built-in functions doesn't run

f <- readLines('/home/dogus/Desktop/phonezzzz/vcards.txt', encoding="UTF-8") #empty lists names <- c() numbers <- c() phonezz <- function(){ for(i in 1:length(f)){ if("FN" == substring(f[i],0,2)){ name <- substring(f[i],4...
more »

2017-10-01 22:10 (2) Answers

How to add columns to a big numpy matrix

I happen to have a 2-D numpy matrix of the form 2 3 1 2 3 9 . . I need to add another column to it so that it represents the squared sum of the first two columns like : 2 3 13 1 2 5 3 9 36 . . what numpy functions should I use to add this th...
more »

2017-10-01 20:10 (3) Answers

Adding 2 matrices using pointers

I can acheive it by passing (c,a,b) to add_mat function, where result of a,b is stored in c like, void add_mat(int c[][3], int a[][3], int b[][3], int m, int n) What should be the return type of add_mat if I want to construct the funtion in this w...
more »

2017-10-01 15:10 (3) Answers