« first day (200 days earlier)      last day (2216 days later) » 

12:20 AM
Q: Rails 4: Get list of associated models based on field in join table

ahuthFor a Rails 4.0.0 app, I have a method in a model that creates a list of associated ActiveRecord objects, based on a field in a join table. The models are Users, Groups, and GroupUsers (the join table). Users and Groups are associated as has_many through GroupUsers. GroupUsers also has a "role" ...

12:50 AM
Has no one seen this before?

1:03 AM
@Jamal No. Although I knew it was possible to use the search feature in special ways (like that), but I didn't know exactly how and I also didn't think about it
@Jamal Seems like you found a good tool for your vacuum cleaner.
@Jamal Dang, all this time and I never clicked advanced search tips!
@retailcoder What? There's advanced search tips?
isaccepted:yes, hasaccepted:no. What is the difference of isaccepted and hasaccepted?
score:0 only search for question score :(
1:21 AM
@SimonAndréForsberg yeah, it's rather basic - I'm sure 200_success will come up with some nice queries once beta sites are on the data dump!
IsAccepted is for answers / HasAccepted is for questions :)
Yahoo! (Google! sounds weird) - I made up all the rep I paid for my bounties: rep this week = 0 :)
@retailcoder Welcome back to the light sight of the rep numbers :)
@SimonAndréForsberg Thanks! Now I just need to double that up if I want to catch up with @Malachi's score :)
@SimonAndréForsberg: @retailcoder: It appears that most of them are just plain abandoned. Only a few warranted closing and deletion.
@Jamal did you mean only a few?
@retailcoder: Yes. Fixed.
1:31 AM
@Jamal so, getting used to the dashboard?
@Jamal Whaaaaat? You can edit chat messages now? I'm jealous! Damn invisible dropdown arrow
@SimonAndréForsberg you can too (same as comments) - just use that dropdown arrow that only shows up when you hover a post :)
@retailcoder Found it!
@SimonAndréForsberg: That was my own message. :P
@Jamal Can you edit messages by others then?
1:33 AM
But, it looks like I can edit others.
@Jamal You've got my permission to try it!
@Jamal Thou has teh permission te trey it
try wat
@SimonAndréForsberg I just got a picture of us two staring at our screens thinking "he's gonna do it, watch he's gonna do it!"
Ooooh... Moderator powers at play!!
@retailcoder I think he did it!
@SimonAndréForsberg yeah he did :) chat.stackexchange.com/messages/12260041/history
(wow there's even an edit history on chat posts!)
StackExchange continues to impress me...
I don't understand this advanced search, why does "is:answer answers:1 isaccepted:no closed:no score:0" give me this question as a result? codereview.stackexchange.com/questions/15029/…
"¤/("!)(¤!!()!2£@@£€£€$£ searching for "is:answer answers:1 isaccepted:no" gives me this question among the results: codereview.stackexchange.com/questions/12958/…
Where's my data explorer? I want the data explorer! Give me data explorer! Omnomnomnom cookie monster imitation
Milestone! 100 questions with no upvoted answers in your tags:
964 questions with no answers; 1,107 questions with no upvoted answers. That's a lot of progress since the mission began.
1:50 AM
@SimonAndréForsberg nice! Indeed, the post was updated with Round 1 status earlier today :)
@retailcoder The best thing is, that even if we would remain at the same number of unanswered questions, we would still increase our percentage of answered questions!
@SimonAndréForsberg yeah I thought of that - actually the best thing is, it's decreasing despite the daily new questions :)
@retailcoder Indeed!
Sleeping time for now, new day new questions tomorrow! (and probably some old questions too)
@SimonAndréForsberg yeah get some rest soldier, tomorrow's a whole new day!
2:39 AM
@Jamal dude you're on fire! Careful with all these edits though, you're bumping quite a few questions.. mind you I've answered a couple ones you just edited so all the better if they show up at the top :)
@retailcoder: I know. I'm mostly getting the unanswered questions. I'm pretty much not editing anything else.
@Jamal I noticed, I thought "is he feeding us with easy old questions to answer?"
Does anyone remember what the unanswered count some hours ago?
@Jamal uh, define "some hours"?
@retailcoder: The last time you've recorded the number of unanswered questions (whenever that may be).
2:54 AM
Right now 957 questions without answers, 1,103 questions with no upvoted answers; last time I checked was 969 w/o/ answers and 1,113 w/o upvotes (these last numbers are on the round 1 update of the CoD meta-post... and that was like about an hour ago - damn we're good!
@retailcoder: I will tackle the big languages (Java, C#...) later on this week. There may be plenty of posts to close/remove.
@Jamal now 1,100 questions with no upvoted answers (I like round numbers... OCD)
@retailcoder: I was hoping to find some leftover spam to remove... sigh
@janoulle welcome to CR!
@Malachi you alive?
7 answers in the last 23 hours, 50pts bounty paid back; I think I'll stop talking to myself and call it a day!
3:29 AM
@retailcoder, I am here
1 hour later…
4:53 AM
@retailcoder. remind me tomorrow to take a look at that question again, the one about the interfaces. I have an idea but I think that I am way to tired and don't want to look like an idiot?
2 hours later…
6:31 AM
Q: evaluating Tonelli -Shanks algorithm

Sushma Palimarfrom math import * import itertools def bound(num): o1 = 0.22 return int(exp((0.5 + o1) * (log(num) * log(log(num))) ** 0.5)) def atkin_sieve(bound): primes = [2, 3, 5] sieve = [False] * (bound + 1) factor =int(sqrt(bound)) + 1 for i in range(1, factor): for j in...

Q: Given sum and product, find the two variables

JavaDeveloperBasically find x and y given the product = xy and sum = x + y. I would like code reviewer to optimize and clean code + help me with complexity. Looks like O(1) but while loop makes me wonder if its something different. /** * x will always be less than or equal to y. */ final class Variables {...

6 hours later…
12:42 PM
Q: Postfix evaluation using a stack

P.성미I just wrote the code to evaluate a postfix expression and would like it if someone reviews it for me, it works perfectly fine but I'm having trouble adding the character "=" at the end. public static int evalPostfix(String exp) { int res = 0; myStack list = new myStack(); int n1;...

1:02 PM
Q: Get Instance from ArrayList

iroegbuI have an ArrayList of cars - arCar I want to find a car in this array list given different parameters that the cars have, one of said parameters in RegNumber. What is the best way to achieve this. I have this presently: public Car GetCar(string RegNumber) { Car car; foreach (Car c in ar...

1:26 PM
CodeReview is now 90% answered
@Malachi take a look at that question again :)
@SimonAndréForsberg RE: "good enough" rarely satisfies me when it comes to code - well I meant good enough of a review post, given there already was an accepted answer when I got back to the question :)
@retailcoder I understand :) Your review was good enough for me to give it an upvote :)
1:42 PM
@SimonAndréForsberg thanks - say mr. Java developer, would you care to take a look at how blatantly wrong my answer is on this one:
A: First introduction to MVC

retailcoderI've only skimmed through, and all I could find is a bool stopped which I would have called bool isStopped, although stopped is a fairly unambiguous, clear name - as is the rest of this code. Oh, and maybe the 256 hard-coded into your ColorRandomizer could be a constant. Naming is crystal-clear...

@retailcoder Without having looked much at the code in the original question, I agree with you except for the proposed renaming of "stopped"
isStopped is a conventional name for a getter that returns a boolean in Java
@SimonAndréForsberg ok, but regarding MVC?
@retailcoder I totally agree. View should know about Model, not vice-versa. At least that's how I always do it.
@retailcoder I'll give you an upvote as soon as I've read the entire question
@SimonAndréForsberg I'm not begging for one, if you find something better to write, by all means do it and I will upvote it - I'm so not a Java guy!
@retailcoder The question is a Zombie, your answer is a target. I have ammunition.
@retailcoder There are many things I would have to say about this question. I think it's an example of using too much abstraction. I really think he should keep it more simple.
1:59 PM
@SimonAndréForsberg that's why I think I should stick to C# :)
@SimonAndréForsberg actually last time I worked on a MVC project was like 2 years ago, been doing windows dev ever since!
@retailcoder I'm trying to use a bit of MVC in most of my projects. I'm having multiple projects that uses Swing forms (as a window-based application) and I also have an Android-corresponding project. They use the same model (with logic and data), but different views (Can't use Swing forms for Android!). Not sure if what I do is real MVC though, but it works. And it feels clean.
Yay I'm back on page 1 of the users page :)
@retailcoder Congratulations. What users page?
@retailcoder, I need to get some work done here at work before I start looking at that again....lol
2:18 PM
"You have 5 votes left today" - WTF? Feels like the day barely just started!
Q: Developing a JavaScript library

keldarI am slowly learning to master JavaScript and particularly the art of self-executing/invoking functions. I have developed a simple JavaScript plugin and I think I have followed the correct standards. It is pretty basic in what it does, it is to store information on a oData BATCH request, which p...

2:34 PM
Daily vote limit reached; vote again in 9 hours. Yesterday it was 8 hours!
OK, no one is allowed to post any good answers for the next 9 hours, I'm out of votes! Can't @Jamal Hit a pause button or something to freeze the site for a while until I get more votes?
Q: Optimize C code

Mousa FarajallahI have the following code void Fun2() { if(X0<=A) X0=ceil(Max1*X0); else X0=Max2*(Max-X0); } I want to program it in fast manner using C99, take into account the following comments. X0, A, Max1, and Max2 are 32 bit variable and I declare them as uint64_t, While Max as...

@SimonAndréForsberg, I still have votes!!!
@Malachi Then if I find any good posts, I'll send them to you so you can upvote them. ;)
@SimonAndréForsberg, I was just thinking that before you posted it....lol
@Malachi Here's a good answer, can you upvote that for me? :) codereview.stackexchange.com/questions/33735/…
2:55 PM
I have 9 votes remaining (was careful not to bust the limit yesterday night!)
@SimonAndréForsberg It's an answer posted by @Malachi, he can't upvote himself! ...I have 8 votes remaining :)
@retailcoder I knew that :)
3:08 PM
Q: count all array[index] == index occurrences

user32385The method foo gets as a parameter a sorted list with different numbers and returns the count of all the occurrences such that: i == list[i] (where i is the index 0 <= i <= len(list)). def foo_helper(lst, start, end): if start > end: # end of recursion return 0 if lst[end] < end or l...

3:56 PM
I'm out of ammo.
@retailcoder Fall back to base!
4:23 PM
90% answered again!!! I never thought I would see the day!
@Jamal I guess your newly bought vacuum cleaner might have something to do with it
@Jamal that's nothing. We upped it by 2 percent points in like 4 days. We'll get to 95% by the time you've done your x-mas shopping!
I can now suggest synonym tags!!
4:38 PM
@Malachi Watch behind you, I'm like 3 upvotes away from catching up :)
@Malachi Gratulations! I don't even have full editing privileges yet (but if this speed keeps up....)
I can't let you catch me @retailcoder
tonight i will make sure to answer some more questions!
@SimonAndréForsberg you're on freakin' FIRE!
very nice @SimonAndréForsberg
@SimonAndréForsberg it's not up-to-date, 200_success is ahead by... 2pts :)
4:43 PM
It's almost too easy sometimes to get rep here :P
@retailcoder Oh crap! must, suggest, edits
he has only been a member for 49 days
@SimonAndréForsberg you are right up there with him, only a member for 19 days!!!
@Malachi Yeah, I know, I'm nuts... :P
Whoa, rolfl isn't bad either. 21 days, 683 rep.
Yeah CR has seen a bunch of highly valuable members join recently. At this rate we'll not only have a decent answered%, but also a bunch of hi-rep users to sustain the site - i.e. there's a chance CR could enter 2014 as a grown-up/graduated SE site!
4:54 PM
@retailcoder I hope so. We still got some work ahead of us though
@retailcoder, i posted another answer here. see what you think.
A: Constructing a Data Contract interface that can be used with Entity Framework 4.1 to ensure entity validity

MalachiHaving an Interface that only does one thing doesn't seem right to me. the way that you set up your User Class in your answer is much better than having an interface that forces you to create the User Credentials. I like that much better. I also like the new IEntityContract<TEntity> as it for...

Q: Can I check for a palindrome in a better way than this?

Rohan JamesWhat I'm basically wondering is if there's anything that is possible to improve in this C++ code: #include <cstddef> #include <string> bool is_palindromic(std::string s) { std::size_t i = 0; std::size_t j = s.length() - 1; while (i < j) { if (s[i++] != s[j--]) { ...

Q: Javascript slider module and extending it further

keviniusi created this module, and i'm wondering if i did a good job. How would an experienced javascript developer improve this simple slider module further? Like, let's say that you want to use this module on 3 sliders on the same page. This is the module var sliderTest = (function(){ /*::::::::...

5:16 PM
and are they the same?
@Malachi No, JQuery-ui is an extention to JQuery
or plugin.
ok thanks
anyone want to compare my answer to the other answers on this Javascript question? I think that my answer is better.
A: How could I do DateTime.Now.Date (from c#) in javascript?

MalachiJavaScript Date Object this code will give you the date in the format mm/dd/yyyy (at least that is what it gave me, because that is my locale convention) var today = new Date(); document.write(today.toLocaleDateString()); Note: var today = new Date(); is a Date object that has ToString Metho...

@Jamal, will you tell me if I bent the rules to make this question openable, please.
Q: How to fix slow loading images using jquery mobile and phone gap?

sharatakaI have the following jquery mobile + phonegap app. I'm finding when I load the app, the images in the separate pages load pretty slowly. Any advice on how to either fix this? <html> <head> <meta charset="utf-8" /> <meta name="format-detection" content="telephone=no" /> ...

I GOT AMMO!!! A question must have been deleted or something, because now suddenly I have one vote left!
@Malachi your answer does look prettier. Actually it's better, but I'm out of votes...
@SimonAndréForsberg what?! Is that zombie looting?
@retailcoder Yeah, unfortunately it didn't drop a shiny diamond like Jamal has, but at least it dropped something!
@Malachi I actually agree with Vedran who commented on your answer. I think the accepted answer is better than yours (for this time)
5:37 PM
@SimonAndréForsberg, what comment of his do you agree with? my code is shorter and clearer than the answer that was given, and works across a majority of browsers as shown by the Mozilla link that I gave along with the w3schools link that I gave. my code is cleaner.
@Malachi Your code gives a string, the OP wants a Date object
In the question comments, the OP wrote "@Guffa As I put in parentheses, I just use the expression without to mean the value 00:00:00 "
@Malachi: It sort of looks like it implies non-working code, so I wouldn't consider reopening right now. It doesn't seem clear if everything else works, and only a performance increase is desired.
the date object holds all of that information, but the OP wanted to return a String of the date, you view parts of the date object, in string format.
@Jamal, ok that sounds good. was the edit close to ok?
@retailcoder: I'm only focusing on questions scored 0 or lower (to save time). I have to trust that no one has upvoted too many off-topic questions.
@Malachi I don't see anywhere that he says he wants a string
5:46 PM
@Malachi: Yes, that's good.
@SimonAndréForsberg, quoted from Mozilla "Note: Note that JavaScript Date objects can only be instantiated by calling JavaScript Date as a constructor: calling it as a regular function (i.e. without the new operator) will return a string rather than a Date object; unlike other JavaScript object types, JavaScript Date objects have no literal syntax."
@Malachi But it's not called without the new operator anywhere as far as I can see in the question
Date Objects return strings. they don't return other objects. the date object is an array of string values, except for the number of milliseconds from 1 January, 1970 UTC. so to see if the object is holding a value in the correct format you have to return a string.
maybe I am looking at this the wrong way @SimonAndréForsberg
"Date Objects return strings. they don't return other objects.", I believe that's incorrect, @Malachi
A: Call of Duty - We're on a mission

retailcoderSome "memes"... A few expressions have come up recently, thought I'd share them here (feel free to add, this is CW!) Running out of ammo: when you have exhausted all 40 votes for the day. Zombie looting: when you downvoted (upvoted?) a zombie question that ends up getting deleted, and then you...

5:58 PM
the only way to achieve what the OP is asking (from assumptions one everyone's part) is to create a new DateLike object and give it a key that is the same thing as date.toLocalDateString or what the other answer says. does that make sense?
@Malachi I believe the OP is actually looking for a Date object with a year, month, and date specified, and with hour/minute/second set to zero.
Does this make the Civic Duty badge the Medal of Honor (or a lesser award)? :-)
@SimonAndréForsberg, the way that I read the question, the OP wants the String representation of the Date Object equivalent to DateTime.Now.Date is that how you read the question? does he want the object or the representation?
@Malachi, @SimonAndréForsberg reading all this back-and-forth I feel like voting to close for "unclear what you're asking" (/sarcasm)
@Malachi I believe he wants the object
@retailcoder close us or close the question? :)
6:06 PM
@SimonAndréForsberg the question!
@SimonAndréForsberg, what is he going to do with the object when he has it? he must need the String representation for some reason.
@Malachi Maybe he wants to compute stuff with it, maybe he wants to throw it in /dev/null, that's up to him :)
@SimonAndréForsberg Quoted from OP, "This will give the current date, without the TimeSpan value ('00:00:00'). In javascript I did this:"
giving the current date without the timespan value, he needed to see it, my code does "giving the current date without the timespan value" using the original Date Object
@Malachi Also quoting the OP (from comments), "@Guffa As I put in parentheses, I just use the expression without to mean the value 00:00:00"
@Malachi Besides, he's already accepted an answer and commented "I liked the idea of setting hours min and sec to 0"
@SimonAndréForsberg, I guess it is his code. good think he isn't going up against a master Coder/BS'er like me. I would win for sure.... :)
6:16 PM
@Malachi Considering his reputation vs. yours, I'm sure you would :)
@retailcoder. I added all the code from both posts (only the code in the first revision of the first post) into that sheet, and it gave me an error when I tried to run it. am I adding some code twice or something?
I will have to look at it later
@Malachi I think ToString() is using StringFormat() which is a helper function that you don't want to be copying - also looking at the revision history what you want is revision #6 I believe (some bugs were fixed, that's the last revision with a single code block)...
...and - my bad, I forgot about those - as there are procedure attributes involved you should be pasting it in Notepad and save it with a .cls extension, and then import it into the VBA IDE.
I pasted two different versions of the IsTypeSafe Function
it said something about ambigous or something like that.
now I am getting something about a variable not being set, but I have to get some work done, I will leave it up and play with it later. I need to look at all the code so I know where I need to put stuff. @retailcoder
6:48 PM
@Malachi I put the actual code into a macro-enabled Excel 2010 workbook (and tested, it works :)), I can email it to you if you want (don't post your email here, just send me an email at retailcoder [at] gmail . com)
cool. now when I get my keyboard for my laptop I can check it out. @retailcoder, my little guy spilled water on my laptop and the only thing that doesn't work is some of the keys that I need for everything including my password. I had to pull the harddrive and hook it up to my linux machine to get some files off of it
and by little guy I mean my son....lol
@Malachi lol! kids... imagine, I have TWINS!
I have two redheads, not counting their mother.
7:13 PM
I know how you feel @retailcoder
@Malachi my sympathies for your laptop - my little ones broke a 2GB external hard drive by powering on/off/on/off/on/off/on/off/on/off/....[nothing] - stupid touch power buttons!
7:26 PM
@retailcoder, that sucks. is it inside an enclosure? can you pull the actual hard drive out of the enclosure?
7:39 PM
Okay, I have cleaned up the Python questions.
7:50 PM
@Jamal that's great news! @Malachi IDK how broken it is, Windows just says it "doesn't recognize it", 2nd time it happens, my brother-in-law managed to fix it last time so it might be salvageable...
8:03 PM
it's hard to hide things from kids these days!~ @retailcoder
@Malachi they're just over a year-and-a-half old, it's only going to get worse!
I probably shouldn't star stuff like that but I have Facebook Syndrome really bad @retailcoder
@Malachi perhaps you can post a meta-question like, "Are we somehow misusing Chat?" :p
Q: Longest dna sequence that appears atleast twice (Only ONE dna string as input)

DobbyMy question is to find the longest dna sub-sequence that appears atleast twice. The input is only one DNA string. NOT TWO strings as other LCS programs. I have done my 4th program and it seems to be working and efficient (computes 10k string in 4 seconds). But I dont know if this is 100 % correc...

Q: Object inheritance

jackwilsdonI have written some example code to test object inheritance, but I'm not sure if it's really the best way for an object to inherit another's functions (like Java's extends). function Class() { console.log("Created class"); // The base class } Class.prototype.test = function() { console....

Q: How far off-Topic can we get in the Code Review General Chat Room?

Malachiwhat is off limits in chat? Pretty Simple subject for Discussion. but it might need to be discussed.

8:21 PM
Q: How far off-Topic can we get in the Code Review General Chat Room?

Malachiwhat is off limits in chat? Pretty Simple subject for Discussion. but it might need to be discussed.

8:50 PM
@StackExchange slow poke
9:27 PM
@StackExchange Sorry. I meant, @Malachi was faster :)
@Malachi heading home, will post some more answers tonight (and get that vote gun reloaded!)
@retailcoder nice I createed a chat room too
for conversations like the one I had with @SimonAndréForsberg
9:50 PM
What's that chat room for?
10:01 PM
Q: Calling multiple functions

Dan LeachI have an image upload form with which I call multiple functions before uploading the file such as checking the size, dimensions and that it is a valid image. The code works but calling the functions and dealing with the results seems quite cumbersome and complex. Is there a tidier way of struct...

@Malachi Lol! That wasn't a grudge, that was just a discussion :)
@Jamal, me and @SimonAndréForsberg had a good discussion about answers on a question earlier in this chat room. the question was
A: How could I do DateTime.Now.Date (from c#) in javascript?

MalachiJavaScript Date Object Mozilla Documentation on toLocalDateString this code will give you the date in the format mm/dd/yyyy (at least that is what it gave me, because that is my locale convention) var today = new Date(); document.write(today.toLocaleDateString()); Note: var today = new Date...

well the answer I guess
@SimonAndréForsberg: Okay. The name does sound misleading, though.

grudge match 1

5 hours ago, 58 minutes total – 42 messages, 4 users, 6 stars

Bookmarked 15 secs ago by Malachi

@Malachi Funny that the first thing I say there is "I GOT AMMO!!!", lol
10:07 PM
I posted 40% of the messages in there...lol
@Malachi I'm afraid I'll have to disagree with you again, I don't think this question should have a "Java" tag.
Q: A way to make input text sizing function more elegant?

Kris HollenbeckSo I have this jQuery function I wrote up to set the size of an input based off of its data. In this case I have already figured out the widths for each character based off of a 12px font size for Helvetica. So not super flexible or anything. But I would like to know if there is any good way to t...

@SimonAndréForsberg: I agree. That could draw in other Java reviewers, who may not be able to review that code. It may also bring up the usual Java != JavaScript.
@Jamal, @SimonAndréForsberg, I think that you both may be right. but he wants Java-like Extension, but now that I think about it, Extension is pretty much the same across the board right?
@Malachi Yeah, extending classes in Java is no different from C# or similar. It's only a syntax difference
10:26 PM
@SimonAndréForsberg, Nice answer codereview.stackexchange.com/a/35787/18427
@Malachi Thanks. Easiest clean-up I've done today. (And probably one of the more important ones)
I saw the review in the queue and was going to answer the question, and saw that you had already answered it @SimonAndréForsberg lol
@SimonAndréForsberg are you a SQL Person as well?
@Malachi I know a lot of SQL, but I think you know far more than I do in that area. I don't know so much about triggers, stored procedures, and stuff like that.
PHP code like in that question I just answered can really get out of control sometimes...
I don't know much about triggers yet, but I am getting there @SimonAndréForsberg
check this question out
Q: Query too slow - Optimization

Evan lewisI am having an issue with the following query returning results a bit too slow and I suspect I am missing something basic. My initial guess is the 'CASE' statement is taking too long to process its result on the underlying data. But it could be something in the derived tables as well. The qu...

@Malachi Will upvote when I have ammo, but I also hope he will add his own answer. Judging from the comments, he managed to simplify things a lot.
10:54 PM
Q: CSV Cleanup and better Lazy Programming Techniques in Python

AirborneI'm fairly new to Python and am going to be parsing hundreds of thousands of names eventually. What I wanted to do was take individual CSV Files, and create new CSV files with only the info I wanted. Then to take the whole lot and combine it into one Big File. This code does that, but I feel I...

11:53 PM
Q: Providing Ninject with constructor dependencies it can't resolve - more complex

SOReaderI'd like to ask how to solve this problem in more complicated world: public interface ICommunicationMedium { /* ... */ } public interface IDevice { /*...*/ } public class SomeDeviceImpl: IDevice { public SomeDeviceImpl( ICommunicationMedium medium, /* lots of dependencies */ ) { /*...*/} } ...


« first day (200 days earlier)      last day (2216 days later) »