« first day (946 days earlier)      last day (3070 days later) » 

8:17 PM
Working code that you would like to optimize should be posted on CodeReview instead of StackOverflow — cricket_007 10 secs ago
 
Greetings
 
@Mast that one's kind of answered in the comments...
 
@cricket_007 yes looks good for codereview — Caridorc 56 secs ago
 
@IsmaelMiguel grettings
One question on SO is actually good for Codereview, what a day
 
How is it going?
 
8:22 PM
Everything good, just a bit anxious for some hard tests I am going to have shortly
 
I hope it goes better than your expectations
 
Thanks :)
 
You're welcome
I'm facing a huge problem right now
 
@Caridorc Hey, same!
 
I need to split a library into modules
 
8:26 PM
@syb0rg hi, cool to know we have tests in the same period
 
I've split it by functionality, but they have loads of code in common and they take 16kb separated
 
I have a Calc 3 test tomorrow, and I know literally ~25% of the content
I think that is an optimal estimation
 
@syb0rg well, I have 3 different tests, on completely different subjects...
 
@Caridorc Finals? Or just pre-finals?
 
@syb0rg well in Italy it is a bit different. We divide the school year in 3 / 5 or 4 / 4 months periods. The 3 months period is going to end in 2 weeks so teachers need the last marks
 
8:33 PM
@Caridorc Ah, see this Calc 3 test is a pre-final for me
And then I have 6 finals to study for shortly after that
 
So the school year ends at december?
 
The first semester ends, yes
And then the second semester starts back up in January
 
Wait a second... two semesters -> 6 + 6 = 12 -> You have no holidays at all?
 
@Caridorc semesters usually are a little shorter
I also have semesters, but they include holidays in between the semesters (and for schools also holidays for two weeks after 8 weeks school)
 
@Vogel612 in Italy it is beautiful, 3 months of holiday in the summer to go to the beautiful sea. And a bit for Christmas and Easter but just a bit
 
8:40 PM
wow that's overkill
 
@Caridorc Our semesters aren't 6 months long
 
Germany has 6 weeks in the summer
and then 1 or 2 week holidays sprinkled all over
 
Semesters are about inbetween 4-5 months
 
christmas, carneval, easter, in the middle of autumn..
 
For me anyways
Summer is 3ish months
 
8:42 PM
Interesting, so a semester is not always six months long...
 
Yup
And I won't even go into the concept of the J-term...
 
sounds like something mathsey
 
@LokiAstari Thank you for both of your comments. I read about code reviewing and re-factoring but I didn't know there was a place on stackoverflow to do so. Thank you so much for the help. — BitShift 34 secs ago
 
"a place on stackoverflow"
 
@Vogel612 Better than a forum
 
8:48 PM
true that
 
0
Q: Rails guestbook with new, index, and Kaminari pagination in the same method: refactor

JackI created a guestbook that on one page displays both the form for a new entry and all of the entries that have been created so far. I am trying to use Kaminari for pagination for the entries. Right now this code is working on my local machine, but I just have that feeling that it could be impr...

 
Shouldn't that be a meme?
 
meh. it isn't really...
 
It doesn't really have the traction I'd say...
not really viral..
 
8:51 PM
But used quite a lot, I guess
 
@Vogel612 That doesn't mean it isn't a zombie.
 
This seems more like a code review type of question. — Brian Rogers 1 min ago
 
@IsmaelMiguel Memes should die.
 
@Mast Well, people should stop calling CR a forum. Therefore, it should die as well.
 
That's not how logic works.
That's not how any of this works.
6
There's nothing wrong with using proven statements. Just don't focus on whether it's a meme or not.
 
8:55 PM
I'm asking because it is quite a lot used
 
monking
 
Greetings
 
I thought my C# code was OK-ish, wow was I mistaken!
 
Same with me :/
 
@Phrancis 'Ello!
 
9:13 PM
Hey there @syb0rg!
 
@Phrancis What code?
 
@Phrancis Got a thorough review tho!
@Hosch250 Nice answer! Have a medal!
 
@Vogel612 "Stack Overflow" is not entirely wrong, unfortunately.
 
Yes, all 3 reviews were great but @Hosch250 really went above and beyond
 
9:17 PM
@200_success About?
 
Hmm, I'd like to hear some opinions about calculating a grade for a project that I failed :/ I'm quite pissed about it, but not sure if I'm right
 
Gak. Replied to the wrong message.
 
lol
 
We had a project with 7 students, and we got a 6 in the end as group, in the peer review the average of our group was a 7.3 and they gave me a 5.2 (which is somewhat correct, though I believe my efforts have been sufficient)... Then my final grade consists of 50% project grade (a 6), and 50% project grade minus difference with average peer review grade (6 - 2 = 4), so final grade is avg of 6 and 4 and I failed it with a 5
Does that make sense?
 
The calculation sounds right
Someone really bent over backwards to come up with such a complicated way to grade though
 
9:21 PM
Similarly in that scheme, if the project gets a 6, and the others each gave eachother an 8.5 and me a 6, then I would still be off 2 points of the average, get a 4 for my personal part and fail the class, while both the project grade and my peer review grade was sufficient
 
So really, one could play the numbers and give lower peer rating and in doing so, make the gap smaller and thereby individual grade higher...
Pretty big flaw of that system right there
 
I for once do not agree with the peer review grade so I'll complain about that, but I think I also need to inform my direct coordinator and the exam committee about this...
 
Holy carp
Solving Project Euler #1 in F# is easy.
It's literally 3 lines of code.
 
@skiwi Show the problem that @Phrancis gave with the grading scheme
 
@EBrown in Haskell:

    main = print $ sum $ filter (\x -> x `mod` 3 == 0 || x `mod` 5 == 0) [1..999]
 
9:26 PM
@Caridorc in F#:
printfn "%i" (List.sum (List.where (fun x -> x % 3 = 0 || x % 5 = 0) [1..999]))
 
I'm not even so much pissed about failing the subject, I'm more pissed about being handed a 4 as a grade
 
@skiwi what @syb0rg said
Peer review grading, as applied in this instance, brings a huge amount of subjectivity in what should otherwise be as objective of a process a possible
 
@EBrown they are almost identical, but I guess that happens with languages of the same-paradigm
 
Indeed.
 
Also somewhat dumb that peers control such a big part of your grade
 
9:28 PM
^^
 
I agree that they perhaps should have input
But jeez, limits
 
I guess in the end the result is the same, project grade is a 6, based on peer review I've done "not enough" get a -1 and end up with a 5...
But not like this, not like this
 
@skiwi What's the highest grade one could achieve? 10?
 
I'm sorry to hear about your grade @skiwi, really am. Hopefully some sense can be talked into the people who came up with this, or at least the professor(s) involved in the grading
 
@syb0rg Yes, graded on a scale from 0 to 10, though in practice minimum is usually 1
 
9:34 PM
What would happen if the peer review was lower than the group grade? Would it add points to individual grade? (that would be the logical extension, at least)
 
@skiwi Remember that what matters is what you know, not an arbitrary number. If you know your stuff, don't worry everything will work out.
 
@Phrancis I don't have high hopes for it, but I'll at least try to get something going, in any case I won't be doing a resit for this project, either an extra assignment or a replacement subject
@Phrancis You must mean higher there, and it would add points yes based on this scheme (I can only assume)
 
@Caridorc words of wisdom right there
 
@Caridorc Unfortunately, employers mainly look at those arbitrary numbers these days
 
@skiwi Perhaps you should also mention that, showing how biased that grading system is
 
9:36 PM
@syb0rg Or worse: "We are looking for a graduate fresh out of college with 10 years of experience."
11
 
Sadly, people consistently fail to recognize the difference between quantity vs. quality
10 years of experience to some is 2 years or 15 years to another
 
I just add up how many years I have of experience with each programming language I know.
So far I'm up to 22ish.
 
@EBrown Which I may be able to do... Okay, well not 10 years :P
 
"How can you have 22 years of experience when you are only 21?" ""
 
@EBrown Some programmers may say they have ~100 years of programming experience then haha
 
9:38 PM
Doing internships next to college is the best thing though, even if it makes your study last longer, I've gotten some compliments already that I have both theoretical knowledge by study and practical knowledge by internships
(At job interviews)
 
Practical knowledge is worth its weight in gold
 
So there's an SE chat room I periodically use where they tolerate 0 profanity what-so-ever.
Pretty sure would not go over well there.
 
I'm being to be so happy if I can get this OLog project properly up and running... Project management is more involving than you may think ;)
 
@skiwi BTW.Grammar
 
@syb0rg I can honestly say I have been programming for centuries.... so?
Hi syb0rg ;-)
 
9:41 PM
@Phrancis BTW.Fixed | BTW.Thanks
 
HAI ROLF
 
@rolfl Hello :)
 
@rolfl Hey wise programming monkey!
That old shouldn't be in there :P Comes with being wise ^^
 
bwahaha ... no problem
I am feeling old right now..... been putting up XMas lights, and prepping for winter - some more (winter is late this year).
 
My least favorite part about this upcoming Calc 3 exam: no calculator
 
9:43 PM
Sore back, sore shoulders, sore hands, sore feet... sore everywhere.
 
1
Q: Encryption/decryption program

MagirldoogerA little encrypter I wrote but just asking for people to tell me what is good practice and whats not. Also I mean the code not the actual encryption cause its just a dumb thing. #include "stdafx.h" #include <iostream> #include <stdexcept> using namespace std; int encrypter(int input); int decr...

 
Granted I'd just program the calculator to do all the work for me... but if I have the ability to do that then I think that should be allowed
 
@syb0rg You supposed to do everything on paper?
 
@Phrancis All calculations yes
 
9:44 PM
Can you just write your calculator program on a piece of paper then? :)
 
It's a good thing, syb0rg.
 
And the professor tends to be a bit of a d*ck on his tests, with answers being something like 182489/2
 
Ugh, long divisions blech.
 
Or some weird fraction
@rolfl Yes, I know
But I feel like if I was able to write an algorithm to do the work for me, I'd have to understand all the complexities underneath the problem I was trying to solve
 
> Also I mean the code not the actual encryption cause its just a dumb thing.
^ got a giggle
 
9:45 PM
@syb0rg Seems reasonable for Calculus if you ask me, if the exam is made well
@Phrancis We don't need no encr — Access Terminated
 
@Phrancis the encryption is:

int encrypter(int input)
{
    return (input * 2) + 20 + 1;
}
 
@skiwi If the exam was made well, I'd agree
For example, I don't think I should have to evaluate the triple integrals as long as I show how I set them up and set them up correctly
 
@Caridorc Yeah I just saw your answer on there while I was Jamalizing the Q
 
I've already proven I know how to do integrals in Calc 1 and Calc 2
 
Well, Project Euler 2 in F# was fairly easy.
 
9:48 PM
@Phrancis it was so overcomplicated that It almost looked obfuscated
 
@syb0rg triple integrals don't sound like fun anymore...
What study are you doing?
 
I wonder how far into Project Euler I could get if I did it strictly with SQL...
 
@skiwi Mechanical Engineering & Computer Science
 
@syb0rg That's a dual studies? Or are you taking two studies
 
@skiwi Double major
 
9:50 PM
@EBrown  In Haskell it is mind-bending

fibs = fibs = 1 : 1 : zipWith (+) fibs (tail fibs)
main = print $ sum $ takeWhile (< 4000000) fibs
 
printfn "%i" (List.sum (List.where (fun x -> x % 2 = 0) (1::2::(fibsRec 1 2 4000000))))
 
And then I could say I'm a math minor too, but that comes with the Mechanical Engineering basically
 
@Caridorc ^^
 
Where fibsRec is?
 
let rec fibsRec a b limit =
  if a + b < limit then
    let current = a + b
    let rest = fibsRec b current limit
    current :: rest
  else
    []
Forgot to post it.
 
9:51 PM
@syb0rg Must be challenging, but also hugely useful, I've always been a bit jealous about mechanical engineering, the CAD stuff seems very interesting
 
Uses a recursive function.
 
@EBrown that would be discouraged in Haskell, explicit recursion is best avoided.
 
Little longer than the Haskell version, and I'm sure it could be optimized further.
 
@skiwi There's more crossover than people think, and I see a huge potential for it in the future
 
fibs = map fst $ iterate (\(a,b) -> (b,a+b)) (0,1)
isEven n = n `mod` 2 == 0
answer = sum (filter isEven (takeWhile (<=4000000) fibs))
More sorcery
@Caridorc There ^^
 
9:53 PM
Also, indentation in F# is very important.
 
@EBrown significant?
 
@Caridorc It causes errors and bugs when done wrong.
And throws a warning:
 
@EBrown yup, significant means it has meaning
 
Warning: Possible incorrect indentation: this token is offside of context started at position (5:5). Try indenting this token further or using standard formatting conventions.
 
@skiwi I now realize that I forgot to filter the evens ...
 
10:00 PM
monking
 
0
A: Simulating MixIns with Java

maaartinusThere's always a choice, even if you need some additional state: You can add the class directly to the class and provide methods for it in the interface or go for your solution. Adding to the class directly would look like this: public interface IsBusyMixin { boolean isBusy(); void dum...

 
@Quill Hey!
 
how goes school @syb0rg?
 
1
Q: Add to array method

AequitasThe below method is meant to work similar to the way an ArrayList would work with the add method: The given double is added to the end of the array. Obviously since you can't add to arrays, a new array is returned with the number added to the end. I'm worried about using this in loops due to per...

 
@Quill Busy busy
Cramming a lot of Calculus into my memory banks today
Hoping it doesn't overflow it
 
10:03 PM
oooh, Calculus was always hellish lots of fun
I hear Math.SE's a helpful place, if you need it
 
possible answer invalidation by Magirldooger on question by Magirldooger: codereview.stackexchange.com/posts/113091/revisions
 
@Duga Rolled back and commented
 
Well, Project Euler 3 was a bit longer.
 
10:19 PM
@Quill There is one problem I do need help with... I'll see what they can do
 
@EBrown well, 6 lines in Haskell no big deal:

smallFactors n = [x | x <- [1..intSqrt n], mod n x == 0]
  where intSqrt = (floor . sqrt . fromIntegral)

factors n = smalls ++ [n `div` i | i <- smalls]
  where smalls = smallFactors n

isPrime n = factors n == [1, n]

main = print $ maximum $ filter isPrime $ factors 600851475143
 
    // Project Euler 3
    let findFactors (num:int64) =
        let upperBound = int64(System.Math.Sqrt(double(num)))
        [2L..upperBound] |> Seq.filter (fun x -> num % x = 0L)

    let isPrime(num:int64) = findFactors(num) |> Seq.length = 0

    let findMaxPrimeFactor(num:int64) =
        let upperBound = int64(System.Math.Sqrt(double(num)))

        [2L..upperBound] |> Seq.filter (fun x -> num % x = 0L)
                         |> Seq.filter isPrime
                         |> Seq.max

    printfn "Solution to Project Euler 3: %i" (findMaxPrimeFactor 600851475143L)
I could shorten the lines, by combining the lines that have |> to one line, but that's less readable.
 
If you want someone to review your code, your better ask on codereview.stackexchange.com Stackoverflow is when you have a precise question and expect a directly related answer. — tigrou 52 secs ago
 
@EBrown Runtime is 0.1 seconds for me, for you?
 
I have no idea how to check it.
 
10:23 PM
@EBrown time ./program.exe
 
Windows...
 
Sorry about your luck
 
Hey, I just thought; creating a udf to check if a number is prime, in SQL, would save me all sorts of time in PE :D
 
No easy/technical way to make it impossible. Educate them, sanction them. Have violators take care of the continues integration/build system until next one makes a mistake. Code Reviews help to detect violations. If nothing helps, fire them and get competent developers ;) — Tseng 21 secs ago
 
10:27 PM
I've been writing all these Project Euler problems to be extensible: instead of hardcoding the value in the functions that compute it, I use a parameter for it.
 
Set based, I could have it create a table variable, put number from 0..n in it and check for primality in set-based manner, perhaps. That could be pretty fast
Of course that's all armchair math right now
 
@Phrancis I remember when I was at your level in C++. It was frustrating to be able to do so little.
 
Of course, given a database, one could save a list of primes for a really large list and reuse that, but I think that defeats the purpose
 
You didn't do that bad, though, considering.
Thanks for the check.
 
@Hosch250 I think I had a sort of static bias, whereby I just recently learned about static, and felt like using it made things easier (for me) but not necessarily better
 
10:31 PM
I had to learn that myself - 2-3 times.
Just +95 today. I should write another answer.
 
@Phrancis Well, using static on everything is like saying "This should not be a class. It is a class because the language forces me to write classes everywhere"
Sometimes it is a sensible choice.
 
So, is using static a bit like saying, "this should really just be a function"?
 
It is saying it will only be created once.
 
@Phrancis yes, static means that you do not want to read the inside of the class
 
I learned my lesson first in C++, and gave myself a headache by creating a bug.
Then again in Java, and again in C#.
 
10:35 PM
Python makes it clear

>>> class Foo:
	def bar(self, x):
		pass
	@staticmethod
	def frob(x):
		pass
The staticmethod cannot read inside `self`
 
Is there a precedent in real-life code for static general utility things (like say, calculateSalesTax(amount) to be stored in utility classes?
 
@Phrancis Math.sqrt
 
Python makes things less clear for me :D
 
$\int_{a}^{b}f(x) \, dx$
Ignore me btw, testing something
 
You can do that if you have the chatjax extension installed, but everyone else sees the raw tex
 
10:37 PM
I thought I did have it installed, but it's not rendering for me
Oh well
 
@Phrancis Really? Python is a nice language, for me it is the clearest of all, but I also learned it first, so I am biased
 
@syb0rg There's a sandbox room for that kinda thing
 
Oh, I got it!
 
Turned off the plugin?
 
"Installed" is something they use very loosely
@rolfl Turned it on
For this page anyways
Kinda want to test the limits now...
 
10:40 PM
It's great, except you (and perhaps me), will be the only folk who really get it.... are you planning on jax-blinging your chat experience?
 
Nah
Just one more, then I'm probably done for who knows how long
$\iiint_E f(x,y,z) dV = \int_{c}^{d} \int_{\alpha}^{\beta} \int_{a}^{b} f(\rho\sin\phi\cos\theta,\rho\sin\phi\sin\theta,\rho\cos\phi) \rho^2\sin\phi \,d\rho \,d\theta \, d\phi$
 
So, unless you chat with yourself, thre's not really much point..... ;-)
 
Can't you see the prettiness?
 
Well, not on this computer ;-) But, I can get it soon......
 
10:42 PM
I broke F#.
3
 
Dang, I tried to post a link so everyone could use ChatJax but my message was too long
 
@EBrown like it exploded?
 
@Caridorc Well, the F# Interactive window has been doing something for a while now.
 
@syb0rg url shortener
 
Aha, unbroken. :)
 
10:44 PM
@Quill It's not a URL, but a script really
 
Problem 5 takes my PC a while to solve.
 
@EBrown there is a cheap trick to solve that in infinitesimals
I am not going to say it though
 
How long does Problem 5 take your system? Mine has been taking about a minute already.
 
@Quill Greetings. Sorry, I was distracted
 
@EBrown 0.00 by approximation
 
10:46 PM
Good grief.
Mine is clearly broken.
 
@Quill Integrating spherical coordinates, base equation
 
@Caridorc It's likely my experience that's lacking with Python, that makes it cryptic
 
I have successfully reduced jQuery 2.1.4 from 84347 bytes to 64278 bytes
It is a difference of 20069 bytes.
The code I've used it 15605 bytes long
Downloading both reduces network usage by 4464 bytes
 
@Phrancis I guess so, to me Java / C# are verbose (java 8 is a blessing over the other version thought (as LINQ is) ), maybe after using it for a bit you do not care about code length anymore.
 
10:54 PM
@Caridorc Everything is verbose compared to Python :)
 
Well, another F# coming in.
 
@Phrancis Ruby and Haskell are more succint than Python
 
@IsmaelMiguel Nice!
 
This reminds me of The Blub Paradox
 
I've got Problem 5 down to about 5-10 seconds.
 
10:59 PM
@syb0rg I'm on my way to try to reduce it's size by a few more bytes.
 

« first day (946 days earlier)      last day (3070 days later) »