« first day (1046 days earlier)      last day (2987 days later) » 

2:03 PM
I've rolled back your edit again. If you've updated your code, feel free to ask a new question. We take answer invalidation serious here, don't do it. Please read the link I've provided in the previous comment. — Mast 34 secs ago
@Pimgd Didn't work, now both are closed ^^
 
I keep thinking back to this getters are evil guy
maybe he's rolled his own version of object oriented programming which is REALLY about the objects,
but just like functional programming, this sort of thing is not always useful
 
Pick a style and be consistent.
 
And hope your colleagues agree
 
If you like abusing getters, go for it. If you like removing them altogether, go for it.
 
except industry has gone quite bonkers and nowadays we say we all do OOP when really it's a mixmash of things that's quite effective
 
2:08 PM
^ that
 
And that's why we now have functional streams in Java
 
Consistency is much more important than bike shedding
 
because it does a better job than, well, for loops
 
I don't think that's a bad thing, though @Pimgd
Functional programming is very good at expressing lists over time (streams)
OOP.. not so much
 
but we're not gonna make EVERYTHING functional because we also got other things to do
but then we make the mistake of saying "look at my oop code"
 
2:09 PM
Pick the right tool for the job.
 
and people like him go "wtf is this crap, it is not oop"
 
0
Q: Export node hierarchy and sets from Maya

d3vidThe requirement here is to export an asset (a hierarchy defined by a root node) and all objectSets that include nodes in that asset. My assumptions/findings were: pm.select was the best way to select a hierarchy intersectsWith was the cheapest way to determine which sets to include performing a...

-1
Q: Formal Definiiton for CodeReview required

nigelDoes anybody have a formal definition for the code review phase? Thanks.

 
fwiw we use FRP/FP in javascript. I guess you could say that JS is also OOP because everything is an object but it isn't OOP in the traditional everything is a class sense
 
and he'd be right
but we don't really want oop
we just want it to work nicely
 
As long as there is no code smell though I don't think it matters what paradigm something is in
 
2:10 PM
@CaptainObvious If it should go anywhere at all, put it on meta.
 
... which is scary because it means there's a new name lying in wait
for the ultimate procedural/functional/object oriented combo
 
I believe that is called String Theory
:p
 
I prefer functioning code over functional programming.
4
 
s/functioning/functional? ;-)
 
Code should have a function and function properly.
So I think it's functioning, but English isn't my first language. So I'll leave it to the Brits to correct me.
 
2:12 PM
@DanPantry error no terminator found near "functional? ;-)"
I prefer functional? ;-) code over functional programming.
it reads quite nicely with this replace
but it's a bit weird
 
why not use "working"?
 
@Vogel612 because then we can't make puns
:(
 
because //TODO reason
 
// TODO Tests
 
//TODO work
 
2:15 PM
// FIXME topic
4
 
topic->window(out)
 
codeblocks take that much more space than a message consisting of inline-code
@Mast I'm not sure what the arrow means here :/
 
The 2nd monitor is not sandbox
its easy to forget this at times
 
@Vogel612 topic is a pointer, -> deferences that pointer to the actual topic object then invokes the window method
I think he is saying that the topic is out of the window :d
But then surely topic >> window would have been better
 
Depending on the language used, one is better than the other.
Or I just screwed up.
Happens.
I don't write enough code.
 
topic > /dev/null
 
chat > /dev/null
 
fun fact, my email is devnull@danpantry.me
 
now we're all doomed
 
Did you mean: /dev/urandom > topic?
 
2:21 PM
so I can legitimately say "please send all complains to devnull"
 
@Mast So, talking about bananas...
 
0
Q: Dynamic array of integers: another attempt

User100This is follow up to this one. In the previous some minor errors slipped, so I couldn't update the code. Also took some advice. So final version is below. header: #define DEFAULT_CAPACITY 1000 // Define a vector type typedef struct { int nrOfElements; // This just denotes current number of ...

 
@User100 If you disagree with any decision a user made, take it to Code Review Meta or find us in The 2nd Monitor. — Mast 2 mins ago
 
0
Q: c# Multi process, multi thread read write on a single file

Nikola.LukovicI've got a job to create a library that would be able to support multi threaded and multi process read and write to a single file. On that single file we would store c# models in an array in json format. It would basically work as a mini file system json db. When the application that uses this l...

 
@Mast That's an interesting question because he had ->nrOfElements originally. Not sure why he changed it to ->capacity and then back to ->nrOfElements.
 
2:39 PM
@DanPantry it was a bug
 
Oh. Not good, then. @Pimgd
 
But a bit of a shame to close it at that point, so better to quickly move on to a follow up
That's how I feel, anyway
 
Agreed.
Sure, we could still close it, but there's not much of a point to it really.
We probably should anyway.
 
0
Q: Global site settings middleware for Slim Framework 3

Erdem EceI have created this middleware code for slim. I just want to know that is this right way to store site settings globally. so, I can use where ever I want. What do you think about my class structure apart from invoke (which is slim's own feature) what do you think about foreach and setting the dat...

 
@Mast no. I'd say we keep cleaning up if they keep invalidating
if they really want to play this game, a mod will intervene and lock the post
 
2:46 PM
if someone keeps invalidating then you should flag for a moderator
 
We definitely keep cleaning up, regardless of whether it's on-topic or not.
 
what question are we talking about?
 
@User100 If you disagree with any decision a user made, take it to Code Review Meta or find us in The 2nd Monitor. — Mast 14 mins ago
I don't think it has enough invalidations to bother a mod yet.
I think he got the message.
 
I agree
 
2:53 PM
Does this work? Are you asking for confirmation? If that's the case I recommend using codereview.stackexchange.comJoe Essey 15 secs ago
 
@Duga gimme-the-codes ... here-are-cr-codes
eventually Code Review will be a database of implementations which work, but are messy
 
@Pimgd The answers should fix that last part.
2
 
google-copy-paste
 
Code Review, the new GitHub.
 
The free edition gives you HEAD-1
 
2:56 PM
well we are a hub for gits
 
The professional edition costs a ton and gives you access to HEAD revision
 
@DanPantry GitHubHub
 
But I rarely find stuff on github that I'd want to use via copy paste
it's too long, most of the time
 
Replace at takes the location in the string, the OP is looking for a specific character in the string and replacing it with a set of characters. replaceAt is not the right tool here. the location in the string array may change based on the page — Malachi 2 mins ago
can I get a witness?
 
0
Q: stack smashing detected : Selection sort my own way

hubatrixnew to programming I tried my own way of implementing selection sort and here is the code #include <stdio.h> int main() { int i,j,key; int A[] = {12,3,10,2,15,7}; for(i = 0;i<(int)sizeof(A);i++) { key = A[i]; j = i+1; while(j<(int)sizeof(A)) { if(key<A[j]) A...

 
3:04 PM
+1, this is not a duplicate of the suggested question. replaceAt would not work here, OP appears to want a mutable version of replace. Unfortunately, strings are immutable so no such method exists. The suggested answer seems to do what you would want. — Dan Pantry 22 secs ago
 
Witness Pantry.
 
@DanPantry thank you
 
replace and replaceAt have the same semantics so I'm not even sure why the commenter suggested replaceAt - they both return the new string
Though a better answer would return a clone of the original object :-)
 
they could always use regex
 
they saw the index variable and thought OP was trying to replace at a specific spot in the string array
but the index is for an array of strings.
 
3:07 PM
@PinCrash nope! strings are completely immutable in js.
 
Nothing is immutable in JS, except if you don't expect it to.
 
@CaptainObvious is that C or C++? Either way needs VTC but it lacks a language tag
 
$scope.featureDetails.map(detail => angular.merge({}, detail, { FeatureUrl: detail.replace('#', '#/app') }))
the above is probably what OP wants
And yes I could post it as an answer but I am lazy and can't be bothered to write an answer around the code snippet
also it is not tested
 
@PinCrash Probably , printf in has hopefully disappeared from the textbooks.
 
Ok
 
3:11 PM
On a totally unrelated note:
190
Q: Fixing answers that recommend "chmod 777"

CarpetsmokerAfter stumbling upon both a question which mentioned "I did chmod 777"1 and an answer which recommended "do chmod 777" yesterday I did a basic search and found quite a few answers which recommend this practice—some with a disturbing amount of upvotes. This is especially dangerous since many of t...

 
Any reason why you don't want to use jQuery? The slogan of jQuery is "write less, do more" so it's not that odd that it looks like "more" this way. Anyways, This question is a bit too much opinion based for Stack Overflow. It fits better at Code ReviewIvar 16 secs ago
 
@DanPantry looks right
 
That's one issue we don't have a lot on CR, crap answers sticking around without warning.
 
@DanPantry I don't know angular well enough to steal your answer and explain it.
I too am lazy....
 
Clean-up is definitely required here. I'd recommend doing that first and worry about porting later (if at all). I'm not sure moving this to Code Review is a good idea though, it looks like example code and we don't do that. — Mast 20 secs ago
 
3:15 PM
@Malachi .merge(destination, ...sources) merges sources into destination, left-to-right, overwritign properties as it goes.
so angular.merge({}, {foo: 5, bar: 3}, {foo: 7}) would return { foo: 7, bar: 3 }
 
@DanPantry looks like Linq, did you replace the entire for loop with this?
 
There is a specific site for code reviews: codereview.stackexchange.comGareth Webber 42 secs ago
 
@Malachi wat?
 
sorry the for loop I mean
 
yeah that would replace the for loop
 
3:17 PM
No, there isn't a built in way, and questions about working code that you want help massaging should be asked on Code Review. If your code is working fine, there's no problem! Move on to the next issue. If you can identify specific pain points that you want help with in your working code, identify those and highlight them in a question on CR. It helps those who want to help you. — Will 53 secs ago
 
@DanPantry except for the console.log() call
 
@Mast Do you mean the code above can be shortened using just Javascript? I'm not actually of code review, I'll have a look at that now. I'm happy to post the full code there if it helps (aTest, bTest, cTest was just added for simplicity, the actual variable names might seem odd otherwise) — Gary 10 secs ago
 
@Malachi I removed that because it is just there as a diagnostic, I think.
@Duga Ouch.
 
@DanPantry that is what I was thinking as well.
 
That is one case where I might actually recommend jQuery/Zepto
Creating DOM elements in pure JS sucks
 
3:22 PM
 
It's becoming obvious to me that SQL databases were not designed for configuring interoperability application behavior...
 
@Malachi lol, might want to add additional reasoning
@PinCrash Your database appears to be playing Twister.
4
 
@DanPantry I am working on that right now, pretty much what you told me
 
@DanPantry Turns out he really can't use jQuery, so he'll have to rewrite it first and come over for clean-up afterwards.
 
@DanPantry Can you imagine having to write the code for this crap to work? (or worse, debugging it)
 
3:28 PM
@PinCrash You haven't seen my database yet :-)
My database is almost exactly the same, except in some places it mungs data that should be in two tables into one and every column is in SHOUTCASE with 8 character limits
 
@TemplateRex: My original design used the same logic. This design was suggested on CodeReview. I was skeptical, but after a little testing became convinced that this was entirely competitive for speed (frequently faster). — Jerry Coffin 56 secs ago
 
For example, we have one table called CONTACT1 which contains company information and also the first contact for that company, every other contact is stored in another table.
 
@DanPantry Better? or am I missing anything?
 
and also that company information is spanned across 3 tables, CONTACT1-3
so one company requires 3 inserts. the first contact goes in contact1, any any other contact goes in contsupp.
:D
@Malachi Looks good
 
@DanPantry um, that's odd design. My not just a COMPANYCONTACTS(CompanyId, ContactId) ?
Also, using hyphens in DB object names FTL
 
3:30 PM
@PinCrash legacy reasons - the worst kind of reasons.
sorry, when I said CONTACT1-3 I meant CONTACT1, CONTACT2, CONTACT3, thre are no hyphens in names
 
Ohhhh
 
(probably because the progenitor system couldn't handle anything other than a-z 0-9)
 
And 8 chars...
 
yeah, that too
 
Makes it almost sound like the legacy system was based on Access DB or some other crap like that
 
3:34 PM
0
Q: WPF Track child collection validation errors

YoavI have a need to get notified about validation errors that occur in a child collection of my ViewModel. For validation I use the INotifyDataErrorInfo interface. I've created a class that handles this successfully however, I feel that additional refactoring / simplification can be done on it. Here...

0
Q: making my python code more user friendly to read

bob davidI hap done this quiz project and I have tried as hard as I could when I was writing to make it user friendly to read. Could you help me on improving and making it more user friendly please. import random import operator import csv OPERATIONS = [ (operator.add, "+"), (operator.mul, "*"), (operat...

 
@PinCrash It would not surprise me, the system is probably as old as me
 
Urgent help needed.
 
@Hosch250 what's up?
 
My mouse had a driver error, so i uninstalled the driver.
 
And now you can't get your mouse to run at all?
 
3:38 PM
The thing never finished, and I closed my computer for a while.
 
Depending on your operating system, you should probably try a System Restore.
 
I am strongly resisting the temptation to provide a link that you can click on (to another SE for hardware issues)
 
My computer screen went black, and I can't even force shut my computer down by holding the power button.
 
Oh, uh, oh dear. That doesn't sound good
 
3:39 PM
@Hosch250 Remove the power cord.
 
I have this chat open in my browser on that system, and Dan's ping played through that computer.
 
lol
sounds like display drivers have gone FUBAR
 
Yup, and if you're in luck it will kick itself into gear at the next boot.
Cut the power.
 
I tried removing the power cord, but it has a battery too.
 
So remove the battery as well.
 
3:42 PM
Ok.
 
obligatory code review is not responsible for any damage caused to your device by listening to our "advice"
 
Trust me, I'm an engineer.
Computers shouldn't have a battery though, those things are called laptops.
 
Fortunately, it is not a Mac, and has an accessible battery.
 
Unless you're referring to a small CR2032 battery on the motherboard, you shouldn't touch that one.
That's BIOS.
 
Laptops are computers.
 
3:44 PM
Allright, now put the battery back in, put the power cord back in and boot.
 
Is it safe to turn it upside down with the drive running?
 
If you move it slowly, yes.
 
you're going to try and unscrew the thing whne it is turned on?
 
Just don't shake the thing.
@DanPantry Batteries in laptops aren't connected by screws.
 
@Mast ah, right
 
3:45 PM
Usually...
 
does not have a craptop
Well, except the one I work on, but I can't say I would want to take the battery out of that
 
No, handy pop-out battery. No screws at all.
Booting.
 
Does the screen respond the way it usually does?
 
Now, in a Mac, I would have had to unscrew the entire case, and likely void my warranty.
 
Another reason not to get a Mac ^^
 
3:48 PM
Hello from the laptop.
 
:-)
 
It even saved my open tabs in my browser!
The half-second I had the battery out must not have been enough to clear the RAM.
 
FireFox and Chrome try to do that when a crash occurs, yes.
They store it somewhere else though, I think.
 
Oh.
 
It's quite foolproof.
Of-course, that simply means I'm not a big enough fool to beat it.
 
3:51 PM
If this is working code, might I suggest Code Review Stack Exchange? — Chrismas007 33 secs ago
 
Now, if this happens again in the next couple of minutes, reboot as you just did and run system restore. If nothing unexpected happens in the next day you're probably fine.
 
OK.
 
Although you never know for sure with Windows...
 
What's the phrase about nature always making better fools?
@Duga Hi, Chrismas007.
 
1 fool can ask more questions than 100 wise can answer.
 
3:52 PM
I know you from Rubberduck.
 
TTCAT
 
And now my employer is getting very interested in Big Data.
 
@Donald.McLean Sounds like a good thing... maybe?
I would have thought NASA would already be doing Big Data, though.
 
So, I put my computer to sleep, BSOD on when it woke up, unhandled thread exception.
Clean reboot, and it seems to work now.
 
Kaz
4:08 PM
Gah, why can't other companies just present their web-scrapable data in an easy-to-clean format!
4
I love data mining, but at the same time I also hate data mining.
 
try coal mining
2
 
@Kaz Have you been at occasions where you've been blocked for data mining?
As you're requesting lots of stuff
 
Kaz
@skiwi The data I'm after isn't easily-accessible enough to do via API or similar.
 
@Mat'sMug he lives in the wrong part of the UK for that ;-)
(for the uninitiated, Wales and the Welsh valleys were big coal mining locations)
 
Kaz
Initial Data Collection right now is tricky enough that I'm having to determine queries iteratively and manually
(Namely, the website will return the 80-closest IFAs to a particular postcode. So I have to give it a starting point, determine how far out that extends geographically, then try-guess where to start from next to get minimum geographical overlap.
Did I mention that they provide "distance" in terms of driving distane, and not "as the crow flies"?
 
4:16 PM
Sounds like an API that is not meant to be mined
 
Could you just get more data than you need and deduplicate it afterwards?
e.g., run it for every postal code
 
Kaz
@PinCrash nope. Nor can I set a distance limit for querying.
Just give them a postcode and they'l give me the 80 closest advisers.
Of course we could rent access to their database, but that'd cost more than 2 days of my time.
 
It would pay for itself if you end up spending at least that long mining the data by hand
 
Kaz
@PinCrash There's a postcode for every street in the country.
 
They'd also probably find it more preferable than scraping their web pages
 
4:18 PM
^^
 
Kaz
and some areas of te country (say, central london) have wildly differing densities of companies than oters (say, the highlands).
 
Duh, they'd be getting paid for it.
 
@Hosch250 as opposed to losing money through web page scraping :P
 
Some things are worth paying for. Database access is definitely one of those things, if data is what you are after.
 
Kaz
@PinCrash Thing is, we don't need all the data (in fact, a very minimal part of it). And we only need it once.
Plus, hey, very small company. Definitely don't want to have to pay the going rate for marketing data on the ntire country.
 
4:22 PM
On one hand, what you're doing is unethical (web scraping). So, ಠ_ಠ
On the other hand, I don't care. ¯\_(ツ)_/¯
3
 
Kaz
@DanPantry kinda. It's not like it's non-public information.
 
@Kaz Nah, web scraping (downloading HTML files then just scraping data out of them) is generally frowned upon because of how inefficient it is if there is a public API
 
Kaz
@DanPantry I wish there were an API. believe me.
 
-2
Q: Vending Machine Code Java, how so i do this

ProgramnubOKay guys I'm trying to work on a vending machine code and not sure how to approach this. Here's what I have to do: Vending Machine ***: Write a program that mimics the operations of a vending machine. More specifically, the program reads amounts of money that are inserted into the vending mach...

 
4:38 PM
@CaptainObvious uh, wat?
 
@CaptainObvious
 
oh wow
> They might be storing their “test” data in the same database, but under a dedicated company/store/POS ID. It avoids maintaining multiple databases.
#ShootMe
 
lol, nice utilization of expensive production database server resources
 
isn't testdb just a frakkin' restore of the proddb? how is that "maintaining multiple db's"?
I don't get it.
I just don't.
 
0
Q: Brainf*** Interpreter in JavaScript 3

Obinna NwakwueI have this Brainf*** interpreter (this is the JavaScript part): // Credit goes to where it is due function throwException(cause, index) { // Execute when there is an error in Brainf*** code $('p#output').text("Interpreting Terminated because " + cause + " at char index " + index); } fu...

 
4:50 PM
and now I need to add some funky ad-hoc criteria to every single view, because someone thought it'd be a good idea to test in production
 
DROP DATABASE [testdb]; --problem fixed
3
 
wow. don't they know they can set up a test database on a laptop these days?
 
apparently it's too complicated
 
@Malachi Don't do that.
We have test DBs on our laptops and it eats up a significant amount of resources on our PC
Test DB + web server + static web server (for the front end) on a 12GB RAM + 1.7Ghz quad core = ouchie
Though that may just be because our laptops are under-specced
 
my machine at home only has 4GB RAM
 
4:54 PM
Sadly, its only PI day in the US cultural area. Europeans, with their silly lexigraphcially-sensible date ordering, don't get to have yearly PI days. Spare a sad thought for them, as you're eating your pi(e) today. — T.E.D. 23 hours ago
I never knew there was a PI day
 
Pi day is 3/14 :)
 
3/14
 
was yesterday
 
@Mat'sMug It was yesterday. 3.14.
 
last year was big I guess
3/14/15
 
4:55 PM
This does work. Unfortunately, it would require hundreds of (admittedly minor) changes to the code in order to fully implement, and I'd have to get that kind of thing cleared with a lot of people. I might bring it up at the next code review. It's worth a +1, but I'm still hoping for a solution that doesn't require changing all of the code. — Darrel Hoffman 30 secs ago
 
@DanPantry you get my point though, it doesn't take up that much space to have a test database
 
@Malachi there was a precise nanosecond at one point on that date, where UTC date/time was exactly the value of PI
 
@Mat'sMug yes, and no
 
@Mat'sMug and the nerds everywhere could not agree on which nanosecond it was.
 
shhh don't burst my bubble
6
 
4:56 PM
lol
I have everything working on this Return Excel project except for sending the response through the promise....
 
@PinCrash I prefer DROP DATABASE [testdb]; -- DROP IT LIKE IT AIN'T NO THANG
 
I am probably doing something (or not doing something) stupid
DROP DATABASE [testdb]; -- LIKE IT'S HOT
 
@Malachi lol, that reminds me of a parody of that song done about one of the districts in Cardiff. youtube.com/watch?v=0WkIpybQocw
 
@Malachi Schrödinger's Stupid?
 
lol
 
5:00 PM
@PinCrash I haven't checked, I can't answer star your question.
 
Kaz
5:14 PM
SUCH FUN!
 
1
Q: Looking for a better alternative to looping in Excel VBA

MadChaddersI have used loops to remove lines that are doing various things, but all are deleting rows where certain criteria is met. Some are deleting less than certain numbers, deleting blanks, removing specific rows that contain specific things in columns, remove all the items that don't contain 4 specifi...

 
Kaz
@CaptainObvious To think, not that long ago, I was writing code worse than that.
 
0
Q: C++ template Partial Specialization Member Function; Am I doing right?

Byoungchan LeeI'm trying to improve my C++ template metaprogramming skills. From my understanding, I can't partially specialize a function(either member function or not). So, I need to define another class that can be used as template class, which enables us partially specialize template argument. So, In orde...

0
Q: SlidingNumberTile Program Efficiency

Michelfrancis BustillosI created a Sliding Number Tile Game, and am looking for input on how to make the code better organized & more efficient. #include <iostream> #include <random> #include <algorithm> #include <chrono> #include <windows.h> #include <conio.h> using namespace std; void initializeBoard(char pB[][3]...

 
Welcome to SO. Personally I think your question is fine, but some might argue that since it doesn't have a "correct" answer, it's too vague to fit the format of this site. Please try codereview.stackexchange.com for code review questions. — André Laszlo 5 secs ago
 
5:30 PM
@AndréLaszlo: Does codereview.SE really want to review code people found in a book? :/ — Wooble 40 secs ago
 
@Duga rofl
 
@AndréLaszlo This would be off-topic for Code Review as the OP is asking how to add new functionality. Please consult A guide to Code Review for Stack Overflow users for reference. — Phrancis 16 secs ago
 
@Duga Flagged as UWYA.
 
So... the code works fine (you copied it out of a book), but you want us to write new features for you and suggest and write additional features. What have you actually tried aside from copying the code? — Bob Dylan 7 mins ago
 
Sorry I misunderstood. I thought "I tried to change" meant he actually changed it :) It's definitely not a good fit for code review. — André Laszlo 14 secs ago
If you are asking for your code to be reviewed you should use CodeReview.SE — NathanOliver 42 secs ago
 
5:51 PM
If anyone wonders how Sweden and Norway competes in sports these days, this is apparently the answer:
 
is he skating in IKEA lol
that guy reminds me of Remi Gallard
 
We have now completed a couple of code reviews, one was a code review before the code was checked-in, the other was a code review on a changeset, and in both cases we don't see the CodeLens indicator. Anything else you think we should check? Does the status of the code review matter? — Techromancer 40 secs ago
 
@DanPantry added bonus that the mm/dd/yyyy format is irrational like pi
 
LOL.
 

« first day (1046 days earlier)      last day (2987 days later) »