« first day (1040 days earlier)      last day (2981 days later) » 
00:00 - 17:0017:00 - 00:00

12:00 AM
RELOAD! There are 1942 unanswered questions (93.9680% answered)
 
12:10 AM
possible answer invalidation by 200_success on question by Jake: codereview.stackexchange.com/posts/122308/revisions
 
Someone have some Linux handy and can run some Swift?
 
Since this works and you're looking for ways to improve it, this may be a a better candidate for codereview.stackexchange.com. — jfriend00 12 secs ago
In which case, I'm at the right place to get help. The guide to Code review was really helpful. Thankx for the help, holroy. — iarnold5 24 secs ago
 
1:00 AM
1
Q: Encrypted chat program in Perl

psychedelic_alexOver the last few months, I have written a pair of Perl scripts to create a UDP chat room allowing users to send messages over the internet, encrypted with 1024-bit RSA keys. This makes the messages (AFAIK) imune to MITM attacks. The scripts include a server script and a client script, and works ...

 
 
1 hour later…
2:02 AM
I'm voting to close this question as off-topic because this question belongs to codereview.stackexchange.comhar07 49 secs ago
 
2:17 AM
@Quill nice haircut and headphones in your profile pic.
 
2:34 AM
I can't judge the Java code. But this C++ code would not pass my code review. — Nicky C 28 secs ago
 
2
Q: Longest Collatz sequence in Python

james smithI came across this problem: The following iterative sequence is defined for the set of positive integers: n → n/2 (n is even) n → 3n + 1 (n is odd) Using the rule above and starting with 13, we generate the following sequence: 13 → 40 → 20 → 10 → 5 → 16 → 8 → 4 → 2 → 1 ...

 
Don't tell them I sent you, but codereview.stackexchange.com might have something to say. — Jeremy Banks just now
5
Sidenote: this question is asking about changing the behaviour of the code for the sake of an exercise. FWIW the intention behind the exercise has been made clear by the instructor. I suggest you ask them about help with the intended solution.... This is most probably out of scope for Code Review, though — Vogel612 23 secs ago
 
I think Jeremy ran to be a mod.
 
yea, now that you mention it I remember
 
0
Q: Create a while loop that repeats letters in the loop

Marlee3jacksonI am trying to get letters in the code to print out like 'aabbcc' if you typed 'abc' into the code. Right now it only prints the first letter, how do I get it to print all of the letters that are typed in? def double_the_fun(a): while i< len(a): return (a[i]*2) c = raw_input('Enter ...

 
3:11 AM
See a guide to Code Review for Stack Overflow users and Code Review's Help Center for the on-topic rules. If you have working code that you want to improve, CR is the place to go. — Mat's Mug 49 secs ago
 
@EasterlyIrk <3
 
 
1 hour later…
4:42 AM
void M(int x)
{

}

void M(ref int x)
{

}
This is legal
#TheMoreYouKnowTheMoreYouWillCry
 
why wouldn't it be?
(yes, anyone providing such an overload better have a very very very good reason to do so)
 
I see why it is allowed but at first glance it's certainly questionable
and second, third and fourth glances as well
 
4:56 AM
0
Q: Iterations with Asynchronous functions? - Node.js

mre12345I haven't really worked much with asynchronous code so I'm wondering if I am doing something wrong/something could go wrong. Right now of all the test cases that I have done, my code has worked but I'm not sure if I will get side effects or not. I won't post any of the business logic, just the ...

 
It would be pretty unfair to give to someone a blank version of this map as a 'how many states can you name?' quiz. (If you include Alaska and Hawaii, you should swap the Aleutian Islands with the Hawaiian ones.)
2
 
5:15 AM
0
Q: Using jquery & bootstrape how to add/delete/edit rows in HTML5

user56379it must have a form & table on click submit it should display on table it must have edit & delete functionality on each row

 
5:34 AM
This would be better suited for codereview.stackexchange.comuser1274820 46 secs ago
 
0
Q: Struct inside Inherited Classes

Snackies Sack/**************************************************** BASE CLASS GROUND Starting Position of Birds *****************************************************/ enum Direction { North = 0, South, East, West }; class Ground { public: Ground(); ~Ground(); void setdirection(); virtual v...

 
5:59 AM
monking @all
 
6:09 AM
monking!
@CaptainObvious ugh. how did that one live for so long!
 
6:32 AM
-1
Q: Random Forest Classification doesn't supports >7500 observations for me

DhakshaI need to know why random forest classification doesn't support morethan 7500 observations in spark. If i give morethan 7500 i am getting org.apache.spark.SparkException: Job aborted due to stage failure: Task 0 in stage 4.0 failed 1 times, most recent failure: Lost task 0.0 in stage 4.0 (TID 7, ...

 
6:48 AM
TTGTB
 
0
Q: How to change coding style when there're lots of condition?

ZanderFor example, I have 2 variables and my code needs to select call which function according to these 2 variables' values. if (v1 && v2) { function1(); } else if (v1 && !v2) { function2(); } else if (!v1 && v2) { function3(); } else { function(4); } I think the code looks not good...

 
7:29 AM
0
Q: Design Pattern - Composite Pattern in PHP

nepsdotinPls take a look at the following code and let me know if thats right, and if there are any room for improvements. Strategy Class <?php /** * Draw Strategy class */ abstract class DrawStrategy { abstract function draw(Shape $shape); } /** * This is ConsoleDraw and takes the shape object a...

 
Monking!
 
7:43 AM
0
Q: Design Pattern - Abstract Factory Pattern Implementation in PHP

nepsdotinProducts Class that are like Table Chair etc Pls review it and give your thoughts and let me know if there are any rooms for improvisation. Products.php <?php abstract class Products { } class Table extends products { public function __construct() { echo "New Table Created"...

 
7:54 AM
Suggestions are appreciated You can put this in code review. — user3437460 29 secs ago
 
8:11 AM
Use this website to ask people to review your code. codereview.stackexchange.comVincent Beltman 50 secs ago
 
0
Q: Decimal number to binary number conversion in JavaScript

st88I made this decimal to binary conversion as an exercise for myself and because it is obviously often asked during job interviews / tests. Any hints concerning possible improvements welcomed. // -- START : Testing the function -------- var display = document.querySelector('div'); var result ...

 
8:27 AM
monking @Gemtastic
@RMunroe that.. doesn't seem geographically accurate
 
possible answer invalidation by Nati on question by Nati: codereview.stackexchange.com/posts/122295/revisions
 
What's reviewin' today?
 
monking
 
hoping to see if the switch to Chrome from IE will calm down some of the CPU issues we're having with our product
I dont' think it will solve all of them but it should put the brakes on
 
8:58 AM
wow, no wonder there are issues
they're trying to put 40 users on a virtual desktop which is hosted on a server with 2 cores and 10GB of RAM
 
wat
 
O.o
 
I mean, best practice is to do that
 
Ripe zombie; open question with answers, at least one answer having score 0, no answer having score > 0: HTML Pagination Generator
 
They are struggling to put 15 users on it
But even then if I opened 15 IE tabs my PC would crap itself and it has worse specs than that
 
9:04 AM
This is a question for Code Review. — lturner 39 secs ago
If the code works, it's probably more suitable for codereview.stackexchange.comSami Kuhmonen 30 secs ago
Integer.parseInt(...) throws this exception if the text given isn't a valid number. You'll have to make a method to catch the NumberFormatException and return 0 if you do. Here is an example of that method. You can then replace Integer.parseInt(disp.getText().toString()); for tryParseInt(disp.getText().toString());Kevin Cruijssen 29 secs ago
 
9:37 AM
I think question is more appropriate for code review. — Alex Weitz 44 secs ago
I think that question is more suited for CodeReview because you do not have an actual problem you need help with, this is just an opinion based question. — MeAndSomeRandoms 19 secs ago
 
9:59 AM
0
Q: Regex for mobile number validation

David PilkingtonIn my country (South Africa) mobile numbers have 10 digits and always start with a "0" (e.g. 0821231231). But they can also have the international dialling code ("+27") replacing the "0" (e.g. +27821231231). So I have this regex ((\+27)|(^(?!\+)(0)))\d{9} Is there anyway that this can be imp...

 
Is that something new?
Monking @all
 
Yes, I saw that yesterday @Mast.
 
0
Q: what a triangle or rectangle and a circle what the radius / height and base / width and length

Danny woodfrom math import * def perimeterofRectangle(width, length): return width*2 + length*2 def areaofTriangle(width,length): return width*length/2 def perimeterofTriangle(base, height): return sqrt(base*2+height**2)+ base + height def areaofCircle(radius): return 22/7 * radius * ra...

 
@CaptainObvious Did they even try with that title?
 
@Mast monking
@CaptainObvious what a title
 
10:23 AM
So you guys know I mentioend issues with CPU earlier and IE and whatnot?
They switched to Chrome. Made a drastic improvement.
In other news, water is wet.
 
First step when helping someone complaining about 'slow internet' when they are using IE: "Have you tried a different browser?"
3
 
I'm voting to close this question as off-topic because it better fits codereview.stackexchange.comPete Kirkham 45 secs ago
Apologies I'll move this over to code review if that's a more suitable place for this — Sandman112 51 secs ago
ok sorry. didn't know there was a codereview.stackexchange.com now. — user254694 25 secs ago
@PeteKirkham Vote to close because it's too broad or opinion-based; being on-topic on Code Review isn't a valid close reason. — Mast 1 min ago
@user254694 If you're sure it works, you can post it on Code Review and delete this question. There should be a delete button on the bottom of your post. — Mast 14 secs ago
 
10:46 AM
@Mast starbaut
 
11:03 AM
I still get mad at JavaScript despite needing to use it...
secondaryOptions.splice(i, 1);, who thought this was a good way to remove elements?
 
@skiwi it's a terrible way to remove elements. That's why you use array.filter and don't use mutable operations. :)
 
possible answer invalidation by Killercam on question by Killercam: codereview.stackexchange.com/posts/122238/revisions
 
@DanPantry I might be cutting myself in my finger hand by using old-style JavaScript
 
@skiwi splice isn't "old style" (it's as old as the other functional methods)
it'sj ust the functional style is preferred
splice should only be used when you absolutely have to do a mutation of the array
 
Right now I'm copying an existing array and sometimes removing an element
 
11:14 AM
@skiwi you should use filter instead, then
that will create a new copy of the input array with the elements that filter returns falsey to removed
 
But then I can't break out of the filter anymore.. my code is a mess though
 
why would you need to break out of the filter?
what on earth are you trying to do? lol
 
lol
 
I'm too afraid to post it here, you'll kill me for it
 
nah. only if you were using jquery
 
11:17 AM
i won't kill you for writing bad code
that's what code review is for fixing
 
I'm also trying out how JavaScript exception-handling works
 
the same as pretty much every other language
 
Except it still returns a value that is [object] Object instead of showing that an exception was thrown in the console
 
stop trying to concatenate objects with other things
try {
    // your code here
}
catch (e){
    window.location = "http://stackoverflow.com/search?q=[javascript]+" + e;
}
 
if you do this
throw Foo()
and it isn't caught
Then you will get the following error in teh console (in Node)
Error
    at Error (native)
    at repl:1:7
    at REPLServer.defaultEval (repl.js:252:27)
    at bound (domain.js:287:14)
    at REPLServer.runBound [as eval] (domain.js:300:12)
    at REPLServer.<anonymous> (repl.js:417:12)
    at emitOne (events.js:82:20)
    at REPLServer.emit (events.js:169:7)
    at REPLServer.Interface._onLine (readline.js:210:10)
    at REPLServer.Interface._line (readline.js:549:8)
where Foo = Error
something similar happens in Chrome as well
if an error is uncaught it will print to the console, unless it is an error thrown within a promise handler.. or an error in a callback
 
11:21 AM
0
Q: Use Ruby variable in Style tag

Atul KhanduriIn my view, I have a CSS class in ruby variable which I'm using in style tag like below: <% style_var = '.myclass {color:red}' %> <div class="myclass">This text will be Red </div> <style type="text/css"> <%= style_var %> </style> Though it is working flawlessly, my question is: "Is it a go...

 
unhandled promise handler errors will trigger an unhandledRejection event (on window in browsers, process in Node)
 
Oh right... it shows me [object] Object as if it was the output of my function, but it's marked in red so I guess I should've figured it was an exception
 
node-style callbacks pass errors as an argument to a function instead of throwing them, so unles you explicitly throw that error it will never be caught and fail silently..
can you at least show the code where you are handling the exception?
 
this will never work, halp
 
11:24 AM
I've got it kind-of working now... I was throwing a homemade function, turns it throw new Error() also works, better
 
> I was throwing a homemade function
well there's yer problem
 
var up = new Error("vomit");
throw up;
 
though you can create custom errors quite easily
const error = new Error('custom message')
class CustomError extends Error {
  constructor() {
    super('message')
  }
}

function CustomError(message) {
  const error = new Error(message)
  Object.assign(this, error)
}
 
I was half following the MDN guide and half messing it up after that
 
all above are equivalent (I think except for the last one which might be wrong)
 
11:27 AM
if you're not writing ES6, don't feel bad about not writing like dan's style
 
> if you're not writing ES6
ಠ_ಠ
(I joke, move at a pace which is comfortable to you)
 
ok fixed my little problems, will put out on codereview. — user254694 20 secs ago
 
0
Q: Refactor method for get base uri

MegaTronHow can I improve the following code? private const string OAuthTokenUri = "oauth2/token"; private static string GetOAuthTokenUri(string uriAddress) { var uri = new Uri(uriAddress); var baseUri = uri.GetLeftPart(UriPartial.Authority); var s = new Uri(new Uri(baseUri), OAuthTokenUri); ...

0
Q: Parallel merge sort in Java

coderoddeI have rolled my own parallel merge sort and it looks like this: ParallelMergesort.java: package net.coderodde.util.sorting; import java.util.Arrays; /** * This class implements a parallel merge sort. * * @author Rodion "rodde" Efremov * @version 1.6 (Mar 9, 2016) */ public class Parall...

 
@DanPantry Splice is easier. Side effect is it's also the easiest way to mess-up.
 
You should not calculate 3 times the $(this). This solution could be improved a lot, maybe you could make a post in codereview.stackexchange.com — ANeves 1 min ago
 
11:39 AM
@Duga $(this) is cached you dingbat
 
lol
 
it's true... it's the same thing with document.getElementByXXX
 
-1
Q: Q: Simplify table highlighting

BeckLooking for feedback on how to better improve or simplify the code below. (function($) { $.fn.crosshairs = function(options) { var settings = $.extend({ heading: false, klass: "highlight", thClass: "heading-highlight", rowClass: "row-highlight", colu...

 
@ANeves your last comment could be considered as a valid one. And the rest should have to be ignored as no one here is asking to do a code review. — Rajaprabhu Aravindasamy 46 secs ago
 
12:17 PM
@CaptainObvious Is it just me or do we see an increased amount of code dumps lately?
Things I learn: icacls <folder> /grant Everyone:F is Windowsian for chmod 777 <folder>.
 
*waves @Vogel612 *
 
Monking @Vogel612
 
-1
Q: Lisp - Help in vacuum agent code

Hero1134I know I have this question in StackOverflow and was answered by Vitane Many thanks to him. However, I tried implementing his code, it returns me error that says it is not a structure of the type. Anyone willing to help me? Thanks in advance. (defun smart-traversal-vacuum-agent-with-radar-progra...

0
Q: Optimizing timeline generation

Erki M.I have a bunch of processes that are being executed on different virtual machines. All of those processes have a StartDate, EndDate and Resource properties. Resource is a specific virtual machine it was ran on. I generated the actual timeline for items and found out that all of those resources ha...

 
Thanks for the comments, I'll post the provided docs later. And yes I may post it on code review if there isn't a problem with my method — Jamie Nicholl-Shelley 55 secs ago
 
fun story @Gemtastic @Mast... I got those pings on my phone, before the chatroom had finished rendering
Monking
 
12:23 PM
Heh :)
Seems like it prioritises to let us know you're arriving :P
 
nice to see you around here @Gem btw.
 
I've learned Ruby on Rails and I'm learning swift, I'mma need all the CR I can get soon ;)
 
you sure are getting around in programming languages
 
I'm voting to close this question as off-topic because it belongs to Code Review (codereview.stackexchange.com). — gsamaras 49 secs ago
This doesn't belong on code review until he actually tests this himself and determines if it is actually correctIdos 24 secs ago
 
^ it works!
well, sometimes
 
12:26 PM
Is there no way in JS to find multiple maximal values in an array according to some filter? Googling isn't really paying off
 
multiple maximal values?
 
@CaptainObvious Broken and asking for explanation of someone else's code.
@Duga Whole thing went RBA, might be incoming.
@skiwi There's only one maximum.
 
@Mast Not if it's an array of objects like {name: "John", age: 50}
 
0
Q: Excel to json parser

IgorI just wanted to build simple converter from XLS excel file to JSON. I have predefined JSON format. All fields except of two - are just simple mapping from excel to JSON. The two fields have special format, "|" separated values which should be converted to array items. I need also geocode address...

1
Q: Insertion Sort Implementation?

navindrenI have written a code for insertion sort, I just want some feedback whether the above implementation is correct and Can we further improve it? Thanks public class InsertionSortNew { static int temp; public static void InsertionSort(int [] array){ for(int i =0;i<=array.length-...

 
@skiwi so you want to order them by a criterion and get the maximum?
 
12:31 PM
sort and filter are your friend.
 
@Vogel612 Yes
Was it too much to expect there to be an easy way? I guess?
 
For some values of easy, it might still be.
It could definitely fit in a one-liner.
I think I've written something like that before, but I can't find it.
function where(collection, source) {
  return collection.filter(function(item) {
    //check if all keys in source are present in item, if so, check if item[key] is source[key]
    for (var i in source){
      if (!(item.hasOwnProperty(i))){
        return false;
      } else {
        if (item[i] != source[i]) {
          return false;
        }
      }
    }
    return true;
  });
}
Something like that combined with a sort @skiwi ?
Most definitely not the most appropriate way, but it works.
 
12:50 PM
That could work... maybe?
I solved it old-style for now... Retrieve the maximum element in the array, then filter the array on value equals maximum
 
I've even written it without a sort once:
function largestOfFour(arr) {
  var out = [];
  for (var sub in arr)
    {
      var largest = 0;
      for (var subsub in arr[sub])
        {
          if (arr[sub][subsub] > largest)
            {
              largest = arr[sub][subsub];
            }
        }
      out.push(largest);
    }
  return out;
}
And yes, naming is hard.
3
If @DanP would see this, he'd scould :P
 
O(n^2) ouch
 
Brace styling... ouch :P
So now you fancy JS guys are around anyway... I've got another front-end question
I have a list of attributes here and I want the user to put them in order, is there any known library that does that?
 
list of attributes..? you mean an array of attributes or something?
 
To make it more challenging: The amount of attributes the user has to put in order is determined by a function
 
12:54 PM
wait, wat
 
@DanPantry GUI-side, I'm talking
 
This is some kind of drag and drop interface, am I right?
 
Think of a dropdown list, I could start with a dropdown list of 8 values as first pick, then a new dropdown list of the remaining 7 values, etc.
But I think drag and drop might be better
 
interactjs.io if drag & drop is what you are looking for
otherwise I'd need like some kind of image demo to explain
 
@DanPantry Details, details.
A filter would probably have been better.
 
12:58 PM
Consider an MMO where damage system has attributes like health, critical, defense, etc. There are 8 such attributes, and I want to calculate something which requires the user to order them based on their priority, however my algorithm determines if it wants a second priority after the first one, a third after the second, etc. etc.
 
Have you tried dropping that and using jQuery instead?
 
Ah, priority based optimization?
 
The first problem is that I don't even know how it's called what I'm making :D
It's similar to say select your top 10 favorite holiday destinations in a list where there are lots of them, if that makes sense
 
I get what you mean now
To take the holiday analogy further
you're given a list of holiday destinations and you'd pick one and put that as your top one
then you'd pick another holiday destination and put that as your second
so you end up with two lsits, one of total holiday destinations and another of your personal favourites in priority order
 
1:02 PM
Yep
Now the additional challenge is that the number of destinations you need to pick depends on the algorithm in the backend (It pretty much requests you to give one more priority because it needs more information)
However the original what you described is already mostly what I want
 
That shoudln't really be a "challenge" for the front end
The front end shouldn't care about how many inputs there are, as long as they are well defined
 
0
Q: Safe async api code

StuI'm pretty new to async/await code, and I want to ensure that the code I've written is going to be safe and not cause any deadlocks. The RestClient in the code below will be injected as a singleton dependency via an IoC within an ASP.NET MVC application, so that the access token request is made...

 
I'm kind of stuck though on finding such element, which assumes that one framework/library offers such element
 
That's a bummer... I think TFS should have an option to handle this, same way as you can keep the shelveset on the server when unshelving (by selecting the checkbox for that). I'll have to come up with a way to check in other people's work without interfering with the associated code reviews then. I think asking coworkers to create a copy of the original shelveset and then checking that in is what I'll do from now on. — julealgon 41 secs ago
 
Maybe "Sortable" is similar to what I want, if it provides callbacks to add a 1. and 2. in front of the items
Not sure if Sortable or simply creating more dropdowns as more input is required is the best way to go though
 
1:06 PM
17
A: How are the sites that appear in the "belongs on another site in the Stack Exchange network" dialog chosen?

CerbrusI've pulled the migration statistics for the last 90 days from the stats page: 4 of the top 5 migrations are represented in the current close vote dialog. The only missing like is at position 7 in the migration statistics for the last 90 days.

@Sandeep SoftRecs is in beta, and while in beta you won't get migration paths. Codereview guys are against because SO folks have repeatedly demonstrated they can't recognize a good codereview question. — Braiam 23 hours ago
 
0
Q: Command and observer pattern to build installer wizard

user1578653I've done this mainly as an exercise to understand these design patterns. I'm writing a theoretical install wizard which will allow users to select different options throughout, and have it execute them all at the end. I think the correct way to do this would be to use a mixture of Command and Ob...

0
Q: Xml python cab this be improved

Sandman112ok spent ages on this simple problem (I'm not good at XML) below code is probably self explanatory and it works, but i think this could be done a lot easier sample XML <data> <id name="ch01"> <channel>test channel 1</channel> <gpio>3</gpio> <

 
1:30 PM
Why don't you just make the user rank them all every time @skiwi?
 
It is not clear what is the question. For a code review you can try codereview.stackexchange.comElzo Valugi 9 secs ago
 
@nhgrif Because some ranking is not useful if the algorithm doesn't need extra input
 
Kaz
Always fun to read about people getting (deserved) revenge.
67
Q: How can I deal with troublesome Professional Engineer?

JessI currently manage a team of about 25 engineers and developers in a subdivision of a Canadian tech company working out of Ottawa. Things normally run smoothly, but we've had a serious problem with a senior engineer as of late. This engineer is the sole engineer on our team with his Professional ...

 
It could be a difference of ranking 3 or 4 things versus 8 things
 
You don't have to feed all 8 to the algorithm.
Or take whatever the amount the algorithm that needs the most needs
and make the user rank that many for every algorithm
The user doesn't have to know what inputs the algorithm needs, do they?
 
1:38 PM
@Sandeep SoftRecs is in beta, and while in beta you won't get migration paths. Codereview guys are against because SO folks have repeatedly demonstrated they can't recognize a good codereview question. — Braiam 24 hours ago
 
0
Q: Simple customer program in C

AlexanderI have just finished a simple C program which is basicaly composed of 3 functions: accadd(void){} which adds some customer details to a binary file void view(char file[30]){} which is supposed to let me view some of the data in a .txt file void modify(char file[30]){} which verifies if number ...

 
I rejected this for being against intent of OP and being an attempt to reply. Somebody approved it anyway. Opinions?
 
I would also reject
 
@Mast the approval comes from someone witzh 45:0:3 suggested edit stats
don't give too much about it
 
@user3437460 I tried posting in code review and they said try stack overflow. — Abdullah Nafees 59 secs ago
 
1:51 PM
You have double that amount of reviewed edits, and you know your stuff..
 
Thanks for the opinions.
 
@user3437460 that doesn't mean it's on-topic at Code Review, as Abdullah stated correctly. You're both right and wrong here... — Vogel612 8 secs ago
 
2:08 PM
user image
2
When OP disagrees with the rest of the internet.
2
Wandering around the rest of the SE network makes me realize we're doing quite a good job of keeping Code Review clean.
12
 
0
Q: callback of setTimeout function when performing synchronous actions

rewobsInside a function I'm calling playgame service, once I've obtained the needed data (gameBeingPlayed) I need to show a 3..2..1 counter and then start a game chooseGameService.playGame(gameDefinitionID) .then(function () { vm.container.gameBeingPlayed = chooseG...

0
Q: Use StringDictionary instead of Dictionary<string, string>?

Danny GoodallIn my current MVC project, I have the following code, which uses a Dictionary<string, string> Model: public Dictionary<string, string> QuestionsAndAnswers { get; set; } Controller: for (int i = 1; i <= 5; i++) { if (Session[$"Question{i}Answer"] != null) { result.QuestionsAn...

0
Q: Guidence on the use of Ninject and Constructor injection

KillercamThanks to Mat's Mug's answer on this question Guidence on the use of Ninject as IoC Container in a WinForms MVC Application I have made some progress with my architecture, however, I have further questions. Following Mat's advice I changed my Program.cs to static class Program { [STAThread]...

 
2:32 PM
Thanks Mat. All you help has been fantastic and it is people like yourself that make these sites worthwhile... — Killercam 28 secs ago
aww
best comment I've ever had after hammering a question as off-topic :)
4
@Mast I think it's because we like our site as clean as our code!
4
 
-2
Q: How to make xml file of following html type and parse through jquery and display in html?

samar 1.song1 5:00 2.song2 1:11 3.song3 1:53 4.song4 5:45 5.song5 3:01 6.song6 3:01 how to make xml file attribute for this and parse it through jquery and display it in html as shown above

0
Q: lodash - replace array objects property with other object property where id match

Below the RadarI am using lodash to perform the following code but I find it slower than I would expected when the arrays have a lot of objects. Is there a faster solution using lodash or pure javascript? var array1 = [{id: 1, value: 'value1'}, {id: 2, value: 'value2'}]; var array2 = [{id: 1, value: 'valueA'},...

 
@CaptainObvious lodash - replace titles with other titles
Also OP's issue has nothing to do with lodash and everything to do with the fact that he is experiencing slowdowns on O(mn) operations
Actually that might even be O(n^m), depending on whether or not _.find is O(n) or not, unless I misunderstand big-o notation.
 
2:57 PM
0
Q: difficult mysql query wordpress

user3514052Could you help me write a difficult query to count count posts on wordpress? The situation is this: There is an ads system on a wordpress web site and search (filtering). The home page displays a list of all categories with the number of ads in each of them. User enters in the form of city, ty...

 
Do you have working code? If so, post your question on codereview.stackexchange.comroryap 47 secs ago
 
@CaptainObvious gimmeh-teh-codez
 
> My script works, but it is very very slow.
really?
 
> I know that I need to use COUNT and postmeta.meta_key and postmeta.meta_value in my query, but it does not work
 
Does it really work if it's really slow?
 
3:07 PM
ah, yeah
 
Their query definitely doesn't do what they say it needs to do
It'd make a good Stack Overflow question though, methinks
 
Thanks for the link @roryap. I wasn't aware of the code review site - looks useful. However, this question is more of a generic issue that I come across quite freqently and wondered if there was a pattern that I could use to enforce how an interface is consumed. — Gibbonfiend just now
 
"looks useful" ...well duh
@Duga I'd be curious about reception on programmers.se
 
0
Q: How to parse xml file?

David <ul class="playlist "> <li class="col-lg-3" audiourl="song1.wav" cover="cover1.jpg" artist=" by vj"> 1.song1 <span> 5:00</span> </li> <li class="col-lg-3" audiourl="song2.wav" cover="cover2.jpg" artist=" by vj">2.song2<span> 1:11</span></li> <li class="col-lg-...

 
wtf
i'm working on a new feature. had some confusion, asked boss about it yesterday before close of play
he sent me an email back saying "no, that part isn't required, I've updated the ticket so it is clear"
i just went off what the email said and just left out the bit that wasn't required
turns out he added two additional tasks (one completely unrelated) to the ticket item and didn't mention it
...wtf?
 
3:19 PM
@captain geez, is it September already?
 
@CaptainObvious that's HTML.
 
lol
 
@DanPantry I believe "wtf" is indeed the appropriate reaction.
 
please nobody says "use a regex!"
 
@PinCrash His defense is "I expected you to look at the updated ticket" but if you saw the email context you'd see that all he was explaining was that he was removing one of the requirements because "it was just a check"
it's not even big requirements either and this would not be an issue if he had just created two new task items and assigned them to me :s
@Mat'sMug I was tempted, but I don't want to troll potential students
 
3:22 PM
@DanPantry Moving the goal posts is annoying, doubly so when you have to find out on your own that it was done without informing you
 
@PinCrash Well, he did tell me had updated the task to clarify the requirements, I guess it's just my fault that I didnt' realise he had added additional requirements because I am not a mind reader. /rant over
 
lol
 
pick battles and all that
 
@gabn88 Thank you so much for code review and suggested edit. I'm not sure, what to do. May be, I should totally remove name argument from add_api_view/remove_api_view functions and strictly require that url patterns contain name argument? Because I don't want to duplicate the functionality of django's configuration as primary storage of url names. Or should I create my own optional name storage in the HybridRouter and stick with your edit? Do you have any considerations in favour of either approach? — Bob 36 secs ago
 
@Mat'sMug Probably. Let's keep up the good work.
 
3:26 PM
0
Q: alphanumerica binary search in node.js

user254694I have some rather large arrays with hash values in them that looks like this: "ZjFhOTZjYzgtMmZhMy00YjdkLThmMDgtNjI4MjYxNTc3MGRlXw==ntyxntmzmzkw" I've done a binary search, using the node.js binary-search library, so my code looks like the following (although with c_array being read in from a fi...

 
@DanPantry You don't get updates in your whatever-system-youre-using when tickets assigned to you are updated?
 
@Mast TFS doesn't really do that, no
 
@Mast No
 
@CaptainObvious I sense somebody will suggest ternaries.
 
@Mast return x > ar2.length || ar1[x] > ar2[x]
if either of those are true, return true otherwise return false, which is what he has now
ah, bugger, it's in a for. NVM
 
3:32 PM
Does this @path variable seem redundant? That insert is its only use in the script
-- Builds the correct path for customer database name:
declare @path varchar(200) = 'C:\MESSAGES\Demographics\OPPC\' + @databasename + '\Out';
insert into vendor_details (vd_vid, vd_key, vd_value)
    values (72, 'ADTOutPath', @path);
 
@PinCrash Increased readability?
 
@databasename is declared at the top of the script and is used a few other places
 
i guess it's a bit more readable
 
That was my intention indeed
 
The German MSDN slide calls TFS "ein mächtiges Werkzeug".
Good thing I didn't have coffee around or it would've ended up on the screen.
4
 
3:35 PM
What does that translate to?
Should be "Team Foundation Server" or something like that
 
translate: ein mächtiges Werkzeug
(from German) a powerful tool
lol
 
0
Q: Cooperative multi-tasking / coroutine implementation

user5434231Here is my implementation of user-level cooperative threads in C++14, which I'm working on for a hobby project. It's not entirely finished but works pretty well so far. The target operating system is DOS (dpmi), which does not support native multi-tasking. Here is a link to the code: https://gis...

 
hahaha
 
Total F***ing S***
2
is what I would say it should translate to
To be fair, VSO is actually okay, but TFS the source control is pretty bad
 
Oh, right, I sometimes forget German to English isn't as straightforward as German to Dutch.
 
3:37 PM
Okay, I have successfully put the ball through the moved goal posts -.-
 
Does it successfully register as a goal this time?
 
I'll let you know.... as long as a situation similar to yesterday didn't happen
Yesterday a feature absolutely had to be implemented and deployed that day, so we implemented it and put it on the UAT environment to be tested by the person who requested it so it could be deployed this morning.
That feature was so urgent they forgot to test it on UAT and now it won't be rolled out until tomorrow morning instead
Luckily this is the last day we have dedicated for hotfixing features... after tomorrow it is back to regular sprints
 
possible answer invalidation by Nati on question by Nati: codereview.stackexchange.com/posts/122295/revisions
 
BTW, sorry if I complain too much. I have to vent my frustration somewhere and as frustrated as I am I worry that raising any of these frustrations in work would cause me to be viewed as melodramatic..
 
@Duga Meh, technically yes but the answer being validated isn't worth much IMO.
@DanPantry I'm not troubled by it, but if others are you could always decide to open your own room. Or vent in the Nth.
 
3:44 PM
@Mast Nth sounds like a good idea
 
You might want to consider posting this on code review. — roryap 34 secs ago
 
To the extent it's somewhat "relatable" to others and there's nothing more serious going on, I don't think it's too terribly objectionable; that said, if you feel it would be more appropriate on the Nth that's up to you
 
0
Q: Database query inside a method of a class and return data

Erdem EceI'm trying to find out what is the right approach to return db values from a class. This is what I came up with; class Category { public $result; public $errors; public function __construct( $pdo) { $this->pdo = $pdo; } public function getCategoryNames () { $sql = "SELECT ...

 
@Duga aka. How to tell someone has written crap code in a nice way
However that appears to be example / asking about a concept. opinions?
 
@roryap The code is heavily exemplified and would be a poor fit in it's current form for Code Review. It's quite a specific question, so I see no problems with keeping it on SO. — Mast 38 secs ago
 
3:47 PM
@CaptainObvious That looks surprisingly clean, at least to me
 
I guess you could it is a very clean piece of ?
 
@DanPantry ++
 
@DanPantry IMO it's a Programmers question. But I'm not going to suggest that openly on SO.
 
@DanPantry -- I was under the impression that CR wasn't necessarily for posting "here is my code, give me your feedback"...that specific improvements sought are fair game... Though maybe I need to study the help section a little better. I'm not saying it doesn't also work here... — roryap 1 min ago
 
If it works there, keep it there.
2nd rule of migrations.
1st rule being Don't. Migrate. Crap.
 
3:53 PM
@roryap Posters on Code Review are welcome to suggest areas of specific concern or interest but answerers are free to offer feedback on any and every facet of the code in question. As such, we try to discourage specific requests as a way of managing expectations. — Zak 19 secs ago
 
Hehe.. the zombie ad is showing :-)
I love community ads
 
Talking about zombies, let me pimp one:
6
Q: Multithreaded Groovy Mandelbrot

JustinSeeing as it's October, I thought I'd do the community challenge. Due to my inexperience coding in Groovy, I decided to give Groovy a go. I'm not sure how well I followed Groovy conventions, and the rendering is quite slow. It seem that the slow rendering might have to do with locking when writin...

 
Kaz
This question could also be boiled down to the much more general question - "Why do people fall for scams?", which is a question as old as the oldest fool. — Zibbobz 2 hours ago
 
@roryap So... Should I post it on code review as well / only there / not ? — Eregrith 37 secs ago
 
0
Q: Implement rate limiting by cookie ID

jcmI want to develop a simple in-memory web request rate limiting module, I am allowed to have 50 requests from each unique cookie ID every 60 seconds. I am wondering if the following code is an optimal way of implementing such functionality: class RateLimiter { private static final int MAX_R...

 
4:14 PM
@CaptainObvious I'm no Java guru, but that looks pretty neat already.
 
@Mast whenever I see if (...) { return true; } else { return false; }, I know something isn't right
 
It's perfectly readable though and not the worst of Java mistakes you can make.
 
of course
also MAX_REQUESTS isn't allowed, so you think you can make 50, but the 49th is the last one allowed
 
Classic.
 
4:26 PM
0
Q: remote access to external database in app web in c#

cmontalvoI have two webpages, first in the folder /webpageone/ and the second in the folder /webpagetwo/. In webpageone I have an administrator where I can edit info in the database, after editing info I copy the databaseone.sdf to webpagetwo for access to the info. How I can access to databaseone.sdf i...

 
@CaptainObvious No code, broken code, no clue, pick one.
 
𓀡
 
user image
2
finally I see it!
this is so cool! :)
 
If the code is working questions like this are better asked on codereview.stackexchange.comcharlietfl 37 secs ago
 
4:47 PM
0
Q: Could this implementation of permuted index in C++ be better?

MateuszI have implemented a program that produces a permuted index. Actually it is this exercise: http://stackoverflow.com/questions/4015016/what-is-a-permuted-index My first version was here: Implementing permuted index in C++ And according to one of the answers I splitted my program into two classes...

 
I just saw the Brainduck ad!
 
@Mast It's unfortunate we don't have very many people who use Groovy to review that
 
Yup.
 
> DO NOT be cute when defining operator overloads.
lol what
 
> , or to use the shift operator to write to a stream.
I can almost feel the angry eyes glaring at C++ in that article.
 
00:00 - 17:0017:00 - 00:00

« first day (1040 days earlier)      last day (2981 days later) »