« first day (1132 days earlier)      last day (2877 days later) » 

12:00 AM
RELOAD! There are 2438 unanswered questions (93.0015% answered)
Questions about optimizing working code should be asked on codereview.stackexchange.comcharlietfl 49 secs ago
 
12:35 AM
@Pimgd sounds like you may have transactions blocking each other... unless the table is GIGANTIC (multiple millions of rows) very few things should take Postgres(or any SQL for that matter, except maybe Jet/Access) that long to process
Looks like you found your issue, sorry for the late response. Deadlocks are not fun
 
12:47 AM
@Mat'sMug I just asked a question on DBA you may find interest with. I think PaulWhite is going to be answering it (I was discussing it in their chat room with him). Using MAX text or more specific, smaller type
 
1:29 AM
-2
Q: where to put the included header files in source file or header file

LiuI have a base class which has two derived class. In the source file of the base, I includes two derived class head file instead of the base class header file. Would this cause problem?

 
1:43 AM
0
A: Using MAX text or more specific, smaller type

Mat's MugThis is going to read like a paranoid's answer, but there aren't only storage and performance considerations. The database itself doesn't control its clients, and clients can't be assumed to always securely insert user input - even if a database is designed to be used only with a .net applicatio...

Phone post btw ;-)
 
1:55 AM
@Mat'sMug You can do backticks on your phone. I'm totally jealous.
 
the SE iPhone app has a code block button
 
Oh dear God yes, SSIS loves to freak out over varchar(max) - beautiful answer! — Mat's Mug 30 secs ago
 
2:10 AM
Holy cow, that Paul White answer
He knows his stuff
 
2:23 AM
Great, thanks Microsoft. I had a bookmark for it, now its some magazine landing page
Was titled "new sql truncation attacks and how to avoid them"
damn, even MSDN links that point to it have rotten
 
@Mat'sMug Isn't a truncation attack like SQL injection?
 
sort of
 
Any notable distinction?
 
2:40 AM
hmm it's actually the opposite problem - say you have a nvarchar(20) parameter
you exploit the fact that SQL Server will truncate anything after the 20th character
so basically yeah, my DBA.SE answer is really all about SQL injection opportunities.. I thought there was more to it :-/
in other words I don't know what I'm talking about lol
 
3:14 AM
@Mat'sMug archive.org
 
 
1 hour later…
4:31 AM
-2
Q: Should I create a unit of work with 1 entity and multiple services for a single transaction?

AKADERI am using .net and EF on the back end and I have only seen UOW implementations with multiple entities without any services or other business logic. Should I create a unit of work with 1 entity and multiple services? I need them to execute in a single transaction I have the following classes an...

0
Q: Call Center Design

thalaivvapackage design; import java.math.BigInteger; import java.util.*; import java.util.concurrent.LinkedBlockingQueue; public class CallCenter { Employee[] employees; int size = 100; Map<Employee,PhoneCall> callMap = new TreeMap<Employee, PhoneCall>(new Comparator<Employee>() { @...

0
Q: UDP network message packer

vinnylinuxI just came across the following method in a game engine i'm currently working on: bool addmsg(int type, const char *fmt, ...) { if (!connected) return false; static uchar buf[MAXTRANS]; ucharbuf p(buf, sizeof (buf)); putint(p, type); int numi = 1, numf = 0, nums = 0, mcn = -...

 
5:09 AM
Monking
 
0
Q: Pomodoro Timer in python

daroraI wrote a simple Pomodoro Timer in Python 3: from datetime import datetime, timedelta from gi import require_version require_version('Notify', '0.7') from gi.repository import Notify import sys class State: #length: the length of the state in minutes def __init__(self, length): ...

0
Q: Correct design decision for parsing an excel file with services and entity framework

AKADERI have a class that reads a specific excel file of about 200 records or so and will grow in the future. Did I design this class correctly? Most of those comments are code I have not implemented yet. public class ExcellFileService { //CUSTOM date values in the excell file pr...

 
5:25 AM
1
Q: I took Pattern Matching in Elixir too far... Help me make this more readable and idiomatic Elixir code

Scott S.I've recently started working with Elixir and am writing an app that queries various URLs and parses the response. I am having issues with my parse method, which is included below. The code works just fine, but it looks like spaghetti. This is the code that sets the whole thing in process. I thi...

 
5:48 AM
How does one name a variable which is calculated size * size ? Is powedSize ok ?
 
sizeSquared
 
thanks
 
6:02 AM
0
Q: Reading a file chunk by chunk in QT 4.3.3

TechEnthusiastI have following code in QT in // myEditor.h class myEditor : QScintilla { public: readFile(); }; #include "myEditor.h" // myEditor.cc myEditor::readFile() { FILE* fp = fopen("mynew.v","r"): QTextStream ts(fp, QIODevice::ReadOnly); /* reading the text stream buffer by b...

 
6:24 AM
@JeroenVannevel you are only 120 rep short of 10k. Go for it!
 
6:41 AM
codereview.stackexchange.com would be your best bet. — Raw N 31 secs ago
 
7:05 AM
0
Q: Simple Rock Paper Scissors in C++

MORTALi have made Rock Paper Scissors game, it works fine, i would like to know, how can i improve it further. #include <iostream> #include <string> #include <random> #include <array> #include <map> #include <regex> #include <limits> namespace { enum Winner { Tie, Player, Computer, WinnerCount };...

0
Q: Factory for object init and configuration

Fabiani want to extract the creation of different objects in a factory class for the reason of reusability. The problem is that within the current code the objects are configured also for the specific problem. Now i want to reuse only the creation of the objects within another code place. if (FieldCo...

 
@Heslacher meh
 
;-)
 
7:33 AM
Consider uploading questions such as this to Code Review next time. — Dev-iL 33 secs ago
 
GRAH
 
0
Q: simple color flooding game in Javascript/HTML5 canvas area

greenbikeI'm learining JS. I have prepared simple color flooding game. Live example: http://codepen.io/anon/pen/MeKaZG?editors=0010 Please help me find out how this code could be made better, more JS-specific, more efficient... HTML code: <!DOCTYPE html> <html> <body> <canvas id="game" width="280" h...

 
Monking
 
I need a new job.
 
Consider uploading questions such as this to Code Review next time. Also, did you try to compare your code with known-to-work MATLAB implementations such as this? — Dev-iL 46 secs ago
 
7:42 AM
if isAlias("monking", "morning") {
    print("Monking to you too, @DanPantry!")
} else {
    print("What does monking mean?")
}
 
66
Q: What's a Zombie? And what are the many other memes of Code Review?

Simon ForsbergWhat is a Zombie? Why are Code Reviewers so violent and talking about killing Zombies all the time? And what ammo are they talking about? What is a TS? What does RSA mean? And what other Code Review-specific memes are there? (As the number of memes grows and grows, and Malachi's wish to vote fo...

I GOT A REPLY!
I've just been introduced to the interviewer who will organise the next step
 
@DanPantry Coolio.
That's good, man.
 
I JUST opened that question on meta before you linekd it
 
figured I should get to know the memes of this place
 
7:43 AM
It's a time-zone neutral "morning" ;-)
 
We should use UGT.
Morning (UGT).
 
> Your ass will be laminated
lmao
(laminating my ass off)
 
> Now, instead of spending time figuring out what time of day is it for every member of the channel, we spend time explaining newcomers benefits of UGT.
 
I like the TS / RSA meme
 
8:00 AM
Ripe zombie; open question with answers, at least one answer having score 0, no answer having score > 0: Reduce a string using grammar-like rules
 
Zak
@overactor You should've seen the Pokémon versions
 
My colleague is "not convinced" by Git because he has to use the CLI for some of the more powerful features
Apparently using the CLI is too much of an inconvenience. :s
@Mast what's "dutch" in dutch?
 
@DanPantry nederlands
@Zak oh god
 
8:15 AM
@overactor As in the language
 
@DanPantry Then Nederlands with a capital N
 
so the dutch speak Nederlands in Nederlands?
wtf
 
Nederland is the country
no s
 
Thanks :-)
 
I'm a Belgian living in Switzerland; between the Netherlands and Belgium, it's remarkable how few people know which country is called what officially and which languages are spoken in each one.
@DanPantry no problem
why did you need to know, if you don't mind my asking
 
8:20 AM
Switzerland would be a country I'd like to visit one day
Because I was adding Dutch to our language dropdown and wanted to have it written in, well, Dutch, as per UX standards, instead of it saying "Dutch" in English
 
It's pretty nice over here, though granted, I don't live in the nicest part of the country and travel around less than I'd like to.
I'm not too fond of what's going on politically though.
 
Isn't Switzerland exempt frmo the EU though? So I couldn't just up sticks and live there if I wanted to without applying for a visa
 
Zak
@overactor True pretty much everywhere these days, unfortunately.
 
The same can be said for most European countries, but Switzerland is a bit more extreme.
 
@Zak +1. I mean, the US is currently in a state where the majority of Americans want neither nominee as president. [citation needed]
 
8:22 AM
@DanPantry They are part of Schengen
which means you can cross the border into the EU without being checked
 
@overactor Yes, but that doesnt' enable staying, it just enables passage
Say I wanted to live and work in Switzerland, I'd need a Visa, right?
 
@DanPantry Yeah, i might have been too young in previous elections, but I can't remember the two major candidates having such an overwhelmingly negative image
 
@overactor They didn't.
 
@DanPantry I'm not sure if you'd call it a Visum, but yeah
 
BTW, if things get too political, we should probably move the conversation to the Nth
 
8:24 AM
You need a permit to stay
 
The Nth being The Nth Monitor, our alternative chat room... since we tend to be very passionate about our discussions, in case you didn't know already @overactor
 
can anyone here move the chat over there?
 
No one here at the moment. @Vogel612 usually comes on soon, he is able to, if he would be so kind ^^
 
Zak
@overactor Funny thing. Obama currently has better poll numbers than *either* candidate. Which is pretty much unheard of for a sitting 2-term president.
 
0
Q: Bare bones painter app in Java - follow-up

coderoddeSee the previous iteration: Bare bones painter app in Java. I have improved my program thanks to all the answers in the initial post. Now I have this: App.java: package net.coderodde.javapaint; import javax.swing.JFrame; /** * This class implements an application for simple drawing. * * ...

 
8:31 AM
@Zak We're discussing in Nth BTW
 
You shouldn't have given up your RO powers Dan :P
2
Also, monking all
 
@Mast ¯\_(ツ)_/¯
If I get the job at Riot I may have more time and may be able to apply for RO again
Then again, if Ig et the job at Riot, most people don't start there until 10am..
 
Good, the traffic jams in London are killing.
 
One of the reasons I got RO was because I'm online at times that some other ROs aren't (8.30am - 5pm GMT)
The position is in Dublin, not London ^^
and I don't drive, so the traffic jams wouldn't matter
 
Oh, right, Jeroen went to Gent to London, you went from Cardiff to Dublin.
 
8:37 AM
He came to the UK so I necessarily have to flee it.
 
Zak
@DanPantry Cardiff and Dublin are *basically* in the same time zone.
 
There must be at least one body of water between myself and @JeroenVannevel otherwise there would be too much awesome in the same country.
This would decrease the demand for awesome and increase the supply, thereby saturating the market. It would be bad for both of us. :p
 
@Zak They are, but I would be getting into work at 10am and not 8am.
 
@DanPantry as I am now
speaking of which
gotta run
standup at 10
still in underwear
 
8:39 AM
@JeroenVannevel Is that a problem at your company?
 
I actually don't think so
we've got a husky walking around and the guy in front of me walks barefoot with his sweatpants rolled up to his knees
center of center of london. We're the exception to all the suits
 
You have a husky in the center of London
That poor thing must be boiling
 
That's freaking awesome though.
 
yeah he sits right behind me
he's our PO's dog
 
Can you see the Gherkin from your office? @JeroenVannevel
 
8:42 AM
I'll upload a pic tonight if I don't forget
the buttplug?
 
@JeroenVannevel Take a photo of the husky
2
^^^ Star that
 
No, too many office buildings
 
@JeroenVannevel No.. it's a building that is shaped like a Gherkin
 
I'm in cannon street
so late. talk to you in the office
 
@JeroenVannevel I know you're bias, but how does viagogo compare to ticketmaster RE bots and/or resellers?
@Quill Yeah, it's annoying.
I actually had the pleasure of speakign to a Google developer yesterday
who were working on the Angular team
> Funny, I actually really don't like mixing code and templates in the way that JSX does.
Unfortunately, I don't think this is a direction we'll go ourselves. The imperative style of templating that JSX provides just isn't the approach we're going for.
That said, I don't think it'd be impossible to build some sort of integration with Angular templates, and I imagine someone will do that at some point. There's also such a thing as TSX, too.
When I mentioned how good angular would be with JSX
His justification is that you should split the HTML from the logic
which doesn't really make sense -in Angular and Angular 2, the HTML is compiled so that the template and logic are more or less inseperable at runtime anyway.
 
8:53 AM
@DanPantry Wat.
 
@JoeWallis I mean, he is right.
Historically, you should have split html, css and js up.
But when you have a component-based architecture and you're using inline html strings it really stops making sense
if you have an inline html string in your file the only "split" your template has from logic is a whitespace one.
 
I've not used Angular much, but that's the opposite to what they do isn't it?! They couple the HTML and logic.
 
I'm so glad I don't do front end stuff
 
What Angular does is that it uses inline html strings (or html files, or urls to html files).
 
It seems headache-inducing
 
8:55 AM
It does this to separate concerns. So it looks like this:
module.component('componentName', {
  template: '<h1>{{$ctrl.foo}}</h1>',
  controller: class {
    constructor() {
      this.foo = 'bar'
    }
  }
})
For some reason this is "better" than...
const componentName = ({ foo }) => <h1>{foo}</h1>
they haven't changed this in Angular 2, angular 2 still uses the same sort of syntax, except they made the template syntax even more verbose..
And then you have the issue that because you're using inline strings any errors are only determined at runtime when the component is created.
With React, <h1>{foo}</h1> translates to a function call - React.createElement('h1', foo) - which you can run type checking on.
/endrant
 
Oh, I've not done anything with Angular2, it was still in beta when I was using Angular. Looks nothing like what I was doing, XD
 
@JoeWallis Angular 2 is still in beta
 
I'm a bit torn on whether I like the logic excluded. Either you end with a react or PHP style syntax in the same page, or you get a templating language where you've got to add another layer of complexity and the view becomes another logic layer
 
Angular 1.5 is the "migration" version. You're meant to rewrite all of your directives/controllers into components (except not all directives because you might want to still use those as attributes but hey why make things simple)
@Quill I can see the argument for both, but in data heavy apps I am prefering React. The ease of tracing where data is coming from and type safety and immutability makes it so much easier to use
Angular 2 feels like react with a lot of bad things added to it for the sake of making it different
 
@DanPantry IIRC I used 1.3, and didn't use components, mostly directives, as it was a very simple dumb app.
 
9:01 AM
@JoeWallis Components were added in 1.5 though you can get a polyfill for 1.2+
 
@DanPantry Explains my confusion, are they like all the four different 'sugar' methods combined into one?
By that I mean that all Factory, Service, Value and Constant are all sugar around Provider
Actually, I should probably stop talking, "directives/controllers into components". None of the others were mentioned.
 
@DanPantry in what way?
I actually signed a PR policy so I don't want to break that. But the guarantee that you receive real tickets is very much real
 
Did you guys know that Zombies make up 7% of the site at the moment?
 
Yup. Duga tells us every day.
 
@DanPantry meh . Too much of a hassle on the phone and it ain't that big
 
9:12 AM
Thanks to @EBrown
 
@Mast does that exist per tag as well?
 
Uh, yes and no.
Let me pull you the relevant query.
Thanks to @rolfl
 
@Mast I saw that
 
But that doesn't work in percentages. Someone with enough SQL-fu could probably re-write it though.
 
I don't posses the fu.
 
9:17 AM
 
@Quill Why is it so darn expensive?
 
someone's probably auctioning it
 
Zak
9:38 AM
@Mat'sMug I like the disclaimer ^^
> Disclaimer: I'm totally, completely, heavily involved with the Rubberduck project.
 
@JeroenVannevel Alright, sure, sorry :)
 
0
Q: Calculate point on scaled, translated and rotated canvas

Daniël van den BergI've got the following two methods, written for xamarin: private PointF toDrawingPoint(PointF screenPoint) { double sin = Math.Sin(-panParameters.rotation * Math.PI / 180); double cos = Math.Cos(-panParameters.rotation * Math.PI / 180); screenPoint.X = (float)((sc...

 
9:58 AM
@Zak One of his best so far.
Anyone up for a Python question? This one has been up for over a week. Give the newcomer some love.
3
Q: Scraping the date of most recent post from various social media services

A_S00Task I have a large spreadsheet where each line should include: The URL of a social media account A field indicating whether the account is "active" A name and UID number for each account I have to find if the activity field is accurate for every account on the list, and fix any mismatches. ...

 
I am itching to write a review, but I have so much to do. I need to write the some code for Simon, and do refactoring of my work project..
I also came up with an idea for a "coding hall of shame" where you could anonymously sbumit bad code for lulz
 
there's already a bunch of those
 
aaaaaaaaand this is why i never finish a project
because I discover mid way through it's already been done ^^
 
@DanPantry Like the daily WTF?
 
@Mast more like CodeReview, but without reviews
 
10:15 AM
possible answer invalidation by AndyH on question by AndyH: codereview.stackexchange.com/posts/131460/revisions
 
> By dangerous, I mean with pointers and other similar stuff.
The ignorance is strong with this one.
@Duga Rolled back.
 
Zak
@DanPantry Well hey, if you want, I'll go dig out the first (working) VBA code I ever wrote.
 
9 upvotes + bounty on question possibly containing stub code, looking for second opinion
9
Q: Efficiently using Apache HttpClient in multithreaded environment

user1950349I have a library which is being used by customers and they are passing DataRequest object which has userid, various timeouts and some other fields in it. Now I use this DataRequest object to create a URL, then make an HTTP call using Apache HttpClient for which my service returns a JSON response ...

points of suspicion:
        // some code to find out the "hostnames"

        for (String hostname : hostnames) {
            if (statusCode == HttpStatus.OK.value()) {
                // create successful DataResponse and return it
            }
            // otherwise log error and return DataResponse with error in it
 
Zak
@Pimgd Depends, is the code in question the central focus of the review?
Or is it more "provided for context"
Taking a quick look, my impression is "Probably fine"
 
10:37 AM
http://www.commitstrip.com/en/2016/06/09/coder-1-corrupt-file-0/
CommitStrip
Coder: 1. Corrupt file: 0.
CommitStrip
1465468090
 
@Quill I aproved the edit. It doesn't harm and removing credentials if they are real is correct.
 
I also pressed approve
 
possible answer invalidation by D. Jurcau on question by Daniel Netzer: codereview.stackexchange.com/posts/131457/revisions
 
@Duga we talked about this and it is ok
 
10:48 AM
the email seems real enough so I sent it a mail that the password may have leaked and that they should change their password
3
 
0
Q: How to replace OR operator with UNION operator and make the query faster?

StackHere is my query: SELECT h.id, h.subject, h.body matnF, h.amount, h.keywords tags, h.closed, h.author_id author, h.AcceptedAnswer, h.type, h.visibility, h.date_time, v.value AS vote_value, u.reputation, u.user_fname, u.user_lname, u.avatar, (h.author_id = :user_id1) as hasUserId, (select COALESC...

0
Q: ThreadSave implementation of a navigation service with monitor

Florian MoserI'm refactoring code for a navigation service, and the original Author uses a pattern I do not quite understand how and why it works. All methods which access a private variable of the object (_pagesByKey) are of the following structure: /// <summary> /// This code is from the WindowsRT ...

 
I've been trying to formulate an answer to a year old zombie question by of @MartinR; it took me at least 20 minutes to even understand the code...
 
@overactor Is that this question? codereview.stackexchange.com/q/87004/11728
 
@DanPantry all good
yesterday we sat together to read helpdesk emails
 
yup, though in my defence, I didn't know AnySequence used to be called SequenceOf
 
10:59 AM
quite a useful approach
 
But looking back, it shouldn't have taken as long as it did
 
Looks like a breadth-first search, which seems wrong to me.
 
It's not quite breadth-first
Wait, what is defined as breath first?
it goes
 
It puts the children on the end of the queue, which is breadth-first
 
1, 2, 3, 1a, 1b, 1a1, 1a2, 1b1, 1b3, 2a, etc.
 
11:03 AM
Breadth-first is 1, 2, 3, 1a, 1b, 1c, 2a, 2b, 2c, 3a, 3b, 3c, 1a1, ...
 
would breadth first not be:
Yeah, that's what I though
 
Mdonking
 
ah but wait, I'm wrong
yeah, it is breadth first
I suppose depth-first would be better, it's typically how trees work
 
The trouble with breadth-first is that it requires O(n) storage for the queue. Sometimes this is necessary because of the search requirements, for example if you want the shortest path. But in this case there are no such requirements, so depth-first would only need O(log n) storage.
 
0
Q: ThreadSave implementation of a navigation service with monitor

Florian MoserI'm refactoring code for a navigation service, and the original Author uses a pattern I do not quite understand how and why it works. All methods which access a private variable of the object (_pagesByKey) are of the following structure: /// <summary> /// This code is from the WindowsRT ...

would this fit for SO ?
 
11:10 AM
@Heslacher I'm afraid they would downvote it and flag it to be moved back here.
 
ok
 
@overactor You just learned something ^^
 
11:27 AM
I did indeed
also, I think I solved it now
 
37
A: What programming languages have been created by PPCG users?

TimwiMornington Crescent A joke language I (Timwi) created based on Mornington Crescent from I'm Sorry I Haven't a Clue. The program is executed by moving from station to station on the London Underground, starting and ending at Mornington Crescent. Martin Büttner wrote a “Hello, World!” and a primal...

 
WTF...
 
That's so awesome
the same person also made funciton
 
Unfortunately, language extensions typically cost millions of pounds and require lots of digging. — Comintern Sep 20 '15 at 3:09
 
11:45 AM
@Mast so you need a lot of dirt?
 
If you want a code review, then maybe it should be asked on [Code Review](code review.stackexchange.com)? 10 lines instead of 1 is long-winded. The use of files=(`ls`) loses spaces in filename so; you should simply use for file in *. Using multiple awk processes per file is unnecessary. A single use of awk (or sed) could fix up the name all at once. With you code, any files created at 20:16 would get the names butchered. Personally, I would find a blank line per file odd feedback; I'd expect to see the file names or nothing. — Jonathan Leffler 14 secs ago
 
Anyone got any resources for git training courses?
not for me, boss has asked. I just blew someone's mind showing them git checkout <rev>
 
GitHub's git tutorial: try.github.io/levels/1/challenges/1
 
0
Q: Currency Converter as first React.js

st88After reading a few React.js beginner-tutorials I decided to make this web app. Just for to get some practical experience ... Moreover I used Twitter Boostrap for the layout. The app works as expected. But the code can surely be improved. Therefore: Any hints welcomed. I would be especially in...

0
Q: Using lists of types to specify types conversion order for operations

Alexander MorozovI want a mechanism for specifying arbitrary order of type conversion for arbitrary set of types for each operation on that types (separately). For example, let's have set of types Bool, Date, Number, String and operations isEqual and isLess. For isEqual I would like to have order Bool -> Date ->...

 
Monking
 
11:59 AM
@Quill That's useful, but I'm looking more for private training
 
@DanPantry I know a couple, but they don't serve UK.
They do Git, Python, Numpy, Linux, etc.
 
online courses might be good enough
 
Doulos might give Git courses, they're UK.
 
When the interpreter got done, I'll post it in codereview.stackexchange.com, and I would appreciate an review by you @GuyCoder. — Gabriel B S M 26 secs ago
 
@DanPantry I can't find it on their site, but it might be worth asking them.
 
12:08 PM
@DanPantry interactive or not?
 
Any resources at all
Just need to compile a list for my boss
I so far have the atlassian bitbucket tutorials, github's interactive tutorial, official git, your link @Vogel612, and the contact page for Github training
 
atlassian also has git workflow tutorials, those are kinda nice, too
 
Yes, I linked those
We'll likely be using the PR workflow as we're using Bitbucket anyway
 
I pretty much always have like three outstanding PRs at work
 
> Snowman's code is much more elegant and efficient than Ostrich, it has far more documentation, and it has much more work put into it in general. This conclusively proves that I am at my best when writing bad code. Which is probably why I'm on this site in the first place.
If anyone doubted PPCG and CR don't mix well ^^
@JeroenVannevel We demand a photo of the husky.
 
12:17 PM
@Sinatr I remember I saw a similar question about job scheduling (in a very complicate scenario) here on Stack Overflow (or Code Review? I can't find it now...) If you find it you may pick some nice ideas from there — Adriano Repetti 58 secs ago
 
I've got one on my phone from last week
and a video when we were drunk in the office
I'll send tonight
 
@DanPantry Does that fit what you need or are you still missing something?
 
@Mast It will do for a start, thanks @all
 
This is also a good reference to have around.
A bit big for a course though.
 
Yes, I linked that, but it's quite wordy
 
12:22 PM
is there a short way to compare the elements of two tuples of same sizes?
 
@N3buchadnezzar in what language?
 
Python
 
Probably.
It's Python.
 
Need to output true if all elements are bigger or equal
 
0
Q: Data model for complex tree (multiple children and multiple parents)

ElfayerI'd like to have a discussion on the data model (mostly) for a tree with nodes having multiple children and multiple parents. I already have a working algorithm, but I'm looking for improvements. The things to keep in mind are the feasibility of the algorithm and the performances. Here is the da...

 
12:25 PM
(3, 4) > (2, 3) true, that kind of comparison?
 
Or do all the elements of the bigger tuple have to be bigger than all the elements of the smaller tuple?
 
@Mast they all have the same sizes
 
@N3buchadnezzar [a >= b for a, b in zip(l1, l2)]?
 
print not False in [x>=y for x,y in zip(A, B)]
:p
 
12:28 PM
@N3buchadnezzar print not all(x>=y for x,y in zip(A, B)) ;P
 
I tried first any, that did the opposite :p
 
How about a simple sort?
 
@JoeWallis does all break the instant it finds a False case, or does it build the whole thing first?
@Mast The first list A is already sorted
 
@N3buchadnezzar It's lazy, so it breaks on the first False
 
6
Q: Recursive flattening of Swift sequences

Martin RIn Flatten to get all child controls of certain type in a UIView, methods were discussed to recursively flatten a tree-like structure in Swift, resulting in an array of all elements. Motivated by that thread, I have written a flatten function which creates a sequence instead. This can be an adva...

de-zombiefied?
 
12:33 PM
Most git tutorials start at the high level (branches, checkouts, checkins, merges, versions), which I think is a mistake. If you start at the low level then the number of concepts you have to learn is much smaller.
 
@JoeWallis Thanks! Btw, what is your background in programing? I am curious to know ^^
 
Thanks, Santa!
 
@N3buchadnezzar Self-taught, Started learning when I was 13/14. I have no formal qualifications in programming, ):
 
possible answer invalidation by Killercam on question by Killercam: codereview.stackexchange.com/posts/131456/revisions
 
12:39 PM
Thanks very much for this, most appreciated. I have implemented the class as per my edit. I appreciate the test method looks like it is doing a lot, but I am not sure I can cut it down in size. I hope this looks better! :] — Killercam 2 mins ago
answer invalidaaaation
 
@JoeWallis Perhaps a strange question. This is a different problem. I have one tuple which is increasing (9, 8, 7) and another unsorted tuple (9, 7, 8). I want to figure out if they contain the same elements.
 
Does that edit get rolled back then?
 
@N3buchadnezzar Don't be disheartened, by self-taught I mean I only had Python docs and SO, so you'll be as good as I am in no time if you stay here. :)
 
yes it does
 
One way is to sort the second list and compare (since the first tuple always is sorted). However is it fast to use set comparisons?
 
12:40 PM
@N3buchadnezzar if it's unique set(a) <= set(b) if not then... collections.Counter?
 
A "git repository" is a database of trees, commits and refs, where a "tree" is a bunch of files, a "commit" has one pointer to a tree and zero or more pointers to other commits, and a "ref" is a name for a commit. The other git operations are built out of these basic elements.
 
Hello! Please don't make changes to your original question once it has been reviewed, as that invalidates the current answers. See our meta site on performing iterative reviews for more information! — syb0rg 10 secs ago
 
This is a perfect place for a parameterized query. You can find examples here and here. — Comintern 1 min ago
 
@JoeWallis Just wondering wheterer it is best to sort one tuple, or compare them using sets =)
 
Does anyone else here use AutoReviewComments?
 
12:44 PM
yeah
 
@N3buchadnezzar I'll do a timeit
 
@Quill How do you add more default comments?
Like I only have two options for comments on questions rn
But a bunch available for answers
I mainly leave a variety of comments on questions tho
 
Somewhere on Meta is a link to a API that Simon set up to provide pretty much all the comments we'd need
 
Thanks, I was not aware it was reasonable and valid to ask another question based on a previous one... — Killercam 1 min ago
(Hurray!)
 
@Quill Upvotes to anyone posting said link here
28
Q: Frequently Posted Comments

Simon ForsbergOn Code Review we often encounter questions with the same kind of problem over and over again. Some of us are using the auto comments script which allows you to maintain a list of comments to post. What are some useful tin-can comments that can be good to have in your list of comments? If you ...

 
12:48 PM
def hlim(x):
    return 0.5 if x == 0 else 0 if x < 0 else 1
 
Now if only I could give myself upvotes
 
python wat
 
@syb0rg Ask douga to vote for you.
 
@syb0rg <_<
 
@Duga Hook a brother up?
Us robots gotta look out for each other
3
 
12:49 PM
Brother from another circuit
 
@Quill Have some upvotes for the helpful information anyways ;)
 
please don't selectively upvote
 
@Quill ?
 
can someone explain that python snippet I just posted
 
you shouldn't upvote people because of who they are
 
12:51 PM
because I thought I could read python
but that bit I don't understand - it smells hacky and/or broken
 
it's a ternary inside a ternary
 
question mark where
The syntax is:

`a if condition else b`
 
return (x == 0 ? 0.5 :
    x < 0 ? 0 : 1
);
 
2322
Q: Does Python have a ternary conditional operator?

DevotedIf not, is it possible to simulate one using other language constructs?

 
Python's ternary is right-associative
 
12:53 PM
x == 0, 0.5
else x < 0, 0
else 1
like that
right
okay so it's not broken
just ... really confusing (at first)
 
@MartinR you're welcome, thanks for taking the time to read my answer in depth. I'm fairly certain you know more about Swift than I do, but your question grabbed my attention and with 1 year extra of Swift development to fall back on, I managed to offer up some improvements. I learned a lot while reading your question, even more while answering it and am excited to find out what I'll learn when you give me feedback on my answer.
 
So it's 0.5 if x == 0 else (0 if x < 0 else 1)
4
 
Zak
@Quill Depends on how you do it. If I want to give someone a present, I'll find a question/answer of theirs and then upvote all the posts on said question if I think they are deserving of upvotes.
 
possible answer invalidation by Resistory on question by Resistory: codereview.stackexchange.com/posts/131371/revisions
 
Thanks for your feedback, I add a new way to call the functions I hope it's what you intended to explain it to me. — Resistory 7 mins ago
 
12:57 PM
@Zak I wouldn't suggest considering the author at all when you're deciding whether to vote
vote bias isn't great, even if your intentions are pure
 
@Quill There are exceptions though
 
like?
 
@N3buchadnezzar sorted is faster, significantly faster. ~2times faster. It's up to you if you use set or sorted.
 
1
Q: Optimize query from xml column

Mantas ČekanauskasSo I have a query like this: SELECT data.Id, mr.mri AS Mri FROM ( SELECT e.Id , dbo.GetLatestEntryId(e.Id, 2) AS G02 FROM dbo.Estimations AS e ) AS data LEFT JOIN ( SELECT Id, d.valu...

 
@Quill If the poster has a really offensive username she is more likely to get downvoted.
 
12:59 PM
Hi @SisomaMunden
 
meh, that's a personal thing. post quality is independent of username offensiveness. I would suggest just leaving a moderator flag on one of their posts instead of outright downvoting it
 

« first day (1132 days earlier)      last day (2877 days later) »