« first day (653 days earlier)      last day (3358 days later) » 

12:00 AM
[Cardshifter/Cardshifter] 1 commit. 2 opened issues. 2 closed issues. 2 issue comments.
[Cardshifter/cardshifter.github.io] 3 commits. 3 opened issues.
[retailcoder/Rubberduck] 12 commits. 2 opened issues. 2 closed issues. 1 issue comment.
[Tejpbit/CodeIT] 1 opened issue. 1 issue comment.
[Vincentyification/JavaBot‌​] 8 commits. 2 closed issues. 1 issue comment.
[Vogel612/JavaBot] 3 commits.
[Zomis/Prosit] 1 commit.
 
12:25 AM
3
A: What should our logo and site design look like?

Gábor AngyalFirst of all I really like kleinfreund's magnifying glass idea. However I think, that as programmers.SE has a logo that is not that serious, even a little funny, the coffe mug, the same could apply to codereview.SE. So what do you think about the famous code reviewing rubber duck? I am by no ...

I can't stop giggling. ^^
 
0
Q: How I can format this bash script better?

ZhigalinThis produces recursive directory listing, but it isn't very intuitive. How I can improve it? #! /bin/bash deploy () { for file in $(ls $1); do if [ ! -d "$2$file" ]; then echo ${2}${file} else deploy $2$file "$2$file/" fi done; } deploy .

 
Biased as well, but yeah, absolutely - this is an awesome idea! — Mat's Mug 1 min ago
 
I like the idea of a funny/iconic logo... just not sure the rubber duck is representative of all code reviewers lol :D
 
12:46 AM
Whoops.
I didn't spend my last vote yesterday because I overslept.
3
 
Morning all
 
Morning.
rolfl only earned 20 rep today.
He is way down the list of rep per week.
janos and 200_success both pulled off earning more than the rep cap.
Supper's on. See you.
 
Time for a weekly CR bulletin
 
Not sure if anybody is into Design side of things in this bunch but I was watching this and I kinda liked it.
Øredev 2011 - Design Composition for Developers - Robby Ingebretsen
 
1:30 AM
@JeroenVannevel I get those on Tuesday.
 
@Mehrad interesting
 
@Gemtastic, glad you liked it. I myself am an arty type of person despite the fact that, i've been dealing with programming(which is 99% logic) during most of my life. I've done most of my UIs or been heavily involved with the people doing it for us so learned so much from this.
 
I kinda come from the designer part and fell into programing, but I enjoy both and I'm self taught so new pointers and tips are always welcome ^^
 
exactly. I actually digged and found this video when Robby Ingebresten mentioned it in one of his Video's he did for Microsoft related to a tool he created called Kaxaml.
@Gemtastic Do you do WPF or non Microsoft ?
 
I do web and general graphics
 
1:40 AM
interesting
 
@Hosch250 Who starred you?
I don't want that starred.
Star this instead.
 
And by "do" I mean "I've been drawing stuff and teaching myself webdesign for the last 10 years"
I don't swear on the quality of my work :P
I do it because I enjoy it
 
@Hosch250 I did ;p
 
Alright.
 
I'm personally much more proficient at design stuff than logic stuff, at least for the foreseeable future
 
1:44 AM
I'm good at both (sort of).
Talking about UI, a problem I was having with my app magically fixed itself somewhere in the refactoring.
It wasn't working right to select menus with the arrow key, while it is now.
I think I know what fixed it.
 
0
Q: Algorithm to determine transparency for a color

GenisBy analyzing how GIMP determines the modification of the new color in order to make it look transparent with the background one, I could figure out a formula that behaves at least similarly. round(newpixel = newpixel + (bgpixel * transp) / %(transp of 255)); newpixel is R/G/B of the pixel you...

 
@Hosch250 that's the important part
 
XD
 
I think it is because before I would set the item from the UI, which would call the VM.
Now, I set the item with the UI, which both calls the VM and is bound directly to a CurrentItem value in the VM.
Whoops, premature announcement.
It is not fixed after all :(
@CaptainObvious I'm not sure this is asking for a code review.
 
2:10 AM
@Gemtastic if you wanna be successful do a lot of what you enjoy :D
 
@Mehrad Well, I will do what I enjoy either way, it would be nice if what I did was nice as well :P
 
agreed
 
2:33 AM
0
Q: Factman - A two player numbers game

Eric RochI'm not sure if anyone else has ever heard of Factman, or even where the name comes from, but my AP Computer Science teacher calls this project Factman, so that's what I'm going with. Naming aside, the game is simple. Players take turns choosing from a list of numbers. They get the number adde...

 
2:54 AM
Hello
 
hi!
 
1
Q: Wait, is that variable ever assigned?

Mat's MugOne of the inspections we wanted to implement in Rubberduck for the next release, is one that finds all unassigned variables in a VBA project. Implementing this inspection has been ...complicated (it's the most complex inspection in the Rubberduck code base so far). Here's the code: public cl...

 
"The requested operation cannot be performed on a file with a user-mapped section open." :/
 
hey @mjolka!
I ended up posting the "Extract Method" refactoring, did you see it?
 
3:19 AM
hey @Mat'sMug :) yeah i saw the q, i'm hoping to get around to it some time
 
these last two posts are pretty... meaty - take your time :)
 
i think this is ready for re-opening codereview.stackexchange.com/questions/80640/…
 
VTR'd
 
3:33 AM
this is a question for codereview.stackexchange.com — MrBearAndBeer just now
 
@Mat'sMug i am experiencing the weirdest behaviour with this code, you got a minute?
 
which code?
 
class Program
{
    private static readonly SemaphoreSlim writeLock = new SemaphoreSlim(1);
    private static int completed;
    private const string LicenseFilePath = @"C:\Users\mcollins\fakelicense.txt";

    static void Main(string[] args)
    {
        for (var i = 0; i < 100000; i++)
        {
            Test();
        }

        Thread.Sleep(TimeSpan.FromSeconds(10));
        Console.WriteLine(completed);
        Console.ReadLine();
    }

    static void Test()
    {
        Task.Run(() =>
it's throwing that exception i mentioned above: "The requested operation cannot be performed on a file with a user-mapped section open."
but almost any change to the code, and the exception doesn't seem to be thrown. changes include: removing the completed int, changing the file path to just "license.txt"
but if i understand SemaphoreSlim correctly, the exception should never be thrown in the first place
 
I've never used SemaphoreSlim :(
 
Any Javascript dev wanna collaborate with me on a JSFiddle for a relatively simple, fun little challenge? I've written code to re-create iMessage's next-word-guessing feature based on the user's past messages. I've successfully written the function to build a data structure called a Radix Tree, AKA Patricia Trie, which should then be read for each character typed into the text field to see if we can guess which word the user might be typing
 
3:41 AM
@Mat'sMug albahari.com/threading/part2.aspx#_Semaphore has a pretty good description
 
I guess that's the key here:
> Any thread can call Release on a Semaphore, whereas with Mutex and lock, only the thread that obtained the lock can release it.
..but your code looks good to me, I don't understand the weirdness '~'
 
might have to post it to SO, but that place scares me
 
0
Q: Amalgamate two toggle functions into one in javascript

daveI want to amalgamate this into one function, any ideas? function toggleVisibility() { document.getElementById('regStart').style.visibility = 'hidden'; document.getElementById('regPage').style.visibility = 'visible'; document.getElementById('facebook').src = "/images/js ...

 
@mjolka my last SO post was an question - one of ANTLR's devs ended up answering, I have to say it's been a good experience :)
@mjolka but why make a semaphore with a capacity of only 1?
 
@Mat'sMug to get a mutex that i can use from multiple threads
 
3:50 AM
> The requested operation cannot be performed on a file with a user-mapped section open.
Would you happen to have the file opened in a text editor somewhere?
22
A: System.IO.Exception error: "The requested operation cannot be performed on a file with a user-mapped section open."

RichardLooks like another process had the file open using the file mapping (shared memory) APIs. The find function in Process Explorer should be able to tell you.

 
@Mat'sMug no, but i have an explorer window open in that directory. i think that's it!
it seems having the file selected in explorer is what's causing it :|
 
well, you asked for exclusive access right!
 
afaict File.WriteAllText opens the stream with FileShare.Read permission
 
4:05 AM
but isn't it the lock/mutex causing that?
 
As we return implementation details to the user of repeat function; are we not breaking abstraction? — overexchange 2 mins ago
@overexchange What is your objection, exactly?
I don't see any implementation details being returned.
 
4:20 AM
@Mat'sMug I have.
 
@Mat'sMug turns out it had nothing to do with the semaphore. i changed Test to just be File.WriteAllText(LicenseFilePath, new string('*', 1000)); and i get the same exception if the file is selected in explorer
 
ah
 
Was hoping to get revival, but it turns out it was 28 days short:
0
A: 2048 (game) solver

Hosch250First, you are usually good about naming your variables, but you still have a few single-letter variables in here, o, p, and v, to name a few. These should be more descriptive of what they are. Second, your code would be a bit more readable if you put spaces around your operators, like for(var ...

BTW, @Mat'sMug, do you have a problem with getting this: C# Corner (@CsharpCorner) is now following you on Twitter!
I have gotten two emails in two days, but they aren't really following me when I check.
 
didn't happen to me..
 
It is being sent from Twitter.
Thanks for the vote.
Time to get ready for bed, be back in a bit.
 
4:27 AM
same here - 'night @CR!
 
@Mat'sMug 'night!
Making pretty things. Or trying, anyways.
 
4:45 AM
Back again.
@Phrancis You should read this: janosgyerik.com/taking-screenshots-in-mac-os-x
@janos I found this blog that appears to be yours: blog.janosgyerik.com/…
That says it is powered by WordPress, is that old, or are you still active there?
 
"Grab" app works pretty dandy, plus don't need to erase clutter from desktop :)
 
These are even more powerful.
I like keyboard commands better.
If I get to 5k before the site graduates, that will be all I really care about.
20k will be grand.
 
@Hosch250 Don't feel in a hurry, gonna be a while longer!
 
I'm in a hurry.
I want to pass you up.
 
Almost there!
 
5:00 AM
Just 15 more.
 
0
Q: Writing Parser for JSON String

Kevin MeredithAs part of trying to write a JSON Parser, I'm working on parsing a JSON String value. Given the following definition from Prof. Brent Yorgey's Haskell course: -- A parser for a value of type a is a function which takes a String -- represnting the input to be parsed, and succeeds or fails; if it...

 
I'm almost whipping Eric Lippert.
When a 1k user asks a question about non-working code...
 
IKR
 
5:16 AM
Just LOLing
 
0
Q: Sieve of Sundaram for Project Euler 7: Improving the Perfomance of my Haskell Solution

castle-bravoThis is a sequel to my previous question: Sieve of Sundaram for Project Euler 7: Python implementation slower than C++ and R. I am trying to implement the Sieve of Sundaram in various languages to solve Project Euler Problem #7. I have written a solution in Haskell (to which I am still very new,...

 
Hmmm, @Captain is being a bit slow...
 
1
Q: Smart as a bag of rocks

syb0rgFor my second project in CS2, I was given the following assignment: Implement a new ADT called a bag with receipts. The specification for the class of bag with receipts differs from a typical bag in the text in the following ways: The add() operation will return a unique intege...

Now he'll post.
TTGTB.
See you tomorrow.
 
1
Q: Smart as a bag of rocks

syb0rgFor my second project in CS2, I was given the following assignment: Implement a new ADT called a bag with receipts. The specification for the class of bag with receipts differs from a typical bag in the text in the following ways: The add() operation will return a unique intege...

 
5:32 AM
@Hosch250 Goodnight!
 
5:56 AM
monking
 
Good morning!
Well, good night actually... cause it's bedtime for me
Cya!
 
see ya Syb0rg
@Hosch250 yup, my old blog. The same post exists on the new one too: janosgyerik.com/building-reputation-on-stack-exchange-sites
I used WordPress before migrating to Jekyll + GitHub Pages
it's too bad there are still links to the old one
I setup automatic redirection from the old pages to the new, but it seems it stopped working at some point :-/
I should improve this article, glad you reminded
but first, let's review some code today :)
 
Eclipse keeps telling me that I have misspelled English words. Is there a way to make it not care about "non-code"?
 
don't know, Phrancis.... what are you doing in Eclipse btw?
 
Writing text content into an HTML file
 
6:13 AM
I thought maybe you're getting into Java (the most typical purpose for Eclipse)
 
@janos That's definitely still on the radar :)
The website is running off a Java webapp, which works fantastic, aside from the constant need to restart Tomcat lol.
 
that's gotta be a PITA
 
Kind of.
Anyways, someone more clever than me (@Marc-Andre) made this app, and I'm just putting stuff in it to add game content
 
0
Q: I am getting CSRF Validation Failed

VARUN SINGHALNSURL *URl=[NSURL URLWithString:@"http://s0001.webdemos.biz:82/crowdfunding//?q=services/session/token"]; NSError *error; NSString *stringFromFileAtURL = [[NSString alloc] initWithContentsOfURL:URl encoding:NSUTF8StringEncoding ...

 
@200_success When we evaluate expression repeat(square, 2)(5), the sub expression repeat(square, 2) first gets evaluated to apply_n_times(1)(square(x))which is an implementation detail. Does this not break abstraction?
 
6:23 AM
Functions are "opaque". You can call them, you can pass them around. There's not much else you can do with them. (Unless you use reflection or disassemble them.)
 
ok
So, when you say functions are "opaque", are you talking about partially applied functions?
 
7:12 AM
When I say breaking the abstraction, the user's way of calling the call expression repeat(square, 2)(5) is totally depend on how repeat is implemented. Because the user of repeat knows that repeat(square, 2) will first return partially applied function so author of repeat function is leaking the implementation details
 
monking @all
 
@200_success Ideally the abstraction would be call f(square, 2, 5) and repeat should return once with exact value 625 instead of multiple return recursive_apply? Did you get my question?
 
Why do you object to the partially applied function? What harm results from that?
 
Once a function is available to use by any user, I think her interface to outer world would be like pass me these arguments and I will give you the required result. Unlike the user of repeat has to have an implementation idea about repeat function before writing such expression repeat(square, 2)(5). One would think of writing such expression repeat(square, 2)(5) only when he knows that internal implementation will return PAF to this expression repeat(square, 2).
repeat(square, 2, 5) is an abstract way for the author of repeat to present his service.
How repeat(square, 2, 5) internally works? who cares?
 
> Unlike the user of repeat has to have an implementation idea about repeat function before writing such expression repeat(square, 2)(5).
Huh? Explain?
 
7:31 AM
If somebody provides me the module X that has repeat function defined, As a user of this function, I would think of writing expression repeat(square, 2, 5) to get the results. To write an expression repeat(square, 2)(5) I need to first go thru implementation of repeat. Am not sure, How documentation of that module X will explain the usage of repeat when it returns PAF
 
What do you mean by
> I need to first go thru implementation of repeat
and why is it a problem?
 
If a third party provides me a module X that has repeat function, How would I know that call expression has to be expressed as repeat(square, 2)(5) to assist me in performing square(square(2))?
 
That was the homework question to be solved: implement a repeat function that does just that.
Part of the point was to get you comfortable with the idea of a function that returns a function.
 
Yes You are right. My question is, When I write a module using FP in production, Do we practice functions returning functions?
 
7:47 AM
Sometimes that is the right thing to do.
 
ok
I mean, if this was the production code repeat, would you allow such code?
If no, what are the reasons?
 
Well, functional programming isn't really idiomatic in Python, because Python isn't designed to be an FP language. So there's always that caveat.
 
So, If I would implement the same logic in scheme, How would you call that function repeat in scheme?
 
In Python, you'd normally prefer iteration to recursion, for example. But there are some problems where recursion leads to a solution that is so much simpler that it's worth it.
In the same way, it's a bit rare or unnatural to return higher-order functions in Python, but there are some situations where it's just the right elegant approach.
If you want to dig deeper into the topic, read about function decorators in Python.
 
Basically I am trying to make sure that any function or class I write in any language, I would like to maintain abstraction
 
7:52 AM
1
A: Stop connecting to a server after n unsuccessful attempts

200_successThe smart and polite thing to do when retrying is to wait some random (and possibly increasing) interval between retries. The last thing you want to do to a failing server or network is to overwhelm it with connections as fast as the clients are able to generate them. In connect_to_server(), sq...

Python recognizes that higher-order functions are useful, so it has a special syntax to support functions that modify functions.
The syntax for that is a bit messy, but the principles are the same as your repeat() exercise.
I still don't understand why you fear that abstraction is being violated.
 
I feel, abstraction is violated because we return recursive_apply to the user where recursive_apply points to local function object def recursive_apply(x): return apply_n_times(n - 1)(f(x))
 
8:07 AM
So?
What can the user possibly do with it that is harmful?
The user received a function as a result. Functions are opaque. You can't do much with them except to call them.
(Reflection and disassembly aside. But that's bordering on sabotage.)
 
For your curiosity, here it is in Scheme:
(define (repeat f n)
  (define (apply_n_times n)
    (if (= n 0)
        (lambda (x) x)
        (lambda (x) ((apply_n_times (- n 1)) (f x)))))
  (apply_n_times n))

(define (square x) (* x x))

((repeat square 2) 5)
Basically, a direct translation.
 
8:24 AM
when i say f = repeat(square, 2) am getting all the info about members of f outside repeat.
 
>>> def repeat(f, n):
...     def apply_n_times(n):
...         if n < 0:
...             raise ValueError("Cannot apply a function %d times" % (n))
...         elif n == 0:
...             return lambda x: x
...         else:
...             return lambda x: apply_n_times(n - 1)(f(x))
...     return apply_n_times(n)
...
>>>
>>> def square(x):
...     return x * x
...
>>> f = repeat(square, 2)
>>> f
<function <lambda> at 0x10a4c3c08>
 
So, Breaking abstraction mean to manipulate the members of this object pointed by f, which I think is not possible.
 
Manipulate the members of f in what way, exactly?
 
>>> f.__name__
'recursive_apply'
>>> f.__name__ = '__main__'
>>> f.__name__
'main'
 
Well, I consider that to be a form of reflection. If you really want to prevent it, use a lambda instead.
But why worry about it? Hiding the name would just be a form of obfuscation.
If you're worried about leaking a name, I'll give you something that will keep you up worrying all night:
>>> f
<function <lambda> at 0x10a4c3c08>
>>> from dis import dis
>>> dis(f)
  8           0 LOAD_DEREF               0 (apply_n_times)
              3 LOAD_DEREF               2 (n)
              6 LOAD_CONST               1 (1)
              9 BINARY_SUBTRACT
             10 CALL_FUNCTION            1
             13 LOAD_DEREF               1 (f)
             16 LOAD_FAST                0 (x)
             19 CALL_FUNCTION            1
             22 CALL_FUNCTION            1
             25 RETURN_VALUE
The bytecode is all there! Horrors!
 
8:37 AM
There is a chance where my module first calls repeat(square, 2) first and then as I do not know operated number 5 or something else based on runtime.
 
¿Give me an example of what you fear can go wrong?
 
functional programming talks about minimising side-effects where it does not allow re-assigning local objects within a function ): In contrast in our example one can get access to a function object that is local to some other function that can be manipulated like f.__name__
 
Well, Python is not a pure functional language. The language allows you to do non-functional stuff like count = count - 1. When you're using Python to do functional programming exercises, you have to exercise some restraint, and stick to the rules of FP. That means that it's your own responsibility to avoid mutation and such.
(You see why I've been trying to encourage you to learn in Scheme instead? All of these caveats go away.)
 
Ya, with such code, I will get confused what an abstraction is? As you told it is about strictly hiding implementation details.
 
Anyway, at some point you have to draw the line between what is reasonable to hide and what is unreasonable paranoia.
 
8:48 AM
When we say hiding implementation details It is just not to bother the internal logic.
It is encapsulation that says, one should not allow a user to tamper the implementations something like f.__name__='main'
ok
 
I was just about to say… your concern is not so much about abstraction; it's straying more into encapsulation.
The main goal of Abstraction is to free your mind from details.
To give you tools to build bigger stuff.
The repeat() function satisfies that goal nicely. It lets you repeatedly call a function easily.
 
But big software modules must also provide abstraction, other modules using these modules become difficult, if they return something intermediate than the actual result.
yes
For your point It lets you repeatedly call a function easily, what if repeat(square, 2) is ready with the user and pointed by f and (5) is not ready in runtime. (5) would be available as per runtime circumstance.
So, Am I freeing my mind with the details when I want to use repeat?
 
Are you debating the merits of repeat(square, n, x) vs. repeat(square, n)(x)?
 
yes correct
repeat(square, n, x) provides me abstraction and encapsulation
because repeat(square, 2, 5) just returns 625
 
There are arguments in favour of each approach. You should learn how to do it both ways.
The language Haskell takes the view that the two expressions are exactly equivalent.
That is, in Haskell, every function that takes more than one parameter is theoretically a chain of partial function applications.
In Python, the distinction is not as seamless.
I'll let you in on a secret.
 
9:02 AM
Ideally function's local objects(for that frame) should die when we come out of that function, to maintain abstraction and encapsulation. local object like definition of recursive_apply. (higher order functions + closure) and abstraction look contradictory to me
 
What do you mean by "come out of that function"?
 
you are coming out of repeat by saying return recursive_apply
 
You might still be stuck in the imperative programming mindset.
retur recursive_apply doesn't execute the function that it returns; it creates a closure that captures the relevant information.
 
I want to slowly forget imp paradigm, Because your solution looks very mathematical and I like that thought process, but contradicts with abstraction/encapsulation
 
Closures are an important tool. I still don't see solid evidence that encapsulation violation is a problem here.
 
9:08 AM
yes object pointed by recursive_apply has closure properties about square and n. I understand that point.
ok
 
0
Q: Implement test which tries function with diferent params and expected results

TrollkemadaWhat could I improve in the following code? The goal is to test a function againts a table of input parameters and compare to some expected results with some tolerance (as there are random variables involved in the computations). This is how I am doing it right now. Note that I cannot use any C+...

 
10:11 AM
hmmmm
I think I'm setting myself up for disaster
I've got a "read last line" function that takes a file
and reads all the lines
and returns the last one
... but if we give this an ever expanding file...
aren't we gonna get a huge performance issue eventually
 
1
Q: Can I post both my code and link to the external repository?

Jorge BucaranI have read the guidelines and FAQ, and understand that code up for review should be posted on this site. I also understand that modifying the code after it is posted goes against the rules as well as asking reviews to be conducted off site. However, I would like to know if it is still acceptabl...

 
10:39 AM
Sometimes I feel like I should raise my expectations of the day
I played a game, left a few SO comments, prepared breakfast and I already feel a sense of accomplishment of the day
 
10:50 AM
Monking
my day's expectactions are reached when I see at least +10 rep on SO/CR when I log in in the morning
 
Gave a hot MSO answer with 3 minutes work
counts as well
 
Using Netbeans feels like I have returned to the middle ages
Watching other people use Netbeans feels like they are still in the prehistoric age
 
11:07 AM
I'm voting to close this question as off-topic because it is asking for a code reviewQuentin 1 min ago
 
11:21 AM
Morning
 
@Quentin The code is strapped of so much context that this feels very much like "example code", which is off-topic on Code Review. — Simon André Forsberg 43 secs ago
 
what's bad about netbeans
I keep struggling with eclipse
never does quite what I want
 
NetBeans just feels so old compared to IntelliJ
 
old doesn't sound like a valid argument
You're 20+ years old, are you an outdated human?
 
@Pimgd Compared to new-born, yes
The biggest annoyance when going back (for some university project), is that it doesn't automatically save my files, doesn't automatically fix indentation when I copy-paste code
 
11:33 AM
=D all the new-borns seem to do is cry, poop, and attempt to eat various things for the first two years
so I'm not sure newer is better
@skiwi huh... I used my AS3 ide for things last weekend and I felt annoyed that my IDE didn't highlight usages of a variable when you put the cursor there.
But annoyance over not auto-indenting...?
I think I'd be annoyed if it auto-indented
many times copied code needs to be adjusted
 
auto-indenting is awesome
 
Isn't that when you just run the auto-formatter?
copy, paste, edit, run formatter
> Body is limited to 30000 characters; you entered 35958.
bah.
It's just 1 class.
 
@Pimgd wat
 
I have a ~700 line parse function I'd like a better algorithm for
so that I can split it up
 
Monking everyone
 
11:45 AM
maybe I should remove the helper functions....?
still too much.
hmmh...
okay, what about ONLY the function?
 
monking @rolfl
 
Hey skiwi, I rejected your issue on JDOM .... eventually.
 
27600 characters for just the parse function.
 
Monking, monkey
 
@rolfl I noticed the mail yesterday
 
12:02 PM
0
Q: Creating a grah for java application

new_to_codingI'm building an application that implements the A* algorithm to calculate a route between two rooms. I am trying to create a graph which the algorithm can operate of and I am not sure if this is the right way to do it. Here's what I've done so far: Vect2.java: package myalgorithm; public class...

 
Well, that was quite the weekend, folk. It's a long one for me, today is a holiday here in Ontario, Canada
 
What holiday is it today?
 
Also, at some point over the weekend, my profile became accurate.
Family Day
 
That's... a holiday?
 
In the US they have "President's Day", and the Canadians feel it is important to be on holiday for the same days as them.
But, yes, it's a holiday. I would have been happier with "Flag Day":
The National Flag of Canada, also known as the Maple Leaf and l'Unifolié (French for "the one-leafed"), is a flag consisting of a red field with a white square at its centre, in the middle of which is featured a stylized, 11-pointed, red maple leaf. Adopted in 1965 to replace the Union Flag, it is the first ever specified by statute law for use as the country's national flag. The Canadian Red Ensign had been unofficially used since the 1890s and was approved by a 1945 Order in Council for use "wherever place or occasion may make it desirable to fly a distinctive Canadian flag". In 1964, Pri...
 
12:10 PM
@rolfl profile became accurate? what does that mean?
 
Well, I really am 42 now ;-)
 
You weren't before!? Cheater!
 
Stack Exchange thinks my birthday is 1 Jan
 
I'm about to do a slow clap for myself... I've made my checkers AI such that it tries to lose, instead of tries to win.
 
Happy Birthday, @rolfl! (a few days late)
 
12:11 PM
Happy 42th birthday @rolfl!
 
Ta - had a bunch of people around, and the phone was going crazy, and I did a lot of JDOM work over the weekend.
I did not have much time for CR.... :(
JDOM 2.0.6 is shipped (available on Maven central)
the jdom.org site is waiting for singapore to wake up.
Now i have cleared the backlog, I can look at interesting ways for Java8 and JDOM to work together.
First of all, thank you for the great and non-condescending answer! This is by far the most accurate and to the point explanation I got. As far as the QuickSort example goes, It seems that you are right about ints.First bloating as the recursion level grow. I believe this can be easily fixed by computing 'gt' and 'lt' eagerly (by collecting the results with ToArray). That being said, it certainly supports your point that this style of programming may incur unexpected performance price. (Continue in second comment) — Vitaliy yesterday
I geuss my answer was the condescending one?
But, it's really nice to see the Java designers step in occasionally.
 
-1
Q: How make smooth falling game objects and kill them with your keyboard in C#?

BerndWe are creating a mixture between space invaders and tetris. A letter will fall and you have to push the corresponding button on the keyboard to kill the letter and protect your base at the bottom of the screen. A letter e.g.: the letter "A" falls, than you push "A"

 
29937 characters
time to add tags and post it
 
@rolfl seems like your answer will get a populist badge and might get great answer some time in the future.
 
Yeah, I think it may. That answer ended up being a lot of work.... Even good experiences on SO are only good relative to the regular crap.
The great answer will take a while though, now that there's an authoritative answer.
 
12:20 PM
fuuu it's 30618 chars says CR
ugh I have to cut out 600 chars but I don't wanna kill the comments because I think they're vital in understanding
30028...
 
Morning folks. The beginner tag is for beginner in the language, not beginning to program, right?
 
0
Q: Parsing a Dialogue Script - fixing my 620 line mess

PimgdGiven a Dialogue Script for SDT (NSFW! Google at own risk), parse said dialogue script for validation with checkers. A dialogue script consists of a set of lines. There's a special line, initial_settings, formatted like such: initial_settings:{"variable1":numericvalue,"variable2":"stringvalue"}...

don't worry, 25% of the lines are comments, I think
 
@rolfl Maybe I'll use, some day :)
 
I'm pretty sure it's easy to snipe some of the inner body statements
it's overhauling the whole thing into smaller functions that's killing me
and ofc I spot my own flaws just after posting >_<
0
A: Parsing a Dialogue Script - fixing my 620 line mess

PimgdDuplication if (contentString.charAt(0) == "%" && contentString.indexOf("%2A") != 0) { contentParseMode = "SpecialChar"; } else if (contentString.charAt(0) == "[") { contentParseMode = "Trigger"; } else if (contentString.charAt(0) == "*" || content...

small answers welcomed too =)
I'mma have lunch
 
I'm starting to wonder if I really want to go for 3D graphics game development as career.... I'm starting to think programming AI is getting cooler and cooler
 
12:35 PM
 
1
Q: Parsing a Dialogue Script - fixing my 620 line mess

PimgdGiven a Dialogue Script for SDT (NSFW! Google at own risk), parse said dialogue script for validation with checkers. A dialogue script consists of a set of lines. There's a special line, initial_settings, formatted like such: initial_settings:{"variable1":numericvalue,"variable2":"stringvalue"}...

 
@rolfl yeah well that's a 620 line function for you
 
Yeah, it's a stupid auto-flag to have on Code Review.
We routinely simply decline them
 
Bounty Notice: An answer that provides a detailed description of how to split this up into separate maintainable functions, with examples, will get a 500 point bounty awarded on their answer. I really wanna be rid of this mess in my code, but I am blinded by implementation details and just need someone with fresh eyes to show me the light. — Pimgd 1 min ago
Does rep-bribery work on CR?
eh
Lunch now for real
 
@Pimgd AS3 has a switch statement which works for strings so could use that as well.
 
12:56 PM
lol
I'm having two draughts/checkers AIs here, which both play perfect, the game will never end anymore
Quite interesting though, one player has 1 men, 1 knight and the other has 2 knights, yet it is balanced
you would say that 2 knights ought to be able to take one knight down?
 

« first day (653 days earlier)      last day (3358 days later) »