« first day (1020 days earlier)      last day (2982 days later) » 
00:00 - 21:0021:00 - 00:00

12:00 AM
RELOAD! There are 1867 unanswered questions (94.0869% answered)
 
Yay, I've hit 10k!
7
 
12:13 AM
Congratulations on hitting 10k @SirPython!
 
Thanks @Mast!
 
@SirPython congrats! now you get to see all the deleted carp! :-)
 
Thanks @Mat'sMug! That also means I can see the juicy/interesting posts.
 
12:31 AM
@SirPython Great job!
 
Thanks @Phrancis!
 
Regaining trusted users one at a time, one of the disadvantages perks of graduation!
For posterity^^
 
Thanks :)
 
@Phrancis Another addict, great ^^
 
12:49 AM
@Mast Oh yes,
 
Machine-learning at it's best:
in Beep Boop Maggot, 1 min ago, by Marky Markov
@Geobits _UNK:_UNK:_UNK:_UNK:_UNK:_UNK:_UNK:_UNK:_UNK:_UNK:_UNK:_UNK:_UNK:_UNK:_UNK:_UNK:‌​_UNK:_UNK:_UNK:_UNK:_UNK:_UNK:_UNK:_UNK:_UNK:
3
 
@Mast wtf
 
No, we don't know how he did that or why.
 
0
A: Portfolio object made of Asset classes and Securities

nhgrifI've got a problem with your SecuritiesBasketType protocol and its extension. The problem is best highlighted by taking a look at the multiple classes you've implemented to conform to this protocol. class AssetClass : SecuritiesBasketType{ var name : String = "" var securities = [Secu...

(I'm trying to get to 20k to get some of my privileges back.)
There was also this for those who missed it:
0
A: Basic ToDo App in Objective-C

nhgrifThere are a lot of things wrong here that I'm probably not mentioning at all. There is so much code that I instead want to focus on the big picture problems and the repeated problems (that you need to correct now and keep correct in the future as you write more code). weak vs strong IBOutlet...

 
@nhgrif I don't blame you, wish more people were familiar with the Apple-centric tags so you wouldn't have to pimp them, but, excellent answers as usual :)
 
1:01 AM
I should be posting code instead of building robots which are going to take over the world.
 
@Mast _UNK:
@nhgrif Is it normal that #import "Foo" statements show up as code comment formatting in posts?
 
Uhm, I think it shows the same on Stack Overflow.
 
@nhgrif There might be a bug with Prettify, unless those also show as comments in common Obj-C IDEs
 
I'm trying to model a mobility scooter with primitive building blocks, but they'll be evil scooters.
 
@Phrancis There are absolute heaps of bugs with Prettify.
 
1:05 AM
@Phrancis Yes, if you don't specify the language.
If you do specify the language, it should be fixed.
 
@Hosch250 Incidentally most of them appear to be dealing with VBA code ;D
That silly single-quote comment syntax
 
It shows up that way in Objective-C on Stack Overflow as well. It does not show up that way in Xcode.
 
I think I might have seen that bug in TSQL posts as well whenever you use #TempTable syntax
I don't think # comment is in most languages, is it? I think I've seen it with Python, Lisp, maybe... C or C++?
and I think Powershell
 
Python, PowerShell, not C/C++.
 
Prettify probably have it in their main regex for comments and might just be patching languages that don't have that
 
1:09 AM
Perl, PHP, Ruby.
In computer programming, a comment is a programmer-readable annotation in the source code of a computer program. They are added with the purpose of making the source code easier to understand, and are generally ignored by compilers and interpreters. The syntax of comments in various programming languages varies considerably. As well as of direct use to any programmer reading the source code, comments are sometimes processed in various ways to generate documentation external to the source code itself by documentation generators, or used for integration with source code management systems and other...
Looks like those five. PHP can use C-style comments too.
Python uses ''' for doc comments, as well as multi-line strings.
 
It's not a comment in C-style languages, but a directive.
However, they tend to be greyed-out by default by their IDE's and text editors even in those languages.
 
 var REGEXP_PRECEDER_PATTERN = '(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*';
I think that^^ is where the problem is
 
dafuq?
 
@Vogel612 Google Code Prettify source code
 
@Phrancis It's a regex longer than 80 characters. There's definitely a problem there.
 
1:16 AM
Oh wait, here we go, I think line 915 might be it github.com/google/code-prettify/blob/master/src/…
 
  shortcutStylePatterns.push(
      [PR_COMMENT, /^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,
       null, '#']);
}
I think import would just needed added in that beast of a regex
 
Don't forget #include
 
#if defined(LINUX)
#define WORD_DICTIONARY      "wordDIC"
#elif definded(WINDOWS)
#define WORD_DICTIONARY      ".\\wordDIC"
#else
#error "Unsupported platform"
#endif
 
But then... what if a language which uses # as comments has a comment which looks like this #import values from local file
 
1:21 AM
Parsing is hard.
 
@nhgrif SOL?
I'll post an issue on their github
 
Adding a language tag doesn't solve it?
 
May or may not, haven't tried
Even if it does, it's not a very obvious step for anyone unless they have used CR/SO for a good while
 
No. It does not.
The question for which Phrancis noticed it had the Objective-C tag...
 
This test is definitely going up for review. I'm using nested MultiAsserts :/
 
1:29 AM
@nhgrif Can you give a bit bigger screenshot? Or is that just regular Keyword + String formatting?
 
maybe later... not from that file though...
 
Roger
is the 2nd part of directive formatted the same in these two directives?
#import <UIKit/UIKit.h>
#import "ACAddTaskViewController.h"
@nhgrif nevermind I found a good screenshot of XCode
 
1:44 AM
use that screenshot
 
@nhgrif Could you include an #if in there (or some other pound/hashtag directive) for reference?
Maybe it's not necessary though
 
@nhgrif Beautiful. XCode really has gorgeous code formatting, unlike VS and especially SSMS
 
@nhgrif Ah, no, that's not what I meant. You can define the language with a construct like <!-- language:c -->, something like that.
@Phrancis You realize you can add custom skins to VS et al, right?
 
Oh yeah, I added a VS skin to SSMS months ago
But when a coworker presents a demo from their IDE, I shriek at the Courier New formatting. In fact, my team lead had a FixedSys theme until recently he got a new computer with updated SSMS
 
1:53 AM
@Mast VS doesn't let you differentiate between types that come from the framework and types that come from your project's source code. ;)
 
I loaded a VS dark theme into SSMS, and switched to the Monaco font (default for code on Mac), most people look at my screen and are like "WTF" because they are used to this:
 
2:37 AM
Post on codereview.stackexchange.com and not on stackoverflow.com — Michael 49 secs ago
 
I'm about to add an rss-feed for migrated questions...
it might get a little shakey
 
Those probably need/deserve attention, good idea.
 
@Vogel612 migrated questions end up here anyway from Captain, why bother?
 
no they don't
captain doesn't pick them up
 
2:45 AM
I am not asking a code review I am asking whether a switch statement to serve this purpose would be considered acceptable coding standards — Jay 25 secs ago
 
Ah, okay
 
3:01 AM
hmm... I think that feed doesn't work correctly :/
carp.. It seems I need to roll that back
 
Vogel612 has stopped a feed from being posted into this room
 
6 messages moved to Trash
 
@Vogel612 Would it be possible for a feed to post deleted questions?
Just curious, not asking for it.
 
can you access them on the API unauthenticated?
 
I don't think so.
 
3:04 AM
I guess not, so I daresay you can't have them posted
 
You need 10k rep, or something.
 
so I set the feed up using stack2rss.quickmediasolutions.com
interesting...
I think I may have found a way to keep tab on migrations...
I'll do some checking against the tools in the next few days and then try to add that feed properly
that said I'm off for getting the best out of the remaining 6 hours I have for sleep tonight.
Niters
 
3:24 AM
Night.
 
Good luck stopping China cyber commando zero-days if you can't stop a fucking teenager in Uzbekistan with Python and a Bitcoin wallet.
@Hosch250 the feed can do it already if they're deleted before captain posts, but I don't think there's an RSS feed for deleted questions
 
@Quill "Use Oxford commas" LOL.
 
0
Q: Printing binary trees

ElogentAfter writing this answer, I was inspired to try to design a more elegant solution to the problem of printing binary trees. And what better tool with which to seek elegance than Clojure? The solution I ended up with involved creating, merging, and printing what I'm going to call sparse strings. ...

 
@Hosch250 huh?
Oh
 
 
1 hour later…
4:58 AM
0
Q: Approach to parse producing AST

OrientUsing Boost.Spirit I decide, that using BOOST_FUSION_ADAPT_STRUCT is shomewhat redundant. It can be avoided using of deducing of result type in conversion operator: #include <type_traits> #include <utility> #include <sstream> template< typename Iterator, typename Sentinel = Iterator > struct p...

 
0
Q: Simple PIN Locker in Python

gtalaricoI am fairly new to Python but I have been improving, and I wanted to try writing a simple program that simulates locker with multiple chambers(4) for storing "objects". I recently used lockers at a theme park with a similar functionality. A chamber can be reserved by simply typing a unique PIN. ...

 
Night.
 
6:21 AM
0
Q: SPOJ - Prime Generator Solution: What is wrong with this code?

hishighnessAfter submitting, run time error - SIGSEGV is being shown, even after using malloc. #include <stdio.h> #include <stdlib.h> int main(void) { int n; int i,j,a,b; scanf("%d", &n); while(n){ scanf("%d %d", &a, &b); int *z= malloc(sizeof(int)*(b-1)); // Fillin...

 
6:40 AM
0
Q: Check if a string has 20 numbers in a row in it

OwenMy code will check if the variable myString has 20 running numbers. I'm new to JavaScript and I'm wondering if there is a simpler way to do this. How can I shorten my code and possibly make it more efficient? var myString = "tuxwuhkocx14789470019215498263ljmgwsxvne"; var runningNumbers = 0; for...

 
6:53 AM
0
Q: FizzBuzzWoof in F# - can I get rid of this mutable?

rmunnI'm learning F#, and have challenged myself to write a good functional implementation of FizzBuzzWoof. (The difference from "standard" FizzBuzz is that any number that either is divisible by or contains the appropriate number must be replaced by the appropriate string of text: 3 = Fizz, 5 = Buzz,...

0
Q: Looking for an ideal solution for date of birth clone in to one with momentjs

Muhammed AthimannilThere are two methods I am using here for merging day, month and year. First one $scope.firstOption = moment(new Date($scope.register.db.day + ' ' + $scope.register.db.month + ' ' + $scope.register.db.year)); Second One $scope.secondOption = moment($scope.register.db.day + $scope.register....

 
This may be more suited in Code Review, I think. — Ian 10 secs ago
 
7:20 AM
monking @all
 
Upvoted for the basic question. Hope you will get more attention. Actually, I think, there might be couple of reasons why your question receives less attention despite your +150 bounty. (1) Not many people using Workflow, (2) You are asking for Best Solution which might be more suited question for Code Review rather than Stack Overflow, (3) This is rather minor, but your test code is pretty long without meaningful explanation (which is ok if people can really duplicate your issue directly from it, but otherwise will discourage the code reading). Hope you get your answer though... — Ian 48 secs ago
Upvoted. The question itself seems to be good, but not sure if you could get answer which really suit you. It is rather hard to imagine your situation and pin point the exact problem IMHO. This is because you say that your code works except for the delay. Perhaps you can consider to post this in the Code Review? — Ian 41 secs ago
 
8:00 AM
This is more the question for programmers.stackexchange.com. If you have any specific code that you are not happy with, you can post it on codereview.stackexchange.com. Some commercial companies offer training through code reviews as well for a small fee. — BroiSatse 16 secs ago
 
0
Q: Small PHP CMS base

Dave XI am a bit worried about this small PHP base as it has been running a bit slow. Can anyone notice anything majorly wrong with it? root/Index.php: define('START', microtime(true)); define('RAM', memory_get_usage(true)); define('ROOT', dirname(__FILE__) . '/'); define("SECURE", true); ini_set('d...

 
8:36 AM
If it is a working code, you should post your question on codereview.stackoverflow.net — phaberest 26 secs ago
 
@CaptainObvious @Jamal I'm not convinced that a deprecation warning makes the code sufficiently broken to justify moderator closure. I've reopened it to let the community decide.
 
Monking
 
@gurvinder372 Golfing is explicitly off-topic on Code Review. Please read the Help Center before making such suggestions. — 200_success 1 min ago
 
8:52 AM
0
Q: Code optimization for Java

Marek DerdzinskiHello friends i want to know how i can improve this code because now is a little bit ugly. I try to be polite for my colleagues in work. Someone can help me? I'm working with Apache POI framework. FileOutputStream fos = new FileOutputStream(outputFile); Workbook work...

 
I am so, so done with Angular. Introducing breaking changes in a minor version change is stupid
 
Isn't this more appropriate for codereview.stackexchange.com? — EdChum 18 secs ago
 
Ripe zombie; open question with answers, at least one answer having score 0, no answer having score > 0: String merge sort in Java
 
9:08 AM
0
Q: Reduce Time Complexity of C++ Code

Sukhmeet SinghI was doing a programming question in C++ at HackerRank. I solved the question with Time Complexity of O(n^3). I can't figure out how i can solve the question with a better time complexity. I looked at Problem-Settlers Code but it was again of the order of O(n^3). My solution is-> #include <math.h

 
@skiwi at least they're not armed with knives. I would have expected tumbleweed to be armed with knives in Australia.
2
 
0
Q: Better, efficient way of creating a class avoiding repeating code for functions?

xavierI am trying to create a class that parses a JSON and selects all labels, or just a particular label that you prefer to later do a calculation with the value pair extracted off that label. This is working well for .all() This is the first function, wich selects ALL available labels. But then I wan...

0
Q: Replace space with %20

Mosbius8Here is my code. public class Test{ public static void main(String[] args){ System.out.println(replaceSpace("All men must die")); } public static String replaceSpace(String s){ String[] stringArray = s.split(" "); StringBuffer sb = new StringBuffer(); for(String s3 : stringArra...

0
Q: Printing the divisors

user98031Write a Java program that is reading from the keyboard a value between 100 and 700 and is printing on the screen the divisors of the number.

 
9:36 AM
Monking @Mast
 
Monking @DanPantry
 
9:53 AM
0
Q: Hibernate Save method practice

ᴊᴀᴠʏWe are new into hibernate, in our project for saving an entry the below given code is used, please have a look. public void save(Object obj) { Session session = null; Transaction transaction = null; try { session = sessionFactory.getCurrentSession(); transaction = ses...

0
Q: Improving Speeds of Tokenisation of large word list for distinct combinations

frostwareIm having trouble with a current algorithim I'm writing that takes a corpa, a list of characters in sets (1 one or larger) with a frequency number attached to it. Against another list of character sets that need to be created using the most frequenent occurences of the combined sets... if that ma...

 
10:03 AM
0
Q: Better way for securing direct access to php files

Dave XI don't know if this method uses a lot of time to process, or if it is bad but I wanted to know if there is any better way of actually doing this? I have a few class files that I want to stop users viewing vue the browser, and only allowing them to view it if actually load it from the index.php ...

 
10:36 AM
I think this question belongs more to codereview or programmers. — WorldSEnder 47 secs ago
 
11:04 AM
Monking
 
@Duga Nope.
Monking @skiwi
 
@WorldSEnder This would be closed as hypothetical on Code Review. Please take a look at the on-topic help page before making suggestions like these again. — Mast 53 secs ago
 
0
Q: EventHandler for custom control

K. GkinisI'm writing a Winforms Control, that wraps a JS library and extends a web browser control. When the JS library, calls an event, I have a callback to a method in C# that parses the returned JSON etc... At the end of that method, I want to fire an event, with the data returned from JS. I'm doing ...

 
11:19 AM
There may be a better way to do this, but with Adela's answer you can fix the script so that it works. If you want someone to look at your code extensively (to see if you can write it more efficiently), try our sister website Code Review. — Laterow 53 secs ago
 
0
Q: Check if a user is allowed to vote using Doctrine

wawaSo the goal is to have a function that checks if a User can vote for a Registration (later called $driver) There's a Entity called Vote which has the fields voter which is a User entity, joined as ManyToOne, driver which is a Registration entity, joined as ManyToOne and the field created, which ...

 
@CaptainObvious Eh, what?
 
11:59 AM
Quiet in here today
 
12:13 PM
evening
yesterday, by Quill
user image
I've never seen a tumbleweed before, actually
 
@Quill That person probably never wants to see them again
 
lol
 
"What doesn't kill you, will make sure to kill you next time." - Australia
2
 
12:28 PM
There was a story on the news the other day of an old lady who drove herself halfway to hospital after being bitten by a snake
her veins were like black before someone drove her the second half of the way
 
It's in Australia... of course
 
I like the part where there is a place in Australia called Swansea, New South Wales
There is also a place in Wales, South Wales called Swansea.
It's about... an hours train ride from here.
 
> New South Wales
 
Yeah, but you don't have a Cardiff, do you?
 
Most of Australia's towns are named after yours
Cardiff is a suburb of the City of Lake Macquarie, New South Wales, Australia. It is located 13 kilometres (8 mi) west-southwest of Newcastle's central business district in the City of Lake Macquarie North Ward. Cardiff is an irregularly shaped suburb. In the 2001 Census Cardiff had 5,039 inhabitants. Including the associated suburbs of Cardiff South and Cardiff Heights, the population was 9,500 persons. Cardiff contains 2 government primary schools, a Catholic primary school, an Independent school and a government high school. Like most major suburbs in Lake Macquarie, it has its own commercial...
 
12:38 PM
We're fantastic. Of course they are.
 
Probably because you guys colonised this country
 
Woops. Sorry about that
But, look at the upside: we gave you tea. Maybe.
(Do you drink tea in Australia?)
 
Yeah, we drink tea
 
See! We gave you tea. #worth.
 
Didn't the Chinese give you guys Tea anyway?
 
12:40 PM
Shhhshshshshsshhh.
don't tell anyone
This looks pretty cool
Of course, it's Adobe, so it's ridiculously expensive
 
Are they still shipping Flash?
 
I imagine so, but I only really look at adobe for their CC programs
oh, wait, I lied, that app is free on the iPhone.
Wow
 
0
Q: Set matrix row column to zero

Mosbius8Here is my approach public void setZeroes(int[][] matrix) { if(matrix.length == 0 ) { return; } if(matrix.length == 1) { boolean flag = false; for(int j =0; j<matrix[0].length; j++) { if(matrix[0][j] == 0){ ...

0
Q: Should I inject an entire controller into a class or just the dependencies I need

AndyIn my Symfony (v2.7.9) project I have a set of entities which share some view functionality i.e being displayed in a table with some of their values as columns. Following the separation of concerns principle, I've made a ListTable class which handles getting the table headers, rows and column va...

0
Q: Rotate matrix to 90 clockwise

Mosbius8here is my approach public static void main(String[] args) { int[][] mat = { { 1, 2 }, { 3, 4 } }; rotate(mat); } public static void rotate(int[][] matrix) { if (matrix == null) { return; } int n = matrix.length - 1; int temp = 0; int[][] mat2 = new int[n + 1...

 
12:56 PM
I'm voting to close this question as off-topic because it is asking for review, which is too broad on Stack Overflow. Consider asking your question on codereview.stackexchange.com instead, but be sure to read their asking guidelines first; specifically, add background & an desired output of your application to the question itself. — Matt ♦ 55 secs ago
 
There's valentine's day stuff all through Sydney at the moment. It's all pretty weird actually
 
1:12 PM
This question must be asked on codereview.stackexchange.comMatei Mihai just now
 
0
Q: Generating time series for generator ON or OFF

kelamahimWant to create time series for the nuclear power plant performance using the equation for Time to fail and time to repair for 8736 hours in the year so that I have the time series in hours when the generator is operating in when is not. The starting conditions is that the generator is operating o...

 
hmm... I'd say this is a good search for migrated questions, isn't it?
 
@Quill What, as part of the tumbleweed?
 
No, just for the month of February
 
Naming is hard...
@Vogel612 Seems fine to me.
 
1:27 PM
> There are only two hard things in Computer Science: cache invalidation and naming things. -- Phil Karlton
 
What would one name a function taking two arguments: direction and speed?
vector seems like a bad idea.
 
What does the function do?
FWIW, direction + speed = velocity, which is a euclidean vector.
 
It sets the direction and speed of a motor.
velocity could probably work...
 
@Mast It would be called setVelocity(Velocity velocity);
 
I could even make the function accept only one argument, which would be velocity itself. If it's negative the direction is reversed.
 
1:31 PM
struct Velocity {
    float direction;
    float speed;
}
 
Direction is only forwards or backwards, so that could be indicated by a minus sign. No need for a struct since there are no angles.
 
Then is still doesn't need two arguments. Floats are signed.
setVelocity(float velocity);
 
> There are only two hard problems in distributed systems: 2. Exactly-once delivery 1. Guaranteed order of messages 2. Exactly-once delivery -- Mathias Verraes
(Dealing with this in work atm)
 
0
Q: Integer square root

ElogentThis essentially performs the same function as exact-integer-sqrt in math.numeric-tower. (defn isqrt "Returns the greatest integer less than or equal to the principal square root of n." [n] {:pre [(not (neg? n))]} (let [n (bigint n)] (if (zero? n) n (loop [x (.shiftLeft...

0
Q: Dynamic methods generation in Perl

DacavIn my spare time I'm working at a perl library, which is the lightweight implementation of a package I did some time ago. In the previous iteration I used Moose as object-oriented framework, as suggested by many people on the Internet. Later in time I realized how Moose was a total overkill for ...

 
1:52 PM
Yes I have checked the tooltip :P I figured it's not appropriate for code review SE, since I know that it's not quite correct. Thank you very much for the input, I didn't know about these guidelines! — K. Gkinis 49 secs ago
 
2:04 PM
I've removed the code-review tag, since it's not very welcome. — K. Gkinis 6 mins ago
The tag isn't welcome? What?
Ah well, at least SO knows who we are by now.
 
0
Q: Simple Linked list program in C

Deepak SinghThis is my simple linked list program in C. What is the best way to write this program, please offer suggestion. #include <stdio.h> struct node { int data; struct node *next; }; void append(struct node **, int); void display(struct node*); int main() { int n, ch; struct no...

 
@Mast Bad tag, not welcome
 
2:22 PM
Greetings, Programs.
 
@Matt the problem is now described, and you got a example of what i´m doing, it´s not a code review or a request for reccommendations in libraries what i want to know if there is a function or a design solution that i did not implemented that could be implemented that could result in a speed increase in terms of processing the results. — PythonNewbie 1 min ago
 
2:43 PM
If the code is working it is off-topic. You should ask this on code review. — 2501 35 secs ago
@2501 Thx for the hint. Where can I find code review? — Helmut Wollmersdorfer 9 secs ago
 
3:15 PM
0
Q: Is using IntegrityError to prevent duplicates ok?

Martin ThomaI currently have code of the pattern con = sqlite3.connect(path_to_db) cur = con.cursor() for el in data: sql = "INSERT INTO `table` (`some`, `things`) VALUES (?,?)" try: cur.execute(sql, el) except sqlite3.IntegrityError: pass # This data is already in the DB. Just ...

 
Do we not have MathJax in comments? :(
I wanted to display $\sqrt{all evil}$.
 
Only in posts I think.
Not in titles either.
 
Damn.
 
0
Q: @ParametersAreNonnullByDefault in package-info and check in a method that the input is not null

ManuelarteThis is the set up we have in our project: package-info.java @ParametersAreNonnullByDefault package testPackage; import javax.annotation.ParametersAreNonnullByDefault; And then, a class like: package testPackage public class TestClass { ... public void methodOne(final String param...

0
Q: A function that helps you change a character in a string at a specified index position

user69786#!/usr/bin/python3 def change_char_at(ch, s, indx): """ Strings in Python are immutable objects. So, it is not possible to change a certain character in a string in place. For example, an attempt to run the following code will fail with a TypeError: s = "spam" s[1...

 
3:34 PM
There are multiple issues in this example. Please be more specific, especially with what you expect to happen, since this is not a code review site. Examples could be, why is the list not showing up on page1, or why isn't page1 working when you go back to it from page2? — André Laszlo 10 secs ago
 
0
Q: Chinese Poker using Classes

mschlindweinI developed a Chinese Poker game for better understanding Classes in Python. It is not finished yet, but the main part is. The game mechanics: There is 1 board for each player. Each board have 3 rows. The first row can receive up to 3 cards, and the other 2, 5 cards each. A total of 13 cards i...

 
@DanPantry You could make it a feature-request if there hasn't been a meta about it yet.
 
@Didii There should still be a way, maybe even passing Actions into sub-methods or splitting up the segments that don't use DoSomething better. Perhaps you should write out your code once and put it on Code Review to see what people think of your concrete case? — 31eee384 55 secs ago
 
3:57 PM
-1
Q: What am I doing wrong in this c++ code! New to C++ it stops letting me put input after the first time

acm818include using namespace std; int main() { double propValue, //Property Value name, //Full Name assessment, //Assessment srAssessment, //Sr Assessment taxRate, //Tax rate annualPropTax; //Annual Property tax const double EXEMPT = 5000, ...

 
where would i go to post this then sorry im new to all this? — acm818 2 mins ago
Oh I wish people would only get read-only access on the internet in their first months as programmer...
4
 
Monking
 
3
Q: Reduce linq in linq in linq statements for get data from SQL server with entity framework

LuïsFirst of all I make an ASP.NET MVC application and use entity framework for code first migrations to the SQL server database. I use also an Unity-container for managing the services and repositories. I've made an overview page but I'll limit the items on that page to 10, 50 or 100 (variable name...

0
Q: A program that creates an alternade from a dictionary list using python

ianI have tried to create a code that will make up at least two words from the original word but..am finding difficultly in concatinating the original word with its alternades. the word list can be obtained from http://www.puzzlers.org/pub/wordlists/unixdict.txt. This is the code i currently have f...

 
4:29 PM
0
Q: Making the same amount from different combinations of coins (top-down approach)

bourbaki4481472I was reading a typical interview question found here. Given an amount and a list of denominations, count the number of possible ways to break the amount into different combinations of coins. For example, if amount = 4 and denominations=[1, 2, 3], there are 4 possibilities. Here's my Python solut...

-1
Q: How to get 10 random rows from MySQL database and put it into an output variable?

Christian VelezThe code below selects rows from the DB random rows.I want to select 10 random rows and then in an output variable like the code below. I am following this link but still can't understand how the person manages to put the data the php code receives into a csv_output variable. $result = mysqli_q...

0
Q: A Dockerfile for Composer (a dependency manager for PHP)

SamI recently built a Docker image for Composer, and I'd love to get a review of the image, the bash based wrapper script, it's recomended use, and the repository structure. Here's the Dockerfile for the latest tag: FROM alpine:edge MAINTAINER Samuel Parkinson <sam@graze.com> RUN echo "http://dl...

 
possible answer invalidation by user69786 on question by user69786: codereview.stackexchange.com/posts/120417/revisions
I'm voting to close this question as off-topic because the code works, and as such belongs on CodeReview. — Bartek Banachewicz 45 secs ago
 
4:59 PM
@Duga Harmless.
 
monking!
 
monking!
 
that linq in linq in linq question was fun
 
possible answer invalidation by user69786 on question by user69786: codereview.stackexchange.com/posts/120417/revisions
 
pagination gets rather interesting when OP doesn't know about .Skip
 
5:16 PM
@Mat'sMug What's that?
 
@skiwi OP was sorting ascending, taking all items up to the end of the page he wanted; then sorting descending and taking the number of items on a page, then sorting ascending again to return the paginated results
Simplifies to..
   .Skip((page - 1) * pageSize)
   .Take(pageSize)
   .ToList();
 
@Mat'sMug He wat?
Sounds a bit complicated ;)
 
A bit, yeah
return (from b1 in ((from b2 in ((from b3 in dbSet.Include(b3 => b3.Category).Include(b3 => b3.User)
                                      orderby b3.CreationDateStamp ascending
                                      where categories.Contains(b3.CategoryId)
                                      select b3).Take<Blog>(page * pagecount)).Include(b2 => b2.Category).Include(b3 => b3.User) // step one
                         orderby b2.CreationDateStamp descending
                         select b2).Take<Blog>(pagecount)).Include(b1 => b1.Category).Include(b3 => b3.User) // step two
 
0
Q: LINQ to SQL code - in models project or in db project

HoppeI currently have two projects. One called Models, a second called TaskEntityModels, a model first Entity Framework 6 project. Here is an example of a class in my models project: public class ImportRequest { private readonly TaskEntities _taskEntities; public ImportRequest(TaskEntities...

 
Well, I disagree, with the statement of your answer (cin.getline being "the way you should read a string in C++"), with your statement that char[] is "not that bad", that C arrays vs. C++ containers is an "issue of opinion", and that this were on the level of disputing brace style. I'd point that piece of code out in every code review we'd be doing, and insist on proper use of C++ idioms. I could also tell you of the number of char[]-related errors I had to fix over the years, but I am afraid you wouldn't listen. You have your opinion, I have mine, sorry. @stackptr — DevSolar 20 secs ago
 
5:25 PM
Oh, I need 1 more answer for a tag badge
 
@Mat'sMug wat...
 
0
Q: Angular app run wrap code in a service

AndreFontaineHow can I make this better in terms of modularity? It is working but the JWT here seems to be not good at all. I have some misconceptions about angular.run. app.run(runInit); function runInit($rootScope, $state, $localStorage, authorizationService, SECURE_CONSTANTS, jwtHelper) { $rootScope.$...

 
5:42 PM
@Mat'sMug Sounds like you have a goal.
6 more answers till I get my first answer badge.
 
6:09 PM
gosh some people don't get it
3
I disagree with that one should extract methods instead of creating regions in existing method. I think in OOP you shouldn't have unnecessary private methods as it's more a part of functional programming. It's better to make a class OR [extract methods only if they gonna be REused]. There is no sense to have one more method if it's called from only one place and you have to navigate there to understand what it does so I prefer scopes and regions when it's not too nested. (But there is a sense to have a class even if it's used only in one place because you can substitude implementation). — Vlad Feb 15 at 16:13
 
yet again the problem is naming
and lacking documentation
 
@Vlad if you have to navigate there to understand what it does, then you need better method names. Abstraction is also one of the 4 pillars of OOP AFAIK. — Mat's Mug 5 secs ago
 
@Mat'sMug wow
I didn't realize that people actually thought that doing stuff like that was okay.
 
0
Q: How can I make this ActiveRecord update more efficient?

Joe MasilottiI have an Active Record update with the following data model: TvMenuProfile has one rich_text_special Bar has zero to many tv_menu_profiles Special has one bar_id and one description I want to copy all of the Special.description columns to each TvMenuProfile. The link between the two is tv_me...

 
Working on WPF with ViewModels that have 10 or 20 properties that simply wrap properties on my model, I love regions - I can just tuck those properties away in a region (they never need to be touched) and keep my eyes on the relevant code. — Kirk Broadhurst Mar 1 '11 at 6:57
I totally agree with Kirk. I just wrote a WPF control with about 16 completely-related and inseparable controls with backing properties. Each property is almost an auto-property, but the setter needs to have an if (_backingField != value) { _backingField = value; OnPropertyChanged(); }, and these 16 fields end up taking 13 lines each uncollapsed + whitespace between the fields. I put these in a region and collapsed it because these properties need never be touched, and are really just clutter on my screen. — Hosch250 2 mins ago
Those 16 backing properties take up 223 lines of code.
 
6:23 PM
Oh wow.
That's a lot, just for some properties.
 
Matt Sherman on February 18, 2016
Spoiler: It’s hard! Here’s what we’ve learned.
 
Yet, a ViewModel shouldn't have anything much more than properties exposed...
What's the relevant code anyway? Command execute methods?
 
0
Q: Can I rewrite this code for better performance?

user3275095Asked this initially on SO but later found this forum, thought this fits here. I have a REST WS in JAVA using jersey that connects to database. I don't know what should be the ideal time for execution but I feel the time it takes is too much. The actual call to DB completes in range of 0-3 mill...

 
http://www.commitstrip.com/en/2016/02/18/gifs-you-need-to-stop-now/
CommitStrip
GIFs: You need to stop. Now.
CommitStrip
1455819797
 
@janos
> Python has a philosophy called ask for forgiveness, not permission
python is fkin weird. I don't like it.
@CaptainObvious you could rewrite that title for better review performance!
@CommitStrip meh, imgur supports webm though
 
6:35 PM
@Mat'sMug My Save/Update methods.
 
okay, so the VM can go like this then
 
This type of question is better suited for CodeReview or Programmers. I suggest you carefully read their help center pages about asking and then format your question according to the one that better suits your question. You can ping me if you want another pair of eyes, then flag for a moderator for migration. — user1803551 35 secs ago
 
        class Something
        {
              private readonly ISomeService _service;

             public Something(ISomeService service)
             {
                  _service = service;
                  // ..
             }

             public void Method1()
             {
                  //...
             }

             public void Method2()
             {
                 //...
             }

             private Foobar _field1
             public Foobar Property1
             {
so the "relevant code" is at the top
and the backing fields are together with the properties, while the dependencies remain at the top
 
Yes, it could.
 
see, no need for #region
3
 
6:43 PM
Hypothetical, in my opinion:
0
Q: Dynamic methods generation in Perl

DacavIn my spare time I'm working at a perl library, which is the lightweight implementation of a package I did some time ago. In the previous iteration I used Moose as object-oriented framework, as suggested by many people on the Internet. Later in time I realized how Moose was a total overkill for ...

Second opinions?
 
@200_success i guess you could say it's a Perl in the rough
It looks like a hypothetical to learn a concept
 
The naming is definitely hypothetical, but on the other hand, he may not care about variable naming.
 
I think I'll allow it.
 
@Mat'sMug No, but it isn't doing any harm either.
 
possible answer invalidation by rav_kr on question by Mosbius8: codereview.stackexchange.com/posts/120385/revisions
 
7:00 PM
@Duga Added one level of indentation everywhere. It's OK.
 
@DanPantry Agreed. It was nice to write when I was first starting out, but it just feels odd now.
 
0
Q: Greatest Common Divisor of two or more integers

NullI wrote a function template to compute the GCD of two integers. This function checks that its arguments are an integral type. I also wrote a function template which accepts a pair of iterators in order to compute the GCD of two or more integers. It calls the first function to compute the GCD of p...

 
Python is really interesting, but it is really difficult to debug.
 
7:18 PM
I wish Python had some form of explicit typing. I might be able to enjoy it better that way.
 
@Hosch250 Nah.
If it's hard to debug, you're making too much progress at once.
As in, you're in way over your head.
 
When you are doing a Checkers game with an AI, it is too hard to debug.
 
This question is probably better for the codereview.stackexchange.com site. — vcsjones 13 secs ago
 
-1
Q: define a function call printstarx, which has two parameters

Michael Jonsondefine a function call printstarx, which has two parameters. n parameter specifies how many stars to print on each row row parameter specify how many rows to print stars the row parameter should have a default value as 1. so this function will print a couple of rows, each row composed of n stars ...

 
It shows you where the crash is through the stack trace dump, but it doesn't tell you what the values are, so you have to run through the program again. Sometimes it takes several minutes to get to the point.
 
7:20 PM
If you want to know the values, there's print.
 
Pretty useless after the stack is dumped and the program crashed.
 
Programs aren't supposed to crash.
 
They do when there is an exception...
 
You know there's a thing called Exception handling, right?
 
@Hosch250 What are you using to write Python?
 
7:23 PM
Python says it's easier to ask for forgiveness than for permission.
 
IDLE.
 
Which means exception handling is important.
Expect exceptions.
 
What makes Python harder or weirder than any other language?
 
@Hosch250 If you want a Python debugger, Python Tools for VS2015 has one.
 
@200_success The way I can't trust a variable to keep its type.
 
7:23 PM
JavaScript is worse in that regard.
 
Yeah, it came with VS 2015.
@Mast I don't even use JavaScript at all.
 
javascript + vs = hell
even with node dev tools in vs
 
Yeah, don't change types for a variable.
 
I don't try to, but it sometimes just happens. That is usually the cause of the exceptions.
 
Doesn't Python have a runtime const like javascript?
 
7:26 PM
Like, I might inadvertently pass a string instead of an integer, then use the + operator.
@DanPantry Not as far as I know.
 
Getting the wrong typing can be caught by unit tests
@EthanBierlein er, js doesn't
unless you use ==
which any linter will scream at you for using
 
== is fun.
 
> You've earned the 'Copy Editor' badge.
3
dang, was about time
 
Congrats, Mug!
 
:)
 
7:29 PM
In 99% of scenarios JS doesn't know about types at runtime, with == being one exception (and typeof being the other)
 
there are no types. only ducks.
4
 
quack quack
So, Firefox Dev edition looks pretty swanky
 
7:56 PM
Please use CodeReview for questions about the correctness of working code. — MSeifert 40 secs ago
 
0
Q: Google Script optimization - protection for cells in google sheets

Mr. M. PerzanIs there some way to speed this up since it keeps timing out while running? The spreadsheet is shared with a Google Group with editing permissions. I've loaded what I can into memory but each .addEditor and .removeEditor takes up to 3 seconds each x 100s of cells. I have the sheet deleting the fi...

 
@CaptainObvious someone took "tab vs space" a bit too literally. single-space indent anyone?
wait no, it's not consistent at all
 
@CaptainObvious ew
 
8:18 PM
0
Q: Reverse Polish Notation Calculator in Java

T145So I created a highly effective Reverse Polish Notation calculator using Java 8, but am uncertain if there are any better ways to handle the problem. Feedback on any evident taboos and bugs is greatly appreciated! public final class RPN { /** * Removes all characters that are not opera...

0
Q: Automating Python interpreter imports from bash

catWhen I'm writing Python, I wanna be able to pull up an interpreter quickly, and import what I need easily. Previously, this involved: bash4.3 $ python3 >>> import os, sys, readline, lxml I was irked by the amount of typing in that, so I wrote a couple of tiny bash functions that live in my .ba...

 
This looks more like a request for code review than an actual question. — chepner 45 secs ago
There's a lot of business logic in here we'd have to infer, if you just want this refactored, probably better for CodeReview. — Anthony 14 secs ago
@PatrickQ Thanks, I will try the return tonight. In my version of the code that is in my code review question, it does render the html to the php page with the injected $viewData. I have now added an example to my question on here of the literal HTML that did get output to the php page (when using my version on code review) and now does not. — user3935156 46 secs ago
 
8:33 PM
0
Q: `atof` revisited

vnpIn an answer to this question I mentioned best effort. Here I try to explain what I meant. Please keep in mind that the implementation is intentionally incomplete (missing features such as NAN are trivial to add) and focuses specifically on the numerical stability. It was surprisingly hard to ge...

 
I've moved this over to CodeReview... thanks for the suggestion. — Tony Gaeta 17 secs ago
 
0
Q: Ternary like assignement in BASH

StphaneGood evening, Given my code below: # Source file source=$( [[ ! -z "$1" ]] && echo "/home/$1" || echo '/root' ) source="$source"/.bash_history [[ ! -f "$source" ]] && echo "History file '$source' not found." 1>&2 && exit 1; # Am I dealing with root isRoot=$([[ "$source" =~ ^/root ]] && echo 1 ...

0
Q: Using basic HTML to render and check

thesayheyI am a newbie and I am using basic HTML to render and check. No JSON at the moment. With that said, I’m having a hard time conceptualizing organization of a group of matching series (e.g. a series that falls under a given number, say 1) into a single link that expands into the subseries (say, 1a,...

0
Q: Does this respect Ruby's DRY principle?

Tony GaetaI'm trying to respect the ruby principle of keeping my code dry; however, in my conditional, I have different constants set to different days. But that's the only thing different. They're pretty much the same code minus the evaluation of days from_now. if term_type == TERM_MONTH MONTHLY_WARNI...

0
Q: TicTacToe game in Python 3

D.CI would just like a general review of my Tic Tac Toe game in Python. Any improvements or suggestions? def print_board(board): print "The board look like this: \n" for i in range(3): print " ", for j in range(3): if board[i*3+j] == 1: print 'X',...

 
You might want to check out stackoverflow's codeviewzamuz 35 secs ago
 
8:58 PM
@Duga Stack Overflow's Code Review. well that's a new one.
 
00:00 - 21:0021:00 - 00:00

« first day (1020 days earlier)      last day (2982 days later) »