« first day (1811 days earlier)      last day (516 days later) » 

12:00 AM
RELOAD! There are 5240 unanswered questions (90.0036% answered)
12:14 AM
12:27 AM
Q: Simplifying casting in my C/C++ qsort char** comparator function

Alex ReynoldsI have a comparator function I use with qsort to sort an array of char* (i.e., char**), which compiles with current versions of Clang and GCC without giving errors or warnings: static int comparator(const void* a, const void* b) { #ifdef __cplusplus auto a_recast = const_cast<void *>(a); ...

1:12 AM
@CaptainObvious @Phrancis isn't the last code block the code they actually want reviewed?
looked like real code the first time I looked at it
@Malachi You mean this?

SELECT @query = ISNULL(@query+', ','') + [name]
                FROM  sys.columns
                WHERE object_id = OBJECT_ID('TableName')
                AND  [name] != 'PK';

SET @query = N'SELECT * FROM TableName WHERE COALESCE('+ @query +') IS NULL';

he doesn't use it for the same table every time
but it's a script that he uses to perform a task
I suppose it's real code, there's not much to say about it though, just a string building query
could be a stored procedure or a function with parameters passed in for the tablename, probably could do it differently too? idk
1:35 AM
Q: Generate a Json from Strings using Jackson library

Padmanabhan VijendranI am pretty new to Java and I got a requirement of converting Strings to a json structure. My below codes works fine but I have to create multiple objects and my code looks bit ugly. I want to know the better approach. I want the below Json Structure from three Strings SourceApplication, messag...

@Malachi I suppose, I'll withdraw my VTC, but I don't really like it, guess it's kind of a grey area
As presented, the code would only work if their table is literally called TableName
@Phrancis I agree, it is pretty grey
1 hour later…
3:36 AM
Q: Is there any memory leak for the implementation of array of char arrays

LoganBasically, I declared a char array to hold a maximum size of 100 char arrays. #include <stdlib.h> #include <memory.h> #include <stdio.h> int add_to_urls(char **urls, char *url) { for (int i = 0; i < 100; i++) { if (urls[i] == NULL) { urls[i] = malloc(sizeof(strlen(url) +...

3:55 AM
possible answer invalidation by flodel on question by Llopis: codereview.stackexchange.com/posts/192410/revisions
4:17 AM
4:31 AM
The you have to post the same in codereview.stackexchange.comun-lucky 34 secs ago
5:00 AM
@Duga It's fine
Be sure to add the code in full, have a header that explains what the code does. and some sample data might help if posting to code review. — QHarr 50 secs ago
Q: why I can't route into another page

Mishal Erickimport React, { Component } from 'react'; import { connect } from 'react-redux'; import { login } from '../../redux/reducer'; import { LoginForm } from '../LoginForm/LoginForm'; import { BrowserRouter as Router, Route, Link } from "react-router-dom"; const HomePage = () => ( <Router> <div>

5:23 AM
Q: integral steps in Python

Janet BuckmannI work alot with calculus and i am fairly new to python. I was looking for a way to code the following problem and future integral problems quickly through python. I already computed the following triple integral by hand and got an answer of 48.75pi. Can anyone show me some simple steps to use sc...

@CaptainObvious broken
@CaptainObvious no code no glory
5:42 AM
Q: How come my "Yes" or "No" questions always bring me to the first if statement?

Ryanwhile running: print("Would you like to change anything?") print("You would have", freePoints,"free points left") b = raw_input("Yes or no?: ") if(b == "Yes" or "yes"): c = raw_input("What stat would you like to change? ") if c in attributes: d = str(r...

Q: Printing multiple triangles

Nauman ShahidI am new to Python and only just started learning about functions. I stumbled upon a question which recommends using function to print triangles in such a format: Enter height: 5 /\ / \ / \ / \ /________\ /\ /\ / \ / \ / \ ...

@CaptainObvious broken
1/4 questions is at least good...
6:31 AM
Strictly speaking, if you have code that works, but are looking for improvements - you should try codereview.stackexchange.comBurhan Khalid 37 secs ago
possible answer invalidation by Qwerty on question by Qwerty: codereview.stackexchange.com/posts/191523/revisions
If you already have a working solution, you should go to codereview.stackexchange.comHimBromBeere 29 secs ago
7:14 AM
Q: How optimize set of nested 'if' in one function?

nepeI have such part of function: $token = $this->getToken($user); if ('main' !== session('type') && is_null($token)) { $instagramProfile = $this->findInstagramProfile($user); $token = $instagramProfile->profile->user->api_token ?? null; } else { if (!$instagramProfi...

7:30 AM
Q: Python program that will count the number of capital letters in a file

PrincessI have written the code but it is printing the count as 0. I am unable to find where my code went wrong. Can anyone help me in resolving this error? My python code: def uppercase(files): count = 0 for ch in files: for c in ch: if c.isupper(): count += 1 ...

If both code snippets work as expected, this is a question for CodeReview. — jsheeran 55 secs ago
@jsheeran I doubt its for CodeReview, as it doesn't ask for improvement but for best practices which AFAIK are on-topic — XtremeBaumer 45 secs ago
I'm voting to close this quesion as it seems more suitable for codereview.stackexchange.com since the code is working but OP wants to improve it. — VDWWD 29 secs ago
7:47 AM
Q: Optimizing string handling function

machine_1How can I optimize the following function? It checks whether two strings have a certain number of similar characters. As of now, it is very slow. I tried it on a directory containing 81 files, each containing varying number of lines: #include <stdio.h> int overlap(char *str, const char *substr,...

Q: Batch scripting r.in.lidar in pyQGIS for LiDAR DEM output?

Rohan"PNOA_2016_CAT_huso31_346-4560.las",5,1,"",1,100,"","","1","","",False,True,True,"295165.831809,383949.483035,4552152.32354,4577352.32354",0,"E:/Rohan/Heimdall/data/Raster/PyQGIS/trial.tif") With the code above I want to make a raster from an LAS. Unsure what is wrong as the code, when run in Py...

oh... just found out this (Code Review) is new to me. — Jack 24 secs ago
8:04 AM
Q: How optimize gpd function?

Vincent Ferrandhow can I optimize the following function? It calculate percentage of parcel dedicated to building (ces). As of now, it is not very "clean". bati is buildings and parcelle is parcels. Data are here : https://cadastre.data.gouv.fr/data/etalab-cadastre/2018-01-02/geojson/communes/14/14007/ def ces...

@CaptainObvious Broken
8:45 AM
Q: Python class for permutations

MontrealI am trying to develop a program which will solve any permutation-based puzzle such as 15 puzzle or Rubik's cube, so there will be a follow-up question about class that actually solves puzzle. Here I ask about the class which is essential to this task: Permutation class. class Permutation(object...

Q: Reinforcement Learning agent Lights Out

BugridWisliI'm trying to implement a Reinforcement Learning Agent for the game Lights Out which is specified here: https://www.hackerrank.com/challenges/lightsout The code so far: https://github.com/BugsBuggy/RL-LightsOut The problem is: the agent is not converging towards a policy. It is not learning any...

9:01 AM
Q: Java Code optimization - Fastest list to search and remove?

Marek Gołębiewskiso I've been working on a task. I have two giant strings, both consist of the same characters just scrambled. The task is to find the lowest possible number of changes you can make to turn the first string in the other one, while 1 change = switching neighbour chars in the string. I found a solut...

possible answer invalidation by Grrrrr on question by Grrrrr: codereview.stackexchange.com/posts/190762/revisions
The question is on best practice and as a result its not mvce. You could check if it's applicable to software engineering or code review. — lloyd 34 secs ago
@Duga seems acceptable
@lloyd This question is 100% off-topic on Code Review. Please don't recommend sites if you don't know the question is on-topic 100%. — Peilonrayz 5 secs ago
codereview.stackexchange.com offers feedback on complete, working source code. — Lundin 13 secs ago
9:21 AM
Q: Kotlin API - endpoint for users

SimonI am writing API in Kotlin - this is my first code in this language. I implemented a very primitive 'player' endpoint. I was wondering if I am doing everything ok (please don't mind the static variables - I will put them in the database later) import org.springframework.http.ResponseEntity impo...

Q: Custom parser for google protobuf

JerakinI have written a module for parsing a format used by the Defold game engine, it is essentially the google protobuf format, but with a lot of custom things to support how they handle internal things. I would like to have the whole code reviewed, but seeing that it is fairly big (800 lines) I ass...

@ikegami see my attempt at beefing this function up here: codereview.stackexchange.com/questions/192385/…Jarede 46 secs ago
Unfortunately SO is not about code review and guidance. You need to ask specific programming questions. Please edit your post accordingly. — Ron 25 secs ago
9:38 AM
Q: Proper use of OOP in Python and ORM

user1480135This isn't so much as a specific code review, but a concept review when converting a class diagram to code and then eventually a database, in Python. I know how to add things in to a database, but I have only ever done this directly with SQL from forms and not from classes, (which I believe is ca...

9:51 AM
Not an answer: Even if this were legal, I would reject any code review that relied on it — Caleth 6 secs ago
10:07 AM
I'm voting to close this question as off-topic because it is asking for a code review (and this thus too broad / opinion based). It could probably be adjusted to be on topic for the code review stackexchange. — Quentin 45 secs ago
The way you did looks fine, just you shouldn't calculate the counts twice (one in if, one in print) and use an intermediate variable. But overall your question fits in https://codereview.stackexchange.com/ better. You should move it to there. — umutto 29 secs ago
10:36 AM
Q: Geometry Task TLE

SrbinI am working on a task and the idea is working. Since it's on a online judge I get few AC, but others are TLE. Can anyone help me to make my code faster? Link to the problem: https://www.hackerrank.com/contests/w37/challenges/dynamic-line-intersection/problem My code (cpp): #include <bits/stdc...

11:09 AM
Q: Console-based table structure: Revisited

766F6964This is a follow-up from my previous post, which can be found here. A readme for more detailed information can be found here. It is a library to create console based tables where you can insert, remove and update entries. An example could look like this: +---------------+-------------+----------...

Q: A single function for implementing Newton forward and backward polynomial interpolation

Alex KonradOn various websites, I've come across a lot of realizations of Newton polynomial interpolation that use separate functions for forward and backward interpolation, respectively. Such solutions seem ugly to me because the functions look pretty much the same. For a single Newton interpolation funct...

11:28 AM
posted on April 19, 2018 by user167606

I have problem in redirecting from homepage to another page(through links)in app deployed on google cloud. I have tested it on local host and it works well.I have used a test.html to test app for simplying my testing and understanding why it is not working. homepage.html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> &l

@CaptainObvious This seems to be from a running contest. Does this policy apply here? "When we are made aware of it, code for active/current contests are removed."
@MartinR link 404s for me...and uses an xkcd without attribution as "something funny for you instead"
btw2 if it works and you are just asking for improvement, then you can use codereview portalxxxvodnikxxx 1 min ago
seems retrieving the challenge results in a 403.
but praising themselves as "one of the best startups out there" in the console ...
@MartinR next time you can flag the post with a custom-flag :)
that makes sure a mod sees it, it's not guaranteed that happens here in chat
@Vogel612 I'll do that. – Policies sometimes change over time, I just wanted some confirmation that it still applies. Thank's for dealing with it!
11:41 AM
pleasure :)
@Vogel612 And congratulations to your election as a moderator!
thank you :)
12:20 PM
Q: Quadratic Equation Solver v2.0 in Javascript using Functional Programming

Shubhendu VaidI have posted this in continuation to my earlier post Quadratic equation solver in JavaScript. Tried to improve on the shortcomings last time and also changed the logic. It is still not covering all the input cases. Planning to improve it over time with feedbacks. Recently started learning abou...

Resharper is cool.
It let me set up a test class template with a single stub method that prompts me for renaming.
It cut down a lot of template population when creating a class.
It also knows where to put the cursor after I rename the method.
If you're looking for advice on how to improve working code, please see Code Review. — glibdud 43 secs ago
You know, as much as I've said 'I hate CSS' over the past few days
Web design isn't that bad
Basicly this is what I think about current state of web.
12:33 PM
oh dear, you haven't seen the half of it
@DanPantry web design is k. User-Agent strings are a ridiculous mountain of the carp that was thrown at walls until it stuck
and proxies.
@DanPantry Yes, web design is OK. It's just implementing the design that's bad.
Yeah I'm not touching user agent strings
It's not that bad, honestly
Disagree with that website @sineemore but I';m guessing it's meant to be satire
Q: Weak Goldbach Conjecture in Rust

Simon BrahanThis is a program to find solutions to Goldbach's weak conjecture. I've tried to optimise the solution function by never looking at primes that are larger than the remaining sum, but it feels clunky. Any ideas? extern crate primal; use std::env; fn get_input() -> usize { env::args() ...

Q: Use of static methods to implement logic within a class

JohnLBevanI've recently caught an odd behaviour in my own coding: At some point in the last year I began creating protected static methods to implement the logic of my public methods, ensuring that the protected static version contains all of the logic, but is not affected by state. e.g. class Demo { ...

@DanPantry btw what happened to your profile pic? Did you change to facebook auth and your gravatar got nuked?
you def. don't need to answer that. Just curious what happened to the old one
@DanPantry, maybe. As I know guys from suckless a rather radical one.
But half of my favorite software is written by them: dwm, st, vis and tons of other stuff (mostly C). I tend to belive them. More over I came to C from writing custom patches for dwm.
Damn, those guys changed my life (:
12:44 PM
@Vogel612 I'm not sure, I didn't change anything, it just broke
I was always using facebook auth
Where's the wheel of blame.
@sineemore only a sith (or curmudgeon) deals in absolutes
and that website seems to like its absolutes
@DanPantry Then I must be a sith.
And so must every scientist out there because they demand repeatable results.
similarly, only a sith would recommend passing usernames and passwords in querystrings @EBrown
LOL. Those should be in an HTTPS POST, no?
12:46 PM
it was in HTTP POST
hm, what is sith?
@sineemore Darth Vader.
@aJimHolmes Hey Jim, got all my thoughts thrown together, feel free to let me know if anything is lacking or needs more information: http://usingprogramming.com/post/2018/04/18/doing-bad-cookie-authentication-but-for-the-right-reasons :)
@sineemore star wars villains
Aha) i see
12:47 PM
'only a sith deals in absolutes' is a quote from the movie
which one? I don't know, I haven't watched them, I just see the memes
interestingly that itself is an absolute. And it's not coming from a sith...
Guys, you never heard of suckless community before?
It's certainly not something I'd want to type into google.
You might want to check out codereview.stackexchange.comkath 59 secs ago
Q: Throttling aiohttp requests with semaphore in asyncio

Benjamin TouegI'm trying to achieve fine-grained throttling with aiohttp. By fine-grained, I mean that controlling how many requests and simultaneously executed is not good enough, I want to rate-limit the number of requests such that I have 100 requests per 10 seconds interval. Here is my code: async def f...

1:03 PM
Greetings, Programs.
Q: C#/.Net Socket BeginSend() / EndSend()

JesperI'm writing a TCP server in C# and in particular getting sending right is a bit tricky. I have something that works pretty well but I'm not totally happy about using lock(). The code I'm posting here is a distilled version of my actual server code and is just the basics for sending - I've remove...

1:32 PM
@Donald.McLean Monking, Program.
Would you folks say that extensibility/flexibility is a part of "clean code"?
@SimonForsberg Extensibility/flexibility is a proper subset of maintainability, so yes, absolutely.
@SimonForsberg Absolutely. Let me know when you find a program that by definition never changes.
Extensibility/flexibility translates directly into easier bug fixes.
Q: Littlewood Polynomial Heatmap

Husnain RazaThe following Python program generates heat maps of the roots of Littlewood polynomials as shown in [this link (see last section)][1]. It works fine with a small number of roots, however I tried to use 2^21 in the first loop and it ate up 12 gigabytes of RAM on my computer. How can I make it less...

@Hosch250 @Donald.McLean Good point(s).
1:50 PM
@CaptainObvious Broken
2:08 PM
Instead of writing comments in a code review interface someone might want to checkout the branch locally implement some changes and push those for the original author to look at. — u123 47 secs ago
ffs this is the same family of bugs introduced in XE8. Are they just waiting for us to submit reports before they fix them? What about a proactive code review and introduction of comprehensive tests? — David Heffernan 50 secs ago
Q: How to remove duplicate numbers from an array only without using any collections from java.util

Avinash PandeBelow code snippets shows how to remove duplicate integers from an array without using any collections such as HashSet, ArrayList etc...

2:32 PM
FYI, I'm considering this on-topic here and not Code Review since this is a question about how the code works, not about improving the code. — Joe 1 min ago
@sineemore You mean the community behind dwm, dmenu and so on?
@Zeta, Yes.
See backlog.
You know that guys?
Perhaps you should ask your question over at codereview.stackexchange.com/. However, you will need to make your question more clearer than "I think that this is way too big". I suggest reading How to get the best value out of Code Review before posting a question there. — RobC 33 secs ago
2:51 PM
Stack Overflow is about specific questions and answers. I can't really identify a concrete question in your post other than "what do you think about my code?". codereview.stackexchange.com might be better fitted for your request, but I'm not familiar with their rules, so be sure to check out their help pages first, if you consider posting there. — anothernode just now
Q: Parsing excel file into CSV file

MattI am loading in an excel file to a dataset using ExcelDataReader. I then need to create a csv file with the data. Currently for the excel sheet I'm working with I have about 40 columns and 30k rows of data. The approach I'm taking takes about 2 minutes to complete. What can I do to speed this up...

@sineemore Not personally (and never corresponded to them), but I know their philosophy and some tools.
@Zeta, What do you think on it [philosophy] in general? I saw lots of people complaining about their tools being barely usable.
3:13 PM
Q: Transfer the sas code into stata

Alberto AlvarezI am trying to transfer the SAS code (I am completely new in sas) to STATA. Can you please help me to interpret the code: (do i actually need this code?) PROC SQL NOPRINT; SELECT COUNT(gvkey) INTO :nobs FROM sample; QUIT; DATA sample; SET sample; observ = _N_; RUN; DATA sample;...

Q: Pair up elements of a sequence without overlap in F#

Avrohom YisroelI have a sequence (in this case actually an array) like this... [| 1; 2; 3; 4; 5; 6; 7; 8; 9; 10|] ...and want to produce a sequence of pairs like this... [(1, 2); (3, 4); (5, 6); (7, 8); ...] The following code works, but I can't help feeling that it's a lot of code. Is there a shorter, mo...

Q: one more C++ event system

  BAntDitthere is event system implementation for C++. I'm targeted on following features: RAII-friendly any number of event parameters ability to use member functions, free functions and lambdas as well almost c# like usage Now i'm looking for review, ideas and critique. The current solution for ...

3:27 PM
posted on April 19, 2018 by CommitStrip

@CommitStrip Happens every so often.
@CaptainObvious No.
Q: Circle - Line segment collision

TomekI wrote an implementation of circle - line segment collision detection algorithm. Here is quick demonstration how it works: And here is my implementation in Javascript using HTML canvas: index.html <html> <head> <meta charset="utf-8"> </head> <body> <canvas id="can...

3:50 PM
Q: Build embedded XML based on string containment

Bram VanroyI have a list of strings that represent a path. These are unique, unsorted values that look like this: li = ['1/', '1/2/4/', '1/23/4/', '1/2/', '1/1/3/', '1/2/3/4/', '1/1/', '1/23/', '1/2/3/'] It can also be assumed that every path has a parent, e.g. 1/2/ has parent 1/. The goal is to organis...

I will have to dig out my BlackJack game from Github. can't remember how I did the Deck... clean up my code and post a question too. lol
SO is not about code review. — Ron 1 min ago
This is a problem...
4:03 PM
I think one of our Windows Server is in an endless rollback loop.
wow, 17000+ lines, what language?
@Zeta FTFY I think one of our Windows Server is in an endless rollback loop.
Damnit, forgot the chat strike.
Probably not.
@sineemore VB.NET
4:06 PM
@202_accepted ---text---.
@Zeta Damnit
@sineemore Thanks, I appreciate that
Also, my current audio is broken, and whenever I get pinged it sounds like a blast in space invaders (aka compressed white noise).
@Zeta That's going to be hard to prove
@Rubberduck203 It gets better, Chris. :)
@Rubberduck203 Way...
@Rubberduck203 Way, better.
4:09 PM
@skiwi Well, at least it's stuck on "Could not install updates, rolling back changes" for the last ~10 minutes.
Yeah, I have an If 1 = 1 Then in a production application because that was easier than commenting the If out.
@202_accepted, and I have 3e9 rows in db and just ran alter to add index, no backups. i dream of being fired from my current job
Same thing with If 1 / 2 Then. :)
@Zeta I'm pretty sure we had a production server as well stuck, and later at home with my new (current now) PC I had the same issue, ended up reinstalling it for the fourth time and since then it's worked fine
@sineemore I do that regularly because I don't think they'd ever fire me.
4:12 PM
Finally those rollbackupdates are done. TTQW.
COUNT(*) took 10 minutes to.. hm, count the rows.. it weights ~100G and I belive it will do alter for several days
the first
Oh dear god, I'll pray for you.
nah. I just need that index.
okay, i am doing backup.
you forced me (:
4:14 PM
I, personally, wouldn't do a backup. The biggest issue will be table locks.
just not sure i can run press ctrl+c right now
no not in this company
that great table is barely used
I have a table with over a billion rows that seems to do just fine when I add indexes to it. :)
300000000 rows is a lot i guess.
hm, nice
was it innodb?
hm, i can see alter progress by disk space usage i guess
will wait for it to double
argh, it is righting to /tmp which is 6GB
4:22 PM
@DanPantry Weird that I didn't get pinged from that. At any rate, the querystring username/password was not a "suggestion" or "recommendation", simply an easy way to get the MVP we needed. ;)
Which, interestingly, not all servers log that: ours is configured to only log the page because there are some older things that use insecure query-string parameters, so we don't log them. ;)
Q: Error in p5.js library

codeczarThis error showing in my code of p5.js.Before two days the same code was running smoothly. Has there been made any changes in p5.js library which is causing this error? The link to my web page is here Uncaught DOMException: Failed to execute 'drawImage' on 'CanvasRenderingContext2D': The image a...

Q: Composable by-member comparison

Toby SpeightMotivation Quite often, I find myself creating types that must be compared memberwise. For example, consider this simple Person: #include <string> struct Person { // Pretend that the falsehoods programmers believe about names are // all actually true. std::string first_name; s...

Q: Removing last part/file in path

StrangeRangerI have a variable that looks like this: path = sys.argv[0] which path will equal something like this: /root/home/user/dir/program. I want to remove /program from the string so it looks like /root/home/user/dir. How exactly would I do this?

@CaptainObvious Nope
4:43 PM
Hey @200_success.
How's the life of a non-mod?
Q: Search Feature built with jQuery AJAX, query strings and a few ES6 features

PeeperThis is front end code for a search feature. It uses the users search query to return an array of matching characters, which then gets displayed in a search list for the user to view and select. Please let me know how I can shorten, simplify or improve this code. Thanks for your time! //Champ Se...

I kind of miss the ability to nuke junk, though.
4:46 PM
Maybe @SimonForsberg can set up something on his Server2 for you to nuke things using his account :P
@Hosch250 I think that would go against moderator agreement :)
Good to see you @202_accepted
That's OK. It's someone else's job now. That was kind of the point of handing over the position.
Good to see you @200_success
(Good to see you too actually, @202_accepted, but it was 200 I meant first)
4:48 PM
@SimonForsberg It's OK, I have run this ploy for several months now simple for this one, minuscule moment.
@202_accepted Does that mean that you can change your name now?
What I've been waiting for more: finally, MySQL supports CTEs and window functions!
This is what happens when you just press @20<tab>
@SimonForsberg Yeah but I need a new gimmick, and that's a lot of research. :)
4:49 PM
@202_accepted I think it's just because he was in this room now. I'm so used to pinging him in The 1st Monitor otherwise.
How many versions of SQL does Oracle own?
@200_success wait, they integrated NoSQL into MySQL without segregating the datapots?
doesn't that completely nuke the query performance?
Dunno. MySQL has already been a hodgepodge of storage engines anyway.
MySQL query performance isn't that great to begin with.
@200_success Gah, you beat me to it. ;)
@aJimHolmes USB devices _will_ fit in an HDMI port, and upside down, if you are determined enough, try hard, and believe in yourself. Also HULK SMASH
5:19 PM
Side note, grab a copy of the framework design guidelines. Or, alternatively, if you don't see a style in the .net framework, don't use it. Hungarian notation and_underscores_in_names aren't used (except in autogenerated event handler names which is so embarrassing), and if other people see you using it they'll think you aren't as skilled in the language. It can hurt you in job interviews and in code reviews. — Will 35 secs ago
@202_accepted Oh yeah? What happens?
5:37 PM
Q: How to efficiently apply correction to a time series with fully vectorized code in Matlab

CuninghamI face a computation efficiency problem. I have a time series of a non-monotonically drifting variable, that is measurements of objects going through a machine (where the measurement is made) in a production line. The job to do consists of simulating what this time series would yield if there was...

5:55 PM
Q: post Like/Dislike with mongoose/mongodb

Asaf AvivRight now my route is doing the following: Searching the post Check if user already likes the post If likes inc likeCount and push user_id to the likes array of the current post and vice versa (dec, pull) Adding post id to myLikes array of user and vice versa Any thoughts / suggestions on th...

This might be a better fit for softwareengineering.stackexchange.com or codereview.stackexchange.com — WhiteHotLoveTiger 45 secs ago
I'm voting to close this question as off-topic because it belongs on codereview.stackexchange.com since it is working code seeking improvements / critique — scsimon 41 secs ago
6:13 PM
@Hosch250 Not much, really.
Q: Tic Tac Toe / Noughts and Crosses - Game End Result Printing Twice

jr100This is the first program I have tried to make. Its written in Python 3. I have noticed when the game finishes, the message is printed twice but I cannot see why. Any help regarding this or any other improvements are appreciated. Thanks. #Grid grid = [0, 1, 2, 3, 4, 5, 6, 7, 8] print("Welcome ...

@scsimon It is okay to recommend the OP post on CR but in the future, please don't use Code Review as a reason to close a question. Evaluate the request and use a reason like too broad, primarily opinion-based, etc. Then you can mention to the OP that it can be posted on Code Review if it is on-topic. Please see the section What you should not do in this answer to A guide to Code Review for Stack Overflow usersPhrancis 23 secs ago
@202_accepted fit in != work
Thanks for the post. I always found it odd that stats.stackexchange was a default option, but not codereview, thus I used the custom method. I just didn't want to discourage CodeMonkey, but rather steer them to somewhere that it could garner more attention. My bad — scsimon 40 secs ago
6:34 PM
Q: Media Genre ID parser

AppleThe class below takes in a string of genreIDs deserialized from JSON and spits them back out in a format I can actually use. I'm definitely a beginner and would like to better myself, I feel like with this class specifically I lack of Java knowledge really shows, what would be the big-boy way to ...

Q: Are vectorization requests on-topic?

200_successCurrently, there are 62 questions tagged vectorization, nearly all of which say "The performance sucks; how can I vectorize this code?". Recently, How to efficiently apply correction to a time series with fully vectorized code in Matlab was closed, with this comment: This question is off-top...

6:47 PM
@Feeds @200_success I think we should eliminate that tag but that's just me.
man this script takes forever....
almost 40 minutes....ugh
at least it is done.
@Malachi Wow. That's a script that needs some TLC.
@Hosch250 it loads address information tables.
Although, who am I to complain. We've got scripts at work that take hours and hours to run.
Counties, Zip Codes and Zip4 Ranges
6:56 PM
Fortunately, I don't touch them (yet).
@Malachi Meh, still needs TLC.
And when I do touch them, DB indexes and parallelization, here I come.
@Hosch250 I have one that was never able to finish within a week (and we get new data each week) so I broke it into two parts: one that downloads the data, and one that does the sync to the database. The sync runs indefinitely. :)
@202_accepted Yes, that's more/less what this does.
@202_accepted Hmm. So you have an ever-growing backlog of data to load?
@202_accepted either you're dealing with reams of data, or you should look at the performance of that database...
Let me know when that tumbles down.
@Vogel612 Probably both.
@Vogel612 We deal with a lot of government-provided data, from roughly 20 different departments and organizations.
@Hosch250 No, it replaces the in-process data.
6:58 PM
Oh, so each week you dump all previous data and replace it?
I don't try to wrap my head around the SQL stuff, 1 I don't know oracle well enough and 2 there are people here that are very good at SQL
Well, that sounds like a challenge. I'm itching to get my fingers on it already.
@Malachi I'm rather quickly becoming one of the people at my work that's pretty (I won't say very yet) good at SQL.
So if we look at it sequentially, say I have values 1-10, and each value takes a day to process, we start it Sunday after I get my new data set, and I get new data every Sunday at 0130 ET, so I replace 1-10 with the new stuff the next Sunday, and it starts processing element 8 from the new data-set, and loops to element 1 by Wednesday, so it's always rotating.
SQL is awesome for processing data in-DB quickly and only extracting what you need.
@202_accepted In other words, you lose a bunch of data?
That doesn't sound very good at all.
We don't actually need it, because the next Sunday dump will have the old data in it.
We don't get incremental updates for this, so we have to reprocess the whole thing.
7:01 PM
Oh wow.
@Hosch250 I know enough SQL. I would say that I am somewhere in the intermediate realm
So if 1 doesn't change between two Sundays, I still have to reprocess it.
OK, sounds OK.
there isn't any change logs?
But my fingers are still itching to try fixing it :P
7:02 PM
they should be sending you what changed
@Malachi Nope. :(
@Malachi The government should be doing a lot of things...lol
lol aint that the truth
Sun: 0a 1a 2a 3a 4a 5a 6a 7a 8a 9a
Sun: ^
Mon:    ^
Tue:       ^
Wed:          ^
Thu:             ^
Fri:                ^
Sat:                   ^
Sun: 0b 1b 2b 3b 4b 5b 6b 7b 8b 9b
Sun:                      ^
Mon:                         ^
Tue:                            ^
Wed: ^
Thu:    ^
Fri:       ^
Sat:          ^
Sun: 0c 1c 2c 3c 4c 5c 6c 7c 8c 9c
Sun:             ^
Mon:                ^
Tue:                   ^
Wed:                      ^
Thu:                         ^
Fri:                            ^
@Hosch250 @Malachi ^^^ That's how it works.
The caret is what point it's processing. So in this example, we missed data 7a, 8a, 9a, 4b, 5b, 6b, 0c, 1c, 2c, 3c.
Yeah, not a bad idea at all given what you have.
Nah, it works well, and it means we can not have to worry about how long it takes, because it's always working through what it can. If it gets done too soon, it'll start over with the same data-set, but that never happens.
7:06 PM
so data is only current every so many days, otherwise it could be 7 days old?
It takes about 12.5 days to process the whole set, so at most things are 2 weeks old.
Well, 2 weeks 6 days.
The good news is we only have to have data accurate to 30 days.
So I still have ~25% of it to spare.
well then your doing a good job given the specifications...lol
Most companies in our field don't have this data-set accurate to 60 days...lol
oh wow
(Ever wonder why things at your bank take so long or are out-of-date?)
7:09 PM
This script is taking longer than I was told it would take.....
I'd still like to get my fingers on it, LOL.
Hah, well if you decide to become an employee (because I can't share more details with folks not on payroll - SOC stuff) you can peek at it. ;)
@202_accepted Ha, SOC 2 compliant?
Same here. Almost.
We are working on it.
All sorts of BS about devs not having admin access to their local machine, etc.
We can't even open the task manager without an admin password now.
7:27 PM
Well I only figured out what the problem was. Tim wrote that code. Code optimization is really for code review site where you post the code in its entirety. You give a header saying what the code does. You can supplement with some additional explanation if required. The whole code is then reviewed. You can request that particular focus on speed is included. And if this has answered your initial question please consider accepting as answer. stackoverflow.com/help/someone-answersQHarr 15 secs ago
Q: A Stack Machine

bruglescoWhy you're here: Today I bring you a simple Stack Machine and a Lot of questions. I am trying to gain a little bit more understanding of pointers, memory management and templates and thought a Stack implementation would be a fun exercise. As such I would love feedback pertaining to those areas, ...

Q: should we Vectorize [tag:vectorization] questions with a [Vectorized] tag?

MalachiThe vectorization seems to be misleading, a possible solution to this problem would be to create a new tag, vectorized and clean up the aftermath. This would let users know that the tag needs to be used for questions where the code has already gone through the vectorization process and are now v...

@Feeds I think that would have been better as a potential answer on the original question.
@Hosch250 but that question is about closing all the questions that are already tagged with the confusing tag. I didn't feel like it fit as an answer...
7:37 PM
Yes, it does fit. It proposes we don't delete it, like 202's and rolfl's answers.
And it also addresses the issue of improving usage of the tag.
so should I leave the question and paste it into an answer? because the current way of getting rid of a tag is to post a meta about it and let everyone weigh in, feels like this would be doing it backwards...
@Malachi I don't know. Anyone else have thoughts?
@202_accepted I was reading that
@Malachi Well read it over there --> ;) Figured I should be a responsible RO and move the off-topic stuff since it got a bit long. :P
7:49 PM
@202_accepted lol already did, I was almost done, and then * poof *
@Malachi I would probably wait until we decided with the question from @200_success, then yours would be more appropriate. :)
@202_accepted 200 already handled it.
I was going to be nice about the tag, but jeez it's a complete cluster. Every question tagged with that I looked at (granted, not all 62) was not relevant to how it should actually be used.
@Malachi Your question is dupe hammered.
1 min ago, by Malachi
@202_accepted 200 already handled it.
7:52 PM
200? Looks like rolfl.
nope. 200 got a golden badge and can dup-hammer on meta
Oh, NVM. I'm blind.
I just saw rolfl's edit.
@Malachi FWIW I think your second question was hammered because, in this case, the scope of the original question dove into that area because I suggested burn the @#$%er to the ground.
I went to ask a DB about the script I had running, and the second I got up it finished so he didn't see anything going on with my sessions
8:01 PM
@Malachi I usually just run queries against my DB for that.
@202_accepted I am using Toad, so when I ran this script it kept me from doing anything in my IDE
I am not impressed with Oracle so far...lol I miss SQLServer
your capslock seems to be stuck
No I did that on purpose. :)
Sometimes I shout stuff, not often, but sometimes.
Q: I was making a solar system with 2 Star Arrays(processing)

JasonHere is the beginning of my code.(Planet codes are in a different Tab) PImage bg; int STARS = 500; int STARS1 = 200; float[] xs = new float[STARS]; float[] ys = new float[STARS]; float[] speeds = new float[STARS]; float[] xs1 = new float[STARS1]; float[] ys1 = new float[STARS1]; float[] speeds1...

8:29 PM
Q: Longest Common Prefix TLE

SrbendaCan anyone help me remove tle (time limit exceeded) from this? Given integer n and array of string of length n. In each query (q of them) we are given l and r and we need to find LCP in this subsequence. Q and N <= 10^5. The sum of lengths of strings <= 10^5. My code (CPP): #include <bits/stdc...

Q: AttributeError: 'dict' object has no attribute 'fees'

mattI do not understand how to allocate a python dictionary. I was hoping someone could point out my error. If this is not the right forum, please help me out and point me to the right one. This is my code: msg = {'fees': ['GMBk8YVHn2', 2, 'C4xbW4SR'] } fees = getattr(msg, "fees") Traceback (m...

8:58 PM
My two cents:
A: Are vectorization requests on-topic?

Simon Forsbergrolfl's argument is that "I would like to vectorize this code to make it more efficient. Does anyone see a way to do this?" is off-topic because it asks for the code. I disagree with this. "How do I vectorize this code" is a specific refactoring question (I believe this has been brought up on me...

Hahah, someone on PPCG fixed my overlook on my FizzBuzz golfing attempt from 2 years ago
9:21 PM
Q: TicTacToe in Python

TheAmazingRakThis is my second attempt to make Tic Tac Toe in Python. It's a part of my learning. Tomorrow I'll work on some simple AI and better menu. What do you think about it? What changes do you suggest? Code: class Field: val = " " pos = 0 weight = 0 def __init__(self, n): self...

9:36 PM
If someone could look at this, I would appreciate it. Thanks codereview.stackexchange.com/q/192464/88981
@HusnainRaza you did already get an answer and the question is only 8 hours old. Have a little patience :)
Q: Failing to identify a mistake in the code

Alberto AlvarezI use the code below. What I am trying to do is to run sum equations simultaneously so that some of the observations (volatility, value of the firm) are determined simultaneously. For this, I employ the code below. However, what I get is that there is a bug that I am failing to identify. In parti...

I'm sorry
no worries :)
I didn't know what to expect in terms of rate of getting answers
like I thought the question would be buried under new ones after a couple of hours
9:39 PM
while that may happen, I usually recommend waiting at least a day, if not two.
Code Review is a comparatively slow site
@HusnainRaza We don't get nearly as much volume as sites like Stack Overflow, but at the same time there aren't nearly as many active members, so it's pretty typical for it to take a few days, depending how common or esoteric the question/code is
Might be more suitable for codereview.stackexchange.comchoroba 29 secs ago
10:01 PM
I can't possibly think of use case for &mut &mut _.this uses &mut &_, and I think the extension to &mut &mut is reasonable. — Shepmaster 1 min ago
10:19 PM
Q: Should I replace this numeric literal with a variable that signifies the number of bytes we use to encode a length?

pushkinI'm having a bit of a debate at work regarding when to replace numeric literals with variable names. I have a function that reads data from a buffer and after each read, updates the offset so that next time, we read starting at the right offset. function readMessage(data: Buffer, offset: number...

code reviews are off topic for stack overflow. — xaxxon 54 secs ago
@SimonForsberg I like the justification of it being on-topic here. (That's something I purposefully didn't directly discuss.)
@xaxxon Noted, I'll post it on codereview as mentioned by choroba. Should I delete the one here? — Azure Heights 50 secs ago

« first day (1811 days earlier)      last day (516 days later) »