I have written up a data structure in Java that supports the following features:
get(i)
set(i, e)
add(e)
remove(e)
contains(e)
size
Elements must remain in order and iteration needs to be as fast as possible. The code does not require thread safety.
This is my current solution which seems to...
http://www.commitstrip.com/en/2015/06/29/as-the-last-resort/ CommitStrip - Blog relating the daily life of web agencies developers As the last resort CommitStrip 1435600332
@Jamal Reminds me of those 'shoot yourself in the foot' jokes.
After correctly packaging your foot, you attempt to concurrently load the gun, pull the trigger, scream, and shoot yourself in the foot. When you try, however, you discover that your foot is of the wrong type.
@Jamal For what it's worth, I think it's valuable advice.
You're explaining the risks which he probably hasn't seen.
For generic template types, it's more common to use T. This would help take out the guesswork if one isn't already aware of the template statement.
Your typedef is superfluous since it's only used once in main(), so just remove it. The new name itself doesn't add anything to the context anyway...
I'm replaced character strings with numeric codes in R. I find myself doing a lot of copying and pasting, so there's probably a better solution with apply, sapply, or ddply that I'm missing.
Here's an example:
example <- data.frame(matrix(nrow = 20, ncol = 20))
example[,1] <- 30:49
example[,10]
If you have code that is working but you would like to be more efficient or clean, try posting over on Code Review. (although they may want you to provide sample text files first so they can easily test their changes) — Kevin44 secs ago
If a packet hits a pocket on a socket on a port, And the bus is interrupted as a very last resort, And the address of the memory makes your floppy disk abort, Then the socket packet pocket has an error to report!
I've recently started teaching myself Python but have no prior programming experience or formal training. I've successfully created a program that outputs what I wanted it to output, but I'm looking for guidance on design/efficiency. Is there an overall design that would have been more efficient?...
If you run a .bat file with %0|%0 inside, your computer starts to use a lot of memory and after several minutes, is restarted. Why does this code block your Windows? And what does this code programmatically do? Could it be considered a "bug"?
@steve, from what you say I would guess that intermediate assignment(s) are reasonable in your case. If you want a more considered opinion, you could always post in Code Review. — Roamer-188858 secs ago
It is election season in Puzzlevania. There are two candidates: the incumbent and a challenger. Of the $20$ million citizens, only $1$ percent support the current president; the other $99\%$ favoring the challenger.
Here's how the election system in Puzzlevania works: There is a list of numbers,...
Nerdcore is a genre of hip hop music characterized by themes and subject matter considered to be of general interest to nerds. Self-described nerdcore musician MC Frontalot has the earliest known recorded use of the term (to describe this genre) in the 2000 song "Nerdcore Hiphop". Frontalot, like most nerdcore artists, self-publishes his work and has released much of it for free online. As a niche genre, nerdcore generally holds to the DIY ethic, and has a history of self-publishing and self-production.
Though nerdcore rappers rhyme about anything from politics to science fiction, there are some...