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 - "array"
-
I have an array of 1037 records. The soap service only accepts 100 at a time. So, I write code to send an array of 100 records at a time to the soap service in a loop and get a response back of, "The maximum number (100) of records allowed for this operation has been exceeded." Well, I'll try 99 records then. Nope same error. I'll try 50 records, nope I'll just bang my head on the desk now since the documentation and error say it is a record limit of 100. 😠
Look at my code again. I was grabbing 100 records out of the array of 1037 records and storing it in a new array, but I was sending the original array with 1037 records instead of the temporary array in the loop. 😢 I'm going to bed.7 -
My thoughts on programming:
As a child:
It is 100% magic
As a developer:
It is 65% if/else statements, 34% iterating an array, 1% actual amazing and unique code17 -
How language creators choose the function to get the size of an array..
I mean, the life could be more simple, this is just an example.12 -
Did this on my first programming exam.
int index = 0
int value = 0
try {
while true {
value += array[index]
index++
}
} catch NullPointerException {
System.out.print("Sum: " + value)
}
The task was to add together all numbers in an array.
I somehow aced the exam, but got called in to teachers office this is not the way to use exceptions.7 -
Me to my friend into coding : Hey! I’m finally learning to code at university!
Friend : Nice! Never Forget array start at 0. Which language are you learning?
Me: Matlab
Friend : I don’t know you13 -
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
-
Colleague: I really wish array index in all languages would start from 1. If I ever write a language the index will start from 1.
Me:7 -
People on Stack Overflow are SUCH FUCKING ASSHOLES
"You didn't show us where you declared this unimportant array, please review this article for how to ask questions"
My question doesn't concern the array, my question concerns how the system works, all code I provided was only for clarity. Read my fucking question you arrogant asshole. You have lots of points, fine, go tell your mother, but you assume I don't know how to ask a question which you clearly did not read.10 -
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 -
The person who found this toilet paper company, probably was a programmer. Also probably the best way to describe Array with an Object4
-
"Why can't I just get the terminology right in my head"
java: map.
javascript: object?
python: dictionary!
ruby: HASH!
php: aSsoCiaTiVe aRrAy14 -
My teacher told us, that the array size in C is useless, becouse the array is dynamic and can be bigger or smaller everytime you want.. Happy overriding..13
-
It's not that I hate PHP, I just hate the lack of consistency in standard function naming and parameter order, nonsensical attribute access, nearly-meaningless comparison operators, reference handling, case (in)sensitivities, and more!
I mean, look at these functions:
strtoupper(...)
bin2hex(...)
strtolower(...)
And look at THESE FUNCTIONS:
array_search($needle, $haystack)
strpos($haystack, $needle)
array_filter($array, $callable)
array_map($callback, $array)
array_walk($array, $callable)
And let me jUST USE SOME ATTRIBUTES:
$object->attr = "No dollar sign...";
Class::$attr = "GOD WHY";
HOW ABOUT SOME COMPARISONS:
(NULL == 0) // true
(NULL < -1) // ALSO true
Functions AREN'T CASE SENSITIVE (at least variables are).
Wanna dereference? TOO BAD, YOU'LL HAVE TO GET OUT THE TNT.
Alright, yeah, I hate PHP.19 -
Junior dev complained about my request to remove unnecessary comments because they're too obvious. "They may be obvious to you, but not to others" he said.
The codes and the comments:
// Sort the array
arr.Sort()
// Return the first element of the array
return arr[0]14 -
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 -
C is not that hard:
void (* (* f[ ]) () ) () declares f to be array of unspecified size, of pointers to functions, which return pointers to functions which return void.
By the way, I am uncomfortable with the fact that I am comfortable with this statement.6 -
Interviewer: "Using this 2D array and calculate.."
Me: "This input isn't a 2D array though. Do you want me to parse or construct a 2D array then.."
"It is a 2D array."
"Uh.. ok..and if it's not what if we.."
"Look my notes say you must use this input, and treat it as a 2D Array"
"What if I wrote a function for a 2D array similar to this input, but actually a 2D array"
"You must use only the input provided"
Me: does rain dance code for 20 minutes.
Interviewer: "hmm, maybe it wasn't a 2D Array. I like your efforts but that's all the time we have today."
I promise I can code, sometimes. It does help to have correct questions to give correct answers.1 -
When you see a Java devotee using Python and they're doing something like this:
array = [1, 2, 3, 4]
for n in range(0,len(array)):
print(array[n])
At least I get to tell them "hey it doesn't have to be so hard just do it like this:"
array = [1, 2, 3, 4]
for n in array:
print(n)12 -
you know you've looked into too many languages if you have to google how to properly initialize a array in java after 5+ years coding4
-
Working on my boss's code. Spent over a day trying to figure out why the array wasn't working to discover it's custom built to start at one.5
-
Oh my fucking god... I am looking at this code written by a previous developer and he put the passwords in plain in an array in a PHP file, like WHAT WHERE YOU THINKING? (btw that's also how he checks the password, just check whether it's in the array)
c'mon pls14 -
I finally ended my first side project ever. I challenged myself to write a Tetris game in vanilla JS (with the less possible lines of code), some algorithm was tougher than I expected (2d array hell) but I made it ! 500 lines of JS code, I feel I could refactor some stuffs now...4
-
Oh My God!
I just spent 2 hours trying to fix an issue. Just came to know that I was using the wrong index number from the array.
* KILL ME * -
So today I saw this guy:
long size = long.MaxValue;
//method that may or may not set
//size
int[] array = new int[size];
Apparently we are processing blu-ray movies in place in memory.7 -
So I found this in the code:
Inet4Address.getByAddress (new byte[] {0x7f,0x00,0x00,0x01})
It's localhost. Why the actual fuck would you declare 127.0.0.1 as a fucking byte array!15 -
$str = str_replace(array("\{","\}")," ",$str);
//Replaces with spaces the braces in cases where braces in places cause stasis1 -
Client's API returns a very weird response that changes its structure depending on its content.
When a array field has more than 1 children it returns:
{
"field" : [
{ "name1" : "value1"},
{ "name2" : "value2"}
]
}
So far so good. However, the fuckery happens when it has 1 children:
{
"field" : { "name1" : "value1"}
}
WTF! So the client API can return either a JSON object or an array and we cant trust the specs they gave us.4 -
Dear javascript, if your array is treated like an arraylist THEN CALL IT A FUCKING ARRAYLIST
Sincerely, a java developer20 -
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 -
If I have a wish,
I would wished for all the programming languages in this world to have their array...
...start from -1.6 -
Php array methods, all of them, or should i say hash methods
They should fix them. I mean they should fix placing of callback and subject params, because.
I mean
array_filter(array, callback)
array_map(callback, array)
Or they should make array a object like js4 -
Bought a micro:bit for me and my son. It's awesome! He's also learning super fast. He's 7 y/o and already creating something on it. First thing i've learned him: Array starts at 0 😎
-
my previous boss once told me [ ] array initializing syntax will be depricated in php 7 (few years ago) so i should only use array() instead.
couple months back after i got used to always using the latter i found out the first was never depricated but he just prefered how array() looks6 -
You know what just gets to me about garbage-collected languages like c# and Java? Fucking dynamic memory allocation (seemingly) on the stack. Like it's so bizzare to me.
"Hey, c#, can I have an array of 256 integers during run-time?"
"Ya sure no prob"
"What happens when the array falls out of scope"
"I gotchu fam lol"8 -
When a professor says, "strings are an array of characters" and you proceed to post a question on stack overflow containing the phrase, "strings are an array of characters" and get a healthy dose of knowledge about what strings actually are....
I'm paying for this education?12 -
FUCK STATIC-SIZED ARRAY!!!
FUCK YOU!!!!
FOR MORE THAN 3 HOURS I TRY TO ADD A VALUE TO AN ARRAY
Nothing work...
Nothing...
AAAAAAAAHHHHHHHHHHHHHHHHHHHHHHH!!!!!18 -
That moment when the instructor is explaining array in Java, and you are the only one in the batch having 4 Years of Experience, and Certification by Oracle4
-
PHP ist one of the languages I use regularly, but not the main language.
Anyhow, passing an array to a function will create a Copy of the array unless you specifically choose to Pass the reference.
That's seriously fucked up. What other language does that?! Coming from C, Java, Python to PHP I was not prepared to expect shit like that.21 -
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 -
So c# has its own system.collections.list and system.collections.generics.list<type> classes. And this guy wrote his own list (no generics) using an object[] array which always had same size.4
-
There was a computer programming teacher in my 1st semester who taught C. He used to have this conventional way of teaching C like other Engineering subjects which was going to more theories before writing actual codes.
These are the conversations with him.
(First day, a guy asks him some questions.)
Guy: Sir, why do we need to learn C? There are other languages used extensively for other tasks like python,etc. Why bother with this boring C?
Teacher: C is used to learn other languages. After learning C, you can easily learn other languages.
Guy: Sir, where is C's application? Where is it used?
Teacher: It is used in academics to lay foundation for students to learn other languages which are used to build softwares.
(Fucking Hilarious)
(A month after he was asking some questions to students.)
Teacher: What is an array? What is an array-name?
Student 1: Array, is this collection of data that can be stored in a single type.
Teacher: Then what is an array-name?
Student 1: I don't know.
Teacher: (angrily) Array-name is a definition itself.
(We were supposed to answer that. It was a standard definition.)15 -
Let's teach the class about security. OK *spends 1.5 hr teaching about encryption and practices* OK now students make a login page and just store the passwords in a JavaScript array....... *Facepalm*7
-
I always wanted to have an array where I could store an object at index 694307084175882649501.
And now I can!!!13 -
fuck.
I think when you need 20 minutes to figure out that you tried to use (0) to acces array values instead of [0] in Java it is time to go to bed.3 -
I'm a junior dev and my seniors insist to use Hungarian Notation. Looking the code I found a variable called oAllProjects... This is a fucking array.12
-
Trying to get the name of all objects in an array i made , thank god there is nothing wrong here...3
-
Few days ago I wrote function that finds occurrence of value in array:
function findOccurrence(value, array) {
for (var i = 0; i < array.length; i++) {
if (value === array[I]) return true;
}
return false;
}
But there's already [].includes() function in JavaScript.5 -
MFW I have to deal with an array that has various objects of many types and it's not easily debuggable because the backend is multithreaded.6
-
Here I am wondering why the array only has 1 item after the loop finishes. I wonder if it's because the array I'm pushing too is INSIDE the loop...😁1
-
!rant
I just remembered some joke I said while we had C++ classes.
To see who will actually listen to me, I said : "Hey, I heard you can malloc a dynamic array."1 -
Just thought I'd share what I've been working on lately.
Heap: https://repl.it/@AmyShackles/Heap/...
Array: https://repl.it/@AmyShackles/...
Binary Tree: https://repl.it/@AmyShackles/...
(I'm so freaking tired.)6 -
After hours of debugging a legacy binary which throwed an unknown error. Realizing that it was expecting an array starting at 1.1
-
I wish I could just destroy Apple, and its fucked up IDE!
About the image:
I'm using an array of object ("SearchFilterse") called: searchFilters IT IS A FUCKING ARRAY!
What is XCode complaining about:
completion function requires an array of "SearchFilters" and the variable "searchFilters" is not an array
if xcode could only understand the line just above "completion(result, searchFilters) it will fucking understand that I'm using a goddamn array!
and if I apply its proposed solution it tells me: Cannot use [[SearchFilters]] required is [SearchFilters]
I hate my life :)undefined apple xcode = shit on shit! shit apple let me code! apple always fucks up with devs xcode apple fucked up again! -
when code comments be like
# loop over the array
for i in 1...10
# divide by 2
x = i / 2
# return the result
return x4 -
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
-
One of our internal apis returns an array in which the first element is metadata about the request.
Why would anyone want to punish their users like that5 -
ME: so this is a RAID array
YOU: but the A in RAID is for "array" so isn't saying "RAID array" redundant?
ME: Yes, that's what the R is for.
(from Steve Land, source: http://ganssle.com/tem/tem348.html/) -
How to log in to CMS Of Doom™...
What could go wrong?
MD5 password hashing? HTTP links? Extracting the whole $_POST array?8 -
My girl friend was complaining that I care more about programming than her.
I told her,
"Trust me baby, in the array of my interests you are [1]."
She was satisfied.3 -
You guys remember that awful Java class that I'm taking at uni? Mentioned in this rant here: (https://devrant.com/rants/1461472/...).
Well we had an assignment to make a program that accepted any amount of numbers from a user and add the unique ones to an array (so if 2 was already entered, it would not be added to the array a second time), and then print the array out backwards. Simple as fuck right?
I checked my grade from the assignment I turned in and see that I only received 10 out of 50 points. Why?
"Program compiles and works with expected output. Partial credit for using ArrayList instead of array".
Uhm.. Partial credit is 10 out of 50?? And what the hell? Yeah okay let me go make this stupid program that involves an array with an unknown length and see how fucking perfect it works out for me.
Fuck you for docking my grade because I made a program that was sensible.
Fucking dickhead. -
I just love languages and functions that support using a negative int to access array from the end! Awesome.5
-
You know your codebase is fucked beyond restoration when a one-dimensional array is indexed using two indices and this formula.
FUCK.8 -
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 -
I need to delay execution of code in a for loop, how do I do that?
PHP: Sleep(3000)
Javascript:
const waitFor = (ms) => new Promise(r => setTimeout(r, ms))
const asyncForEach = (array, callback) => {
for (let index = 0; index < array.length; index++) {
await callback(array[index], index, array)
}
}
const start = async () => {
await asyncForEach([1, 2, 3], async (num) => {
await waitFor(50)
console.log(num)
})
console.log('Done')
}
start()
Fuck you Javascript17 -
The other thing I did was write a reduce function to sort items in an array without modifying the original array.
.... I really need to find a job so I stop being the sole driver of my time. XD4 -
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 -
When searching through an array,because I also program using Java,i always end up putting for(x=0;x<array.length ;x++){}
Now in php I have to deal with this10 -
My CTO uses an array instead of objectto keep list of items with random numerical keys. I told him you’re creating multiple unintended undefined members in between, he said: yeah that’s how silly JavaScript is :-|2
-
If is funny when you see a code challenge that requieres to reverse and array and you use ruby.
array.reverse! #fucking done5 -
Old but gold - try this in the Dev Tools Console and see Batman in action:
Array(16).join("lol" - 2) + " Batman!";1 -
We bitch about JavaScript a lot, but I have never encountered a language with better out of bounds index handling for its array methods. It does make some projects considerably easier!7
-
Yes, php, it makes total sense that `array_diff` compares the string representation of the elements.1
-
Picked up an older project which is in prod for 2 years now. I got a DB error related to a null in an array.
Proceed to check the front end(angular 1.5). Ended up in a 3000 lines file😫
What's worse the array was processed by multiple functions including 'filter' and 'filter2'. Naming conventions ftw😂 I don't know whether to laugh or cry 😂1 -
Laravels error reporting is sometimes fucking useless. Yesterday it wrote into the logs "class foo doesn't exist". I triple checked the including of this class. Checked the namespaces. Checked the classnames. Everything was ok.
Today I removed the content of this particular class, which returned an array. And the error was gone...
After further search I realized I was missing commas within the array deceleration...
Why the fuck you don't just tell me this????!?4 -
I actually experienced this today:
"Halp, why is this not working?"
$array = [];
$array->key = 'value';
...a few more...1 -
Linux software RAID and LVM are pretty powerful.
Bought a new server case for my home file server / VM host. 3U with 16 hotswap bays. Had 2x software RAID1 mirrors already with everything on them. Inserted 2 new disks with system running. Created new RAID10 array using these, with their mirrors as "missing".
Created new physical volume. Extended volume group into it, then used pvmove to transfer every logical volume across. Shrunk volume group to no longer use the old RAID1 array, disassembled that array, added its disks to the new array... Now just waiting for the mirror disks to sync up.
All this, with the system and several VMs still running.
And with a backup, of course ;)3 -
There is a mAtHeMaTicAl pRoOf 🤡 that a comparison-based sorting algorithm cannot get more efficient than O(n*log n). That's bullshit. Radix sort et al. — granted, they're not comparison-based.
But there is one comparison-based algorithm that can sort an array in O(n). It's called Stalin sort.
It traverses the array and deletes every item that doesn't appear in order. Boom, problem solved — the array is sorted in O(n), at the expense of losing (most of the) elements.
This is the perfect metaphor of Stalin's politics.4 -
Don’t use an array with index to get a value without checking the length. Don’t use an object without checking for null.
-
Pet peeve #1: those guys who iterate over a whole array with 'for' and 'break' on a condition. Have you ever heard of fckng 'while'??
Git source code will be the death of me.3 -
Well Argos, you now know what bad developers + Java can bring you. An out of bounds on an empty array -.^
Good job guys. Really, well done! -
When you are searching a bug for two hours, only to realise that you forget to add .length to get the size of an array... Darn you javascript2
-
When you're doing bounds checking on an array and type "i" instead of "j", so it refers to completely the wrong index >>>>>7
-
Should array indexes begin with 0 or with 1?
To end this discussion I propose they begin with 0.5.6 -
This way of converting "string" to "s" (for example)
0) program reads the whole buffer, stores it as an array of instructions
1) program reverses the order of the instructions
2) parser makes standard token from an instruction ("asd" -> ASD)
3) parser2 assigns operands to instruction
4) parser 3 makes string from instruction token ?????
5) parser fucking 4 makeS A MUTABLE STRING INSTRUCTION
6) PARSER FIVE SUBSTITUES OPERANDS
7) AND THEN CUTS IT TO A REVERSED ARRAY OF COMMANDS
8) AND PUSHES IT UNTO THE STACK
WHAT1 -
Helping out a friend how to code, and he said:
"Can't we just use a string? An array is just like a string anyway."
We were looking at some setting types in Visual Studio. -
debugging a performance issue. basically the original dev had no idea what a database was for. system was generating millions of buffered reads, and paging horribly.
to see if an id existed they had done the following:
fetch all 1 million rows into an array.
iterate the array looking for a match.
if found, set found=true
continue to iterate the rest of the array.
return found.
repeat at every login.
replaced with
return person.get(id)
set world record for most i/o avoided with one liner.1 -
That feeling when you spend two hours trying to crack an array sorting exercise for college and finally get it right3
-
Whyyyyyyyyyy are you making typedefs for a type that you only need once
Just leave the array<uint32, 20> there
It's actually less readable to typedef it6 -
I find myself always accidentally saying "string" when I mean to talk about words and "array" when I mean to talk about a list.
-
We had to implement our own sorting algorithm for a Linkedlist. My teammate was in charge of implementing this. I took a look at his algorithm when he pushed his changes. He was transforming the Linkedlist into an array, sorting it, then re-creating the linkedlist from the array.
-
Pulled two hard disks out of a QNAP NAS, and the whole RAID10 died on my. Put one back, and the array came back to life. Pulled another one out, and the array died again. WTF is wrong with you QNAP?10
-
Learning C and just wrote a function to reverse chars in a char array (ex. "Hello" -> "olleH") but the array did not change.
It took me way to long to realize: I forgot to divide the length variable by two. So it reversed the array back everytime...6 -
TIL that in JavaScript [1, 2, ] gives you a 2 elements array, while [, 1, 2] gives you a 3 elements array
WTF JavaScript???7 -
React's `useEffect()` won't fire if you have someone in your team wrote a hook that maintain a state of an array, mutates the array, empties it, and then set it back to the state.
https://codesandbox.io/s/...
Reported it, ticket closed without asking, told should avoid mutating the object stored in useState.
Isn't it bluntly obvious that if someone spent hours to spot the line in hundreds of lines of code, which actually caused the problem and reduce the whole piece of turds into some understandable minimal reproducible example means they must of course for sure know that by avoiding mutating the array it will fix the bloody issue?
Isn't that bluntly obvious they are trying to say that there is a bigger issue behind those twisted wires?9 -
Learn JavaScript.!!
Everybody talk about functional programming, I was thinking why php json_encode is not working on large array.
Javascript is Awesome.2 -
I can't believe that a modern language like JS is still lacking basic utilities like removing something from an array by value6
-
Today I was asked a question on JavaScript regarding the difference between normal `for` loop and a `map` function on an array with regards to closures. Can anyone help me understand? #javascript #interview12
-
Having a static class in C# with 20 variables of generic type: ArrayList with zero documentation to know type of array content 😒1
-
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 -
Devs who use the array map method for purposes other than generating a new array, and who use an empty return statement to satisfy the linter, should receive a slap in the face. A gentle one, but a slap nonetheless3
-
"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
-
I don't care if a language decides to start their array on 0 or 1...
I just would like every language to stay consistent because I'm tired of trying to figure out why in the hell my array key isn't defined.4 -
Failed another programming intervie. Didn't expect the 2D array question. Feel so bad. Just wanna cry and give up. I need to get better..fast.5
-
"The reddit" or forty two function
ary[41] == ary.forty_two
Explanation https://quora.com/Why-is-Array-fort... -
Oh Shit! Here we go again!
print(request_permissions)
>> [ ]
if request_permissions:
//some if shit
else:
raise 404
It was supposed to raise 404 for empty array, but continue to exit if.
Me: What the fuck?
**printing request POST data**
**empty, nothing wrong here**
**double checked print statement output**
** still printing [ ] **
**restart server and again checking print statement**
**still same**
Getting mad over myself, for failing to debug simple if else.
Wait....
print(type(request_permissions))
>> <class 'str'>
Me: What the actual fuck??
Fucker literally dumped empty array to JSON causing array to convert into string "[ ]" and still using if else based on array instead of string length.
Thanks to our Product Manager who approved our request to revamp this part of code and also revamping the whole shitty project developed by 3rd party in upcoming quarter.22 -
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 -
Can any sql guru take a look at this problem?
I try to select number array from a JSON object, but have no idea how to do it.
https://stackoverflow.com/questions...5 -
I had to solve some issues regarding comments on a Wordpress site.
I noticed some interesting code that an old developer had left behind.
It was an array of swearwords, and an if statement that checked if words in a comment existed in that array of swear words.
It was written in Javascript, everyone; including the customer could see the array of nasty words...3 -
CLEARLY! ...
I'm drunk.
//motherfucking populate the mailings table yo
Route::get('fuckman', function () {
$statuses = array('queued', 'sent', 'failure');
$statusKey = rand(0,2);
$mailings=App\Models\Mailing::all();
foreach($mailings as $mailing){
$mailing->status=$statuses[$statusKey];
$mailing->save();
}
return 'fuckyou';
}); -
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 -
You know what's better than a Bucket Object that wraps an arraylist?
A BucketBucket Object which wraps an array of buckets which each wraps an ArrayList.
FML1 -
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 -
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 -
What's this orange light blinking on my RAID array. Ah, the sign for praising all weekend on a rebuild...
-
C:
char greeting[] = "Hello world";
Developers: char array... What da f*CK!
C++
... Okay.
std::string,
std::string_view,
char*,
std::wstring,
hstring,
qstring...
How about now? ( ͡° ͜ʖ ͡°)5 -
Frnd : Array starts at 1
Me : ya, when donkeys teaches Quantum mechanics and Einstein shits black hole3 -
What the fuck is going on ???
How the "intermediate" c# developers can't do a simple null safe average of even numbers in an array ?!
Why they still write loops and shit (without any nul checks ofc) while it can be done in 1 line :
array?.Where(x => x % 2 == 0).DefaultIfEmpty(0).Average() ?? 0
WHY ? Even Junior c# dev is supposed to know that shit4 -
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 -
Having a method that is only called at one place is ok, if you want to tidy your code (except that that hope is long lost in this project). But if that method usually returns an array, except if it's an empty array, then it returns null, but at the only call location you handle that null case specifically to act just like it would if you just had returned that empty array in the first place, then I ask myself: Why separate that?2
-
Deciding to make the website I'm working on a one pager with calls to API.
Why did I decide to make such an extensive API. 😅
API functionality includes:
user endpoint:
- log in/out
admin endpoint:
- edit user
- create/delete user
- create (sub)menu categories
- create items (install/test/image)
image endpoint:
- create image (of machines in array)
- restore image (of machines in array)
install endpoint
- install machines (Windows/Linux)
test endpoint
- auto-test (array of machines)
- test (array of machines, test)
Then the machine endpoint:
- if action in table then do action3 -
C++ Really confuses me... I mean why when defining an array variable is the array notation on the variable name rather than the variable type?1
-
Today I learned.
In php if you cast a string to array you get an array with one value: the string.20 -
We used a javascript library before on our project. While reading the documentation, it states that you need to put the ajax response on an .addRow() function in json array.
That was what we did, but it keeps on throwing tons of errors. In the end, we visited our senior dev. Turns out, the function needs an array and not a json array.
I stopped reading documentations since then. And our senior dev stopped talking to us. Hahahajk -
Getting hard time to understand std::vector and even more confusing with multidimensional vector.
Going back to array. 😪4 -
To generate a true random number you must call the random function a random amount of times, store those results in an array, then pick a random array index5
-
I have a PHP related question.
I noticed a few frameworks make use of this structure of code and it makes absolutely no sense to me. There would be a PHP file, and the contents of the file would be as follows:
<?php
return [
‘a’ => ‘b’
];
My only understanding is that this is an array/object but I have no idea how these values would even be accessed.
Like, there is no array variable, how can a php file simply return something into a void? There isn’t a function or variable to catch that array.
How does this even work?23 -
*array* in php. As soon as the word "array" is in it's name it's argument order, type and return value are just fucken luck.1
-
!rant Spent days reading Unicode docs, trying to make sense of what codepoints were included in every Unicode property escape in JavaScript and awk’ing the heck out of the different text files associated with them.
Then at around midnight the other night, it came to me. I was an idiot.
I could literally just create an array including every Unicode codepoint and write a program to iterate through the array and test if it matched against a Unicode property escape.
Unicode array: https://gist.github.com/AmyShackles...
Program to compare against Unicode property escape: https://gist.github.com/AmyShackles...
So. Much. Easier.
Happy 2024, friends. -
Another terrible rant from the inhereted Hydra source code. So deep in the dark dungeon of that code I noticed something interesting. They declare this INT32 array with an incredibly long (like 200 values) list of hard coded magic numbers. Something along the lines of:
INT32 array[200] = {-1,0,1,21,4,7,19,33...};
However, the resulting output was incorrect. After spending a fort night and a good chunk of my remaining sanity I had overcone the 437 levels of indirection left by the previous programmers, and narrowed it down to this line. But it looked perfectly fine.
I pull up the diffs and notice someone had checked in a change to the source. I track it to this line and find what the original data had been.
INT32 array[200] = {-1,0,1,2l,4,7,19,33...};
In VS the default font shows l and 1 as fucking identical. Someone had accidentally made that change to 21 from the original 2l and checked it in. I mean I can't really blame them. Who the fucking hell inatantiates a fucking int32 array and peppers in a fucking 2l (long) for no fucking reason?! -
When I close my eyes I see identical objects in array, forming random numbers.
Last time it was a 7.
Anyways, gotta sleep.1 -
When everything passed to the front end is in the form of a magic array... all values are grabbed using an arbitrary index...
-
Interviewer: What is typeof typeof []
Interviewee: I think it's Array
Interviewer: Why?
Interviewee: Because first one would return Array, so second one will also return Array
:/5 -
My fucking god!! I swear if i meet the guy who implemented Array.reduce in javascript!! I'll tear his god damn head clean off and stuff it down his throat!!
From the spec: "if the initial value is omitted, the first value of the array is used instead and skipped"
WHO TF THOUGHT THIS WOULD BE A GOOD IDEA!?!!?!
One freaking hour that stuff cost me today RRREEEEEEEEEE
# rm -rf $JAVASCRIPT
Please and thank you!7 -
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 -
Project was based on Ionic3 with angular and SCSS.
Ionic has an SCSS array with colours that generates countless CSS classes for each combination of color-component.
Smh I managed to reduce the amount of colours in that array and reduced the overall size of the final CSS by 48% (from ~8MB to 4.1MB)
Of course the overall app had no performance increase BC the problem is the main.js file which is about 12MB with no lazy load3 -
Quirk of C++ (also C I think)
int array[]={1,2,3,4,5};
int temp = array[0]; //valid access
int temp2 = 0[array]; // also valid
C++ is a member of the Foot Shooters Club languages of choice.
Also, this weekend I learned you cannot have a vector of references:
https://stackoverflow.com/questions...
Well, at least not without some pain.5 -
The forEach in JavaScript makes no sense. It looks like a map /filter/reduce but doesn’t actually return the array. Can you please loop like a normal language?8
-
So i'm working on this course assignment program and i'm trying to remove object from a 2d array and I couldn't figure it out how to do it without messing the array indexes. Wen I was using aarrayList I could just do arrayName.remove(number), but not with the regular array. Than I had an enlightment moment.
Why not just move the object off the screen?1 -
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 -
Definition of database table in my DBMS book :
Table is a rectangular array 😩😂😂😂
I am like why am I even studying this subject1 -
At the very start when I learned my first language. Didn't know where to find the "{" and "}" keys on the keyboard. Thought I would never be a dev, since I couldn't write a program without those keys.
Or when I didn't understand the notation of accessing values inside an array. Thought things like array[0] would do some magic to the array and didn't know how to access other parts of an array. I was following a book back then. -
Why would you do this?
public Array multiContent;
I'm working on a legacy c# app, trying to understand what the developers were doing here1 -
Can the subscript of an array be a floating point number ?
i know, i know, i can find answers on google and i found one on quora but i want you guys to help me 🤗 in the comments10 -
So I have an array of length 20 which stores a 64 bit decimal number by digits. The starting address is let's say array64. When I am trying to build up my number in ECX:EBX, I am using EDX as the iterator to access the individual elements of the array (I am loading them into AL)
.LOOP:
....
MOV AL, [array64+EDX]
INC EDX
....
JMP .LOOP
The problem is: somehow EDX cannot get higher than 10, so the program just stops and waits for input, when I try to work with a 12 digit number...
This module is outside the main function, and I thought about some Far Pointer problems, but all of my ideas just failed...
What is wrong here?1 -
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 -
Why THE FUCK would Array.fill(arr) use arr's REFERENCE?
I know it's the default behaviour on parameters but WHY WOULD YOU WANT THAT BEHAVIOUR IN THAT METHOD?3 -
I kind of hate people who use the JavaScript array method Array.reduce(...)
It rarely makes sense but makes code unnecessarily complex to read.12 -
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
-
Do I have just a bad version of ecma script or is this some stupid shit in JS in general? I want each sub array to be separate entities, not that same one for all. I assume the fill in just putting the same list in all of them? I honestly don't care I guess, replacing a sublist is fine too. Rather than editing each element separately. Saves ram in long run.
let arr = Array(5).fill(Array(1,2))
console.log(arr)
arr[0][0] = 3
console.log(arr)
[[1,2],[1,2],[1,2],[1,2],[1,2]]
[[3,2],[3,2],[3,2],[3,2],[3,2]]
Congratulations, you are my dev duck today.19 -
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
-
// Pouring over idiot API developer's crappy documentation.
Example:
Goal Detail
* From Docs "table_breakdown key will return an array but will always only contain one json object.
json -> "table_breakdown" [
{
"field" : "value",
"etc" : "etc"
}
]
WHYYYY!!!!1 -
New data structure:
Map with repeated keys allowed. Values of repeated keys will be stored in an array.
Calling get(key) will get the array, pick a random entry in said array, and return it.
Use: Finding what the "number one rule of x," the "greatest thing ever," the "most unbelievable event," and more is. -
DailyCodingProblem: #1
Given an array of integers, return a new array such that each element at index i of the new array is the product of all the numbers in the original array except the one at i.
For example, if our input was [1, 2, 3, 4, 5], the expected output would be [120, 60, 40, 30, 24]. If our input was [3, 2, 1], the expected output would be [2, 3, 6].
this is my quickly solution in php:
$input_array = [1, 2, 3, 4, 5];
echo('INPUT ARRAY:');
print_r($input_array);
echo("<br/>");
foreach($input_array as $key => $value){
$works_input_array = $input_array;
unset($works_input_array[$key]);
$result[] = array_product($works_input_array);
}
echo('OUTPUT ARRAY:');
print_r($result);
outpout:
INPUT ARRAY:Array ( [0] => 3 [1] => 2 [2] => 1 )
OUTPUT ARRAY:Array ( [0] => 2 [1] => 3 [2] => 6 )5 -
In android 7.1, I've seen a lot of conflicting reports about crypto security.
If I do something like the following in the default android 7.1 browser...
var array = new Uint32Array(n);
window.crypto.getRandomValues(array);
How secure would the resulting numbers be overall? I'm asking because I've seen a lot of articles talking about it, but they never specifically mention the default 7.1 android *browser* and what or how it obtains secure random numbers. They only ever talk about the api, sdk, and developers working in java.4 -
I'm developing an app for a client, but they are responsible for the APIs.
Which turns out is the biggest mistake of my life...
I don't know whether data types are unknown to them or they are just playing a sick game with my emotions.
They have a different data type depending on how they feel, e.g.
- a boolean can be true, false, 0,1 or 2...
- an array can be an array or just a single item...
Who in their right mind can do this?4 -
When you need to fill an array with a database that has over 10000 rows and took hours to import, and you remember you truncated the database.. I hate my life now.2
-
Why the fuck is it not possible to pass a pointer to a multidimensional array in C++? Like who the fuck though a pointer to a pointer to an array was an elegant solution? I still can’t get my head around how to access the fucking array!!! And this is for a project too that solves poisons equation using the finite difference method none of which was EVER explained!!! Does anyone have a clue about this??????
-
Just lost like half an hour debugging an issue because I was using .pop() to get the last element of an array, but not intending to remove the element from the array. I wish typescript had immutable references... Rust kinda spoiled me there.2
-
!rant
This is neat https://twitter.com/atlasobscura/... take a picture of bunch of lava lamps, make that bit array your entropy for crypto.1 -
So last week, I struggled to loop through an an array on HPSM JavaScript... I felt like garbage. I have a computer Science degree BTW.1
-
<?php
// This is the demo code of a PHP gotcha which took me some hours to figure out
$hr = "\n<hr>\n";
$JSON = '{"2":"Element Foo","3":"Element Bar","Test":"Works"}';
$array = (array)json_decode($JSON);
echo "Version: " . phpversion() . $hr;
// Tested on: 5.5.35 and 7.0.15
var_dump($array);
// Prints: array(3) { '2' => string(11) "Element Foo" '3' => string(11) "Element Bar" 'Test' => string(5) "Works" }
echo $hr;
var_dump($array['Test']);
// Prints: string(5) "Works"
echo $hr;
var_dump($array[2]);
var_dump($array['2']);
var_dump($array["2"]);
var_dump($array[3]);
var_dump($array['3']);
var_dump($array["3"]);
// Prints: NULL + Notice: Undefined offset ... in ...
echo $hr;
$newArray = array();
foreach ($array as $key => $value) $newArray[$key] = $value;
var_dump($newArray[2]);
var_dump($newArray['2']);
var_dump($newArray["2"]);
// Prints three times: string(11) "Element Foo"
var_dump($newArray[3]);
var_dump($newArray['3']);
var_dump($newArray["3"]);
// Prints three times: string(11) "Element Bar"1 -
I just wasted a few hours by not realizing that array.prototype.concat does not act upon the array calling it but rather that it returns a new concatenated one :/
-
I'm browsing through my old 'learning projects'.
I realized that I didn't knew json and exploded the whole json string and had an array with 4 dimensions. -
Re-instantiating the interesting bits from the other thing:
Time complexity of unsorted array equality operations. Go!23 -
Functions with all Get/Post data as parameters like this
public function qwerty($params)
{
return $params['item']['price'][0]* 2;
} -
In Go, one symbol is called a rune. A string is a string, but when I try to manipulate it, it turns into an array of bytes, not an array of runes. I then have to deal with this crap.
Can you suggest some mental gymnastics to justify this behavior to people who use real programming languages?5 -
I requested an response from an Json api, the documenting and example showed perfect json as soon as I request it my self I get an array with Json in it.
What fucking logic is it to left your Json api with an array that contains the fucking Json took me way to long to debug that shit.1 -
Mongoose: Callbacks VS Promises? Opinions and reasons please.
I'm trying to update array of data which involves couple queries.. Best practices?9 -
this aint working for some reason. unless im missing something then im completely stumped.
https://gyazo.com/37598c63be6af4702...
can someone please tell me what’s wrong?
It’s an array of objects that im trying to turn into options for a selector with the id prop being the value and the name prop being the actual text but it keeps saying select.add or appendCHild isn’t a function. now im lost.
god i hate tests, i know they are needed but damn5 -
I spent 2-3 days on debugging code written in assembly script. Apparently, you need to initialise an array using new method otherwise it re-uses the previous array from the same scope and it has created infinitely large array. Just wtf.
And I got error like "wasm blah blah blah blah blah blah".Just give proper error.
Running the environment locally wasn't an option because well it doesn't fucking work locally. So, I have to forcibly test on CI and they have created a site that can show you logs because you can't access or query data directly from server and while debugging you try to log something it randomly works sometimes and sometimes you get output from god knows which deployment. Just create a fucking API for displaying log or build a proper docker so that we test it locally.1 -
I love that every time I try to find cURL docs I'm treated to a full array of beauty blogger videos.1
-
Remove a property from an array to spend an hour trying to work out why something isn't running to notice that there was a count later on the array that required a specific number of elements so the bit I was expecting to execute never executed.
Was looking for ages as to why.
Friday afternoon code brain. -
The circular was crashed my PC just because of playing with "list all fields and it's sub fields to an array"...
Now I hate circular thing -
Currently working on a snippet manager application in my free time.
Added support for c++,c and codffe script. Added them to my supported languages array to use them inside the editor.
Just to realize that now all my test snippets i created for testing are using the wrong language for the internal code editor.
Well Fuck me! Deleting all snippet files now and changing the system to be indipendent of the array index. -
Fun fact about JavaScript: it's a... bit inconsistent. For example, functions like Array.map, Array.reduce, Array.sort don't mutate the array, but Array.unshift does, and returns array's length after the element was added.5
-
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
-
old MATLAB versions are such a pain
I can't even check if a char array (sort of a string) contains another char array.
MATLAB is like a sports car for mathematics, but a broken wheel chair for actual programming...... -
So I've been tackling the Multer package with express and react, Christ what a nightmare so far. I can't get anything to work.
- Images as array string in mongoDB check
- enctype on the form, check
- state for the field set to an array, check
- type file check
- express configuration based on the Multer docs check
Everything as far as I can tell is as it should be, yet nothing gets saved.
FFFFFF9 -
Jackson has this adorable option of an array sintax to represent every object on a JSON where the first element of the array is the classpath of the type and the second is the object itself and someone thought it would be nice to use this notation on a REST API...
why? -
The algorithm basically works like this:
For every element x in an array, start a new program that:
Sleeps for x seconds
Prints out x
The clock starts on all the elements at the same time.
It works for any array that has non-negative numbers. -
You have an array of objects with a startIndex and endIndex representing their position in a string & you want to end up with a nested structure to represent their relation in the string (i.e., A is from 1 to 10, B from 3 to 5, C from 4 to 5, D from 7 to 9). How would you do it?
Input array looks like: https://gist.github.com/AmyShackles...
Desired output looks like: https://gist.github.com/AmyShackles...
(Though what I really have to start with is an object whose keys are the start index and whose values are values of each element in the above input array, so if you can think of a way to morph it without needing to turn it into an array first that’d also be cool)
Figured I’ve been stuck on this part of my side project for long enough that I really should just make a desperate cry for help. ❤️question please help with a little help from my friends man i hate data structures regex parser still killing me5 -
Help? I would like to create a Search delegate with Edit Text (Because Search View is weird) for a custom adapter List View (not String Array).... anyone know how?
I search over the Internet all I found is Search Delegate for String Array. -
I have a function that receives 2 parameters: a string and a max numer of characters.
It returns an array with the partitioned string.
Example:
function name("hi, I love devRant", 10);
//return:
array(2){
[0] ->"hi, I love"
[1] ->" devRant"
}
Now.... what would be the appropriate name for that function?10 -
Guys, is any one worked with d3.js ?
I need a graph and my data source is a 2d array, A Boolean array I mean.
bool[,] matrix;3 -
"You shouldn't use STL as it's slower"
<<Writes std::array instead of double* >>
Oh look, the execution time and the instruction read is the same! -
A usefull function, everyone should have near by. May requires some optimisations.
/// <summary>
/// DoEs tHiS To tHe pRoViDeD StRiNg. StArTs aLwAyS WiTh a cApItAl
/// </summary>
/// <param name="s"></param>
/// <returns></returns>
public static string DoThIsToThEtExT(string s)
{
var array = s.ToCharArray();
Parallel.For(0, s.Length, (index) =>
{
if (index % 2 == 0)
{
array[index] = array[index].ToString().ToUpper()[0];
}
else
{
array[index] = array[index].ToString().ToLower()[0];
}
});
return new string(array);
}3 -
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) -
When I copy some lines of my source code into other functions but getting desperated when compiler says something like "...'Double' but 'Array' was expected" because I forgot to change the value for the functions.
-
How come when implementing merge sort the mid doesn't need to deal with odd/even division?
I know int will always go down if there is decimal but how will it cover the whole array?
Full code:
https://gist.github.com/allanx2000/...
I guess in general, array indexing that involves dynamic cutoffs always confuse me.
How do you think about them without having to try things out on paper?7 -
Is there any way to sort an array in such a way that picking 3 numbers a,b,c randomly from the array and performing a cyclic right shift then place them back in the array??10
-
i am trying to pass an array of php to js for use with beforeshowday function in datepicker. any suggestions?4
-
Learning Python from some days back, and have confused about Python Array and Python Lists, please help me to understand this.
Thank You.5