« first day (1120 days earlier)      last day (3194 days later) » 

00:00
RELOAD! There are 2397 unanswered questions (93.0566% answered)
@Mat'sMug Sounds nice but not really useful for that particular question :D! But thanks anyway! I'm still tempted to do a bit more C# these days and I may switch to C# soon for my job so hey maybe I should grab it
0
Q: Getting a Random Word Generate to Generate Words without Repetition

bookydedreamerI am just learning C# and am trying to write a random color generator for use with threadcrafting for fun. I've got it mostly operational, but it always repeats the same color however many times my integer flows through the loop. What is the best way for me to get this to generate a random color ...

@Marc-Andre The way I know it (and I don't know much) is that you manually-ish handle this.
You usually retrieve an object from your EntityManager.
@Vogel612 I'm still at the point too. EntityManager is too "low level" for me at the moment. There are new stuff to not deal that manually now
Then you'd change that object and can then call EntityManager#merge
actually.. persist is for new objects only it seems
00:09
I'm using the spring-jpa, so no entitymanager shenanigans
that's spring right there. never worked with that
I could guess it's similar though. I remember spring abstractions being kind of thin
It's working nice but I do not find any intermediate stuff to continue working on my api! I'll kept looking! Thanks for the discussion @Vogel612!
On another note, how are you doing ?
Tired, mostly. University is more taxing than I'd have imagined given that I already know most of the stuff I have to do for two classes of four
and you?
0
Q: FlowRouter auto-redirect on login page

pikauspThe site should be accessible only to signed-in users. I'm making sure I publish and enable data manipulation to only those, but I wanna make sure even the app structure won't be visible. What I did was creating an autorun that checks for changes in signed-in user and reloads the router. The rou...

@Vogel612 I've changed job and I'm preparing myself to be a dad so I'm doing a lot of gaming and programming as I can before I don't have any sleep :D You were working full-time before right ?
00:23
@Marc-Andre hey congratulations!
@Mat'sMug Thank you!
twins?
lol
Nope, as far as we know we got only one!
awesome! stressed? how many weeks of gaming and programming left? ;-)
We had our first echo at 12 weeks and we only see one. It moved so much and we did not see two, so there is not a lot of chance for us to have twins
@Mat'sMug Not really stresses just a lot to do! She's at 16 weeks, so 24 ish weeks left
00:29
you have unspeakably wonderful moments coming, you'll do great. be there for your wife/girlfriend, she's going to need you around ;-)
codereview.stackexchange.com may be more appropriate for review of working code. — rrauenza 14 secs ago
Ohh I know! I can't wait :D ! This will be worth it :D! And we're young that's one thing I like. We'll have plenty of time and energy to deal with everything :D
Would anyone explain why someone would do a reload page to switch from the C# code example to Vb code example
because microsoft
@Marc-Andre yea I was. it was horrendous
@Vogel612 Is that why you're returning to the University ?
00:44
that's one of the reasons. I did not return though
the other was, that I wanted to be exposed to theoretical CS and different programming languages and paradigms
Do you like it at the moment even if it's taxing ?
Yes I do, which is great
otherwise I might've run out of things I like to do :D
What new paradigms or programming languages you like the most ?
00:48
didn't get to see any of these yet.
the theoretical CS is interesting though, so there's that
What do you learn in theoretical CS ?
Formal Verification of programs. Grammars and (theoretical) Languages. Automata
@Marc-Andre how to be a badass
01:03
@Vogel612 Looks interesting!
0
Q: Brainf*ck interpreter written in x86 assembly

Wasabi FanI have written a program in x86 assembly (Intel syntax/MASM) that interprets a string of brainfuck code (which is hard-coded) and prints the final stack to stdout. Note that it does not include an implementation for , and . instructions at this time. This is my first major foray into assembly, so...

anyways I'm off to bed.. it's beyond 3AM after all :D
01:20
Night!
0
Q: My code is repetitive, can someone give me a hint on how to make it more brief?

essentialgreenThis is what I have tried so far: codepen.io/alehl/pen/GqRqZv but I am missing something. I've been staring at it all day without being able to figure out what's missing.

 
2 hours later…
03:02
0
Q: How to check if scanner input is a string?

fnTASYI am a beginner to java, and I have a pretty simple calculator: import java.util.Scanner; class learningtest{ public static void main(String args[]){ String operator; double f1,f2,answer; Scanner scanner = new Scanner(System.in); System.out.println("What op...

0
Q: Fast CSV parser in C or C++

Naresh VankayalapatiI have written a CSV parser to read in 12609000 lines of CSV data. Each line has 16 fields of both string and double type data. The following code takes about 40 seconds to parse the data. I would like to know if there is a better way of doing this which can make it even faster. I have seen recom...

0
Q: Java: Good UI design practices

user12314243I have created a UI shown in the screenshot below but the thing is, I am initalizing too many JPanels within a panel in my codes to achieve the UI which will leads to bad code design and also slows down the performance of the program. Is there any good practices to follow in writing such UI like ...

03:17
@syb0rg That doesn't look like real code to me.
Since this has been cross-posted, you should just delete the closed question on Stack Overflow. — 200_success 57 secs ago
0
Q: Dijkstra's algorithm

seteropereAssuming everything else works as expected, is the following a correct - but not the most efficient way - of implementing Dijkstra algorithm? Because I have tested it on several examples and it gives correct result. But I can't imagine Dijkstra is that simple. public static void FindShortestPa...

03:50
posted on May 28, 2016 by Mona Jalal

I found this method here. So I wonder what are better (or more intuitive) methods for finding all permutations of a given string? public static void perm(String s) { alternativePerm("", s); } public static void alternativePerm(String prefix, String s) { if (s.length() == 0) { System.out.println(prefix); }

04:35
1
Q: A socket server that receives strings and prints them

Luke B.Summary: Is my server handling every error and corner case possible? If not, what did I miss? Details I'm trying to write the most basic socket server I can, so I can learn TCP and the pitfalls of parsing network data. I'm also worried about security (DDOS mitigation) and making sure the server...

0
Q: Find majority element in an array given constant external space

Mona JalalGiven constant external space (yes no HashMap), how would you improve the following code (code-wise or complexity-wise with stress on the latter) to find the majority element in an array? /** * Created by mona on 5/27/16. */ import java.util.Arrays; public class FinaMajority { public sta...

04:45
0
Q: Simple JavaScript Module "Loader"

Jack WilsdonI have written a simple JS module "loader" (loader is in quotes because it doesn't actually load the files) that is designed to resolve simple dependencies between modules. It is heavily inspired by module.js and takes some of it's design from it. Here is the code itself: (function() { functi...

04:56
0
Q: Java Decode Huffman Code

Reza HabibiI took Huffman source code from Introduction to Programming Comprehensive 9th ed. Daniel Liang. I enabled to show encoding, but i unable to show decoding. This is my code to decode: String text1 = taText1.getText(); int[] counts1 = getCharacterFrequency(text1); Tree tree1 = getHuf...

05:32
0
Q: UPDATE FROM that overwrites matches

DaiI'm reviewing code by another developer. I'm not too familiar with the semantics of UPDATE FROM when used with a JOIN, but here is the query: UPDATE Vehicles SET Vehicles.Manufacturer = VehicleMakes.Make, Vehicles.Model = VehicleMakes.Model FROM VehicleMakes INNER JOIN...

05:47
-2
Q: **weired behaviour of JDK** caused me banned from SO,

holidayCoderAfter getting banned from SO , I came here to seek help The problem is i had few questions that didn't work properly as the code was right and probably I can blame JDK for that so I got few negative votes. But now everything is working fine and I just want to go back to SO I mean I want to get ...

 
1 hour later…
07:55
-2
Q: traverse through binary tree and print list

ross.cNew here! Trying to traverse through a binary tree in level order (breadth first traversal). I have written code but I get a different output to what is desired. The tree 2---+ (l) 29---+ (l) 26---+ (r) 4---+ (r) 2---+ (l) 9---+ Im using a Binary class below class Bina...

Ripe zombie; open question with answers, at least one answer having score 0, no answer having score > 0: Chunked file upload
08:20
0
Q: For loop with multiple arrays of same size, one variable with 2000

PatKelloughI'm new to this so sorry if it's a ridiculous question or if it's the wrong place to ask. I'm trying to enter an equation with 5 variables into MATLAB, each an array of 5 values. I have an additional variable which is incremental and ends up being 2000 values. How would a loop be used to have 5...

0
Q: Horrible duplication, what's the alternative for sharing static methods?

gudthingOk I am trying to record some session data using static methods. I have 3 counters: CounterA, CounterB, CounterC: public class CounterA{ private static List<SomeData> data = new ArrayList<Data>(); private static final AtomicInteger counter = new AtomicInteger(); public static void...

@CrazyNinja No he shouldn't. Codereview is not for fixing broken code. — Tom 25 secs ago
08:35
0
Q: Python Code for the Rod Cutting Problem using Dynamic Programming

DhruvI wrote the following code for solving the Rod Cutting Problem using Dynamic Programming. Rod Cutting Problem: Given a rod of length n inches and an array of prices that contains prices of all pieces of size smaller than n. Determine the maximum value obtainable by cutting up the rod and sel...

08:55
0
Q: Javascript promises, multiple api calls in then()

VeronikaThis is the first time I'm trying to use promises in javascript so I'm not sure if I have done it correctly but it seems to work. The problem is that I have ended up with a "nested when" and it doesn't look that great. Probably there is a nicer solution out there. I would really appreciate some f...

09:35
@Zak They did it:
@skiwi I think you meant cp, not mv.
09:51
0
Q: Genetic algorithm in Java

LearningI am working on genetic algorithm using the following code. The variable "best" stores the best chromosomes from the previous generation and adds it without modification to the new generation. The problem is that if I allow crossover, the "best" changes it value to the best of the current generat...

10:13
@Mast Oh well, it does add a little job security that way
10:29
0
Q: How to sort a list and sort a list inside each item

JackI have a list of factories each factory has an item of its own and a list of other items from competitors. I need to sort list of factories based on price of their items and also sort list of other items from competitors for each factory. What I am doing require to sort collection of factories ...

10:48
Afternoon @all
possible answer invalidation by Jack on question by Jack: codereview.stackexchange.com/posts/129547/revisions
I think this is a better fit for the code review site — Carsten 42 secs ago
0
Q: Check digits-validating customer Id javascript

NajID must be 5digits in length for eg:77721 And it's sum digits 1,2,3. Eg :7+7+7=21 Sum must be equal the number represented by digits 4 and 5. Eg : 66618 is valid ,.12345 is not valid How should I write the javascript code in order to check the customer id by the user in the input bo...

11:20
Monking
@JeroenVannevel I have no idea what is going on here.
I understand the part where the GC will not track structs that reference reference types. And that's abou tit.
Is anyone playing Overwatch, BTW? I got it yesterday... I've always been pretty bad at TF2 so it's interesting
maybe, not sure how to move that, nor can I find the stated mission of code review site.. — nicolas 51 secs ago
11:41
0
Q: JavaScript News Ticker in Retro Style

st88I have chosen to do it in a some "Retro-Style". So that it shall remind one of old green-screen monitors. Version with working Ajax-Request and Sass-Code on Codepen : http://codepen.io/mizech/full/gMYMdB/ Any hints and suggestions concerning webdesign, programming, structure are welcomed. ...

@DanPantry I think it's too expensive for a "f2p shooter"
At least that's still what I think it is :P Haven't looked into it though
So do I
but I still find it aenjoyable
> Trait objects are both simple and complicated: their core representation and layout is quite straight-forward, but there are some curly error messages and surprising behaviors to discover.
That's... interesting in Rust
12:45
0
Q: Regarding Global Variables

420blazeitfaggotBinary gap as defined here https://codility.com/programmers/task/binary_gap/ As the title implies, I try to write a program to count how many numbers with a binary gap less than or equal to 3 in the range from 1 to N. However, I notice that my function "bingap" will not work if variables "ans" an...

13:15
@DanPantry do you follow the difference between reference assembly and implementation assembly?
The former only contains the API while the latter contains the API and its implementation of each method call
the post highlights what should be considered API
Because there are some fairly esotheric rules regarding structs that mean private members are part of the public contract due to extra constraints put on structs
ergo: in some situations, private members of structs should be considered part of the public API; otherwise you end up with a difference in behaviour
those situations are then outlined
13:50
This looks horribly complicated...
fn factory() -> Box<Fn(i32) -> i32> {
    let num = 5;

    Box::new(move |x| x + num)
}
let f = factory();

let answer = f(1);
assert_eq!(6, answer);
And that's not my code, that's code from the documentation
0
Q: View/templating system with standard content and custom parents

BasI've been working on my own website, and decided to write an own framework for it. One of the items in the framework is a view/templating system, used to easily maintain presentation files (HTML, PHP) For this purpose, I used object-oriented PHP programming and tried to apply the SOLID principle...

When your encryption code is finished, and if it's of any real importance, perhaps you should consider posting it on codereview.se for a review. Encryption can be hard to get right, easy to mess up, and nasty if you mess it up. Artjom's comments show it's quite nice to have it reviewed by more crypto literate people. — Arjan 28 secs ago
We don't currently have the ability to have the pull request automatically complete if the build is successful. It's something we want for ourselves (we use branch policies requiring a build and code reviews), and I hope we get to it soon. — Buck Hodges 5 secs ago
14:05
103
A: How to avoid installing "Unlimited Strength" JCE policy files when deploying an application?

ntoskrnlThere are a couple of commonly quoted solutions to this problem. Unfortunately neither of these are entirely satisfactory: Install the unlimited strength policy files. While this is probably the right solution for your development workstation, it quickly becomes a major hassle (if not a roadblo...

Lol this seems silly ^^
14:29
14:39
0
Q: Could anyone find a bug in my code for finding whether the graph is BIPARTITE or not ?

SiddharthI am solving this problem on spoj. The problem essentially tells to find whether graph is bipartite or not. I have written the code and tried many(really many) test cases but it seems to work properly, but on submitting it gives wrong answer which implies this is code has a bug. What I have done...

@CaptainObvious So it doesn't work. Cut the crap...
@Mast We allow code that is too slow, or uses too much memory. It could be one of those cases... But as it doesn't say either of them I'll vtc. I may ask a meta question about this.
> but on submitting it gives wrong answer
I fail to see the ambiguity.
Could be me though.
More VTC please.
14:57
@Mast Nuke from orbit please
@Mast I read that bit as it give 'incorrect answer' or sommin'. Where it doesn't tell you what's wrong. You're probs right tho
Wat
> A value of type &&&&&&&&&&&&&&&&Foo can still have methods defined on Foo called, because the compiler will insert as many * operations as necessary to get it right. And since it’s inserting *s, that uses Deref.
@JoeWallis It somehow passes his test cases but not the one from the online judge. Which means the code does not produce the right answers. Which means it's broken. Which means it's off-topic.
Right?
And it passes test that don't take into account time to run and memory, but not ones that do, that's broken right?
15:19
I have no clue which tests it passes, but it fails the final one.
@Mast Nor I. I just don't think saying "So it doesn't work. Cut the crap..." is good, when it could be perfectly on-topic if it were a test that tests speed or memory usage.
He's not convinced that his code works therefore it belongs on SO and not on CR, either way he doesn't have a clue (yet) about what he's doing
15:35
This question is more suited for Code Review. Please post it there. — Gerald Schneider 18 secs ago
0
Q: Print out a Zig-Zag Matrix

Cyneon BaneMy task is to code something that prints out this: diag matrix = diag2 [] [] matrix where diag2 [] [] [] = [] diag2 xss [] (zs:zss) = diag2 [] (reverse $ zs:xss) zss diag2 xss ((y:ys):yss) zss = y : diag2 (ys:xss) yss zss dia...

@JoeWallis I phrased it more politely on the question itself, but you're correct.
Title must have made me grumpy.
Comments like this don't help either:
@Mast Please tell what is broken code. Please go through the question at least once and please clearly mention what I have done wrong — Siddharth 1 hour ago
No mortal user will tell me what to do.
@Mast I'll tell you what to do to become immortal then!
15:50
0
Q: Refactor code that violates “Needless Repition” principle

Bob JonesAssume class Animal which does Eat, Sleep and Make Noise. Assume class Mammal : public Animal which also does MakesBaby Assume that Mammal also does Eat, Sleep and Make Noise which it inherits from Animal. This code is extended from code presented in this question which was answered yesterday by ...

@skiwi Using reflection to break TOS and get something working because stupid restrictions. Wow. That's awesome and crazy at the same time.
> But then there's reflection. Is there anything you can't do using reflection?
Java just dropped a little on the list of awesomeness.
16:29
The modified stand-up meeting... Proven to reduce meeting times by 79% ;) https://t.co/p3bEJIVnAI
0
Q: is this php / mysql code secure? im new to php

pimiIm starting with a php so I can save data to a mysql database. I read a lot and seems the "escape" strings is not so safe. this is my simple code. <?php session_start(); date_default_timezone_set('America/Argentina'); require_once("config/db.php"); $link = mysqli_connect(DB_HOST, DB_USER, DB_P...

macro_rules! o_O {
    (
        $(
            $x:expr; [ $( $y:expr ),* ]
        );*
    ) => {
        &[ $($( $x + $y ),*),* ]
    }
}

fn main() {
    let a: &[i32]
        = o_O!(10; [1, 2, 3];
               20; [4, 5, 6]);

    assert_eq!(a, [11, 12, 13, 24, 25, 26]);
}
Rust macros... o_O
WTF
If that's idiomatic, I ain't touching that language.
That's awfully confusing.
Although, in fairness, every language has it's quarks.
I think I'll rank Rust macros on the same level of craziness as C++ templates
Except I already understand Rust macros whereas I still don't understand C++ templates
Now I need to decide what to write though in my first Rust program
16:50
1
Q: Do I follow best practices of MVC pattern design

coos wolffI created my first java application for a college assignment. I tried my best to design my application using best practices of MVC design patterns. I have read about it on stackoverflow and other sites. My question basically is: Do I follow the best practices? Every feedback is much appreciated. ...

If you're looking for improvement of already working code you better should ask at SE Code Review. — πάντα ῥεῖ 38 secs ago
@skiwi Battleship ^^
Title: The Rusty fleet
@skiwi Too bad that list is irrelevant for what I do.
> JavaScript, Python, SQL
I wonder how a JS, Python SQL stack works.
Server-side Python?
I know it can be done, but I didn't realize it was anywhere near popular.
17:12
Isn't Python always server-side?
It wasn't intended as a web language AFAIK.
You can client-side it and also use it as general-purpose scripting language.
It's often used as a tool when other languages are in play as well.
Isn't only JavaScript client-side?
Like a build tool, or verification, or whatever.
@skiwi Only if we're talking browsers.
Who needs a browser to build a client?
Python, C#, many languages can be used to make clients.
Even C ^^
And what's server-side then in that definition?
The thing the client connects with.
You can have a HTTP server in whatever language (Python, Grails, PHP) which can be reached by anything capable of sending a HTTP request.
So, anything capable of reaching the commandline to hit curl basically...
Contrary to popular belief, you don't need a web-browser to scour the internet.
17:23
I'm missing the point... Isn't a JS, Python, SQL stack just JS as front-end and Python + SQL server-side?
Probably.
But you could also put the JS server-side.
Both combinations are not something you encounter a lot in production code AFAIK.
I've done it once, Python on client-side and Node.JS on server-side with a SQL database. But the project wasn't considered a success for multiple reasons.
Wat ^^
0
Q: Managing IDs using AVL trees

MitsosIn a txt file there are IDs and next to them there are their neighbours like this: 1 1 1 2 1 3 2 1 2 4 2 8 3 5 Using AVL trees I store the IDs in one AVL tree and for every ID in this AVL I make another AVL tree in which I store its neighbours.In the end I make another txt file that in...

17:52
0
Q: How to pass data from onActivityResult() to recyclerview?

Puneet0 down vote favorite In this program i am using the recycler view . It has AlbumListHolder which contains imageview(mAlbumProfileImage) .I want to implement longClickListener on the imageview of listHolder to set the image from camera . So i am confused how to use onActivityResult to set the imag...

Please refrain from cross-posting. Pick one site, and go with it. — Robert Harvey ♦ 15 secs ago
Did you get lost? This is Code Review, not "how do I fix my broken code." — Robert Harvey 1 min ago
18:08
:-)
@RobertHarvey Always good having you here Robert.
Given that your code works fine, and you're asking people to help you write something new, this is not a question for Stackoverflow (you have no actual problem) but more a question for codereview. — Mike 'Pomax' Kamermans 26 secs ago
18:39
This should be placed at CodeReview not Stackoverflow. — Orel Eraki 23 secs ago
18:58
0
Q: How can I refactor this?

ZilI have this block of code which clearly looks like duplicate, but I don't know how to refactor. float offsetDifference; nfloat newLogoHeight; nfloat newHeaderHeight; nfloat newLogoWidth; if (offset > _previousOffset) { ...

19:08
0
Q: Knight's Tour - all Solutions and Optimizing - Java

iKuraikoI wrote a Code for the Knight's Tour Problem. I googled alot to try to make it as efficiant as possible. I got the Buffer. I also thought about using the Heuristics Algorithm. I don't know where I could put that in the code. But that's the second thing I want to do. Now my main question. I want t...

0
Q: Spaceship Arcade Battles V0.1

MontrealI am trying to implement something like this using SFML and Box2D. Now my code lives here and I don't know how good is it. Please, look and criticize.

19:26
91
A: How are globals any different from a database?

JulesFirst, I'd say that the answer you link to overstates that particular issue and that the primary evil of global state is that it introduces coupling in unpredictable ways that can make it difficult to change the behaviour of your system in future. But delving into this issue further, there are d...

@Phrancis In that answer they state that in databases you only change behavior and not data, but didn't your old company do both some time ago?
19:54
@πάνταῥεῖ you are not. but it is not also my job. This is not a code review website. The OP need something. I did it with the min efforts. Your comment is appreciated since it add a good thing. You can downvote if you find it a bad answer. You can also edit. You can do nothing. That is all the story :) — Humam Helfawi 56 secs ago
Ripe zombie; open question with answers, at least one answer having score 0, no answer having score > 0: Nested values copies from one object to another
20:58
...when you have something that works, and the question is whether it can be made to work better, that really isn't a fit for StackOverflow at all -- there's a separate CodeReview StackExcharge for that class of question. — Charles Duffy 59 secs ago
21:10
possible answer invalidation by Mik3c on question by Mik3c: codereview.stackexchange.com/posts/129509/revisions
 
1 hour later…
22:24
Mocking repositories is not trivial. I assume that when you say change data source you mean replacing the data access layer, for instance by NHibernate. That too is not as easy as it looks because of leaky abstractions. — Gert Arnold just now
"Man is the lowest-cost, 150-pound, nonlinear, all-purpose computer system which can be mass-produced by unskilled labor." —@ForeignAffairs
22:43
@skiwi I think it's a bit of asking the wrong question, comparing an OOP concept like globals, to how a database works. Since the database is only concerned with persisting and retrieving data, yes of course you can change data, and often do, but I don't think that's what the author of that answer/question is asking about
In fact, depending on the setup of the system, a database may only expose very limited parts to certain processes/programs, while as far as I know, globals are accessible by every process (right?)
Looks like you should rather ask your question on Code Review where you can have your code reviewed. If you explicitly tell that you don't want memory leaks, people might look at that specifically. — Morwenn 18 secs ago
23:03
@Vogel612 any reason you rolled back the edit that made the notify Q on topic?
@RubberDuck me not being able to read, mostly. Rollback rolled back
Cool. Thanks!

« first day (1120 days earlier)      last day (3194 days later) »