« first day (463 days earlier)      last day (2154 days later) » 
00:00 - 21:0021:00 - 00:00

12:17 AM
0
Q: Wrapper for jquery Ajax to ensure redirects occur on clientside - Round 2

drezaA while back I posted an code review on handling ajax and redirects when a server side error occurs. Wrapper for jquery ajax to ensure redirects occur on clientside Since that post I've been using this module extensively (in MVC.net projects) and it works really well in conjuction with some ser...

 
12:59 AM
0
Q: Cleaning up a rotating image gallery

EasilyBaffledI have created a nice little image gallery for the web. I set out wanting 3 things. 1. The whole gallery had a basic level responsiveness to it. 2. The gallery would take images of any size, and display them without cropping. 3. The gallery would run automatically. If you look here I have done ju...

 
1:33 AM
0
Q: merge sort in JavaScript

SpiderPigI implemented this merge sort in JS and noticed that for random integer numbers it's a lot faster than the build in sort functions of all the browsers I tested (Chrome, FF, IE). Does anyone have an idea why that is? Also, is there a way to make my code even faster? function bubbleSort(f, a, star...

1
Q: While loop uses extra variables - can this be cleaned up?

ShaneA piece of my program allows the looping and incrementing of a targeted entity to be used in a while loop somewhere else. Here is a sample of the while loop: while (state.World.Looping(reqComponents)) { TimerComponent timer = state.World.GetComponent(TimerComponent.Type); if (timer.IsAc...

 
 
2 hours later…
3:26 AM
0
Q: Why am I being asked to review suggested edits when I can't approve or deny them?

SnowbodySo I see the yellow box next to review, and click it. It offers to let me review suggested edits. But when I get there, the only option available to me is "Skip". Why is it offering for me to review it if I can't do anything about it?

 
4:14 AM
@Pimgd You can set your preferences to ignore certain tags. (Unfortunately, that post was mis-tagged, so it wouldn't have helped.)
 
0
Q: Bash functions to run/manage mysql, redis, sidekiq, rails server

ivanI'm working with a Rails app that requires a few layers of infrastructure to run: MySQL, Redis, Sidekiq, and (of course) the Rails server. I wrote some functions to help me manage the various servers (start/stop/check and one to kill the rails server when it gets hung up and decides to eat all my...

 
5:11 AM
0
Q: Is there any alternate method for swap values without temporary variables?

Sujith KarivelilI have some code snippets for swapping values without using temporary variables: Using addition and subtraction: #include <stdio.h> int main() { int x = 10, y = 5; // Code to swap 'x' and 'y' x = x + y; // x now becomes 15 y = x - y; // y becomes 10 x = x - y; // x becomes 5 prin...

 
5:57 AM
@CaptainObvious I'm confused
he accepts an answer that's basically identical to part of his question, except less readable
after he apparently decided another part of his question was a better way to do it
oh, now he un-accepts
ehh, I'm not even sure that was on topic to begin with
whatever, time to sleep
 
6:40 AM
1
Q: Vectorize Fisher's Exact Test

user133206I have two data frames/ lists of datas 'humanSplitandratSplit` and they are of the form > ratSplit$Kidney_F_GSM1328570 ratGene ratReplicate alignment RNAtype 1 Crot Kidney_F_GSM1328570 7 REV 2 Crot Kidney_F_GSM1328570 12 REV 3 Crot Kidney_F_GSM1328570 ...

 
7:07 AM
0
Q: Can You Tell Me Whats Wrong With My Java Code?

KEVINTHIS IS MY FIRST CODE ITS IS USE FOR CHECKING AGE. (FIRST TIME DOING CODE DON'T JUDGE) package bucky; import java.util.Scanner; class apples{ public static void main(String args[]){ } System.out.printnl("Enter your age: "); Scanner bucky = new Scanner(System.in); ...

 
7:32 AM
fuck it
 
 
1 hour later…
9:01 AM
0
Q: Recursive function that generates the permutations of a string

splashinnI am looking for a review of my recursive function that generates the permutations of a string. Are there better ways to do this? var permutations = []; function doPerm(str, arr) { if (typeof (str) == 'string') str = str.split(''); if (str.length == 0) permutations.push(arr.join('')); ...

 
9:30 AM
Can You Tell Me Whats Wrong With My Title?
 
 
1 hour later…
10:47 AM
Hey folks, what kind of mobile phones do you have and how're you enjoying/not enjoying it?
 
11:03 AM
I have a Blackberry.
I really love the physical azerty keyboard. I won't be happy when I will have to change it for a touch-only phone.
 
android, enjoying
 
The Blackberry pad is fine to navigate in files once you get used to it, but rather bad to do anything else. No wonder there are not many games.
 
Hello, Android:awesome
hello
 
11:45 AM
What kind of Android phone do you have?
 
12:01 PM
nexus 4
 
Would you buy it again today or rather take the nexus 5?
(Assuming you needed to)
Oh well, the price tag doesn't have the huge gap I though it would.
 
12:25 PM
Hello, Again
I have a Galaxy Y.
 
What a courageous comment...
 
1:00 PM
@kleinfreund I'd buy the 5 ;)
this phone has many problems, but it's good enough
 
0
Q: Project Euler #1

Bhathiya-JaDogg-PereraThis is a very simple one. If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000. My solution : #include <stdio.h> #define TOP_LIMIT 1000 float sum_of_...

 
Why can't I add the project_euler tag to my question
Is it because project_euler is in my ignored tags. I'm ignoring other peoples questions of that tag though. I cannot tempt my self to get spoilers
 
@janos What's the issue with the 5?
 
@kleinfreund I meant my nexus 4 has its issues
 
Oh, right. ok.
 
1:07 PM
but they are small enough I don't actually remember right now...
very rarely, but spontaneous reboots
battery life is not great, have to charge every night, even though I keep wifi off in general
 
I'm just considering my possibilities, because my battery is basically broken.
It's empty in the matter of hours, really.
 
ouch, that's a serious problem
I like my phone, I'd buy it again
and by "it", I mean whatever is the latest google phone at the moment, so right now that's nexus 5
 
Having battery issues is basically a side effect of having an Android phone and not paying attention to what all your apps are doing in the background.
Since the OS doesn't really limit the app background activity.
 
sure, it's good to keep your phone clean, avoid junk
 
Are you telling me... there is no easier way to implement a cell edit event?
valueTableColumn.setOnEditCommit(cellEditEvent ->
    cellEditEvent.getTableView().getItems().get(cellEditEvent.getTablePosition().getRow()).setValue(cellEditEvent.getNewValue()));
 
1:12 PM
wow... what is that?
 
@nhgrif No, it's not. I use my phone for messaging via SMS only, rarely phone calls. I have nothing running in the background apart from the message app.
 
@nhgrif That is JavaFX 8
It's like, they did not provide a factory method for it? :|
 
I'm not saying it's necessarily the cause of your problem.
 
Yeah for it as a general cause you're right. Sure thing.
 
But if you have an Android phone, you have to pay attention to what apps you're letting do what in the background because the OS doesn't care.
 
1:15 PM
Anyone also having a really really really weird chat just now?
 
Well, Apple stuff is out of the league. Too expensive for me, currently.
 
What phone do you have?
 
Samsung Galaxy Ace ._. @nhgrif
I can go low budget (Moto G) or more expansive (Nexus 5, etc)
But I don't know how to decide.
 
I had very bad experience with my prev phone, a motorola
I hated that thing
go for the nexus
do you need a lot of space?
I didn't. I got the cheapest one, and it was a good deal
 
I've got a Motorola Moto G right now, no complaints so far
 
1:29 PM
Galaxy S3 is also being good for me
Uh wait, I have an S4
Nexus 5 might be better then indeed for lower budget
 
Oh, for some reason I thought Nexus was the expensive Android phone, but that's the Galaxy, right?
 
Nexus is the Android phone from Google. There are more expensive ones.
Samsung Galaxy S5, LG G3, etc.
Galaxy Ace is old.
 
$349 for Nexus?
 
Yes.
 
iPhone 5c isn't that much more expensive.
 
1:33 PM
Well, 500 bucks?!
460 for the 8GB one.
 
@Jamal quit deleting stuff!
 
0
Q: losing edit points when questions are deleted

Malachi3 questions were deleted because of being closed and off-topic, I had edits on various places on those posts and lost points for the edits that were approved by the community. is this the way it is supposed to work, or is this something that should be where if the post is so old it doesn't get re...

 
1:48 PM
0
Q: Sorting Visualizations - WinForms

Vogel612Description I think many many people have seen this youtube video "15 Sorting Algorithms in 6 Minutes" When I saw it, I decided: "I can do that better" and I tried to get things done with the tools at my disposal back then. Windows Forms and C#. I added a functionality to allow the pausing of so...

 
And I give you: Wall of Code ^^
 
Is the point of Project-Euler speed?
 
17 upvotes left before I have the Java banhammer on SO
Life will get so much better then
 
@nhgrif nope
just solution..
 
2:03 PM
0
A: Project Euler #1

nhgrifMy first big concern here is that we're looking for an integer answer to a question about a sum of integers. Everything about this problem screams integer, integer, integer. But to calculate the answer, we're converting to float, using a confusing formula (that I finally figured out what/why), ...

 
@JeroenVannevel what's that?
I mean, the "Java banhammer on SO"
 
@janos Ability to close questions as a duplicate once you have 1000 upvotes in a tag that's on the question (at the first revision)
 
cool
java questions on SO are really hard + not interesting
high competition and lots of junky code
 
0
Q: Verifying the Credit/Debit card number using mod10 algorithm

Sujith KarivelilThe Credit/Debit card numbers are verified with Luhn’s algorithm. The first digit of the card number is the Major Industry Identified (MII), which tells us which category of the entity issued the card. For example, If the number begins with 1 or 2, it’s issued by Airlines industry. If the num...

0
Q: Splitting plain text dictionary data to multiple files

janosI have a plain text file with the content of a dictionary (Webster's Unabridged Dictionary) in this format: A A (named a in the English, and most commonly ä in other languages). Defn: The first letter of the English and of many other alphabets. The capital A of the alphabets of Middle and Weste...

0
Q: Multiple if else statements plus more nested ones

IsuruI'll try to explain the problem as best as I can. There will be a wall of text but please bare with me. In this iOS app I'm working on, there are two landing screens shown to the user depending on a particular status. The screens are Login screen and Activate screen. Let me explain what this A...

 
2:33 PM
@janos What's hard about "Using == with strings doesn't work!"
 
@nhgrif dunno what you mean
 
It's a very common, very easy Java question on SO
 
but it's a dupe..
and people still FGITW it with a RTFM answer and get upvotes.
 
@nhgrif most of them are not like that
 
2:50 PM
0
Q: Fat ViewModel - mvvm, winrt

fexHow to deal with ViewModels that are "fat" - or should I just accept it sometimes? Example - one of my ViewModel (editing image page, almost 300 lines of code) which has a lot of UI Commands like cropping, quick image filters (like contrast, brightness), undo, redo etc. public class ImageEditVie...

 
I really hope I'll never have any memory issues
I think I understand most of how the GC works and how you should treat it but damn, debugging the GC is extremely complicated
 
0
A: Showing a certain screen depending on a particular status

nhgrifif Preferences.getDeviceIsActive() == true { // Checks if deviceIsActive flag is true. redirectToView(.LoginScreen) } else { // If there is not deviceID, generate one. if Preferences.getDeviceID() == nil { var deviceID = NSUUID.UUID().UUIDString deviceID = deviceID...

 
Woohoo! Breaking Bad is on today!
 
3:20 PM
0
Q: Random Schedule Generator

CarcigenicateIn an attempt to try something new, and possibly help out at work, I tried creating a random schedule generator that generates schedules based on 3 inputs (Rotation length, Staff list, and Shift list), then filters them based on predicates (so far, the only predicate is to make sure that no-one i...

 
3:44 PM
@JeroenVannevel Step 1: To avoid GC, do not use objects... Now enjoy :P
And your code will look awful
 
Thanks, Santa!
 
I may need to take a look at that query again. I'm usually a bit hesitant if it's not already updated.
 
@rolfl what are those things? "one-vote-short" if I click on it I get an empty page
 
Hello @all
@janos Those are tags: [tag:c] -> . Click on that and it should take you to our C language page.
If that tag doesn't exist, then it takes you to an empty page.
 
hi @syb0rg
 
12
Q: Can we revisit "Did I write that code myself"?

nhgrif Did I write that code myself? This is one of the six questions the help center recommends users should be able to answer "Yes" to before posting their question. I'm not sure I quite understand it though. Two possible reasons for this requirement were suggested in chat this morning when I wa...

@rolfl are you still unconvinced?
 
4:13 PM
I wrote a query that identifies questions/answers that are one-vote-short of a badge
It is a some-times convenient way to find interesting things to vote on./
Normally on Sundays, because it is a slow day, and the data is fresh
 
hah! I know there was more to than an empty tag page! <- @syb0rg
 
Oh, that's what you meant... :P
 
@rolfl what about ?
 
It's not though.
 
4:18 PM
If you haven't already, toss this guy an upvote: codereview.stackexchange.com/q/59557/27623
He's using C11 stuff, and deserves to be rewarded.
 
speaking of rewarding newcomers:
1
A: Simple python script to shorten URLs in specified text files

jcolladoA few comments: Imports should be in alphabetical order Please use docstrings (PEP257) The sample_url1 and sample_url1_shortened variables should be class attributes in UrlShortenerTestCase I'd prefer to use double quotes in the fmt variable in the test methods Maybe a test case in which the go...

this answer has less votes than the other (1 vs 4), even though it's substantially better (and the one I will accept, of course)
 
@janos I was just looking at one of his other answers: codereview.stackexchange.com/questions/57833/…
 
totally agree with your comment there
 
Another good answer from a newcomer: codereview.stackexchange.com/a/59620/27623
 
18
A: What's a Zombie? And what are the many other memes of Code Review?

Mat's MugMeme: "Thanks, Santa!" Originator: Jamal Cultural Height: The 2nd Monitor Background: Votes are anonymous. So whenever someone upvotes a post of yours, and you think the voter might be in the chatroom, just say "Thanks, Santa!", the voter(s) will know that was for them.

and
33 mins ago, by Jamal
Thanks, Santa!
@nhgrif I'm still thinking
 
4:30 PM
I just got the OpenGL SuperBible 6th Edition ebook, hopefully I will soon be able to pimp this answer of mine.
That was the first time I had really even used OpenGL...
 
@nhgrif - your answer is basically saying: replace "did I write the code" with: did I write or do I maintain the code ... ?
 
"Do I own or maintain"
Which is what the close reason says
Just not the helpcenter.
One or the other definitely needs to change.
 
I'm OK with that....
the help-center on-topic page changes the "rule 2" Did I write that code myself? ...
 
I kind of want to go farther, but for now at least changing the help center from "Did I write that code?" to "Do I own or maintain that code?" would be a good start for me and anything further can be discussed at a later date.
 
i had edited the code and include one function now it is properly working, tested it with my credit card number. the function gives accurate output. now kindly remove the hold state — Sujith Karivelil 2 mins ago
 
4:33 PM
to be: "Do I own or maintain that code myself?"
 
can't judge, but..
 
Yes, though "myself" seems redundant and weird
 
it does.
@nhgrif - Can you make that option more clear in your answer....
 
Plenty of people in that meta discussion seemed very open to getting behind the idea of being able to submit questions about code they own/maintain, but are still hesitant toward just putting up random github libraries, and I'm okay with this change for now (still not allowing random codes that the asker has no affiliation with)
 
For me the reason for that option is that I want the code to be 'talking' to the person who 'owns' the code psychologically.
 
4:36 PM
yes
 
I believe that 'question 2' is in line with that in spirit.
So, update your answe, make that recommended change more obvious, including th wording.
I'll have to run things past Jamal/200_success, but it is a change that moderators can do.
I'm pretty sure it will be OK.
It does make the close reasons and on-topic questions more in-line with each other too.
 
"Am I an owner or maintainer of this code?"
Since it's a list of questions the user should be able to answer yes to
And there could potentially be multiple owners/maintainers of any given set of code
Who may both equally consider it their own code
Are you okay with that question?
 
Yes.
 
7
A: Can we revisit "Did I write that code myself"?

nhgrifTo add to the discussion and to clarify my point... I'm not saying we should only eliminate this rule. It's highly likely that we need different, more specific rules in place of this rule. The problem with this rule is that there are questions that could easily be on-topic if it were for this ...

 
If it ever comes up that there's the crazy 'my employee wrote this code, I'll fire him if it's not good. I own the code, please review'.
then we can find another reason to close.
 
4:40 PM
Yes, that was my thought.
In fact, I even think that this issue will likely be so rare that down voting and a custom close reason should suffice.
 
Agreed.
I'ts happened once since I joined.
 
This program is still dysfunctional. Using my own validator, the number you supplied should be considered valid; yet your program says it isn't. — syb0rg 12 secs ago
 
And if the asker opens a meta question about it, it's easy enough to explain that this is not within the spirit of CodeReview.
 
Lunch time for me... bbiab
 
@rolfl Is there a link to this incident?
 
4:41 PM
@Jamal His program still doesn't work, per my comment.
 
Thought so. He did fix the obvious compiler errors, so I removed my downvote (but maybe I did it a little too soon).
 
@syb0rg Does he actually say that the number is a number that should be considered valid?
He said he gave a number that's not his due to security.
Which may mean that the program should actually say it's invalid.
 
@nhgrif I know, but using my own Luhn's algo, it's a valid number. And I've tested and proven my algorithm to work.
 
Welp, Xcode gives me 4 warnings, but no errors.
 
It will compile now.
 
4:47 PM
Although one of them would result in an error because it's the "Implicit declaration of function" warning.
Xcode doesn't know what tolower is
 
Oh right, I did fix that before I compiled his code, that should result in a linker error.
 
yeah... what would actually need to be included?
ctype.h?
 
Yes
 
Yep
 
Actually... despite the warning, it runs just fine...
but it tells me my card number is wrong.
 
4:51 PM
Your own actual number?
 
Shouldn't this just be about the type of number, not the number itself? Surely no one will post tests on this with a real card number.
 
yes.
I typed the number from my Visa debit card and it said it was invalid.
I'm not going to post my number (though without my expiration and security code, it's useless), but it says my real card is invalid
 
If so, then it still doesn't work.
 
@Jamal Yes, the first and last of these should be valid too, the middle ones are invalid:
	const char* cc[] = {
		"49927398716",
		"49927398717",
		"1234567812345678",
		"1234567812345670",
		0
	};
 
It's kind of too bad, because the fact that I have 4 ugly-ass warnings when I copy and paste his code is something I wanted to post an answer about...
 
4:53 PM
@nhgrif Yeah, my validator was a lot shorter than his too. I was kinda hoping to answer.
 
Can credit card numbers even have chars in them?
 
I don't believe so...
 
@nhgrif Not that I can find.
 
This code does not produce the correct results. I just tried it with my own card number and was told it was invalid. — nhgrif 4 mins ago
 
@Jamal - @200_success - check out the suggested change to the help/on-topic pache in @nhgrif 's answer:
8
A: Can we revisit "Did I write that code myself"?

nhgrifTo add to the discussion and to clarify my point... I'm not saying we should only eliminate this rule. It's highly likely that we need different, more specific rules in place of this rule. The problem with this rule is that there are questions that could easily be on-topic if it were for this ...

s/Did I write that code myself?/Am I an owner or maintainer of this code?/
 
5:00 PM
Okay
 
Hey, I can protect questions now
2
 
Hello @ckuhn203
 
Hey @syb0rg!
 
Hey
 
5:06 PM
Hola.
 
Hi @Bhathiya-JaDogg-Perera
 
hi, I'm new here
 
@Bhathiya You are the the rising asker I hear. Pity I haven't had the chance to review one of your questions yet.
 
Mostly Java, one Javascript, and one C.
I was on holiday for the past week, missed the Java questions.
 
5:08 PM
You had the interesting implementation of Project Euler 1, right?
 
He's a beginner, but I'll convert him to the light side ;)
What brought you to this chat room @Bhathiya
 
It definitely caught my eye. I never would have thought to take that approach.
 
Is synonymized?
 
Yes
Click on the tag you just created in chat and you'll see
 
5:10 PM
I lost the original code to the #1 (because Project Euler got hacked), had to rewrite it. (the algorithm was the same)
What brought you to this chat room @Bhathiya : bored
 
lol
 
I would like to know what your original source was for the formula you use in your code.... return (position/2) * ( 2 * start_from + (position-1) * difference);
 
It was O/L (high school for you guys I think) maths
 
Ahh, the OWL's
I just realized that I completely fudged that problem.
Crap.
 
@Bhathiya-JaDogg-Perera Well, it is proven that being in this chat room increases your rate of reputation growth.
 
5:14 PM
LOL
4
 
Uhm, you will most likely want to read this:
 
yeah I just got +20 :D
 
13
A: What's a Zombie? And what are the many other memes of Code Review?

rolflMeme: LOL - AutoStar Originator: Mat's Mug / Jamal Cultural Height: The 2nd Monitor Background: "lol" somehow got targeted at this point here (the first starred lol): retailcoder: lol (darn, again) Followed shortly by: Jamal: lol (don't star that) And then the tradition was cement...

 
@Bhathiya-JaDogg-Perera
btw, you have a really long username haha
 
Yeah
My real name is Bhathiya Perera, JaDogg is like a pseudonym or a username
 
5:19 PM
I'm off. Just wanted to say hi. Gotta go try out the new backstop for the bow. See y'all later.
 
Bye!
 
this relatively new user also wrote a great answer:
4
A: Delete alternate nodes of linkedlist

timUnused Variables / wrong variable values You are not actually using last for the algorithm, and you are also not keeping it up-to-date, so I would just get rid of it. Alternatively, keep it, but then it should always have a correct value. The same goes for size. You should do this because the ...

bye @syb0rg
 
Oh, I was saying bye to @ckuhn203
:P
 
ah, haven't read properly
 
My cat is trying to get on top of my keyboard
 
5:28 PM
Is that your secret ingredient for good code?
6
 
yes
undo what the cat typed and refactor :D
 
5:53 PM
I can see close votes now. Thanks Santa
 
One more upvote before you overtake your SO rep!
(too bad I'm out of ammo)
 
@Bhathiya-JaDogg-Perera Only on your own questions, though. ;-)
 
That's enough, I can see why my questions are bad :D
Most of the questions I ask on SO, becomes tumble-weeds and I delete them
has anyone used freeBASIC
 
6:09 PM
+50!?!
Thanks! But I hope that wasn't all one person...
 
has anyone used freeBASIC
 
200_ might have
 
@syb0rg That may depend on how far apart the votes are.
 
I only used the real BASIC, on C64
 
ah
I just found an event named dfdfdf() in a JavaFX controller
 
6:29 PM
is asking in chat to take a look at my own question allowed ?
 
I think it's okay, as long as you are too persistent about us looking at it.
 
ok, need more answers or comments codereview.stackexchange.com/questions/59180/…
0
Q: Single class unit test framework in Java

Bhathiya-JaDogg-PereraThis is a single class and dependency free unit test framework for Java. The only assertion available is assertTrue (this can be used for all test cases). What it does Execute all methods with annotation Test. should fail if any arguments are needed. Calculate elapsed time using a given repea...

 
6:48 PM
this incoming question is off-topic, right?
0
Q: simple program to calculate day not working

Optimus PrimeI am trying to write a simple program, that outputs the day given a date, using 1/1/0001 as Saturday. I have written the program, but have passed about 4 hours just to find some mistake which is making my answer wrong. The correct answer can be found here. http://www.timeanddate.com/date/duration...

 
Already closed
And self-deleted
 
posted on August 10, 2014 by Optimus Prime

I am trying to write a simple program, that outputs the day given a date, using 1/1/0001 as Saturday. I have written the program, but have passed about 4 hours just to find some mistake which is making my answer wrong. The correct answer can be found here. http://www.timeanddate.com/date/durationresult.html?d1=1&m1=1&y1=1&d2=1&m2=1&y2=400&ti=on

 
@CaptainObvious You okay?
 
How does a 'voting irregularity account suspension' occur ?
 
It could happen if someone uses alternate accounts ("sock puppets") to vote for their own posts.
 
6:59 PM
hmm hmm
I just noticed one of the CR members had their SO account suspended that way,
 
And if it's done here as well, the mods will do the same as on SO.
 
7:21 PM
Going away to write some bad Java/JavaFX code, arrgh, Bye
 
:o JavaFX
 
7:31 PM
1
Q: Substitution cipher algorithm performance boost

mirgeeThis algorithm is meant to read a string of numbers on an input, a naive substitution cipher code (A = 1, B = 2, ..., Z = 26) and output the number of ways the code could be interpreted (e.g. 25114 could mean 'BEAN', ‘BEAAD’, ‘YAAD’, ‘YAN’, ‘YKD’ and ‘BEKD’, hence output is 6). It is working pr...

 
7:44 PM
0
Q: Basic math interpreter

Vladimir PutinEssentially what I've done here is written an Interpreter that takes in Python math, such as this, 23 ** 374748, and prints out the result. This program relies on the fact that in Python 2.7 input() is "broken". This means it can take in Python math. # Main parser class class Parser(object): ...

 
7:58 PM
Monkernoon
user image
2
^ whoops
 
irony
 
8:16 PM
-1
A: Project Euler #1

Emanuele PaoliniWhy a so complicated algorithm when you can keep it as simple as: #include <stdio.h> int main() { int sum=0; for (int i=1;i<1000;i++) { ...

 
> Since you have no input every solution is O(1).
My brains...
Erm you contradict yourself there @Jamal
It means linear complexity. This code loops through a certain number. Constant complexity would involve single operations. The OP's code is \$O(1)\$. — Jamal ♦ 3 mins ago
You must be meaning O(n) there
or am I wrong?
because it's hardcoded... I still see n = 1000 as a variable though
 
It would still be linear since the program must go through the loop a number of times. The OP just makes function calls that return one calculation with no loops.
@rolfl: Care to weigh in?
 
Yeah, 200lb?
Oh, on O(1)?
 
lol
3
Yeah. :-)
 
He's right
 
8:25 PM
About his solution?
 
I'm not going to claim to have a complete understanding about time complexity, but I was kind of thinking that that solution was O(1) as well. O(n) would mean you're calling some function once per every integer you're going to add, right?
 
So was amon wrong about his comment (both answers are similar)?
 
I don't know, because like I said... I don't completely understand the Big O stuff.
I wasn't going to delete my answer except that his comment continued to receive upvotes and my answer received no more upvotes even after I removed the efficiency aspects. This combined with the fact that rolfl's answer seemed to accomplish what the OP was trying to do without sacrificing the use of int.
 
My downvote was for the original revision anyway. I may remove the vote after a while.
 
Because my primary problem was with the fact that he was using float and that definitely deserves a mention. I simply couldn't see how to still do it the same with an int (and as such posted an alternate int solution even if it's less efficient)
 
8:32 PM
I don't think you can get away with calling it O(1), even though an invocation of that method will be O(1) because it doesn't scale with input
 
@EmanuelePaolini - you're right, since the input is a constant, all Solutions will be O(1), and there is no concept of scaling at all. Talking time-complexity for scaling is... going to require assumptions. Still, your solution is about 1000 times slower than the OP's — rolfl ♦ 1 min ago
 
My other problem was with the fact that the first function was confusing and makes very little sense. Given that the problem statement is very easy to understand, anything more complex than the problem statement needs comments.
 
@rolfl Ah, scaling... I didn't consider that. Overall, I agree.
 
Hey again
 
8:47 PM
Hello again to all my friends. Together let's play some rock'n'roll.
2
 
I came back, Still working on bad Java/JavaFX Code though :D
I mean I'm writing some obviously bad code. err
 
I am always impressed by the number of conspiracy theories around the web.
 
You shouldn't be.
 
What, you're not Inspector Clouseau?
 
00:00 - 21:0021:00 - 00:00

« first day (463 days earlier)      last day (2154 days later) »