« first day (513 days earlier)      last day (3496 days later) » 

9:02 PM
@monkey I'm surprised I'm mentioned, since I don't have a single line of code on Git ;-)
Can you use Github for SQL, btw?
 
@Phrancis Yes... It's generally advisable to also put your tables under version control
 
@rolfl Cool!
 
Can someone casta the final delete vote on this?
-6
A: Bubble sorting in C

Amr AymanThe final sort function: int sort(char ** sorted, char ** strs, const size_t size, const bool ascending) { // using the bubble sort algorithm int result, times; bool changed; // boolean to check if a loop makes a change to "sorted" sorted[0] = strs[0]; char ** test; // a pointer ...

 
@syb0rg not on that one
 
No... I am about to do something different there.
 
9:04 PM
I don't think it warrants a deletion
 
Just doing soime research.
 
it's really uncool that he accepted his own answer, but it's okay to show the end result
 
@Phrancis What's even more interesting is that apparently my friend André apparently has a connection to you guys... instead of having a connection to his friends from school
 
@JeroenVannevel I agree, but all that answer does it re-iterate what @vnp covered
 
He made it CW as well, which is a plus.
 
9:05 PM
like they said earlier, it's like no one got the accepted answer.
 
@syb0rg he even explains his changes. that's actually a quite good answer. I gave it an uproot.
 
Same user does the same thing here:
-8
A: Bash Music Player 2

Amr AymanAfter reading Janos comment, I decided I need to refactor and refine that code heavily, since I haven't touched it in five months. This is the github repository for the project .. Here's the main script source .. #!/bin/bash mkdir -p "$HOME/Music" # So that any download will be in the music di...

 
@SimonAndréForsberg uproot? on your phone?
@syb0rg that one doesn't explain what was done, that one is not a good answer
 
To me, that is considered unacceptable behavior
 
@Malachi LOL
 
9:06 PM
@Malachi No, worse. On my Mac.
 
@SimonAndréForsberg What are you using a mac for? thought you were a programmer?
 
@rolfl I am tempted at putting the output from that on my CV, but I have a feeling that wouldn't be the best option :)
 
(feels lonely in really liking his Mac computer)
 
@SimonAndréForsberg Nah, but it is entertaining.
 
@Phrancis Read my profile
 
9:08 PM
@rolfl very entertaining. And a bit inspirational. And informative
 
 for life
 
It seems like malachi26 is—or should be—friends with Simon Forsberg.
 
@Malachi lol, yeah. I bought it years ago because I needed a new laptop, and I wanted a Mac to develop iOS applications.
@syb0rg This is Code Review chat. We prefer bananas.
2
 
@SimonAndréForsberg I am not a mac/apple person...lol I was just messin with you...
 
I am also not a Mac/Apple person. I still don't have an iPhone, and I still have not finished a single iOS app.
 
9:10 PM
@syb0rg I just see a square.
 
@Mat'sMug You're on your phone, aren't you?
 
I did one Android App almost 4 years ago. I really should get back into it, but I have no idea what application to start with,
 
nope.
hold on.
 
I am on a desktop and all I see is a square
 
9:10 PM
phone doesn't show anything
but I can guess the apple
 
@Mat'sMug Yep. I wonder why it isn't showing up for you...
 
@Malachi Google paid me about 8$ this month for sales of my so-far only existing app on Google Play :)
 
@SimonAndréForsberg more than I am making
 
because apples won't display in my Chrome browser and my Android phone
 
or was it 8$? Perhaps it was more like 5$...
@Malachi I hope your real work pays better though :)
 
9:13 PM
1
Q: Best way to write generic factory in Java

DymytryI need to write a factory of generic converters to produce converters from/to MongoDB objects to/from Java objects. Here is my implementation, it doesn't look good enough to me, so I would like to see your advice. public static <T> Converter<T> getConverter(final Class<T> clazz) { return new...

 
@SimonAndréForsberg oh yeah.
I want to create some programs though, I need to find something that people need and hit the coding hard and create an application
 
I think an app where you can set reminders and it sends you an SMS would be handy
 
I need to finish some of my half-finished Android games, and just make them free. Because I honestly don't care so much about the small amounts of $ I get from Google Play
 
I release identical apps for free and for 1$
 
@Phrancis Why even send you an SMS? Why not just use the phone's built-in calendar feature with notifications?
 
9:16 PM
Well it could be used to send someone else a reminder
 
wtf am I missing here..
select
	detail.Id,
	detail.LineNumber,
	detail.TotalUnits,
	sum(invoiceSz.Units) SzUnits
from dbo.InvoiceDetailSizes invoiceSz
	inner join dbo.InvoiceDetails detail on invoiceSz.InvoiceDetailId = detail.Id
where detail.InvoiceHeaderId = 278663
group by detail.Id, detail.LineNumber, detail.TotalUnits
order by detail.LineNumber
Id	LineNumber	TotalUnits	SzUnits
626420	1	2	2
626421	2	2	2
626418	3	11	11
626422	4	2	2
626423	5	3	3
626419	6	1	1
 
^^ correct result
 
@Phrancis Ah, that could be something yes.
 
select
	detail.Id,
	detail.LineNumber,
	sum(detail.TotalUnits) DetailUnits,
	sum(invoiceSz.Units) SzUnits
from dbo.InvoiceDetailSizes invoiceSz
	inner join dbo.InvoiceDetails detail on invoiceSz.InvoiceDetailId = detail.Id
where detail.InvoiceHeaderId = 278663
group by detail.Id, detail.LineNumber
order by detail.LineNumber
Id	LineNumber	DetailUnits	SzUnits
626420	1	4	2
626421	2	4	2
626418	3	66	11
626422	4	4	2
626423	5	6	3
626419	6	1	1
^^ borked
why is sum multiplying by the number of rows? what's wrong with me???
 
9:19 PM
missing group by?
 
0
A: Self-accepting own answer when competing answers exist

syb0rgDon't get me wrong, there is nothing wrong with self-answering a question. There isn't even anything wrong with accepting your own answer if you review your own code. The problem comes in when you implement the advice given to you by other answers into your own answer and choose to accept that ...

 
I want to compare the sum of units at the InvoiceDetail level, vs the sum of units at InvoiceDetailSizes level... and I can't seem to figure it out!!
 
why do you group by TotalUnits in the first query?
 
because if I don't...
> Column 'dbo.InvoiceDetails.TotalUnits' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
but then if I make the sum, it's multiplied by the number of rows at the size level
as if... the join was broken
 
^^ WTF
 
9:22 PM
^^ my thoughts exactly
seems to freakin' trivial, ...
 
this looks like something that you should post as a question rather than something you should post as an answer to this question. — Malachi 16 secs ago
 
My friend posted an answer to the julia question:
1
A: Speed optimization for girth-counting algorithm

André SamuelssonWhat you should be using is a neighboring matrix. The key is graph theory. You represent the graph with a matrix. For example: Here is a graph and its corresponding neighbouring matrix. If you look at the first row you see that A has no one-step connection to itself. But it has a one-step...

IMO that will bring a significant performance gain
 
> Now then, here's the mathemagic.
 
@Phrancis got a clue? brain's melting over that one..
 
12222 rep!
 
9:29 PM
nice!
 
Looking it over now mug
 
it's been a long time since I even thought about Matrices other than the cool movies of the Matrix
I don't even remember how to add or subtract them on paper...
 
@Phrancis nathematic, mathematic :)
 
Line	dtlUnits	SzUnits	Rows
1	4	2	2
2	4	2	2
3	66	11	6
4	4	2	2
5	6	3	2
6	1	1	1
 
0
Q: Eliminating for loops by using NSDictionary

Michael ShamashI have this code which is preformed each time the user presses a button, but depending on how long my input string is (route), it could be very fast or very slow to run. The code gets the data from two files and has to go through each one to find the correct information for each element in route...

 
9:31 PM
sum(detail.TotalUnits) DetailUnits,
Try count() maybe instead of sum
 
count gives me Rows ^^ above 2-2-6-2-2-1
 
Ah
Weird schema?
 
oh I need to partition by and sum over
 
Why is Oktoberfest in September..
 
well it's a sanity check query; the InvoiceHeader has a figure, each InvoiceDetail line has a figure (that should add up to InvoiceHeader's total), and now with the size-level, I need to check they add up to what the InvoiceDetail line is saying.
 
9:35 PM
Gotta love some sanity checks
 
@JeroenVannevel That has to be a good question for..... skeptics?
 
@rolfl help me out here... going nutz
 
Catching up/.
 
> By moving the festivities up, it allowed for better weather conditions. Because the September nights were warmer, the visitors were able to enjoy the gardens outside the tents and the stroll over "die Wiesen" or the fields much longer without feeling chilly. Historically, the last Oktoberfest weekend was in October and this tradition continues into present times.
 
22 mins ago, by Mat's Mug
select
	detail.Id,
	detail.LineNumber,
	sum(detail.TotalUnits) DetailUnits,
	sum(invoiceSz.Units) SzUnits
from dbo.InvoiceDetailSizes invoiceSz
	inner join dbo.InvoiceDetails detail on invoiceSz.InvoiceDetailId = detail.Id
where detail.InvoiceHeaderId = 278663
group by detail.Id, detail.LineNumber
order by detail.LineNumber
 
9:39 PM
That's some tricky shizzle. So much for a quick weekend to German land
 
tsss.. drink more, keeps you warm.
 
Is that still your SQL, @Mat's ?
 
yeah
why?
 
Is it just me, or has the chat prompt-for-user-completion after typing the @ changed? And now has pictures?
 
^^ that
 
9:41 PM
yeah it did. and they borked @'ing @Captain
 
So they did.
 
@Mat'sMug your join doesn't look right to me
 
@JeroenVannevel eternal September
 
@Phrancis why is that?
 
I would expect detail to have an InvoiceId rather than the other way around
But, I could very well be wrong
 
9:43 PM
inner join dbo.InvoiceHeaders head on detail.InvoiceHeaderId = head.Id
^^ that's exactly what I have... detail has FK to header
 
@Phrancis - you are right, and @Mat's has the wrong code in chat:
> inner join dbo.InvoiceDetails detail on invoiceSz.InvoiceDetailId = detail.Id
 
Ah we're looking at different code then :)
 
0
Q: Refactoring this JavaScript code

CommonCentsI am loading divs from separate .html files into a div on the index.html page. This is being done using jQuery's .load(). There is however, a lot of repetition and I'm wondering if there is a cleaner way to achieve this. The HTML: <nav class="menu-side"> <a href="#" id="about">About</a> <a ...

 
from dbo.InvoiceDetailSizes invoiceSz
	inner join dbo.InvoiceDetails detail on invoiceSz.InvoiceDetailId = detail.Id
	inner join dbo.InvoiceHeaders head on detail.InvoiceHeaderId = head.Id
 
9:44 PM
Yeah, @Mat's has to figure out what query he is running... ;-)
 
'night @sim
 
Night Simon.
 
Good night Simon!
 
@CaptainObvious Refactoring this title
 
Also @CaptainObvious - Stub code?
 
9:46 PM
@rolfl I want to sum up both size-level units and detail-level units, and compare them. but because I have the size-level table in my query, the sum at detail-level is overstated. So my guess is that I need to sum(detail.TotalUnits) over (partition by detail.Id), but it's not letting me
header > detail > size-level
 
Sounds like a job for a CTE.
Use the CTE to aggregate the one level, and then use that on the outer level, and, depending on which way you do it, you either aggregate the new value, or group by the inner value.....
 
You could also "hack" it by dividing it... like this... but probably not the best idea
select
	detail.Id,
	detail.LineNumber,
	sum(detail.TotalUnits) DetailUnits,
	sum(invoiceSz.Units) / count(invoiceSz.Units) as SzUnits
 
hmm, no.
:)
@rolfl sounds like a plan
 
^^ that
 
9:50 PM
Hmmm... I can't get the problem straight in my head.
need to see the code, and play with it ;-)
Ohhhh, real santas today, I got a +1 on SO ;-)
 
select
	detail.LineNumber Line,
	sum(detail.TotalUnits) Wrong,
	sum(invoiceSz.Units) SzUnits,
	count(*) SzRows
from dbo.InvoiceDetailSizes invoiceSz
	inner join dbo.InvoiceDetails detail on invoiceSz.InvoiceDetailId = detail.Id
	inner join dbo.InvoiceHeaders head on detail.InvoiceHeaderId = head.Id
where head.Id = 278663
group by
	detail.Id,
	detail.LineNumber
order by detail.LineNumber
Line	Wrong	SzUnits	SzRows
1	4	2	2
2	4	2	2
3	66	11	6
4	4	2	2
5	6	3	2
6	1	1	1
 
in The Whiteboard, 1 min ago, by Jimmy Hoffa
@amon ....I just skimmed a code review Haskell post and didn't look particularly closely, went back just now to think about reading it in detail and answering, realized I wrote it almost 2 years ago....
 
@Mat's if you change the sum(detail.TotalUnits) Wrong, to min(detail.TotalUnits) Right ... ?
 
Ummm. Wtf kind of CR answer is that?
0
A: Refactoring this JavaScript code

outoftimengView First of all you described ngView from angularjs It is what it does. It just helps to organize routing code and template loading. In next section I'll show samples from my current self-learning project. If you need strict jQuery solution, place appropriate comment.

 
but why would I want the min?
 
9:57 PM
well, by my instinct, the TotalUnits is already the sum of the different sizes... for that line on the invoice, right?
 
(and it does work)
Line	Wrong	SzUnits	SzRows
1	2	2	2
2	2	2	2
3	11	11	6
4	2	2	2
5	3	3	2
6	1	1	1
so yeah, the 2 is there twice for line 1, and the 11 is there 6 times for line 3
I could just as well take the max
I'm fried.
 
So, you are counting the Total Units as many times as there are size records.....
 
yeah. dumb me.
 
and the values will be identical for all records in the group.
 
indeed
like a borked join
@Phrancis count doesn't work though
 
10:00 PM
That's right you already said that
Pretty tired too, what with all the excitement of graduating and all :D
 
But, Phrancis's suggestion to divide by count would have worked.
 
yeah, but too dirty ;)
 
And it should have divided the TotalUnits sum, not the size sum.
 
lol avg works better
 
should work the same.... actually
bottom line, is that, if it is any different from the size-sum, you have a problem.
 
10:01 PM
I think you need a reference to this meta question. Please read it thoroughly. — syb0rg 8 secs ago
 
so, do you really need the TotalUnits, because that is what the SzUnits is already
 
@rolfl that's what I'm verifying!
there's a potential data integrity issue here
like, potentially 2 versions of the truth, in 2 tables.
 
@syb0rg was that supposed to be on the answer, or the question, because the meta link points out how to work on a question.....
 
@rolfl Oops, wrong link. Fixed
 
@Mat'sMug For validation, I would add two columns, one is:
max(TotalUnits) - min(TotalUnits)
the other is
 max(TotalUnits) - sum(SzUnits)
If either of those values are non-zero, you have a problem.
 
10:06 PM
oh it's more complicated than that - invoices have an InvoiceType at the header level - an invoice could actually be a credit note, with negative or zero units
 
That's OK, the point then will be that both the total and size sums should be the same, with a difference of zero.
just so long as the size units are negative to, the above will work fine.
 
TTQWAHAB-BBL
 
@rolfl and that's where I fucked up - I completely forgot to account for InvoiceType at the size level
 
Looks like he read the link:
1
A: Refactoring this JavaScript code

outoftimengView First of all you described ngView from angularjs It is what it does. It just helps to organize routing code and template loading. In next section I'll show samples from my current self-learning project. If you need strict jQuery solution, place appropriate comment. Angular solution Ma...

(toss him an upvote!)
 
done.
 
10:09 PM
0
Q: Is this tutorial good for learning about PHP MVC?

RottenElfI have basic knkowledge about PHP. I have build simple application such are contact forms, logins, very simple CMS systems etc... I decided to step ahead and start following some tutorial of creating own framework for learning purposes. There fore i have found this tutorial https://www.youtube.c...

 
what link?
 
@Mat'sMug Scroll up to the comment posted in chat. I've deleted it from the answer
 
chat still has the bad link ;)
hi!
welcome to The 2nd Monitor, @outoftime!
 
@outoftime Hello!
 
way TTQW here, laters!
 
10:13 PM
@Mat'sMug See ya!
 
@syb0rg hello
 
@outoftime Welcome to the engine room of CR!
 
Why did you give me that link?
 
Your answer wasn't what I would consider a "proper review"
I didn't want you to lose reputation, so I pointed you to that link
I see you read it?
 
@syb0rg not all
@syb0rg I'm real newbie
 
10:17 PM
@outoftime Ahh, well your edited answer was much better than the original anyhow IMO.
@outoftime Hang around here for a while and you will soon get the hang of things!
 
And you will meet the regulars, who, when reminded, can be nice people ;-)
 
Expamle pls (:
 
@outoftime Like for example, people who are regulars in the chatroom usually get more votes on their answers
Hence that little bit of rep you gained since joining
 
^^^ That's only because people in the chat room tend to talk about questions, and, when you look at questions you tend to vote on things you like/dislike, so the more people look at stuff, the more stuff gets voted on.
 
@outoftime But anyways, there are a certain way things are done around here. Most of those things are stated in some meta post somewhere
Which we can happily point you too if requested
 
10:23 PM
5
Q: English-Russian irregular words tester

outoftimeCould you take some comments about my self lerning project. It is really hard codded, but I have no idea what to do next. I'm using angular (only few features for now) and grunt + bower. tester.html <table class="table table-bordered"> <thead> <th>First form</th> <th>Second form</th>...

 
0
Q: List file in a directory with Python

metoI have folder1 that contains other folders (which may contain other folders etc). This process stops at some point where a folder contains only files, and some of them end with the string "img". I would like to write to a file for each line: the complete path of the file (if ends with, say "i...

 
@CaptainObvious I saw it.
 
@outoftime we're a funny bunch at times, too:
33
Q: What's a Zombie? And what are the many other memes of Code Review?

Simon André 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...

 
Should I duplicate my post from codereview.se to programmers.se ? Or there is some better way?
 
@outoftime CoptainObvious is a bot.... it posts all new questions.
 
10:31 PM
@rolfl nice, ty
 
@outoftime Your question, as it is, is not appropriate for Programmers.se.
Are you actually looking for a code review, or suggestions on what to do next (new functionality)?
 
I thought It is the same is some cases.
 
Hmmm. it's complicated ;-)
there is a big difference between que3stions on Code Review, and Answers.
 
How to take a link to answer?
 
Questions should present the code to be reviewed, and a description of what the code does.
The idea of a review is that the code is inspected, and suggestions are made on how to improve the code.
If the code does not do what you want the code to do, then the code is not working, yet.
So, if the code currently does 'x' and 'y', but you also want it to do 'z', then the question is off-topic, because the code does not work.
On the other hand......
 
10:38 PM
5
Q: Optimisation of palindrome

encoree1337My program in input has to take number of numbers to check - n, then for n times it is checking if number is palindrome - if it is - prints 0, if it is not - prints the smallest number which you want to add to input number to get palindrome. I have problem with optimisation, my present algorithm ...

 
if the code does x, and y, and an ANSWER says.... "Hey, your code does x, and y, but it would be better if it does 'z' too", then that's OK
 
What about my answer? Is it correct?
 
Ahhh, you edited your answer substantially there.
mostly after the downvotes happened.
 
Yeap.
 
0
Q: counting the number of times each letter appears in an input string

trentenok here is the question. i am 1. getting user input in the form of a string. 2.use a nested for loop to count the number of times each letter would appear. for now i don't want to worry about case sensitivity lets assume everything is lowercase but here is what i am looking for. please enter a s...

 
10:44 PM
Problem was with task complexity so I place brief solution description, than start implement it
And only after that I added full description
 
Yeah, that's a disadvantage when answering.... a lot of the people will only look at your post when it is new.... I have just taken a few minutes to read it.... and, I think it is more complicated than it needs to be because there is an error.
I don't understand the first example.... I think it may be wrong:
Lets look at some samples

123 + 9 = 202

[1]2<3> + 8 = 201 # (3 + 8) % 10 = 1
[2]0<1> + 1 = 202 # (1 + 1) % 10 = 2
 
@rolfl Yea, it is.
 
I am not sure what you mean with the 123 = 9 = 202
 
123 + 9 = 131
131 is palindrom
 
Yup.... that small error made it hard to work through the examples, and frankly it made no sense.
now that I have spent more time on it, I really like the algorithm, but, I am afraid there may be a language thing as well here.
Are you going to edit it to make the first example right, @outoftime ?
After you do that, I'll edit it as well, and see if I can make the English a little more standard (just change a few things here and there).
 
10:55 PM
Done
@rolfl I'm B2 at english lessons.
 
Check out my revisions, feel free to modify as well. You can see the changes I made in the history here: codereview.stackexchange.com/posts/64180/revisions
 
11:20 PM
0
Q: Modularizing a Game Scene in Sprite Kit

bazolaI am trying to modularize the main SKScene of my strategy game. I am not sure that my approach is correct so I would love to get a review of the following code. The SKScene adds the top level node of this class to its _world SKNode. It calls the update method in a fixed time step that can be in...

 
Just clearing my notifications
 
Who is @Emily. ?
 
Emily, from my brief interactions with her, is really good with math.
 
She's just a regular, she edits a fair amount too. She often provides significantly mathematical answers.... she knows a lot more about algorithms than me ;-)
@outoftime She gives answers like:
11
A: Project Euler #1 in PHP

Emily L.You're using a brute force approach with a linear time complexity in the range and linear in the number of factors i.e. \$\mathcal{O}(nk)\$ where \$n\$ is the range of numbers (1000) and \$k\$ is the number of factors to check for (2 in this problem). Consider the sum of all numbers that are a m...

 
Yeah that was way over my head... lol.
 
11:32 PM
I won't admit it often, but, yeah.
 
You won't admit something was over my head? ;-)
 
Hey, I still have stars!
 
O RLY? YA RLY (me too, surprisingly)
Now, to find @200's post to look at it in a real browser...
Huh that's pretty neat!
 
11:57 PM
I love math, but I'm not good at english.
 
0
Q: With css only, is there a better way to target these specific elements?

JClark4321This code below works as needed, but I am not sure if there is a more elegant way with pure CSS. I have a table with two columns, and 4+ rows. I'll actually upload a picture...It's the first table in grey that I am messing with. I want to select all the TDs--except for the first TD, because tha...

 
@outoftime SE has a real problem with being an English-only site. There are a lot of people who are excluded as a result of that.... but, the alternative of letting multiple languages is... worse. So, what we do, is try as hard as we can to make sure people who struggle with English get as much editing help as they want.
We understand that as a second/third/even fourth language, it can't be easy. We just sort of hope that you don't mind if edits go through that correct English usage in a way that does not upset you.
 

« first day (513 days earlier)      last day (3496 days later) »