So I was playing with writing FizzBuzz in Elixir; this is my first, naive implementation:
defmodule FizzBuzz do
def getFB(n) do
cond do
rem(n,15) == 0 ->
IO.puts "FizzBuzz"
rem(n,3) == 0 ->
IO.puts "Fizz"
rem(n,5) == 0 ->
IO.puts "Buzz"
tr...
This is a Python 2 script to take in a file in one of two formats (unknown), and standardize it.
The data are coordinates in the xy-plane. They represent airfoils in the first and fourth quadrants: x should always be positive, and y may be positive or negative. The magnitude of each coordinate o...
@Jamal Also, using ints is fine. You probably don't need huge values, and Loki would tell you that unsigned should only be used to represent bytes and that unsigned don't even prevent errors and may create some more.
I wrote a little code sample which:
load images
manipulate DOM (replace images)
store/retrieve related data using
localStorage
Here's the code and demo: http://embed.plnkr.co/hTecMEP9VB300qNhzB2D/
It works, but many parts could be improved. To begin with:
I believe these lines should be t...
@Morwenn The reason why I pass the whole object to add_EXP() is because exp is encapsulated. I also don't think I should make Game a friend of LifeForm.
So, I've been given another task from my professor, and this one is bugging me.
Write a program that can replicate this sort of exchange:
`What is the url to the course page? http://registrar.indiana.edu/browser/soc4148/index.shtml
Searching for departments on: http://registrar.indiana.edu/...
Suppose I have a MyList class which extends ObservableCollection<MyObject> where MyObject has the Boolean Property Enabled.
Let's say I want the number of MyObject objects that have the Property Enabled equal to true.
Should define this as a Property or a Function?
In MyList class, should I us...
@Svante The problem might be that you are using multiple Scanner objects in your code. Use only one scanner and pass it along to all other methods that need to use it.
Good thing I managed to refactor that stupid music accompaniment in one night, I'll send it to the studio again so he can tell me the artist liked the first one better.
This is a wrapper for an API. For now all it does is get a certain document or search for relevant documents from a document store -- although I plan to build out more features later. I'm new to PHP and want to both improve my PHP skills and develop "idiomatic" PHP style. Thanks.
<?php
class P...
@Svante that's what he did last time. "I don't like the sounds you picked for drums" OK so I changed them. "Oh I liked the old ones better". Since then I have learned to make a copy of the tracks and keep the original.
I have a large number of plain text files (north of 20 GB), and I wish to find all "matching" "bigrams" between any two texts in this collection. More specifically, my workflow looks like this: for each text, for each sentence in that text, for each possible combination of two non-stop-words ("bi...
@Svante you have no idea. But at least he's a repeat customer so I try to treat him good.
I can't look it up from here but go to youtube and search for "Jacob Resch oh marie" good summer time song. That's him, he sings and plays guitar (quite well I might add) @Svante
She sounds great on the album but she sucks live, because she insists on playing piano (even though she is not good at it yet) there is no way in hell she can play the piano parts we wrote and for some reason refuses to just sing over the instrumentals we made.
HALUserDefaults
First of all, the calls to synchronize can probably be eliminated. It's quite rare that you actually have to make this call in order for the data to properly persist, and making the call every time you store something in defaults completely eliminates any advantage you'd gain by...
@Svante If you're looking to make a quality piece of OO, I think you're almost there. Of course, there's a lot to be said abut what could be done better, but I think you've got a good idea
My goals are to make this code:
faster
more idiomatic C++
What the code does:
take an integer command-line argument N
make a vector of N random floating point values
make a matrix of N*N random floating point values
do inner product of vector * matrix
write the resulting vector to a file
...