« first day (429 days earlier)      last day (3581 days later) » 

12:29 AM
are we trying to burninate , or no?
 
I don't think so. The last two to go (as far as I know) have already been posted.
2
A: Should we do something about our meta tags?

JamalThe selected meta tags will be burninated in phases, based on usefulness. This post will be updated as burninations are done, up until the question is tagged as status-completed. Phase 1: status-completed refactoring clean-code code-smell Phase 2: status-completed style code-organizatio...

 
yea I was just looking through that
Also Jamal, on the ObjC question you added to, I'm changing that to
 
Okay
 
0
Q: Is `dis` an acceptable replacement for `this`?

DokkatSuppose you have a method on a class that looks like this: MyClass.prototype.pretty = function(tree){ return "[Tree " + (function go(tree){ return this.isLeaf(tree) ? tree.toString() : "(" + go(this.left(tree)) + " " + go(this.right...

 
No.
@rolfl I'm on there. I have 86.
 
12:50 AM
@CaptainObvious might as well go full AAVE: this.isLeaf(tree) -> dis.beLeaf(tree)
 
0
Q: Index was outside the bounds of the array

joshsoriano89I am trying to put an integer inside the array by subtracting the initialized value in every loop. This code seems right for me, but the compiler always claims that "Index was outside the bounds of the array.". Am I doing something wrong here particularly in itr part? static void Main() { ...

 
0
Q: Find all nodes in tree , without a sibling

JavaDeveloperFind all nodes of trees, without siblings. This question is attributed to GeeksForGeeks. Looking fr code review, optimizations and best practices. public class PrintNodesWithoutSiblings<T> { private TreeNode<T> root; public PrintNodesWithoutSiblings(List<T> items) { ...

 
0
Q: Should timings be included in answers where appropriate?

Mark RossFor many of the questions I've looked at, I see people saying that the algorithms or parts of the implementation will be 'slow', but no one seems to follow this up with performance figures for a 'typical' run of their favorite algorithm and/or implementation. If you're going to criticize the run...

 
1:45 AM
Anyone good at regex?
 
more or less
 
This question might benefit from some regex. I'll find the appropriate Objective-C methods if you want to post a regex answer.
3
Q: Replacing occurrences in NSString and NSMutableString

user3478869I ran it and it's working, but I just want someone to double check that I followed the directions. Any suggestions or corrections will be appreciated. Assume you have a NSString *str object containing some text. Write a code fragment to create a new string with all substrings "aaa" deleted....

 
@nhgrif stringByReplacingOccurrencesOfString is something provided by NS?
 
Yes.
 
this looks too simple for regex IMO, if that works I'd stick with it
 
1:50 AM
I think you're right. I don't want @"aaaa" to be replaced with @"a". Can't get my head around it how to stop that from occurring. — user3478869 46 mins ago
 
yeah i just read that
that doesn't make sense to me given the question
 
Can regex solve that problem easily?
 
not clear to me what he wants exactly
"aaaa" wouldn't be replaced with anything
 
delete "aaa" but don't turn "aaaa" into "a"
Which is what stringByReplacingOccurencesOfString: would do.
 
so... he really wants "<word boundary>aaa<word boundary>" replaced with ""?
 
1:52 AM
Yes.
 
/\baaa\b/
 
Do you want to post the answer?
The regex answer
 
nah, I'm good ;)
 
Okay.
 
but \b matches a word boundary in regex, that's probably what he wants
 
1:53 AM
so, it'd replace @"aaa," with @"," still, right?
but @"aaaa" would be left untouched
 
yeah, it should, lemme check
yeah it works
try this in browser console:
"blaaa aaa aaaa caaat".replace(/\baaa\b/g, "")
i wonder if that's really what he wants either, leaves a double space in there
 
2:09 AM
@nhgrif +1, but assuming this is his homework and the quoted thing at the top was his assignment, I wonder how he knows "aaaa" or "goaaat" or whatever shouldn't get replaced. Feels like we're not getting the whole picture.
also the indentation in your answer makes me want to strangle someone, is it normal to align it on the colons like that?
 
@nhgrif You have some catching up to do ... ;-)
 
2:44 AM
@DaggNabbit Yes. Xcode does it for you automatically actually.
It looks better when you get Xcode's syntax highlighting with it too.
 
3:02 AM
@nhgrif how do you quote people like that with the links and everything?
oh, he's gone
 
@DaggNabbit Gunna test this...
@DavidHarkness closure compiler with advanced optimizations will preserve the name create when you write it like that. Those no-op statements in the ctor are there for closure too, going to annotate them later. — Dagg May 25 at 23:34
Yes, that's it
When you see a comment, it has a timestamp next to it. Click that and you get an anchor link. C&P that in chat to get it formatted
 
 
1 hour later…
4:27 AM
0
Q: Short XML parser

Curtis J.This is my first code in C# ever. It compiles and works as intended (not complete), but I want to see what I'm doing right and wrong as a first-timer. using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using S...

 
5:00 AM
@AlexL nice, ty
 
5:48 AM
@Mat'sMug - I thought I saw a ghost:
@tchrist you're missing ghost-buster ;) — retailcoder 20 mins ago
 
6:46 AM
> deleted by Jamal 3 hours ago.
but no red background :(
 
7:40 AM
Monking
@nhgrif Do we really need both string and nsstring? Are there any functional differences? Does ObjC have a regular string?
I gotta pimp this. Many good answers on it that I think have got too little attention (including mine):
6
Q: List all possible numbers from a given array that sums up to a given number

user3371223I have to solve the following problem: Given an array of integers and given an integer value, list all possible numbers frm the array that sums up to the given value. Example: Input: array = {1, 2, 2, 3, 4, 5}, int N = 5 Output: {1, 2, 2}, {1, 4}, {5} {2, 3}. This is my solution: import java...

 
8:09 AM
0
Q: Just saw this code in RichFaces, isn't this redundant?

user3280015I just saw the following JavaScript function in RichFaces: var curry = function (g, a) { var _g = g; var _a = a; return function (b) { _g(_a, b); }; }; Isn't the definition of the local variables _g, _a entirely unnecessary / redundant here as function arguments are imp...

 
8:48 AM
monking
@SimonAndréForsberg What, online that early?!
 
@skiwi Yup. Me and my cousin had a competition: Who can get up the earliest?
I won for today, but he was not far behind. Just a matter of minutes.
09:22 a.m. for me.
The earlier you get up, the more you can code during the day.
 
haha nice one
 
0
Q: How many semi magic squares are there?

user2468587i want to write a program to work out how many semi-magic squares are there. here is the definition of semi-magic squares if we define $H_n(t)$ is the number of semi magic squares which satisfy: the square is n*n dimension sum of each row elements and sum of each column elements equal to t ...

0
Q: Printing simple SQL comparsion

m.edmondsonI'm comparing two variables which I'd like to be printed to the console like so: ==Full Ex Vat== true Currently the code to do this is: print '==Full Ex Vat==' print case when @aTotalExVat = @sTotalExVat then 'true' else 'false' end which I feel isn't as elegant as it could be. Any tips?

 
I got up at 8.45, so beat ya all!
YES
> You earned the badge.
3
I had no clue it was coming
 
Congratulations!
 
8:58 AM
Thanks a lot-ions
Hmm SO is also interesting
visited 419 days, 237 consecutive
 
9:09 AM
I should start working on my 40+ tabs of things I should still read on CR, which seemed interesting
 
@skiwi And don't forget to , ,
Aim for the Electorate badge!
@skiwi And don't forget about your 200+ tabs of other stuff....
 
I'll remember
@SimonAndréForsberg Hey remember, my browser crashed some week or two ago! Now it's mainly CR that's giving those open tabs
I just got 158 open right now!
wtf how is it 158 again?
 
@skiwi That's 42 less than 200.
 
I see there is some other tabs open as well
 
9:25 AM
Haha, I have a popular question on French.SE :D
 
9:50 AM
0
Q: Verilog coding practices for synthesis

Shreyas VinodI'm having a hard time figuring out if the code I wrote is purely combinatorial or sequential logic. I'm designing a simple 16-bit microprocessor (will be implemented on a Spartan 6) and I'm new to Verilog, HDL and FPGAs. The code for the microprocessor is complete, but I'm having second thoughts...

0
Q: C# Search-Algorithm for specific values in a 3D array/matrix being super slow. How to fix it?

StefI'm trying to create a code that reads a text file (containing (double) numbers between 0 and 1) and filling up a 3D array/matrix (calling it matrix from now on) with those values. After that is done I need to figure out the current max-value inside this matrix and then look at the values around ...

0
Q: Name for Grid-O-Edit element

DmitryI have a region on my screen which can display either a grid or a maintenance screen for the selected grid row (when it double click'ed). The mode is managed via Grid-o_Edit.Mode property. How would you call such a dual aspect element, I'm looking for something nicer than grid-o-edit (other opti...

 
10:05 AM
Monking!
 
Hey :)
 
Its breakdown day for me, breaking down all my code into manageable chunks and securing it, its going to be so much fun! ;)
 
Also called: Refactoring
 
Thats the word!
I couldn't think of it
thanks
 
The most productive days are those where you remove more code as you write.
 
10:13 AM
"Access is denied" when using an elevated command prompt
wat
 
@JeroenVannevel Needs more elevation
 
@skiwi Finding myself doing that a lot today
 
finally I have network :D
noon @all ;)
 
I put my trust in the hands of a reboot
and lunch
lunch fixes everything
2
 
@CaptainObvious Trying to think of a good comment for that question
 
10:25 AM
I learned something new!
If you hover over a message having a reply-to, then it will already subtly highlight to which message the reply to was.
I used to click on it to see the bright yellow to fin dout which message it was
 
I learned something new ^^
Best practice / program to structure / design an application? @ me please
BBL
 
Physicssss
 
10:55 AM
0
Q: Javascript OO Design for tic tac toe program

abbieI am practicing Object oriented design. So I have taken Tic Tac Toe as an example. I have written first all the requirements and then started writing code. I would like to get it reviewed so that I can improve my skill further. Please provide suggestions. I have placed code at github repo

 
11:11 AM
rejoice, the reboot fixed it!
Or the lunch, could be either
 
@SimonAndréForsberg Best practice / program to structure / design an application?
 
@CodeX What is your question exactly?
@JeroenVannevel Probably the lunch
 
In your experience, what is the best practice to structure / design an application do you use a program or just write on paper or a word doc?
 
@SimonAndréForsberg No, ObjC does not have a "regular" string other than C's string, which is virtually never used in ObjC.
 
Ive always just wrote down what i need in the order of importance and gone from there, i was wondering if there was a best practice to structure, if that makes any sense
 
11:15 AM
NSString is to ObjC exactly what the String class is to Java.
 
@nhgrif Which is why I think the would be enough. Strings as strings. No matter what they're called.
 
Swift has a regular string though, and will still be using NSString when it makes calls to Foundation methods.
 
@CodeX Design: I stink at design. Code structure: Write down the classes you need and determine the connections between them. Code the interface of them first, determine what methods each class should have. That's how I do it.
 
And what do you write all this down in?
 
@nhgrif I can understand that SO separates and , but on Code Review? I can't really say that we have that many string questions. Or ObjC questions.
 
11:20 AM
I'd suggest to split up your application in a few key components, and then decompose those further down, and start building them at some point.
Writing down can be in anything, even notepad.
 
So we may as well get rid of then.
 
@nhgrif That I did not say. We have 180 ObjC question, it's a big language. Of course it needs it's own tag.
 
There are probably more than 1 questions if I go through them.
 
But does this question really need those NS-specific tags, or would the tag perhaps be even better?
@CodeX IRL Paper, Eclipse, Notepad. Pick one.
 
0
Q: New to OOP and need criticism and feedback on first attempt at making a user class

r3wti've just begun creating my first user class. First, i need some clarifications. If i construct all of my variables in __construct(), am i correct in assuming that i will be able to fetch the object later by returning $this from the public method get_user_object() ?. I'm trying to avoid manually...

 
11:23 AM
@skiwi @SimonAndréForsberg Thanks, i use notepad++, i wasnt sure if there was an application i could use or any tricks to getting a better structure
 
@nhgrif There are three questions tagged with and . Before you re-tag though, if you want to do so, I think we could bring it to meta.
 
@SimonAndréForsberg Paper? Whats that? :/
 
There's a massive difference between working with an and a . Moreover, in Swift, there will be a big difference between working with a and a . Just as there's a difference between working with an and a .
 
@nhgrif And yet we don't have .
 
@CodeX There's always better ways at designing... But you don't always need them in my opinion, maybe experience at some point will tell I'm being dumb now
 
11:25 AM
There are also no questions (to my knowledge) tagged and
 
@skiwi Ok, i understand, ill go work on my structure / design, thanks
 
Then I'll go fix them.
 
Just because there's a difference in working with them doesn't necessarily make it deserve separate tags IMO.
 
This question already had even...
No complaints about that tag?
 
11:28 AM
I don't really see the difference between and ...
 
So are you suggesting eliminated ALL class-specific tags?
 
I would like to hear more opinions about all these NS-tags though.
Depends on what you mean by "class-specific" tag.
 
A tag that is about a specific class from the standard library of the language.
That's what these are.
 
My argument is that a Dictionary in C# is just like a NSDictionary in Objective-C. Same thing, different languages.
 
But in C#, the class is called dictionary.
 
11:30 AM
We don't have a , even though that's one of the most used Java classes.
 
And people seldom try to reimplement it
Monking all
 
We do have but that's mainly because there's so many people that seem to get some kind of strange satisfaction by making implementations of that.
Monking @rolfl.
 
@SimonAndréForsberg What simon says ....
 
If I implement my own dictionary class in Objective-C, I'd tag it
 
and it should be tagged as something helse, like
 
11:32 AM
If I have a question in which NSDictionaries are heavily used, I'm tagging it because to answer the question most likely requires some intimate knowledge about how the class works.
 
Is an arraylist even a data structure? Or does it have a more scientific name? Like random access list, but it sounds long
 
@nhgrif I think the question probably needs more knowledge about how Dictionaries work in general than how the NSDictionary-specific class works. If you know how Dictionaries work in general, then you can probably make a qualified guess about how NSDictionary work.
 
I don't know enough about other languages, but the NS collections all have entire subsets of built-in methods for mutating them into other NS collections.
 
@skiwi An array-list uses an array internally.
 
Simon, that sort of thinking builds bad Objective-C programmers.
 
11:35 AM
@nhgrif By that logic, all questions that use Strings a lot should be tagged .
 
@nhgrif I believe many languages have something similar. It's usually easy to transform one collection to another.
 
Okay, and these are class-specific methods, are they not?
 
Depending on the language.
 
@nhgrif Not really in many cases.
 
The point here is, google "nsdictionary". Tell me what the first link is.
It's a link to the official documentation.
 
11:37 AM
Java has a 'utility library' for them, or a constructor that accepts other collections
 
@nhgrif I'm not an Objective-C programmer. But please explain why.
 
Google "objective-c dictionary" and there's some helpful links, but the official documentation isn't on the first page.
 
@SimonAndréForsberg That's implementation-specific, I think linked-list exists because of how it works, not neccessarilly the implementation... I doubt anyone cares about array-list using an array, they want O(1) access time ultimately
 
@nhgrif That probably means that the documentation is not what people click on when they google it.....
TTGTW
 
@nhgrif That's because they named the class differently. We can't do anything about that.
 
11:39 AM
No, what it means is that people google for "nsdictionary" when they know what they're looking for.
Because two things make you a good Objective-C programmer.
 
Adding totally irrelevant NS to every class would quite annoy me... Unless they have a very good reason. Else we'd have JString, JMap, etc.
 
@skiwi I mean the java.util.ArrayList. An ArrayList implemented without using arrays is probably not called *Array*List.
 
1) A strong C-foundation. 2) The ability to read and understand the official documentation on all of the Apple classes.
Because the classes are extremely complete and extremely well documented. Before you spend more than 5 minutes writing some code, you need to check the documentation to make sure there's not a method that will do it all for you. That's Objective-C
 
@skiwi JButton, JList.... Which naming convention they now thankfully have dropped in JavaFX.
@nhgrif I don't many similarities to Java there...
 
A good ObjC programmer working with dictionary has more than just a concept of how dictionaries work. He's got most of the NSDictionary methods memorized and the rest are an Alt-Tab (Cmd-Tab) away.
gotta run to work
later
 
11:44 AM
@nhgrif A good Java programmer working with Map has more than just a concept of how dictionaries/maps work. He's got most of the HashMap methods memorized and the rest are an Ctrl+Space away.
 
I really don't see what this last discussion added.
What makes ObjC more special than Java or any other language in treatment on CR?
 
Welcome to Code Review! Unfortunately what you posted here is not a codereview, but an advertisement. I am sure you could tell OP directly, how he can improve his code, and not make him go all the way via twitter, youtube and msdn. Read through other answers to see what we expect from an answer. btw. you can always edit your answer. — Vogel612 20 secs ago
 
@skiwi They have different names for their classes... That's it. At least as from how I understand it.
@Vogel612 I skipped that one. Couldn't tell how helpful the answer is or not. You may be right about it.
Hmm... looking at the answer again, I think you are right about it.
 
@SimonAndréForsberg well It's not a review of op's code it's some: "implement it like [random (anti-)pattern] and write me on twitter if you have problems"
 
Flagging as NAA
> Entity Framework supports Stored Procedure mappings out of the box and it is possible to implplement a generic repository using the Unit of Work pattern.
^^ That part might be helpful. But it's a comment at best.
 
11:57 AM
also flagged as NAA, was tempted to flag as advertising / spam, but that would prob have been to hard.
 
This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have sufficient reputation you will be able to comment on any post. — BeetDemGuise 1 min ago
Seems like more people agree
 
$page = $_GET['page'] THEN include($page); << Am i right in saying that this would be safe as long as i check in_array(); ?
the array would be the whitelist..
 
@CodeX I think so. But don't quote me on that in case anything goes wrong.
 
12:12 PM
@CodeX you should probably check it... Don't trust the request
 
$pagearray = array('dashboard', 'article', 'video', 'app');
if(in_array($page, $pagearray)) {
include_once($page.'.php');
}
else {
include_once('404.php');
}
That would only include if its in_array() is there any way to hack that?
I really need to use dynamic pages
 
1
Q: Pythonic way for double iteration (list all files with extensions)

ProfHase85Given a base path and a list with extensions the task is to list all files: Two of my solutions are: from glob import glob from os import path EXTENSIONS = ['*.zip', '*.jar', '*.pdf'] DOC_PATH = '/path/to/files' # Solution1: files = [] for ext in EXTENSIONS: files.extend(glob(pat...

 
In Java I'd write an enum holding the input name and the output page... but I don't see easy possibilities for that in PHP
 
if(in_array($page, $pagearray)) {
include_once($page.'.php');
}
I cant see how this could fail..
I could well be shortsighted
 
12:16 PM
I don't think it would fail true
 
Seems to work..
 
12:31 PM
Sure sucks when your code crashes on some internal Sqlite.c Assertion
 
Sounds tough.
 
I started off with a new solution to get a Proof of Concept going first
now I'm using the same code in my actual library and it gives this random stuff
I'll cry soon
 
Crying is not always the worst solution.
 
12:47 PM
0
Q: How to fix bug of not clearing an input vector if it is the same as the output one?

thedarkside ofthemoonI have a function that has two vector parameters. It takes just some elements from the "input vector" and add them to the "output vector". It looks like this: void foo(const std::vector< MyObj >& myObjsIn, std::vector< MyObj >& myObjsOut) { for (size_t i = 0; i < myObjsIn.size(); i++) { ...

 
1:00 PM
OP added the code. Re-open please.
2
Q: Javascript OO Design for tic tac toe program

abbieI am practicing Object oriented design. So I have taken Tic Tac Toe as an example. I have written first all the requirements and then started writing code. I would like to get it reviewed so that I can improve my skill further. Please provide suggestions. I have placed code at this github repo. ...

 
I feel as if my test suite randomly chooses whether or not it wants to run a test
Sometimes I have to attempt to execute it 3 times and toggle a breakpoint for it to do its work
 
You've earned the "Necromancer" badge (Answered a question more than 60 days later with score of 5 or more) for "Show days of single week - the right way?". YEAH!
3
 
@Malachi Nice!
 
@Malachi Half of my silver badges are badges :/
 
only 2 Necromancers for me
 
1:13 PM
I've got 7 Necromancer, and 8 Revival, but it seems your silver badges are better than mine :p
Generalist & Taxonomist. That's something.
 
@Malachi I got that exact same thing...
 
took me a while to get generalist...lol
 
@Malachi Sorry, i mean i got the Necromancer for the same reason
 
monking
I keep getting votes on my answers for this post
13
Q: RPSLS Game in C#

MalachiI went with what I know and can use well, not what I know and can't figure the syntax out to make it look good. so please enjoy the code and prepare to school me (probably in the basics) in C# public static void Main (string[] args) { /* Here are your rules: "Scissors cuts paper, ...

pretty much straight out of the blue
 
@BenVlodgi Must be good answers then :)
 
1:25 PM
monking!
 
@Mat'sMug Monking :)
 
Monking!
481 Simons on the wall, 481 Simons on the wall...
Don't take one down and don't pass it around, because that would hurt.
 
hehe.. and counting.
 
481 Simons on the wall, 481 Simons on the wall...
Put one up after you've passed it around, but please don't make it hurt.
 
@CodeX I can accept that
 
1:38 PM
@CodeX Nice
@BenVlodgi Nice, I need to find my code for that again after I do some more reading and up my "game" a little bit more
 
enums this time :3
 
maybe even some linq?? IDK we will see where new knowledge will take me! lol
 
1
Q: Longest common substring problem solution in Perl

OleksiyI was googling thru Perl community to find out appropriate solution for Longest common substring problem. It turns out, that there is no ready-to-use one: String:LCSS appears to have bugs have been already reported for. Algorithm::LCSS works with sequences. Thus, it will introduce overhead on s...

 
Hello, world!
 
Monking @Phrancis.
 
1:45 PM
return subsiteName + i doesn't look right? what does it return if you run this code? it looks like you haven't actually written the code yet, and don't know if this code will run at all.... — Malachi 8 secs ago
 
The posts here really really deserves more votes:
6
Q: List all possible numbers from a given array that sums up to a given number

user3371223I have to solve the following problem: Given an array of integers and given an integer value, list all possible numbers frm the array that sums up to the given value. Example: Input: array = {1, 2, 2, 3, 4, 5}, int N = 5 Output: {1, 2, 2}, {1, 4}, {5} {2, 3}. This is my solution: import java...

 
Napalmed ;-)
 
ditto
 
@Mat's you two-timing ELL ghost-hunter!
 
Ditto
Good news, everybody! We managed to move basically all the furniture (save for one gigantic book shelf we will get later) yesterday, and we are now waiting for the electric company to turn the power back on, hopefully today. They said up to 2 business days so who knows but with luck we will be moved in tonight.
 
1:59 PM
I do not envy you.
Hope the new digs is nice though ;-)
My back is sore just reading that.
2
 
I twisted my back really funny moving the mattress, very sore this morning :/
 
@Phrancis My brother and his wife and kids moved to a new house about 1-2 months ago, I also do not envy you. It is a nice feeling when all is done.
Speaking of hamburgers, I love my OCD vote query
@Mat'sMug I removed one of myself for you. Can't stand having rep that ends with 1.
if (rep % 5 != 0) doOCDvote();
2
 
@tchrist you're missing ghost-buster ;) — retailcoder 9 hours ago
that? ;)
@SimonAndréForsberg feel free to start a 500pts bounty anytime! :)
 
@Mat'sMug Maybe when I've reached 20500 rep :)
 
@SimonAndréForsberg what is the meaning of this ParentId column? Never really paid attention to that
 
2:06 PM
This sounds like a @Mat'sMug answer:
7
A: Global data singleton

almaz Singletons are evil Even if you do want to use it, use Lazy<T> instead of manually doing double-checked locking Best solution would be to leverage IoC container to inject dependencies you need.

@Phrancis All answers have their question as parent.
 
Ah. Makes sense.
 
In other news, seems like comments and question votes is on it's way up: data.stackexchange.com/codereview/query/164523/…
 
@SimonAndréForsberg I prefer my one-vote-short query, even if it does not help your OCD....
 
Good idea, it's been a while since I visited that one!
Whoa, holy mother of MathJax!
5
A: Determining numeric palindromes

Emily L.I do not do C# but I can offer another way of approaching the problem: As our range of numbers is \$[100\cdot100, 999\cdot999] = [10000, 998001]\$, assume a palindromic number on the form \$abccba\$. The largest \$abccba < 998001\$ is \$k = abccba = 997799\$. We need to determine if \$k\$ can ...

 
1
Q: Bouncing square in a box

IlyaI wrote my first animation in Java FX and would like a code review. I created StackPane with Rectangle. Rectangle starts to move inside StackPane to right-bottom direction and changes direction after hitting the StackPane bound. Please review the code that moves Rectangle. Is it a correct...

 
2:20 PM
Santa Came for a couple of people. more to come later
3
 
0
Q: Find two unique integers in sorted array (Java)

user3371223I have to write the following method: I have sorted array of integers and in this array every integer repeats twice, except two elements. Find these two elements. Input: 1, 1, 2, 3, 3, 4, 4, 5 Output: 2, 5 This is my solution in Java: private static int[] findUniques(int[] arr) { int[] res...

 
Welcome to Code Review! Have you tested your code? — Simon André Forsberg 9 secs ago
 
@SimonAndréForsberg Testing??
What is that utopian word?
 
@skiwi I got Exception in thread "Timer-0" java.lang.IllegalStateException: Not on FX application thread; currentThread = Timer-0 when trying to test the code.
 
I haven't tried to test though
 
2:30 PM
0
Q: Decoding custom network packets with python using twisted

majidarifThis server require fast decoding of packets from clients, as I am expecting 5000 concurrent clients that is sending packets possibly every second. This is a game server. I want to see if my implementation is fast enough or there are still room for improvements. def dataReceived(self, data): ...

 
With our combined skills we should come up with a function for world peace / domination.. Whichever comes first..
4
 
I'm sorry but I don't believe this code is working correctly (because of Exception in thread "Timer-0" java.lang.IllegalStateException: Not on FX application thread; currentThread = Timer-0). You ask "Is it a correct implementation of a Java FX animation?" and I don't think this is working as expected as you say. I would love to help you clean up some things in the code, but it is better if you fix the problem first. If you search for "Not on FX application thread" you should find a solution. Please come back and update your code here once you have fixed that problem. — Simon André Forsberg 15 secs ago
public class CodeReview implements WorldPeace {
    @Override
    public void peace() {
       CodePeaceUtils.makeCodeNotWar();
    }
}
3
 
Can spoiler tags collapse?
I wouldn't mind putting a "my version" in an answer, but I don't want it to be fully visible.
 
@skiwi No, spoiler tags cannot collapse.
 
Oooo I just earned my first Nice Question badge :D
4
 
2:42 PM
@Phrancis NICE!
 
@Phrancis congrats!
 
@Mat'sMug should have gotten a couple of badges as well....
 
hey, thanks @Santa!
 
@SimonAndréForsberg Aw... Then I guess I won't put my version of the code up in a whole
Holy cow, my answer is longer as expected
0
A: Searching for songs on an Android application

skiwiIn general the code seems fine and it is not horrible or anything, but I think you could surely have improvements. High level Currently your code returns null if audioCursor == null, I think this should be an exception, possibly an existing one, or a custom one. I'm not exactly sure what it doe...

 
0
Q: Livelock or a Deadlock

GoranI'm preparing for Java SE 7 Programmer II exam. In one of the mock exams there was an exercise to name from what threading problem does the code suffer. This is the code: public class Test { public static void main(String[] args) { final Counter obj1 = new Counter("obj1"); final Counter...

 
2:52 PM
Hmm, I'm not sure if I'm too happy with this:
1
A: Find two unique integers in sorted array

AlanTFor each number in the list, either there is no next (at end of src list) - add to result list the next is different - add to the result list, increment result count (if all answers found, return) the next is the same; skip next, (add 2 to src pointer) public int[] findUnique(int[] src){ ...

It doesn't really review his code at all, it just gives an alternative?
 
@skiwi He does explain his answer a bit though. It's not the best answer I've seen but it's better than some others.
private static int[] findUniques(int[] arr) {
There's that Scottish notation again!
2
 
arrrr
 
int[] arr of course it's an array!!!
 
He does explain his code... yes, but I'm still not happy with it
 
I haven't up-voted it, but I haven't down-voted it either.
 
2:58 PM
"Spotify has been paused because your account is in use somewhere else." ...What?
 
0
Q: MVC5 + EF + UOW + Services Layer where to commit changes?

ebram tharwatI'm building a web application using: MVC5 and EF Code First with Repository and Unit of Work Patterns. Till now I have 3 layers: "Data Layer" which contains the repositories, UOW. "Services Layer" which has refrence to UOW to implement bussiness logic and bussiness validation. "Web Layer" whic...

 
DECLARE @var VARCHAR -- note: this is a variable
 
What on earth...
44
Q: Draw with your cpu

bebeI have come across an article where students used network traffic to draw their university on the country's ipv6 graph. [image] Your goal is simple to tell but hard to implement. Draw the text MAIL (as it is one of the few words that can be read on a 1D graph) on the cpu graph. It should look ...

 

« first day (429 days earlier)      last day (3581 days later) »