« first day (1779 days earlier)      last day (2221 days later) » 

12:00 AM
RELOAD! There are 5178 unanswered questions (89.9861% answered)
 
12:58 AM
Hi. I'm looking for some pretty basic help, something that would get me tossed from SO for asking.

VB.NET - I've figured out how to override `.OnPaint` and I've learned I shouldn't draw with `CreateGraphics`. I've read the .net docs on PaintEventArgs class, PaintEventHandler Delegates and Handling and Raising Events.

So I need to `Me.Invalidate` to trigger `.OnPaint`. But I can't. I put my objects or arrays into (Form) module level variables, create a form and when I invalidate it, it doesn't trigger my `Protected Overrides Sub OnPaint()`.
 
@Raystafarian This looks actually pretty good for SO, maybe a small code snippet to replicate. I'd love to help but I've never used VB.NET
 
1:37 AM
@Raystafarian #1 - use C# :)
#2 - do you ever call OnPaint or trigger it from somewhere else?
 
2:29 AM
-1
Q: Are my codes IFFY? what can I do to increase readability and efficiency?

Vural ErdoganI would like to improve my coding style. I tried to implement Minimax algorithm for a game. What would you suggest me for below codes style? Am I doing something unnecessary? or inefficient? def heuristic_value(state, depth): # manhattan distance has been used for heuristic value of static pos...

 
3:03 AM
@CaptainObvious Your codes are probably iffy, yes.
 
3:29 AM
Hello! Just wanted to say thanks everyone for spending time reviewing others' code, and to ask something. If my question has not had answers for a couple of days, should I hold off for a couple more days, or put a bounty on it sooner? It seems that questions here (understandably) get less attention, but it may be that someone finds it and looks into it later.
 
@DanielCausebrook This one, right?
3
Q: Parsing and creating JSON packets

Daniel CausebrookFor several hobby projects now I have had to interpret and/or send JSON websocket or HTTP responses in Java. I did some research and picked the library GSON to use. In each project I have implemented a custom deserializer in order to correctly interpret different packet types. For example: {"typ...

 
Wow, that notification sound made me jump. Yep, that's the one.
 
@DanielCausebrook You are right that in general, questions take longer to get answers here
Also, you can turn off the sound notifications by clicking the speaker icon @ top-right corner, just above room name
 
Yeah I'll just turn down the tab volume or something.
 
Well, it's been, give or take, about a day since you posted. It's the weekend so it's generally slower, too. I'd suggest wait another day or two before spending your rep on a bounty
(above link may not work with your rep level)
 
3:39 AM
Yeah, I'll leave it a few days then. I've used that code several times recently, and I don't want to be using it lots if it's got issues or if I can do it in a better. But it's not urgent so I'm fine waiting. Frankly it feels odd to ask random people to check my code but I was just getting too curious.
 
On Stack Overflow you usually get an answer pretty quick, but here it's about reviewing quite a bit of code, often, so we can't just post quick "try this" answers :)
On quickly reading over your question, it may not be a bad idea to include the Data class, just for completeness
 
Yeah I understand. I've tried my hand at reviewing someone else's code too, and it's quite fun really. But it is a time commitment. Especially when coursework is due shortly.
Oh yeah I did wonder about including Data, but it's pretty small. Frankly I think it could be an interface instead. I'll add it though.
 
@DanielCausebrook Java questions normally don't sit around too long before being answered, since it's very common language on the site. I'd take a stab but I don't use Java often at all. It's a nicely put together question
 
Ah, thanks for looking at the question. Why did you put the first two code sections as quotes though?
 
@DanielCausebrook They seemed like example data/usage... is that incorrect? Happy to fix if so
 
3:51 AM
That's fair actually.
 
Cool, stick around, nice to meet you :)
 
Nice to meet you too. I'll try to stick around, I don't mind reviewing code (assuming I feel confident enough). I am a bit busy right now honestly but It's been fun.
I'm currently a student but have been programming in Java for around 7 years already.
And it's also 4am and I should be doing coursework so I think I'll take my leave.
 
Impressive! I've been hammering around mostly SQL, Python, and more recently JavaScript, as a hobby for maybe 4-5 years
 
Oh and also that hquestion history link I could view but I don't think I could have reached it myself from the question. It appears to contain some sort of key or ID in the URL so I'd imagine it's only initially accessible to users with high enough moderation priviledges.
Yeah I've used SQL and JavaScript before but not much Python really. I find JavaScript a bit frustrating because I'm too used to Java's nice strict typing :P
 
@DanielCausebrook It's kinda hidden, some of us use this userscript with Tampermonkey (or other such) to add it
@DanielCausebrook I think Java's strictness is what worn me off lol
 
4:11 AM
Well, it looks like the script even works for me so that token was just highlighting a specific event in the timeline.
And I like the strictness because it enforces good practices, and means you always know exactly what's coming into your method.
But, again, I haven't tried a non-strict language much so maybe I won't mind after a while.
 
As far as JavaScript goes, I think too much strictness would just break the web. Python is a different use case though
 
Oh, I agree. I don't think strictness is a good thing everywhere, but it does present problems when I try to write some JavaScript as if it is Java. It's just a lack of experience really.
 
4:32 AM
0
Q: regular expression to parse guid and other attributes

App2015I've this regular expression, please review for any optimizations. (([a-f0-9]+\-)+[a-f0-9]+)\/(.*?)\/(.*?);version=(\d*) Test records /publication/d40a4e4c-d6a3-45ae-98b3-924b31d8712a/collection/content1;version=1520623346833 Expected output: d40a4e4c-d6a3-45ae-98b3-924b31d8712a collect...

 
4:48 AM
@Hosch250 It has a handler, so I'm pretty sure I should never call it specifically. I did try C# but it was just too foreign to me :)
 
5:21 AM
@CaptainObvious I'd sooner review an Excel formula question than a straight up regex question...
 
5:59 AM
1
Q: Domain Design Pattern consideration

Francois TaljaardI've come up with the following pattern that I would like to use within my domain. My question is more opinion then a single answer. Use case. Each domain service does one action called submit, a submit takes a Request, it uses the Requirements (validation and getting data) and then gives you ...

 
@Phrancis Ha!
 
I'm bugging soliciting assistance from kind people on the SO JS chat room now, trying to figure out how the heck to make promises work
 
 
1 hour later…
7:26 AM
0
Q: Elixir PEG Parser Generator ... How do I make it more Idiomatic?

Nigel ThorneI am trying to learn Elixir, so I decided to write a port of Ruby's Parslet library. I want to define a DSL that let's you define your grammar and given a string can parse it into an AST. I wrote something... but it's not very Idiomatic. I'd love some pointers. Also... I wanted to be able to...

 
@Phrancis Can't you just peek at questions on CR using them to see how it's done?
Monking all
 
7:43 AM
0
Q: How to run function and if result is not false push it to array?

SolHow to run function and if result is not false push it to array? I can think of: var responses=[]; //.... var temp = getData(); if (temp) response.push(temp) and var responses=[]; //.... if (getData()) response.push(getData()) How to rewrite this to avoid temp creation or double function c...

 
8:03 AM
What exactly is the problem with your code? Perhaps codereview.stackexchange.com is a better fit for your concern? — Michael Swartz 33 secs ago
 
8:51 AM
Monking
 
Monking
@Mast I don't learn by example that well, I grasp something much better once I have used it for myself
 
-1
Q: install mongo-php-adapter on php 7

pedram shabaniI try to install mongo-php-adapter over composer but drops me $ composer require alcaeus/mongo-php-adapter Problem 1 - alcaeus/mongo-php-adapter 1.1.5 requires ext-mongodb ^1.2.0 -> the requested PHP extension mongodb is missing from your system. - alcaeus/mongo-php-adapter 1.1.4 requi...

 
I have not ran into a timing problem programming so far (before just earlier today), I suppose it's all been synchronous until now.
 
9:18 AM
You can use this thread as a starting point — wasthishelpful 43 secs ago
 
 
1 hour later…
10:20 AM
0
Q: Move zeroes to the end of array

Low Kian SeongFor the problem of moving zeroes to the back of the array as detailed here: https://www.geeksforgeeks.org/move-zeroes-end-array/. I did it like below in Erlang. Can someone please give me some feedback ? -module(move_zeroes). -compile([export_all, debug_info]). %% This is solving this problem:...

0
Q: ReadWriteSerializer

Sukant KumarI am developing a C++ kernel, and I've got the need for manipulating huge data structures before the task-scheduler runs - it means in non-preemptive environment. For this, I have developed a read-write serializer struct. Its job is to allow readers to concurrently access the data. But any write...

 
10:46 AM
@rolfl Any considerations in trying to take back the diamond?
 
 
1 hour later…
12:15 PM
@SimonForsberg Over the past day I have stewed over it. I have not otherwise thought about it all really since we graduated (there were a few times I missed the mod powers, but not being a mod).
I have been much more active on the site than most people realize, I think, and I have been hammering the review queues typically at least twice a day. It's not like I am absent.....
I know that I already spend enough time on-site doing "meta" site activity to cover the minimum requirements of a mod.
Also, if I commit to half of what I was doing before graduation, it would be much more than enough - especially with 5 mods now.
So, in my "stewing", I have decided that I "could" offer to do it. The question is whether I "should".
 
-1
Q: fetching issues with python

PythonPI have been working on a project that uses python to access and fetch information from Jira. My question is is there a better way to implement this part which aims to fetch all the issues ? last = 100 first = 0 while True: start= first*last issues = jira.search_issues('project=<NAME OR ID>...

 
12:41 PM
 
0
Q: Integrating Spark in Play for Scala

ps0604I need to make available Spark functionality in a Play for Scala application. I put together the following sample code: class Test4 extends Controller { def test4 = Action.async { request => val conf = new SparkConf().setAppName("AppTest").setMaster("local[2]"). ...

 
Re-monking
@rolfl Re-opened the latter, I'm not so sure about the former.
Definitely example code. Should he upload the real deal, yes, it would be reviewable.
 
12:58 PM
-3
Q: How to fix indent problem in this code?

CanerScrapy used.Couldnt find anything in google to fix.Please help. # -*- coding: utf-8 -* class TestSpider(scrapy.Spider): name = 'test' allowed_domains = ['url'] start_urls = ['url'] def parse(self, response): baslik = response.css("img::attr(alt)").extract() resim = respon...

 
SE has been doing weird things on my device today...
 
What is your issue? If not, this post should be posted on codereview.stackexchange.comSyscall 55 secs ago
 
1:25 PM
Monking
 
Monking
 
1:48 PM
@Phrancis I'm a little bit familiar with them.
Have you ever written asynchronous code with callbacks?
That's basically what it is.
You do something like foo.doSomething().Then().Success().Error(), etc.
 
0
Q: Optional File upload in forms implementation

itajackassThis is my example code where i've a form with an input text (or more) and an input file where the file is optional: File can be added File can be deleted File can be changed with another one With a simple logic, without headcache. <?php //retrieve data from database (example purpose only) ...

 
And doSomething() basically returns a task. When it finishes, it'll run then(), etc.
(Not a perfect example, and each "promise" is a little different and stuff.)
 
@DanielCausebrook drop me a note if you want to talk about that review I gave you :)
 
@rolfl Yeah, you don't have to at all do as much as you did before we graduated. Being 5 mods is really nice.
@rolfl I have a feeling you would probably get quite a bit of votes if you would run.
 
2:03 PM
heh, I spoke with my wife about it..... (She's the one who always wears my Code Review T-Shirt - so she's an authority on these things), and she assures me that it would be OK with her if I were to volunteer again..... the question still remains whether I should.
 
@rolfl Time to make a list of +/- ?
 
Well, let's hold off on that until an election is actually announced.... right?
 
Haha, ok then :)
 
to be honest, I'll probably also get a feel for the other candidates, too.
I know (from experience) that the site does not NEED me.... and there are lots of great people on the site who could do more than a good job. I don't want to take away opportunities from others.
(or even appear to do that).
 
0
Q: typedef pointer-to function or typedef function reference - preference?

fearless_foolIn the following example, both the fp_t and the fn_t typedefs do their job just fine. The former defines a pointer to a function, the latter is a reference to a function. And both can be used to create a dispatch table, as shown. Is there an argument for using one over the other? #include <st...

 
2:07 PM
(and hey, I don't know whether my ego could survive being a nominee and not getting elected) ;-)
5
 
You'd get elected alright.
 
optimizing code is more likely to be a candidate for code review than SO. You can try avoiding Activate and set ranges = to each other between workbooks, put things in variables, potentially load data into arrays and work with the arrays rather than looping through the sheet. Avoid msgbox where possible (if you have to, better not to, use debug.print over msgbox - is this for you or user?) — QHarr 35 secs ago
 
@Hosch250 - I'm not so sure. I have not been highly visible on the site for 3 years now.... and I'm not about to pretend to be the same mod that I was pre-graduation. I know I can do the job, I have experience, but there are people currently on the site who are far more active, and even passionate, than I am.
Hell, people like you.
;-)
I won't play the "I helped the site graduate so I deserve to be a mod" card. It's not true (sure I helped the site graduate, but it does not mean I deserve to be a mod).
 
Seems like the question is asking for a review of working code, as such codereview.stackexchange.com would be a better site than SO for that. — paisanco 11 secs ago
If this is for an assignment the code itself seems fine and the only nitpick is that it should say "Player 1 wins" instead of "is win". If its a personal project you want improve then the code review site is the place to go. — Jon Reinhold 57 secs ago
 
2:24 PM
0
Q: an effective way to access variables within a for loop?

BARNOWLI'm trying to find a more effective way to access variables within for loops, i felt that my attempt which works is not an effective way to access variables that are within for loops. mylist=None is the variable in which i want to access within the for loop. Also, want to find a way to mimizim...

 
@rolfl I've not been on the main site meaningfully for over a year.
 
@Vogel612 Thanks for the review! I put the comments in because I thought it would be helpful to the people reading the review, but I think they would have been better as text outside the code, or not there at all. The Map is a good idea, but I'm still pretty sure I'll still be having to hardcode it somewhere. It makes a lot of sense though, because it allows me to put my Data classes in whatever other packages need to be parsing messages.
The main thing I wanted to check out was that the overall strategy was sound, since I came up with it as a kind-of new programmer years ago.
 
I did something related when I was not as experienced as I am now...
14
Q: More German overengineering™ - Class mappings and factories

Vogel612Goals: So the plan was simple: Provide a factory to instantiate implementations of a certain interface (ModelConverter<T>), depending on what model-class you want to convert. The approach is relatively straightforward: statically map model-classes to ModelConverter implementations use that ma...

^^ it was a mess
 
Please don't post questions as answers. Also stackoverflow is not for reviewing code, there is codereview.stackexchange for that. — Max Vollmer 27 secs ago
 
2:48 PM
Yeah it's the sort of thing you do and it's right, maybe even good code but a bit overcomplicated.
 
@Hosch250 Sometimes I wonder if I've ever been on the site meaningfully. It all depends on definitions I guess.
@rolfl Heads-up: both are open now.
 
0
Q: Trigonometric Subplots with Matplotlib

AriefThe code consists of 4 functions that result in a figure with 3 subplots : a sine wave, a cosine wave, and the superposition of both (a bichromatic wave). I have shown in 4 ways, the first two are basically plot the same way, but the generation of the waves are different. I also show different ...

1
Q: Iterating through nested array of objects

RuaghainI have the following JSON list of objects, and I'm able to find the required object, and pass it back to the caller, given the id. Everything works fine, I'm just wondering if there's a better (more efficient) way to return the node. I'm open to using a 3rd party tool like lodash. JSON payload: ...

 
3:34 PM
0
Q: Making a triangle without inner stars

Raza KhanBy this method I am able to solve my problem, but is there any other way that I can make this type of triangle? Please correct my code if I am doing this the long way. public class Pyramid{ public static void main(String [] args){ for (int i=0;i<= 6 ;i++) { for (int x=0;x <...

 
 
2 hours later…
5:18 PM
0
Q: maximumBy using foldr that satisfies special cases with (\_ _ -> GT) and (\_ _ -> LT)

Attila GulyasA similar thread already exists (Custom maximumBy and minimumBy in Haskell), but in the Haskell Book exercises it also brings special cases that the custom maximumBy needs to satisfy: Prelude> myMaximumBy (\_ _ -> GT) [1..10] 1 Prelude> myMaximumBy (\_ _ -> LT) [1..10] 10 I came up with the sa...

 
 
1 hour later…
6:26 PM
0
Q: Socket.IO chat app with extra features

Gab De JesusI added upon the Socket.IO tutorial, and wanted to know how I could improve my code. I have some questions about how it's built at the moment, especially when a client or the server should handle a task. The app has the following features: Real time chat Shows who is online Custom client ident...

 
7:05 PM
Monking!
 
This would not fare well on Code Review site in this form, as no context is provided as to what this code is for. I do think it's not fit for Stack Overflow, as there doesn't appear to be a question or problem. — Phrancis 16 secs ago
 
7:26 PM
I just couldn't help myself... ;P
2
 
@Phrancis lol. too much free-time? :D
 
8:00 PM
Who needs to turn it upside down when you can just right-align it? i.imgur.com/CfbNR3s.png
Should probably post that on code review, people would be singing my praises for years with that one.
 
@DanielCausebrook Why use semicolons and not spaces?
 
Because you get a much more clearly defined, elegant and readable block. You can clearly see the boundaries of the code. It's the future!
 
8:18 PM
@DanielCausebrook Instant headache
 
8:29 PM
Also, consider posting this on Code Review once it works to get a review of your code. — Graipher 16 secs ago
 
8:50 PM
-1
Q: Most creative expression - Python

overexchangeIn this exercise, am trying to get an approach to think of a solution, for below question: def twenty_eighteen(): """Come up with the most creative expression that evaluates to 2018, using only numbers and the +, *, and - operators. >>> twenty_eighteen() 2018 """ return ...

 
9:20 PM
If you have trouble compiling their stuff, I'd suggest you open a new issue on their github page. Stack Overflow is not a code reviewing platform for third-party projects. — Pablo 36 secs ago
 
0
Q: bitwise comparison of any structure

Darius DuesentriebWhat I tried to do is compare arbitrary structures independent of the '==' operator implementation. template<typename T> bool bitWiseCompare(T a, T b) { size_t size = sizeof(T) / sizeof(char); char* array_a = (char*)(&a); char* array_b = (char*)(&b); for(size_t i = 0; i<size; i++) { ...

 
9:52 PM
Make use of of, for example, if statements to define the price or discount (margin) when x-items are selected. Possible example matching your question: codereview.stackexchange.com/questions/143120/…Yvo Linssen 51 secs ago
I think a question like this would fit better on Code Review. — Joe C 12 secs ago
 
10:14 PM
-2
Q: Networking. Connection between two machines with unknown ip's but same LAN

Corporacia K.U.B ANDREYDENSay I want to write a multiplayer python game. I want to connect two computers that are in the same local network. I've succeeded using TCP/UDP connection and python sockets. Similar to python socket library example: server: import socket # Import socket module s = socket.socket()...

 
10:49 PM
0
Q: Adding values to a HashMap through searching

John LexusI have two Objects that I need to store in a java Map in the form HashMap<ObjectA, ArrayList<ObjectB>>(). Before my program is even exposed to Object B, my program has seen and stored all ObjectAs in this hashmap (by using the argument put(ObjectA, new ArrayList<ObjectB>()). I am having a design...

 
10:59 PM
Thanks to @MathieuGuindon @200_success, @janos for your great job as moderators! It's been nice working with you all!
17
 
janos too? Just now seeing that post on meta
 
@SimonForsberg thanks for keeping the fort with @Jamal! Whatever happens next, the newly-elected moderators will need you two veterans to teach them the ropes.
4
 
@Phrancis Yep, janos too. Seems like @janos is considering participating in the election though so he might be elected again
@Jamal and I have also considered throwing our hats in the mix as well but participate in the election, just to check if we still have the "trust of the people" still. I haven't entirely built the list of + and - if we were to do that.
 
I'll correct the code ed eventually post in the code review section. — user8469759 19 secs ago
 
@SimonForsberg OK, I hope the election happens soon :)
 
11:10 PM
@SimonForsberg I think you should stay if you want to stay. As much as I respect @janos' decision, I really believe no moderator should step down unless they're ready to lose the diamond. We're doing this to bring new blood into the mod team, and with how elections/voting works, it's hard to vote to fill more than 3 spots IMO
 
sooo .... umm ... Who's going to train the newbies?
 
@Vogel612 Jamal & Simon =)
(and Janos, should he be re-elected)
 
@MathieuGuindon yea they should stop that silly cap of three priorities
it's especially annoying if there's a ton of good candidates
 
@Vogel612 Yeah, that's one - if I and @Jamal would throw our hats into the mix as well. Although some of us would probably be re-elected, for now I think it's better if I and @Jamal stay and maybe throw our hats in another time :)
 
Why dont you ask this at codereview.stackexchange.com. Since that site is totally about optimisation of working codes! — Subham 56 secs ago
 
11:24 PM
Yes, I’ll be staying indeed. One, ideally two, vets are best for bringing the new mods up to speed.
 
If you'd really like contribute to some open source C++ projects in both a direct and indirect way, while also gaining skill points, go fix other peoples code with the C++ tag for CodeReview .. you'll learn how it's done, how to do it better, how not to it, and more importantly, how to read other peoples codetxtechhelp 39 secs ago
 
@Jamal agreed! thanks for your sustained hard work man, it's hard to find words to express how grateful I am (and I hope, this whole community is) for everything you've done for this site all these years.
I remember the kid we rooted for in that unofficial election back then. I'm so happy you're still around. You're the veteran now!
 

« first day (1779 days earlier)      last day (2221 days later) »