Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Search - "associative arrays"
-
Not about favorite language but about why PHP is not my favorite language.
I recently launched a web shop built on Prestashop. I found that some product pages are so god damn slow, like taking 50 fuckin' seconds to load. So I started investigating and analyzing the problem. Turns out that for some products we have so many different combinations that it results in a cartesian product totalling about 75K of unique combinations.
Prestashop did a real bad job coding the product controller because for every combination they fetch additional data. So that results in 75K queries being executed for just 1 product detail page. Crazy, even more when you know that the query that loads all these combinations, before iterating through them, takes 7 fuckin' seconds to execute on my dev machine which is a very very fast high end machine.
That said I analyzed the query and now I broke the query down into 3 smaller queries that execute in a much faster 400 ms (in total!) fetching the exact same data.
So what does this have to do with PHP? As PHP is also OO why the fuck would you always put stuff in these god damn associative arrays, that in turn contain associative arrays that contain more arrays containing even more arrays of arrays.
Yes I could do the same in C# and other languages as well but I have never ever encountered that in other languages but always seem to find this in PHP. That's why I hate PHP. Not because of the language but all those fucking retarded assholes putting everything in arrays. Nothing OO about that.2 -
At this point i'd like to talk about the original PHP founder Rasmus Lerdorf, who was obviously too distracted by his own beard while watching the NBA Playoffs in 1995 to write a proper language.
There's not a language more inconsistent, ilogical, deficient, and best of all, bad structured.
Seriously, which substances was he smoking when thinking up such things as: non objective strings, incasesensitive functions and associative arrays?
What have objects ever done? any other honorable language does that, python, javascript, rails, C#, take your pick.
Not to mention the order of needle/haystack parameters.4 -
It's always fun to see some less experienced folks struggle with the shell :D
- quotes (single/double)
- subshells (and lost updates)
- variable substitutions (#, ##, %, %%, /, //)
- IFS
- environments vs variables
- associative arrays' limitations
and many more ways to drive the person crazy :)
I remember the times when I used to spend days-weeks over some problem - only because I didn't know how shell works. But it was worth it :)
Now I can watch others be tortured in the shell because they refuse to listen to my advice :popcorn:6 -
in BASH you cannot reassign associative arrays (i.e. string:string maps) to other variables.
If you have created an array as variable "arr", doing
```
declare -A arr2
arr2=${arr}
```
will not give you var2 as a usable assoc array. It will kind of transform it into an indexed array
In fact working with assoc arrays in shell is a bitch.3 -
why am i not able to find a way to use multidimensional associative arrays in vba?
plus: why am i too dumb to see my own data structure and process data sheets in a complicated way instead of using prepared data with a simple string split?3