« first day (203 days earlier)      last day (2185 days later) » 

12:00 AM
(actually I gotta go, won't be able to exhaust my votes tonight)
See y'all tomorrow! (well I know I'll be there :))
@retailcoder: You have tag wiki reviewing privileges! :D
@Jamal that's nothing, shooting for moderator tools by the end of next week :)
@retailcoder: Even better!
@retailcoder Nice question, congratulations!
@rolfl Would love to hear your opinions to my answer here:
Q: Optimize random number generator

Sionnach733I have a method that generates a 10 digit random number where each digit occurs only once. eg: 0123456789 3645720918 Is there any way this method could be optimized/improved? private static String randomize(){ Random r = new Random(); List<Integer> digits= new ArrayList<...

Yeah, thanks!
12:14 AM
@retailcoder I'll race ya to the moderator privileges!
Anyone noticed the Community bot is pinging zombies for us?
Just upvoted 3 answers from those!
@retailcoder Yeah, it's alerting us whenever there's new questions. Love that feature.
@retailcoder 3 answers from what? I've only seen one question from it recently, and that has only 2 answers.
12:38 AM
@sim I meant on the main questions page, Community is reviving some old unanswered posts every now and then.
you're talking about the SE bot :)
@sim challenge accepted!
1:20 AM
@retailcoder Realized you've got 400 rep more than me. This is gonna be hard.
@retailcoder sure, just looked at it... do you mind if I throw out a 'competing' answer ..... ;-)
@SimonAndréForsberg I mean ... competing answer>
1:47 AM
@sim depends if I can sustain this rate, ...never been as productive as this week! Add 150 to this week's progress (bounties)!
Q: Javascript velocity converter, fully chainable

papirtigerI created this out of curiosity and it has some code duplication issues and the fact that sticking .yeild() on the end of a call to a unit converter is pretty strange. How would you improve it? /** * A very special velocity converter * Designed mainly for a very natural syntax * It allows fu...

Wow meta.CR has been thoroughly gone through! Looks a bit messy though..
@rolfl Sure, go ahead. The more answers the better I think.
OK, I'm done with my revie.... I would gess that my option is 3X faster than any of the others ... ;-)
@rolfl But if you think my answer also is useful, feel free to upvote it as well :)
1:52 AM
I got a 'ding'.... so I came her!
@rolfl Nice answer you posted there. It's interesting that the 3 reviews (especially yours and mine) focus mainly on different things.
@SimonAndréForsberg ... you know what, I think you missed a critical aspect, that ...
I was about to say something similar...
I actually think it can be made even faster... I think I will 'edit' and add.
I don't think the OP is after a general solution so the generics is not really something I think helps him.
@rolfl Yeah, I was mainly focused on the structure / flexibility of the code than the performance of it.
Guys this zombie needs a better answer:
His specific request was optimization,....
1:57 AM
Q: What's wrong with my spec_helper.rb for RSpec, Capybara, FactoryGirl, Spork and Devise?

user540790Here's my spec_helper.rb Having been through hundreds of often-conflicting posts on testing with RSpec, Capybara, FactoryGirl, Spork, Guard and Devise without Cucumber, this is the spec_helper which "seems to" work. I'm bracing for it to blow up or not work like the previous attempts. Questions...

This one too:
Q: Query builder improvment

Din RevahI've got the following query builder. Some of the cases have the same piece of code (those that have a parameter). I know it's not good to duplicate code that much if at all. How would you suggest I improve this loop? for ($i = 0; $i < $len; ++$i) { switch ($conditions[$i]['condition']) { ...

@rolfl You're right. Perhaps I was doing too much work in abstracting things (I love to make flexible. Perhaps too much sometimes). Perhaps also I was reading too much into "optimized/**improved**"
@retailcoder The ruby question is all yours (I don't speak ruby). I can take a look at the PHP question though
Q: Recursive branch and bound for knapsack problem

LooftI've got the imperative styled solution working perfectly. What I'm wondering is how to make a recursive branch and bound. This is my code below, Evaluate function returns the optimistic estimate, the largest possible value for the set of items which fit into the knapsack(linear relaxation). Fo...

@retailcoder ugh, I'll take a look at that PHP question some other time. Perhaps a lot of things lie in the comment to that question.
Night folks. (How come time is always 3 am when I logout from here?)
I'm just going through some zombies, afk (phone), I'm more java than ruby.. and I don't do java so...
@SimonAndréForsberg - That's my final answer foing to bed
2:06 AM
This one had 3 unvoted answers
Q: How to structure a Javascript module better?

KosThere's this Ajax-heavy, JQuery-based site which I'm about to work on. There hasn't been much structure in the JS code so far (lots of functions at global scope, hard-coded in the HTML onclick="something(args);". I want to improve upon that and introduce some structure. How? Here's what I've tri...

@sim lol
'Night guys
2 hours later…
3:51 AM
everyone is gone
1 hour later…
5:01 AM
Q: How do I do a Scheme/Dr. Racket code to remove all a from list L?

Addie (removeAll a L) returns the list L without any occurrences of atom a. I can only use car, cdr, length, null?, and SUPER basic stuff like that to make the recursion. Anyone know how to do it? :)

5:18 AM
@rolfl, @SimonAndréForsberg, you guys went all sorts of overboard on this Java code, codereview.stackexchange.com/questions/35950/…
5:55 AM
Q: Android code optimization - AsyncTask

Abdullah FahimI have finished my first Android App, but I am getting lots of skipped frame messages from Choreographer. So, I started reading and got the impression that I should put as less calculations/works as possible in main thread, rather should use AsyncTask. To understand the thumb rule, can anybody p...

6:12 AM
@Malachi I'm still here!
(albeit not for long)
7:08 AM
posted on November 23, 2013 by 3Nex

I made an extermely simple labirinth game out of boredom, however there's a weird bug that i can't figure out why is happening. When i try to move into the obstacle, the first row of my output shifts. Also, depending on where i try to move, it can shift just 1 or more than 1 characters to the right. This is pretty weird to me considering that my showFrame() functio

2 hours later…
9:07 AM
Q: Python app-level document/record locking (eg. for MongoDB)

Yaroslav StavnichiyIntroduction MongoDB does not provide means to lock a document (like SELECT FOR UPDATE in RDBMS). There is recommended approach to Isolate Sequence of Operations, which is sometimes called optimistic locking, but there are scenarios when this approach seems to be overly complicated or even inef...

9:20 AM
Q: Optim function in R

teddypicker I want to optimize this function in R (optim function) to obtain MLE of Teta (vector of 5 unknown parameters) But I guess i need some help Thank you.

3 hours later…
12:26 PM
Q: Python len() Built.in Function, internal code

user32505I need to know how it works de len() built.in function on Python. Thanks so much to all answers.

12:40 PM
Q: best way to write series of objects to a .ser file using ObjectOutputStream and read them back

EclayazI create series of objects out of Student Class and store them in a vector. I write each object in to a .ser file once it created. Then I read them back. My code is working perfectly. What I want to know is, I do this in a correct optimized way or are there any easy and optimized ways to get this...

2 hours later…
2:59 PM
@Malachi What do you mean by "all sorts of overboard"? (sorry, not a native English speaker here)
3:57 PM
Q: Clear ArrayList

EclayazI create class level static ArrayList by the following line. static ArrayList<Student> studentList = null; Then I create and fill ArrayList with some objects inside a function. studentList = new ArrayList<Student>(); Write(student); later I want to clear all of my ArrayList elements stude...

4:33 PM
Anyone has ammo? Target in sight:
Q: script- loop through files and directories

SureshI have written the script, which unzips a zip file (passed as argument to the bash), loops through directory and files, then perform different actions based on directory or file. It is working fine. However I would like to know some things: Is it possible to do this without the unzip command? ...

@retailcoder Headshot!
4:51 PM
Q: Translate and review C# Interface and Composition into Objective-C native categories

Andyz SmithCan somebody review the semantic content in C# below and provide an equivalent, but highly native Objective-C implementation, presumably using categories or possibly protocol, or both. Can you provide a bit of discussion on why the Objective-C features are used, and what the ramifications are fo...

5:17 PM
Q: Applying a list to a function

alrzHow to make this idea work? let rec apply f args = match args with | x::xs -> apply (f x) xs | [] -> f() Is there any way to write a function to get another function of any signature as parameter (like Delegate type in C#)?

5:43 PM
Q: Windows(All) Sytem Hotkey C++

Brandon ClarkI would like to come up with the simplest best practice of making a system-wide hotkey for all versions of windows covering winnt 2000, winxp, winvista, win7, win 8 and others if possible. The intention is to have it replace the current example on MSDN. Code Example: #include "stdafx.h" Reg...

Q: Nested select Linq

ImanIs there a simpler and optimized way to calculate listAdminCorePriveleges and privileges ? public string[] GetPrivilegesForUserByPersonEntityId(int personEntityId) { var listPrivileges = new List<string>(); var listAdminCorePriveleges = (_accountRepository.AsQueryable() ...

6:24 PM
Congrats, you've gained the privilege – create tag synonyms
6:53 PM
Since I've finished cleaning questions, I'm going to clean answers (especially from questions with a lot of answers and a lot of views). I've found some non-answers already.
7:08 PM
@SimonAndréForsberg I mean that you guys went from a simple couple lines of code and tripled the amount of code. but that is kind of what the OP wanted, I was messing with you
2 hours later…
8:54 PM
Q: Best way to get rid of code repetition?

Carla DessiI currently have this bit of code, but I need to repeat it for red green and blue. Is there a way I can do it without copying and pasting the code 3 times? yellow.setOnClickListener(new View.OnClickListener() { public void onClick (View v) { switch (buttonCount) { ...

9:29 PM
Looks like the cureent mission won't need more than 3 rounds. Next level: target questions with 0-1 answers and bring the average answer count up!
Currently 1.9
Target 2.5
10:02 PM
@SimonAndréForsberg added "Headshot" to the list of "memes" :)
@retailcoder, guess what I am doing? going to the oldest answers and making sure they are edited nicely....lol
@Malachi shooting for Strunk & White?
I already have that one
I do a lot of editing
helps me to read through a question sometimes
I am about to run out of ammo for the day too.... upvoting answers that should be accepted but aren't
if anyone still has ammo, here is a very good answer.
A: Is this a sufficient way to prevent script injections and other bad stuff in strings

edorianThat one is quite simple (for me at least) since there is a very general answer :) NO There is no way you can ever really safely "repair" user input. "Please provide a list of everything you shouldn't to with a hammer" is way harder than "list all appropriate uses of a hammer". Y...

10:07 PM
@Malachi keep it up! I'll upvote your answer on IsTypeSafe() (it's become a target!) when I reload in 2 hours, and if you edit it with more meat I'll manually award you the bounty (100pts) - in its current state I just have to keep waiting for more answers...
Head shot anyone?
well it's already quite upvoted?!
I like how the other answer goes "I'm doing a copy-pasta"
I wonder what kind of sauce is good with copy-pasta
10:26 PM
Q: JavaScript Game Engine Design

RUJordanI recently gutted and redid my game code to be object oriented (before it was just functions and a mass of global variables. Before I go an make more functionality happen, I would like to take one last step backwards to make sure I have the best foundation I can before proceeding. Note: the poi...

Target in sight:
Q: Daemon code for updating blog

jvzrI have a bit of code that I use to update my blog. Basically, I send an email to a particular address, and every x minutes the daemon fetches the emails, creates the files, executes middleman and then synchronizes it all to S3. The thing is that I'm using lots of different apps to do it all, be ...

Another one:
Q: Basic graphical R code draws an ellipse instead of a circle

dataqeuerentI wrote some very basic R code. This has at least two problems. 1 - It uses a very basic imperative-programming style instead of good R style. 2 - It draws the result as an ellipse, not a circle. This effect is barely visible on RGui on Windows, but extremely visible in RStudio on Linux. [Edi...

@Malachi Yeah, improving code is often a matter of adding code :) I think I added a bit too much though :P @rolfl's answer was better on that question
@SimonAndréForsberg ... ding! Why thank you!
@Malachi That answer has 15 upvotes by now. How much should we shoot it?
I was just saying if someone wanted something to shoot at, this one is worthy
10:33 PM
@rolfl Ding!
I am working on an answer for @retailcoder
I am working on work :(
@Malachi Shot taken. Target hit.
And I am working on absolutely nothing at the moment.
@retailcoder Will there be a new mission update soon?
he said something about it earlier
@SimonAndréForsberg I just starred it, it should be at the top of the list
@retailcoder, check my Edit
10:44 PM
@Skylion Hello and welcome!
Anyone here good with regex?
@Skylion Depends on what you need.
Well, here is the story. I work up today, and at about 11:00AM I thought, why don't I work on my program for half an hour or so. And six hours of programming later, here i am. I needed to parse a bunch of URLs, but I don't know regex so I just used substring which I know is probably extremely inefficient.
@SimonAndréForsberg I'll update if no one has done so in 1.25 hours :)
10:48 PM
So parsing URLs in short order
@Skylion in Expresso there's this regex in the regex library: (?<Protocol>\w+):\/\/(?<Domain>[\w@][\w.:@]+)\/?[\w\.?=%&=\-@/$,]*
No, it wasn't suppose to hyperlink...
And that does what exactly?
@Skylion regular-expressions.info has all the information you need for learning regular expressions, and they also have a couple of examples - including URLs.
@Skylion check it out: ultrapico.com/expresso.htm
Oh, I should have mentioned. Java syntax
10:51 PM
@Skylion I would however, use substring actually. If you know the index of the first "//" and of the last "/", it should be simple to get the middle using substring
Of course.
But a lot it was in the middle.
@Skylion and to get them I believe there's string.indexOf and string.lastIndexOf
Used those to kingdom come
@Skylion Doesn't matter how much is in the middle, substring can handle it.
You just need to substring a lot though
like 3 to 4 times
Which I did
10:54 PM
@Skylion If you've already tried something, then post a question on Stack Overflow with what you have tried, what the result was, and what the desired result is.
@Skylion Once is enough, if you have the correct indexes.
Oh no no, I forgot to mention.
The urls aren't set lengths
like /fajlkfjsalkfjslkajflksf/INEEDTHIS/
You get the point
A: Revisited IsTypeSafe method implementation for "type-safe" List

Malachithis code looks very clean, it looks like it handles edge cases well. I especially like the way that if it converts to the specified data type that it does it and doesn't make you convert explicitly. that is very slick! I would definitely like to see some code that puts it into play. not mu...

@Skylion Then get new indexes.
10:55 PM
K then, will leave code as is.
Now I just need a name for my program.
@Skylion Yeah, well... good luck at that. It's said that 49% of the time, programmers are naming things.
good luck @Skylion
Thank you
11:02 PM
@Malachi nice. the resume should be remove though (it would take execution back to the error line, which would throw again, and the err handler would take execution back to the error line, which would throw again, and ..well you get the idea: infinite loop!)
and the err handler block would still run in the normal execution path so you need to Exit Function just before it - otherwise it's all good :)
I need to add Exit Function right before the Error handling part?
what about Exit sub? if I did that would it still pass the isSafe variable?
yup otherwise the function will systematically return false - the err handler is just a label that On Error jumps to; Exit Sub won't work in a Function, you need to Exit Function (yeah VB is that stupid!)
I know the difference between a sub and a function, why did I write it like that the first time.......
have a look at it now.
11:09 PM
@Malachi better, but I wouldn't resume exit function, I'd just let it exit at that point; the ExitFunction: label isn't needed then.
(also I'd add Err.Clear after the assignment in the error handler)
right, I forgot about that. otherwise it will leave the error in the log or whatever? right?
@retailcoder, ok I am not touching it again....lol
wish I knew the syntax better. I always have issues when I try to write VB code of any type.
I think so (maybe the Err object gets reset when the function returns, I'm never sure so I'd rather play it safe and call Err.Clear in all my err handlers) So your answer is essentially that the IsSafe[Type] functions are not handling errors in a way that's consistent with the error handling code in the IsTypeSafe method - and you're right! I guess I was just lazy... well sir, you've just earned yourself 100 rep points :)
thank you
@all, @Malachi's answer is an unvoted target, shoot at will!
awaiting [badge:benefactor] to kick in :)
next up: [badge:altruist] :)
Q: Inheritance in angular directive with coffeescript

standup75Here is my solution: MyFactory = -> test: -> "test" class Base @$inject: ["MyFactory"] constructor: -> return (@MyFactory) => @ restrict: "E" link: (scope, element, attr) => scope.test = @test() class MyDirective extends Base test: -> @MyFactory.test() angular.module("app", [...

11:19 PM
I have altruist but not benefactor...lol
Hmm, I just came up with a name for my program may I run it by you?
@retailcoder, now I just need 10 upvotes in like 38 minutes and I will get that one reputation badge too
Janga? sounds cool. what does the program do again?
I don't think that I caught it earlier
It's a Manga Reading App in Java.
Except it gets all the pages from scraping so no need for local storage. :)
11:24 PM
I burrowed the naming convention from Jomics, which is a Java Application for reading comic books (CBZs, CBRs, and stuff.)
I honestly wrote the hole thing because I couldn't stand how the pages on the website were slightly larger than my computer screen. :)
@retailcoder, if I get 10 votes on that answer I will get 3 badges, enlightened, nice answer, and mortarboard
@Skylion that sounds awesome.
Now I just need to have it prefetch pages.
What is the real difference between image and bufferedImage?
11:30 PM
one has extra information in it I think?
the buffered one
A: Revisited IsTypeSafe method implementation for "type-safe" List

Malachithis code looks very clean, it looks like it handles edge cases well. I especially like the way that if it converts to the specified data type that it does it and doesn't make you convert explicitly. that is very slick! I would definitely like to see some code that puts it into play. not mu...

malachi shamelessly trying to get 10 votes on this question before the switchover
@Malachi answer accepted - you only need 8.5 votes now :)
NICE I have 25 minutes
no, 23
@all our mission has been going on for 7 days now. Are we happy with the results so far?
Q: Could people look over my python text base game

user3026064Any improvements or fixes you could recommend would be great im new too python and this is just the start of my first script. I need help writing the main player class and sub classes for the races and classes I need help implementing a save feature I need help cleaning up the code #-----------...

11:42 PM
911 questions with no answers, 1,008 with no upvoted answers (less than 100 targets remaining!)
reload in 16 minutes
mission status updated
11:59 PM
Q: I'm attempting to set up my viewing frustum for culling in openGL. I custom built my matrices. Hoping someone could help em out?

Ryland GoldsteinWhat currently occurs when I run my game is that the frustum seems to be there in some capacity but just offcenter or not moving with the camera. I think it may have to do with my matrices or the way that I set up my frustum, due to the fact that I read a tutorial and cannot remember if OpenGL is...


« first day (203 days earlier)      last day (2185 days later) »