We had a little bit of fun in the 2nd Monitor this morning, one user greeted another with a hex string. It turned out that the user being greeted deals with Hex Dumps enough that they were able to read the string, but I wasn't so I created this converter.
What could I have done to reduce the dep...
I'm voting to close this question as off-topic because it is asking about implementing design patterns for working code which probably belongs on codereview.stackexchange.com — Simply Ged44 secs ago
In the past three days, I've been developing a simple raycasting algorithm. I've made the renderer work as I'd like to. However, it is extremely slow (5 frames per second) because of two things (as far as I know).
Finding the values of a pixel independently many times, and often it lands on the...
I want to compare user input values with what I defined (compare with data in the database if possible?) and if it is ture (here is if key_in == 'a') then head to another PHP called downloads.php.
Hope anyone can help me :)
// Define variables and initialize with empty values
$key_in = "";
...
The two method get the same sequence, if the algorithm not same, how to seep up the second method, and is there third method get the same sequence?
method 1: # http://oeis.org/A179382
# largest odd divisor of n; or odd part of n. http://oeis.org/A000265
def A000265(n):
while not n % 2:
...
Given a string, return the sum of all the numbers in the string, 0 if none are present.
Below is my solution for the problem above. I feel like this can be turned into one line. I would really only like suggestions on the actual algorithm, but anything else is appreciated.
def sum_numbers(s...
Given a string, assuming the string is numbers only, rearrange the string to that it is the greatest possible number.
Below is my solution to the problem above. I'd like feedback mainly on the algorithm, as I wrote this up very quickly. I used comprehension syntax to find the largest num, wh...
I am running an event loop which has the option to stop a double loop at any time. To break the double loop I have come to a solution where I create the indices in a generator and to flatten the double loop to a single loop where I simply can use break. Is this a best Pythonic solution?
def indi...
I am building generic Graph where I will be improving. I want to know current design is fine? am I doing memory leaks ? Any suggestions are deeply appreciated
Thannks
GraphCode
#include <iostream>
#include <memory>
#include <vector>
#include <atomic>
#include <map>
namespace AtomicOps
{
int...
I will double check everything again, I have looked at that section repeatedly but it does not have anybody under the 'Automatically include code reviewers' part....I may be looking at the wrong branch policy. Thanks for the nudge. — Joe Ruder20 secs ago
@JoeRuder, You can check my answer if it give you any helps, or you could not find the required reviewer from the Branch policies? If yes, would you please the image about the Automatically include code reviewers and the Branch policies of the branch which you want to merge — Leo Liu-MSFT24 secs ago
@JoeRuder, Check the branch policy of the branch which you want to merge, if does not have anybody under the 'Automatically include code reviewers', to check if you set Require a minimum number of reviewers on the branch policy? — Leo Liu-MSFT22 secs ago
When I key in a value that exists in the database (the column name is "job_no"), nothing happens i.e. neither show errors nor redirect to another page. Please help me have a look at codes. What am I doing wrong??
<?php
// Initialize the session
session_start();
// Check if the user is logg...
I have implemented a Ternary search tree. It works well. But if you think something needs to be improved, say it. This code was tested in Python 3.7.4.
class Node(object):
def __init__(self, character):
self.character = character
self.leftNode = None
self.middleNode ...
Hey, I have a block of Ruby code that works but I think should be able to be made neater, is this the SE to post it for improvements? Don't want to post something off topic
So I'm writting some code which works perfectly but bothers me a lot:
For i = 3 To UBound(arr)
If arr(i, 4) = 0 Then Exit For
Login = arr(i, 4)
Agentes.Logins(Login).Negocio = DatosAgente("NEGOCIO")
Agentes.Logins(Login).Mes = DatosAgente("MES")
Agentes.Logins(Login).Año = Da...
Sounds like it could be on-topic here, as long as you're the writer or maintainer of the code (you know how the code works and why it's written that way).
I have a project I am working on, and I would like some, or all of it
reviewed, how can I ask for this review on Code Review in a way that
produces the best possible value?
This is not about a question being on-topic, or off topic. Rather, this is about making on-topic questions great qu...
I've written a module for repeating blocks of code, generally to cover issues related to eventual consistency and testing screen elements which may take some time to fully load. It looks like this:
class Repeater
def initialize(&block)
@repeat_block = block
end
def repeat(times: 25, d...
Hi fellow Developers/Programmers!
I just started Developing Web App (Vue.js) for my company for around 1-2 months.
Therefore, my knowledge and experience in HTML, CSS and Javascript is kinda shallow.
I've created a custom resizable split DIVs and it working just fine as what I wanted.
However, ...
If it works for every possible input you could think of, that's good, isn't it? Do you ask for a small code review or are there any problems with your code? — churill22 secs ago
I need to grab specific fields from several csv data log streams using a PCRE RegEx. All the fields in the log files are on a single line.
^(A|B|C)[0-9]{5}.*|
^(QWE|ASD|ZXC)(\\|\/)(A|B|C)[0-9]{5}.*|
(?![\s\S])
Some example are fields that start with A12345, A123456_R, B12345T, QWE\C123456, ASD...
trying to figure out a good MVC design for my qt c++ Gui project.
I've been focusing on seperations of concerns, each class is stricktly responsible for its own implementations without being exposed to other classes implementation details, for example ,the View class is the only one that contai...
As of now the below code working As expected. But in future if the newFilterArr have new record again I want to reedit this functionality. So how to overcome this?
function Optimiz() {
let courseFilter = this.newFilterArr.find(k => k.key === 'courseId'),
rateTypeFilter = this.newFilt...
I work with electronics test equipment. I like to be able to automate tests using their remote control interfaces. I have built a pattern, a few base classes, that I can apply to all devices that follow the SCPI protocol. I would like to avoid half-assing the implementation like every time before...
I designed a (q)spi controller which can be configured over generics in QSYS(Quartus) and acts as an avalon slave.
The documentation started in german, so please bear with the partial translation.
I want to know if I can improve my signal handling or naming of my variables (or lets just say: wh...
I work with electronics test equipment. I like to be able to automate tests using their remote control interfaces. I have built a pattern, a few base classes, that I can apply to all devices that follow the SCPI protocol. I would like to avoid half-assing the implementation like every time before...
public function email( bool $set = FALSE, string $value = null ) : string {
if ( $set === TRUE ) {
$this->email = $value;
}
return $this->email;
}
Not sure how I feel about this yet. On one hand, I like that it keeps the interface smaller, on the other, I'm not sure if I like combining the get/set actions.
When I put down my mug 18 months ago, I promised I'd stick around, and I did. I've been keeping a distant eye on CR and meta, while remaining in our Rubberducking dev chat, and monitoring vba posts on both Code Review and Stack Overflow.
Seeing rolfl's resignation and the bleeding of several SE ...
@pacmaninbw obviously Joseph seemed to think it was okay and I can presume that newFilterArr is an array because of the name and array methods are called on it... but it does seem like more context of how the function/method is used would help
When I put down my mug 18 months ago, I promised I'd stick around, and I did. I've been keeping a distant eye on CR and meta, while remaining in our Rubberducking dev chat, and monitoring vba posts on both Code Review and Stack Overflow.
Seeing rolfl's resignation and the bleeding of several SE ...
@pacmaninbw RubberDuck helped seed the vba tag in 2014-2015, and eventually we started the Rubberduck OSS project together, and then he left the project (although he still participates in discussions once in a while)
@pacmaninbw I was elected in 2015, and stepped down in 2018, shortly after Microsoft MVP Summit
so anyway, it turns out MVP activities aren't too exhausting (didn't expect to get renewed last July), Rubberduck is becoming a rather mature (although gigantic) code base, and I figure I could swap some SO activity for CR moderating, and everything should be fine
Welcome to Stack Overflow! If you want help improving working code you should post this on CodeReview.SE. If you do decide to do so please delete the question here. — NathanOliver30 secs ago
I'm voting to close this question as off-topic because it is asking for help optimizing working code, and therefore should be posted on Code Review instead, which was designed specifically for that purpose. — Ken White43 secs ago
lol agreed! what I mean is, I'll likely not have the same pace here... on SO I've consistently been ranking #1 in the VBA tag's "past 30 days" for ...for as long as I remember (and climbed up to #3 in the all-time ranking).. MVP renewal demands that we submit all "community activities" - 400-and-some SO answers does weight in, IDK how much weight fewer CR answers might have (it's less exposure, I guess)
OTOH I still contribute to Rubberduck, so there's that
plus, moderating a technical community is a positive thing
And should you ever tire of it, just call for elections. If you can help us stay afloat till the storm blows over (if it ever does), that's already quite something.
It takes a long time to run. I think the loops are causing it to be inefficient
_________________________________________________________________________________#python
def addFilesToDatabase(directory):
uploadedFiles = []
errorFiles = []
rows_to_chunk_by = 1000
for filename in os.listdir(...
I have a list List which contains 100 records . I would like to split the above list into 3 lists. I tried the below condition
var transactions2 = from item in transactions
group item by i++ % 3 into part
select part.AsEnum...
I'm writing a program to calculate the longest collatz sequence for positive integers below some N. I have optimized it as far as I can - is there anything more I could do to optimize it? Any constructive criticism is welcome :)
A few interesting notes: It is easy to prove (by contradiction or ...
I need help with bubble sort. Is there any possibility to optimize the following code? How do you put it in one on the 'if' to make it work? I tried it myself but I can't do it
void sort(person tab[] , int n)
{
person tmp;
for (int i = n-1; i >0; i--)
{
for (int j = 0; j < i;...
The Tavern has it all figured out. The moment somebody starts talking about something considered by some as offensive or unwanted, they start speaking llama.
Once you get your code fixed you should posted it at SO's sister-site, Code Review. There you will receive helpful advice on how to improve your code (and make it more Ruby-like). For one, for loops are never used, for reasons you will come to understand. — Cary Swoveland54 secs ago
We have an upcoming project at work which is going to require working with express.js. I have no prior experience with node.js so I thought I'd try and do something aside from some courses. Are there any anti-patterns and what can be improved?
Objective
I have a text file that is retrieved from...
What I can't tell is if this is legitimate concern, or if it's people attempting to be argumentative for the sake of it (like that series of flags we just had).
Lots of people I used to assume were good, but now they seem to be singing a different tune...extremely concerning.
You know, I think that sums up my feelings on the whole matter.
People seem outraged at this change for no reason, and I can't tell if they're trolling or legitimately concerned.
I tried to implement KMP algorithm on my own and found it kind of hard to follow.
Can you please comment how would you make this code easier to read / understand.
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace StringQuestions
{
[TestClass]
...
The code i did for a simple app that gives us random images, the code works but i feel like im doing somenthing wrong. And one thing i would love to know is instead of grabbing from a folder called "resources" he would actually grab from a custom folder inside my exe. So theirs no need to add any...
I write a function that partition an image into multiple patches. Here is the function, are there any suggestions to make it better or more production ready in terms of the best software practice? Thanks
def cal_patches(img,num_colums):
patch_list = []
num_rows = num_colums
x,y,w,h = 0...
So in learning c++ I have to make a little program that makes a game list that can add games to the list, remove games, and display the list, and it has to use vectors and iterators, so I made the program and need feedback on how to improve it and make it cleaner/better
// Favourite Game list
//...
I am working on a web application (ASP.NET MVC). I have a CarMake dropdown list in my application: it contains car make names and corresponding Id, for example: { 1:Alfa romeo}, { 2:Audi }, { 3:BMW }, etc
I want to keep this lookup in cache, so I won't have to make a trip to DB every time I want...