« first day (599 days earlier)      last day (3716 days later) » 

20:04
0
Q: implement credit card checking in python

mcgyver5practicing test-driven development in python. So, feedback about both the tests and the code is appreciated. Using luhn algorithm and regex to check credit card numbers for validity. here are the tests: from unittest import TestCase import luhn_check class TestLuhnCheck(TestCase): def s...

300pts bounty up!
@Mat'sMug Doesn't Bruno Costa's answer work?
@Mat'sMug HOLY CARP
I have a DRY question.
There seem to be an awful lot of DRY questions around, should I make a DRY tag?
Well, if I shouldn't, just remove it.
I'm posting now.
The system will take care of it once there are no questions with the tag, so...
0
Q: DRY up some code

Hosch250In my app, I have this code to display different tutorials about OneNote. This clears and resets certain values, and updates some variables so we know which version we are working with. The main problem is it has a lot of repetition, although all comments are required. private void SwitchVersi...

0
Q: DRY up some code

Hosch250In my app, I have this code to display different tutorials about OneNote. This clears and resets certain values, and updates some variables so we know which version we are working with. The main problem is it has a lot of repetition, although all comments are required. private void SwitchVersi...

20:13
@Hosch250 is more of a meta-tag, those are generally not particularly helpful.
@janos My understanding is that bounty deductions and credits are independent of the rep cap system.
@Hosch250 that tag got burnt
@RubberDuck @Phrancis OK, no offense.
@200_success Deductions are not, but awards are.
@Hosch250 You're good, just educating you :)
20:15
OK, I like being educated.
I wasn't around then anyway, so I didn't know that.
@rolfl I'm still getting that annoying *Incorrect syntax near the keyword 'NOT'.
Incorrect syntax near the keyword 'ELSE'.*
No worries @Hosch250.
@Phrancis Link?
@RubberDuck There are no comments in my production code. They are only to provide the bigger picture of what is happening. — Hosch250 31 secs ago
@rolfl There is not a link since it won't execute
But, here it is:
WHILE @FirstDay < @LastDay BEGIN
  IF (SELECT DATEADD(DAY, 1, @FirstDay) NOT IN
      (
        SELECT
            CommentCreationDate
          , PostHistoryCreationDate
          , SuggestedEditCreationDate
          , SuggestedEditApprovalDate
          , SuggestedEditRejectionDate
          , SuggestedEditVoteCreationDate
          , VoteCreationDate
        FROM #UserActiveDays
      )
    INSERT INTO #ConsecDaysCount (DaysCount) VALUES (@ConsecDaysCounter);
    BREAK
  ELSE
    SET @ConsecDaysCounter = @ConsecDaysCounter + 1;
20:17
@RubberDuck Ohh, I meant to say all comments welcome.
You can only return one column in the select ....
In the subquery?
Wow, was just playing a racing game again after having had 6 hours of driving lessons, and hell I drive nicely... uncomparable to before I had lessons
@skiwi Learning to drive myself.
@Phrancis Yes, in the sub query
20:18
@Hosch250 Okay. Makes sense, but I wouldn't recommend adding extra comments into your code when posting here. Comments are part of the code and up for review too.
0
A: What happens to reputation earned after the 200 rep limit is exceeded?

nicaelYou stop getting rep from upvotes till tomorrow (in UTC), it just disappears. However accepts and bounties still bring you rep - they are exempt from the rep cap. Look at my rep for June 28 (two days ago).

At least I was last summer.
OMGosh this is going to be ugly
So in short, I have to do an IF statement for each column?
Personally, I wouldn't want a reveiw that told me "Quit pointing out the obvious, comments are for why not what" after adding them beofre posting.
@200_success Yes, but offering a bounty of, say 150, means you lose rep after 50
20:20
There you go again, "losing" rep. =)
So if you post a 200 bounty, you cannot gain any rep on that day?
Only from accepts, and other bounties awarded to you.
Ah ok
@RubberDuck Better now? Just left the comments explaining the types and bindings.
@Phrancis you can zero out
20:21
It's consistent. Offering a bounty does not give you an opportunity to earn more points on the day that it is offered and is thus "independent" of the rep cap system.
@rolfl Would I run into the same problem if I used IN instead of NOT IN?
@RubberDuck Leaving my comment to kill after the new year.
Yes, same problem.
@%#&
@Phrancis - think of it like......
20:23
@Hosch250 It's really cool
select * from table where price in (1, 2, 3, 10, 100);
That would be the same as saying:
@Phrancis If you post a 200 bounty, you can earn up to 200 points from upvotes for a zero balance, and possibly more if you have an answer accepted or a bounty awarded to you.
it's like Where price = 1 and price = 2 and ...
@skiwi Yeah, not doing it much now.
Basically, the rule is a max of +200 from upvotes per day.
20:24
Winter here, and I haven't driven since October.
I wish I had a real racing steer and pedals for manual shifting for gaming
@200_success OK that makes perfect sense
insert into #prices values (1), (2), (3), (10),(100)
So my parents are afraid I'll smash the car because I'm out of practice and it is slippery.
select * from table where price in (select prices from #prices)
@Hosch250 They're faking it......
20:25
@rolfl OK that makes perfect sense
THey are afraid you'll smash the car...... and using the slippery as an excuse to voice it.... ;-)
0
Q: Recommendations for a newbie to CSS & HTML

Brittany RutherfordI am getting started with web development, and been trying some HTML & CSS, and I want recommendations on my code from experts here. I want to know what standard naming conventions you use for class names, how do you layout your pages, do you use tables or divs? I have written the following code ...

You don't know MN winters.
Pretty wild here.
@Hosch250 yes I do
@Malachi You live here too?
20:26
@Hosch250 I know Canadian winters... ;p
@rolfl Oh.
MN ones are worse.
@Hosch250 until I was 15 then I moved to South Dakota
@Hosch250 You already have your license then?
@Hosch250 Are they, now? ;-)
@skiwi No, my permit.
Got it this summer.
20:27
@Hosch250 worse than Canadian Winters......
What's difference between permit and license?
Permit means I have to have an adult with a license in the front passenger seat.
@skiwi Generally, permits are much easier to get revoked. At least from my experience.
Permit is for learning.
In The Netherlands you are allowed to take driving lessons if you are 16,5 years old... Then you have a restricted license you can get when you are 17 years (you always need an experienced supervisor with you then), and a regular license once you're 18
No learning permit I guess
National average is on 53 hours of lessons before getting your license
20:30
@skiwi sometimes I wish they would do that here. some people really need to learn how to drive....lol
Ok, I must be missing something silly (again)
WHILE @FirstDay < @LastDay BEGIN
  IF (SELECT DATEADD(DAY, 1, @FirstDay) NOT IN
    (SELECT CommentCreationDate FROM #UserActiveDays) OR
    (SELECT PostHistoryCreationDate FROM #UserActiveDays) OR
    (SELECT SuggestedEditCreationDate FROM #UserActiveDays) OR
    (SELECT SuggestedEditApprovalDate FROM #UserActiveDays) OR
    (SELECT SuggestedEditRejectionDate FROM #UserActiveDays) OR
    (SELECT SuggestedEditVoteCreationDate FROM #UserActiveDays) OR
    (SELECT VoteCreationDate FROM #UserActiveDays)
> Incorrect syntax near the keyword 'NOT'.
Incorrect syntax near the keyword 'OR'.
Incorrect syntax near the keyword 'OR'.
Incorrect syntax near the keyword 'OR'.
Incorrect syntax near the keyword 'OR'.
Incorrect syntax near the keyword 'OR'.
Incorrect syntax near the keyword 'OR'.
Incorrect syntax near the keyword 'ELSE'.
@Malachi After 6 hours I'm one of those people you would not want to meet at the roads ;-)
lol
not in this or not in this or not in that. but you need a field that it's not in
Bruno's answer is ok and will earn the bounty if nothing better shows up by the time bounty is expired - I'd like to see more answers though!
@Malachi Huh?
20:34
@Phrancis There may be an error in your query
I've never had this many problems with a query. Guess @rolfl was right (again)!
0
Q: How to extract name and value from the enum?

user2809564I wrote below enum from which I need to extract the name and it's value - public enum UserEnum { TreeUser("/tree"), ParentUser("/parent"); private String value; UserEnum(String value) { this.value = value; } public String value() { return value; } } T...

Killed a zombie before any harm was done:
0
A: Recommendations for a newbie to CSS & HTML

Hosch250You have some pretty major problems in your HTML here. In the first place, you need to add a DOCTYPE to the top of your HTML file. This is the DOCTYPE for HTML5: <!DOCTYPE html> Then, you need to have enclose your main markdown in a <body>...</body> tag, and you also need a <head>, like this:

@Phrancis Where Price IN (SELECT Field FROM Table1) or Price IN (SELECT Field2 FROM Table1) ....etc
each one represents a WHERE Price = RangeOfValues statement
Ahhhhhh
20:39
Really hard to explain in chat, lol
but I think you got it now, right?
So I need to repeat (SELECT DATEADD(DAY, 1, @FirstDay) NOT IN each time then
or Declare a Variable and set it equal to that....
@Phrancis As I said, start with a union, how about:
Did SE just die briefly, or is it my internet?
@RubberDuck This is not a Clear(), it leaves the top value:
while (Data.ItemList.Count > 1)
{
    Data.ItemList.RemoveAt(1);
}
20:44
@rolfl Ahhh, you just gave me an epiphany!
That was the idea, right?
Yes, I would assume. Thanks for helping me become a better Sql-monkey ;-)
Note a few things in there, though....
the UNION is important because it is 'distinct'
Also, that reduces it all down to just one record per user per day of activity
Right
And you can probably throw out all the community and null activity to start with too
20:48
UNION ALL would query quicker at first, but slower when it looks for matches later
It would, but, note that you can just add source of 'activity' in to the union, and you'll pick them up in all subsequent code.
The real problem you have is to identify the streaks in activity....
@rolfl Not sure I understand what that means
Oh, now I do
Man you're good at this. Can you clarify what you mean by "streaks in activity"?
Let the answers come in!
^^ how do you find the longest streak without a concept of ..a streak? @Phrancis
My brother wants me to play chess with him now.
20:55
25 active bounties... never seen as many on this site!
@Mat'sMug Need to think it through, there's probably a way with some clever math....
@Mat'sMug That was the idea behind the loop/cursor. I think I can go from here, but I'll certainly post it for review if once it works!
it's beginning to look a lot like Christmas
5
@Mat'sMug CURSE YOU! Now that song is stuck in my head ;p
@Phrancis ONION ALL
2
21:10
1
Q: Computing the RPY tensor with C++/Eigen (linear algebra)

user13492I'm mostly used to writing scientific code in MATLAB / Python / Julia and my experience with C++ is very limited. I've implemented a fairly simple computation of the Rotne-Prager-Yamakawa tensor in dimensionless form using the Eigen library in C++11 (currently using the Visual Studio toolchain). ...

21:39
@Phrancis - you got me engrossed.... I am not sure whether to say thanks, or not: data.stackexchange.com/codereview/query/260693/…
@rolfl I'm not sure your result set is correct?
hehehehehehe
@Phrancis I could remind you of another song if you would like. I know a song that is very Fun! Fun! Fun!
Any differences I have are probably a result of the choice of events that constitute activity
Ok
@SimonAndréForsberg Should I be afraid?
21:43
0
Q: Making User Login System Secure with $_SESSION in PHP

Carl SmithI am hoping that someone can help me out here, I am creating a PHP web app that requires a user to login to view there data in the mysql database. I just want to know if this is a good approach and is it secure enough? I know that nothing is secure in PHP scripting but I need this fairly secure....

@Phrancis I think you know which song I'm talking about, but don't worry, I won't post it. It's not the right day for it.
Hahahah
@Phrancis - what do you consider to be 'activity'?
From the way I'm writing it now: Comment, Post, Suggest edit, Approve or Reject edit, Vote on suggested edit, Vote on a post
Not sure what SE goes by specifically
SE has the IP Log as well.
All you need to do is click a link....
21:50
Does SEDE have that? (probably not)
no
For all it's worth...
CREATE TABLE #UserActiveDays
(
    UserId INT
  , ActivityDate DATE
  , Source VARCHAR(50)
);

-- Put dates from all relevant activity tables into one column
  SELECT DISTINCT
      UserId
    , CreationDate
    , 'CommentCreation'
  INTO #UserActiveDays
  FROM Comments
  WHERE UserId = @UserId
UNION
  SELECT DISTINCT
      UserId
    , CreationDate
    , 'PostHistoryCreation'
  INTO #UserActiveDays
  FROM PostHistory
  WHERE UserId = @UserId
UNION
  SELECT DISTINCT
      OwnerUserId
    , CreationDate
Lots of copy+paste code :D
Gotta cook dinner... bbiab
> There is already an object named '#UserActiveDays' in the database.
Good gods this is difficult.
Ah I think I found the boo-boo. Gotta use INSERT INTO ... SELECT ... instead of SELECT ... INTO ...
why are you declaring functions that don't do anything and then calling them in the this.init function? — Malachi 16 mins ago
22:03
Hi, @Jamal!
I'm back on my laptop now (and am using my phone as a WiFi hotspot). :-)
Nice. I've never done that.
Did your graduation petition get accepted?
What petition?
Don't you have to submit a petition to graduate this year?
Or something?
I have to fill out an application and submit it to my department.
22:06
OK, sorry I got the names mixed.
THe post man been visiting, @Jamal?
My adviser is leaving the U :(
@rolfl Hm? I just have to fill it out online.
Damn, that's a lot of bounties. Since I see that Mug has the stockings hat, I can raise my next bounty.
I have the stockings hat too.
That is what all those bounties are for.
And in just under two hours, Mistletoe will be up.
Grrrr... Incorrect syntax near 'INT'.
CREATE TABLE #UserActiveDays
(
    UserId INT
  , ActivityDate DATE
  , Source VARCHAR(50)
);
22:08
@Phrancis Why don't you ask on SO?
This is quicker ;-)
I know, I do this too.
@Hosch250 Mistletoe? No, that's for new-year
@rolfl Oh yes, oops.
Well, maybe there is a secret one for Christmas.
I'll go ahead and pimp this since there are five answers one-away.
22:10
Oh, F me. Stupid copy&paste error
Just learned about partial in C#.
That is one lovely keyword.
@Jamal No can do with me, BTDT.
@Jamal Meaning for Nice Answer?
Yeah
They got it.
22:24
OMGosh, I'm this close to having a working query, but still having problems with the IF... ELSE... statement...
Next bounty out
I hate #defines.
0
Q: Print factorial of given input -1

ZydnarI try to print number of combinations of given count of elements. - Yes, there was such topic, but I'm very beginner of Python and I want to understand my errors. Count is true just for x=4. x=int(input('Count of elements for combinations: ')) a=x from math import factorial def everywithevery(x)...

CV everyone.
@CaptainObvious Dispose of it.
22:42
Uuuggghhhhh. Incorrect syntax near the keyword 'ELSE'.
WHILE (@FirstDay < @LastDay)
BEGIN
  IF ( SELECT DATEADD(DAY, 1, @FirstDay) ) IN (SELECT ActivityDate FROM #UserActiveDate)
    SET @ConsecDaysCounter = @ConsecDaysCounter + 1;
    SET @FirstDay = DATEADD(DAY, 1, @FirstDay);
  ELSE
    INSERT INTO #ConsecDaysCount (DaysCount) VALUES (@ConsecDaysCounter);
    SET @ConsecDaysCounter = 0;
    SET @FirstDay = DATEADD(DAY, 1, @FirstDay);
END
Either my brain is mush, or this is particularly finnicky syntax
Guess I better get on SO now
Just SLAUGHTERED a bug that made my program crash.
3
Don't you enjoy that?
@Hosch250 Nice!
@Phrancis if you have more than a single instruction in the if or else branch you need to enclose them in BEGIN/END delimiters
This question appears to be off-topic because it is asking for review of working code. Recommend migration to codereview.stackexchange.com — Adam Smith 35 mins ago
I don't even.
If (condition) begin (if-branch) end else (else-branch) end
22:50
@Mat'sMug Like IF BEGIN DO THIS; DO THAT; END; ELSE BEGIN DO THIS; DO THAT; END; END; ??
If foo = bar begin do this; do that; end else begin do this; do that; end
Thank you @Mug
(back to my wine)
Battery is running out anyway
And now the OP deleted the CR question. I was also pointed to a comment on SO that I've missed. Cross-posting is such a hassle sometimes.
Can someone sanity-check this query with their own user id to make sure I haven't lost my mind?
22:56
I don't know what I like most, writing new features, testing new features, merging new features, or killing bugs that new features bring in to various, seemingly-unrelated locations.
@RubberDuck Actually, I think we should go further. Anyone in favour of blacklisting "DRY" from question titles?
Doesn't bother me.
0
Q: Working with random integers

apsstudentHere is the assignment: For this program, there are two "parts". The first part will run the trials and determine how many caps each trial opens before finding a winning cap. Every trial (person) will be a winner. The number of caps opened by each trial is written to the file. (The output file sh...

Only, I rather liked my title before it was edited.
@CaptainObvious Off-topic
@200_success I approve
23:01
@Jamal I saw that identical question and user the other day.
I have a title to change then
But yeah DRY can die
sigh I don't know @200_success. I'm not a fan of that in general. It's frustrating to run against the title word blacklist. That might be a good one though. Might be.
Another candidate for blacklisting: "if statements"
I'm not even sure how it works with two words. Plus, "conditions" or "conditionals" can be used as substitutes, but I may not be in favor of blacklisting those two right away.
"Conditions" seems like it could definitely be legitimate.
23:05
How about DNRY?
I've never seen "DNRY" in the wild.
I suppose we'll need to put together a list.
Sure. Maybe some other day.
0
Q: 'Tis the season for gift-wrapping

200_successWhen reviewing a Graham scan convex hull algorithm implementation, I wrote the following function in an answer: giftWrap :: [Vector2] -> [Vector2] giftWrap vs = result where -- Decides whether to keep or reject vertex b. -- Vertex b is provisionally kept if a left turn occurs there; th...

Right
23:07
DNRY is the "correct" version of DRY - Do Not Repeat Yourself.
Hey apsstudent ... welcome to Code Review ... you should join us in the site chat room... The 2nd monitorrolfl ♦ 56 secs ago
I put a bounty, and it still doesn't have any attention:
14
Q: Virtual Texturing - Page Indirection Table

glampertI'm working on a Virtual Texturing library for mobile devices based on OpenGL-ES. This is the PageIndirectionTable, one of the library components I would like to have some feedback on: vt_page_indirection_table.hpp: #ifndef VTLIB_VT_PAGE_INDIRECTION_TABLE_HPP #define VTLIB_VT_PAGE_INDIRECTION_...

@rolfl I don't know if they can.
They haven't earned any rep.
THey can join, and when they do, I can give rights to talk
I have some history with them
OK, I didn't know that.
@MannyMeng Don't worry about it too much.
If no one wants the rep, that is their problem.
23:18
But the problems is that I want someone to take it.
@MannyMeng I want someone to take mine too - I worked hard (sort of) to get it.
But you can't do anything about it, so don't think about it.
That ^
That ^^
It is also why, if a second bounty is issued on a question, it has to be for more than the previous
Hm. Looks like Loki got Naruto from here.
He did, back under your rock ;-)
23:21
Well... It's actually so you don't use bounties to get yourself rep, but yeah. That too. XP
6 hours ago, by janos
@LokiAstari earned Naruto on CR, for this: http://codereview.stackexchange.com/a/74519/12390
@rolfl @Mat'sMug
0
Q: What are my highest activity streaks?

PhrancisI have written the following query to figure out activity streaks on a per-user basis. I find it... Ugly... And would love to improve it! Problems Can this be done without a loop? Is there a better way to do this than #TempTables? Bonus! If it is possible to do this for multiple users, e.g...

Was a PITA to post on the iPad, too ;D
Oh, look at that. The OP added some noise later on. But, I'm not surprised the hat came from a new user anyway.
@200_success Thanks for cleaning up accidental junk from the mobile app :)
2
Q: What are my highest activity streaks?

PhrancisI have written the following query to figure out activity streaks on a per-user basis. I find it... Ugly... And would love to improve it! Problems Can this be done without a loop? Is there a better way to do this than #TempTables? Bonus! If it is possible to do this for multiple users, e.g...

23:31
You posted that from the mobile app?
No wonder the columns are so narrow.
Hey, with a cheat, or three, it can be done.
7 mins ago, by Phrancis
Was a PITA to post on the iPad, too ;D
I suppose it's more feasible on an iPad than an iPhone.
23:33
I can't imagine from an iPhone, wow.
I posted earlier from and android phone... The code I built up in Eclipse, and mailed to myself, then copy/pasted in to the app. The rest of it was a pain, and I did another mail-to-self to get around typing in some links, etc.
Ouch
Touch surfaces certainly have their limitations
I gave up on the gif, and fixed that after posting, as well as correcting a number of newlines that the copy/paste or app inserted in to the code, creating broken syntax blocks
I'm surprised this sucker runs in ~2 seconds
(the SQL)
23:38
TTGTB, once again a Merry Christmas to all, especially all you who have the big celebration on the 25th.
0
Q: Reducing usage of redundant keyframes with animation delay

Sean AndersonI'm looking through Google Polymer's source code and I found this: /** * IMPORTANT NOTE ABOUT CSS ANIMATION PROPERTIES (keanulee): * * iOS Safari (tested on iOS 8.1) does not handle animation-delay very well - it doesn't * guarantee that the animation will start _exactly_ after that value. S...

@SimonAndréForsberg Likewise to you!!
@Jamal I tried doing so, and failed
I didn't know where to place the <!-- language: lang-none -->
@SimonAndréForsberg THanks, and to you too
@syb0rg So you spent 100 points for a hat, and you hope to get it back through pimping? =)
23:43
@200_success I like my hatz and my repz :P
5
@200_success Nice catch on the NULL checks
@syb0rg So do I.
I barely pulled ahead of my bounty today.
I need Windows 10.
Ho ho ho! Welcome to 1K @Hosch250!
5
@syb0rg Was that you, or did I just get that since I was last here?
The rep has been trickling in since two of my questions hit Hot Network Questions.
I wish it wasn't the holidays - it would be flooding in.

« first day (599 days earlier)      last day (3716 days later) »