« first day (691 days earlier)      last day (3342 days later) » 

8:02 PM
I'm assuming that this code works, so this isn't really a question for Stack Overflow. Code Review might be a better place but check their help centre before you post. — Hobo Sapiens 55 secs ago
Yeah it works...and thanks for pointing out code review. I wasn't actually sure where to post this. — David Webb 1 min ago
 
0
Q: Best Solution for normalizing string using php preg_replace and regex expressions

David WebbI needed a way to normalize nearly any given input for a configuration parameter on a dashboard. Server side code is in php so i wrote a test script to experiment with preg_replace and regex. When I say normalize meaning, the resulting value must match the following restrictions: Take any cas...

 
Thanks for posting to Code Review! You should probably delete it on Stack Overflow now. — Phrancis 37 secs ago
 
8:18 PM
Haven't seen @janos for some time around here
 
First post on gaming.se: hot answer
 
@JeroenVannevel link?
 
I've been in hot Q/A's on SO, CR, Programmers, Gaming, Money, workplace and travel
17
A: Why isn't my connections to the highway valid in Cities: Skylines?

Jeroen VannevelIt's hard to verify it because it isn't zoomed in but I'm 99% sure it's because your road is facing in one direction at one point and in the other direction in another. Look at the arrows on the road, you'll notice that they're pointing towards eachother and essentially creating an impossible dr...

lol @ linq btw
 
(oh wow, the lapsus - /s/linq/link)
 
It's not even a very elaborate answer or anything
It was unanswered for at least 1 hour before I posted mine and it's a basic thing you notice when playing Cities:Skylines
 
8:27 PM
@CaptainObvious How many more revisions before they post new code? ...
Maybe it's just me though.
 
Studying e-commerce.
Anyone got a business they want me to run an e-commerce campaign for?
Maybe I should try my app, or RubberDuck.
 
^
 
Since this code is working, you may want to consider moving this to Code ReviewJasonAizkalns 16 secs ago
 
Trouble is, MS takes so many of the search hits with their OneNote webpages.
 
By the way, for performance problems Code Review seems to be the better place. — honk 1 min ago
 
8:40 PM
If you search "OneNote" in the Windows Store, my app is the second hit.
I'm terribly low in the Windows Phone store, though.
In Bing, my app is the middle of the first page, and it is the bottom of the page in Google.
Maybe I should get a webapp up, but I can't afford the server ATM.
 
@JasonAizkalns Thanks. I have never posted anything there, but I did consider it in the present case. I was just thinking maybe there was a 1, 2 or 3 line solution in R that perhaps somebody might post quickly here. I do not know if there are many R programmers on the Code Review site. — Mark Miller 1 min ago
This question is better suited for codereview — Bhargav Rao 40 secs ago
 
@Duga Busy today!
 
There are 17 unanswered [R] questions on CR, 76 questions and 77 answers, last of which was posted 4 days ago. Worth a shot I think ;) — Mat's Mug 13 secs ago
 
@MarkMiller if the code works as intended and you're looking to improve it, then codereview.stackexchange.com would be a good fit for your question. — Phrancis 31 secs ago
 
0
Q: Replicating a file system

LegatoThe goal of this is just to practice. I went off on a self-challenge to replicate something(So the names of the parts can be ignored), I'm not done yet (Though what is here is fully runnable), but have enough code that I thought it could merit taking a moment to examine whether I could be doing a...

1
Q: MultiLevel Javascript Inheritance

josegomezrI'm making an experiment on JS, trying to build a framework for OOP. It's called Universe. The main purpose is to emulate a mini-universe, where classes are created with a defined behavior (prototype) and objects are created from those classes to provide data. So far I managed to make inheritan...

0
Q: UPenn Homework 3: localMaxima :: [Integer] -> [Integer]

hasnoobPlease see this question for the general description. Exercise 2: localMaxima :: [Integer] -> [Integer] A local maximum of a list is an element of the list which is strictly greater than both the elements immediately before and after it localMaxima :: [Integer] -> [Integer] localMaxima l = ...

0
Q: Programming challenge. Need to optimize this Python code to not exceed the time limit

letfoolsdieI've been trying to solve this problem on Codeforces: http://codeforces.com/contest/525/problem/A but I keep exceeding time limit on one of the test cases. I made several changes (i.e. using try/except instead of 'if a in b') to my program but it still can't pass that test. My last version is t...

0
Q: UPenn homework 3: histogram

hasnoobPlease see here for the general description. Exercise 3: histogram :: [Integer] -> String takes as input a list of Integers between 0 and 9 (inclusive), and outputs a vertical histogram showing how many of each number were in the input list. histogram :: [Integer] -> String histogram xs = le...

 
9:10 PM
Just registered for classes this fall.
I hope I'm recovered by then.
Just about 6 more weeks left this semester.
 
That should give you some time to recover!
 
I hope.
Right now I don't feel like I'll ever recover.
 
If anyone's in for a laugh: youtube.com/watch?v=IdLHAqL8KJw
and WTF, half of the profile pictures just went black
 
@skiwi That's racist! [Animated image converted to link]
 
@skiwi That poor poor clutch.
 
9:21 PM
@RubberDuck Who would have thought doing a burn-out would not only be not good for the tires?
 
People are amazingly stupid.
 
It even gets better in that video
 
Dude flipping his truck was pretty priceless.
 
@JeroenVannevel We do you have a black child yelling that it's racist, isn't that racist by itself?
My driving lessons car is probably the most badass car I'll drive for a long while, not sure if that's good or bad
 
@skiwi I'm a handsome young able-bodied white male from a first-world country in a relative luxurious position. What do I know about what is or isn't racism
^ fill in the commas yourself
 
9:28 PM
Please read: What topics can I ask about here? For performance discussions Code Review might be the better place. But please check their help center first. — honk 21 secs ago
2
 
9:48 PM
I believe this is a valid question here, but would be a bit better-suited for Programmers. Design approaches are discussed there more often. The rule of thumb is that questions with not working code go to Stack Overflow, questions with working code needing improvement go to Code Review and programming questions without code go to Programmers. — Palec 25 secs ago
 
@Duga Preach it Palec!
 
10:15 PM
0
Q: Shuffle Symfony entities

wawaI've got an object $contest which is a Symfony entity that has some other entities assigned. I can get them by $content->getEntries();. That will return an object with the lazyloaded db objects. I need to display them in a random order. $tempEntries = $contest->getEntries(); $entries = array(); ...

0
Q: Simple High Score Server for HTML Game

bazolaI have implemented a basic high score server for my strategy game. The goal here was to get the high scores working for the browser based version of the game (I am using the libGDX library with GWT for this version). Unfortunately this required using websockets, which made the process more diff...

 
lol the "VBA" room is popular?
How's that even possible?
 
@paul23 There's Ducks!
 
10:31 PM
0
Q: Python code to compact other python code

PeterI've just finished (well, I can't find any more ways to break it so I guess that counts) a small function that will reduce the size of code as much as possible without breaking anything.Obviously it makes everything a bit unreadable so it's not really for cleaning the code, more for if you want t...

0
Q: Simple Javascript todo list code

Yeysidescan someone tell me how good/bad this code is for a super simple todo list made from vanilla javascript? Anything to work on or consider on my next projects? Thanks so much in advance! // establish variables var addButton = document.getElementById('btnAdd'); // event listeners addButton.addEven...

 
10:47 PM
@paul23 because it has a Rubberduck, a Mug, and a Duga.
 
yay! A @Duga!
 
11:02 PM
Something for codereview.stackexchange.com? — Fluffmeister General 13 secs ago
 
@Duga Yes. Please.
@rolfl You around today?
 
Nope
Just kidding
Yup
 
Good. Didn't want to talk to you either.
Just kidding.
I got a little idea, not sure if it's something for UBench or something separate...
 
Hmm I'm wondering once again about something...
 
Listening ...... yeah?
 
11:07 PM
@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.
 
That's an interesting idea.
 
I believe figuring out if it's O(n), O(n^2) is quite easy, and even O(n log n)
 
It will require warming things up, then teting at different scales
 
O(n log n + n + 2n + q + z) would probably be a bit more difficult.
yes
 
An approximation is probably enough.
 
11:09 PM
definitely
 
(or at least a good starting point)
 
I have 1000ish objects, which all are identified by properties, like 10 different properties. Now I want a system where I can easily select objects where property m is say "10" and property B is "1". Or other selections.. I'm wondering if using sqlite (python) and an in-memory database is a good approach. Or if there are better libraries (as it would all be in memory)
 
yup. "make it better" comes at step 3.
 
^and is that something I could ask @ SO?
 
I don't think it should be that hard to make either
 
11:10 PM
UBench.press, and uBench.squat?
 
@SimonAndréForsberg But then you completelly ignore the mathematical beauty of the big O and what you can do/use it for and you just consider it a magical number.
 
Well, you know what a bench press is... right ? ....
 
oh, right.... I should have figured it out -.-
@paul23 how do you mean?
@paul23 that is not something for SO. You can use in-memory database and you can also do just as fine without IMO.
 
@SimonAndréForsberg In the big-o only the lowest (or heighest depending on the field) order counts. - So using L'hopitals rule and taking derivatives is the way to go.
@SimonAndréForsberg Well that in a system where the average case is: N + r^2, to the big O only the r counts. Which simplifies complexity if you combine algorithms
 
11:13 PM
@paul23 when it comes to algorithmic complexity, only the highest counts, yes. I just figured that it would be a bit more problematic if the code had that kind of complexity, then if it had "pure" O(n^2) for example.
@paul23 I am not aware of L'hopitals rule, but it sounds useful.
 
Well it's for finding limits of something like: N^3 / N^2
(ok that one is silly)
 
@paul23 the complexity is simplified yes, but if the actual time taken is more complex than that it will be harder to determine the big-o simplified complexity.
 
So, in order to work, it would have to have ....
1. a function to test which takes an input.
 
That is NOT the big oh notation the.. The big Oh is just a mathematical thing, and it doesn't always describe the complete picture
 
2. a generator that can generate the desired inputs using a supplied scale factor
3. time....
 
11:17 PM
It is just a way to simplify the algorithm by stating 'variable xN' is the variable at which you get most advantages
 
Also be useful to provide projections.....
 
@rolfl using a numerical method you can never find if a function behaves like a^n or n^n (=n!)
 
oh, projections, yes!
and graphs!
 
Actually using numerical methods you can't find anything other than lower than polynomial functions..
as any set of N data points can be described as a polynomial of order n-1
 
Where numerical methods end, the programming methods begin!
 
11:20 PM
and a polynomial will always be faster asymptotically than an exponent
 
Take some well known curves from functions with pre-defined complexity, generate a base set of data for each complexity, then write a 'fitting function' that matches the current test to the baseline with the best correlation
 
like I said you can't
simply BECAUSE of how the big oh notation works
 
Sure you can, just not for everything
it will be fuzzy, but good enough
 
O(n^4) \sup an^4 + bn^3 + cn^2 + dn + e
 
@rolfl Like me!
 
11:22 PM
@paul23 So? Who cares about that one.
 
Unless you actually already KNOW your big OH you can fit any curve by adjusting the lower orders
Well point is: you can adjust the lower orders
For an exponent there are infinitelly many lower order constants.
 
The point is, it does nto need to be perfect, just good enough to get a feel.
Keep it simple, and have just one variant.
 
And when it is good enough, it can be investigated if it can be made better.
 
So, identify the scalability relative to one variant.
if your system has two variants, then test it against the other as a separate test.
etc.
 
I'm saying that you can't distinguish an exponent from a polynom
 
11:24 PM
@paul23 I doubt I will ever see an algorithm that takes an^4 + bn^3 + cn^2 + dn + e time.
 
You can't just "do it" and see if it works.
 
Additionally, in practice, one scalability dimension often dwarfs the others.
 
sigh.. But if you have a random function which you do not know you don't ever know when "dwarving" starts.
 
Further, there is value as a simple validation tool.... "I think this has O(n) complexity, oh, sh1t, it doesn't
 
"I think it has 2^N complexity"
 
11:27 PM
@paul23 you've never kissed a girl, have you ... ;-)
You know, you can't do that... right?
You can never actually touch her...
 
@rolfl ....
 
@rolfl how is that relevant?
 
you can get really, really close, but never get absolutely nothing in between.
 
Oh. Philosophy.
 
Well, it's still worth trying even if it is impossible, because the results are pretty decent despite the fact that the technical event never happened
 
11:28 PM
I'm saying that I can exactly the same curves in two completelly different complexities
 
Yeah, so you still get an idea of how your system scales
 
@paul23 What curves would those be?
 
Polynomial complexity is easy enough to distinguish yes, but you can not ever say anything then about exponentional
 
@paul23 If you can detect polynomial complexity, you can detect exponential complexity.
perhaps not with your mathematical tricks. but with code.
If this thing would be able to distinguish between the following, I'm happy:
 
Uh nope, you can't distinguish between a polynomial of N degrees and an exponent
you have to choose one or the other
 
I could plot an exponent for each (apart from the linear one) curve
 
@paul23 You mean n^4 = 4^n for n = 4? Sure. But if it is being run for different values of n, it is possible to determine.
 
And the same for n log n curves (or n^2 log n .. or log log n etc etc)
That's if you (like I said) completelly ignore what the big Oh means
take say quicksort
it really does not behave like n log n
rather it behaves like A * n log n + B * m + C. With B and C being quite high
And then doing a test would depend on the implementation details, even the underlying processor architecture would have a large influence over the factors.
 
You know what, you may be right.
@Simon, he's right.
 
But if you think you can solve it, have fun - you can of course just try and give 3-4 suggestions
 
11:36 PM
But, I think that there's enough up-side to be more than worth it.
 
Saying "it's a polynomial of degree a, or an exponents of degree b, or a logarithmic of form c"
 
Saying: the measured complexity is approximately n^2 for scale from 2 to 1024
That's cool.
Saying: the measured complexity failed to match sufficiently to simple complexity curves
That's not cool, but still OK.
 
But coming back to my point: big Oh is so nice for being a mathematically sound measure of your complex algorithm. Independent of the implementation details.
 
@paul23 that was what I was trying to get at by this:
30 mins ago, by Simon André Forsberg
O(n log n + n + 2n + q + z) would probably be a bit more difficult.
 
And for teaching I think it is better to the other approach: show how the big oh actually influences time by doing well known operations.
 
11:39 PM
@paul23 - why do people want to know the time-compexity of the code?
 
Big Oh is for algorithms and deciding what better algorithm to use?
 
In part, but that's not the biggest reason....
 
This should be migrated to codereview — Neil McGuigan 1 min ago
 
But just doing a simple regression is quite easy through datapoints
 
That's right, it is.
and that's all Simon is suggesting.
 
11:41 PM
Still has no meaning but ok
 
except, it is useful to compare it to known, common, time complexities
 
you cant know for sure that the one you will get is correct
 
And, it's useful to say: Hey, your code scales at approximately X which means, if you want to brute force ABC you will need Y years
Or, it is good to say: Hey, your algorithm closely matches scalability X, is that what you were expecting?
 
extrapolation is in this case hence a terrible thing to do..
the physicist in me just died reading that
 
0
Q: Forming combinations of a 16 bit binary number

Karthik ChilukuriI wrote this code to form combinations of a 16 bit binary number (I know it is in output is string format, but it is my goal to just print all possible 16 bit binary numbers). My question is, can this code be optimized? How can I calculate the time complexity of this code? public class Combinati...

 
11:42 PM
Bahhh.... physics and engineering are terrible partnerships
 
I've a bachelor in applied physics.. Doing aerospace engineering right now (bachelor will be gained this summer).......
 
@paul23 - you drive a car?
do you drive it down the middle of the road, or approximately down the middle?
 
I'm from the netherlands lol
 
@rolfl Sounds like a good way to get in a head-on collision.
 
I bike, I don't drive
 
11:45 PM
I think Good Enough is good enough.... in this case. Complexity is complex, and people very selddom need to know the eccentricities in scalability
2
 
@paul23 My dream. I'm learning how to drive, though.
 
Anyway, I am off for a walk... back in a bit.
 
No driving = alcohol = me happy
 
when I am back, I will look in to it.
 
And I didn't have to use approximation there
 
11:45 PM
@Simon, drop a note if there's something that interests you and you want to start. I will do something complementary
 
@paul23 Not my dream - I'm an anti-alcoholic.
 
You're not from the Netherlands I take it?
 
all we are is an Error :/
 
But rofl, is the halting problem solvable?
 
I'm in the US.
 
11:48 PM
@NeilMcGuigan No it shouldn't. It is not about code at all, and Code Review requires the code to be included within the question itself. It is also not a good question and migration rule #1 is: Don't migrate crap. — Simon André Forsberg 1 min ago
 
@SimonAndréForsberg lets change Duga's avatar
 
@rolfl yes, I'm interested in doing this. Do you think it fits for UBench? Or probably would be better of as something separate, at least at first.
@Mehrad got a suggestion?
 
0
Q: Pygame implementation of pong

Pseudonym EnigmaRecently, I have been working on a pong game in python using pygame. I have a complete basic game, however there are two problems. 1) The ball always follows the same trajectory and I do not know how to fix this 2) The AI is set to mirror the ball's motion. However, as a result, the AI always mis...

 
can I ?!! @SimonAndréForsberg I DO
my fabourite :D
 
@paul23 It seems like you're focusing on the limitations of this idea. I believe @rolfl and I focus on the possibilities. We're not expecting it to be 100% correct.
 
11:50 PM
@Mehrad I AM A SHE!!!
 
Now you've upset @Duga
 
:(
 
@SimonAndréForsberg No I am focussing on the fact that it will give falsy information that is then extrapolated into even worse things
 
I thoughts that's the only solid advantage of a Bot. Not to be bound with the sexism
 
@SimonAndréForsberg there are database-design and database-schema tags on codereview. He asks "are the following tables right?". But you're right, not a good question. — Neil McGuigan 37 secs ago
 
11:53 PM
@Duga Nope nope nope (to the first part being there).
 
@paul23 The software will be provided as-is, no warranties, for entertainment-purposes only, yada yada yada...
 
@SimonAndréForsberg Any engineer knows: "never ever extrapolate data unless you know the function"
 
@paul23 I have not heard that. And I disagree. There's nothing wrong with extrapolating, but you should always keep in mind that the extrapolation might not become reality.
 
This would be better suited for the CodeReview stack exchange, you should try there. — Loocid 1 min ago
Welcome Lionel, Stack Overflow is not really the place for your question, you should asj it on the Code Review section — AdrieanKhisbe 27 secs ago
RELOAD!
 

« first day (691 days earlier)      last day (3342 days later) »