« first day (1311 days earlier)      last day (2722 days later) » 

12:00 AM
RELOAD! There are 3158 unanswered questions (92.0721% answered)
 
12:19 AM
-1
Q: Artificial intelligence

Skripo If can someone help me with because i kinda not sure how to do it

 
12:38 AM
1
Q: Go fish game in Go

Roland IlligBased on this question, I have written my own implementation of the Go Fish game, with the following features: Full trace of all actions that happen in the game More than 2 players possible Each of the players can be a computer or a human As a debugging aid, it is possible to see the computer p...

 
12:49 AM
0
Q: Auto postback and paging do not functional on IIS

miri'm newbie to vb and asp.net. Suppose , I need to do mini CRM project on Microsoft Server. I'm using visual studio 2015 and sql server for the project. While doing gridview, there is paging and autopostback function. When I use IIS express, it functions, but when I use localhost , both paging and...

 
1:04 AM
This belongs to Code ReviewNordenheim 49 secs ago
 
1:22 AM
I'm voting to close this question as off-topic because it belongs to Code Review. — SJuan76 just now
 
1:45 AM
0
Q: Java - Make current working code more efficient

motnreal123I am doing a project, and i have come up with some code to swap every letter with every other letter in a string, only the project was to be "efficient as possible". Example "rya" = yra, ray, ayr.. etc I understand exactly how the code works, i would just like to make it efficient as possible....

 
2:12 AM
I'm going to write a meta question after I do the dishes.
 
Kaz
Initial opinion on Hearthstone: In a word, grindy.
 
0
Q: Encoding text to keypresses on old phone keyboard (0-9*#)

D. AmorosoI am going through "Haskell Programming from first principles" for the first time and I would like to get some pointers on what can be improved in my code, which is the following: module DaPhone ( stringToKeyTaps , fingerTaps , mostPopularLetter , mostPopularWor...

 
2:42 AM
Dagon is right, you should submit it to code review. But, answering your question: So you wrote a class. Congratulations, its the first step to OO. You now know how write a class and create an object. Now learn about MVC and you will start programming in OO in some moment. — Antonio Alexandre Alonso de Si just now
 
2:56 AM
stackoverflow.com is not where you ask for "any suggestions". You're looking for codereview.stackexchange.comSam Varshavchik 44 secs ago
possible answer invalidation by TOM__ on question by TOM__: codereview.stackexchange.com/posts/148764/revisions
 
3:38 AM
@EBrown Are you around?
Or @Phrancis?
 
Yeah
What's up?
 
I want to find too broad questions.
If that is correct, we have 11 questions that are too broad that haven't been reopened.
 
It probably is correct.
 
OK.
 
We don't use "Too Broad" all that often.
 
3:39 AM
I know.
 
I don't have mod tools anymore, so I can't verify.
 
That's what my meta question is going to be about.
I think we should use it for Gimme teh Codez questions.
Maybe, that is.
That is because they don't really fall into "Asking advice about code not yet written."
They aren't asking for advice at all--they just want the code.
 
GRAH THIS THREADING STUFF IS NOT WORKING AT ALL
 
You see, we could use ^, or we could use "No code in question," or "Too Broad."
 
It never removes my thread.
 
3:42 AM
I think TB would be the best fit, so I'm going to toss my argument before the site.
@EBrown Which lang?
 
@Hosch250 C# of course.
Tasks are being dumb.
 
If you are using .NET, then just use the TPL.
The task will remove itself when it is finished.
 
I am, they're not working.
It's not supposed to complete, is the thing.
 
In fact, just because you use a task doesn't even mean it creates a new thread.
 
It's an infinite loop for a WPF GUI.
 
3:43 AM
GAHHHHHHAHAHAHAHAHAH
 
The problem is that I am trying to "cancel" it without a cancellation token, and then detect when it cancels.
 
Never use infinite loops for GUI's, especially not in WPF.
 
It's not for the GUI
 
Use events and commands.
 
It's a simulator for something, but it reflects information into the GUI.
It works as expected, the problem is that I need it to cancel when I set a specific boolean flag.
 
3:44 AM
Hey there, @Mehrad!
 
And it is, but the TPL isn't reporting it correctly.
 
Long time no see!
 
Then I tried throwing an ArgumentException and that didn't work.
 
@EBrown Are you using the cancellation token correctly?
 
@Hosch250 I'm not using a CancellationToken.
 
3:45 AM
Then I'm not surprised.
You need to pass a cancellation token into the thread and cancel it from outside the thread.
That's the C# way of doing it.
Or whatever you are doing.
You can cancel it anywhere you can control the token source, really.
 
Well I'm trying to do it slightly different, and .NET is being entirely illogical about it.
 
@Hosch250 Good to see ya @Hosch250. Pretty busy with some C stuff and don't get to meet the old friends much :D
 
Nice.
 
_task = Task.Factory.StartNew(() => Run().Wait());
 
Atm the moment dealing with some stack overflow :/
 
3:47 AM
Then, inside Run, some of the code:
        private async Task Run()
        {
            var waitSw = new Stopwatch();

            while (_runTask)
            {
                // Some stuff
            }

            _taskFinished = true;
            throw new ArgumentException("Cannot run task when {nameof(_runTask)} is false.");
        }
Then I have a Clear method:
 
Uh, what?
You are making a task that is a field?
 
public void Clear()
{
    while (!_taskFinished)
    {
        _runTask = false;
        Task.Delay(25).Wait();
    }

    _taskFinished = false;
    _runTask = true;
    _task = Task.Factory.StartNew(() => Run().Wait());
}
The problem is that the clear method is entering an infinite loop.
Because _taskFinished never get's set.
 
I'm pretty sure that isn't a very good idea.
 
I thought about using the Task.Status property, but that doesn't work properly either.
It still shows Running instead of RanToCompletion.
 
Yeah.
You are never finishing the task.
.NET is working 100% right.
You need to kill the bloody task.
 
3:50 AM
No, it's not.
It's working entirely wrong.
I have killed it
It's had a chance to die a million different ways.
It refuses.
 
No you haven't.
 
The loop finishes.
The TPL registers the exception.
Even without the exception the TPL registers that the task finished.
The problem is that the TPL never let's me see that it finished.
 
Then the Task.Status won't be Running.
 
But it is.
 
Also, why the heck are you restarting it after you clear it?
 
3:52 AM
Don't worry about that.
That's intended.
 
OK.
Umm, I don't even see how you can even get the task to run.
while (!_taskFinished)
{
    _runTask = false;
    Task.Delay(25).Wait();
}
Look.
 
Yes, and then right after that _taskFinished = false; _runTask = true;.
 
Oh, nvm.
 
Then I recreate the task.
 
I thought you were delaying the running task.
 
3:53 AM
Inside the task it only does things if another field is > 0.
 
Well, I tell you you are doing it wrong.
This is what you really want:
First, set the field and start the task.
 
The problem isn't what is/isn't the best way, the problem is that .NET is not doing what it should.
 
Second, use the .OnCompletion() method to restart it.
 
I just ran a few tests, and .NET doesn't register the exception being thrown sometimes.
 
Just wait a second.
You have a race condition.
 
3:56 AM
75% of the time the debugger throws on the Task.Factory.StartNew(... line that created the task, but 25% of the time it doesn't finish.
 
_taskFinished has a race condition.
This code is so bad I don't even know where all your bugs are.
Just do it the right way the first time.
 
"The code is so bad" bs.
You're not seeing what I'm seeing.
 
Maybe that's because I have a fresh look.
 
No, you aren't seeing it in action.
 
@EBrown Maybe I'm seeing bugs you aren't. And please use Tasks correctly.
And if you think .NET has a bug, then contact the .NET team. I can't help if it is a .NET bug.
 
4:04 AM
I give up.
 
OK, feel free to weigh in on my meta question.
Maybe I should have waited for Winter Bash. It would be a good one for hats, I think.
 
CancellationToken isn't working either.
 
Are you using continuations?
 
???
 
Use .ContinueWith to restart the task.
It will run each time the task completes.
 
4:11 AM
I won't want to restart it yet.
It doesn't cancel yet.
 
0
Q: To make my python code more run time efficient and simple

SreederI want my code reviewed and improved. Can any of you please help. Here is the link to the question which I had originally asked. http://stackoverflow.com/q/40965024/7243109

0
Q: Merge two sorted lists of numbers

iseligetInputs are two sorted lists (of the same length) of numbers. I would like to return a merged, sorted new list. I have written the following codes, but most lines are used to deal with the end case. I am wondering if there is any better way to write it? def merge(array1,array2): result = [0]*...

 
_cancellationTokenSource.Cancel();

while (_task.Status == TaskStatus.Running)
{
    Task.Delay(25).Wait();
}
It's still TaskStatus.Running even after cancelling.
You have got to be kidding me...
 
The task status should be TaskStatus.Cancelled.
 
It's not.
 
Also, are you passing the token into the task correctly?
 
4:15 AM
Yes.
It works 7/10 times.
 
Task.Run(() => {}, token)
 
I changed the while to while (!_cancellationToken.IsCancellationRequested) and it's still not completing.
But the while loop also isn't looping.
 
Then, you need to call token.ThrowIfCancellationRequested().
I'm not sure if you call that periodically or just once.
It looks like you call it periodically.
 
You don't need to call that at all.
 
Oh, right.
 
4:17 AM
It's not throwing anyway.
 
@EBrown It sounds like you have a race condition to me.
 
I CAN'T
 
Odds are you do.
 
Unless the CancellationToken itself has a race condition.
I changed the entire code.
 
Do you access any variable from both threads?
 
4:18 AM
Yes, but it can't be causing this issue.
 
I've done enough multithreading in RD's parser to be very suspicious.
 
There's no way in hell that it can.
 
You might be surprised. I was.
You can always make an SO post.
 
It's got to have something to do with the await in the Task.
 
Probably.
Uh, why are you awaiting in a task?
 
4:21 AM
I'm not.
 
@EBrown Then what does thus mean?
 
await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => Generation++);
That's a LoC in my Run method.
Looks like that's creating the issue.
 
Exactly.
That is booting up a third thread within the second thread.
 
That makes no sense.
 
Yes it does.
That's what await calls do.
 
4:23 AM
Please explain.
Because as far as I'm concerned it makes 0 sense.
Because everything else is working as expected.
 
async methods create a new thread to run the method in.
When you do an await call, it boots up a new thread because you are calling an async method.
 
I know that.
But that does not at all explain why it's causing this issue.
 
When the async method returns, it continues from where you were with one of those continuations I mentioned.
No, I'm confused too.
Basically, your code looks like this:
 
I think I figured it out.
As soon as I say that I'm wrong.
 
Task.Run(() =>
{
    // run code...
    await ...
    Task.Run(() => {async method body})
        .ContinueWith(() => { rest of method body });
}
Anyway, are you using C# 7?
 
4:27 AM
No
 
OK.
Because they made some changes in that.
 
0
Q: When is a Question Too Broad?

Hosch250I wish to bring this question before the Code Review site. In the past, we have had this question: What makes a question too broad for code review?, which asks how to use the Too Broad close vote reason. It received one answer that said to use the Too Broad reason on comparative-review question...

 
@Hosch250 You'll never guessed what fixed it.
 
Huh?
 
Don't use await or .Wait() on the "third" task.
 
4:37 AM
Hmm.
 
var t = Task.Run(() => Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => Generation++));
while (t.Status == TaskStatus.Running)
{
    _cancellationToken.ThrowIfCancellationRequested();
}
Now I'm back to the first problem I had.
Oh good I broke it again.
5
The TPL does not work with UWA very well.
Somehow the task is stopping it's work, but UWA is not telling me.
 
Funny.
There is a difference between not working and being marked as finished, I think.
 
CPU usage goes down to 0%, but the task isn't registering as cancelled.
Hahaha this just get's better.
 
5:02 AM
0
Q: Redirecting user to another page if certain condition is met

JackyOn Page#1, I am writing a code in JavaScript to check if the user has certain properties or not, if not, I want to redirect the user to page#2. So I wrote code to check the user status, and redirect them to page#2. I am doing all of this in JavaScript but I am not sure if this is the right way to...

0
Q: Sqlite.swift -- Selecting all rows and returning them in an array of tuples

JosephLink to SQLite wrapper func queryAll() -> [(String, String, String)] { do { let sql = try DB?.prepare("SELECT city, zip , temp FROM weather") var arr : [(city : String, zip : String, temp : String)] = [] for row in sql! { arr += [(city: row[0] as! String,...

 
Remonking
 
@Hosch250 Absolutely nothing worked correctly. Had to cheat.
 
@CaptainObvious Is that stub code?
Sunday night seems slow for meta :P
 
5:19 AM
Yes, because this could have been prevented with: (1) code reviews; (2) documentation; (3) better encapsulation; (4) more careful code analysis prior to refactoring — paddy 12 secs ago
 
5:29 AM
@Hosch250 I voted UWYA
 
I can't because it is more than clear what they are asking.
On SO, it would be too broad, I think.
Certainly Too Broad on Programmers.se.
 
Doing a code review of a single if statement seems to be too narrow in scope IMO
 
Me too.
But there isn't a Too Narrow close reason.
Eh, I'll just close it as stub code.
That question is giving me the creeps.
See my latest comment.
No server-side, but subscriptions and sign ins, and such?
Scary, scary, scary.
 
Sounds like a world of pain waiting
 
@Phrancis and @Kaz Are you guys planning on running if/when we have an election?
 
5:35 AM
@Hosch250 I'm thinking about it
 
Kaz
@Hosch250 God no. I have neither the time nor the desire for that much responsibility.
 
@Kaz That's a pity--you'd be my first pick. You are a little more level-headed than some others.
 
Can't argue there
 
@Phrancis If you do, it will probably be either you or Vogel.
 
Kaz
Really? Interesting.
 
5:36 AM
Malachi did well in the last one, so I'm not ruling out him pulling a Trump.
 
I think my main concern is that my schedule is really odd, I'm not much around anymore during peak activity
 
Yeah.
I'm considering running, but I'd have to pull a Trump if I won.
 
I'm here in the middle of the night when not much going on (unless you count being on mobile as "here", but not sure how much actual moderation can be done from a phone)
 
I know a few moderators do it.
Anyway, guess what?
 
What?
 
5:38 AM
I inherited a million dollars ordered Clean Code.
 
Nice!
 
I'm going to be reading it between semesters.
Almost done with my DI book, so I'll finish that as soon as I get my two final papers done.
 
Kaz
If you guys think I'd make a good mod, I might give it some thought.
Never let it be said that I ignore evidence that contradicts my worldview ^^
 
Night, folkses.
 
Later
 
Kaz
5:43 AM
'night
 
> Configuring your system. This might take a while.
3
Well thanks, VS, for at least warning me
 
5:55 AM
I'm voting to close this question as off-topic because this belongs to codereview.stackexchange.com — ForceMagic 14 secs ago
 
6:12 AM
You should post on Code Review if you have working code that you would like feedback on. — Miles Budnek 50 secs ago
 
0
Q: Are hard questions forbidden?

Björn LindqvistI asked this question http://codereview.stackexchange.com/questions/146193/red-black-tree-appears-to-be-slower-than-stdmultimap and it was closed. Before I asked that question I asked on meta.stackexchange.com which community would be suitable to ask the question in: Stack Exchange site for code...

 
@StackExchange The question in question was RBM.
 
0
Q: Activity Assigner - that randomly assigns each student to an activity

MAnchanI am trying to improve my object-oriented modelling and programming skills and hence made an attempt at solving the problem statement from this link. Problem Statement A teacher wants you to help her write a program that will randomly assign each of her students to an activity at the vario...

0
Q: Strictly Identical arrays input

russellThe textbook problem: (strictly identical arrays) Two arrays list1[] and list2[] are strictly identical if they have the same length and list1[] is equal to list2[] for each[i]. Write a function that returns true if list1 and list2 are strictly identical using the following header:...

 
6:30 AM
@StackExchange plenty of hard questions out there, but apparently there were 5 users who thought this one was unclear
I cast a vote to undelete it, I think personally that sufficient detail has been provided to warranty reopening
 
6:50 AM
Probably more suitable at codereview.stackexchange.com (if you're actually looking for reviews instead of visitors) - it's offtopic for this website, hence the downvotes. — Qirel 47 secs ago
 
Monking
The countdown has started: winterbash2016.stackexchange.com
13
@StackExchange now undeleted
 
Now to re-open it...
@EBrown Skype crashed... lol
Think the PC could use a reboot
 
Its reopened
 
0
Q: Consider this simple string for string replacement

Vendredi for (long i = 2; i <= numberOfRows; i++) { string quarry = "=IF(J"+i+"<10000,J"+i+"*0.05,IF(J"+i+ "<30000,(J" + i + "-10000)*0.1+500,IF(J" + i + "<70000,(J" + i + "-30000)*0.15+2500,IF(J" + i + "<140000,(J" + i + "-70000)...

 
@CaptainObvious what in the world is that
 
7:01 AM
@Phrancis C# that creates VBA code in an Excel worksheet.
I never thought I would meet the devil but then I saw that
 
Why would you want to do that
 
Well there are lots of reasons
I cannot think of any of them.
But I'm sure there are.
 
Sounds like it's building an Excel formula rather than VBA
 
@Duga ORLY? YA RLY
 
7:23 AM
0
Q: LinkedList throws NoSuchElementException

RafaelI'm developing snake game in Java. Why do I get following exception? Everything seems right, but I keep getting it Exception in thread "Thread-6" java.util.NoSuchElementException at java.util.LinkedList.getLast(Unknown Source) at snake.SnakeModel.moved(SnakeModel.java:76) at snake.S...

 
@CaptainObvious Question throws NotOnTopicException
 
7:47 AM
possible answer invalidation by Michael Johnson on question by Michael Johnson: codereview.stackexchange.com/posts/148747/revisions
 
@CaptainObvious Didn't even review the C# code, went with reviewing the formula.
 
8:22 AM
 
8:34 AM
0
Q: Simplify toggle button change BackColor Code VBA

Rosidim new in VBA making, so all code below is still working tho but it takes a lot of line of codes. Even it is easier to maintain but if someone can simplify my noob-code to cut some lines and more eye-pleasing? there are more than 20 toggle buttons in my userform this is the example of my code, ...

 
8:49 AM
@ForceMagic The reason that Code Review is not offered as a migration destination is because too many Stack Overflow users pick bogus reasons for migrating. That is why we are encouraging people to stick to the rules when voting to close. — 200_success 17 secs ago
 
Kaz
@Mast I take it from the dead link that there were comments on said post that have since been dealt with?
 
Monking
 
@Kaz A bogus answer.
As in, almost spam, so bad.
 
9:05 AM
Monking :)
 
@200_success So you're suggesting that the question does not met the CR migration checklist : meta.codereview.stackexchange.com/a/1689/18559 and that anyway since it's not an option in the Closed Votes panel, the question should be marked as too broad? — ForceMagic 37 secs ago
 
Kaz
Also, Monking @all
 
0
Q: notepad++ find/replace - get the found text

user2961606im using regular Expressions to find and replace text in some documents. Im trying to find an Expression like img.src.?picture.jpg".*?> which finds a string for example like IMG alt="" src="picture.jpg" width=461 align=baseline height=72> now i want to use that found string and save him in ...

 
9:27 AM
@CaptainObvious The <center> cannot hold.
3
 
Kaz
I get to do some honest-to-goodness coding for the first time in 10 weeks. And it feels good.
4
 
9:47 AM
@UnholySheep - this question was actually moved on Codereview here, but promptly closed by a moderator there (its content is accessible to 10K+ users only). — Alexei 51 secs ago
 
10:10 AM
0
Q: 20 columns (non sequential), 10 with dates and 10 with numbers (and nulls)

PaulI'm trying to find a simple and easy way to find the 1 and second (will be a max of 2) dates and numbers in this range. The colums are non sequential. the date is always beside the number. I hope this makes sense all i want is 4 seperate colums showing date 1, amount 1, date 2, amount 2 from th...

 
So your code works and you just want to optimize? Take a look at this community: codereview.stackexchange.comBas 58 secs ago
 
Monking
@CaptainObvious Hammertime
 
0
Q: Bitex - Cryptocurrency Exchange API Framework for Python - Round 2

j4ckThis is a follow up to my previous review request. BitEx is a python module I've been working on for a little over 9 months now, as a side project. It was published 6 months ago on GitHub, and as I edge closer to my 1.0 release, I wanted to take the opportunity to present my code on here, in o...

0
Q: Handling Arguments in Simple Python Scripts

k62I've been writing a basic script to enumerate SMTP users (via a user dictionary) on poorly configured SMTP servers. In scripts like this, I usually see arguments handled as follows. if (len(sys.argv) != 3: print "Usage: ..." sys.exit(0) I found the if and print statement approach irrit...

 
10:28 AM
Monking
Ah, so the answer is "To locate the runway, simply invert the plane." — TonyK 11 hours ago
@CaptainObvious One more.
@Kaz Congratulations!
If all goes according to plan, I'll start abusing Excel as a test suite in the near future.
Going to be fun!
 
0
Q: How can I take more advantage of scss?

Joseph ChambersI'm very new to scss, and was wondering how can I make my scss more elegant in terms of some of the features I may or may not know about. I just have 1 style.scss file which imports bootstrap and font awesome thats coming from bower. @import "bootstrap"; @import "font-awesome"; $enable-flex: tr...

 
10:55 AM
possible answer invalidation by k62 on question by k62: codereview.stackexchange.com/posts/148984/revisions
 
1
Q: Three numbers calculator

Sela12I made this three-function calculator. I have been learning C for a couple of months, and I learned C++ through the internet. This is my first "real" program in C++, it started really messy but I did a lot of refining and debuging and deleting unnecessary code and this is the final result. If you...

0
Q: Get parameters of many 3D objects

BabuhI'm working again on the 3D model of a building in order to parse in JSON every parameters of every objects of the model. My program works well but it is too slow because of the huge number of information : about ~10k objects each containing ~20 parameters. In order to get a lighter JSON we organ...

 
11:32 AM
    query += ','.join(columns)
TypeError: sequence item 0: expected string, tuple found
The joys of dynamic typing.
It's an array of tuples and I'm doing it stupidly wrong.
 
I'm voting to close this question as off-topic because it's asking for a code review — Alnitak 16 secs ago
 
@Mast wild guess: flatten = itertools.chain.from_iterable; query += ','.join(flatten(columns)) ?
 
or just ','.join(itertools.chain(*list_of_tuples)) maybe ? ^_^
 
Since I can control what columns looks like and I probably figured out how to avoid requiring tuples in the first place, I've simply made it an array instead.
 
@MathiasEttinger I think that doing the way I said will avoid lazy evaluation right ? :D
 
11:45 AM
Put this question in codereview.stackexchange.com along with some implementation details if possible. StackOverflow is for asking help on specific issues. — Souvik Ghosh 40 secs ago
 
Monking
 
@Dex'ter I think both are equivalent. But looking at the source code of chain.from_iterable would give you a better answer ;)
 
    # Here Be Dragons
    query = '''CREATE TABLE IF NOT EXISTS {} ('''
    query += ','.join(columns)
    query += ')'

    cur = conn.cursor()
    cur.execute(query.format(table_name))
And yes, I should wrap my cursor, but that leads to unexpected behaviour for some reason.
So I'll have to fix that immediately after it works.
 
Dragons are pretty epic
I think I'll read this article waitbutwhy.com/2013/10/why-procrastinators-procrastinate.html about procrastinating later today
 

« first day (1311 days earlier)      last day (2722 days later) »