« first day (700 days earlier)      last day (3316 days later) » 

3:00 AM
so O(n) is fastest as long as you have < 3M entries?
 
You have to have one of the top-5 selected to get a Y-scale.
@Mat'sMug That's simplistic....
Simon's algorithm does a 'best fit' calculation
it says, "If I have a straight line, what slope and Y-axis intersection does it need in order to have the smallest actual error from the data"
 
I like the CSS in the legend, but the forecolor should turn to white when the backcolor is beyond a certain threshold
 
If you 'select' the O(n) entry, it shows the actual formula used to plot the curve
77.171939*n + -2095873.106014
In other words, if the system was actually linear, each element you add to the array would cost an additional 77 nanoseconds.... and the cost starts at -2 miliseconds.
 
and r-squared at .999499 sounds like a fairly accurate plot
 
n-log-n is 0.999989
 
3:05 AM
wow
 
Anyway, the point is that any attempt to apply a mismatched curve will give inappropriate impressions.
in theory, the same algorithm improved to O(n) would have a lower slope.
the O(n) should always be below the n-log-n curve.
 
for any log-n < 1 right?
 
no, always.... ish.
 
lol right
 
I visualize the complexity as being the a combination of components.
for example, a merge-sort.......
has some basic overhead that needs to happen regardless of the size of the data.
that is the O(1) component.
then it has some work that it has that is proportional to the size of the data.... which is the O(n) component (like scan the data from beginning to end).
then there's also a log component, because it divides the data in a binary way.... and merges pre-sorted binary components...
 
3:13 AM
ok
 
So, the overall time for the run will be some O(1) time, plus a O(n) time, and then for each N there's a log-n time as well.
I would expect a curve that for any scale (x axis value) is the sum of the overhead, the linear component (the time reqired for each component), and then the search time (the log n time).
a curve like:
A * n * log (B *n) + C
where C is the overhead....
and B is the time in the log function, which happens log-n times.
and the A is the time needed for each n in the data.
Add them together, you get the time required for scale N
The complexity is n-log-n, but the performance can be improved by reducing any of the A,B, or C coefficients too.
reduce the time it takes to process each n, and you win.
reduce the constant-time C component, and you win.
 
obviously
 
Reducing the A coefficient is a big win, because that saves time every loop, and is worth a lot if there's lots of loops.
 
B is less of a win
 
But, splitting those three components out (the constant, linear, and log components), basically draws three curves.
the constant curve is horizontal, at time C
the linear cuve is straight, with slope A, and intersects the Y axis at C
Now, go back to one of those charts, and enable the O(log n) curve.
It has been 'scaled' to be a best fit', but look at the shape....
at the very left it has a steep slope, and from then on, it essentially becomes flat.
 
3:22 AM
yup
 
You take that curve, and "add" it to the slop from above.....
you flatten it down al lot (because simon best-fitted it....).
and you get a curve which starts off very steep, and then essentially becomes straight (at the original slope)
You can see the effect here:
It is designed to be a linear function, and it shows.
The best-fit linear curve is: 0.051313*n + 21.174744
 
the part I'm wondering the most about is, ...what's the code being benchmarked?
 
a slope of 0.05 nano-seconds per n in the data, plus a constant time of 21 nanoseconds.
private static final long linear(long input) {
    long count = 0;
    while (input > 10) {
        input -= 10;
        count++;
    }
    return count;
}
Then then 'tested' with:
    UScale.function(
            data -> linear(data),
            scale -> scale, true)
       .reportHTML("Linear", Paths.get("output/Linear.html"));
 
so this isn't about the code, it's purely about algorithms.
and comparing them.
with is deeply interesting, but then how does that translate into decision-making when writing actual code?
(sorry if this is a dumb question)
 
Well, the assumption there is wrong.
it is about the code.
it is about understandinghow your code scales, and giving a name to it.
There is no easy way to inspect the code and 'label' it as having complexity "Foo".
So, instead, run the code, measure the actual scaling, and then compare that with known common baselines....
and, if a baseline matches the results, then there's a good chance you code has that scaling.
So, if the Foo function matches, then your code has complexity Foo.
 
3:36 AM
hmm
 
Call it a "function scale detector".
 
right
 
This can be very useful in the decision making process, I hope, because you can possibly identify where your scalability is failing to grow in a friendly way.
Or, you can use it to do 'black-box' testing of third-party code.
For example, the ArraysSort.html code does this:
    UScale.consumer(
            Arrays::sort,
            scale -> randomData(scale), false)
       .reportHTML("Array Sort", Paths.get("output/ArraysSort.html"));
take random data of scale X, and sort it.
time it for different scales.
does it really scale the way it is advertised to scale?
 
so if you run a veeeeeerrry slow function at a huge scale, is the page responsive?
 
The page is not running the code.....
the page is just the report.
 
3:40 AM
the server
 
but, I have 1 assumption, and 1 failsafe.
I assume the code works ;-)
if the user cannot run with input size 1, then they have bigger problems.
3
 
lol
 
then, I also have a time-limit of 1 second for all scales... I run it as often as I can, with a limit of 1,000,000 loops, or 1 second.
 
ah
 
whichever comes first.
 
3:42 AM
3 mins ago, by rolfl
    UScale.consumer(
            Arrays::sort,
            scale -> randomData(scale), false)
       .reportHTML("Array Sort", Paths.get("output/ArraysSort.html"));
 
So, a slow function, with scale 1, will possibly take longer than 1 second, and be don... with just one data point.
 
brings me back to ^^^^^ - that code runs server-side when the page is requested, right?
 
nope.
not when the page is requested.
I ran that a while ago....
and saved the report.
 
facepalm. weapons-grade.
 
23:45 ... forgiven.
But pinned anyway
 
right
Anyway, the reportHTML takes the results of the 'consumer', and analyses it and produces a bunch of JSON data in the report.......
if you look at the 'source' (Ctrl U) for: git.tuis.net/ubench/BinarySearch.html
You will see an out-dented block at line 238
 
yeah
 
That's the data.
the rest of that HTML is presenting it in a dynamic way.
 
I realized that. What I thought was that the JSON data was somehow being dynamically landing into that page from server-side code.
oh and #GrammarIsFun, I just fixed another issue :)
 
Nahhh... though, that's maybe an idea I should consider DDOS on the way....
Consider that most datapoints take a second to run, at 100% cpu (and that's just the test time, the overhead does not count toward the test).
 
3:53 AM
lol
I see
 
(i.e. for the array sorting, I have to create a new array unsorted, each time... because I cannot reuse the sorted one).
 
how long did it take to generate all the data?
 
about 10 seconds per test. My code runs three at the moment.
 
(rebuilding parser)
 
/home/sol/Java/jdk1.8.0_31/bin/java (Apr 3, 2015, 11:55:18 PM)
Hmmm, bad names, starting again:
/home/sol/Java/jdk1.8.0_31/bin/java (Apr 3, 2015, 11:56:29 PM)
Completed at: Fri Apr 3 23:58:05 EDT 2015
4 tests.
Must improve logging.
 
4:00 AM
aaaaaaaaaaaaaaaaaaaaaaah FML
Error	2	The item "Grammar\VBABaseListener.cs" was specified more than once in the "Sources" parameter.  Duplicate items are not supported by the "Sources" parameter.	Rubberduck.Parsing
must have a cigarette
 
Hmmmm your error is understandable, but the response is not....
hmmm:
return IntStream.range(0, size).toArray();
is not the same as:
return IntStream.of(0, size).toArray();
 
The 'sources' parameter is a msbuild parameter - I borked something in the solution/project when I overwrote the generated files
 
Well, I have to drive in the morning.... I need some sleep.
Night
 
I think I should have deleted them first. I need to document that grammar-rebuild process
'Night!
yay source control! Rubberduck.Parsing.csproj > Undo
 
4:37 AM
0
Q: Basic Memory Match Game in Java

swnetI'm relatively new to Java and decided to make a Memory Match game. Below is the code: Here's Card.java: import javax.swing.JButton; @SuppressWarnings("serial") public class Card extends JButton{ private int id; private boolean matched = false; public void setId(int id){ ...

 
5:25 AM
-1
Q: python is giving NZEC (non zero exit code)

jazzzIn reference to codechef's counting non decreasing sequences , problem , I came up with the following solution, from itertools import combinations_with_replacement t = int(raw_input()) for x in range(t): n,l,r = map(int, raw_input().split()) lst = [] for x in range(1,n+1): ...

 
 
1 hour later…
6:51 AM
0
Q: Storing currency-precision values

AssimilaterI'm trying to develop a program that stores currency values. In my particular application I only care about two decimal of precision (cents) but have read it's a good idea (for accuracy when dealing with interest rates) to store 4 digits. I didn't notice a "currency" class in either boost or c++...

 
7:05 AM
0
Q: Array of pointers data structure

Akash#include<iostream> #include<vector> using namespace std; template <class T> class pointerArray { vector<void*> addresses; public: pointerArray(int initialSize=100) { addresses.resize(initialSize); } ~pointerArray() { for(unsigned int i=0;i<addresses.si...

0
Q: Project Euler 78: Counting Partitions

castle-bravoI wrote the following solution to the coin partition problem. I use Euler's recurrence relation for the partition of n and that modular addition is associative; (a + b) % n = (a % n) + (b % n) % n. #include <iostream> #include <vector> using namespace std; int main() { // generalized pentagon...

 
7:47 AM
0
Q: Multithreaded for loop

ThatGuy343I am trying to multithread a for loop, and this works so far. How can it be improved? Have i done anything inccorrectly? The work is broken up into blocks and the block variable is the amount of objects to process per thread. TEST CLASS public class TaskTest extends MultiThreaded { public...

 
8:10 AM
0
Q: iOS compile error: No visible @interface for 'setLocationManger' declares the selector

Kehlin SwainI am currently completing a Ray Wenderlich iOS tutorial over #Augmented Reality , and as I came to this problem concerning the setLocationManger not being found in the MainViewController interface. Which I don't understand because I thought this was included in the class of CoreLocation/Corelocat...

 
8:37 AM
0
Q: Database : what design to point on two possibilities?

sdespontI am designing a datamodel for a new project. One of the requirements specifies that some objects can point either a person or a company. What is the smartest way to achieve that? I have thought about a table link "actor" like this (drawn with the excellent yUML.me BTW) : In the actor table...

0
Q: A dictionary that allows multiple keys for one value

user69610I'm trying to learn to program on my own with the help of books and the Internet and thought I'd start a project (a sub-project for a project). I want to build a dictionary that allows multiple keys for one value: d = mkdict() d['what', 'ever'] = 'testing' d['what'] is d['ever'] # True I thou...

 
 
2 hours later…
10:39 AM
Morning @all °/
 
Morning
 
0
Q: Project Euler #11 in Ruby and some Iterations

Chris YeungQuestion: Given a 20x20 Grid of integers, find the greatest product of four adjacent numbers. (up, down, diagonal, reverse diagonal). 08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08 49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 00 81 49 31 73 55 79 14 29 93 71 40 67 ...

 
Monking
 
Morning @skiwi
 
11:03 AM
0
Q: Network arithmetic, finding the next host for the given

zerkmsDisclaimer: It's literally the second time I write in Haskell. The purpose of this module is to provide some basic operations with IP addresses (and networks). At the moment I only implemented the successor operation, that returns a next address in the range if it exists. Eg: for 192.168.1.1 i...

 
@rolfl @Mat'sMug I see I am being watched talked about :) (or rather, my algorithm)
 
indeed
 
11:21 AM
~confused did I miss something?
 
@Vogel612 depends...
9 hours ago, by rolfl
@Mat'sMug - it's coming together now.... See: http://git.tuis.net/ubench/
Mar 28 at 17:39, by Simon André Forsberg
yesterday, by Simon André Forsberg
2 hours ago, by Simon André Forsberg
@rolfl many people seem to have problems knowing what the complexity of their code is. I figured that by providing a void doSomethingToFindComplexity(int n) method, and in that method create an input and sort it using some algorithm or whatever, it would be possible to estimate the actual complexity of the code.
 
lol that's a cool idea
 
It seems to work quite well as well.
 
It works amazingly well, not just "quite well"..... ;-)
 
monking
 
11:35 AM
The graph is too big for my lap[top though, it works best at HD....
hey Dan
 
I have to disappear for a few hours... Bye bye
 
12:08 PM
4 followers on the tweeter in 30 minutes
I must be the next hot stuff
 
lol
 
12:30 PM
0
Q: Insert entity to the table in Entity Framework

Farhad Jabiyev public virtual void Add(T entity) { DbEntityEntry dbEntityEntry = EfDbContext.Entry(entity); if (dbEntityEntry.State != EntityState.Detached) { dbEntityEntry.State = EntityState.Added; } else { DbSet.Add(entity); ...

 
12:45 PM
0
Q: run command line in python (festival)

user69615I am trying to make a text to speech program, using festival. When running it in command line sudo festival (SayText "Hello") In python : import subprocess subprocess.call(["festival"]) subprocess.call(["(SayText\"hello\")"]) It raises an error, I put the back slashes in python so that it wi...

0
Q: Php form data not adding to database

Adam Khoury DesignNew to this site! Im attempting to upload some form data to a PHP database I have made on my server. The information I manually added via PHPMyadmin shows up but the form submitted data is not being added to the database. I am checking the information on a separate website that connects to the...

 
@rolfl You are a lot better at Java concurrency than me. Can you look over my answer here and tell me what you think?
0
A: Multithreaded for loop

Simon André ForsbergMulti-threaded concepts are complicated at times. If you really want to learn multi-threading, it is important to get it right. Some things can be extremely difficult to get right. I can highly recommend reading Java Concurrency in Practice. Overall It is not that often I see "multi-threaded co...

You will probably also find the question interesting. And the code nasty.
 
1:03 PM
0
Q: Ascii85 in Elixir

TrejkazI'm a complete newbie to Elixir, but I managed to bang together this working example of Ascii85 for a project I'm working on in my spare time. I find some awkward repetition in here which I have tried to replace with iteration but it just made the code harder to read. There is also some lop-side...

 
0
Q: A PHP User System

Hassan AlthafThis PHP User System was built with MySQLi and I also used Composer. I'm planning to improve this, and add more stuff and release it as a sort of a module for Composer. Here is my source code: User.php (Controller File in the src/Controller) folder. <?php namespace Application\Controllers; use...

 
0
Q: A PHP User System

Hassan AlthafThis PHP User System was built with MySQLi and I also used Composer. I'm planning to improve this, and add more stuff and release it as a sort of a module for Composer. Here is my source code: User.php (Controller File in the src/Controller) folder. <?php namespace Application\Controllers; use...

 
@HassanAlthaf asking for feature suggestions is a bad idea, because that's mostly opinion based..
 
@Vogel612 Alright, i'll remove it.
 
1:20 PM
Sure. Welcome to Python and also to SO. Please give a brief skim to the FAQ and browse some other few beginner Python questions to see good tips on how to ask your question here to get the best response. Also you might like CodeReview for general code-reviews as opposed to specific questions with well-defined objective answers. — smci 57 secs ago
@smci "Why doesn't this code work?" questions are off-topic on Code Review. Please read Be careful when recommending Code Review to askersSimon André Forsberg 37 secs ago
 
@SimonAndréForsberg meh. They added a disclaimer... they probably know.
 
@Vogel612 felt like it was a site suggestion to me, I might have misinterpreted it though.
 
0
Q: Debugging game logic

user3646508Spec- In the game the children sit in a circle and one person outside the ring (the leader) sings a song with a fixed number of words. Moving clockwise around the circle, the leader points to a new child in the ring for each word in the song. The child being pointed to on the last word of th...

0
Q: Element in Reverse order using File

koshish kharelI have write this code to get in descending order, input is taken from file. i want output as case#1:something here case#2: somethig here and so on. case1 contains first line and case2 contains line 2 of file, but i cant get it my code is public static void main(String[] args) throws NumberForma...

 
dammit Simon, I also want some comments!
:)
 
I removed at the same time as well, then I noticed you also removed it, so I re-added it :P
 
1:28 PM
well you had been 3 seconds faster
 
yeah, but I wasn't sure if you had seen my comment or not, or if you were going to remove it
 
in the past two days I have created a mobile-first web app with sessions using the new JWT standard that stores tokens in redis (for revocation) and user information in mongoose
 
and?
 
so basically in the past 2 days i've been more productive than i have for the past year
lol
 
hmm... ya..
if you say so....
 
1:29 PM
:( I feel like I've just killed a cat in front of you or something ha
 
meh.. not really.. I just.. don't find that so extremely funny...
 
That is, essentially, the story of my dating life lol
hello all anyway
 
OMFG spotify!!! The song's not bad, but could you stop looping the same 5 Songs when there's like. 50?
 
2:25 PM
0
A: Basic Memory Match Game in Java

Simon André ForsbergCard class Your id does not change after being set once. This makes it perfect for being set inside a constructor. This will also allow you to make it private final int id; . It is a good practice to use final fields whenever possible. Instead of: Card c = new Card(); c.setId(val); Do: Card...

 
0
Q: Find the max. difference between two array elements a[j] and a[i] such that j > i

Maksim DmitrievThe source of the problem is here. Given an array of integer elements, return the maximum difference of any pair of numbers such that the larger number of the pair occurs at a higher index than the smaller. Here is my implementation in Java. package algo.mindiff; public class Main { ...

 
@SimonAndréForsberg nice one..
on a completely unrelated sidenote... can you recommend a DOM parser that doesn't blow up when encountering malformed elements?
 
2:52 PM
codereview.stackexchange.com would be more appropriate for this — laggingreflex 39 secs ago
 
0
Q: Initializing a series of instance variables within a class with multiple conditionals

EcnalyrI started with this really jumbled initialize method: class MyPhaser attr_accessor :event_uuid, :organization, :location, :map_id, :phase_name, :phase_timestamp, :phase_ui_config_json, :phase_ui_config_json_v2 def initialize(args = {}) if args[:source_ui_conf...

0
Q: Python3 evaluate Parenthesis Expression for correct nesting and matching Parens

Gregg LeventhalPlease review this solution for matching parens for correctness and nesting. def matchParens(pstring): plist = [l for l in pstring] newlist = [] if plist[0] == ')' or plist.count('(') != plist.count(')') or plist[-1::] == '(': return False while len(plist) > 0: he...

0
Q: A Table object that accepts input and displays rows

BBeditI think my Table class may be doing too much. I feel as though I should perhaps create a separate Input class that deals with editing the table's rows. My main problem is knowing when to create a new class. Is it true that the table is doing too much? Which things should be made into other class...

 
@laggingreflex This code seems to have been shortened down and stripped of context, it would likely be considered "example code" on Code Review and therefore closed as off-topic. — Simon André Forsberg 35 secs ago
 
@Vogel612 sorry, can't help you there :)
<afk>
 
3:17 PM
How can I get exactly 11 rep?
I want to be at 12,345
 
get answer upvote, accept of an answer and downvote
or get 3 question upvotes, give away 4 downvotes
 
Mmm, I love being the 3rd or later answer to a post and quickly being the most upvoted...
even if it is only 1, 0, 0...
Also, the abundance of "Here's some Objective-C code. Translate it to Swift for me." questions are getting irritating.
 
@SimonAndréForsberg: but I never said Code Review was for "Why doesn't this code work?" questions. I said it was for code reviews. And I directed them to the FAQs. — smci 33 secs ago
@smci Simon was simply pointing out that this question is very much so a "Why doesn't this code work?" question, so it's probably not the best question to be pointing a new user toward Code Review for. — nhgrif 11 secs ago
I'm voting to close this question as off-topic because it is asking for code review. — ChristopherW 1 min ago
 
3:33 PM
-3
Q: Anyone else annoyed by this advertisement?

David WallaceThere's one advertisement that frequently appears in the right margin of Stack Overflow pages, that I find annoying and distracting. Does anyone else feel the same way? The advertisement in question is for a Microsoft Developer Camp. It has a man with his arms folded. To the left of the man...

 
@ChristopherW This question isn't asking for a Code Review, and wouldn't be appropriate for Code Review. That may be one aspect of this question, but the user is asking for help writing additional things that aren't already implement (try/catch, checking for installed applications, Windows version check, calculate virtual memory, etc.) This question is probably "Too Broad" for Stack Overflow, but it's definitely off-topic for Code Review. — nhgrif 1 min ago
And I never referred this question to Code Review. I told them to read the FAQ, and also that Code Review is a separate site for a different purpose. This question had already been answered here, so there was very little chance they would both misunderstand and go repost it there, of all places. I will take care not to give any impression to the contrary, ok? — smci 29 secs ago
 
3:49 PM
0
Q: Find Triangle Triplets from a list of given numbers

Steephen If a triplet of segments A, B and C are triangle triplets if and only if - A + B > C - A + C > B - B + C > A Is there a better implementation for this problem? #include<vector> #include<iostream> void findTriangleTriplets( std::vector<int>& vec_input, std::vector<std::vector<int

 
0
Q: Find Triangle Triplets from a list of given numbers

Steephen If a triplet of segments A, B and C are triangle triplets if and only if - A + B > C - A + C > B - B + C > A Is there a better implementation for this problem? #include<vector> #include<iostream> void findTriangleTriplets( std::vector<int>& vec_input, std::vector<std::vector<int

0
Q: Are there any syntax changes in Python 3.5 alpha?

Mrfunny744This is just a quick question, Python has realesed python 3.5 alpha3. Is there any syntax changes I need to know before it comes out?

 
Thanks Captain
It is pretty bad O(N^3) algorithm, but is there a better way. I wrote in O(N^2) but looks like a dirty complex implementation
 
I fixed your bulleted list for you.
My C++ isn't the greatest. Are you passing in a vector by value, and a vector by reference and returning void, and the one passed by reference is filled?
Why don't you just pass in one by value and return a vector instead of returning void?
Also, which version of C++ did you use? Is it necessary to tag with both and ? Does just cover it?
 
0
Q: Is this the best way to check sorting (in recursation)?

DeBananaPlease let me know if there is a shorter way... static bool isSortedArray(int[] ar, int length) { if (length == 0) return true; bool temp = isSortedArray(ar, length - 1); if (temp && ar[length - 1] < ar[length]) return t...

 
@Steephen ^^^
 
3:59 PM
@nhgrif I am passing vector by reference
 
Yes, but why not not pass it and instead change the return to vector rather than void?
 
Yes, triplet reference is filled with return values
Return by value should be optimized really , but this will be better code I assume
It should need C++11,
 
no
there's no reason to assume that at all
 
@Yuushi Can you please elaborate
 
@Steephen any decent compiler will use NRVO there
 
4:03 PM
Yes I know
 
using a reference means an extra pointer dereference on each member method
 
But its overhead should be minimal
 
But why pass by reference?
Why do functions have return types if you just use void and always pass by reference to fill?
 
0
Q: General Fizzbuzz

wei2912I'm learning Rust now and created a program to solve the task General Fizzbuzz on Rosetta Code. For example, given: 20 3 Fizz 5 Buzz 7 Baxx where the first line indicates the upper bound and every line after that indicates the divisor and the corresponding word, the program should return: 1 ...

 
The advantage I found is I dont need to write a lengthy function signature
 
4:05 PM
...
 
if we return by value, I need to write a lengthy function signature for FindTriangleTriplets
 
Okay, anyway... the triplets vector that's being filled, that's a vector of vectors. The inner vectors always have 3 things in them?
 
Yes
 
Your function signature would be slightly longer, you'd write it once... and it'd make all the rest of the code more readable.
 
function signature would be shorter
 
4:07 PM
actually,yes
because now you have 1 argument instead of 2
 
@Yuushi should be right
 
> Overall, move on. You're way past FizzBuzz as a dev.
@RubberDuck Lol.
 
28
Q: Who's in the fellowship? When are Frodo, and the rest of the gang, together

rolflAs a variant on the fizzbuzz concept, and as an exercise for learning JavaScript, HTML5, and CSS (I know none of them very well). The regular fizzbuzz is somewhat tired, but having a web-based, visualizable output seems to be useful, and being able to adjust the inputs at will, allows you to see...

10
Q: FizzBuzz vs. FortRan

rolflIn keeping with using FizzBuzz as an introduction to a language, I present FizzBuzz with a Fortran95 twist: For multiples of 3, print Fort, and for 5's multiples print Ran. For multiples of both, print FortRan. Looking especially for style and common practice criticisms. A hint on how to left-j...

Never past fizzbuzz
 
:)
 
@Steephen What happens if findTriangleTriplets is passed a vector that's not empty?
 
4:11 PM
0
Q: PyDOS: Version 2.0

Mrfunny744you might remember PyDOS from my other post. I have now updated it and its better than ever! Post any ideas below that could make it better. Source Code: import time import os import sys import random def splash(): print () print ("PyDOS") print () print ("Version 1.9.8") print ...

 
@nhgrif yes another opportunity to consider
 
I'm writing an answer, for the record.
 
but I may need to slightly change a program statement or program to taken care it
If I use given a list of numbers as input, albeit it should be taken care even then
Thanks nhgrif
Any suggestion to improve algorithm in its execution time
It is pretty bas using O(N^3)
bad*
 
1 2 2
1 3 3
1 4 4
1 5 5
1 6 6
2 3 2
2 3 3
2 3 4
2 4 3
2 4 4
2 4 5
2 5 4
2 5 5
2 5 6
2 6 5
2 6 6
3 4 2
3 4 3
3 4 4
3 4 5
3 4 6
3 5 3
3 5 4
3 5 5
3 5 6
3 6 4
3 6 5
3 6 6
4 5 2
4 5 3
4 5 4
4 5 5
4 5 6
4 6 3
4 6 4
4 6 5
4 6 6
5 6 2
5 6 3
5 6 4
5 6 5
5 6 6
Those results are right?
Should results contain 2, 4, 5 and 2, 5, 4
 
hmm
No need
There is a bug
Let me investigate
 
4:28 PM
0
A: Find Triangle Triplets from a list of given numbers

nhgrifFirst thing to comment on after copying and pasting into my IDE, the following line gives a warning: int size = vec_input.size(); Implicit conversion loses integer precision: 'size_type' (aka 'unsigned long') to 'int' Apparently, the size() method of Vector returns an unsigned long, and w...

upvotes ahoy
@Steephen change k=0 to k=j?
 
@Hosch250 =;)-
Seriously though, may I suggest something that requires the use of classes?
 
Public Class ComplexNumber 'There are already lots of examples of RationalNumber
 
I'm going to stick to C# for now.
 
@nhgrif Thanks
 
I can't take the job anyway, so I might as well try to learn C# better for now.
 
4:35 PM
that fizzbuzz in rust looks.. complicated
 
@upvotes done, and more you can expect soon
 
I can't tell if it's supposed to be fizzbuzz or a tool to launch nuclear missiles
 
@nhgrif working on a O(N^2) on same problem
Definitely will include your suggestions
 
@JeroenVannevel Both.
The government is getting its code reviewed under the guise of poor, innocent FizzBuzz.
 
When did FizzBuzz get promoted to General?
I thought he was a Corporal.
 
4:42 PM
Huh?
Last I heard, he was a 5-star general under court martial.
 
4:56 PM
> Please let me know if there is a shorter way to do it again without any kind of loops. recursion only.
This is specified in a current question.
It's again, another seemingly abitrary restriction. What if loops are objectively better by every measurable standard?
 
@nhgrif Probably a class requirement.
If not, maybe the user wants to learn recursion and just chose a not-so-great learning program.
This guy needs an answer for every method, or something:
2
Q: PyDOS: Version 2.0

Mrfunny744you might remember PyDOS from my other post. I have now updated it and its better than ever! Post any ideas below that could make it better. Source Code: import time import os import sys import random def splash(): print () print ("PyDOS") print () print ("Version 1.9.8") print ...

 
@nhgrif k=j solves the bug you figured out, but it will open other serious issues
if you try set 2,1,5 you may observe it
It is a buggy piece of code, more work needed
 
5:24 PM
380 pounds for a one-day conference pass
why is this stuff so expensive..
 
That sounds heavy, not expensive.
2
 
This is seriously one of the coolest schedules I've seen so far
 
JS1
@Steephen How can you make that O(N^2) when there can be O(N^3) correct answers?
 
5:45 PM
@JeroenVannevel because good developers have money
wait, that makes no sense at all
 
Are.. Are you implying I'm not?
I'm sad now
 
6:15 PM
This isn't funny - at least not to me:
3
Q: PyDOS: Version 2.0

Mrfunny744This is a follow up question to PyDOS shell simulaton you might remember PyDOS from my other post. I have now updated it and its better than ever! Post any ideas below that could make it better. Source Code: import time import os import sys import random def splash(): print () print ("P...

First question, he doesn't make all the changes and posts a second (this one).
This question, I suggest some changes, he makes a few (not all), apparently breaks his code and doesn't test it, and posts it as an answer.
 
@JS1 I am working on it. Here we have 3 nested loops. If I implement multiple 2 nested loops its Big O notation will change. I am not sure will it be effective in performance !!!
 
The code just got updated a bit. The calc now dosent have a welcome loop. — Mrfunny744 4 mins ago
I quit. He doesn't seem to care anyway.
 
6:32 PM
1
Q: Spam classifier

CaridorcI wrote a small script to get the probability of a given text to be spam. I downloaded some ham (good content) and spam (bad content) text from the internet. The spam corpus is a 1.8 MB txt file, the ham corpus a 3.6 MB txt file. My method is pretty naive: I count how many times each word appear...

 
The short answer is yes. But assuming this code works correctly, it's kind of off-topic here. I believe that codereview.stackexchange.com would be more suitable. — David Wallace 1 min ago
 
@Hosch250
-1
A: PyDOS: Version 2.0

Mrfunny744Ok guys, some things have been updated and fixed, almost all sleeps have been removed and some ideas have been implemented. Overall, the code should look better and ideas are still accepted. (Updated) Source code: import time import os import sys import random def splash(): print () p...

Downvote and flag that answer.
 
-2
Q: Library Management system

DonkHi I have created a school management system but unable to run it as I get the following errors: 8 duplicate symbols for architecture x86_64 Error 127 occurred while running autoreconf make: ***[libproject2] Error1 make: *** No rule to make target 'all'. The following is my code: main.cpp: #i...

 
Anyone familiar with YouTRACK?
Seems like another Jetbrains child
The cloud version is supposedly free for up to 10 users
 
6:53 PM
@nhgrif I thought I maybe should, but wasn't sure. Thanks.
 
@royvano If that's what you call correctly formatted, then I recommend you start putting some working code examples (not this one... this one doesn't work as intended) to Code Review... because that was far from well formatted... — nhgrif 1 min ago
 
0
Q: How to split code into functions?

siemaI'm writing an animal shelter program, which keeps a database of different classes of animals (dog, cat, monkey). Functions that create the form and add the animals are very similar (difference is two questions and the rest is the same). Is it possible to divide this functions into parts so that ...

 
7:10 PM
@CaptainObvious off-topic.
for now
 
7:41 PM
@CaptainObvious How to split title into better?
</afk>
 
0
Q: Functions and a GUI for entropy-related calculations

TidBI wrote a script with utilities for calculating the entropy of iterables and included a Tk GUI that shows a quick overview over a text's properties in real-time. (on GitHub) I tried to follow PEP 8 as good as possible, but I'm not sure about other things, specificially: I think my docstrings a...

 

« first day (700 days earlier)      last day (3316 days later) »