« first day (1602 days earlier)      last day (2714 days later) » 

00:00
RELOAD! There are 4390 unanswered questions (90.7657% answered)
 
1 hour later…
01:16
0
Q: Find number repeated odd times in array

user7496931I completed the following exercise: 'You are given an array of repeating numbers. All numbers repeat in an even way, except for one. Find that odd occurring number.' function findOdd(arr){ obj = {}; for (var el in arr) { if (!obj[arr[el]]) { obj[arr[el]] = 1; } else { o...

0
Q: Approach for validation in domain layer

MateuszMateuszI was struggling for some time with proper implementation of domain validation in the context of domain entity and it's properties. By the time validation comes down to check if property value matches pattern and/or already exists. First of all, I implemented Validator interface, which is generi...

01:32
@Hosch250 VS2017 has now added official support for folders in F# projects.
Awesome.
Yeah, so you can right click the project and create folders like any other. :)
01:50
0
Q: webcrawler for python using bfs and dfs

idontreallyknow2I am looking for help on how to implement my crawler correctly It needs to: start with a set known URL's which i have stored in a text file but am not sure how to import it in my code correctly . the way the input needs to work for it is : Input(taking command line input like): ~name of file co...

02:24
0
Q: Verbose Word/Phrase Reverse in Node.js

Zach HilmanThis is a Java APCS assignment I'm doing in Node to practice Node and basic JS. This happens to be my second JS program, despite that, be rigorous in review please. The assignment is to: If input is a word, reverse the word. (e.g. "hello" becomes "olleh") If input is a phrase, reverse the orde...

02:38
this feels like it would be a better fit for Code Review. codereview.stackexchange.comClaies 10 secs ago
02:53
0
Q: Verbose Word/Phrase Reverse in C++

Zach HilmanSame exact story as Verbose Word/Phrase Reverse in Node.js, but in C++. If you don't want to follow the link: The assignment is to: 1) If input is a word, reverse the word. (e.g. "hello" becomes "olleh") 2) If input is a phrase, reverse the order of the phrase but not the actual wo...

03:24
0
Q: Need a better way to initialize

Bob RossCould someone tell me a better way to write a this initalizer. I have a function that returns a boolean if it passes, just think that it is messy programming. Any ideas on how to improve this source? static Boolean initialize(){ const int initializers = 2; // amount of initializers that ne...

 
1 hour later…
04:28
0
Q: Particle swarm optimsation using pyCUDA

Bhaskar DhariyalI have written a Particle Swarm Optimisation(PSO) using PyCUDA. I referred this Paper. The code is running, but not converging. The code is also at git repo. # coding: utf-8 # In[41]: import numpy as np import pycuda.driver as cuda import pycuda.autoinit from pycuda.compiler import SourceModu...

Monking
05:07
2
Q: Is catching null pointer exception to handle it instead of null check beforehand always a bad practice or it depends?

Vikas PrasadI wrote a static method for an enum that returns the corresponding enum instance based on the source string, trimming any whitespaces and ignoring case as: public static SomeEnum fromString(String source) { try { return source == null ? null : SomeEnum.valueOf(source.trim().toUpperCa...

05:21
0
Q: How to increase python recursive algorithm performance?

user14511I got an algorithm counting max weight of independent tree subset: def optimal_solution(tree, v, parent): m_first = tree[v].weight m_second = 0 for child in tree[v].children: if child != parent: for grandchild in tree[child].children: if grandchild...

Post on codereview.stackexchange.com — Amit 51 secs ago
Do you get any error. If so please post the error message along with the code and not a picture. If you want your code to be reviewed post it to codereview.stackexchange.com — thebenman 43 secs ago
05:40
possible answer invalidation by Vikas Prasad on question by Vikas Prasad: codereview.stackexchange.com/posts/176276/revisions
I'm voting to close this question as off-topic because it's a review question for working code, which might fit for codereview if edited/improved. — bummi 48 secs ago
06:09
0
Q: Cleaner way to initialize

Bob RossCould someone tell me a better way to write a this initalizer. I have a function that returns a boolean if it passes, just think that it is messy programming. Any ideas on how to improve this source? Ideas on how I would build it with a method attribute that get's auto detected? Or something simi...

06:34
Moved this question to codereview as suggested. — Pankaj Jain 16 secs ago
I also got 3 products. Is this for code review? Just do a ToList() to your query — Amit 39 secs ago
07:13
1
Q: Nelder-Mead algorithm in C#

Jarko DubbeldamI am currently learning C# since the last week. I have little to no prior experience with any of the C family of languages. I implemented the Nelder-Mead algorithm for numerical optimisation of a function. My implementation exists of a function that takes two arguments, the function to optimize,...

07:58
0
Q: Generating Permutations in Python

NilsTo brush up my Python knowledge I an algorithm to generate permutations in lexicographic order. I ended up with the following code: def swap(a, i, j): tmp = a[i] a[i] = a[j] a[j] = tmp def next_permutation(a): n = len(a) if n == 0 or n == 1: return False kFound =...

08:41
Thanks to both of you guys. I'll take your advice and head to codereview.stackexchange.com. One question though - how do I mark your answers as useful. I recently created this account and currently taking baby steps. — Llamathrust 29 secs ago
09:19
0
Q: longest sequence of consecutive numbers

santosh singhI am trying to print longest consecutive element in sorted array for that I have written following brute force algorithm void Main() { var arr = new[] { 1, 2, 4, 5, 6 ,7,8,10,11,12}; int max = 0; int count = 1; int startIndex = 0; int start=0; int endIndex=0; for (...

09:48
0
Q: Web Service Calling a Web API

Sibongeleni MdlaloseI have these 3 methods on my business class that is being utilised by a web service: // 1. Method called by Web Service - DockingHubService.asmx //========================================================= public static JArray GetAutocomplete( string searchText) { using (clien...

10:02
-1
Q: Code to scrape data from yellow pages

James WestonI am very new to this. Previously we have been using a freelancer to do our scraping but thought as we need more and more done we might try it ourselves. We have python installed on our MAC and I found this answer and code which I thought would be ideal for me as it was doing exactly what I wante...

10:53
Maybe you want to post your stored procedure to link codereview? — Sebastian S. just now
11:10
possible answer invalidation by Bhaskar Dhariyal on question by Bhaskar Dhariyal: codereview.stackexchange.com/posts/176273/revisions
@Duga IDK kinda looks fine, the answer doesn't really say much
0
Q: BetaCV implementation in matlab

pranav nerurkarI am implementing BetaCV cluster validation statistic in matlab. The code i am referring to for implementation is in R. It can be seen at this link https://github.com/UBOdin/EttuBench/edit/master/evaluation.R The information about BetaCV can be read from this book page 441. https://books.google...

11:35
Monking
11:48
0
Q: Second URL is not replacing

SadhuI am trying to replace a particular string using .replace(). First and last searches are getting replaced but not second one. var text = "![alt text](https://www.reduceimages.com/img/image-after3.jpg) adadw hjagwdjh ![alt text](https://www.reduceimages.com/img/image-after2.jpg) akjhwdhaw...

0
Q: How to create a folder in External Storage Directory in Android?

SHIDHIN.T.SI cannot create a folder in android External Storage Directory. I have added permissing on manifest, <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> Here is my code: String Path = Environment.getExternalStorageDirectory().getPath().toString()+ "/Shidhin/ShidhiIm...

Note that the algorithm described in codereview.stackexchange.com/questions/1526/… returns all non-empty subsets. Since the OP didn't mention this to be a constraint, I assume that algorithm would not serve his purposes. — Kurt Peek 20 secs ago
Greetings, Programs.
0
Q: Feymann lifeguard riddle graphical representation

CaridorcPyhsicist Richard Feynman though of a very interesting riddle: Imagine you are a lifeguard at the side of the beach and there is a child drowning in the water. (You must cross both sand and water to get to him) Which route would you take to go to the child and save him? Not a straight ...

12:53
Monking
13:34
2
Q: Finding added keys, removed keys, and unchanged keys in ordereddict

Conor ManconeI'm comparing two OrderedDict objects and I need to find added keys, removed keys, and keys that are present in both (the intersection). Sets are designed for exactly that sort of thing, so my initial attempt involved getting the keys, converting to sets and then comparing/intersecting appropria...

Hi, this belongs on Code Review, not Stack Overflow. You're asking for suggestions on how to improve already-working code, which is exactly what CR is for. — TylerH 38 secs ago
@TylerH Yes and no. This could make for a great Code Review question, but OP is excluding a lot of possible answers and appears to be looking for alternative implementations instead of a review on the code provided. As it currently stands, the question would be closed on Code Review for not including the code in the question itself (links can't have the majority of the code, see their help center. — Mast just now
@Mast Ideally OP would adjust the question as necessary to fit Code Review's requirement, that was implicit in my comment as he's a veteran user. — TylerH 34 secs ago
14:32
0
Q: there's two object using a single varaible in my code but they should use it defferently as programmed. why?

RabinHere's the code... import java.util.Scanner; class Draft extends Thread { String name; static int counter; //the static field counter boolean islive; // the constructor public Draft(String name, int counter, boolean islive) { this.name = name; this.counte...

Same advice everyone else asking "speed up VBA macro": work with an in-memory array, not with the worksheet. And when you work with the worksheet, don't use Select and Activate, especially not in a loop - it's the single slowest thing you can do in VBA. As you can see, turning off ScreenUpdating is a cargo-cultist's performance fix for poorly-written code. Fix the blatant issues, see what other problems Rubberduck finds, fix them, then get useful feedback on Code Review. This question isn't really a good fit for Stack Oveflow. — Mat's Mug just now
14:53
This is kind of question for code review: codereview.stackexchange.comMark Benovsky 42 secs ago
I think this should be on codereviewdymanoid 45 secs ago
15:11
@RMunroe I'm really glad that's not true on the JVM or I would be in serious trouble.
15:49
0
Q: Tic Tac Toe in C

Ryan Tinwould appreciate if anyone could look through my tic tac toe code and what I possibly do to improve upon it. Initializing the Board void BoardInitializer(char board[HORIZONTAL][VERTICAL]) { char index = '1'; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) ...

16:17
Monking
0
Q: Simple client/server library

CarcigenicateI'm writing a Tamagotchi clone, and decided to try making an online version. Since I don't do a lot of networking projects, I decided to try and go off on a tangent and screw around with sockets and making basic generic functions. I ended up with an extremely basic set of functions that I'm going...

17:08
0
Q: Recursive right-to-left segmenting (tokenizing) of strings in Python

arjanI want to segment a list of strings based on a custom list of words/forms, from right-to-left. Here I've illustrated it with made-up English examples, but the point is to segment/tokenize using a custom list of forms. (I was also wondering whether I could/should use NLTK tokenize for this, but it...

17:32
This would be better suited to codereview.stackexchange.com, but it seems to me to be more of a matter of how you want to use it. Do you want it as a property of your KdpReport, or as a functional utility? Personally, I'd probably go with an instance method of the model. — Unixmonkey 56 secs ago
1
Q: Function to determine what color shirt somebody should wear to a football game depending on what seat they have

DylanI was tasked with writing a function to find what color shirt someone should wear to our college football game depending on what seat they sit in. Here is the function I came up with: function getColor(section, row) { const colorA = "orange"; const colorB = "white"; section = section.toUpp...

17:54
0
Q: Use offsetof to find a reference to a pointer in a struct

SMCThis is a follow on from this question - Delete node from singly linked list with tail pointer in C I've attempted to implement using the offsetof() macro mentioned by the answerer and after a lot of debugging I found that I needed to cast my pointer to a char* in order to be able to increment ...

stack exchange code review may be a better place to get answers about optimization — johnchase 24 secs ago
oh thanks how can i migrate this question to code review — Srinivas 56 secs ago
18:13
0
Q: JS Function Simplify and shorten

David BriertonI am trying to figure out how I can shorten this code while the function must do the same things. I am trying to learn the most efficient ways with as minimal code as possible. The first part of my code is a datepicker for a "From" and "To" showing the date MMDDYYYY in a textbox and having the F...

0
Q: Code to export pythons scraping results to csv file

James Westonhave managed to do my first succesful scrape with some help found on this forum and a response to a question earlier today. I am really really new to this and have searched the forums but am still a bit confused. I added some extra code in an effort to have the data go straight into a csv file. T...

0
Q: Searching for available IP addresses

GabrielWhat my code does When called without arguments, it searches for the first available IP address in my network. When called with 1 argument (which ought to be an valid IP address), it verifies if this address is available. What I am looking for A better way to find out if a given IP address is...

18:44
2
Q: A new command to find all references to a control

mansellanI'm new to open source, and have started contributing to the Rubberduck open source project, specifically Need "Find all References" in Form Designer context menu. I tried to have the new MenuItem use the existing FindAllReferences command, but this wasn't straightforward, as it would have invol...

0
Q: Airport Construction USE JAVA Language Solve

user149429The input starts with a line containing an integer n (3 ≤ n ≤ 200) specifying the number of vertices of the polygon. This is followed by n lines, each containing two integers x and y (|x|, |y| ≤ 106 ) that give the coordinates (x, y) of the vertices of the polygon in counter-clockwise order. The ...

18:58
0
Q: Managing JS objects while preserving references

maxathousandScenario I have foo: { name: 'Mr. Foo', value: 4 } I receive bar from the server: { name: 'Mrs. Bar', description: 'Wife of Mr. Bar' } I wish to update foo to be identical to bar (containing only the same properties and values in bar, and nothing more), but I need every ref...

If this code works fine, then this question is off topic on Stack Overflow, but may be good for our sister site Code Review. — Joe C 32 secs ago
0
Q: STOMP Consumer stops when got heartbeat timeout

LafadaI have code as below. import stomp import logging from time import sleep from socket import gethostname LOGGER = logging.getLogger(__name__) class Client(object): def start_consumer_connection(self): LOGGER.info('Starting consumer') self.in_queue = in_queue self.c...

19:16
I'm voting to close this question as off-topic because it should be moved to codereview.stackexchange.commainstringargs 30 secs ago
19:55
Structs define objects. They're essentially the same as classes. Also, your question isn't very clear. If you just was a review of working, complete code, Code Review is a better place to ask. — Carcigenicate 31 secs ago
@justsomenoob2020: Still, without knowing exactly what you're trying to accomplish, it's hard to refactor well. And even then, when you end up with something that works (and has a good problem statement), Code Review is a more appropriate place to post. — AndyG 37 secs ago
1
Q: script that imports only data that is not in the database yet

TomI want to write a script that imports data into a database (in django). The database has a Company class with a name (CharField) instance. Additionally, it has a Person class with name (CharField), email address (CharField) and a company which is a reference to the Company class (ForeginKey). T...

0
Q: A command-line Python program

Martin KleivenHere is the GitHub repository for the code if you'd like to look at that instead. It's hardly any larger than what's posted here. Most of the code are in these three modules. I'm looking for some generic advice on this one, comments explaining the code, and my thoughts are added before each modu...

20:25
I'm voting to close this question as off-topic because it's about reviewing working code. It belongs on CodeReview. — Gert Arnold 24 secs ago
21:02
0
Q: Java Algorithm to Declutter Rectangles

mainstringargsI've been working on an algorithm to declutter rectangles. It seems to work fine when I have less than 1,000 rectangles, but becomes much slower when there are 10,000, which I believe to be because the algorithm is inefficient with large datasets. I'm looking to find ways to optimize to perform ...

21:16
0
Q: Common Sorting Algorithms

T145Here I've prepared my solutions for the following algorithms, and was curious if there were a way to optimize any of them. Any input is welcome and appreciated! using System; using System.Collections.Generic; using System.Linq; namespace algotest { class Program { static void In...

21:35
0
Q: Is there a more optimal way of removing objects from a list that don't match an ID from a list of ID's?

Jvalant DaveI have a list of objects with each of them having an ID. I have a second list that is just a list of media ID's. I want to remove the objects from the first list that don't match a mediaID contained in the second list. What is an efficient way of going about this? The only way I could think of wa...

22:06
1
Q: Asynchronous data loading helper

C.WilsonMy Company is beginning Asynchronous programming, the first step they've taken is to have a developer make this data loading helper. We primarily use WPF application's. They're using this code upon performing long running searches. I think it has contributed to our rise in application hangs, cras...

0
Q: What's the deal with font weights on this site?

einpoklumCR.SX is the only website on which font weights behave weirdly - for me (using Linux Mint 18.2 and Firefox 55): Some bold text: hello world. ... but it doesn't seem bold! It's the same weight as the rest of the text. Headings: Level 1 heading some code Level 2 heading some code Level 3 he...

22:39
0
Q: Programming reads from Adam Modules

MichaelI am working on a project to log data from a analog source and need to gather this information from an Adam 6017 unit. The question is how would I get this information into my program? I am planning on using Perl or Java and the Adam unit is connected by Ethernet.

This kind of question might be a good candidate for codereview.stackexchange.comMatt Holland 28 secs ago
"So it works, but it's not too pretty." - this sounds like it might be a better fit for code review. " How could this be cleaned up?" is kind of a broad question for SO. — Don't Panic 41 secs ago
0
Q: termios line editor for APL part 2

luser droogThis is the completely re-worked version of the APL line editor using termios raw mode. Earlier version. All switch constructs have been replaced with tables of function pointers to mirror the decoding of the UTF-8 character codes and vt2xx control sequences. Part of the reason for tables inste...

0
Q: Comparing unordered list in java

user1692342I want to compare two unordered list and currently I am doing it in the following way. Is there a better way to do this as I am repeating my code twice (for null check & then converting to a Set). Maybe there exists a library in Guava which does this? public class CompareUnorderedList implement...

23:17
0
Q: How to make horizontal resizeable on iframe and textarea

andri prasetiyahi I have a small problem when I make a try editor , it's make resizeable between iframe and textarea ... can you help me .. its my code ... #satu{ height:300px; height:200px; float:left; } #dua{ height:300px; height:200px; float:left; } #resize{ width:10px; float:left; height:200px; backgr...

@ata6502 - the question wouldn't get closed, it would get moved to codereview.stackexchange.com. It's a well written question but it might be better for that site. — dbc 39 secs ago
@ata6502 - the question wouldn't get deleted, it would get moved to codereview.stackexchange.com. It's a well written question but it might be better for that site. — dbc 26 secs ago
1
Q: Why 070 + 1 is 57 in java?

Miguel Pastorduring learning about java, I've come with a question, what happens if I put a 0 before an int and I add +1? I did 070+1 and got a 57 and I can't find why. The value that I get is completely different every time I change the 0x and cant see any coherence. int a = 070+1; System.out.print...

23:55
It seems that your code currently works, and you are looking to improve it. Generally these questions are too opinionated for this site, but you might find better luck at CodeReview.SE. Remember to read their requirements as they are a bit more strict than this site. — 4castle 21 secs ago
@CaptainObvious VTC no code, also no clue how to start.

« first day (1602 days earlier)      last day (2714 days later) »