« first day (1658 days earlier)      last day (2495 days later) » 

12:00 AM
RELOAD! There are 4685 unanswered questions (90.4278% answered)
12:27 AM
-1
Q: How to format a duration in golang

AleksandarI have the following code which I can't run on play because I use the gin framework and filewalk. package main import ( "fmt" "github.com/davidscholberg/go-durationfmt" "github.com/gin-gonic/gin" "os" "path/filepath" "regexp" "sort" "strings" "time" ) var fi...

You should consider posting this script at Code Review, there are so many things that are not really wrong but need to be improved — Bergi 57 secs ago
Yes Notmfb was right. I had a code review again and looked up where the error is coming from and found my mistake in unsubscribing my subscription. The unsubscribe function was triggered too early. Thank you — R. Rasco 49 secs ago
I shall add it to code review, thanks for the reply, basically we are supposed to design a lotto game where the user inputs 1 to 6 values and then 6 numbers are randomly generated, if the input value or values match the result they win. I will add the input code too — H.Usmani 25 secs ago
12:57 AM
0
Q: Async Loop best practices

YGilanyI'm building a slack bot to facilitates the standups for teams of developers. I want the bot to run async and not have to wait for one person's response before it starts interviewing others. Here's what I think is the solution for it. however I'm not really sure. I would appreciate a second eye...

^^ hypothetical code?
1:28 AM
0
Q: Singly Linked list methods implementations

Vikas YadavI have implemented various single linked-list related operations in C. The c file contains implementation and h file contains function prototypes and the following definitions: // Various types of data typedef enum { CHAR, INT, UINT, FLOAT, DOUBLE, ARRAY, LIST, P...

Your question isn't entirely clear. Maybe you want something like this but a little modified to return the duplicated substring? — john 50 secs ago
2:03 AM
I'm voting to close this question as off-topic because it is better suited to codereview.stackexchange.comJohn3136 53 secs ago
2:33 AM
0
Q: Synchronized Queue Wrapper C++11

Uchia ItachiI am trying to write a SynchronizedQueue wrapper class to provide a simple synchronized interface to underlying standard std::queue. Could you have a review and let me know if any pitfalls and improvements you see ? Too many mutexes/locks ? I wanted to to use condition variables to wait rather th...

3:09 AM
@Alpha Delta, first you have to define efficient. Secondly, if it works, and you want simply to ask how to do it better, check out stack exchange code reviewivan7707 36 secs ago
3:50 AM
possible answer invalidation by david on question by david: codereview.stackexchange.com/posts/179576/revisions
Monkevening
@CaptainObvious I think this can be undeleted, but it needs 8 votes
I'd have plenty to say about the query. The DDL is included (in the fiddle, easy edit) and EXPLAIN SELECT screenshot is there too
@200_success thoughts? ^^
Still could use better title/explanation but it's also an easy fix
4:15 AM
Again, true, but ugly. I certainly wouldn't let that past code review in the company I work at :P — Shadow 48 secs ago
4:31 AM
0
Q: Large find/replace in Word using VBA

gkavetI have a large amount of data that I read from a hardware device that needs to be cleaned up so it can be analyzed in Excel. I wrote a simple find/replace VBA macro in word to convert it to .csv, but the macro takes a long time to run through large sets of data. I'm looking for suggestions on a...

0
Q: Better way for nested if condition and multiple return

Rahul PatelI am using this code. def request_name(name): def fall_back(): #get something from web return "sorry " + name if 'r' in name: #request teh web for something return "Hello " + name if 'a' in name: #request web for something ...

There's a lot of problems with your code, such as your use of eval, but fixing all of that might be straying into Code Review. — Sebastian 41 secs ago
@CaptainObvious Very much example/stub code
4:48 AM
0
Q: Guessing the word game

user1058652I'm done with this "Guessing word game" but I have a very ugly method named startGuessing(). I tried to make it cleaner and more readable but I couldn't. How I can improve this method? public class GameHangman { private static String[] WORDS = {"programming", "fish", "cairo", "arabs", "quraan"...

5:01 AM
@Phrancis The author self-deleted the question. I'm not going to override that, but I left a comment suggesting that undeleting could lead to upvotes and answers, now that information has been added.
5:19 AM
0
Q: Shorten Python code

DaveyDI am currently learning Python and I wrote the following code. The code searches the string for all digits that appear after ',, sorts them and joins them into a string. I have a strong feeling that it can be shortened... Can anyone suggest how? s = "'bhhd',12 'kjubk',2 'bjki',98 'khjbjj',4" ...

0
Q: (C++) Preventing exceeding the time limit from Codechef

kimchiboy03I am currently trying to solve this problem on Codechef: https://www.codechef.com/problems/WEAPONS However, my code seems to exceed the time limit. Can someone please tell me how to optimize this code to prevent it from exceeding the time limit? Thanks in advance. #include <iostream> using ...

5:38 AM
@200_success Good deal, thank you
 
1 hour later…
Monking.
7:44 AM
0
Q: Iterator structure for block and interlace counting schemes

Martin UedingWe have a set of time slices, in the order of 50. Throughout this question I will use 6. We group these slices into blocks, in this example the block size is 2. Then we want to iterate through all source slice and sink slice combination and call functions of the following types: f(int source_sli...

7:56 AM
How exactly do you need it improved? Questions about improving working code should be asked on Code Review. — Xufox 43 secs ago
Monking
And what is your question? If you want a review of working code, you better turn to codereview.stackexchange.com — GhostCat 30 secs ago
8:14 AM
0
Q: Readibility when removing else or using ternary operator in Python

user674887Given this code if account_id: form = form.replace("<<ACCOUNT_ID>>", "<accountId>"+account_id+"</accountId>") else: form = form.replace("<<ACCOUNT_ID>>", "") I was wondering if I could remove the else tag to make the code simpler: account_id_tag = "" if account...

0
Q: Removing all odd nodes from a binary search tree

TheLearnerHello everyone here is my attempt at removing all odd nodes from a BST. Any feedback will be appreciated. class BinarySearchTree { public static Node root; BinarySearchTree(Node root) { this.root = root; } BinarySearchTree() { root = null; } public static Node getRoot(){...

The reputation % rating system is a bit weird...
@hoffmale The what system?
The reputation ratings (as in "you are among the top XX% this week/month/quarter")
As reported in your profile
It just switched to "top 0.48% this week" for me today... I searched a bit, and it seems the system takes the lowest percentage from any of those categories.
Basically means: I won't get reports for being the top contributor this week if I increase my quarterly reputation rank by two
@hoffmale You're at #1 for 320 reputation.
As the percentage for "top 3 this quarter" would be lower than the percentage for "top 1 this week", so the lower percentage would be reported
@Zeta: I know, I got the surprise this morning ;)
8:27 AM
Monking
I just didn't see that one coming, as over the past days, I just got reports on my quarterly performance
That's why I think it's weird (rank 5 quarterly is reported over rank 3+ weekly)
Because they are more active user in the last quarter than in the last week.
1
Q: RPG Game (Beginner)

moneymikeyI recently picked up a copy of Learn Python 3 The Hard Way, but found that editing and revamping other peoples code was a lot easier for me to learn. I've done a couple so far, but am having a really hard time understanding classes. I decided to make an RPG Game to both help in my understanding, ...

Not that many more (206 this week so far vs. 748 this quarter so far)
Similar on SO, 80k vs 240k.
@hoffmale That reminds me of the time I got a bounty on 1st Jan. For ~8 hours #1 in weekly, monthly, quarterly and yearly on SO. That was weird.
8:35 AM
Nice ^^
(Also nice answer, I can see why the bounty was awarded)
9:05 AM
Hi @Denisx - this question would be better suited for codereview.stackexchange.comFenton 11 secs ago
0
Q: Set reasonable human readable boundaries for lowest and highest values of number groups

Süha BoncukçuI have some chunks as following example: // lowest and highest values of chunk arrays 0 to 945710.3843175517 945710.3843175517 to 2268727.9557668166 2268727.9557668166 to 14965451.25314727 14965451.25314727 to 17890252.39415521 17890252.39415521 to 3501296406.880383 what I want to get from the...

This question is not suited for codereview, @Fenton. Questions on CR should contain working code whereas Denisx asks how to get to working code. See this guide for more information. — Zeta 1 min ago
possible answer invalidation by kimchiboy03 on question by kimchiboy03: codereview.stackexchange.com/posts/180650/revisions
9:54 AM
0
Q: Finding a Bash script's Runfiles as generated by Bazel

thertweckWhen building a sh_binary with dependencies using Bazel, a tree of Runfiles containing the dependencies is generated: my_executable my_executable.sh my_executable.runfiles/ __main__/ a_dependency/ lib_dependency.sh When deploying such a binary to a typical Unix filesyst...

10:09 AM
0
Q: Feedback on modular coding in Javascript, JQuery

ClaudeI just recently started with Javascript and JQuery. My background is in python. I would be more than happy to get some feedback if this coding style of mine is optimal, or if in JS people generally write things differently. The current task is to build different elements in a website that are alw...

0
Q: Fastest way to "Replace" "auto fill" and then loop in Excel VBA

Cassie McAdamsI am wondering if there's any way to improve the performance of this simple "replace" / "autofill" loops that I created in excel? Sub Macro1() Application.Calculation = xlCalculationManual Application.ScreenUpdating = False Application.EnableEvents = False Application.DisplayStatusBar = Fals...

10:54 AM
-1
Q: Number of possible values of x and y in 1/x + 1/y = 1/N(factorial)

NainCan anyone please tell me how to solve this equation in python/Java? Given a number N, what are the possible number of values that x and y can take such that: 1/x + 1/y = 1/N! I have already looked at this post but I didn't get it. Please help

0
Q: Guess Number Game - Object oriented Design

Dexter ThornI want to write well-thought-out, professional, object-oriented code. I wrote this little game to practice this. My goal was to find out how to dissect a number guessing game object-oriented. In the following I present you my model. I ask you to check this model for thoroughness and quality. I wi...

0
Q: Is it better to use Volatile and Synchronized in Singleton?

BobI've a question. I created a singleton. I whould like to know what is better between the two diff class below. I created a singleton to have (of course a unique instance of ExecutorService). I want to reuse the ExecutorService in my application. First one : public class ExecutorServiceSing...

11:12 AM
0
Q: Making bubble sort pure and efficient

Flame_PhoenixBackground I am re-writing a series of algorithms together with a colleague that we are going to later on publish in a packet for the community. To start, I picked the typical buble sort algorithm. Objectives the function must be pure it must be efficient it must obey the complexities list...

11:41 AM
11:52 AM
@CaptainObvious Asking for code
12:32 PM
I am still trying to decide if we should direct you over to Code Review or if this simply should be deleted. — Mr Lister 52 secs ago
Every time I see somebody asking a question here that should be on SO, and they realize it should be on SO but for some reason they can't/refuse to ask there, I want to smack OP right through my monitor.
@MrLister That's easy. Don't migrate crap. If you want another reason: broken code is severely off-topic at Code Review. Don't you even dare. — Mast 51 secs ago
Monking
 
1 hour later…
1:56 PM
I'm voting to close this question as off-topic because it is asking for a different way to do working code. Please ask on Code ReviewDaniel A. White 23 secs ago
2:06 PM
monking
0
Q: Code to calculate similarity between strings - R

pavidI have a large datafile with names and I want to create a similarity distance matrix. With this matrix I want to get similar names that could be the same person (or not) and that I could compare these rows and check whether more variables match or not. However the code I have is quite slow. The ...

2:25 PM
-2
Q: im newbie in c++ pls help me

Randall Redhow to code this one? please help need answers :( How many integer values would you like to sum? 3 Enter an integer value: 1 Enter an integer value: 4 Enter an integer value: 2 The sum is 7 Would you like to go again (y/n)? y

possible answer invalidation by Daniel Lorenz on question by Daniel Lorenz: codereview.stackexchange.com/posts/175365/revisions
@CaptainObvious nukes-pls
Greetings, Programs.
Greetings, User
1
Q: c# Is there a better way to call a method with conditional parameters

Kavya ShettyI am using the below method to assign value to my object(Team.Driver/Team.Codriver). This works fine but just wanted to know if I could improve this code via LINQ or other options. public void MoveDriverCodriver( Team source, string sourceType, Team target, string targetType) { if (sour...

0
Q: fast responsive navigation in CSS & jQuery

undefinedI spent many weeks, even months, to get this menu working. It is my very first "bigger" work in programming at all. The menu is fully responsive and has some features such like: sub and subsub menu expand to the left if there is not enough space to the right touchfriendly pretty fast In par...

2:42 PM
I'm voting to close this question as off-topic because it is much too broad for Stack Overflow, which deals with more focused coding problems. For advice on improving working code, consider Code Review instead - but do read A guide to Code Review for Stack Overflow users first, as some things are done differently over there!. — Toby Speight 9 secs ago
2:58 PM
@Holger you just made a geek very happy :) I re-factored a small piece of our code with this mark and reset to not read an entire buffer since the data after some byte is irrelevant for us what a wonderful friday evening this was (unless I get hammered in the code review that is) thank u — Eugene 30 secs ago
3:33 PM
0
Q: jQuery expansion menu

kawnahI have a menu done in jQuery that I'd like some feedback on: $(function() { // main expansion element $(".expander").click(function() { var subShown = $("ul > li", this).hasClass("show"); if (!subShown) { $(".indented", this).slideDown('100').addClass("show"); $(".car...

0
Q: optimize calculation time

Mohamad Reza Salehi SadaghianiI have written a simple code to extratc different time steps form a big text file. It works for small text files but for bigger text files as input it delivers no result. n=0 y=[] with open ("DEPTH.dat", "r") as input: for x in input: x = x.strip() if x.startswith('SCALAR'):...

I have to explain somehow the entire question? Should this question go to Code Review? — John Spiteri 50 secs ago
3:51 PM
Sorry @Ludisposed could you re-do your edit?
Oh wait, it didn't overwrite it, :O
@Peilonrayz I saw, edited at the sime time. But mine still came through. Only improved spelling a bit.
I think it is a bad question though, asking for code.
@Ludisposed Kinda, it's a TLE question, which basically is. I've written something, but I don't know how to make it faster, please teach me how to make it faster. It looks like a somewhat standard one to me tbf
@Peilonrayz Agreed, it is good enough. Just not one, I want to answer :)
You'll need to learn to use lists of some other data structure, or start moving stuff to a function. This is too broad for here though. If you code works and it's complete, you can post it on Code Review with a good description to have UT reviewed. — Carcigenicate 43 secs ago
@Ludisposed Ah, in that case, I agree with you, :)
4:16 PM
I'm voting to close this question as off-topic because the user is asking how to make things more efficient, not fix a problem. As such this question belongs on codereview.stackexchange.comTaplar 1 min ago
0
Q: ruby schema matching code

Sajjad MurtazaI tried to find the correspondences between columns in two datasets, which is called schema matching. I implement the algorithm like a c so that i could implement easily but i have noticed my logic is very worst. Could some look at it and guilde me how can i improve the stuff using plain-ruby me...

4:36 PM
0
Q: Ambiguous task requiremnt

Dildo of doomI'm implementing a toy interview-kind task which among other requirements states: ============== Write a function: class Solution {public int solution (String S);} that, given a string S consisting of N characters which contain the listing of a file system, returns the total of lengths (in c...

^^^ offensive username for OP???
at least unprofessional ...
not actually sure whether offensive...
then again ... prude america is prude, soo ...
4:51 PM
I wouldn't exactly say offensive... but at the very least NSFW
@SamOnela You should flag the post for moderator intervention, and say they have an offensive name, :)
@Peilonrayz I already flagged the post as off-topic... I guess I could flag the post for mod. intervention too...
Monking Weekend!
enjoy
5:07 PM
Anyone got experience with writing a custom LINQ/query provider? At least I'll be getting it next week likely
-1
Q: What are the ways to find the maximum occurring sub-string in a string in java?

user153701For example the string "aaakkkkbbkkkkk" the max occurrence substring of length 4 is "kkkk" so am asking about the ways of implementing it other than suffix tree

@skiwi the mug wrote one
cursed a lot
CURSES Mini-heartattack... The notification sound turned on again apparently
@Vogel612 Is that a good thing?
not sure, actually
I have experience with expression trees, etc. at least
5:12 PM
migth be related to the fact that Mug wrote the provider for Sage3000, which seems to be fully undocumented and messy
Hmm okay, basically I'm implementing our proprietary database structure in an SQLite database via C# plus an additional transaction layer on top of it
5:26 PM
@maaartinus Thanks for your willingness. This is the github project. To be honest I don't understand why I should open a new question on codereview, tho. — Reizo 13 secs ago
@SamOnela Has the username been changed? Because the one he have at the moment is not offensive to me, but it may be because of an intervention
@Marc-Andre yes - it was formerly three words
Yeah I don't need details if it was handled :)
@Marc-Andre Hover over the user's banner on their question.
5:38 PM
@Hosch250 Marc said "I don't need details if it was handled :)"
I now just imagined a super villain with that name and I find it hilarious !
@SamOnela I was showing him a feature.
@Hosch250 okay- new to me too- thanks!
@SamOnela It's ok I didn't want to have more information but since it's already there it fills my curiosity.
@Hosch250 make that "on the onebox"... then dumb me can also understand it on the first read
5:40 PM
0
Q: Copying and filtering Ruby arrays

vnbrsI'm doing a Ruby exercise to create new arrays with a given filter. Copy the values less than 4 in the array stored in the source variable into the array in the destination variable. The editorial solution code is: def array_copy(source) destination = [] for number in source # Ad...

LOL.
5:53 PM
-1
Q: Correct implementation of SI, SIS, SIR models (python)

ThorvioryI have created some very basic implementations of the mentioned models. However, although graphs seem to look right, the numbers don't add up to a constant. That is for the sum of susceptible/infected/recovered people in each compartment should add up to N (which is total number of people), but i...

6:26 PM
0
Q: jQuery nth child iterate through each row's li tags

Ali KhakpouriScenario: I like to iterate through each row's <li> tags, and fix the maxHeight, and set the all of the <li> heights to that. For this, I created the following function: function setMaxHeight(selector) { var heights = $(selector).map(function () { return $(this...

suitable platform to ask is:- codereview.stackexchange.com. BTW what you are thinking exactly that is happening only. read:- strpos()-ManualAlive to Die 49 secs ago
6:39 PM
0
Q: Robust UDF for finding the max less than a threshold

bobajobAlong with many here I'm sure, I quite often find myself writing little UDFs to do various tasks, but as they are just used by me, I tend to design them to just work the way I intend to use them (e.g. only accepting vertical 1-D ranges). I thought it might be interesting to try and put together a...

@greyfox if you are looking for an alternative way of storing the queries, I like the solutions in this question and answer: codereview.stackexchange.com/questions/140938/…ESala 1 min ago
7:31 PM
I would try another foreach. Joking aside, in reality, sure linq is pretty, but be aware it's still looping behind the scenes, so it's not going to actually save you anything as far as processing goes. Why do you need it in linq? Is this a rogue code review trying to add unnecessary complexity? — Nard Dog 16 secs ago
@Duga Flag as too broad, please.
Just a general **** question.
7:48 PM
monking
today I found out that any undefined behavior is really dangerous. Turns out clang can do whatever it wants if the code has undefined behavior and compiler is able to detect it
@Incomputable Yup/
I should totally fork a C compiler and have it throw fork bombs when it detects undefined memory.
Or just print sassy messages.
@Hosch250 would be great to enforce standard compliance
Work is kind of slow today. Hectic this morning when we had an IE bug in the checkout process...
Leaving in an hour.
@Hosch250 I thought IE is not used anymore
-1
Q: C# How to make a new level

Guest10202I'm making a 2d platformer and i've created a level. I need to know how to link a new scene (level) after you beat the first one. Any help?

7:54 PM
@Hosch250 GCC had something similar.
great to see you back, @Zeta, haven't seen you in a while
@Incomputable Super Mario Odyssey happened.
3
@Zeta shouldn't unknown pragmas be ignored?
ah, I see
@Incomputable I guess you've seen the cppcon16 video on Clang?
@Zeta probably yes, but I would appreciate the exact title or content
I am looking at code I wrote two and a half years ago and I HAVE NO IDEA WHAT IT'S DOING!
8
@Zeta yes, certainly
@SimonForsberg I have some template metaprogramming code lying around, which I've written 4 months ago, and I have no guess at all what it is doing. Neither do all of the people I know
@SimonForsberg Here's the trick. Imagine your old self, back from that time. Project an image of that person you were next to you and let that illusion explain the code to you.
Unfortunately, they don't know either, so just yell at your old self and hate them for not writing enough documentation/comments.
@Zeta Too late. Today's myself knocked the illusion to the ground already.
Oh. That reminds me that I really need to document some template meta structure on Monday. 90% is documented, except for the stuff in the detail namespace…
8:07 PM
@Zeta it gets rather too big sometimes. The detail namespace, I mean
@Incomputable Do you have a concrete example? That sounds like something along while(1) {} return 42;
@Zeta well, it actually is a house for all of the technical debt I have :)
I'm voting to close this question as off-topic because the user is asking if code could be made better, not to solve a problem. As such this question belongs on codereview.stackexchange.comTaplar just now
@hoffmale I'm not quite sure, I only watched some cppcon videos while driving. But I think I haven't seen MLO:UBiM yet.
8:15 PM
I wonder if vanilla javascript is used at all
Err...
@Zeta: Then you should :) Using UB to prove fermats theorem ;)
@hoffmale I thought it was proven?
I mean, the code proves that x^3 + y^3 = z^3
@hoffmale Wait, I recall that. Something along while (true) { if (fermats_theorem_holds()) return 1; else change_variables(); }? Then I've seen at least part of the video. (It was a long drive…)
8:17 PM
Yeah
It's around minute 10 in the video
And yeah, i meant "disprove dermats theorem"
@hoffmale What's z, if x = 2 and y = 3?
thats fermats theorem: x^n + y^n = z^n doesn't have any integral solutions for n > 2
Oh.
Can x = y?
Or does it have to be 3 unique integers?
Sure, but then you end up with 2 * (x^n) = z^n.
Has that one been proven yet?
It would be a big start if it has.
8:23 PM
0
Q: Matlab Code for Convolutional Neural Networks

Alpha BravoI am using Matlab to train a convolutional neural network to do a two class image classification problem. I have an imbalanced data set (~1800 images minority class, ~5000 images majority class). As I understand it, the splitEachLabel function will split the data into a train set and a test set. ...

Yes, it has been proven
Wiles's proof of Fermat's Last Theorem is a proof, by British mathematician Andrew Wiles, of a special case of the modularity theorem for elliptic curves. Together with Ribet's theorem, it provides a proof for Fermat's Last Theorem. Both Fermat's Last Theorem and the modularity theorem were almost universally considered inaccessible to proof by contemporaneous mathematicians, seen as virtually impossible to prove using current knowledge. Wiles first announced his proof on Wednesday 23 June 1993 at a lecture in Cambridge entitled "Elliptic Curves and Galois Representations." However, in September...
Is 0 considered an integer? Because 3^3 + -3^3 = 0^3 :)
All numbers have to be positive.
x, y, z > 0
So the fun is using undefined behavior to disprove it ;)
8:28 PM
Pity we don't have Fermat's proof :(
It would be fun to see if it was accurate.
It probably wasn't (seeing proving it required complete new fields of math)... But yeah, would have been nice to review in retrospect
Or he had an elegant proof that nobody could see.
Or maybe that's why it wouldn't fit in the margin--because he had developed those fields of math.
Like one of the Q/As on Academia.
One of the guys was in a math class, wasn't particularly brilliant at math, but was the only one to answer the tough question--in a brand new, very elegant way.
He'd skipped a lot of lectures, but just happened to go at it a different way (probably because he didn't know how he was supposed to solve it).
@Hosch250 That sounds like my way of programming.
It usually ends in chaos, though.
Talking about programming...
I'm designing a new structure for the RD parser state.
8:34 PM
Rubberduck.
ah
I'm currently trying to design a language for the codereview challenge... Though I might not be able to make it in time :/
The codereview challenge?
-1
Q: CPU Emulator Instruction Processing

Harry FreeboroughI'm making a CPU (6502) emulator. I need to process an OPCODE and execute a certain function depending on the OPCODE and need to handle the different addressing modes as well. I currently have it set up as the following with just the relevant parts extracted: https://gist.github.com/Desetude/04...

21
Q: CODE REVIEW 2017 Challenge: Entries

202_acceptedThe CODE REVIEW 2017 Challenge was selected last night, I've attached the details of the winning challenge below. To enter the challenge, simply post your entry as an answer to this question. The challenge ends on Thursday, 30 November 2017 23:59:59 UTC+0000, all entries must be submitted by the...

this thing
I've been trying to wrap my head around compiler construction for a while now, and since I have the appropriate classes to go along this semester...
Well, it definitely sounds interesting!
But I don't have that much time available
Though I've made such a thing at work already, so yeah :P
8:44 PM
I'm gonna try anyways, even if I don't make it, I'll learn something
(and if it's just how to use cmake)
35
Q: Brainfuck to x86 Assembly Compiler

skiwiAfter my Brainfuck Interpreter written in x86 Assembly I decided that it was time to get to the next step, writing a Brainfuck Compiler in Java that generates x86 Assembly and compiles that to an executable. Currently it only supports Windows and it still uses NASM and GCC as dependencies to tra...

One day I was crazy enough to write that
Do you get bonus points if you write a compiler, interpreter and virtual machine all in the language you create?
And what does it mean if you write unit tests in the same language as the one you are unit testing?
@wizzwizz4 I'd be inclined to say the code here is too simple for Code Review, the asker probably doesn't want a formal review as much as a brief look (possibly) and that questions asking to review cake code would be fundamentally off topic there, since I'm not aware of any commonly accepted best practices relating to cake code. There also isn't an actual question here (does OP even want a code review?). — Dukeling 14 secs ago
AFAICT the idea is: You write a compiler/interpreter/... for X (your new language) in Y (an existing language).
You get points for several features of X that YOU implemented in Y
But why not do all :)
@Hosch250 @hoffmale @Zeta Wasn't Fermat's last theorem proved a few years ago, with the use of quite advanced theory of things that wasn't invented during Fermat's time?
8:53 PM
Yeah.
You can do all - it gives more points ^^
@Zeta Right, that. Nevermind :)
@SimonForsberg: Yes
TTQW.
@skiwi: The only thing is, you need to prove that it works, i.e. provide executable tests
(possibly written in Y)
8:55 PM
So how do you prove that it works if you write it in the language you are writing?
setup parser/interpreter/compiler/..., execute result, compare result to expected
easier with an interpreter, i guess
But say you are testing equality, now in the unit test you wrote in that language you'll also be using equality to test if you are using equality correctly :)
assert(eval("a = 5; b = 6; a == b") == false)
or somesuch
where eval is how you execute stuff
@wizzwizz4 I'd be inclined to say the code sample here is too small and simple for Code Review, the asker probably doesn't want a formal review as much as a brief look (possibly) and that questions asking to review cake code would be fundamentally off topic there, since I'm not aware of any commonly accepted best practices relating to cake code. There also isn't an actual question here (does OP even want a code review?) and I don't think the code is working. — Dukeling 57 secs ago
Actually, the rules are rather vague (possibly to allow for more entries)
9:01 PM
@hoffmale But you don't know whether your equality operator is working correctly
Proof by WTF
assert(eval(...) == false) is in Y, the string contents in X
so you can assume the testing environment works
But it would be interesting how strongly one needs to prove that a feature is working
Ah, I was talking under the assumption that the testing environment is written in the language you are testing
e.g. + operator: Does it suffice to have a specific number x of test cases? (And does it have to hold outside of those? evil grin)
I guess redefining addition wouldn't fly, though
Are you members of Code Review or PCG? I'm starting to wonder.
What? The specs are insufficient :P
9:08 PM
-2
Q: OSError: raw write() returned invalid length when using print() in python

sandywhoI'm using python tensorflow to train a model to recognise images in python. But I'm getting the below error when trying to execute train.py from github Traceback (most recent call last): File "train.py", line 1023, in <module> tf.app.run(main=main, argv=[sys.argv[0]] + unparsed) File "C:\Users\...

0
Q: Mechanism for providing timeout notifications when traffic ceases

GusdorI'm trying to build a nicely encapsulated mechanism for providing timeouts that wait for a signalling channel to go quiet for a duration. As a fun study of System.Reactive, I decided to base this mechanism on the Observable.Throttle extension method. Problem is, I really want to avoid using Subj...

@SimonForsberg Well, the challenge kind of invites into making an estoric language
@skiwi No one is stopping you.
It just sounded to me like both of you were trying to find loopholes.
I was more interested in whether it would even be possibly and automatically provable to do everything in one language
Well... the specs are loose (e.g. nowhere is actually written that it has to be a new language - just that the compiler/interpreter has to be written by you to count)
Though writing a brainfuck interpreter will probably score poorly
Write your own programming language" is up there in bold though
9:18 PM
"My own language" doesn't have to mean a new unique one, though
Or how would you prove that nobody else has done exactly that one before?
E.g. I start with a pascal dialect, and accidentally diverge into delphi. Would that count as an "own" language?
I guess me owning the language requires me to have intellectual property rights (or something along those lines)
I know that the challenge rules are to be interpreted "in the spirit", but even then they are awfully loose for some points
hmm ... true that
~bows to @MadaraUchiha
E.g. do I have to use the exact operator symbols as given in the challenge question? Does "compiling to assembler" mean "produce a working executable" or "write a valid assembler program file"?
does not bow to @MadaraUchiha and instead throws salt around instead
lucky we're not on meta, else my shadow would be so annoyed by this
Salt? That's your line of defense? Pathetic.
9:26 PM
greetings to the CR people though :)
@MadaraUchiha I'm not near my ion cannon right now :P
otherwise that'db e used
@ThomasWard I kinda doubt that would work
I have been known to take explosions from the equivalents of nukes and shrug them off.
meh, i wonder if there's any good responses to my request for code review... searches
Actually haven't been on CR for a while
9:29 PM
@MadaraUchiha so, you'd survive Starkiller Base firing all its energy right at you, then?
:P
Actually a good question. Depending on which state of Madara we're talking about.
0
Q: Using jQuery to Clone nested divs with unique ids

HannahThis is cloning a div that looks like a row of many nested dropdowns, textareas, etc. (Note that the clone is appended to the html outside of this function). What I needed to do was to clone all of the html elements, rename the div and the first nested div to be unique, and occasionally keep all ...

-1
Q: What is going on in this PHP Code?

James AndersonWhat's going on in this code? Specifically, $title = trim($title); Because it looks like $title is being assigned a value, then the entire value is being trimmed. It doesn't make much sense to me. $title = $address->getDiscountDescription(); $description = $address->getDiscountDescriptionAr...

@MadaraUchiha well with regards to SE, diamonded Madara cannot survive the S-Cannon. Nobody can. Except maybe Jon Skeet.
@ThomasWard Shog, too, possibly
SHHH!
that's the secret of the S-Cannon, it's powered by Him!
no, but not much survives Shog if his wrath is turned upon someone :)
except maybe Jon Skeet.
but I digress :)
9:50 PM
In my example class, OnCompleted is called on the BehaviourSubject, so I guess its safe to assume the sequence isn't infinite. Is it appropriate for you to conclude with an appraisel of the lifetime management in the example code? Alternatively, I have created a code review stack for that purpose >> codereview.stackexchange.com/questions/180708/…. — Gusdor 18 secs ago
10:02 PM
1
Q: Suggest potential improvements for my code

AJ123I need a bit of help with a practice Computer Science coursework. I have written a code for a magic trick (more information below) using Python 3.x, and for one particular section, I need to suggest potential improvements/enhancements. I know this sounds a tiny bit egotistical, but I can't seem t...

10:16 PM
0
Q: Code returns simple http response

alaSeanJohnThis POST is called not only from our server-side and client-side code, but also called from a third party software that enables us to create POST requests on its behalf. I just want a simple response so that it can be handled easily no matter where it's called. I have two questions. Considerin...

10:50 PM
possible answer invalidation by YGilany on question by YGilany: codereview.stackexchange.com/posts/180639/revisions
11:03 PM
0
Q: C# Asynchronous Sockets with Begin/End and a State Machine Loop

Christopher PiszDisclaimer: I am a C++ guy, so my C# is not even close. Therefore some review might be helpful. Here is my 4th attempt at a client using asynchronous sockets. Please give feedback. The hardest part of this endeavour is synchronizing what can happen and when it can happen. Some examples I had to...

11:20 PM
possible answer invalidation by Code Recipes on question by Code Recipes: codereview.stackexchange.com/posts/180483/revisions
11:43 PM
As you have a perfect working code here, I suggest you post this at Code Review. If you do so, please mark it with the d3.js tag, and I'll have a look at it. — Gerardo Furtado 23 secs ago
@SamOnela I was the one voting to close suggestin the migration to Code Review. This is not too broad: OP has already a working code, they are just asking if using a stack generator is the best option. — Gerardo Furtado 18 secs ago

« first day (1658 days earlier)      last day (2495 days later) »