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 - "arrays"
-
DO YOU FUCKING SERIOUSLY TELL US IN THE SECOND SEMESTER OF OUR MASTERS DEGREE THAT WE SHOULD BE CAREFUL THAT ARRAYS START WITH 0?!?14
-
Me: *desperately trying to finish a webpage before 5pm deadline*
Girlfriend: Why are you always so focused on your computer? You never pay attention to me.
Me: You know I have to work. Besides, you'll always be number 1 in my heart
Girlfriend: Aww that was cute. Okay I'll let you finish working
Me to me: ...arrays start at 0. *continues typing*
Disclaimer: this was stolen from /r/programmerhumor and I have no girlfriend13 -
┏┓
┃┃╱╲ in
┃╱╱╲╲ this
╱╱╭╮╲╲house
▔▏┗┛▕▔ we
╱▔▔▔▔▔▔▔▔▔▔╲
start arrays at 0
╱╱┏┳┓╭╮┏┳┓ ╲╲
▔▏┗┻┛┃┃┗┻┛▕▔4 -
Call comes down from the CEO and through his "Yes Man" that some investors are coming by to visit and he want to show off the data center and test servers. There are four full racks of storage servers filled with HDDs and each server has 4 to 16 HDDs a piece.
I got told to "make all of the lights blink", which can be epic seeing it in action but my test cycles rarely aligned that way.
All morning I was striping RAID arrays and building short mixed I/O tests to maximize "LED blinking" for the boss's henchman.
Investors apparently live/die by blinking light progress and it was all on me to get everything working.21 -
note: Not the worst dev I've interviewed but worst I've worked with.
A guy who worked in my company before me "HARDCODED" the entire calendar for next 10 years starting 2016 in dictionaries and arrays in Python for a project.12 -
The last two frontend devs I interviewed.
First:
He had 15 some years of experience, but couldn't answer our most basic of technical questions, we stopped asking after the first couple.
Based on a technical test I got the impression that he couldn't distinguish between backend and frontend.
So, I posed a simple question "Have you interfaced with REST API'S using Javascript before?"
Which lead him to talk about arrays. I shit you not he droned on about arrays for five minutes.
"I have experience using big array, small arrays, breaking big arrays into littler arrays and putting arrays inside other arrays."
Never been in an interview situation where I've had to hold back laughter before. We refer to him as the array expert.
His technical knowledge was lacking, and he was nervous, so he just waffled. I managed to ease his nerves and the interview wasn't terrible after that, but he wasn't what we were looking for.
Second:
This was a phone interview.
It started off OK he was clearly walking somewhere and was half preoccupied. Turns out he was on his way back from the shop after buying rolling papers (we'd heard him in the shop asking for Rizla), and he was preoccupied with rolling a joint.
We started asking some basic technical questions at which point he faked that he'd seen a fight in the street.
We then called him back five minutes later you could hear him smoking "ah, that's better". After that the interview was OK, not what we were looking for, but not bad.
Top tip: If you require a joint to get through a phone interview, roll and smoke it before hand.17 -
My prof suggested me to use matlab instead of Python for my project.
So I started learning and found out that in matlab ARRAYS START FROM 1.
Wtf!
I am going back to python8 -
When a customer asks you, why your C++-API is not working... He initializes the array at 1, because he "learned Matlab first" and "that's how arrays are supposed to be initialized" 🙄1
-
I was reading an article and stombled at this note:
when demonstrating arrays, always call them ‘arr’ – it allows you to talk like a pirate3 -
My company just made a nice design on the first door you see after entering the building.
Im so happy they started counting dev rooms from 034 -
There are two things about arrays that sometimes confuse me:
[0]: They start at zero
[1]: They end at one less than the length14 -
How most recruiter emails go these days:
- Hiring multiple senior lead engineers <— That’s me
- 180k+ <— I like it.
- Must have experience with AWS, GCE, AND Azure <— Okay, you’re looking for a unicorn
- Kubernetes expert
- Experience with Rust, Node, and .NET <— What type of fucking company are you?
- Must be on call and 25% travel <— Why?
- Preferred: experience with printer repair, Raid Arrays, CAT5, and Microsoft Access <— Y’all fucked up somewhere a long time ago. I’m out.16 -
After working as a developer for 4-5 years I finally took up school again.
The teacher at our first programming course insisted that we named all our variables in our locale language (swedish) and always started arrays at index 1.18 -
so i guess ill use my code.org teacher for this:
"credit card information is encrypted with the public keys"
"lists and arrays are the same thing"
"javascript is a powerful, fast, programming language" (bhahahaha)
"javascript is [only] used in web browsers"
"java and javascript are *extremely similar* but not the same"12 -
I had to open the desktop app to write this because I could never write a rant this long on the app.
This will be a well-informed rebuttal to the "arrays start at 1 in Lua" complaint. If you have ever said or thought that, I guarantee you will learn a lot from this rant and probably enjoy it quite a bit as well.
Just a tiny bit of background information on me: I have a very intimate understanding of Lua and its c API. I have used this language for years and love it dearly.
[START RANT]
"arrays start at 1 in Lua" is factually incorrect because Lua does not have arrays. From their documentation, section 11.1 ("Arrays"), "We implement arrays in Lua simply by indexing tables with integers."
From chapter 2 of the Lua docs, we know there are only 8 types of data in Lua: nil, boolean, number, string, userdata, function, thread, and table
The only unfamiliar thing here might be userdata. "A userdatum offers a raw memory area with no predefined operations in Lua" (section 26.1). Essentially, it's for the API to interact with Lua scripts. The point is, this isn't a fancy term for array.
The misinformation comes from the table type. Let's first explore, at a low level, what an array is. An array, in programming, is a collection of data items all in a line in memory (The OS may not actually put them in a line, but they act as if they are). In most syntaxes, you access an array element similar to:
array[index]
Let's look at c, so we have some solid reference. "array" would be the name of the array, but what it really does is keep track of the starting location in memory of the array. Memory in computers acts like a number. In a very basic sense, the first sector of your RAM is memory location (referred to as an address) 0. "array" would be, for example, address 543745. This is where your data starts. Arrays can only be made up of one type, this is so that each element in that array is EXACTLY the same size. So, this is how indexing an array works. If you know where your array starts, and you know how large each element is, you can find the 6th element by starting at the start of they array and adding 6 times the size of the data in that array.
Tables are incredibly different. The elements of a table are NOT in a line in memory; they're all over the place depending on when you created them (and a lot of other things). Therefore, an array-style index is useless, because you cannot apply the above formula. In the case of a table, you need to perform a lookup: search through all of the elements in the table to find the right one. In Lua, you can do:
a = {1, 5, 9};
a["hello_world"] = "whatever";
a is a table with the length of 4 (the 4th element is "hello_world" with value "whatever"), but a[4] is nil because even though there are 4 items in the table, it looks for something "named" 4, not the 4th element of the table.
This is the difference between indexing and lookups. But you may say,
"Algo! If I do this:
a = {"first", "second", "third"};
print(a[1]);
...then "first" appears in my console!"
Yes, that's correct, in terms of computer science. Lua, because it is a nice language, makes keys in tables optional by automatically giving them an integer value key. This starts at 1. Why? Lets look at that formula for arrays again:
Given array "arr", size of data type "sz", and index "i", find the desired element ("el"):
el = arr + (sz * i)
This NEEDS to start at 0 and not 1 because otherwise, "sz" would always be added to the start address of the array and the first element would ALWAYS be skipped. But in tables, this is not the case, because tables do not have a defined data type size, and this formula is never used. This is why actual arrays are incredibly performant no matter the size, and the larger a table gets, the slower it is.
That felt good to get off my chest. Yes, Lua could start the auto-key at 0, but that might confuse people into thinking tables are arrays... well, I guess there's no avoiding that either way.13 -
So I have a teacher that when he use "C++" it is basically C with a .cpp file-extension and -O0 compiler flag.
Last assignment was to implement some arbitrary lengthy calculation with a tight requirement of max 1 second runtime, to force us to basically handroll C code without using std and any form of abstraction. But because the language didn’t freeze in time 1998, there is a little keyword named "constexpr" that folded all my classes, arrays, iterators, virtual methods, std::algorithms etc, into a single return statement. Thus making my code the fastest submitted.
Lesson of the story, use the language to the fullest and always turn on the damn optimizer
Ok now I’m done 😚7 -
I'M SO PROUD, I WROTE A FULLY-FUNCTIONAL JSON PARSER!
I used some data from the devRant API to test it :D
(There's a lot of useful tests in the devRant API like empty arrays, mixed arrays and objects, and nested objects)
Here's the devRant feed with one rant, parsed by Lua!
You can see the type of data (automatically parsed) before the name of the data, and you can see nested data represented by indentation.
The whole thing is about 200 lines of code, and as far as I can tell, is fully-featured.24 -
Arrays start at ZERO, Morty, ZERO. God, I (burp) thought you would have figured that out by now. Lo-lo-look, I know you were taught that arrays start at one, but that's just (burp) fucking stupid Morty and if I ever find whoever started that shit I will literally drill the correct answer into their brain. And I don't mean "literally" as a literally unliteral exaggeration Morty, I mean (buuuurp) I will literally use a brain-altering power drill and get it into their fucking head that (burp) arrays start. at. zero.3
-
Should I ever design a programming language, I'll aim for the golden middle course and let arrays start at 0.5.7
-
A client asked me to add a mobile phone field to a registration form and asked me explicitly to use their server side validation for it.
Apparently they need a valid provider prefix, but after that everything goes. This was passed as valid mobile phone number.11 -
Previous developers read entire result of a SELECT into array of arrays.
Then used that later on in the following fashion.
print "name: " + result[row][17]
print "address: " + result[row][23]
...
without any description whatsoever what the numbers mean.
And it's here "result" and "row", in the actual code it was "arr" and "ii".
And these arrays were "public static" used everywhere, but initialized only at few places, so if you went onto wrong screen or if there was a phone call that kicked the app out it crashed.
But real fun began when people started changing queries and altering tables...
I seriously thought I was being pranked as a new hire.9 -
When you're so many fucking multi-dimensional arrays deep. You don't even know where the fuck you are anymore and you just wish you had been a doctor instead.4
-
My own programming language (still WIP). I got SO excited when I found recursion worked, I even got the simplest factorial recursive function wrong. And then again, once arrays worked, bubble sort it was. I shit you not, once I saw all the numbers printed in order, I had to stand up and walk or I would have jumped out of the chair in excitement.
In case someone is interested, I use LLVM for the backend.4 -
Did you know that
console.table(arr);
will let you print whole JavaScript arrays in table form in console?10 -
"C Vectors, Python Lists and Java Arrays are all the same things!" - my IT professor.
He's really talented... :D Don't you guys think? And the fun part is that these "gems" are quite common lately...
I hope I'll graduate soon ;_;17 -
When you have to spend two days inventing math formulas for work because google won't tell you how to sort every possible combination of an array of arrays into a zero based number list, or how to get a combination from just it's index.12
-
Java:
Primitive streams. Their need to exist is a monument to legacy failure.
VB.net
OrElse and AndAlso short-circuiting operators. The language designers were too fucking lazy to process logic, so they give specific keywords for those cases.
PHP
Random Hebrew error messages
JS
Eval. It can be used responsibly, but most of the times you see it it's because someone fucked up.
C#
Lack of Tuple destructuring in argument specification. Tuples were added, and pattern matching was added, and it's been getting better. The gear grinding starts with how Tuple identity assignment in arguments is handled. Rather than destructuring into the current scope, it coalesces the identity specification into a dot property of whatever the argument name is. This seems like an afterthought given they have ootb support for ignore characters.
Typescript
This will probably be remedied in the next version or two, but Tuple identity forwarding between anonymous scopes normalizes to arrays of union types, because tuples compile to typeless arrays. It's irritating because you end up having to restate the type metadata in functional series even when there is no possibility for any other code branch to have occurred.12 -
Me: Bro look, I have learnt so many things from the past couple of days.
-Introduction
-Data Types
-Variables
-Arrays
-Operators
-Control Statements
-Classes
-Methods
-Inheritance
-Packages
-Interfaces
-Exception Handing
-Multi-threaded Programming
-Enumerations
-Autoboxing
-Annotations
-Generics
My senior: Congrats on finishing up the basics
Me: Those were just basics???...///!!! 😜3 -
I know it's not done yet but OOOOOH boy I'm proud already.
Writing a JSON parser in Lua and MMMM it can parse arrays! It converts to valid Lua types, respects the different quotation marks, works with nested objects, and even is fault-tolerant to a degree (ignoring most invalid syntax)
Here's the JSON array I wrote to test, the call to my function, and another call to another function I wrote to pretty print the result. You can see the types are correctly parsed, and the indentation shows the nested structure! (You can see the auto-key re-start at 1)
Very proud. Just gotta make it work for key/value objects (curly bracket bois) and I'm golden! (Easier said than done. Also it's 3am so fuck, dude)15 -
There are two essential things to understand if you want to get along with me :
- Respect goes both ways. If you don't respect me I aint gonna respect you.
- Array starts at 04 -
Why did the programmer quit the job?
Because he didn't get arrays.
Ancestral, I know. But still funny.1 -
So we're working on a few initial apps for a hackercamp and finetuning the OS. We've been coding for like 17-18 hours trying to finish this off without a day 1 patch on the event itself, when someone starts swearing like a sailor. We walk past him take a look at his code and see that he's started an array at 3 instead of 0. He's one of the more experienced members on the team so this is a lack of sleep bug rather than a not knowing. To this day whenever someone makes an array error in their code someone always shouts "Arrays start at 3 right"!
Maybe not the most satisfying bugs but man is it funny as hell. -
I'd tend to say Matlab :
- you don't learn to write good code
- if you start by learning Matlab, you tend to be stuck in Matlab
- it's heavy and ugly and expensive
- arrays start at 18 -
I don't program because I know what I want. I program because I'm indecisive and I need rand Arrays to pick where I eat today.5
-
This week in Programming Language appreciation: the multiplication operator in Python. You can use it on strings and arrays for incredible ease of use. For a horizontal line in a terminal?
print("-" * 30)
Very helpful, and I have used it a lot. And I miss it in other languages.15 -
PHP arrays.
The built-in array is also an hashmap. Actually, it's always a hashmap, but you can append to it without specifying indexes and PHP will use consecutive integers. Its performance characteristics? Who knows. Oh, and only strings, ints and null are valid keys.
What's the iteration order for arrays if you use them as hashmaps (string keys)? Well, they have their internal order. So it's actually an ordered hashmap that's being called an array. And you can produce an array which has only integer keys starting with 0, but with non-sequential internal (iteration) order.
This array weirdness has some non-trivial implications. `json_encode` (serializes argument to JSON) assumes an array corresponds to a JSON array if its keys are consecutive integers in increasing order starting with 0, otherwise the array becomes a JSON object. `array_filter` (filters arrays/hashmaps using callback predicate) preserves keys, so it will punch holes in the int key sequence if non-last items are removed, thus turning arrays into hashmaps and changing your JSON structure if you forget to discard keys before serialization.
You may wonder how JSON deserialization works, then? There's a special class for deserialized JSON objects, `stdClass`. It's basically a hashmap too, but it's an object, not an array, and all functions that would normally accept arrays won't work with it. So basically its only use is JSON (de)serialization. You can even cast arrays to objects, producing `stdClass`.
Bonus PHP trivia:
Many functions return nonsensical values. `preg_match`, the regex matching function, returns 1 for success, 0 for no matches and false for malformed regular expression. PHP supports exceptions, so it could just throw one on errors. It would even make more sense to return true, false and null for these three cases. But no, 1, 0 and false. And actual matches are returned by output arg.
`array_walk_recursive`, a function supposed to recursively apply callback to each element of an array. That's what docs say. It actually applies it to leafs only. It will also silently accept object instead of array and "walk" it, but without recursing into deeper objects.
Runtime type enforcing is supported for function arguments and returned values. You can use scalar types, classes, array, null and a few special keywords. There's also a `mixed` keyword, which is used in docs and means "anything". It's syntactically valid, the parser will accept it, but it matches no values in runtime. Calling such function will always cause a runtime error.
Strings can be indexed with negative integers. Arrays can't.
ReflectionClass::newInstanceWithoutConstructor: "Creates a new class instance without invoking the constructor". This one needs no commentary.
`array_map` is pretty self-explanatory if you call it with a callback and an array. Or if you provide more arrays of equal length via varargs, callback will be called with more arguments, one from each array. Makes sense so far. Now, you can also call `array_map` with null instead of callback. In that case it treats provided arrays as rows of a matrix and returns that matrix, transposed.5 -
They actually did it...
Cheezus Crust, they actually "generated" 3 HTML selects to let a user chose a Date.
(nvm the line numbers, it ends at 3000)
They didn't even bother to generate the fucking arrays lol15 -
How can a candidate have 10+ years or experience with C++ and let alone struggle with the most simple exercise!?
Thoughts from the inner me during an actual interview:
FOR FUCK SAKE, DUDE, PUT THAT "std::" IN FRONT OF YOUR "vector" AND IT WILL COMPILE!
USE ITERATORS GODDAMMIT INSTEAD OF THOSE FUCKING INDEXES. YOUR CODE IS FULL OF DAMN OVERFLOW ERRORS!
HAVE YOU EVER REALIZED THAT ARRAYS CAN BE EMPTY SOMETIMES?5 -
Recently for a project I needed to read/write ID3 tags from MP3 files. And after a long search, I found this bloated, monolithic but quite stable library, "getID3".
So, I was looking through the code-base and I found this. This guy literally storing the key value based data embedded as comments within the class file. Then wrote a method to parse the data and even used caching to ensure maximum speed! And such usage is repeated all over the code-base.
So, this is what people used do before arrays were invented :314 -
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 -
Fuck! I am never gonna get hired again. I fucking suck at live coding. My mind just fucking gets blocked. On simple shit like arrays. I still suck at regular expressions though. Fucking failed Amazon and now wayfare.!!!! Fuck my fucking god dam life.9
-
!Rant
How do you deal with open space offices?
I find it quite difficult to focus, the constant chatting, the constant questions, phone ringing, surprise meeting, more question, arrays of interruptions and questions again. I believe I would be a lot more productive if left alone in the total, undiscontinued silence.
Have you found your escape, your zen, your inner focus? Please share, I need some ideas16 -
I have been on Reddit...
I have been lurking in ProgrammerHumor...
I am not proud of these things...
I got called a "Big Shot" because I didn't think the concept of pointers in C/C++ was ever particularly hard.
If I remember right. I learned in high school how pointers worked when they explained how arrays worked in Pascal. When I taught myself C it didn't ever seem like it was a difficult thing to understand.
Is the concept of pointers really that hard to understand for devs?17 -
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 -
that feeling when your (thrice) refactored code executes literally 1000 times faster.
loading excel ranges into vba arrays and process these is much faster than comparing the ranges themselves. also much more readable. please don't throw rocks at me for don't knowing this in advance.6 -
You think arrays starting with 1 are annoying?
HA!
How about time in a day starting with 12?
12:00, 12:45, 1:00, 1:45,...,11:45, 12:00, 12:45, 1:00, 1:45, ..., 11:45, 12:00, 12:45, 1:00 again
What if arrays started with 12? I bet Americans would love that!
arr[12]=fuck
arr[1]=this
arr[2]=shit
arr[3]=!!!14 -
So a follow up to my last Mathematica rant:
I have a JSON file made up of arrays of arrays of arrays with the outermost layer containing ~10,000 arrays.
So, my graphing works perfectly the first time for one of my graphs. I fix another unrelated graph, graph the whole file, and suddenly the first one stops working. The file read-in only reads in the array {2,13}. I double checked the contents of the file, they were as large as always.
Then, I proceed to look for bugs, find none, and decide to restart Mathematica. This doesn't help.
So I go back, find no bugs, and eventually am so fed up that I just restart Mathematica again, no changes.
Suddenly, the array reads in fine. Waiting for the graphs to come out but I think they'll be fine.
WTF Mathematica? Why must I restart TWICE to make bugs caused by your application go away?7 -
C#: the only language where you have 0 based arrays and 1 based collections, just to mess with you... Damn you M$!
(spent hours trying to understand why collection[0] was raising an out of range exception...)3 -
Saw a question on SO asking why foreach was slow with big data.
The code provided was 6 nested foreachs (basically a cartesian product between an array of arrays, and 4 other arrays).
Inside, a select query and an "update or create" operation.
"But why is foreach so slow?"4 -
I had to write a program that sorts scores but I couldn't use any arrays... I had to create a variable for every score and do "if" "else" for every outcome.6
-
Discovering Julia:
"Wow! It is awesome! It's like a Python but fast, function composition is so useful..."
Then you realize that arrays start at 1:
"WHAT THE F! WHY?!"4 -
Bitch plz, in Argentina arrays start at two.
There is no platform 0 neither platform 1 in any station2 -
You know what really grinds my gears? When people criticize a programming language but uses edge cases and stuff that can be avoided by using the tried and true "don't be an idiot". Take for instance JavaScript, a language I like and a language that has a lot you can criticize. But I feel like a lot of peoples criticism isn't warranted.
What's that? No ints? Use parseInt or Math.floor.
What are you saying? == works in strange ways? Yes, that's what we have === for.
Type coercion is wonky? Think it's weird how string + int works differently than string - int? Wanna string with number + - + - - + - - etc? Don't! Don't add strings and ints, don't subtract strings and ints. You can't in statically typed languages and you aren't supposed to in dynamically typed
Adding arrays and objects, arrays and arrays, objects and objects etc. is inconsistent? Why are you trying to do that?
Adding floats together gives odd results? Now we're getting somewhere! And Mozilla responded to that with a method called toFixed.
Declaring variables with var doesn't always work that well? Use let and const
Then there's this weird attitude that some people I've met have, where they will complain about the module system and how "well you rely on the community for those packages" as if it's a bad thing. And then coming with the "well you don't know what the (open source) packages do internally" as if I (for the most part) give a shit. Then they'll swear by companies like Zend or Microsoft as if they can't just stop supporting the languages they use. Maybe it's just because I like community content more because of video game mods.
Wanna criticize JS, then there's plenty to talk about. Like the built in date object is basically shit. Or how in NodeJS you can have node_modules in your node_modules. Or how classes don't really have the best syntax. Left-Pad. And so on (it's too late for me to be able to remember much more).1 -
Reading about Lua, see this:
"Lua arrays are 1-based: the first index is 1 rather than 0 as it is for many other programming languages (though an explicit index of 0 is allowed)."
*close tab*2 -
Friendly reminder that if every element of one array is equal to the corresponding element of another array that doesn't mean the arrays are equal. I hope next time I'll think of this before spending a day debugging everything else.8
-
So today at the beginning of the class, our teacher asked us to write a function that translates a given string to "leet speak" (basically having to replace every character to another).
Some used python dictionnaries, some used arrays...
And the two people arround me wrote a program with a condition for EVERY SINGLE CHARACTER.
It kind of made me wanna die or kill them 😥7 -
Used a String as a Boolean
First sin of the year
😂😂😂
Ps:Android studio wont let me use int or boolean,it was suggesting to use respective arrays as it was inside a loop2 -
after beginning to learn numpy , i believe these packages were really created by some clown of a circus xD.
Everything is sooooo entertaining!!!
i learned java 3 years ago, but today if i had to crap out some crazy java or c++ expert , i would tell him about numpy's arrays...
Like , "hey dude python has this cool data structure in the numpy library called arrays, which can hold any datatypes in a kind of arraylist like fashion, and you can convert them from 1 dimensional to 1000 dimensional in just 1 line , and also do you know we can select any column with just array[position]? and even this position does not needs to be an integer, you can use a list , like array[[1,2,3]] will give you elements at array[1],array[2],array[3], and...."
wait, why is my friend dead ? xD
HAhahahaha8 -
What kind of seizure of insanity led the devs of Python to believe that static, mutable default parameters could be a good idea? You can literally share whole arrays between multiple calls of the same function with the same input, and the number of cases where a sane person would intentionally want to do that is FUCKING ZERO.4
-
My friend was a really good programmer he had an awesome working environment and amazing colleagues but still he was not satisfied and left the job he said he couldn’t get arrays
-
!rant
I asked my teacher if i would be allowed to use lists in final exam. (If you read my last rants about him you'll know he has a fetish with arrays) He allowed it! I'm feeling so relieved!
(He changed his mind more than once for the last few weeks, but this time he made a clear decision and he will stick with it. He even promised it.)
No more fear now, I know I can do that 😁 -
I can’t say it’s the most painful but it’s one of my recent painful lessons.
So I’m learning C and in my project I was trying to make a copy of a 2D array and I kept getting seg faults up the ass every time I tried to allocate one of the inner arrays and after a long day of debugging I realized that I was trying to allocate memory within an array that doesn’t exist so I had to create the first array then allocate memory for each inner array after.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 -
Trying to work with an API that has no response object (it just returns empty arrays if something breaks) and it's JSON is not key-value.. just a bunch of dynamic nested values. just wow.3
-
Today, for the first time since I've started coding, I had a legitimate use case for the multi-cursor feature of my IDE in reasonably DRY code.
Edit: nvm, I added a version of the function to support arrays on the first argument.5 -
Tech interview prep on leetCode... I solved this but wanted to read the optimal solution. I check the Solution page..... 😟 🙁 ☹️ 😣 😖 😖 😫 😩 😩 😦 😧 😮 😬 😬 😵
https://leetcode.com/problems/...
The way I solved it, basically just did a merge of the 2 lists as is iterates thru them...
Ialright i need a break after i try to understand this...
btw, tech/CS workers, when you approach a real problem do you think like this? Solve the problems in Big O and math symbols?7 -
Lua, tables ("arrays") start at 1.
It also has no sleep function and its defacto package manager (luarocks) has almost never worked for me without some serious fuckery7 -
i was helping a friend with their coding assignment - snake game.
we spent about 45 minutes of trying to figure out why the snake's self-collisions are not working.
then we realized that she's using two separate arrays/grids - one for the food, one for the snake itself.
she was checking both for food collisions and self-collisions on the food array.
it was very painful to realize it took me so embarassingly long to notice it.6 -
Spent hours fixing my homework using arrays, when re-reading the exercise I found out I was supposed to use vectors. Well fuck me!2
-
php's type hints are completely broken.
Why is strict mode not the default? Why does it completely break down for arrays? (You have to abuse phpdocs to get any meaningful hints but you still lose any runtime checks.) What's with union types? (I know, php8 now has them but what took you so long.)2 -
If you wanna think that I'm a bad programmer, that's ok, but I can't put up anymore with Xcode.
Jesus Christ. An entire afternoon spent trying to make an array with two dimensions. I tried every fucking way I found in SO, in the apple site and in every another site that I found in my way.
First: For every example for Swift 3 there's another 10 for Swift <3.
Second: Mutable arrays, as I'm noticing, aren't a thing anymore, so, to declaring array size we go! Except it's impossible to. Tried 3 different ways. Not a single one worked.
Third: Actually, one of the 3 tries worked, for int arrays, and for some obscure reason it won't work for strings, as declaring the array as [String] is too general for swift, I mean, I completely agree with it, a [String] array could contain anything right???? FUCK NO. IT CONTAINS STRINGS YOU FUCKER!!!!
I swear, if the equipment was mine and not from the office, I would have thrown that piece of shit which disconnects from the fucking computer every 30 seconds that apple calls keyboard out of the window already.
Why the fuck do I need to develop for iOS in swift/xcode?? There's so many cross platform alternatives out there, good ones in fact, but no, we must build the applications natively or else the phone will catch on fire according to my boss.
I kinda liked Apple until now.
From now on? Fuck Apple.10 -
Wasted 2 days working on an obj (3d model) exporter….messed up meshes … missing faces … despair build after build …
And then the realization: Vertices in obj are 1-indexed.
…
..
.
FUCK
nobody learned anything from the array start at 1 meme2 -
A colleague of mine was very smart, but didn't know how to use classes in .net or object literals in js, so he organized his data with arrays.
It worked, of course, but, god, did I hate working with his code. It would take hours to make simple changes.1 -
During my first semester of CS we were mostly using MatLab for basal scripting - assigning variables, learning about scope, that type of thing. I was excited to start learning programming but wanted to actually make something rather than reversing arrays and incrementing counters for weeks.
I discovered the image() function which takes a float[][] matrix and displays it as an image. I generated my arrays of random numbers and made a simple nested loop where I iterated over each element, averaging it with its neighbours, and - it worked on the first run! I made a freaking noise and blur filter!
That rush of planning it out, making it, and seeing it work I think is my main drive in coding. All the hours of undefined-but-they-are-tho import paths and mystery segfaults are worth it once there is that moment of "it lives!". -
An anti-rant: I just made some code and out of nowhere it suddenly had an awesome feature that I didn't even program. No, not a euphemism for "bug", an actual feature.
Here's the story: A few months ago I made a shortcut for "System.out.println(…)" called "print(…)". Then I developed it further to also print arrays as "[1,2,3]", lists as "{1,2,3}", work with nested arrays and lists and accept multiple arguments.
Today I wanted to expand the list printing feature, which previously only worked for ArrayLists, to all types of List. That caused a few problems, but eventually I got it to work. Then I also wanted to expand it to all instances of Collection. As a first step, I replaced the two references to "List" with "Collection" and magically, no error message. So I tested it with this code:
HashMap<Integer, String> map = new HashMap<>();
map.put(1, "1");
map.put(2, "");
map.put(3, "a");
print(map);
And magic happened! The output was:
{1=1, 2=, 3=a}
That's awesome! I didn't even think yet about how I wanted to display key-value pairs, but Java already gave me the perfect solution. Now the next puzzle is where the space after the comma comes from, because I didn't program that in either.
I feel a bit like a character in "The subtle knife", who writes a barebones program to communicate with sentient elementary particles (believe me, it makes sense in context) and suddenly there's text alignment on the left and right, without that character having programmed any alignment.4 -
Ive been working on pseudo-Java (ie some 3rd company's UNDOCUMENTED programming language) that they parse into Java in their backend
It doesnt even support if-else (only ifs and elses) or a boolean combination of False and OR together lmao
mainly a GRPC middleware-language
Given its lack of features (arrays/collections) or documentation, I just had to implement a flag-array using a 0-1 string
Im throwing exceptions unless combined strings equal Lengths and is only 1s
living like in 80s-90s 💀7 -
Maybe people have not been around a long time here. But this JS bashing has been going on for half a decade. I honestly don't care about the merits of the language. It does what I need it to for my work. If I need more performance I drop to the C++ anyway. I like a lot of the functionality especially for arrays/lists. I love the ... operator for dynamic lists. It is very useful in the my GUI work. As a scripting language it is pretty nice.
But know this, the bashings will continue until morale improves...12 -
Im a junior android dev working in a startup. Wasted whole week on trying to parse some retarded json data generated by junior backend guy.
Im talking about objects with other objects as their elements, no use of arrays.
In the end had to redo his data in proper order so I could parse properly. Fkin waste of time.
At least now I know how to do his work, and won't be afraid to confront him with detailed criticism.2 -
Instead of using 2 dimensional arrays to represent tables, my supervisor implodes the arrays on a delimiter before loading them into the other arrays... then explodes them again when he needs to use them.
Why? "It's easier"4 -
! rant
I started to learn Matlab today. After I learnt that arrays starting with 1 in the Matlab, I started to think about why using 0 based arrays was made popular in the first place and I realized that C arrays actually just pointers and first element of the array is just a location pointed by array name. There is no need to add number to reach to the first element. After googling it, I saw that my assumption is true. Finding it all myself made me a little bit of proud 😀😀😀 Also, this expanded my horizon 🗻🗻🗻2 -
Configuring apache is so fucking repetitive and inefficient. No for loops. No arrays. Just repeating damn near the same lines over and over and over again.
Oh you want to listen to 20 ports? I hope you like copying and pasting.4 -
Fuck api docs which are blatantly wrong. Wasted several hours on building an API client with pagination according to the api docs.
Turns out the actual implementation did not follow its own spec / api doc and returns values without pagination. And some objects are not objects but arrays.
I mean, next time I build an API client, I'll just fire a dozen requests on the endpoint, see what it wants and see what I get and maybe guess right what it actually does.4 -
Shout out those who love to nest objects inside structures inside arrays.
makeup [1].your.getMind()1 -
I swear the implementation of byte arrays in dot net is fucking brilliant, never thought I would give good credit to dot net but the amount of bloody times this shit has saved me is unbelievable...3
-
"An array of arrays? What the hell?" - the client's dev team, failing to understand the parameters of the JS lib they chose to implement.2
-
48 boolean variables.
For real?
It's clear why the class name is "GameHardActivity", this certainly is hard to maintain, understand, edit, and believe.
I can understand people learning, but with 2 years of experience in programming??? And there's a matrix right in the middle!!!! USE ARRAYS, PLEASE!!!!9 -
Okay... I need to confess.
I actually like the idea of counting arrays from 1 like it is in some languages.
It makes code cleaner.
Think about it.
You would never need to subtract 1 from count/size/length or add 1 for things like the month in javascript because the first item would be at index 1 and many many errors wouldn't be happening because we don't need to force our minds to think another way. I learned counting from 1 after I learned to walk so it's the most natural thing to do. Just because the software/hardware below our language works that way doesn't mean we can not abstract this behavior away. What's your opinion about this? Am I wrong?12 -
Yesterday had fogged mind all day long. I felt like the biggest r-word in the world. Couldn't even map some simple API arrays.
Tool Laterus just makes me woke AF.
Been coding hard today since I turned on the pc1 -
ARRAY LIKE OBJECTS
Long story short, i am fiddling a bit around with javascripts, a json object a php script created and encountered "array-like" objects. I tried to use .forEach and discovered it doesnt work on those.
Easy easy, there is always Array.from()..just..it doesnt work, well it does work for one subset called ['data'] which contains the actual rows i generate a table from, but for the ['meta'] part of the json object it just returns a length 0 object..me no understanderino
at least something cheered me up when researching, it was an article with the quote: "Finally, the spread operator. It’s a fantastic way to convert Array-like objects into honest-to-God arrays."
I like honest-to-God arrays..or in my case honest to Fortuna..doesnt solve my problem though2 -
So today, my friend (who is younger) has returned from a programming competition hosted by the district. The language used was Pascal. Before the competition my friend had been pretty confident about his skills of using Free Pascal, but after that, he has been different.
He came back in tears. I asked him what was happening in the computer room.
- Turbo Pascal.
I was stunned for seconds. Who the heck in this 2019 still uses an ancient compiler dated from the 1990s for the DOS operating system? And yet the competition's computers had only it installed. I think nowadays everyone learning Pascal, at the very least, uses Free Pascal as the IDE. I could immediately imagine how restrictive and frustrating was programming on such that thing.
- I couldn't create... dynamic arrays... so I had to declare two 30 000-element arrays (which was required by the problem), but when compiling... it said... the maximum heap size was 64KB.
It wouldn't let me use "exit(result)" (to return a function's result) so I wasted many minutes replacing them with "<function name> := result; exit;".
And many more problems.
Raise your hand if you think this is ridiculous.7 -
Let's go back to the roots... don't need any frameworks... go pure JS and have control...
15 minutes later... let's build an helper class to manage arrays....
😐😐1 -
I'm developing a new (just for fun) programming language and I'm wondering what features I should add next? These features are already implemented:
- Printing text
- Variables
- user-input
- Datatype conversion (String, Int, Float, Bool, List, Dictionary)
- lists/arrays
- dictionaries
- Sorting
- Shuffling
- random numbers & choices
- Math stuff like: log, abs, floor, ceiling, sin, etc...
- Time & Date
- Working with files
- If-else statements
- Ternary operators
- Loops (for & while)
- Functions
- Classes
- Error handling
- Importing libraries & other scripts
- Arrow/callback functions
- Escaping (\)
is there anything you often use missing?11 -
In C# should I be using collections over normal arrays?
What’s the difference and what are the benefits of using collections?13 -
LUA... its great! I love it... but WHY THE FUCK DOESNT LUA START COUNTING FROM FUCKING 0!!! WHY THE FUCK DOES IT START FROM 1! I SEARCHED HALF A FUCKING HOUR IN MY CODE AND IT JUST DIDNT WORK! then it hit me... LUA IS THE ONLY FUCKING LANGUAGE THAT STARTS FROM 1 and sure enough... after changes and testing IT FUCKING WORKED!
Fuck4 -
I was programming in java, C# and similar languages for years now and I never knew how the buffer overflow exploits would work, then I started C and saw the fixed size char arrays. After puking on my keyboard I realized that most of the vulerable programs were indeed written in C or similar languages.11
-
PHP is such an absolute shit.
`array_map` takes function first param, array second param
`array_walk`, which is similar for associate arrays, takes array first param, function second param
and at the same time, the function of `array_walk` takes parameters in `value, key` order
what the crazy fuck this is.2 -
.Dispose();
.Close();
.Dispose();
what an idiot! and his profile said he had 4 years of experience...
oh, yes, and that thing of not using arrays...
I have even more code from this guy, but one picture is enough -
My problem with referring to my github:
I just found a project from almost two years ago where I exclusively use unordered arrays of key/value pairs as dictionaries.
Man, fuck previous me.1 -
How hard can it be to refactor this 170 lines file?
- a single “data” variable used to store everything
- arrays inside arrays inside arrays (see prev point)
- operations with a lot of obscure sideEffects
- $data[] = something (which in magic php land means $data.enqueue()
Why is such… biological matter… even allowed to code? Fucker’s pretending they are a senior for four years: how in hell didn’t they learn to code in this timeframe?7 -
I'm going to kill myself.
In the nodejs server for my game, there's a function that pushes to an array.
It only works if the array is empty, no matter what type it is.
List of people that know why
- none5 -
Recently I learned that the collective noun for a group of hedgehogs is an "array".
Possibly the only kind of array where we can all agree, you'd have to start counting it from 1.
Or I guess you could just name a pet hedgehog "Element Zero" if that's how you prefer your arrays2 -
Don't you ever try to translate code from one language to another. Instead grasp the problem and write the solution in the other language itself. You don't want to sit there for hours thinking if hashmaps are a good fit for phps nested arrays.1
-
Last year, I made an application of A* maze-solving algorithm in class. I used a linked list and my friends used arrays. Their algorithms were way faster than mine (I remade it later :p).
OK I understand that accessing memory by address if way faster than accessing by iterations, but I also see that python lists or C# lists are really fast. How is it possible to make a list performance-proof like this? Do the python interpreter make a realloc each time you append or pop a value?1 -
Frnd : Array starts at 1
Me : ya, when donkeys teaches Quantum mechanics and Einstein shits black hole3 -
I just noticed that when my wife fills the dishwasher, she always leaves empty the space between the border and the first support for the dishes.
I'm starting to be afraid that she might also believe that arrays start at 1...1 -
There are two types of people in this world, those that understand that arrays start at 0 and
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 2, Size: 2 at java.util.ArrayList.rangeCheck(ArrayList.java:653) at java.util.ArrayList.get(ArrayList.java:429) at NewClass2.main(NewClass2.java:7)2 -
StackOverflow locked my account. I'm hoping someone here might be kind enough to help me with a bash script I'm "bashing" my head with. Actually, it's zsh on MacOS if it makes any difference.
I have an input file. Four lines. No blank lines. Each of the four lines has two strings of text delimited by a tab. Each string on either side of the tab is either one word with no spaces or a bunch of words with spaces. Like this (using <tab> as a placeholder here on Devrant for where the tab actually is)
ABC<tab>DEF
GHI<tab>jkl mno pq
RST<tab>UV
wx<tab>Yz
I need to open and read the file, separate them into key-value pairs, and put them into an array for processing. I have this script to do that:
# Get input arguments
search_string_file="$1"
file_path="$2"
# Read search strings and corresponding names from the file and store in arrays
search_strings=()
search_names=()
# Read search strings and corresponding names from the file and store in arrays
while IFS= read -r line || [[ -n "$line" ]]; do
echo "Line: $line"
search_string=$(echo "$line" | awk -F'\t' '{print $1}')
name=$(echo "$line" | awk -F'\t' '{print $2}')
search_strings+=("$search_string")
search_names+=("$name")
done < "$search_string_file"
# Debug: Print the entire array of search strings
echo "Search strings array:"
for (( i=0; i<${#search_strings[@]}; i++ )); do
echo "[$i] ${search_strings[$i]} -- ${search_names[$i]}"
done
However, in the output, I get the following:
Line: ABC<tab>DEF
Line: GHI<tab>jkl mno pq
Line: RST<tab>UV
Line: wx<tab>Yz
Search strings array:
[0] --
[1] ABC -- DEF
[2] GHI -- jkl mno pq
[3] RST -- UV
That's it. I seem to be off by one because that last line...
Line: wx<tab>Yz
never gets added to the array. What I need it to be is:
[0] ABC -- DEF
[1] GHI -- jkl mno pq
[2] RST -- UV
[3] wx -- Yz
What am I doing wrong here?
Thanks.17 -
I'm starting to rank languages based on how easy is to create and work with multi dimensional arrays.
Converting a class that makes lot of DB connections from Java to kotlin made me realise that. Huge turnoff 😞3 -
Was trying to figure out why my fix had created a performance issue in our app. Tried loads of different things. Turned out it was because I was iterating over a ~300 item array, and then iterating over another ~300 item array within that loop 😂
300 iterations * 300 = unhappy iPad2 -
Q. Why are the arrays that Chuck Norris declare, of infinite size.
A. Because Chuck Norris knows no bounds.7 -
Changing instances to arrays. So we've all had this issue:
Option 1 was the most flexible and abstract option where a lot of functionality could be built on this.
Option 2 was the fastest solution, that would solve only specific problems.
The whole Agile philosophy points to option 2. The problem is that clients will always want to add that functionality in option 1, and changing requirements makes us lose time, the precious resource that managers supposedly cherish, yet they always want us to choose the fast option.
We're at that point where the client wants to add functionalities, but since we already built with the previous requirements in mind. Ugh.
Changing instances to arrays.1 -
When you have a task in javascript and it should use quadratic space and its use only linear space...
... easy workaround for double arrays that rise
so when n goes up
n×n array rise with 'false' within the fields? So i use quadratic space -
A few weeks ago a friend was teaching me about 16bit numbers because we were making one in C# with a function, but he said we need two numbers for the function to work.(so as an example were gonna use 0, 2)
Now I didn’t understand how two numbers were supposed to make one. And my friend could not explain it to me. So I researched the topic all day and the epiphany happened I realized I was looking at it all wrong. I shouldn’t be looking at it as 2 decimal numbers but 2 binary values or two binary arrays forming one byte array with a length of 16.7 -
Refactoring some horrendous old ass (ruby) code and I come across
`schedules.each |do|`
okay. Where does `schedules` get set?
`schedules = [create_schedule(args)]`
Cool. An array that never has more than one object in it. Good code, guy.2 -
Screw Java. Spent the last two days in this language and it's driving me to fits. Tried making a generic function. Java can't seem to easily handle generic typed arrays. Java threw a fit when I converted an array function to an integer function. Java has all this stupid boilerplate code that you put on every stupid thing.
Programming in Java is about as pleasurable as running face first into a brick wall.2 -
My first real own project outside of school was a drinking game written in Java. It had a ugly af GUI where you HAD to put in 5 names and 5 drinks because I didn't knew about storing objects in lists or arrays nor about checking for empty string when trying to access the string value that would be put in there by reading the empty input field. So I had 5 variables each for names and drinks. Then u would click on an button and it would randomly decide who had to drink which drink and how many sips between 1 to 5. Only played it ones at a party where I downloaded eclipse so that I could start my program because I knew shit about compiling into an executable file.
-
C#: The fact that T[,] (multi dimensional arrays) implement IEnumerable, but not IEnumerable<T>.
But one dimensional arrays do.
But you can still foreach over them.
What in the actual hell?
Now I have to write something ugly like
var bruh = values.Cast<float>();23 -
The last 2 days trying to fix a code with 5 String arrays and static indexes that you have to guess.
The nightmare of ArrayIndexOutOfBoundsException.1 -
Today there was a question on the react native forum asking how to map an array..... ([].map(mapFunction))
1) it's the wrong place for the question
2) like 80% mentioned ramda, lodash, underscore :(7 -
Algo question: Tree data structures while drawn as Nodes with children, are usually better implemented with (resizable) arrays?30
-
Phps love of nested arrays is similar to that of structured programing and goto statements. You will do a lot of backtracking in both of them to see where things start. God bless PHP.3
-
My first real programming teacher. She showed us strings, then made us use dynamic arrays in C++ for a year and a half. But we learned pointers and arrays very well!
The hard way can be the best way for education. -
My first programming lan was Lua. And they who know that lan knows, that I may was confused when I switched to a 'normal' programming lan like c# or java, because when you init a string you just type: a = ":)". but you can still set it to an int: a = 10. So every vars in Lua aren't sticked to a type. The arrays also can have any kind of var in it.
So I never learned what a String, int, ... is. I didn't understood why a method can't just return anything or why an array has a length.1 -
Getting a CodinGame puzzle's description without scraping the page.
I spent hours playing with different endpoints and changing values in postman, all to no avail. The most promising endpoint also returned user progress, which requires authentication, which requires a dummy account, which is against their ToS (it is allowed to reverse engineer the API though).
Turns out you just had to submit “null” for your user ID and it would remove the progress field.
Why is this tagged bad design?
["puzzle-id-string", user-id-as-int]
For almost anything, you POST json arrays...
Send help. -
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 -
Have to translate an API library from Ruby into PHP for work, and I swear it's all of the worst pieces of BASIC and Swift thrown together. To top it off, looking up a symbol chart for it to try and get a handle on the symbols they love to throw in front of variable and method names is useless because "symbol" is a freaking type in this language! Arrays are apparently called "hashes" now, and I can't quite tell if modules are supposed to be namespaces or classes yet...
If Ruby has redeeming qualities, I'm definitely open to hearing them. Right now I'm kind of feeling homesick for vanilla C, however...1 -
Working with nested arrays in MongoDb!! Who would have thought it would be such a pain to update data in nested arrays in a database! So frustrated!!!!
-
Any SUPER AWESOME patient... JS PRO that wants to help me with a few problems it would be appreciated..
Okay so I'm having trouble with JavaScript and this can apply to other languages but for now focus on JS. so I'm learning how to manipulate the DOM and I don't really know how to start I picked out a tutorial but I'm afraid I wont learn a lot from it. here are my concerns and yes they don't all have to do with the DOM
> I don't know how to learn without mimicking what the person is doing and when I try something that's related I cant use the related information and techniques because I either don't remember, dont want to do the literal same thing for something slightly different or dont know how and somethings not working even though it should be.
> I do it one way and when people offer to help its just me getting responses of how it could be done completely different and I dont understand why either way should be used
> Why should I have to generate a webpage or div if I can just use HTML5
>whats the difference between JSON and Arrays???????????
>I am not good with arrays, lists, dictionaries, (I'm stretching to python with lists and dictionaries)
>I recently tried the basic quiz project and it was more complicated and fun than I was giving credit for but I want to do it a different way to show myself I learned but I cant because I dont understand how the person managed to loop through the entire array printing the individual questions and answers to the div. like I understand the parts that use the html tags in the code but I dont know how when or what to use it all
>any good javascript/dom resources?
At this point Im just stressing because all I want is a basic skillset with JS but I dont feel like Im learning anything and I dont know how to apply my knowledge or improve upon the programs ive been learning from or trying to make. and arrays have been tripping me up to especially since I have no clue what the difference is between them and JSON and why I should use one over the other and dont get me started how shit I am with manipulating them. FUCK IM STUPID10 -
I've got a question about PHP arrays as I try to update my coding skills.
The problem I'm trying to solve is converting one vendor's CSV format to another vendor's format for a daily processing job.
I have a multi-row CSV file (number of rows changes daily but fields (15) do not). My PHP converts it to an array with fgetcsv so I can then copy its rows and data to a different blank target array with the same number of rows as the source array, but a different field order and number of fields (55) than the source array.
From here I will apply certain conditional business rules to copy data, field-by-field, from the source array fields to the target array fields, then output the target array to a CSV.
I'm stuck trying to figure out how to create (initialize) that target array so that it exists when I loop through the source array and copy values over to the target array.
Can anyone nudge me in the right direction on how to dynamically (loop?) create that multi-dimensional target array of n rows and 55 columns? I looked at http://w3schools.com/php/... for guidance but can't figure out how to structure the loop to make just one array of n rows and 55 columns, and not "n" arrays of n rows and 55 columns.5 -
Okay so update/JS pt2
This is just me throwing my thoughts down and some questions
I've been practicing arrays/objects and loops more and I'm getting more understanding it helps that you can do them both at the same time. But like I need more looping techniques (if that makes sense) like instead of always using for(let i = 0; i <= x.length; i++) and I havent completely learned how or when I use for(x in y)
Questions.
• what's the difference between class objects and objects that look like a python dictionary
• when should I use classes over the other kind of classes
• any good resources and projects I can practice with loops cause I'm kind of running dry on ideas
and I dont wanna google cause I barely already have no social interaction2 -
MATLAB literally has matrix in the name but the fucking array start at 1 thing fucks up every single time I try to use a matrix or array. How do you do the one thing you designed your program to do so fucking poorly. Whoever decided they were going to make arrays start a 1 for a matrix manipulation program should be hung and quartered.4
-
I wrote a type checking utility that also considers all types (JS without TypeScript, so this meant arrays etc.). The desired type had to be declared in a config file and the data didn’t even come from the config.
What would I not do to prevent all possible attack vectors... -
I just discovered that Go needs a very long time to compile a 120MB source code file. Beside the fact that the file was very big, it just contained a big amount of byte arrays.
Did anyone had ever such big source code files?5 -
One of not many things I really hate about PHP is when I have to write arrays. They so sugary, it is very shitty experience. I just hope we can get JSON style arrays some day.9
-
Who the fuck thought that in react useState should return an array and not an object. It makes me wanna make a wrapper that would instead return {current, set} = useSaneState('fuck you') because what the fuck does it have to do with arrays. And an object with shit.current would be consistent with useRef.
Also, vue is just superior in naming and coding standards.6 -
My brain is no good to me today. I've been debugging for the last 20 minutes, only to realize that I've been converting an array to a fucking number. Fuck arrays1
-
Arrays start at 0, so do humans lifes... Therefore we're just senseless arrays in the database called earth.sql. Depressive thoughts🤔3
-
I started my coding journey with JAVA ! I l grasped the basic concepts like LOOPS TYPECASTING ARRAYS etc. pretty well but failed to cope up with stacks , queues . So I switched to python and completed the Python Bootcamp from Udemy and now I am pretty confident in python . So should I try to learn Java again ?2
-
Have to learn the Matlab language for school. It's proprietary, you have to pay for it, and arrays are not even 0 indexed!3
-
I have mixed feelings about Elon’s Neuralink. Just read a bit of the abstract.
“Neuralink’s first steps toward a scalable high-bandwidth BMI system. We have built arrays of small and flexible electrode “threads”, with as many as 3,072 electrodes per array distributed across 96 threads.”
I’m curious, will this be this be the next “form of cognition”?6 -
My two main grudges against Typescript:
1) Union types can't be passed as arguments if there is a variant for every element of the union
2) No tuple polymorphism, i.e. [T, U] isn't assignable to [T]. This is not a mistake because the length of the arrays differs and therefore they may be interpreted in a different way, but IMO there should be a tuple type which is actually an array but length is unavailable and it supports polymorphism. This sounds stupid, but since function parameter lists work well with tuples it would actually enable a lot of functional tricks that are currently inaccessible.7 -
Y’all wouldn’t happen to have some handy mental model for remembering how to iterate through input without being an idiot about it, would you?
Referring to problems like having to get all possible substrings from a given string, etc.
Wishful thinking on my part, probably, but I figure it doesn’t hurt to ask. <39 -
Got a weird bug today...
A new feature I just implemented works but outputs nothing.
So I start printing its inputs early in the code, fine no problem here. Then I print out the supposed results a little bit later, fine too. But now the full program work perfectly.
I find out that if I remove one of those two prints then suddenly my function start outputing empty arrays! WTF?
I think I find a quantum bug, you can observe the bug or the internal values but not both!5 -
I learned a bit of python and started to enjoy programming. The syntax is short and beautiful but because I want to get into AR development I started C# now. The basics were ok but I am going fucking crazy looking at arrays. It's like the time I had to do stuff with Java again. I'd rather get tortured like Theon Greyjoy then writing this clunky garbage. But I really wanna get into AR 😖.
I'd appreciate if someone could give me reasons not to hate this syntax from the bottom of my 💓.
int[ ][ ] ohGodWhy = new int[ ] [ ]5 -
Im creating a "settings" functionality of sorts, unique per "account"
Ideally I'd create a new table, FK it with the Accs table with each Setting variable being a column
But im also inclined to just turn it into a JSON and not bother with N columns for it specially since arrays are involved in the settings
Could version it to ensure that if Settings change on code-level, old accs with old settings dont get fucked up
Now this is a pet project so im free to experiment, not bound by high level design documents
What do y'all prefer/recommend? JSON<->Settings Obj or plain old Table/column with FKs9 -
I’m fucked off tonight.
I’m having to pull a very complex data set out of dB and loop through results in a table.
Easy, done, but one of the Columns I’m pulling out needs further broken down. It’s a comma delimited string.
I can’t get the data, and inside the same loop explode that string so that the contents can be handled independently.
Raging! I have foreach loops inside foreach loops and arrays inside objects that are inside arrays.
I’m going to bed furious.2 -
Not sure if this was already shared but..
Q: why did the programmer quit his job?
A: because he didn't get arrays (a raise) -
Reading the source of a message queue system I'm planning on extending.
I don't see myself as a rockstar programmer or anything but the construction of arrays from hash tables, sorting those arrays and then a nested for loop to find matches really irks me. Luckily not on the critical message processing path but the stats collection thread. There are mutexes in play though that would probably delay processing a little bit when stats are collected. -
Does anyone know the reason behind why JavaScript Arrays start with an index of 0 instead of 1? Or why the .length property starts at 1 instead of 0.11
-
Welcome to the first (and probably only) episode of Code’s Papercuts!
I don’t like Lua. I have almost no experience with it, but in my opinion any programming language where arrays start at 1 should be ashamed of itself.
This has been ~~Brady’s~~ Code’s Papercuts!2 -
Just finished an Assembly homework... For the first (and hope the last) time in my life I complained about arrays starting from 0.2
-
Modern computer technology seems, to give an enormous edge to arrays. Elements of an array can be shifted and copied at insane speeds. As a result arrays and ArrayList will, in most practical situations, outperform LinkedList on inserts and deletes, often dramatically. In other words, ArrayList will beat LinkedList at its own game.
- Copied as is from a stackoverflow answer. The last sentence is savage.2 -
Looking through ecmascript documentation and im not recognizong anything under the arrays.
Oh thats the ruby documentation. Why am i on the ruby documentation -
Why does React have dependency arrays in all hooks if they basically always need to be filled with every single dependency? Just figure this shit out yourself, eslint can do this, why can't react?1
-
Rustfmt doesn't support inline function calls with a block last argument unless the last argument is an array literal or lambda. Dedicated support for arrays is obviously intended for XML-like trees where a factory takes a number of arguments and then a list of children, and the use cases for block last lambda argument don't need explanation, but what I don't get is how did no one catch on that this is a useful pattern that should perhaps be generalized? Why can't I produce the same behaviour for a function call in the last position.3
-
Fuck you arrays.
Why the fuck you want to start with '0'? Ohh I forgot If you will start with '1' then you can't fuck with us. Let it be you f***24 -
so... self-referential arrays.
do you know any languages that have them? thoughts?
what I mean is (in pseudo-c# syntax) :
string[] r = new string[]{ "1", "2", self[0] + " and " + self[1] };
which would result in an array with items:
1
2
1 and 29 -
Making board games in VB 6.0 with control arrays. Ah... The good old days... Control arrays were my answer to everything back then... 😎
Oooh and there was also the time I discovered the AutoIt scripting language and made MadLibs scripts that prompted for each part of speech and then typed the final result into Notepad. 😀
🤔 Or maybe if I go back even earlier... that time I discovered autoexec.bat and the escape codes for box drawing characters to make sweet startup screens for my Windows 95 install. 🤓 -
Idea: Make a programming language where arrays are indexed with py up to the nth digit.
And arrays start at 3.14 -
stdclass arrays of php are a good solution to work with data from the database but sometimes they can be a pain in the ass...7
-
Ugh, retrieving specific data fields nested within several arrays and objects in Javascript/Json jacks me up every fucking time!!!
Anyone ever fuck with the MapQuest geolocation/geoqueries api??
I'm trying to retrieve the lat/lng values out of responses generated from submitted address strings, and it's nested about 8 json layers deep.
I feel like I'm overthinking this?
I can access the values in my web console, and can reach them after using the console to assign them to a temp var, but can't get to the values from my actual js code. Only when I run some business logic from the console.
Here's a shitty example of me explaining the tree:
[{...}]
0:
locations: Array(3)
0:
latLng:
lat: <data here>
lng: <data here)1 -
I have my algorithms exam a day after so I'm on Hackerearth trying to solve some questions and many questions there explicitly require you to consider arrays to be 1 indexed. I'm like dude wtf? why?2
-
Why is it a big deal that arrays start att zero and the length att One? It's logical... Arrays as an index in memory and length as the... Length of the array (numbers of possible objects in the array)4
-
Do anybody have a Nice Code on a sorting algorythm to sort arrays with. The algo shall be in Javascript please sens answer IF you have.4
-
Lua handles arrays and maps/dictionaries essentially the same way. Makes for a pain when binding to cpp. Shame in an otherwise awesome embedded lang
-
having a DSA interview in 2 days, any suggestions on how/what to prepare?
its been years since i tried solving coding problems with anything apart from strings or arrays( and that too the one we use in dev, like writing a function to convert string to uppercase, that's all i remember)
There are a million algorithms: knapsac, djikstra, DFS BFS, bellman ford, TRIE, BST, quick sort, merge sort, insertion , binary search... these are some buzz words i could remember from my early college days, 6 years ago. I was able to understand and learn them at that time, but now i know shit about them :/
How to go with all of these in 48 hours?6 -
I am developing mobile version of c# app, completely alone in java/android. Still don't know how to use enums with int:string pair in java so I keep using arrays for this.
And I feel terrible everytime I add new thing like that.2 -
Haskell's foldl1 is do satisfying: "Folding" multidimensional arrays using a predicate feels like cheating. I feel dirty and clean everytime I use it...
-
I’ve been doing a lot of solidity development lately in my professional life.
Now I get that nested arrays aren’t implemented yet. But it is still weird not being able to have an array of strings.
(Strings are arrays of characters and that would be a meted array) -
Girlfriend complains about how I'm always on my laptop, coding, and how I'm not spending enough time with her.
I tell her that my laptop is not the NUMBER ONE thing in my life, but She is.
Little does she know that as a programmer, I start counting from zero6 -
Freaking RESTful API's.
Never worked with one before and I'm using Django Rest Framework.
Currently working (trying to) with Angular 2.
Spent lots of time trying to make angular work because ng needs arrays instead of objects when I finally realized it was a matter of the API.
Have no idea what I'm doing5 -
Fuck you drupal and your gibberish arrays. what the fuck. and the size of those, it's easier to swallow a cactus than to understand.
Fuck trying to assign a default value to a field, it is about as easy as solving the middle east conflicts. FUCK! -
create two function one for finding factorial of first 6 prime numbers and another for storing prime numbers and their factorial in two separate arrays. call both the function inside the main function.write a c++ code for solving this problem and displaying the all desired output.4
-
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 -
Just got asked what the difference was between an array and a list in python in an interview for a devops position. Who tf uses arrays in python???? I didn't even know there was such thing.8
-
Is ECMAScript a dialect of Lisp?
"JavaScript has much in common with Scheme. It is a dynamic language. It has a flexible datatype (arrays) that can easily simulate s-expressions. And most importantly, functions are lambdas. Because of this deep similarity, all the functions in [recursive programming primer] 'The Little Schemer' can be written in JavaScript."
— Douglas Crockford
An interesting discussion on SO (https://stackoverflow.com/questions...)2 -
Was working as the only frontend developer ona project having 4 "senior" developers. They use Laravel to make an API feeding the angular app.
Why the documentation sucked?
Half the API call params where missing, and not one time did I come across an example stating that the API expects a boolean only to find out 20 minutes later that they mean int 1 or 0 not true or false. Best part however was sending arrays in POST by sending the elements as comma separated values (e1,e2,e3...). Oh and not documentation but while at it a rant... There are other response codes except 200 for fucks sake -
My friends were wondering if I could teach them the basics of coding. What order should I do it in? The basic things I want to teach them are input/output, data types (numbers, strings, arrays, etc.), flow control (loops, if/else), functions, variables, and maybe oop if I'm in the right mood.
Also, would python be a good language to start with? It's definitely the language I know the best.7 -
Recently created a simple nodeJS-mongodb backend for my android app. Is it bad practice to send a potentially big object with arrays to my front end ? I've been struggling implementing this alongside with an ORM because I can't store arrays in my sql ORM.4
-
I'm so happy, I now have so much spending money
You see, At my job I finally got arrays.
(Jk, I don't have a job. Gotta love still being a high-school student.)