« first day (1091 days earlier)      last day (1324 days later) » 

12:00 AM
Consider asking this on codereview.stackexchange.comHamms 12 secs ago
RELOAD! There are 2198 unanswered questions (93.4770% answered)
If you have complete, tested, working code then Stack Overflow isn't the place to be. Try codereview.stackexchange.comAdam Smith 3 mins ago
Q: Template Visitor Pattern (non-polymorphic)

prestokeysI've never done this before, but this exceptional case has prompted me to use the Visitor Pattern without its visit functions being virtual. This is because I need to use templates for the visit functions. To make up for the lack of polymorphism, variadic templates are used to generalize all th...

Excited about ES2015 modules in Node.js but sad at .mjs. A proposal to keep our beloved .js: https://github.com/dherman/defense-of-dot-js/blob/master/proposal.md https://t.co/Jke8nnN4lT
CC @DanPantry
12:17 AM
@nhgrif You should totally make a haiku about it
Abuse this handler
All your exceptions be dismissed
Have fun debugging
I would not do this. It's valuable to see changes to db/schema.rb in code review. — MattyB 1 min ago
Q: A method to check if an xy position is within a rectangular bounds.

dwjohnstonPretty straight forward, but is there a better way to do this? //??Is this the best way to do this? function isWithinBounds(obj, pos) { var oXmin, oXmax, oYmin, oYmax; if (obj.startPos.x < obj.endPos.x) { oXmin = obj.startPos.x;...

Q: Python program to combine values corresponding to same key - have a brute force attempt. Any suggestion will be appreciated

Kirthi RamanWhat the following code does is: The key field is column0: (where sometimes there could be single key, and sometimes keys separated by comma). The rest of the columns are also either single or comma separated. But based on the single key value from column0, the goal is to collect all the valu...

12:57 AM
Woot, OP changed the checkmark, and scored me a Guru badge!
2 hours later…
2:31 AM
Q: Unification with sequence variables and flexible arity functions

Rob KleffnerToday I wrote an implementation of the unification algorithm found in Temur Kutsia's 2002 paper. I didn't just do this for fun, it's related to other research I'm doing. I'm feeling more confident in my Haskell these days, and I was going to go through this code to clean it up myself but, since t...

3:13 AM
Q: PEG parser generator

orlpI wrote a Python PEG parser generator that takes a grammar as a string, and returns a parser. The parser can parse its own syntax, and is feature complete with the original PEG paper, with some additions. I'm looking for comments on the implementation itself, and the interface it uses. I also pu...

3:23 AM
Q: What wrong with my HeapSort method?

ProxyStudentI've written a generic heap sort method, which passes in an array and a comparator variable. I can't find out the reason why it's not working. When I call the heapSort method from a simple driver i created to test, it seems to run but not output anythinh import java.util.Comparator; public class...

3:37 AM
You should try posting this question to codereview.stackexchange.comprashant 24 secs ago
Q: Mangaing large amounts of images

NooBskieHere is a minified CodePen of my current setup My code orginazation is like so HTML <div class="row sec1"> <div class="col-lg-6 col-md-6 col-sm-12"> <h1>Body</h1> <div class="border-wrap clearfix"> <div class="col-lg-12 col-md-12 col-sm-12 clearfix block-1"> <ul> ...

4:06 AM
Q: WebAPI Handling fire and forget exceptions

user104164Hi I'm wanting to implement a fire and forget task from within an existing WebAPI service. The code below simply sends a log event (might be that a client has connected to the service to perform some task) to another service and if it fails should not return an error to the client. I simply want...

4:17 AM
Q: Why require() doesn't work correctly when script is called by autoloader?

stackI have a script named MakeAcatar.php which generates a avatar (something like stackoverflow's avatars) based on two parameters: size (it is size of avatar) hash (the shape and color avatar will be depends on this) Aslo I have this folder-structure: \out MakeAvatar.php \root \applicat...

4:28 AM
I would suggest this be posted # codereview.stackexchange.com instead of SO. Complete code that doesn't work as you expect it is better reviewed there. — Mikanikal 31 secs ago
@Mikanikal CodeReview is for complete code that does work, but needs feedback for better/cleaner solutions. It would be closed if OP posted it on codereview. SO is the correct site for this question. However, it's currently unclear as 'not working as expected' can mean a million different things. — Rob 31 secs ago
5:20 AM
Notepad ++ (REGEX); Invert Selection, The following 2 different codes, it works very nicely. :) now I want to combine these two different code! \bhttps?:[^)''"\s]+\.(?:jpg|jpeg|gif|png) codereview.stackexchange.com/questions/20126/… ^((?!hello).)*$ stackoverflow.com/questions/8264391/…Eren SAĞLAM 14 secs ago
I'm voting to close this question as off-topic because I feel this belongs on codereview.stackexchange.comDom 29 secs ago
5:46 AM
isn't this better suited for code-review (codereview.stackexchange.com)? — Carsten 52 secs ago
Q: memory management in C with malloc

Programmer 400I'm ccoding a custom shell program that works in the Clion debugger but the inspector valgrind reports memory corruption: dac@dac-Latitude-E7450:~/ClionProjects/shell2/openshell$ valgrind ./shell ==28152== Memcheck, a memory error detector ==28152== Copyright (C) 2002-2015, and GNU GPL'd, by...

Q: Haskell parser for the programming language Tiny

user941027102I am learning Haskell and as such am trying to create a parser for the Tiny Programming language. I think I have implemented dealing with "expressions" but am not sure if I have implemented dealing with "commands". What exactly do I have left to implement? How could I make this better/complete...

6:33 AM
@Quill +1
6:46 AM
Probably you should post this on codereview — Francesco 32 secs ago
7:00 AM
Q: How do I rewrite "x raised to the power y " using while-loop in python?[refactor]

ERJANI could not think of any better way to raise to power, except this, but how do I refactor it? I should only use while loop, not for loop, not x**y. I shall not use pow(x,y) result = 1 base = 3 counter = 1 degree = 4 while counter <= degree: result = base * result counter += 1 ...

7:37 AM
Q: 2 spaces indentation in google Docs

salamanka44To prepare an exam, I have to learn coding using google docs rather than using an IDE. It may seem idiot or impratical but the teacher really insists on that. It seems that is the same thing as Google interviews for example... So far, I really got used with using two spaces indentation (I hate u...

8:00 AM
Naruto answer; accepted non-selfie answer with 0 score: Update record with CSV
Ripe zombie; open question with answers, at least one answer having score 0, no answer having score > 0: Divide and Conquer algorithm for counting inversions
8:11 AM
Q: Concurrent resizable ring buffer Golang

Roger AlsingI'm trying to find the fastest way to enqueue and dequeue items concurrently in Go. There are some restrictions: it needs to be unbounded memory allocation should be low. multiple producers (single consumer) This is what I've come up with so far: https://github.com/rogeralsing/gam/blob/mast...

8:29 AM
This question belongs in Code Reviewtransporter_room_3 52 secs ago
Q: A reference source for primes up to 64K (for unit tests)

DarthGizkaIn order to code the tests for my number theory library (a collection of routines that proved handy for coding challenges) I needed a reference source for primes up to 2^16. I did not want to reference code in other modules to get those primes because I wanted the buck to stop right there inste...

possible answer invalidation by Anuj on question by Anuj: codereview.stackexchange.com/posts/126933/revisions
8:48 AM
Q: Find multiple keyphrases from a text

Sashant PardeshiI have keyphrases abc, xyz, pqr, mno, etc. Text - " this text contains abc and mno", want to find whether text contains keyphrase string. I am looking for efficient solution. Please find my current code below. <?php $content = " this text contains keyphrases abc and mno "; $tags = ar...

Q: Fraction class in Java

coderoddeI have this class for representing exact fractions. See what I have: Fraction.java: package net.coderodde.math; import java.util.ArrayList; import java.util.List; /** * This class implements a fraction consisting of a numerator and a denominator. * * @author Rodion "rodde" Efremov * @ver...

possible answer invalidation by Anuj on question by Anuj: codereview.stackexchange.com/posts/126933/revisions
9:04 AM
@Duga rolled back again
Q: improved HibernateDao

MercerI have this HibernateDAO.java Class: public abstract class HibernateDAO implements DAO { private static final SessionFactory sessionFactory; private static final ThreadLocal<Session> session = new ThreadLocal<Session>(); private static final ThreadLocal<Transaction> transaction = ...

9:22 AM
Q: need a simple minesweeper code in java applet?

Saher Aamiri want to make a simple minesweeper game with only nine buttons on java applet I am supposed to make it on java text pad.. I need A simple code but i don't know how to extract information from huge codes of minesweeper available on internet... (Saher)

9:38 AM
Yesterday, we got 22 more accepted answers, 27 more questions were answered, 43 more answers were posted, 186 badges were earned, 142 comments were left, 38 more questions were asked, 11 more questions were unanswered, 115 users were created, and 339 votes were created.
Our question answer accept rate went down by 0.0015%.
Our question answer rate went down by 0.0253%, and our answer accept rate went up by 0.0122%.
10:09 AM
You'd be better off asking this in Code Review. — jsheeran 48 secs ago
10:23 AM
Q: Can this piece of Java Code be refactored?

Fernando Gonzales-VigilI had a task and I completed it: The objective was to create a method with 2 arguments: 1. the number to count, and 2. how many char/numbers is the total result. Result: Let's say that "number" is 5, so it will count: 01234543210 BUT it will also add spaces to the sides to complete the 2nd requi...

@Dom Thanks for retracting your close vote. For future reference, note that this question would have been closed if it had been posted on Code Review, due to being a purely generic example. In any case, please stick to bona fide off-topic reasons on Stack Overflow when voting to close. — 200_success 23 secs ago
This might be better off on codereview.stackexchange.comFred 56 secs ago
10:58 AM
Q: playing with event-sourcing - how to avoiding boiler-plate code

CarstenI'm playing around with some ideas about how to read aggregates from events. From a high-level view I would love to have this: class Apply ev ag where apply :: ag -> ev -> ag which to define how an Event ev should change an Aggregate ag if there is an instance of this class for the pair (if...

11:38 AM
Me right now (animated gif warning)
Q: memory management in C

Programmer 400I have used malloc but I'm nearly certain that at least one can be done with string.h and strdup() int main(int argc, char *argv[]) { struct sigaction sh; sh.sa_handler = int_handler; sigemptyset(&sh.sa_mask); sh.sa_flags = 0; sigaction(SIGINT, &sh, NULL); sourceCount =...

Q: Storing and maintaining function pointers via a plugin like system

dgratI have to work with a lot of functions for a library. I encapsulated these functions into structures, e.g. DistFunction stores two function pointers and the name of this structure (which is necessary for later work with device function pointers). The structure DistFunctions basically lists all th...

@DanPantry You aren't using --force, are you?
This kind of question is more suitable for Code Review. — Ansgar Wiechers just now
This kind of question is more suitable for Code Review. — Ansgar Wiechers 28 secs ago
As the code is working, perhaps this is a better fit for Code Review. — Rad Lexus 8 secs ago
possible answer invalidation by DarthGizka on question by DarthGizka: codereview.stackexchange.com/posts/127024/revisions
12:06 PM
Q: ToDo List Program Efficiency

Michelfrancis BustillosI created a simple todo list program in C++ with the ability to store multiple lists, and add and delete list elements. I'm looking for suggestions on how to make it more efficient, obvious features/checks missing, standard compliance, etc. #include #include #include using name...

Q: playing with a simple matrix to help me learn

MarduxI'm trying to write a Python class that creates a matrix of zeros, then uses a random number generator to pick 'seats' on the matrix. It changes the zero in that seat to a one, until the matrix is all ones. Can someone critique/correct my code? (I also want the 'agent' to check its surroundings o...

@skiwi More force than Anakin Skywalker
aaannnd now Cortana is crap
12:40 PM
Q: argent for exam pls

Sara Maheri need a code of a program When the program start, the user enters one CoursesExams Line like:CoursesExams=[HUM001,Technical Writing, 28/4/2016, HallA​ ;​ CSE121,Computer Programming,3/5/2016, HallB]  and one Students Line like: Students=[12001,Ahmed Hassan, (CSE121,HUM001) ; 12002,Aly Hamed,(CSE...

@CaptainObvious lol
@skiwi I personally always preferred using -fu
12:57 PM
It really depends on what was broken and how. It it broke because of normal usage, even if it seems like "your fault" I wouldn't worry about it. For example rinsing a coffee pot causing it to crack. If on the other hand you did something stupid, like microwaved a cd player, it's time to own up. — coteyr yesterday
lol ^^
possible answer invalidation by Michelfrancis Bustillos on question by Michelfrancis Bustillos: codereview.stackexchange.com/posts/127048/revisions
Does anyone have some resources on deciding whether I want to use an ORM or not and instead write my own SQL queries?
Background: I want to start on a project that needs some simple database interaction and might involve complex queries, my experiences with ORMs on complex queries are not great and I know I can code it in SQL, why bother going through an ORM and figure out how to code those complex queries?
This question is better suited for [code review](codereview.stackexchange.com). — nickb 17 secs ago
I want to aim mostly for fast development speed as well
Swift development speed?
;) I'm like you. I'd rather write my own queries.
But I'm no expert in this area
1:12 PM
Looking further into it, it seems that having domain objects in code is a good thing, I just dislike doing complex queries via an ORM
@DanPantry @nhgrif would probably warn you you're not a Jedi.
@CaptainObvious Put the last nail in the coffin.
@skiwi My gut tells me you should use ORM for maintainability. Wasn't @Phrancis still around?
@Mast I have seen it work against me more than it should
Maybe that was because it was a bad ORM though
Sure you are - A performance review is still a review. See the tour of code review - "Ask about... The quality of your working code with regards to: Performance". — nickb 24 secs ago
1:18 PM
I cannot find the exact piece of code, but I remember having a many-to-many relationship with other tables with foreign keys and the ORM-side of it was a total mess, however in the model it all made sense
ORM done wrong can cause a lot of headaches.
But I imagine a query that selects a couple of rows from two (or more) joined tables, how would you even encapsulate that in an ORM?
@Mast ¯_(ツ)_/¯
@DanPantry Looks like his hand is cut off by a light-saber
1:36 PM
Greetings, Programs.
Q: Building tree graph from dictionary, performance issues

haldaganI'm trying to build a tree graph from dictionary. So, using the following dictionary 'and','anna','ape','apple', graph should look like this: I've tried 2 approaches: using associative array and using self-written tree/node classes. Note: original dictionary is something about 8 MB and contains...

@Donald.McLean Greetings
Lesson I have learned in the past month:
Always store dates in ISO8601 format.
Not a split Date/Time column.
I'm voting to close this question as off-topic because it is asking for a code review. With some editing it might be on-topic on this sister site. — Quentin 47 secs ago
@DanPantry lol
1:44 PM
It's very diffficult to remember to set DateTime.Kind to Utc manually in .NET
and moment(DateTime) everywhere in the app
Date and time (a.k.a., "time") is difficult enough as it is, splitting it into two things makes it doubly difficult (and also nonsensical, it's all just time)
not asking for code review. I ask in this algo which part i improve so it can be more secure — T K 28 secs ago
Aside from having a description of what your code does instead of showing us the actual code… asking for vague "improvements" is asking for a code review! — Quentin 16 secs ago
I must say, IBM Watson looks pretty incredible. ibm.com/smarterplanet/us/en/ibmwatson/developercloud/…
Yeah, ^^^ that
1:59 PM
@rolfl isn't that your team's doing?
monking btw :)
In part, yes, I have code in some of that.
But, I am not officially part of Watson.
What's more accurate for me right now is that I am building the datacenters, and control paths, that will support the massive scale that things like Watson will run at.
user image
It was wrong on the first one - it's a baboon, not a macaque.
You better go fix that bug
Have to say, for such a relatively small and low-res image, it sure does a good job
2:08 PM
My Office 365 subscription ends soon
I didn't know I had one
^^^ My desktop background ...... "Air".
Is it a bird? Is it a plane? No, it's air!
It's a birdplane!
If anyone else wants to play around here's the demo, just paste an image URL or upload an image visual-recognition-demo.mybluemix.net
Quit while you're ahead ;-)
2:12 PM
Q: Perl switch/case module

tjwrona1992I know Perl now has given and when to simulate switch/case statements, but these are still experimental and are not guaranteed to be in future versions. Also there was a Switch module for Perl that existed in older versions, but it used source filtering and was considered not very good either so...

@rolfl LMAO
The execute for macro thing is a pretty answer. Besides directly outputing the variable as suggested above, you could also store everything in an array before hand which will greatly increase run time. Of course you'll need to learn to redim the array, but if youre new I think it would be a good exercise. Check this link codereview.stackexchange.com/questions/121434/… the suggestion marked as answer if a really good example of this — Doug Coats 19 secs ago
@rolfl good grief.. only missing a "superman" match
If this code works, it belongs on Code Review. — Carcigenicate 13 secs ago
2:27 PM
LOL, is that a pigeon?
no, it's a duck. /s
@Hosch250 - it is obvious it is a duck: en.wikipedia.org/wiki/Duck_typing
In computer programming, duck typing is an application of the duck test in type safety. It requires that type checking is deferred to runtime, and is implemented by means of dynamic typing or reflection. Duck typing is concerned with establishing the suitability of an object for some purpose. With normal typing, suitability is assumed to be determined by an object's type only. In duck typing, an object's suitability is determined by the presence of certain methods and properties (with appropriate meaning), rather than the actual type of the object. The analogy to the duck test appeared in a Python...
It's a bird, it's in water, thus, it's a duck.
That's from AlchemyData News API
Watson certainly draws some interesting conclusions from analyzing such massive piles of data
With .44 score on confidence, it's OK.
> github.com/VSDiagnostics/VSDiagnostics/blob/develop/VSDiagnostics/VSDiagnostics/‌​VSDiagnostics/Diagnostics/Exceptions/ArgumentExceptionWithoutNameofOperator/Argum‌​entExceptionWithoutNameofOperatorAnalyzer.cs
Guess the name of the project
2:38 PM
Every project that runs the analyzer I just did.
Trouble is, this is legal syntax:
switch ("test")
And throw new ArgumentException(nameof("test")) is illegal.
what is the nameof("string literal")??
It converts a variable name to a string, but compile-time checks it.
So, renaming the variable will guarantee that string updates are fixed correctly.
yes, I know that. but what do you expect it to do with a string literal?
It doesn't work.
I except it to fail.
just making sure ;-)
2:48 PM
Q: Notepad ++ (REGEX); Invert Selection,

Eren SAĞLAMNotepad ++ (REGEX); Invert Selection, The following 2 different codes, it works very nicely. :) now I want to combine these two different code! \bhttps?:[^)''"\s]+.(?:jpg|jpeg|gif|png) Regex to get all image links ^((?!hello).)*$ http://stackoverflow.com/questions/8264391/notepad-inverse-reg...

Q: Argument based decorators python

LafadaI have assignment to generate argument based decorator I wrote like this. def my_decorator(*deco_args): def wrap(f): def wrapped_f(*func_args): if len(deco_args) == 1 and len(func_args) ==1: return f(func_args[0], deco_args[0]) elif len(deco_a...

3:07 PM
@CaptainObvious Go away. Closed.
Q: create only one instance with std::weak_ptr and enable_shared_from_this

GeorgeAlI need to have a specific instance which is not destroyed (short-lived singleton?) I do not know at which point of my program the class needs to be instantiated nor do I know when it needs to be destroyed. I do however know that there must only be one instance of this class. Its possible that th...

git bisect is so awesome
@DanPantry What on earth would you need that for?
tracking down the introduction of bug
took me 3 minutes to find exactly the revisiont hat caused it that is costing us a lot of money rn
3 minutes is a good time to find a bug.
Not introducing bugs is much more awesome of-course. Can't you do that instead?
3:16 PM
@Mast This is a case of someone basically forgetting to add a finally {} block
stopped the main button for all sales people from working if it failed once
So the bug wasn't added, it was a bug my omission.
Pretty much
    $scope.NextCompany = () => {
      if (!$scope.HitMeLoading) {
        $scope.HitMeLoading = true;
        if (!this.hasProspects) {

        if (!$scope.ShareData.CompanyLoading || !$scope.ShareData.EventsLoading) {
          prospectAllocationService.getNextProspectAllocation().success(function (data) {
              if (data.ReturnedAllocation && data.ReturnedAllocation.length > 0) {
                  alert($translate.instant("PROSPECTS.CHANGE") + data.ReturnedAllocation)
If prospectAllocationService errors, then HitMeLoading is never assigned to false, which prevents the entire app from working
@DanPantry All of them? I'd say it's a design flaw such a thing is even possible.
It's a pretty basic throttling mechanic, more than anything else
The idea was to prevent the button from being pressed more than once in quick sucecssion
Good idea to remove it, bad implementation
Shouldn't that be caught in the client?
3:19 PM
This is the client
So why does it lock-up all clients?
It doesn't lock up all at once
It's just the nature of the bug means that it is easy to reproduce
So nearly everyone who was able to be affected by it was
Ah, like that.
That makes more sense.
I've fixed it nwo though after tracking it down :)
@Mast If you aren't introducing bugs, you're probably not writing code :)
3:26 PM
So I should surprise my boss with a whole lot of bugs? Gotcha.
You shouldn't write them by purpose
I should go to bed, it has been a long week.
But you and I both know that you write bugs as much as the next person ^^
I don't write bugs. I write butterflies-to-be.
@DanPantry depends. if you're evaluated on the number of bugs you fix... some people have their metrics all wrong, and deserve their measures to be abused :)
3:30 PM
Q: Faster copying of images to change their PixelFormat

TheLethalCoderI have the following code below that creates a new Bitmap object the same as the original but to ensure that its 'PixelFormat is 24bppRgb. Does anyone know if there is a faster way to do this: using (Bitmap bitmap = new Bitmap(image.Width, image.Height, PixelFormat.Format24bppRgb)) { using (...

git push -fu is cathartic to write, @Vogel612
This message made me lol
> Corporate Services will be performing emergency maintenance on the Exchange server today to resolve a degraded performance condition. During the maintenance window email services will be unavailable for approximately 10 minutes.

An email will be sent after maintenance is complete.
Q: Can I stop validating email addresses now please?

Nathan CooperWriting code to validate emails is a thing I don't like. It's usually pretty pointless as there's there is actually no right solution, so it leaves me with a certain sense of existential dread. I've written some code that delegates most of the responsibility to System.Net.Mail.MailAddress. Unlik...

You're suggesting something that would be an automatic fail in any code review I'd ever do and I'm not alone here. This is a completely inappropriate use of eval. I don't know why you're fighting so hard here. Casual use of eval in situations like this is why CERT advisories are issued. Ruby had a few of these related to the YAML and XML parser modules which executed arbitrary code for reasons nobody could explain. — tadman 20 secs ago
3:47 PM
> Is this code good enough that I can ignore email addresses for the rest of my life?
Yea, that's probably not what he intended to write.
I don't blame him, though, nobody likes validating email addresses
Nope. I think it's a waste of time.
This answer fails some unit tests (find email addresses to be invalid when they aren't). Can I stop validating email addresses now please?Nathan Cooper 10 secs ago
4:18 PM
There are other stack sites more suited for questions asking for resources. Software Recommendations, Code Review, etc. — Ryios 29 secs ago
Q: Getting data with Rxjava and retrofit

DacorieSI am using rxjava with retrofit to get data from an api then filtering the data with for loop in the onNext Method. Is there anyway not to use the for loop and just use rxjava to filter or improve the code? _subscriptions.add( jamSpeakServiceApi.getAllWords() ...

@Ryios FYI, Code Review's purpose is not to provide resources, it is to review real, working code for improvements. — Phrancis 33 secs ago
I'm voting to close this question, because there is no question. — Mat's Mug 6 secs ago
4:35 PM
@Mat'sMug lol
I wrote this declaration, which works perfectly fine, but I hate that the syntax for the char type and the syntax for a specific character is the same... declare @newline char(1) = char(10);
4:57 PM
Team Foundation Slower is really struggling over VPN :|
@Phrancis So don't use TFS.
I really don't have a say in the matter, unfortunately
I've worked at a Microsoft shop once. I wouldn't do it again if I had the choice.
Feel ya. Where I work it's all Microsoft, all the time...
Only non-Microsoft thing is the Android app, which is for the most part just a bunch of Java form presenters sitting on top of a SQLite DB
@Phrancis use git-tfs
5:05 PM
Is that really a thing?
how do you think I use git in work when everyone else uses TFS?
it only works on windows, though
git tfs quick-clone <repo> will clone the repo at the most recent changeset
Can I use it for tickets in TFS or is it just for VCS?
If you don't have a more specific question; your input would better go to codereview.stackexchange.com ... — Jägermeister 17 secs ago
you can then work on it and after you're done, git tfs rcheckin
I'm not sure about creating tickets
I know you can associate changesets with tickets
(Github style commit messages)
only caveat with git tfs is that you really have to git tfs fetch and git rebase tfs/default before you deploy
because tfs won't let you check in merge commits
although if you use the rebase workflow this isn't an issue anyway
Combining Git and TFS on first sight seems to be a bad idea /random-comment
5:08 PM
it's not hard, honestly
the only caveat is that you must have a linear history
otherwise it's just like any other git remote
oh, also, your commits will be rewritten to have tfs metadata in them. sucks, but you can strip it out when you move away from tfs.
Q: Switch call functions based on the passed parameter

catlovespurpleI have something like this - depending on true or false I will call different methods in dataService. And then do some work with response. The only difference is the function I need to call. Is there any good recommendation on how to make this clean and neat? Thanks! if(true){ dataService.g...

Friday bugs
Q: Thread Safe Servlet

Waleed KhanI am working on a JSP MVC web application. I am confused about Thread-Safe Servlet concept. Following is my code, please tell me is it thread safe or not. Also, tell me the reason that why it is thread-safe or not thread-safe. JSP Code; <%@ page language="java" contentType="text/html; charset=I...

Q: Print how many times a sequence of characters appears in a string

Lúcio CardosoGiven a string, count how many times a sequence of characters (in this code, the sequence is "ei") appears until the user types '#', then print the amount. I would like to know how to improve the code. #include <stdio.h> #include <inttypes.h> int main(void) { char ch, cur_ch, last_ch; c...

Q: C header file for main.c

Programmer 400My main.c includes this header file. Please let me know how I can improve it. I did my best but I don't know much about code conventions in C (I come from Java and Python). #define _XOPEN_SOURCE 500 #ifndef OPENSHELL_OPENSHELL_H #define OPENSHELL_OPENSHELL_H #define CMD_LEN 1024 #def...

5:30 PM
Q: implementation three stack in a single array[java]

sealI have implemented three stack in a single array in Java. Any advise on object oriented design, coding structure, logical part or any sort of advise would be appreciated. public class ThreeStack { private int[] stack; private int first, last, mid; private final int midPosition; public ThreeS...

5:43 PM
monking sr.
No such thing.
I think you mean "monking jr jr"?
5:48 PM
while(true) { monking += " jr" }
golfier: for(;;)monking+=" jr";
Go away.
5:53 PM
The CR response would be to tell him there's no need to put everything on one line.
Although that's a matter of preference I guess.
I wrote such a beautiful SQL query, I wish I could share it
You could write something similar to a similar problem which isn't under NDA.
Yeah... but it's extremely specific and would be pretty uninteresting if it was made more generic
I can share a sample :D
/* Check for worker login profiles assigned 'SUPPLY EMAIL PRIMARY' or 'SUPPLY EMAIL SECONDARY' RPs */
with SupplyWorkers as (
    select distinct lprp_lpid
    where lprp_active = 'Y'
    and lprp_rpid in (select rp_id from RESPONSIBLE_POSITION where rp_desc like 'SUPPLY EMAIL%')
), CountWorkers as (
    select count(lprp_lpid) as [cnt]
    from SupplyWorkers
update #AgencySuppliesConfig set
    WorkersSetForSupplyEmails = (select [cnt] from CountWorkers);
if(select top 1 WorkersSetForSupplyEmails from #AgencySuppliesConfig) = 0
@Phrancis I'm currently working on an embedded platform and running into the same problem. Making it generic enough would make it uninteresting.
@Phrancis why are you shortening your query aliases?
why are you not using column aliases to beat the crap out of these stupid names?
6:01 PM
@Vogel612 huh?
All I'm using are actual column and table names
urk... those column names. it's basically impossible to make them into something sensible, because you don't need any of the condition columns in your result set.
[cnt] can and possibly should be [count] though
Yeah the column names are the pits, it does make a bit of sense but only after you've been exposed to it long enough to understand the method to the madness
aside from that ... it looks quite beautiful-ish
the little bits of legacy madness here and there kinda ruin it
It's the mother of all hungarian notation (ish)
well at least lprp_active = 'Y' is better than cstmact_pid = 1
6:07 PM
A table HELLO_WORLD would have a hw_id, and a table HELLO_WORLD_FOO_BAR would have a hwfb_hwid as a foreign key referencing back to HELLO_WORLD.hw_id
hmm.. it's got method.. but it's kinda redundant
It's insanely redundant
@Vogel612 That's also a problem, there's not really consistency between what one would assume would be boolean fields
Some use 1 and 0 (actual booleans/bit) and others use 'Y' and 'N'
And if you set one of those Y/N fields to another character, who knows what could happen
As long as they don't use 0 for yes and 1 for no...
access anyone?
I would venture though that any character except 'Y' probably does nothing
6:14 PM
well.. it's 0 and -1 actually
@Phrancis meh. You can check the character for both things
it's basically a 4-valued logic you got there
'Y', 'N', NULL, anything else
I was thinking that too
It's pretty bad
I think many SQL programmers are stumped by what a boolean / BIT actually is
They should be - it does not really exist.... right?
@rolfl null
AFAIK it's stored in a byte, so if your table has one bit field you're "wasting" 7 bits per record. "big deal"
Yeah, and "boolean" does not exist at all...... (or should not).
Also, "Bit" is not supported on all systems AFAIK
6:19 PM
I think MySQL and PostgreSQL have an actual boolean type (though it may also be stored in a byte), I think the bit type in TSQL is a misnomer
I mean "big deal" as in, who cares for 7 wasted bits; the field accepts 0's and 1's, and that's what semantically makes the most sense. bit it is.
@Phrancis it is a bit. if you have 3 bit fields in your table, they're still stored in the same byte
What other programming language do you know of that uses the type bit though, instead of a more verbose but far more descriptive boolean type?
right. boolean is a better abstraction. geez I should totally drop T-SQL and do MySQL instead.
if exists (select * from query_languages where name = 'T-SQL')
    drop language 'T-SQL';
use 'MySQL'; -- usually quickly followed with "use 'PHP';"
6:25 PM
@Mat'sMug here's a workaround
declare @true bit = 1;
declare @false bit = 0;
how does it work around anything?
It uses actual words, instead of numbers
I didn't say it was good, but at least it makes code read slightly better
it's not very far from declare @fourty_two int = 42;
6:27 PM
Q: Solving the precedence constrainted biknapsack

Sarah BounejmateI don't have a stong background in combinatorial optimization nor programming and I have to write some code to solve the bi knapsack (2 capacities ) with constraints of precedence.. I've been working on it for 3 months now and I can't debug it and find out why it doesn't return the right answers...

Q: Singleton manager/service classes with mockable dependencies in swift

Falco WinklerIn our swift project, there are multiple service classes that encapsulate functions, mostly network-api calls. They implement a protocol, and depend on other service classes, e.g. an authorization service or a network facade. Their instances should only exist once, hence they are designed as si...

Agreed, somewhat
Maybe though it comes down to writing queries for machines (who don't give a crap) and humans who might actually look at the code
@gleachman you'll need 20 rep to chat in the site's main chatroom; I suggest you create a CR account and post an answer, 20 rep should come pretty fast ;-)
That said I still think using 0 and 1 for booleans is bad, because those are also integers
That's mainly why I declare variables for true and false as above
that's probably not something I'd rewrite if I stumble upon in someone else's
so yeah, fine, you win :)
Q: Adjacency List Graph Implementation for search

TheInnerPartyA pointer heavy adjacency list graph implementation to do search with. Looking for any coding style / best practices suggestions, performance issues, and any other criticisms/ suggestions. // // Graph.hpp // Copyright © 2016 Leo Dastur // #ifndef Graph_hpp #define Graph_hpp #include <vector>...

6:41 PM
> So here's my code , problem is it branches ONLY on the first node ( the root)
Q: Biknapsack with precedence constraint

Sarah BounejmateI don't have a stong background in combinatorial optimization nor programming and I have to write some code to solve the bi knapsack (2 capacities ) with constraints of precedence.. I've been working on it for 3 months now and I can't debug it and find out why it doesn't return the right answers ...

declare @svName varchar(8000) = 'SOME VENDOR NAME'
So many wrong things with this
If the vendor name happens to be entered BY USERS as SOME VENDOR NAME INC. all things break
And please, trying to post the exact same question again after the first question was closed will not help you. — Simon Forsberg ♦ 11 secs ago
@rolfl You're building The Machine, aren't you?
7:11 PM
Q: Creating a custom view ios

ravi rathoreI am trying to create a custom bar button item. It works correctly in simulator but image is not appearing in simulator. It appears that i have not created the subclass correctly.Kindly help me to learn . @IBDesignable class CustomBarButtonItem : UIBarButtonItem{ @IBInspectable var backgrou...

Try codereview.stackexchange.com — j08691 53 secs ago
Q: How do I complete this Python Tennis Kata?

D437I'm trying to write the Tennis kata in python. I've written the code for a standard game, but somehow cannot figure out how to write the Deuce part. Could someone give me an algorithm or help me complete the program? It would be awesome if we can complete the program by just adding new functions ...

ohai @Gemtastic
7:29 PM
oh hai
@CaptainObvious Not our problem. VTC.
@j08691 This question would be severely off-topic at Code Review. Please read our on-topic help centre and be a bit more careful when recommending CR. — Mast 41 secs ago
This post is not nearly as entertaining as the title promised, which I guess is a good thing for the OP, but still... — Lilienthal 2 days ago
Original title: Should I turn myself in?
8:00 PM
Ripe zombie; open question with answers, at least one answer having score 0, no answer having score > 0: Queuing e-mail notifications in a background thread
8:52 PM
Q: Java Connect Four "Four in a row" detection algorithms

Smarticles101Making a connect four type game for my end of the year project in my programming class. I feel sort of if-y about the win algorithms, the code for those is below: public void checkWins(int player) { int count = 0; vertical: for(int y = 0; y<height; y++) { //System.out.print...

9:05 PM
I'm voting to close this question as off-topic because it has been cross-posted codereview.stackexchange.com/questions/126573/…Matt ♦ 18 secs ago
9:18 PM
This question could be suitable for Code Review, as long as (a) your code works as intended, (b) your code is real code, rather than example code, and (c) your code is included in the body of the question. If you wish for a peer review to improve all aspects of your code, please post it on Code Review. — Mike McCaughan 21 secs ago
9:55 PM
@Duga Is that a valid close reason?
@Mast umm... usually not, no...
@200_success maybe you want to ping Matt in the TL
Q: Find the best path amongst N random points

bilbo_pingouinFor an application with a graphical canvas, I want to generate N points. But then I want to link those points, and I want to find the best path through those points. I wanted to use a dynamic programming approach as N will be limited to a maximum of 15 points. The following program works for me ...

Q: trying to creat an array with out repeating numbers

RedBellyi'm trying to creat an array of arrays with 3 values and each array inside the array will contain values that follow this rull: Math.sqrt(Math.pow(x, 2)+Math.pow(y, 2)+Math.pow(z, 2)) = a natural number (an int) my problem is im trying to get it to not push arrays that have the same numbers in a ...

@Vogel612 I mean, I'm all for closing that question, but this is not the way to do it. Sets a bad example IMO.
@CaptainObvious Borked.
@Mast yeap. but it's probably not a good idea to start a fight with a mod from another site publicly when there's much more subtle and probably effective options
10:16 PM
Cross-posting is a good reason to close afaik
also: the contents of that website are a theme park in Belgium
Might be worth pointing him to IP law
Eh nvm. I'm sure he would've had issues by now if there were any
@JeroenVannevel I'm not a lawyer, I don't feel it's my responsibility to tell people stuff could be illegal.
Not a cop either.
Congratulations, @Tunaki, on passing 4k!
Only three flags last night.... not bad
11:28 PM
If I disagree with a status-declined, should I refrain from asking it again?
http://meta.codereview.stackexchange.com/q/5354/42401 if you are wondering
It seemed to get declined in favour for something else, which got declined.
You can ask it again if you like, there's no stopping you
just make sure you reference the older post in the question, to show you want a review or update of that policy
Makes sense, thanks.
So we're doing sqlite alongside PHP for my webtech class
Instead of actually explaining the concept of DB permissions, it's easier to just link to a .db file
class DatabaseConnection extends SQLite3 {
        function __construct(){
Q: Group By sql query

renakreI have the following database schema. My goal is to obtain a result set that lists the total badge points earned by each user. The badges might be earned in different courses. I want to include the courseid and the average score per course. Here is the JSFIDDLE: http://sqlfiddle.com/#!9/2310c/...


« first day (1091 days earlier)      last day (1324 days later) »