All,
I was wondering if anyone knew a better patten than:
array_of_hashes.map { |hash_from_array| hash_from_array[:key] }
for retrieving an array of values with a specific key from an array of hashes containing that key.
...
Suppose I have a people and their GPS coordinates:
User1, 52.99, -41.0
User2, 91.44, -21.4
User3, 5.12, 24.5
...
My objective is:
Given a set of coordinates,
Out of all those users, find the ones within 20 meters. (how to do a SELECT statement like this?)
For each of those users, get the distance.
As you probably guessed, these co...
I'm making a boggle-like word game. The user is given a grid of letters like this:
O V Z W X
S T A C K
Y R F L Q
The user picks out a word using any adjacent chains of letters, like the word "STACK" across the middle line. The letters used are then replaced by the machine e.g. (new letters in lowercase):
O V Z W X
z e x o p
Y R F L Q...
I am developing a GA for a school project and I've noticed that upon evaluating my functions for fitness, an individual is equivalent to its inverse.
For example, the set (1, 1, -1, 1) is equivalent to (-1, -1, 1, -1). To shrink my search space and reach a solution more efficiently, how can I avoid my crossovers from searching in thi...
I'm reading a presentation in which different programming languages are being compared. And one of characteristics which is measured is 'Language Performance'. What does it mean?
...
Is there ever a situation when ASM just isn't low-level enough? After all, assembler still has to be assembled. Has anyone ever written a program in binary? I'm just wondering if there's ever a theoretical reason why doing so might be practical or even if it's possible on modern computers.
...
I will be teaching my first university level Computer Science course this summer, and I'm currently working on coming up with ideas for fun assignments that the students will complete. The course is the second in the program, covering analysis of algorithms and basic data structures such as stacks, queues, lists, trees, etc.
I have a...
In a CS course I'm taking there is an example of a language that is not regular:
{a^nb^n | n >= 0}
I can understand that it is not regular since no Finite State Automaton/Machine can be written that validates and accepts this input since it lacks a memory component. (Please correct me if I'm wrong)
The wikipedia entry on Regular Lang...
I am interested in knowing how does youtube provide different quality video content. ie do they store different versions of the same video or do they have multi-layered video encoding or what is the deal here?
is there a place i can get some resources on this? papers/whitepapers etc.
Thanks!
...
So I'm going to an average university, majoring in CS.
I haven't learned a damn thing and am in my third year.
I've come to be really bored with studying CS.
Initially, I was kind of misinformed and thought majoring in CS
would make me a good "product creator".
I make my money combining programming and business/marketing.
But I have a...
As a programmer, what line of computer science or mechanism should I consider as the first step to constructing a program aware of its environment instead of blindly carrying out tasks? Or a program that convincingly simulates such to the degree its deemed useful by responding to its surroundings. Random goes against convincing.
Awaren...
Hi All,
I am not able to understand few things on the Garbage collection.
Firstly, how is data allocated space ? i.e. on stack or heap( As per my knowledge, all static or global variables are assigned space on stack and local variables are assigned space on heap).
Second, GC runs on data on stacks or heaps ? i.e a GC algorithm like ...
What does multiplexing mean (in it's abstract form)? I understand you have 'multiplexers' in hardware and 'muxing' in networks. What would a good high-level definition be?
...
I've been programming for around... 6->8 years, and I've begun to realize that I don't really know what really happens at the low-ish level when I do something like
int i = j%348
The thing is, I know what j%348 does, it divides j by 348 and finds the remainder. What I don't know is HOW the computer does this.
Similarly, I know tha...
In language design circles there used to be a long-running debate over whether languages should use structural equivalence or name equivalence. Languages like ALGOL or ML or Modula-3 used structural equivalence while ... well, pretty much most programming languages employ named equivalence (including Modula-2).
What are the typical arg...
I am currently doing my MS degree in computer science. i have a 100% Graduate Assistantship at my university, and I am currently working as a full-time software developer at a company. I admit that its very tough to do both....but doable.
So my question is: is it possible to do PhD in this way too. I mean is it possible to have a part-ti...
Hi
I am trying to code something in Netlogo..I am using an existing model Chemical Equilibrium and am trying to implement the following:
turtles-own [speed ]
ask turtles
[
;; set velocity ( ambient-temperature = 30 )
;; fd velocity
if temp > 40 [ "speed" increases of turtles ]
ifelse temperature < 30 [ speed of turtles decrease...
Hi
I am using an existing model in netlogo called Chemical Equilibrium and am adding some more code
I want to add turtles (catalyst) which have no effect on the reaction/other turtles but speeds up the FORWARD reaction.
note: forward reaction has been defined as follows
to react-forward [t]
ask t [ set color red ]
set color green
rt...
What are practical applications of Queues in Computer Science. Where do we use them and why? I heard that we use them in Video Games and Computer Simulation programs, is that true? Why? Apart from these two areas what are other practical applications of Queues as a data structure?
...
hi
I was wondering if it was possible to put balanced chemical equations, and if possible including state symbols, in the existing netlogo model that i am using, i havenot seen any examples in the models library so was not sure if it was possible.
I wanted the model to be able to allow the user to input a balanced chemical equilibrium ...