« first day (1148 days earlier)      last day (2871 days later) » 

12:00 AM
RELOAD! There are 2477 unanswered questions (92.9697% answered)
 
Does anyone have any ideas on how to improve my question, so it's not a zombie? (If not I guess giving a bounties the way to go)
 
@JoeWallis Break it up into smaller portions i if possible? It is a bit hard to digest (atleast for me) as it stands.
 
0
Q: Tcp server implementation in .Net

GeniuS BraiNI wrote a couple programs in the past that use VB6's Winsock to achieve TCP communications, but still I'm kinda new to Socket Programming in .Net. So I needed the same functionality of the Winsock to use in .Net with the advantages of multi-threading & asynchronous support (I'm kinda new to that...

 
@N3buchadnezzar I don't think I can, it's all interlinked... Might have to drop a bounty on it then, ):
 
12:26 AM
@JoeWallis Can you provide some background for the game? I'm not familiar with it.
 
@200_success That's a good idea, I'll add that. Thank you
 
0
Q: Cleancode method placement

ScareCrowSometimes I find it hard to find the "correct" place to put a piece of code. I will try to explain with an example. In my fantasy app a user can look at his program, favorites, result, etc. So concrete I have got a User class and a Favorites class. So now I can place the getFavorites in a metho...

 
12:43 AM
Pops on June 24, 2016
The Stack Exchange Data Explorer is a great way to get information about your favorite SE site. Learn how to harness it with our new tutorial!
 
1:01 AM
what was that joel spolsky Excel Spreadsheet video?
 
> You Suck At Excel by Joel Spolsky
 
possible answer invalidation by Joe Wallis on question by Joe Wallis: codereview.stackexchange.com/posts/132275/revisions
 
I found it, thank you
letting my wife watch it...we are learning together, he is showing some really good stuff there
 
posted on June 25, 2016 by Amanda

I'm trying to write a basic Slack bot with the slackclient python library. I want it to listen for a specific phrase and reply with a standard reply. That seems like it should be relatively straightforward. Because the call might be included in the response, I need to make sure the bot is only listening to other users (not itself). If someone edits their post to inc

 
she ditched me to talk to her mom on the phone
time to switch to plural sight
 
1:47 AM
strongly suggest: complete the function, then post in codereview.com rather than here — user3629249 25 secs ago
 
2:09 AM
0
Q: Guess number games

kboyer/* My program is to guess a number from 1-100. The correct number to guess is 86. Every time I run the program, it generates it's own number. This prevents the statistics from running. I need the program to indicate 86 is the number they need to choose to win the game and then list th...

 
 
2 hours later…
3:57 AM
1
Q: Correct and portable serialization

FaTonySo I've made custom binary streams which work like this: /// \brief Reads a variable from the stream. /// \tparam T Type of the variable. /// \param[out] var Variable to read. /// \return Reference to this stream. /// \throw TODO /// \note No endianness conversion will be performed if a byte is ...

 
4:42 AM
0
Q: Segmentation fault(core dumped) in multi threading in c++

m.r226When try to run my program with up to 1 thread, it works fine for a while (some seconds or minutes) but finally get segmentation fault(core dumped) or double free(faststop ) error. Here are the function which the threads run. //used in the Function struct s_EntryItem { Columns* p_pack...

 
 
1 hour later…
6:04 AM
2
Q: Why aren't my pieces rotating on my chess board in Java?

prakhar londheI am developing chess game in Java using the Netbeans IDE. Instead of rotating the whole board at each move, I thought of changing position of the pieces themselves, while the board remains same. All my pieces and squares are JLabels and are in a JLayeredPane, with pieces being in top layer. All ...

can anyone take a look at this??
 
0
Q: Database to calculate Date/Time

HomerI'm trying to make a calculator to calculate the estimated delivery time for products from its producers, and since every producer has his own time cycles, I have to make a kind of database about them first and compare this data against the order time. This is my try for a JSON file: { "time": ...

 
0
Q: Choosing/Creating/Setting an NPC dialogue

Sniffle6This is a semi-repost. I was suggested to follows the suggestions of my previous post and then to repost the new code for further review. So what this file does is. Creates a Dialogue box, sets the chat history box too inactive. Finds which npc dialogue to display creates the list and sets which...

 
 
1 hour later…
8:00 AM
Ripe zombie; open question with answers, at least one answer having score 0, no answer having score > 0: PageVisibility API, to handle page/tab visibility changes
 
0
Q: A simple bubble sort implementation in Java

Hassan AlthafI've written a Bubble Sort algorithm in Java and I want a review on these: Performance improvements. Code conventions. Algorithm design improvements. Cleaner approaches. I would highly appreciate if you can review based on the points above, and I would prefer if you can add more points on top...

 
This may be a better candidate for Code Review. — Galik 28 secs ago
 
8:22 AM
0
Q: A simple Insertion Sort implementation in Java

Hassan AlthafI've written a InsertionSort algorithm in Java and I want a review on these: Performance improvements. Code conventions. Algorithm design improvements. Cleaner approaches. I would highly appreciate if you can review based on the points above, and I would prefer if you can add more points on t...

posted on June 25, 2016 by Hassan Althaf

I've written a InsertionSort algorithm in Java and I want a review on these: Performance improvements. Code conventions. Algorithm design improvements. Cleaner approaches. I would highly appreciate if you can review based on the points above, and I would prefer if you can add more points on top if it if you find necessary. Here's the code: package com.hassana

 
9:06 AM
0
Q: tab completion for custom shell

Programmer 400The purpose of the code is to enable tab completion for a custom shell I'm writing. The target os are Linux and OpenBSD. I had to make a conditional include that I hope is correct: #ifdef __linux__ #include <editline.h> #endif #ifdef __OpenBSD__ #include <readline/readline.h> #endif Th...

0
Q: Generic Singly Linked List in C++ using the '11 Standard

Robert RingstadThis here is a templated singly linked list that I have been working on for the past couple of days in C++. I am not a programmer or computer scientist by training; finishing up my undergrad in physics this fall but trying to add more skills to my toolkit, so to speak. I have been working my way...

 
9:20 AM
possible answer invalidation by h.j.k. on question by Jal: codereview.stackexchange.com/posts/132871/revisions
 
9:48 AM
@Duga Nah.
 
9:59 AM
@Hosch250 It might be either my internet or my computer that's been a little shaky.
Or the internet...
 
10:22 AM
@Duga Under 93? That's not good.
@JoeWallis Keep in mind you made something specialized for a game that hasn't been around for that long yet. You're fishing in a small pool and the pool only contains small fish at the moment.
 
This might belong on Code Review. — Tim Biegeleisen 24 secs ago
 
0
Q: Checking if numbers in array are sorted or reverse sorted

CeleritasI would like to determine is an array of numbers, is always increasing (for all x, x+1 > x) or always decreasing (for all x, x+1 < x). If so return true. Another way to state the problem is, return true of array is sorted or reverse sorted. Here is the code: public static boolean isAlwaysIncreas...

 
11:18 AM
I'm voting to close this question as off-topic because it belongs to code review SE — Arulkumar 29 secs ago
 
@Duga Are you nuts?
 
@Arulkumar I am voting to close this question as unclear because it is not explaining anything about what the code does and would be closed and downvoted on Code Review. — Simon Forsberg 46 secs ago
 
11:46 AM
0
Q: shell script to display environment variables

Programmer 400This shell script writes my environment variables and if there is an argument, the shell script will grep for the argument in the environment variables. PAGER=more if type less > /dev/null;then PAGER=less; fi echo $PAGER if [ -z ${1+x} ]; then printenv|"$PAGER"; else printenv|grep "$1"|"$PAGER"...

 
12:33 PM
int correctNumber = rnd.nextInt(86) "OP: I need correctNumber to be 86, what is wrong???"
 
1:13 PM
Monking
 
Monking
 
What's with all these prime numbers in chat lately? ^^
 
1:28 PM
@skiwi They're the prime factor of conversation.
 
@Mast Nice
 
@Mast Fair point, that's why I'm going through How can I make my question get more attention?, and thought improving the question would be better than dropping a bounty on a bad question.
 
Likewise I don't think I can save my Rust questions either, they're doomed to be there for a while
 
@JoeWallis Improving should always be the first step, definitely. So good job on that.
 
@JoeWallis I'd say a bounty should work in your case, it's Python and the ruleset (game) can be easily learned
 
1:35 PM
And if it would just be a question about HRM, I could buy the game and see if I can make a review out of it. I've been planning to get it for a while now, it simply wasn't high enough on the to-do list.
But your Python is stronger than mine.
 
Eh wow, that explanation is awesome indeed
 
As it's an interpreter, I don't think you'd need the game, and after 200_success's message I said everything/almost everything that you'd need to know about HRM. Which is good, I'll drop a bounty on it later today / tomorrow. (Also thanks for the complement @Mast :)
 
2:06 PM
0
Q: User search (OOP / MVC approach)

MaxI coded a small user script with PHP. I'm improving the script, learning from my mistakes. I recently learned about object oriented programming and wrote 2 big god classes (user class and message class). That didn't feel right, so read about the MVC model. I wrote a controller class to handle the...

 
2:35 PM
0
Q: A custom String Builder implementation

nikelTwo code files below : the actual logic & the test logic. Only the StringBuilder class is for review :) Core Logic package stringBuilder; public class NoksStringBuilder { //initial capacity private static final int INITIAL_SIZE = 3; String[] stringList = new String[INITIAL_SIZE];...

 
2:46 PM
posted on June 25, 2016 by Raymond

Hi I'm really new to git bash and python, sorry if this sounds stupid. I was watching a tutorial on Youtube to learn to use gitbash and I kind of get the sense of it but in the tutorial instead of python files he used an .md file so he simply wrote notepad README.md and gitbash just opened the .md file for him using notepad i was wondering how I could do the

 
Any idea how to respond here?
Thank you for responding. Do you know how to get a program to read the code below the while statement once it is true? My program terminates right after the question "Do you want to play again?" — kboyer 3 mins ago
I just wanted to give him a quick suggestion on how he could fix his code so the question could be reopened. I do not want to have a discussion in the comments >.< Also I do not want to seem unfriendly.
 
just... don't
 
I found a quick one in the faq
> Code Review is about improving existing, working code. Code Review is not the site to ask for help in fixing or changing what your code does. Once the code does what you want, we would love to help you do the same thing in a cleaner way! Please see our help center for more information.
 
If he wants working code, there are plenty of working number-guessing games on CR already.
He should be able to find those for inspiration on his own, easily.
 
3:01 PM
That is an excellent thing to wish to do. There are many people who are ready to give improvements, but they hang out at Code Review. Good luck there! It is also a good idea to give a description of what your code does so that they can review it better. — zondo 42 secs ago
 
I don't, really, but I try not to be overly pessimistic in chat.
I've been known to do that.
Nov 15 '15 at 15:33, by Mast
It took me over 700 helpful flags to realize SO is a lost cause.
 
And SO consists of people in the upper half of the general population
 
'nuff SO..
 
Well SO is so so
 
3:34 PM
0
Q: Mathematical input parser

Dan DanI made a simple math expressions solver that using a "for" loop iterates over all the characters and stores the numbers and signs in std::vector. It give support for unlimited parentheses and does multiplications and division before other calculations. I really appreciate if you give any suggesti...

 
4:10 PM
possible answer invalidation by Max on question by Max: codereview.stackexchange.com/posts/133034/revisions
 
4:27 PM
@Duga rolled back
 
You might wanna checkout codereview.stackexchange.com — Jeff Puckett II 30 secs ago
 
4:46 PM
What should we do with this answer?
-2
A: Is there a way that I can omit an empty catch block

HSCoderHave you tried getting rid of the catch block? If you just have the try code and finally, it should work. Just do: try { op = opStack.pop(); y = numStack.pop(); x = numStack.pop(); } } finally { if(x == null || y == null || op == null) { new Error(activity, Error.Type.SYNTAX); isOkay =...

It's a broken answer on a pseudo question.
 
also it's factually incorrect.
while NoSuchElementException is a RuntimeException and doesn't need to be declared, it's still stupid to remove that catch-block and expect the program to work the same way
that user doesn't seem to get CR...
 
Exactly.
 
If this is working code that you think could be improved, see Code Review. If not, please clarify the issue with a Minimal, Complete, and Verifiable example. — jonrsharpe 45 secs ago
 
0
Q: Can't change font of text to custom font

Thomas MoroneyI cannot figure out how to change the font of the text to a custom font. I was wondering if anyone knows how to fix my code so that the custom font works. Here is my code: <h1 style="text-align:center;font-family:'Mitr', sans-serif; font-size:600%;">OrHelper</h1>

 
If do you thinks backwards twice, do you then do things in the normal order?
 
4:54 PM
@CaptainObvious Nope.
@skiwi Backwards twice or twice backwards?
 
co-co-controlflow?
 
@Mast However you want to put it ;)
 
the first won't work, the latter might
 
 
(/s/thinks/things/).btw
 
4:59 PM
Figured as much.
Well, if you invert True and invert the result of that again, you should get True.
But that's so simple I doubt you're asking about that.
 
5:25 PM
@Mast Uhm. I have questions
 
Don't hesitate to ask them...
 
i dont actually have any
i just like the image
 
6:02 PM
0
Q: Code to create and check a numeric password

J.FitzI am very new to coding and I have created this relatively simple code to do with my basic knowledge of the language. However I have had to do with some unwanted code including shutting it down if password is too long. so could anybody help me with any improvements to this? import time password...

 
6:27 PM
@Mast I more mean, if you make two mistakes, does that mean that the mistake is gone or that you now have two problems? ^^
 
@skiwi Usually the latter :P
 
Two lefts don't make a right, but two wrights can build a plane.
4
 
Monking @Phrancis
 
Monking!
Just found this in my mailbox
> Francis,

Congratulations again on your interview invitation for [sWorkflowstageName]!
Whoops!
 
Did you hide the company name just now?
 
6:36 PM
No, that's literally copy-paste
 
Oh... lol
That's rather odd
 
Nice Hungarian notation... not
 
I'm more worried about the lack of variable replacement :P
 
That too
Ironically, it's for that "Train 50 People to Code" program :)
 
Looks like you could start training them first!
 
6:43 PM
0
Q: Best way to match current user's "liked / followed" items with results from search query?

NoobSterThis is pretty ugly now. My main objective is to perform a search query, which I do via monggoosastic / elastic search (the search paginates 12 items at time). Then, I want to match those results with a separate "Following" collection. I find documents from the "Following" collection by the cu...

 
That profile picture LOL
 
@Duga dang already deleted
BRB doing interview (it's a recorded video interview, pretty neat)
 
-1
Q: Computer Science for Python

MichelleI am deaf student. Have a hard time with this. Don't know how do this. I am hope you can help. Thank you. Write a program named filemaker.py that will be used to store the first name and age of some friends in a text file named friends.txt. The program must use a while loop that prompts the us...

 
@CaptainObvious Being deaf doesn't make it harder to read anything, right?
 
6:55 PM
@CaptainObvious Just nuke it already.
 
7:09 PM
0
Q: Makefile for refactored recursive breadth first search Knight Tour

pacmaninbwThis is my first hand crafted makefile in quite a while. I thought it might be useful for anyone who wants to review the Knights Tour - Improved Refactored Recursive Breadth First Search. The C++ source code as well as the makefile can be found on github. RM := rm -rf OBJ_DIR := obj BIN_DIR :...

 
Alright done, that was painless enough
I did send them a short email letting them know about the bug too :)
 
0
Q: I am a Beginner. Please help me to put together this code

Shubhankar PatilSo I found this code of this website for the 21: The number with the curse game. But how do you actually run it in eclipse? do we copy all the three code mentioned or they are separate? Please help. 21: The number with the curse

 
@CaptainObvious just... go away
 
7:38 PM
0
Q: How memory inefficient is this algorithm I created, exactly? (It most likely has already been thought of) Why would something like this be useless?

WakerI'm wondering how space inefficient the algorithm I created is, (I know why), and how that makes an algorithm like this obsolete compared to RadixSort. If I had thought of a way to make this more memory efficient, (which is most likely not possible) would it be significant? What is you opinion ...

 
@CaptainObvious insert random inefficient title joke here
 
-1
Q: syntax error, unexpected end-of-input, expecting keyword_end Error in Ruby

David MartinI am by no means an experienced programmer. I am working hard to teach myself and am trying to learn ruby. I recently started a project trying to make a turn based pokemon style fight game. I'm piecing my way through it. But unfortunately I can't run even parts of it. I have torn the code apart l...

 
8:00 PM
Ripe zombie; open question with answers, at least one answer having score 0, no answer having score > 0: Angular UI Bootstrap Modal scope
 
@CaptainObvious Voted Too Broad, OP seems to be looking for a discussion and not an actual review of the code
 
This question might be better suited on Code Review - but apart from that, your code is (with the advice by @Tunaki) pretty solid and it should work as expected. — RAnders00 28 secs ago
 
In C# can an instance of an object not access its own private methods....!?
 
@Phrancis Would you leave a comment?
 
@Mast done
 
8:13 PM
@Phrancis Perhaps you'll have to use getters/setters.
I don't know really, C# is odd.
lol
 
Zak
So. I picked a great time to go on holiday.
 
@Phrancis not if you try to invoke that method from a place where it's not visible
the problem is that those are separate classes
 
class ProjectEuler1
{
    private int min;
    private int max;

    public ProjectEuler1(int min, int max)
    {
        this.min = min;
        this.max = max;
    }

    private bool isMultipleOf3Or5(int n)
    {
        return (n % 3 == 0 || n % 5 == 0) ? true : false;
    }

    private int sumMultiplesOf3Or5()
    {
        int sum = 0;
        for( ; min < max; min++)
        {
            if(isMultipleOf3Or5(min)) { sum += min; }
        }
        return sum;
    }

    public int getAnswer()
Seems a bit clunky I suppose when you are used to Java access control
 
meh. you could've instead made sumMultiplesOf3Or5 public. or internal
 
8:17 PM
Internal...? May need to read up on that one
 
0
Q: Using pointer casting to change the "type" of data in memory

LiamPlease feel free to change the title. I was unsure what to title this question. This question is about idiomatic Rust. Let's say I have a file and I want to read a certain number of bytes from it: use std::io::prelude::*; use std::fs::File; let mut f = File::open("foo.txt").unwrap(); let m...

 
Ah, so internal is really more like Java's private (sort of)
At least for methods...
 
This is not a "standard approach". It's cute and brittle, and would never pass any sort of code review. Use if statements instead. — isanae 9 secs ago
 
8:41 PM
@Zak Unfortunately :/
@Phrancis internal means its only visible in the same module in C#, it's like package private in Java (no modifier) but I believe the details are not exactly the same
 
possible answer invalidation by Celeritas on question by Celeritas: codereview.stackexchange.com/posts/133025/revisions
"but I would like to see how others solve this problem" This might fairly qualify your question better to go at SE Code Review. — πάντα ῥεῖ 37 secs ago
 
@πάνταῥεῖ I don't want my code reviewed, I want to see how others solve this problem. Therefore, it is not for Code Review. — user2296177 13 secs ago
 
Remind me. If I ever say "I love humans", just remind me I actually do not.
 
What's not if this isn't a request for Code Review?? You wan't to see others opinions upon your code, and what would be their ways to improve it, or choose different design decisions than you did. What are you actually bothering with my advice? — πάντα ῥεῖ just now
 
9:07 PM
One of my Python libraries threw a MemoryError.
That's new...
 
-1
Q: Counting the number of inversions but not getting the right answer

Princejeet SinghThis is the code I wrote. I am trying to implement Merge Sort to count the number of inversions in an array. import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class NumberOfInversionsProblem { public static vo...

 
@Mast which?
 
prime_factors
 
is it you'r own?
 
Nope.
from prime_factors import PrimeFactors

factors = PrimeFactors(60085)
print factors.compute_prime_factors()
[5, 61, 197]
But it can't handle the crap I throw towards it.
 
9:14 PM
try primesieve instead
Or primefac if you need to factor numbers
 
Or just build your own :)
 
I also didn't understand it. I guess people think it is more appropriate for Code Review... — Shmulik Klein 53 secs ago
 
@skiwi slaps with a fish
`from primefac import primefac

print primefac(60085)`
scratches head
Needs a list there, primefac creates a generator if I am right
`print list(primefac(600851475143600851475141))`
`[29, 2609L, 880109L, 9023158633309L]`
9998003099700029 is a bit tougher
 
from primefac import primefac
print list(primefac(600851475143))[::-1][0]
Mwuahahaha.
 
Questions that ask for a code review are best suited to Code Review. — Ben N 37 secs ago
 
9:23 PM
Probably not how it should be done.
That's what you get for starting with C instead of Java.
 
@Mast ?
 
The first language we got taught at university was C.
 
We had Matlab..
 
We had Octave, but that was at least a semester later.
 
@Mast I wrote a quick wheel factorization algorithm to solve the problem.
 
9:26 PM
0
Q: Print max occurring character in a String

Neelesh Salianpublic class mostOccurringCharacter { public static Character findMaxOChar(String text){ HashMap<Character, Integer> map = new HashMap<Character, Integer>(); Character maxChar = ' '; long max = Integer.MIN_VALUE; for(int i=0;i<text.length();i++){ Character current = text....

0
Q: Unexpectedly high CPU usage for HTTP request using Haskell wreq

AleXoundOSThe program makes HTTP requests (checks video stream status) and calls an external program. {-# LANGUAGE OverloadedStrings #-} module Main where import qualified Data.ByteString.Lazy.Char8 as B import Control.Lens ((&), (.~), (^.)) import Network.HTTP.Client (HttpException(..)) import Network.Wr...

 
@N3buchadnezzar I know zip about algorithms.
 
It can factor 600851475143600851475141 in about half a second. However it is far slower than primefac.
39.8404614498 ms
471.093681108 ms
@Mast never too late to learn =)
 
I tried. Even got a couple of books.
 
What stopped you?
 
It's all about 'seeing the solution'. Reminds me too much of my math classes years back. Didn't like that either.
Not that I was bad at it, but that's not how something new sticks.
 
9:31 PM
Well PE is more about seeing a solution. But I totally see your point.
I know nada about servers, SQL, PHP or anything to do with making games, running a website or any of that.
Even my JAVA and C++ is rubbish
My C++ makes children cry
 
I dabble in a lot of languages, but I never got good at any of them.
Usually get done what I need to get done though.
Eventually...
 
What I like about PE is that they are hard. It takes me sometimes hours or days before I see the solution. It requires research, reading up on algorithms, and also testing with smaller variables. However it feels good when one get's it.
 
But algorithms, it can be so awfully cryptic and I haven't figured out how to start.
There was a bio-informatics problem last week that I still haven't figured out. I guess I leaped too hard.
 
9:59 PM
1.4521390764 µs (microseconds) to solve Project Euler 2. Think we have a winner ^^
 
0
Q: Sorting a list by the modulus of 3

Neelesh Salianpublic class sortByMod { public static void main(String args[]) throws Exception { int a[] = {1,90,2100, 12, 24, 80, 90, 5}; LinkedList<List<Integer>> a1=sortMod(a); for(int i=0; i <a1.size();i++) System.out.print(a1.get(i)+" "); } public static LinkedList sortMod(int a[...

 
10:13 PM
0
Q: Python api for an existing Java API

user28989I am new to python and I have to design a Python API(version - 2.7) similar to an existing Java API Python version - 2.7 The Java API is as follows There is a Process interface public interface Process<T> { Future<T> create(Client<T> client) } There are two implementations of Process . ...

0
Q: first text-based adventure game. any constructive criticism?

Zach UnrauI'm sure there are better ways to code this. I spent a lot of time re-working the code to get it as clean as possible. I would appreciate any input on what I could change to have the program run more efficiently and look cleaner. outer = False while outer == False: room_list = [] room ...

 
10:31 PM
0
Q: python imports too verbose

zhirzhI am working on a python game and the import statements are too verbose and redundant. How can I make them lesser so? This is my directory tree: game/ | |- __init__.py | |- game_1/ | | | |- __init__.py | | | |- game_1.py | | | |- class Game_1 | |- game_2/ | | | |- __init__.py | ...

 
10:42 PM
0
Q: Initializing immutable objects with a nested builder

t3chb0tI need to initialize several parameters of an object but I also wanted to make it immutable. At the same time I don't want the constructor to take all several parameters because some of them are optional and have default values that the user can change during initialization like an IReadOnlyDicti...

 
10:54 PM
@user2296177 code review is not to review your code and give you a score. If you post it there, you are basically asking for improvements or a better way to do what you're doing. That is exactly what you are wanting... — Evan Carslake 26 secs ago
 
This Sieve starts taking really long if I go over 100000 numbers, am I doing something wrong?
internal LinkedList<ulong> GetPrimes()
{
    // populate all numbers from 2 to max
    for(ulong i = 2; i <= maxNumber; i++)
    {
        primes.AddLast(i);
    }
    // trim out list using Sieve of Eratosthenes
    LinkedListNode<ulong> currentNode = primes.First;
    LinkedListNode<ulong> targetNode;
    LinkedListNode<ulong> nextNode;
    ulong currentNum;
    while (currentNode != null)
    {
        currentNum = currentNode.Value;
        targetNode = currentNode.Next;
        while (targetNode != null)
There must be something about this (probably crappy) algorithm that bottlenecks somewhere
I used a LinkedList since I'm removing nodes a lot
 
get cracking with a profiler
 
Not a bad idea, but I don't think LINQPad has one of those
Hmm I suppose I could use simple multiplications instead of iterating each and every node and using modulus each time
 
11:13 PM
well I assumed you're using the default algorithm
Rather than inventing your own sieve's internals
 
Yeah, I'm doing the latter, I think I'll stick with the default algorithm
 
Let's not try to refine an algorithm created over 2000 years ago
Hate to break it to you but that's a very inefficient use of time
 
monking
I got IP banned from the SE API last night for not throttling my requests
 
0
Q: Class like module that updates divs on main variable changes

ifsessionI'm getting a customer from my database in a json format. I'd like to assign this customer to a js variable and do stuff when the customer changes. There are certain events on which I'd like to bind my customer. When the customer turns to null or any of the variables get updated, id like to upda...

 
@JeroenVannevel Hm, fair enough
 
11:46 PM
0
Q: Checking cookie instead of session to determine user's being-login

stackHere is my current code into index.php page: (all pages passes from this page) // checking the cookie if(isset($_SESSION["LoginValidation"]) != 1 && isset($_COOKIE['login'])) { // database connection require_once('dbh_conn.php'); $cookie_value = $_COOKIE['login']; $s...

 
@Phrancis Wheel factorization, Atkins sieve, a couple of good ones here stackoverflow.com/questions/3939660/…
Tried to make a code run under a second, tried for ages to optimize it but alas nothing seemed to work. It hovered around 3-4sec. Then I realized I just read the output wrong and the code actually uses 40ms >.<
 

« first day (1148 days earlier)      last day (2871 days later) »