12:12 AM
Bah, why can't I use the word "improve" in the title of my question about improving my code

Because, that word is disallowed ;-)
everything on CodeReview is about reviews (blocked) or improving(blocked).

Lousy rule

Hmm okay
"My animation code is lousy, help me fix it"
How's that

And 2014Q2 begins!

12:16 AM
Still have a few more hours here

Stack Exchange runs on UTC.

Yup, look who's top of the quarter rankings !!! ;-)

Holding the #1 position was fun while it lasted: codereview.stackexchange.com/…

12:53 AM
1

A brief background, I'm working on a game prototype for a simple strategy game. After I created a number of possible jobs I wanted to create something to manage them. This is the first time I've attempted something like this so code review would be helpful. I created a set of methods that adds...

that sieve question got jumped on

1:12 AM
0

This question is a follow-up to a previous version of this program, which I wrote because I found it annoying that VLC Media Player (which I love) prevents the screensaver from starting after playback of media has ended on my Ubuntu 12.04 system. There have been several changes which are listed ...

@rolfl thank you

0

When a user presses a key in my game, their avatar can move down, left, right or up. By move, I mean their avatar animates while various other things move around them on the screen. This is accomplished by raising an event from the input handler. The Player class listens for this event, finds the...

1:29 AM
Stack Overflow really is hard to get votes on...
0

This is homework, so I'll just get you started. #include <stdio.h> #include <string.h> int main(void) { char *buff = "this is a test string"; char* substr; strncpy(substr, buff+10, 4); puts(substr); // prints "test" } So for your pyramid problem, you will want to take the subs...

@syb0rg upboated

@PatoSáinz Ahh, thank you!
But now I got randomly downvoted, with not comment...
And they wonder why people hate SO

1:48 AM
lol

Now people are trying to criticize my code, when I know it works and how it works.
I made the mistake of second guessing myself and changing it for a bit. Now I've reverted.
And now I have a negative score...

It was interesting to see how many downvotes (sometimes even without upvotes) has the moderator candidates cast there in the last election.

2:12 AM
I'm back.

2:24 AM
Hey guys I appreciate the upvotes but suggestions for improving code would be better ;)
w/b Jamal

@Koveras Keep in mind that the more code you include in a question, the longer it takes to review.

Alas
I guess I will need to be patient, not my strong point

3:12 AM
0

This is my code for a server using EAP (Sockets). Is AsyncOperation.Post is the right way to raise thread safe events? AsyncOperation.Post states: Invokes a delegate on the thread or context appropriate for the application model. PS: Is there any other mistake in the code i.e something t...

4:07 AM
0

I'm trying to write a javascript library to allow inheritance with knockout. The fundemental problem when implementing inheritance in knockout is that each knockout observable is it's own instance, thus if you try this: x = function () {}; x.prototype.m = ko.observable(); y = function () {};...

4:19 AM
0

I am working on a project involving the unique partitioning of integers. I.e. I am looking to have all of the partitions of n = x1 + x2 + x3 + ... + xk, where xi = xj implies i = j. For example, if I give my code input of 10, I want to have as output (in an ArrayList>) the following: [[1, 2, 3, ...

5:15 AM
Unicoins!
8

I have more rep than everyone! :D

I almost fell for most of it.....
check out the SQL tag..
does it show up with my avatar for you guys?

It's only visible to you.

oh
I hate April fools. next your I am going to buy some annoyatrons from thinkgeek and get some people

Should I post my unicoins hack for review? :)
4

5:30 AM
LOL

I'm seriously considering doing it - maybe leave out a single part, just to make it a little less spoiler'y...
Anyway, point is that a few lines of JS in the console, and those rocks mine themselves as soon as they appear

have fun I am going to eat some popcorn and watch a tv show and fall asleep...I was just checking to see if the modem reset fixed my internet and saw that
@Flambino give to me!!!!

@Malachi I'm still not sure I should...

I am outta here I was just playing.. maybe tomorrow towards the end of it all
goodnight all

@Malachi 'night

6:02 AM
Monking!

6:35 AM
0

I have a content provider in my app and I really don't like it :-). The provider is created after reading number of articles like the official one and this unofficial one. What I really don't like is the amount of duplication in the provider class (see very stripped down code below). Even for tw...

M'lorning all!
Our April fool's should be that everyone starts posting linked lists implementations on CR!
3

Oh boy...

If I only had spare time for that...

7:00 AM
0

Given an expression string exp, write a program to examine whether the pairs and the orders of “{“,”}”,”(“,”)”,”[","]” are correct in exp. For example, the program should print true for exp = “[()]{}{()()}” and false for exp = “[(])” Complexity: Time complexity: O(n) where n is length of th...

Just finished one Java question and now there's two more? Is this Christmas?
@skiwi Or we could create a "simple calculator", when reviewing one yesterday I realized that I've never made one.
@Jamal Did you sleep well tonight? :)

@skiwi done! :-)

0

As suggested in the 2nd monitor, I'd like to put some code to do an in-place reversal of a linked-list up for review: #include <iostream> struct node { int data; node *next; }; node *reverse(node *list) { node *prev = NULL; node *next; while (list) { next = list->...

@SimonAndréForsberg Gotta finish homework...

@JerryCoffin Well done :)

7:07 AM
Nooooooooooooooooo!

@SimonAndréForsberg A calculator implemented as a linked list?

@skiwi Oooh, now we're getting somewhere...

Is that actually possible? :D
Is there something more I could add...

@Jamal Darn! I was hoping for more "o"s than that. I think the Darth Vader scene still wins.

Well, I can create the tag just for this (it's 25 characters).
Even better, we should give out a prize for the, say, 1000th linked list question asked. :P

7:11 AM
@Jamal Beat you to it.

Luke, I have made a LinkedList

hrm, wonder if I still have some linked list code lying around...

I assume we'll burninate this tag at the end of the day?

Meh. Unicoins are scriptable

7:13 AM
@Jamal Only if I get at least one badge first!

Yeah, if it's tagged with 50 questions.

@Jamal I can do that... :-)

maybe I should post one with template <typename T> using my_list = std::list<T>; int main() { my_list<int> m; }

I wonder, was it overkill to post two answers to this question? Should I merge them into one?
0

This answer will focus on general style of your code. Use constructor chaining. One of your constructors can call the other one, like this: public StackExchange(int num) { this(new BigInteger(String.valueOf(num))); } This helps removing a bit of code duplication. Declare by interface, no...

@JerryCoffin Well, if it helps increase site activity and awards more rep...
If I have time, perhaps I can slap together a silly linked list implementation. Something that works, of course.

7:17 AM
@Jamal Skip editing for a while, and you'll have time for two or three.

Monking everybody

Hey you! :)

@JerryCoffin It's classes that may take much time. I can look into it if I don't have much homework.
I just know someone is gonna flip out when they see this new tag.

hehe

@Jamal Flip 'em if they can't take a joke!

7:25 AM
We could start by giving it a tag wiki.
@JerryCoffin: Someone's trying to remove the tag.
(I knew it)

@Jamal Rejected, Dejected, and Ejected.

Rejected, detected and erected? What the hell did I just read...

@skiwi Only what your filthy mind decided to see.

@JerryCoffin I wonder if you should've given it a custom reason. Oh well.

@Jamal I thought "too minor" was fitting...

7:32 AM
Erected doesn't have to be like that. Perhaps you're the one with the dirty mind, Jerry Coffin. :p

@Corbin I'm insulted at that suggestion! My mind is not dirty--it's downright filthy!

Hah

@JerryCoffin It is, but eh. Maybe others will realize that it's just a joke (at least after the reason behind this tag is mentioned).
I don't think I even want to know how you erect a suggested edit...

It requires quite a bit of care. And lube. Lots and lots of lube.

@Jamal Well, "erect" is basically the same as perpendicular.

7:37 AM
"so in principle, this is possible?" hahaha

Oops, I killed the chat.

nvm ....

@JerryCoffin: Did you seriously not use delete here, or is it part of a joke? :-P

7:55 AM
@Jamal "That's a great question!" (Am I the only one to notice that when a speaker starts an answer like this, they never actually answer the question they just said was great?)

I'm writing an answer anyway. What we see is what we review.

Damn, I forgot how to delete something like this. Blasted raw pointers...
On the other hand, you can do a self-answer for it for a badge.

By encapsulating that crap in a list where it belongs :p

@Jamal Imagine me with a purely seraphic smile (since you don't want to think about me as I really am...)

8:06 AM
Can you all upvote this gripe?
0

In Optimizing unique partitions of integers, I just want to write the quadratic equation nicely. Having to resort to ASCII art to do so is just ridiculously frustrating! _________ -1 ± √ 1 + 8 n x = ————————————————— max 2 Have I mentioned th...

I'd like to go back to the SE Devs with a formal request for MathJax.

It certainly would be nice... I've written a few questions that could have used it. Nothing worthy of the gripe wall though.

@Jamal If at least a few stones remain unturned long enough, I might.
There's certainly plenty about the code that deserves critique.

It took me much longer than I would like to admit to realize that it's now April Fool's day. My first thought was just "who killed Jerry and stole his SE account?" :D.

Here goes nothing:
0

You don't use delete after allocating nodes with new, resulting in a memory leak. As a general rule, delete should be used in the same way new was used. In this case, have an identical for loop and use delete on each node: for (int i=0; i<10; i++) { delete n; } With these two loops, you...

Thanks. For now, I'm off to bed. Unlike some people, I need sleep.

8:14 AM
Goodnight!

:-)

Night

Night you guys across the big pond.

waits for Corbin to suggest using std::list

Hah. That was my first thought... Or at least to use a custom list instead of stringing together bare nodes. But alas... It's far too late in the night for me to write out a long ass post of stuff Jerry not only knows but knows much better than I :p.

8:21 AM
I think he was just allowing us some extra points. :-) I'm fine with that. If I have time tomorrow, I might come up with some kind of creative linked list.
And if someone recommends std::list, I'll slap them with a fish.

Hrmm, while we're doing "flood CR with lists!" thing... I have a std::list implementation I did a while back. Perhaps I should put that up on CR tomorrow. Could be my first question :D

Do eet! And I guess we're using the "no" tag for these entries. Seriously, I didn't expect him to actually create it.

I think we should remove the "no" tag tomorrow at least, and just have it as an April Fools day thingy.

Yeah... The no tag should definitely not stick around very long. Considering on The 2nd Monitor has any idea what the hell is going on, it's likely to be poorly received by many.
@Vogel612 Don't worry; I'm well aware of that. I did it because there was a rather terrible implementation of std::list on CR one day and I was curious how decent of one I could make (likely not very).

8:30 AM
@SimonAndréForsberg That's why I was thinking. Also, why isn't the linked list thing a meme already? We can even mention this tag on that post.

I kinda feed sorry for the poor guy..

Me, too. I never expected it to actually be created.

8:33 AM
0

I've created a linked list class in Python, but I'm not sure how to enforce only passing Node objects into the insert routine. # linked list in Python class Node: """linked list node""" def __init__(self, data): self.next = None self.data = data def insert(self, n): ...

So it begins...
2

Oh god....

I created a small tag-wiki, feel free to improve

Hm... should we spoil the joke so easily?

you guys are so late anyway, April Fools is almost over ;)

8:37 AM
The day is almost beginning over here.

8:48 AM
In your collective opinion, do any of the answers to this question warrant an "Insufficient Explanation" warning?
11

Problem Statement Generate as many distinct primes P such that reverse (P) is also prime and is not equal to P. Output: Print per line one integer( ≤ 1015 ). Don't print more than 106 integers in all. Scoring: Let N = correct outputs. M= incorrect outputs. Your score w...

@200_success at least the accepted could should be more detailed
also that numba
and the one from Vincent.

Whose sock puppet this "@Edward"?

@abuzittingillifirca There are several Edwards. Which user number?

Oh! Ok then :)

@200_success almost all of them. The answers seem to have turned from a review into "ooo a fun challenge! here's how I would do it! giant code dump." That doesn't really fit the spirit of CR in my opinion--at least not without detailed explanations of why their own code is the way it is.
2

9:01 AM
Hi Edward.

Sock puppet indeed! ;)
I was going to do a linked list in APL but didn't have the stamina.

I simply don't have the keyboard.

@Edward Could you explain what you mean by "Too many colons"?
3

Code this valuable shouldn't be limited solely to int data. template<typename T> struct node { T data; node *next; }; The only other problem I noticed was too many colons.

@Morwenn J

10 points for first linked list implementation in assembly.
2

9:23 AM
I really should be going to bed now.
And the next question (apparently asked by Voldemort) is off-topic.

0

I have just joined my new company. In the current code-base of my new company, the coding-standards are a bit different from those I have used before. For eg. string b = "SomeMockTest"; //Current company's coding standard. is used instead of var b = "SomeMockTest"; //I used this before i...

@amon you were faster... damn you was about to write the same thing.

9:46 AM
0

I need to add comments to this perl script. I cant figure out the syntax. INPUT red green yellow blue red red red yellow yellow green blue blue green green red OUTPUT red occurs 5 times green occurs 4 times blue occurs 3 times SCRIPT #usr/bin/perl sub by_count { $count{$b} <=> \$coun...

@Simon your comment duplicates the first sentence...

@Vogel612 Just noticed... stupid auto-commenting Greasemonkey script...

@Simon shouldn't be hard to correct ;)

10:18 AM
0

I wrote an webapp recently which allowed me to export my gridview data to an excel spread sheet. This is still working perfectly on my one webapp, but now when I copied my code to the webapp I am currently busy with, I am getting errors, and I am hoping you can spot it? so before reading all the...

surprisingly that question is not a cross-post from SO...

10:39 AM
skiwi, Netherlands
5.3k 1 9 41
just went to 53K

11:03 AM
@skiwi From 5.3K to 53K just like that? Wow, that's impressive ;)

For the sake of a dot ... I have a program for that ;-)

@200_success Did you visit the link under the phrase "too many colons?" It was a link to this Dilbert cartoon: dilbert.com/strips/comic/1994-06-08

0

first let me explain what I am trying to achieve here : I am supposed to compute some results, using data from several tables, filtered by a run_id. One of these tables has about 500.000 rows per run_id, and 60 columns. All other tables have only a few thousand rows per run_id. I also have to wr...

@rolfl Monking!

11:18 AM
Monking indeed.
TTGTW

12:04 PM
*preventing 1 hour since last message...*
3

0

I am trying to write the following Linq (query style) in Lambda Expression so that I can chain and make my code more compact: var result = from p1 in defaults join p2 in get on p1.PermissionName equals p2.PermissionName into joined select new { PermissionName = p1.Permi...

Off-topic. Code not working... could be reformulated though...

0

before I go too far, is this look right? this is mostly to have a "central" place that hold a "hierarchical/structured" errors message public static class ValidationError { static ValidationError() { Prefix = "VE"; Notice = new _Notice(); Exporter = new _Exporter...

12:28 PM
hello!
(meeting, gotta run - later!)

Bye!

Morning all!

Monking!

I've name one of my D3 caracter MonkyBanana just for you :P

Hope you spelled it better than that ... :(

12:36 PM
Well I don't quite remember his exact name (since it doesn't show in interface) but sorry if I've misspelled something
In fact, I've just check and it's : MonkyBanane (monky for you, and Banane since we always saying that at work (for no good reason))
If you don't like it then you could choose the name of my next one!

@Marc-Andre Any reason it's not MonkeyBanana ?
Char limit or something?

Morning

@SimonAndréForsberg Well I'm really bad at spelling ... and Banane since it's banana in french

Afternoon, rabbit

Sorry @rolfl I now see what I misspelled :S :(

12:49 PM
All good... but, if you submitted for CR, you would likely hit the devowelinzation criticisim
2

0

I was thinking about how to implement a GPS navigation for my quadcopter. So I was writing some functions to calculate the angle between two positions (from home point to the target). Maybe someone could review this code. Because I am not very sure, whether I was calculating the geographic posi...

@SimonAndréForsberg I know right. I am impressive.
Our assembly linked list implementation yet there?

1:10 PM
What's everyone up to?

I'm preparing a presentation for tomorrow. You?

Working on a question I'll put up for review soon on CR

yes.

Ok, so only storing forward references then?

It is called a doubly-linked list when it is not
yes

1:17 PM
I cannot look in the actual implementation :p

@skiwi - I always recommend that Java folk learn to implement a List in Java, and use the standard List interface.
There are so many unexpected nuances in the API, especially when it comes to ConcurrentModificationException and ListIterators.
For the record, The Java LinkedList implementation is actually Doubly-linked, to support ListIterator.

@rolfl Are you suggestion LinkedList should be called DoublyLinkedList? As if that'd help the verbosity of the Java language...
@skiwi I'm programming with Java 8 :)

What about a TriplyLinkedList?

What would the third item be?

@skiwi I think that's called a tree.

1:22 PM
next, previous, umm...?

I'm a bit confused with the weird ordering of the List interface
I'm decising in what order I should implement..
I think an iterator is the basis of everything?

@skiwi I built a JUnit test harness for anything that implements java.util.List... it is open-source. You should 'borrow it'.

I have no clue how to deal with concurrency though...

I would start with add and put

Cool @rolfl!
size() and isEmpty() are fairly easy
@rolfl Where can I find your open source projects?
My Galaxy S4 just arrived... But linked lists are more important

I'll try to not ask too much, so that there is actually something to review...
But one thing has always been boggling my mind
Do I want to use this?
    @Override
public int size() {
return size;
}

@Override
public boolean isEmpty() {
return size == 0;
}
Or do I want return size() == 0?

if your class is final, use size == 0

@rolfl Why do you call super(); even though you just extend Object ?

@SimonAndréForsberg - artifact of class-generation in Eclipse.

ok, that explains it

1:28 PM
@rolfl And my class happens to be non-final...

@skiwi - that class is used like this, for JDOM's one list: github.com/hunterhacker/jdom/blob/master/test/src/java/org/…

Also how exactly is that AbstractTestList used?
Ah, checking that first
I'm still a bit lost, also I'm lacking some dependencies apperantly

Give me 5 minutes .... I'l pastebin something for you.

I adopted the c++ tag. That's cute.

I've got time

1:43 PM
morning

Hi!

hey @BenVlodgi

howdy @skiwi

(what happens if 2 users adopt the same tag?)

@Mat'sMug things get complicated, and we make a sitcom about it
3

1:51 PM
amazing!

Divide everybody's reputation by 10 - that doesn't seem very nice

wow mining for unicoins is painful. literally.

1:55 PM
I'm wondering if I should make my linkedlist smart or not? If I store the last node, then I can add in O(1), instead of O(n)...

There is a script to do it for you :P

@Marc-Andre isn't that cheating?

@skiwi do you have the ArrayList failing yet?

1:57 PM
@rolfl I've actually been busy with phone mainly
And when I ask my dad something while he's working outside, I end up helping him 10 minutes...