6:08 PM
10

We've just gotten the June 2016 Community Challenge going, so it's time to pick one for July. It's time to choose a community-challenge for July 2016. Post your challenge as an answer to this question. Feel free to resubmit non-winning ideas from previous months. Vote for those answers which...

Only a couple more days until this is settled.

@krillgar: I write some "new code", I check it in, I go get lunch and when I get back, my "new code" has magically turned into "legacy code". How'd that happen? :) — Eric Lippert 55 mins ago

Probably

@Mast Can I see build/library-build/src/LibSndFile-stamp/LibSndFile-download-*.log

@StevieV I use my own Validation Extensions v2 (Code Review) in the production code as well as a replacement for the assert. — t3chb0t 51 secs ago

What's a good generic term for an IEnumerable of chars? It's a parameter for a helper method, so it has no broader meaning. A single char is c.

6:20 PM
0

Hi there I was wondering if there are any really good tutorial videos or websites that walks you through the implementation process of conway's game of life in python? Any links at all would be appreciated.

0

I have code that opens a workbook and copies the sheet to the workbook running the code. I know activating is generally bad for speed but I can't figure out how to speed this up anymore. The data area is usually "A1:Q45000" but is different all the time. Sub AutofillOperations() Dim answe...

@syb0rg Sure.

Finally got some work assigned, day 8.

@MichaelBrandonMorris IEnumerable<char>?

@CaptainObvious that was fast removal
@CaptainObvious this seems confusing

@EBrown Yes, the parameter type is IEnumerable<char>

6:23 PM
Probably chars or characters.

I think it's more the speculative nature than the question itself. It might be better in codereview.stackexchange.com. It's a very, very good question. As soon as you realized that you don't want your class talking to AppSettings directly you were onto something big. When you get the answer to that you'll find that it applies much more broadly. For me personally, dependency injection (I use Windsor) changed everything. Not because DI alone is so great but because it became a catalyst that changed the way I wrote code. It facilitates other best practices like unit testing. — Scott Hannen 40 secs ago

@MichaelBrandonMorris Naming things is hard.

@EBrown Ok, yeah, that was simple.

@enderland The code or the question?

6:24 PM
@syb0rg the "what are you trying to do and why" side of it

@enderland Wanna have a go at leaving a comment for the OP?

@syb0rg Gist updated with -err. -out is empty.

I also feel pretty crappy right now and my head is sort of spinning. not sure if causation or correlation :)

@enderland Dizzification.

dizzfuzz. kind of like fizzbuzz, but... doing it while your head is spinning

6:26 PM
Does this make sense

public static bool Equals(this char c, IEnumerable<char> characters)
{
return characters.Any(c.Equals);
}

A char is never equal to an IEnumerable<char>.

@Mast What is build/library-build/src/LibSndFile-stamp/LibSndFile-download-Release?

@EBrown EqualsAny?

That's an acceptable name.
Also, to format a code block, indent every line by four spaces.

@EBrown EqualsAnyOf?

6:27 PM
@MichaelBrandonMorris What meaning does Of convey?
Hint: the answer is none. ;)
Just use EqualsAny, that will be fine.

Not sure if this constitutes an answer:
1

How did you time your program? I ran a modified version of your program (because you failed to give the code for "mex.h" so I rewrote the parts that needed it). When I ran your program with 1, 2, and 4 threads, I got the following results: 1 thread = 9.38 sec 2 threads = 4.93 sec 4 threads = ...

CharInList or something

@enderland That doesn't make sense for an extension method.

oh :P
3 mins ago, by enderland
I also feel pretty crappy right now and my head is sort of spinning. not sure if causation or correlation :)

var chars = SomeMethodThatReturnsIEnumerableOfChar();
char c = 'A';

if (c.EqualsAny(chars))
{
// Do something
}
That's how you're using it, correct @MichaelBrandonMorris?

6:30 PM
@EBrown Yeah, that's correct

Then EqualsAny is a fine name.

@syb0rg Updated.

But why are you going to such an extreme, @MichaelBrandonMorris?

Odd...

@EBrown I already have a primitive extensions library. I was just adding that in there because I found use for it in a project.

6:33 PM
@Mast You created a build folder and went in there to run cmake .., right?

@syb0rg Of-course.
Why?

Why not just us the IEnumerable<T>.Contains(T) method?

CMake runs. Babbles something about configuration. Make fails.

@Mast But configures without warnings or errors, right?

-- No build type selected, default to Release
-- Could NOT find sphinxbase (missing:  SPHINXBASE_LIBRARY SPHINXBASE_INCLUDE_DIR)
-- Could NOT find pocketsphinx (missing:  POCKETSPHINX_LIBRARY POCKETSPHINX_INCLUDE_DIR)
-- Could NOT find LibSndFile (missing:  LIBSNDFILE_LIBRARY LIBSNDFILE_INCLUDE_DIR)
-- Configuring done
-- Generating done

6:35 PM
Perfect, that's what it should do

That's what I thought.
Finds what's missing and tells make how to fix it.
Except, make doesn't fix it.

@Mast Wanna clean everything out of the build folder and run it again?
Sometimes it just fails the build for me on Windows

-- The C compiler identification is GNU 5.3.1
-- The CXX compiler identification is GNU 5.3.1
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done

And then I do nothing but just start up the build again and it works just fine

That's fresh.

6:37 PM
I wonder if me setting the build type to "Release" automatically somehow screwed with it... it shouldn't?
CMake output looks good

@EBrown Good point.

@MichaelBrandonMorris Yours may make sense in a given context, but IEnumerable<T>.Contains(T) is a more generic and reusable version.
You're over-LINQing it.

Perhaps the server is just FUBAR today.

That should've been updated to the github repo tho... I thought I already did that
One sec

@syb0rg Looks up.

6:43 PM
@Mast What OS are you running on?

Ubuntu 16.04 LTS

Do you guys have personal websites? Looking to redo mine and seeking inspiration.

@Legato Do you count blogs? A couple of regulars have one.

@EBrown But there's no such thing! xD

6:47 PM
@Legato Not mine, but someone I know: petervaro.com

@syb0rg Awesome, very fitting.

@syb0rg neat!

@Legato Not necessarily updated, but here's tritium's website: syb0rg.github.io/tritium.io

Also good!
I mocked up mine a while back and haven't really done much with it since...want to remake it this summer. Thank you @syb0rg

@janos has a fancy site as well.

6:56 PM
@Mast Right now I'm having some issues running cmake .. since it's such an old Ubuntu OS
I'm working on fixing them, then hopefully I can replicate the issue you're having

8 is old, I'm not sure why you're running that.
Anything older than 12 shouldn't be in use anymore.

@Mast I'm not, I temporarily put it on a build machine at my job
And I can't really upgrade it or anything :(

ruh oh

@Mast I'm lucky to have the minimum required CMake version: 2.8

0

Let A and B are n\$\times\$n matrix. In my code this multiplication takes one minutes, is there any way or packages that can make this calculation faster. I found only command in R for matrix by vector. X is n\$\times\$p matrix, and y is a vector. K = X%*%vs%*%t(X) # three sec y1 = (y - mea...

7:04 PM
@EBrown I'm using like this: return new string(s.Where(c => c.IsLetterOrDigit() || c.EqualsAny(_legalCharacters)).ToArray());
@EBrown It's a method to keep only the specified characters in a string (s).

Actually 2.8 might be too old

how do I access the browsers developer tools? — Ben Lanier 9 mins ago
2
#WhenYouShouldChangeJobs

or just browse the frakkin' UI of the programs you're using every freakin' day of your modern life

7:18 PM
@Mat'sMug Why is that tagged VBA and VBA-Excel anyway?

@MichaelBrandonMorris really, because OP is using Excel-VBA to scrape the web. about 25% of VBA questions are about web scraping these days. go figure.
I VTC'd that one as "too broad" FWIW

@Mat'sMug Did you see his reply? xD

@zʏᴀʙiɴ101 I would dare to say most people in 2nd are probably already subscribed to the newsletter so posting the "Dare to answer" questions here is probably redundant

Since you have functioning code that you wrote yourself, your question is probably on-topic for Code Review, but see their on-topic help page to be sure. — apsillers 1 min ago

7:25 PM
(monking!)

@Mast I'm kinda stuck on my end

@Phrancis Monking!

@Phrancis I get the weekly newsletter, but I get it at the same address as my github notifications... so I need to dig it up among hundreds upon hundreds of emails. I should have seen that coming.

@Mat'sMug Forward it with a filter?

@Mat'sMug lol I turned off Github emails a long long time ago

7:27 PM
@Phrancis it makes me feel busy

Since @Duga posts everything to chat rooms anyways it's a bit moot

Please do not make Duga post Github emails!
shudders

I'd like to pimp this excellent answer

@Mat'sMug my github mail is mailaddress+github@domain.tld, I set a filter to automatically move them to a github folder

@N3buchadnezzar She doesn't in this room, but she does in a few other rooms for some repositories

7:29 PM
Can you be your own pimp?

@Phrancis by all means, go ahead! #moot

@N3buchadnezzar You can, but I'd only do that if you wrote a really good answer

@N3buchadnezzar some are shameless about it. when a RO gets tired of constant pimping they're hereby authorized to kick.

Also that^

RO = Robust Ogre?

7:30 PM
yup. or Room Owner.
you can spot them in the wilderness, by their italic username

So I just need to become a RO to start pimpin

Speaking of spotting, I just spotted a wild @Downgoat

My goal in life is set.
On the serious side that answer was really great.

Yeah it's quite good, I can start putting those into practice immediately
I'm still a bit confused about when the keyword this should be used in C# other than in the constructor

I was just mocking Mast with my overly optimized solution for PE1.

7:34 PM
My Java is really showing here

Thank god it is not JAVA

this.Java != JAVA;

in VBA Rubberducking, 3 hours ago, by Mat's Mug
mine is to only ever use this when I need to pass this around, e.g. in a builder pattern. I never use it as a qualifier, proper unambiguous naming makes the this qualifier redundant.

Is the tag just used for kicks and laughs?

7:36 PM
not really. it tells people "look, I know I could use a library for this, but I'm making my own because I'M MAD LEAVE ME ALONE"
10

For when you decide to roll your own instead of using pre-built stuff

Ah, so it is used for things that have a builtin. Not just overly simple questions.

Correct

I was wondering if the 100000000000000000000 FizzBuzz question should be tagged. But now I know otherwise.
I should just make a FizzBuzz libary so that I can start using that tag.

7:39 PM
@Mat'sMug Or rather, I had a homework assignment to implement something that someone else did so I can understand it better.

@MichaelBrandonMorris Or rather, I had a homework assignment to implement something that someone else already did so I came here so you guyz can GIVE ME TEH CODEZ

@N3buchadnezzar It's CR, not SO. I was being serious, as I have done what I mentioned before.

@MichaelBrandonMorris you'd be surprised

@MichaelBrandonMorris That actually sounds like a really good exercise

@MichaelBrandonMorris I have done that as well. However not everyone are like us. looks around suspiciously

7:42 PM
I do think by this point CR has a large enough collection of Q&A that you can probably find really good (and really bad) solutions to most programming problems

@Phrancis It is for the first time around. By the time you implement a list in multiple C-style languages though, it gets boring.

I have used CR to check for PE solutions a few times (after I already have solved it).

@MichaelBrandonMorris I suppose. We have so many implementations of LinkedList on here it's dizzying

Or rather it made me addicted to this site, so my productivity has fallen dramatically...

Oh and

7:44 PM
Also

@Phrancis Right. I was referring to the exercise, not necessarily posting on here.

Well, my work's Linux build machine is a bust
Too old

You would think by now that the PHP people who know how to do a database query, but surprisingly, we get those practically every day

But if a student does post their own implementation of something, it shows that they put forth effort to learn it and write their own code, not copy someone else.

I think LinkedList are cool, I wish I got to use them more often

7:46 PM
@syb0rg too old

@Phrancis I don't think they're practical when optimizing applications tho

@Phrancis I never could find a good use case for them where something else wasn't better.

They have a lot of complexity stuff tied with them

If you want a FIFO ordering, then a queue works.
Circular FIFO? Push after you pop.

@MichaelBrandonMorris I suppose lists where you need to add or remove stuff a lot, I don't think that use case is so common though

7:47 PM
However that could be the few years of having LinkedLists shoved down my throat by my uni speaking

@Phrancis Nevermind, that did not make sense.

Ok, I guess LinkedList are cool in theory but not necessarily in practice

BTW
0

Deleting a good start to a review seems like a bad idea Indeed. But you don't delete the post, you vote to delete it. Just do it. And downvote. You could also come across one such answer outside the review queues. Often, this results in [correct] NAA flags. Let's be clear: a code dump is ...

@Phrancis Like a Fedora

@Mat'sMug What rep level do you need to be at to cast a delete vote?

7:50 PM
5k?

@N3buchadnezzar I have a Fedora :(

I think it's 20K / Trusted User for answers

@Phrancis Do you use it?

Dang, that's a little over 5k for me

@N3buchadnezzar <--- Um... see my picture right there
2

7:52 PM
Oh noes

I saw a guy the other day who was wearing a tan Fedora... backwards D:

@Phrancis pls dont hunt me

@Downgoat good evening goat of the down

@Downgoat I KNOW YOU. YOU ARE FAMOUS. Are you the Downgoat Upgoat fellow?

Just saw the newest PPCG challenge idea in the Sandbox, looks pretty interesting

7:54 PM
@Quill >_> its morning for me in california, but good evening
6

takes a picture

Should buy MSI Armor GTX 1080 or should wait for EVGA FTW/Classified?

@Downgoat You know C, good enough

@MichaelBrandonMorris Depends how soon you need a new video card, I suppose
MSI's stuff is usually pretty badass, don't know anything about EVGA though

@MichaelBrandonMorris Do you have a billion dollars or only half a billion dollars?

8:00 PM
Ripe zombie; open question with answers, at least one answer having score 0, no answer having score > 0: Country lookup for locations in an array

@Phrancis I don't think a "need" is involved here. :P No one "needs" a $700 gaming graphics card. @MichaelBrandonMorris Good grief that's expensive I ordered it. Will cancel or return if I can snag one I want more. looks at$900 MSI gaming laptop

@MichaelBrandonMorris Uhh, I do

8:01 PM
@Phrancis Does laptop play games at 4k at 60+fps?

@MichaelBrandonMorris uh not quite

GPU's are amazing for training neural nets

@MichaelBrandonMorris It does on solitary sobs

@syb0rg You don't need a gaming gpu though

@MichaelBrandonMorris Why not?

8:02 PM
@syb0rg Gaming gpus have higher clock speeds, rgb lighting, and big coolers. You should look into a professional gpu.

Hey @Justin

Higher clock speeds at the expense of cores, as far as I am aware.

@syb0rg ?

@Justin I was just saying hello

8:03 PM
Okay

@MichaelBrandonMorris Oop, nvm

@syb0rg I'm not debating that GPUs are better for simultaneous computing. I'm just saying you don't need one with bells-and-whistles for gamers and enthusiasts. They make professional GPUs.

@RoboSanta Improved the grammar on that one, reads a bit better now. Not a spectacular answer but good enough I think
Hm, question should probably have been closed as stub code

@MotokoKusanagi I recall you looking for a GitHub project you wanted to look at in the past

    } else{
//handle the error
}
// more code goes here...
}

8:08 PM
Did you ever find a good one?

Me when looking at my old code: "Don't code what you can't debug tomorrow."

posted on June 29, 2016 by user110215

So I really want to start designing and coding games and I have no clue where to start. I have tried googling "How to code in insert language here and I have learned bits and pieces but nothing to specific. Nothing I have learned equates into coding a game. So if anybody has any tips, anything is appreciated. Thanks!

@CaptainObvious Rekt

Actually... reality is, more often than not, NAA flags get through and the answer gets mod-deleted after a while anyway. — Mat's Mug ♦ 6 secs ago

When was the last time @Edward was on here?

8:18 PM
Uh, been a good while AFAIK

@arda I just start crying when looking at old code.

@Phrancis Dang, I wonder where he went/why he doesn't come around anymore

@syb0rg Well, people come and go...

8:25 PM
I only see the 2 of them

Oh, I thought the second one was new

@syb0rg He was here not too long ago though.

@downvoter please feel free to comment about how can this answer be improved, or answer yourself. — Mat's Mug ♦ 5 secs ago

@syb0rg What's the matter?

of course

8:33 PM
Also, it's meta. A downvote can simply mean "I disagree".

they're also non-productive on meta if all they mean is <grumpy>I disagree</grumpy>

@Mast downvotes are anonymous* ** *** **** *****

@Mast So CMake 2.8 (the version my build machine has), has a bug with External Projects that I didn't know about... so turns out I require at least CMake 2.8.2 to run properly

* = unless you are a mod

@syb0rg Explains.

8:33 PM
no, not even mods see who's voting where

^^
Only SE employees could look at that data, and I don't think most have those privileges.

** = unless you are a cm *** = unless you are a stack developer **** = unless you are a stack employee ***** = unless you are jeff

Jeff can't either.

-- Could NOT find LibSndFile  (missing:  LIBSNDFILE_LIBRARY LIBSNDFILE_INCLUDE_DIR)
CMake Warning (dev) at /usr/local/share/cmake-2.8/Modules/ExternalProject.cmake:160 (message):
Call Stack (most recent call first):
/usr/local/share/cmake-2.8/Modules/ExternalProject.cmake:907 (_ep_parse_arguments)
CMakeLists.txt:65 (INCLUDE)
This warning is for project developers.  Use -Wno-dev to suppress it.

Basically, you need full DB access.

8:35 PM
@Mat'sMug Might be me. My mouse is wonky

possible answer invalidation by James on question by James: codereview.stackexchange.com/posts/133404/revisions

Sorry!

@Mast That and more, it's a known bug with CMake that had been fixed
Anyways, I think I found a possible fix for your problem

@syb0rg That explains that part at least.

@Mat'sMug I think that you can, in a way, to check for serial voting.

8:36 PM
@N3buchadnezzar you better be sorry I'm just wondering what would be a legit counter-point for that meta question. I love debates, don't get me wrong. and I can often argue on both sides, too. ..but on that one I'm actually wondering what good counter-points could exist.

@Mast In cmake/Unix-Ex... change LibSndFile's ExternalProjectAdd command to this:
	ExternalProject_Add(
LibSndFile
GIT_REPOSITORY  	"https://github.com/erikd/libsndfile.git"
SOURCE_DIR          ${CMAKE_CURRENT_SOURCE_DIR}/lib/LibSndFile UPDATE_COMMAND "" INSTALL_COMMAND "" BUILD_IN_SOURCE ON LOG_DOWNLOAD ON LOG_UPDATE ON LOG_CONFIGURE ON LOG_BUILD ON LOG_TEST ON LOG_INSTALL ON ) @arda this may or may not be a possibility that I will not deny nor confirm maybe you can view it user-wide but not question-wide Again Sorry I have no counter arguments, as I agree with you. :30711953 Sorry, I grabbed that code from the Win32 experimental build file. It should work with Unix tho 8:38 PM My Win .txt is empty. It should be, I haven't pushed any experimental stuff out yet Edit Unix-Extern... Download succeeded, configuration failed. @Mast Okay, progress I suppose  Command failed: 1 '/usr/bin/cmake' '-GUnix Makefiles' '/home/mathias/Khronos/lib/LibSndFile' This isn't the place for a code review, or help profiling and improving your application. It sounds like it's working as expected, but you want to somehow use less memory. — JimB 51 secs ago 8:41 PM Yea, we went from failing on 5% to failing on 13%. This has been the same problem I've been trying to deal with on Windows Add "CONFIGURE_COMMAND${CMAKE_CURRENT_SOURCE_DIR}/lib/LibSndFile/autogen.sh cmake" above "UPDATE_COMMAND"
No quotes, just trying to make clearer what to copy and paste

Progress, now it fails on 16%.
  Command failed: 2

'make'
In ;FORCE.cmake:16

@Mast I have never seen anything like that file in my life :/

For some reason the build fails. Is it possible this version of LibSndFile is slightly different from the other one?

8:52 PM
Take a look at this answer about sql injection: stackoverflow.com/a/60496/3595565. Then rework your code and post it under codereview as Jamie pointed out — Philipp 1 min ago

@Mast Why would that matter?

@Pimgd When did you get s many points this week?

It shouldn't, I guess.
Anyway, I'm off to bed. If you got any more things you want to try, you know where to find me. If anything pops up I can take another shot at it tomorrow morning before I leave for a meeting.

@Mast 'night!

@Mast I'll do some more work on it, I'll probably have you download a clean slate tomorrow
Cya!
TTQW for me

9:11 PM
I'm crying
this code sucks
so much repeated code
(is working on cleaning code on old projects)

“Everything you need to know about how to pretend you know JavaScript” - Honest O’Reilly books.

@arda copy-pasta code huh?

@Phrancis the project is based on two pages, which do similar jobs and communicate in very hackish methods.
I'm trying to remove the repeated parts and improve the communication between the pages
Might end up combining the two pages

What language(s)?

C#

9:21 PM
What's that? The web can have nice features.... and be performant....Well how about that

I was afraid you were going to say PHP :)

@Phrancis oh I have some PHP work after this
I'm just preparing myself for the worst by going through bad code, so I won't be as mad at PHP.

lol ok

9:43 PM
Is there something inherently wrong with using var in C# instead of an actual explicit type?
(e.g. can it lead to unexpected/undefined behavior, etc.?)

nope.
why would there be anything wrong with it?

I'm not sure, that's why I'm asking :D
Ah, I was worried about changing the type of a var after it is declared, but I see the compiler doesn't allow it, good

@Phrancis var is not dynamic. var is statically typed.

Good stuff, I thought it was like JavaScript's var at first which is why I guess I was concerned about it

it simply makes the code less Javaesque annoyingly redundant. e.g. var foo = new Something(); instead of Something foo = new Something();
if you hover the var keyword VS will tell you its type

9:52 PM
So var can be used for basically any type/object?

yes

Nice, good to know

well, not for fields

monking

var is type inference

9:54 PM
JS var is similar to C# var, in that they both have types, but JS obviously doesn't have type specific params
I can't remember the BNF for var either ;-;

BNF?

JS var is more like Dim foo [As Variant] in VBA
or just Dim foo in VBScript

In computer science, BNF (Backus Normal Form or Backus–Naur Form) is one of the two main notation techniques for context-free grammars, often used to describe the syntax of languages used in computing, such as computer programming languages, document formats, instruction sets and communication protocols; the other main technique for writing context-free grammars is the van Wijngaarden form. They are applied wherever exact descriptions of languages are needed: for instance, in official language specifications, in manuals, and in textbooks on programming language theory. Many extensions and variants...

Big Name Fan

@Quill would EBNF work?

9:59 PM
Hm, BNF is very meta

actually, var probably wouldn't even be explicitly defined in a parser grammar, since it fills the type` spot in a declaration.