12:00 AM

-1

I've been building this program for around a week or two on my spare time because I'm slowly starting to figure out how to code better. This program generates a yearly 5/3/1 cycle that is exported to a CSV file so you can easily print it off if you want. Below is my code: /** * */ package ...

12:50 AM
0

This code is used to select K for a K-nearest neighbor graph [KNNG] from a dataset with an unknown number of centroids (which is not the same as K-means clustering). Suppose that you have a dataset of observations stored in a data matrix X[n_samples, n_features] with each row being an observatio...

0

I have created a Modal, at the bottom of my CV to show various different resources and content creators that I have used to learn how to code, I have nearly finished this project and will be sending it out to companies maybe in the next few months. This modal animates in and out of the page by sl...

0

Based on this article And this question posted on the power bi forums Objectives: Resolve a hierarchy (parent - child relationship) in Power Query adding levels and their corresponding sorting columns. The final result can be used in a Power Pivot table and use it to generate a dynamic P&L. ...

1:05 AM
possible answer invalidation by Januson on question by Max: codereview.stackexchange.com/posts/236249/revisions

1:31 AM
0

I created this console app that get some json strings from a web request using a parallels for loop, class Program { private static readonly object ConsoleLock = new object(); static void Main(string[] args) { //DECLARATION var link = "http://www.mytestrequest.com/i...

2:00 AM
possible answer invalidation by Linny on question by jennifer ruurs: codereview.stackexchange.com/posts/234055/revisions

2:20 AM
@Duga Fine, fixing the  bug.

Huh, what's going on here with the bots? What purpose?

I don't understand you. Are you asking what the purpose of Duga is?

23

Although it may seem daunting to start talking in an unfamiliar room or site, The 2nd Monitor is a great room, and the friendly regulars will help you to feel right at home. Some questions you may have: How do I ask questions or get help with a post on the site using chat? What topics are ...

Interesting. So the Captain is just indicating new questions and the Duga is for some stats and whatnot. Makes me think if Crypto needs something like that as well.

Yeah pretty much

Oh, "possible answer invalidation" happens if the question is changed significantly?
I was wondering, I just answered that last one...

2:32 AM
Kinda, it's if any codeblocks change. Since that's likely to make the Q&A's not make much sense - like updating the question with feedback

Ah, but it is not smart enough to detect the removal of  :) That makes sense I suppose.
(from a programmers perspective anywho)
@Peilonrayz I voted down one question which was just a single code block of a few 100 lines. Is that acceptable here? Tried to look on meta when code is just not taking any programming practices in account, but yeah.
Hey, those posts of today / yesterday took me over 1000 rep :) My rep line looks like a staircase to heaven. Should visit more often.

@MaartenBodewes TBH I'm not sure why Duga catches that. Because technically it's not a removal, it's adding a \n after it...

@Peilonrayz I think there is a bug where  is considered part of the code if it doesn't end with a newline.
Of course, it is not part of the code anymore after the \n is added :P

@MaartenBodewes You're allowed to vote however you wish. Since I can't see the question I can't really give an opinion, as it doesn't make to much sense to me at the moment

It's this - uh - blob of code:
0

I've been building this program for around a week or two on my spare time because I'm slowly starting to figure out how to code better. This program generates a yearly 5/3/1 cycle that is exported to a CSV file so you can easily print it off if you want. Below is my code: /** * */ package ...

I'll remove my comment anyway.

2:39 AM
@MaartenBodewes Exactly

I would not even know how to start picking that together.
We at crypto have the same bug, of course. MathJax enabled and code blocks...

As for the question, the description is lacking. So I can understand a DV for that. But I don't really see a reason to downvote for the code - albeit I don't know Java.
Wow. I'm surprised they don't just append a newline to the end of posts automatically like most editors do now-a-days.

Maybe they simply didn't think about that yet. It seems a perfect solution to me, really. If not end with newline, add newline, done...
(and do that test twice, once in JS and once at the server, so the posts will always get that newline but the server doesn't have to do much most of the time)

3:23 AM
OK, I'll receive any question about cryptography review from now on in email :)

2 hours later…
5:07 AM
Monking

6:07 AM
It would be more appropriate for Code Review, I think, but since your pivot is the first element, less will be empty and more will be full, so the performance will be O(N^2) or so. (I did actually encounter this case in my current project!) Next, there is a lot of list creation and deletion; I count 5 new lists each time round, which will be slow and may cause stack overflow issues. If you wish to continue reviewing, please post to Code Review, thanks. — Ken Y-N 22 secs ago

6:29 AM
If your code works and you just want someone to review it, post it over at Code Review. — Magnus Eriksson 50 secs ago
I'm voting to close this question as off-topic because it belongs on codereview.stackexchange.comNick 21 secs ago

7:12 AM
Monking
@MaartenBodewes Captain is a feed in disguise, so setting that up for Crypto won't be particularly hard. If you want a Duga, ask @SimonForsberg and/or start here. Welcome to The 2nd :-)
@MaartenBodewes It's a poor question, so don't worry about people disagreeing with a downvote. But poor code doesn't necessarily make a poor question, so try to keep the difference between those in mind. After all, we all started somewhere. May need a tag (one of the few allowed meta-tags) if it's that obvious though.

0

I am very new to PHP coding, hence just wanted to know if my coding is prone to any SQL injection attack or any other kind of threat. Below is the code for adding client to the database: <?php \$response = array(); include 'db/db_connect.php'; include 'functions.php'; //Get the input request par...

1 hour later…
8:24 AM
I'm accepting this now. Let my Tech lead do the code review. I hope she'll be OK with it, or else i'll get back to you . :-) — Tanzeel 18 secs ago

Why is it that if you want to help someone, you get chewed out...

8:36 AM
Working code commentary can be requested at Code Review. — usr2564301 50 secs ago

0

I'm currently trying to learng the basics of the Rust programming language, to do this my first piece of code after the classic 'Hello World' was a simple recursive Fibonacci function. This is the code: use std::io; fn factorial(num: i64) -> i64 { return if num == 1 { 1 }else{...

8:59 AM
1

I have just migrated from Python 2 to Python 3 and I wrote following script to fetch all records of a table (ir_attachment) of PostgreSQL. After fetching all the records I check following points: 1.If attachment records have value for related_model, related_model_id and saved_file_name columns a...

2 hours later…
11:01 AM
Since your code works and objective of this post is code improvements/ optimizations, CodeReviews is a more apt platform — Rajesh 52 secs ago

0

from collections import defaultdict n = int(input("")) print("") array = 0 def single_element(array, n): table = defaultdict(lambda: 0) for i in range(0,n): array[i] = int(input("")) table[array[i]] += 1 if table[array[i]] == 1: print(array[i], end=""...

0

hello i am trying to write a unit test for my processor class in my project i try to deserialize a json file and then build and process it then save it to database i want to write a unit test for my process class but i get this error and i d not know where is the problem this is my process class...

If you want code review please ask here codereview.stackexchange.comcoolio85 41 secs ago

@CaptainObvious broken

11:21 AM
Monking

This is a code review question then. Assumng it works as you expect, you can get feedback on codereview.stackexchange.com If it doesn't work, however, then you should explain exactly what's wrong with it. — M. Prokhorov 44 secs ago
Thank you. I'll repost on code review — Fred Kibuchi just now

11:42 AM
0

my aim is to assign a color to each workday in a week. So if a user enters a day as a str, then I can know which color it should have. Because colors and workdays are fixed, I make them as enum.Enum instance. 1. Is enum.Enum a proper choice for colors and workdays? 2. To link day and color, I c...

Profiled our app about leaking memory.....it took only 3 hours to finish

11:56 AM
@Heslacher Is that due to a major amount of memory leaking or simply because it's a large app?

The time is because the app is running on a single core virtual machine with the profiler attached.

0

I have products page with a button to add to cart. I'm looking for an elegant way to present this scenario. Currently adding to cart is submitting to an entity cart items.I want to an elegant solution that involves finding subtotals. Here is my code effort for adding to cart soo far. Product Mod...

Its doing analyzing images about a colored mark, doing ocr and storing as pdf and tiff. Its doing this for around 120 pdfs containing 3 pages each.

oh wow that's a lot of work

Ah, ja, that will take a while.

12:03 PM
Usually this would be finished without ocr on a decent pc in about 3 minutes ;-)
Good I am payed monthly regardless how many lines of code I type ;-)
If you are interested take a look here papercmd.de/home.html what it is about.

@RolandIllig For the purpose of getting a username, it actually could be. Anyways, I wouldn't consider the code as "not working" simply for that minor issue. — Simon Forsberg 31 secs ago
Has 2 close votes... for a getName` method... Overkill IMO.

@SimonForsberg Perhaps. It does show the author didn't bother to test it though, since it would be immediately visible.
For someone claiming to want to get more serious...
Went HNQ by the way.
@Heslacher So, the documents are first marked and the software will only OCR the marked pieces? Or OCR the entire page and use the marked parts for archiving purposes?
Categorize documents based on colour while OCR'ing them all?

12:29 PM
Nowadys the mosted used solution to separate a stack of pages into documents would be to stick a barcode onto the first page of a document. Instead of doing this with our app you would use a highlighter to place a mark on the "non printable" area of the first page. You can mark one "line" inside the first page of the document as well which will be ocred as well.
That could be an invoice-number or whatever. Based on the position of the border-mark you can assign one or more filings to that document where it will be stored. Based on the settings of these filings the app will do ocr, sign the documment change from color to grey or black and white and reduces the dpi of the resulted document. The currently integrated filings are store in a folder, send per mail, store in ELO (dms-system) or in PRO-FILE (dms).
I am in the progress to turn this app into a service for a customer. We have an api for recognition of the colored markings as well.
Well, it seems there is another memory-leak taking 1.8GB, will need to find it now.

Ah, like that.

0

I made the following wrapper for the mediainfo command line. I did this mainly because mediainfo gives me more information than os.stat, specifically it gives me the Encoded date for .wma files, while the dates in os.stat don't represent the time the files were made, but rather the date the files...

1:03 PM
0

I'd like feedback on my solution to the outlined (medium level) programming challenge. What might be a more efficient or Pythonic solution? The challenge as outlined by Coderbyte: [Run Length] (https://www.coderbyte.com/solution/Run%20Length?tblang=german) Have the function RunLength(st...

1:38 PM
The question is, is this better fit on Code Review? — usr2564301 59 secs ago

0

I want to make a camera class with help of the Eigen library. The camera will be used to perform certain calculations or rather the values used to setup the camera will be used later on in multiple matrix calculations. The camera can be defined by the 9D vector and the near/far plane and width/he...

2 hours later…
3:30 PM
Ben Popper on January 28, 2020

Our guest this week is Alex Qin, co-founder and CEO of the Code Cooperative.

Alex graduated from NYU with a degree in computer science and worked as a developer and engineer at several startups in New York City, eventually assuming senior roles like engineering team lead and director of technology.

Along the way, however, she found herself face with discrimination and harassment. In 2016, she dramatically altered her appearance, an experience she discusses in a humorous and poignant talk – Shaving My Head Made me a Better Developer. …

4:06 PM
0

The code below looks at different range values and then populates specific cells on a worksheet called GeneralInfo in the Worksheet_Activate event.The below code does work as expected, but its time to clean it up a little bit, so I am looking for some ideas. I have tried to split up the code wit...

4:46 PM
1

I'm trying to add error handling and response logging for API calls. The way I have my application (chatbot) set up is that a helper function is called from the main dialog, and that helper function calls the API. I believe this is standard practice. What I'm not sure on is how I should be catchi...

Questions related to working code, with requests for refactoring advice, should be made on codereview.stackexchange.com instead. — Taplar 1 min ago

Monking

5:07 PM
-2

I have a library program that checks out books to patrons, instead of printing original data, then changes I made to the data and finally the original data again (return the books to the shelf making them not checked out again), it's only going through the first two the exiting the code. I though...

5:35 PM
possible answer invalidation by Peilonrayz on question by Daryl: codereview.stackexchange.com/posts/236282/revisions

6:02 PM
It seems I found the memory-leak. Had been some stupid error. Will see tomorrow morning after the profiler has finished. Time to go home.

6:22 PM
@Heslacher I've caught stupid errors plenty of times. Smart errors though, not so much. Perhaps those are even harder to find?

6:33 PM
Posts about working code that you wish to have improvements / critiques on are better suited for Code Review. This post doesn't have an actual question, so it's not a good fit for a question and answer site like Stack Overflow. — Shepmaster 59 secs ago

6:49 PM
Monking
@Duga doesn't appear to be invalidating, and post is off-topic as CNIONWAI

0

i need to improve the performance of ConcurrentDictionary. for that i created 2 classes for check if the more efficiencies than the original. public class FixedConcurrentDictionary<TKey, TValue> { readonly ConcurrentDictionary<TKey, TValue> _dictionary = new ConcurrentDictionary<TKey, TValue>...

7:23 PM
you may want to post this to codereview.stackexchange.comStidgeon just now
@Stidgeon Code review is for working code. This is about non-working code. — kaya3 47 secs ago

8:15 PM
possible answer invalidation by Dave on question by Dave: codereview.stackexchange.com/posts/236289/revisions

@Duga I'll handle that in a minute

8:30 PM
-1

I have an array that contains non-breaking spaces that I want to get rid of. I need to retain regular spaces and nil entries in the array. Here is what I have: myarray = ["foo/u00A0", "foo bar/u00A0", "foo foo bar/u00A0"] I want to end up with: myarray = ["foo", "foo bar", "foo foo bar"] ...

This question might be a better fit for Code Review. If you don't get a good answer here, you might want to try there — divibisan 33 secs ago
possible answer invalidation by Dave on question by Dave: codereview.stackexchange.com/posts/236289/revisions

@Duga Self-fixed by the OP

9:04 PM
"I wrote a script for salting and hashing password. Wonder how improve it and make more object oriented. It would be nice if someone more experienced can take a look and give me some advice how to make it more kosher. Any help for newbie would be great!" Sounds like a question for codereview.stackexchange.com - that's the place to ask about style issues and general advice for improving code. — kaya3 35 secs ago

@CaptainObvious off-topic: CNIONWAI - 2 more VTCs needed

9:37 PM
Thanks. It helps me. Also thanks for the code review:) — Parazit-nsk just now
If it is working code then it doesn't belong here. It might be ok for "code review". — John3136 9 secs ago
In my opinion, since this is working code looking for efficiency improvements, this question should have been migrated to Code Review instead of Stack Overflow. codereview.stackexchange.com/help/on-topicMaximillian Laumeister 36 secs ago

0

I am starting my adventure with Python and object oriented programming. I wrote a script for salting and hashing password. Wonder how improve it and make more object oriented. It would be nice if someone more experienced can take a look and give me some advice how to make it more kosher. Any h...

10:11 PM
0

Hello I just wanted to write my own code for md5 in javascript and learn its inner mechanics. (I know it is not trusted anymore, depracated, ... but im just learning). I didn't want to just copy the code that uses these like 60 repeated lines and overcomplicated functions (like here), so I starte...

2 hours later…
11:53 PM
0

Well, I'm working with Selenium to scrap a webpage that has obfuscated class names (example <div class="example-gHJkLM">...)... So I needed to create an extension method to get public static ReadOnlyCollection<IWebElement> Descendants(this IWebElement element, bool hasChildren = false, int in...

0

I wrote this quick and dirty (i hope not too much) script to download a an url list with a win32 wget port and save them as files with the url as the name to use as a cache for another program. It is my first time using powershell like this ... please be gentle ;P param ([Parameter(Mandatory =...