« first day (1456 days earlier)   

12:00 AM
RELOAD! There are 3794 unanswered questions (91.3466% answered)
 
12:11 AM
0
Q: LINQ Understanding

IvenBachI'm going through C# Operators which led me to more specifically Lambda Expressions (C# Programming Guide). I've modified one of the examples from just getting the .Count to printing out the odd numbers. Is there anything I can do to simplify my code? Should I "method chain" oddNumbers and oddDes...

 
 
1 hour later…
1:11 AM
0
Q: Height of a general tree in C++

A userI need to calculate the height of an optional (not AVL, binary) tree. For input I receive an n integer positive number: parent(0), parent(1), ... parent(n-1). Here, parent(i) is a parent of node i. If parent(i) == -1, that i is the root of the tree. It is guaranteed that the sequence has only one...

 
 
3 hours later…
4:21 AM
0
Q: Python Random Book Parser

esoteI have made the following program to gather data on random books from Goodreads, via their random books feature. import requests import re URL = "https://www.goodreads.com/book/random" while True: html_text = requests.get(URL).text # Rating Count bg_rating_count = html_text....

1
Q: Shuffling blocks of ints in an array

AaronThe shuffle method in ShuffleMethods.java takes an array of ints and shuffles them by blocks of ints in another array. So for example, if we had an array of ints called nums comprising of 0,1,2,3,4,5 and a block of ints of 2,1,3. The method reads the first element of the blocks array which is 2. ...

 
 
1 hour later…
5:34 AM
0
Q: Adding multiple flags to items in a game

majidarifIs there a way I can improve this without changing the current i values (0x00, 0x01, 0x10, 0x11). Maybe by using bit-wise operators? var i uint8 = 0x00 // not droppable and not special if item[w].IsDroppable { i = 0x01 // droppable } if item[w].IsFeatured { i = 0x10 // special } if item[...

 
 
1 hour later…
7:04 AM
0
Q: Optimizing C# to C++ function call that fills and auto resize array if size is not enough

ProgrammerI have a C# function that calls a C++ function. It's job is to call the C++ function and fill the array from C++. This will be used with a camera to fill pixel array to the array that is passed in the function. This is better than allocation memory on the C++ side and marshaling it on C# side e...

0
Q: Codeigniter/php/mysql on insert update other tables depending radio button selected

Fredrick Boazi need a little Codeigniter/php/Mysql help, i have 3 mysql tables, item, batch and transactions. in transactions i have a column transaction_type which in my code i have 4 radio buttons: Incoming, Outgoing, Damaged and Expired. i also have a column quantity in transaction, batch and Items tables,...

 
7:42 AM
-3
Q: Need an antivirus script

B.SoDI want an antivirus script in Python. I have been studying Python 3 for some weeks. With my current knowledge, I am unable to create one.

 
7:52 AM
Hm. Link only answer. Flag? Downvote? Comment? Scream at user?
 
8:02 AM
Monking
@Zeta I guess flag would be better
 
8:17 AM
@CaptainObvious HAMMERTIME!
@Zeta All 3.
 
0
Q: Coding Practices and Improvements

Timothy Soon Yu FengI'm a young coder who is looking to improve in my coding practices because I was told by my supervisor to look into a more healthier method to code. What I would like to ask is how can I improve my coding structures? for example is using a whole crap ton of bool to check for conditions considere...

 
8:35 AM
1
Q: Simon Game in JavaScript

YiyoI've made a JavaScript, HTML and CSS version of the memory game 'Simon' from the 70s. The design of the board is not too impressive (I wanted to focus first on the JavaScript part) but I also appreciate feedback on it of course. If you want to see the game already in action, it's available here. ...

 
8:48 AM
Monking humans
 
9:02 AM
Well, I've spent some time, but it's worth it hehe
 
9:23 AM
-1
Q: Function inside an action and use of global variable

AlbertIn yii2 I created an action and one function inside that action and recursively calling that function till $balance become lesser than 3. I'am getting output what i expected. (onutput = 1) Can anyone help me to review my code 1) usage of global variable and 2) using function inside an action p...

 
9:48 AM
0
Q: Retrieving database values through properties

Kostas K.I have a “Settings” table which I make frequent DlookUp calls to retrieve values. So I thought instead of having to write Nz(DLookup("FieldName", "TableName", "Condition"), vbNullString) everytime I needed the value, why not wrap it in a property in a standard module. Public Property Get ActiveK...

 
10:01 AM
1
Q: Learning Python and hoping for useful feedback

Bernardo AraujoCode objective: Read a txt file, parse it into a matrix and count (and also print) the number of unique "islands" in the map formed by the matrix. 0 = Sea; 1 = Land; Islands are orthogonal groups of land. testfile.txt : 5 9 00000 00010 10000 01101 10000 00100 01001 10010 01101 Python code: ...

 
10:25 AM
-1
Q: ES6: Why is the use of setTimeout() now considered bad practice?

kimmikI have been using the following javascript code snippet for years to invoke a wait ... until delay. Typically while another asynchronous action is happening (eg another script loading, ajax fetch, image). It still works in ES6 but I have been told that this is now bad practice and that I should b...

 
10:38 AM
Monking
 
0
Q: Average value for each row

work questionI have below classes: public class DelayReason { public virtual ICollection<WorkOrder> WorkOrders { get; set; } } public class WorkOrder { public virtual ICollection<DelayReason> DelayReasons { get; set; } //other fields } each DelayReason has 0..* WorkOrders and it's the same for W...

-2
Q: Sum the number when the element in list in list is same

ray8693aList=[['Apple',2],['Orange',3],['Apple',2],['Orange',5]] How to add the number together when the element in the list in list is the same? The sample output like below. bList=[['Apple',4],['Orange',8]] Can i do it without import any library from python?

 
11:05 AM
possible answer invalidation by le_m on question by Yiyo: codereview.stackexchange.com/posts/162096/revisions
 
11:18 AM
@CaptainObvious One more VTC for hypothetical.
@Duga Fixes something that wasn't mentioned yet, so OK.
 
-2
Q: Is this the best way to find the vectors of shortest strings?

Smitpublic static Vector<String> q(Vector<String> b){ Vector<String> a = new Vector<String>(); int small = b.get(0).length(); for(int i=0; i<b.size(); i++) { if(small > b.get(i).length()){ small = b.get(i).length(); } } ...

 
11:40 AM
0
Q: Command line blackjack Revised

SeitroxThis is my Revised Command line Blackjack Code. I tried to use as much suggestions as possible and ended up with this Code. I also uploaded the Project to github if someone is interested. The Dealer is now a bit smarter. The game now uses a card stack of 5 decks(which is easy to change), which i...

 
12:31 PM
0
Q: Optimising list comprehension in Python

user1286695I have list of tuples like so: lst = [(106, 210, 108, 134, 134), (106, 210, 108, 134, 210), (106, 210, 108, 168, 268), (106, 210, 108, 168, 671), ...] I need to only keep the tuples that contain: keep = (106, 210, 108, 168) Which I am currently doing using this s...

 
@Zeta @Mast Post was edited and I undeleted it. Please check the answer again and vote accordingly.
-2
A: Reinforcement learning example (chap. 1) from Sutton's book

Mohan Radhakrishnangameplanrevised :: (String -> IO()) ->( IOArray Int Double) -> BoardState -> BoardState -> IO (IOArray Int Double,BoardState,Double) gameplanrevised log a state newstate = do exploremove a state newstate where explore...

 
12:59 PM
@SimonForsberg Thanks for the update.
 
@SimonForsberg Thanks for the update too (although I didn't vote :D).
Urgh. I remember now why I didn't review that code. My ±0 stays ±0 :/.
 
I don't know Haskell a lot, but that answer shows some serious indentation issues...
 
1:20 PM
@holroy it shows a systematic misunderstanding of how haskell should be programmed ...
It makes no sense to encapsulate that amount of work into a single do block..
 
So, it's beginner code in Haskell/Lisp doing machine learning?
How did a beginner manage to get it to work?
 
@Mast Same way we all do: trial and error. ;)
5
 
True.
 
And it is now the accepted answer, aka the example for all who stumbles upon that question...
 
@holroy Feel free to write a better one :P
 
1:25 PM
HeHe... I really don't know enough Haskell, but given the statements earlier on here, it seems that there should really be a better answer than this one.
 
There most certainly is.
 
@Vogel612, are you up for writing a better answer?
 
the problem is: the original code does it significantly better and the answer isn't really up for review....
 
So write a better answer to the question and make sure it gets uprooted over the accepted one. :P
 
0
Q: Command line blackjack Revised

SeitroxThis is my Revised Command line Blackjack Code. I tried to use as much suggestions as possible and ended up with this Code. I also uploaded the Project to github if someone is interested. The Dealer is now a bit smarter. The game now uses a card stack of 5 decks(which is easy to change), which i...

 
1:31 PM
@Seitrox Be patient.
 
yeah i know, just thought i'd put it here ^^
 
@Vogel612 Then say so, and comment upon the good quality on the question. I'll gladly upvote such an answer. Most of our answers are not cheering enough for good quality code in the original question, as we rip the original question apart... :-/
 
@Vogel612 Since its a self answered question, I suspect that there were bugs in the original gameLoop which are now fixed by the new... thing.
 
Are you indicating that the original post is broken code?
 
@holroy To quote the OP: "My code compiles and prints the result, so trivial bugs aren't there, I think. But gameplan, my largest function, could have a bug or two, but I'm not sure."
 
1:41 PM
Hmm... he says in the answer that the original code is "error prone"...
 
@holroy Yes, but original posts don't need to be error free to get reviewed. They must be error free to the best knowledge of the questioner. It took Mohan almost a month to come up with a revision, so those "bugs" (if they exist) don't seem too trivial.
 
That is a strange question and answer combo, which I don't know what to suggest how to handle. Parts of me just wants to ignore the entire thingy, and let if fade away, and parts of me would like to either close the question as broken code or possibly get the answer to be a new post where some Haskell guys could properly review the badness of it.
 
Omking
Nobody will notice if your Haskell code has a bug in it :P
 
oh wow i didnt notice that there was a bot that autopost the questions here. Sorry for reposting
 
@holroy It's a self-answered question. But I think I found a diplomatic way.
 
1:47 PM
Looks like a good comment...
 
@skiwi Yeah, we know.
3
 
Especially combined with the comment by Mast regarding how this answer is not a really good review of the original question.
 
@holroy Technically, Mast targeted this revision (LOA/NAA).
 
@Zeta Starred! B O O M
2
:))))
 
@Zeta But if you want to see another, almost realistic portrayal of a Haskeller, have a look at "How to Kill the Dragon" (in case you didn't come across yet).
 
2:51 PM
-1
Q: C# performance loop Datagridview vs List<>

marjesI am inserting a lot of data continuously and in real time to a datagridview, and sometimes this data is repeated so I am trying to perform a kind of filter, for this I would have to ask if the column A B C have no match in my stored data. my table is like this +--------+--------+--------+------...

0
Q: In memory caching management in node.js

user746458I have implemented a simple class for managing in memory caching. I have written 2 classes, 1 for adding cache and 1 for getting cache. Can anyone please review code for adding cache? The code is:- class cache_add_manager { constructor() { this.data_type_memory_size = { ...

0
Q: Pomodoro timer module

iccomqso i have been learning javascript for some time and have just finished my first piece of code that not only actually does something, but is also longer than a few lines of code. It most likely is pretty terrible though (but works!). I would appreciate any help, insight or/and pointers. General...

 
Welcome @iccomq. You don't have enough reputation to talk yet. This is the Code Review general chat. Did you have a question about our site? We also have a Code Review Meta. If you're wondering what's going on here, have a look at the chat FAQ.
 
3:30 PM
2
Q: Mergesort vs Quicksort Timing in Python

Alpha BravoI have implemented Mergesort and Quicksort in Python and have noticed that Quicksort runs two times as fast as Mergesort. Is this a property of the algorithm or is Mergesort coded inefficiently? Are there any other suggestions? (I am aware that the timing includes the creation of the random list...

0
Q: RSVP.hash replacement using ES6 Promise

MikeWe have a pretty big code base that made use of RSVP which we are moving to node 4.3.2+. The only RSVP feature we use frequently that's not in the native js Promise api is the hash() function. I expected to either use the RSVP source or find something on stack overflow. Most people appear to be b...

 
4:06 PM
1
Q: An Image Downloader for a website

Salah EddineI'm still learning and this is my code and I'm happy about it after a lot of struggle, this code take a web site and download all images in the webpage (jpg images) and this code support only website that has the element and src contains a jpg link; Here's the code( tested in https://pixabay.co...

 
4:57 PM
0
Q: Model of DMA controller in SMV

Dj DacI wrote a model of a DMA controller (but it might be incomplete) in SMV. MODULE DMA (proc, DMAmemAddress, UART2DMA) VAR address : 0..7; control : unsigned word [ 64 ]; ASSIGN init(control) := 0ud64_31; next (address) := case proc = setDMAaddress : DMAmemAddre...

 
5:22 PM
0
Q: Script to temporarily drop admin privilages

MiheerDescription The aim of my project is to allow administrators to drop privileges for reasons of self-control. Currently, it works only on MacOS Sierra but the concept should be extensible to any Unix compatible system. The sudoers mechanism is the workhorse. By adding a file in sudoers.d/ the ad...

0
Q: Tensorflow implementation of the Thomson model

HookedI've implemented the Thomson model in Tensorflow and it seems to work very well. I'm repeating some computation by computing the other half of the symmetric distance matrix. I think, for a GPU based approach (though I may be wrong), the savings from a vectorized computation is worth the doubling ...

 

« first day (1456 days earlier)