I have an UpdateId class which represents some kind of version (like AssemblyVersion). UpdateId has three int values (listed in their compare priorities order): Year, ReleaseNumber and Revision.
How can I make my CompareTo method better? It looks clumpy to me.
public int CompareTo(object obj)
...
I have three collections: IEnumerable<Item> Data, then Item contains IEnumerable<Guid> Ids collection, and IList<Guid> agentIds in input
And the following algorithm
var agentReportItems = from data in Data
from id in data.Ids
...
@Liam I don't think this would fit on CodeReview, since it still has some example code in it. myFun1 and myFun2 will most likely trigger a close-vote for the same reason. Not to mention the foo, bar, getFoo and getBar. — Ismael Miguel18 secs ago
I've created an encryption using RSA, without Padding my function run well. But after using some padding like "OPENSSL_SSLV23_PADDING"my function didn't work well as usual.
Here's my simple RSA encryption function :
function EncryptDataUsingPublic($source){
$filename = "any_file.crt";
$...
Could a mod please tell here -> codereview.stackexchange.com/questions/38795/… to the user @Green what makes a good title? I would not be clear enough and he seemed a little annoyed so a soft touch is needed.
This is my java code for an console calculator. I just want to know if it can be improved in any way
import java.util.Scanner;
public class Algorithm1 {
public static int FirstNumber, SecondNumber;
public static float TheAnswer;
public static String Action;
public static Scanner ScanInt1, ...
@GreenAsJade Titles are meant to describe what the code does, instead of what you want to ask. Currently, your title is poor. — Ismael Miguel49 secs ago
Community moderator elections on the Stack Exchange network are really exciting.
Alas, on the page of the primaries,
I find it mildly annoying that candidates are randomly reordered on every page load,
even if it's surely for a good reason.
So I cooked up (pun totally intended) this script using...
Visiting my list of sugested edits, I've noticed that I xould have a perfect score (100% approval), if it wasn't @200_success rejecting 1 edit that was approved here on chat... :/
@Huey CodeReview only works on full code, and not example code. This question doesn't have enough code to be on-topic there. — Ismael Miguel49 secs ago
@lhf It's just you. "How do I make it so the values transfer over to the first function?" sounds like a re-design request, which doesn't seem to be on-topic on CodeReview. — Ismael Miguel31 secs ago
@lhf It's just you. "How do I make it so the values transfer over to the first function?" sounds like a re-design request, which doesn't seem to be on-topic on CodeReview. — Ismael Miguel43 secs ago
I have three collections: IEnumerable<Item> Data, then Item contains IEnumerable<Guid> Ids collection, and IList<Guid> agentIds in input
And the following algorithm
var agentReportItems = from data in Data
from id in data.Ids
...
Does your code work? If no then describe the problem and what it is doing. If the code does work then what is the problem? There are other sites (perhaps codereview.stackexchange.com) that may be more suitable. — AdrianHHH10 secs ago
That's why I am asking ..... because I think people are misinterpreting the text.
@Morwenn - FYI - posts that are absolute crap like skldj; asekdfh a;skoiashdnv a;wehg, but are not spam, should be flagged as "Rude or Abusive" - it is considered abusing the system.
spam and abusive flags both have the effect of deelting the post after 6 flags, and -1-ing it at the same time. Spam also goes further and affects the spam management tools.
I have three collections:
IEnumerable<Item> Data
the Item in the above Data contains an inner IEnumerable<Guid> Ids collection
there is an input collection IList<Guid> agentIds which contains Agents that need to be found.
The following algorithm is what I use to find data items handled by the...
Really, I am not complaining, the flag system is complex, and no-one knows how they all work, or when to use them (myself included), so when I can help educate, I do.
@rolfl while you are here ;-) I would like to ask instead of doing it, if I "flag for moderator" a chat message, is there a step between (a window for the type of flag) like if I flag a answer/question ?
You might want to consider posting this on the code review SE site. This seems to be better suited over there. — Mike Bantegui46 secs ago
@MikeBantegui I am not asking for somone to propose better code. The actual question, is what the value the block size should be. I mean the question is about the parameter that the code uses. Is the code review SE for that? — gsamaras53 secs ago
I have written a simple hangman game in java. It randomly gets a word from an array of Strings. It prints out '_' char for every letter of the word, displays the ones you have already guessed and displays the ones you have missed.
Some advice would be welcome, what should I change, avoid and so ...
I have to create TCP service with TCPListener to handle multiple client. At a time 2000 client can connect with our service through their devices. Can someone please provide good example or article where I can find best way to implement that. I gone through multiple forum but confused in multiple...
I have three collections:
IEnumerable<Item> Data
the Item in the above Data contains an inner IEnumerable<Guid> Ids collection
there is an input collection IList<Guid> agentIds which contains Agents that need to be found.
The following algorithm is what I use to find data items handled by the...
Here is my code for printf() implementation in C. Please share your thoughts for improvements.
#define PRINTCHAR(c) putchar(c)
#define MAXLEN 256
// Write a printf function which simulates printf() in C.
int formatAndPrintString(char *pcFmt, va_list lList)
{
//Holds the number of characters...
Though there are assurances that PHP will always interpret integers as integers (and never as strings) - I am having a hard time convincing PHP this fundamental aspect of its nature.
I have an SQL query which returns an array of ints
SELECT day, MAX(countoftime)
FROM (SELECT FK_Hour, day A...
I tried to implement a generic stack in C using void pointers and tried to keep it as simple as possible by delegating all responsibility to the caller of the functions and avoiding more sophisticated approaches. Here are the three files:
stack.h
#ifndef STACK_H
#define STACK_H
#include <stdbo...
Unit testing the rubberduck refactorings, inspections and quick-fixes has been pretty much impossible, at least until a MockFactory was implemented, to do things like this:
internal static Mock<CodeModule> CreateCodeModuleMock(string code)
{
var lines = code.Split(new[] {Environment.NewLine}...
Rubberduck is an addin for the VBA IDE. The main showstopper for proper unit testing of most functionalities was the coupling with the VBIDE API, which exposes everything our addin is working with. From windows to toolbars and code panes. So yeah, in this case the API is that of an IDE. The VBIDE extensibility API.
In addition, this is not the best stackexchange site for this question. It should be migrated to codereview. — puzzlepiece871 min ago
@roryap This does not belong on Programmers, and contains hypothetical code which makes it explicitly off-topic on Code Review. Also, could you please tell me what exactly makes it off-topic for Stack Overflow? — Simon André Forsberg10 secs ago
I have had a hard time understanding all the documentation on the logger module and forking processes.
My goal, is to have each child process that's worked to write to their own separate log file.
Here's what I have and it seems to work but I just want to try and verify that this is the correct...
Found a custom function called UniqueItems() to use and then developed by own RemoveDups() and FaxesToUse() code:
Function UniqueItems(ArrayIn, Optional Count As Variant) As Variant
' Accepts an array or range as input
' If Count = True or is missing, the function returns the number of uni...
I am trying to refactor a switch statement that is like this:
private void Validate(DataTypeEnum dataType, object value, ...)
{
switch(dataType)
{
case DataTypeEnum.Number:
//Validation
break;
case DataTypeEnum.Decimal:
//Validation
...
So I have to write a program that reads numbers, finds the largest number, and tells the user how frequently it appears. The program also needs to stop once it reads 0, but I'm having trouble with that.
So far if I input it prints max as 0 every time. The frequency also gets screwed up sometimes...
I'm afraid this question does not match what this site is about. Code Review is about improving existing, working code. Code Review is not the site to ask for help in fixing or changing what your code does. Once the code does what you want, we would love to help you do the same thing in a cleaner way! Please see our help center for more information. — Quill8 mins ago
Sorry, I guess it is kind of a code review isn't it? Thanks for the information, I didn't realize that about Events. The timestamps are necessary because the analysis uses data for a certain period before the analysis is run, so this way I can set a number of reports to run at once (e.g. run a report one hour from now, one day from now, etc.). I'll definitely look into using a priority queue, so thank you! — echolocation44 secs ago
I've got the following schema, which can not be modified since it's a problem taken from an exam:
Player
-------
player_id (PK)
player_name
player_games_total
player_games_won
Competition
-----------
comp_id (PK)
comp_player1 (FK references Player.player_id, NOT NULL)
comp_player2 (FK r...
I created a widget to handle multiple selections in CoffeeScript. There's a working attached snippet that uses the compiled JavaScript (StackExchange snippets don't support CoffeeScript), which is available to see. There are two classes: DocList and Doc (I didn't use Document fearing a name clash...
I'm not sure to understand the whole idea, but questions sounding like "Can I do this another way" or "Is there a better way" should be ask on code review — Brewal10 secs ago
This question is probably a better fit for codereview.stackexchange.com. StackOverflow is for when you need help with bugs; CodeReview.SE is for when you've finished writing your code and want general feedback. — Michael0x2a24 secs ago
Here is the slow part of my code
def Prepare_WCfst_file():
content_WCfst = "iteration\tlocus\tFromSite\tToSite\tWCFst\n"
nbchunks = nbsites/nbsitesChunk
if nbchunks%1 != 0:
print("\n\nThe number of sites per chunk for WCFst is not a divisor of the number of sites per locus.\n...
would be hugely appreciative if some Front end masters would have a look at the HTML/CSS/JS (well there is very little JS at the moment) here: https://github.com/eurolife/esc-legal and give me some feedback as to how my code looks to you, what level of skills it looks like I have and how I can im...
The following working code targets SQL-Server 2012 and I have distilled the actual problem into a manageable scenario with the code example shown below also presented on SQL Fiddle.
I seek feedback on best practices on using CTE's and temp tables and am wondering if the following could be strea...
Does anyone have any pointers how to improve the code below to make it compliant with Command Query Separation principle
Thanks.
P.S. Just to make it clear, I treat the if conditions in this code as queries and list modifications as commands
public List<string> GetTreeCaptions(Tree root, bool ...
@Jamal doesn't the time spent reformatting the post also garner a +1 vote that the post is is now clear to the reader ? It confuses me that one would take the time to edit the post but not infer why they edited it; at least with a vote. — OmegaMan1 min ago
I was trying this problem and I was wondering if there is a way to check for the edge cases inside the for-loop. Here I am starting the loop from index 1 as I need to look back and I don't want an ArrayIndexOutOfBounds exception. The same applies for the end edge case where I need to look the fol...
I implemented search module, but I'm novice in programming and I'm not sure about public and private functions that I coded. Did I do right?
var data = require('./data');
function My_module(string) {
var data_size_ = data.length;
/**
* @param {Array.<Object>} data.
* @return...
I have just created the minesweeper tag and the rock-paper-scissors tag.
The reasoning for this was:
Rock Paper Scissors (Lizard Spock) is popular enough to deserve its own tag. (37 questions seem to be applicable for it)
Minesweeper has seen some questions (posted by me) not directly related ...
On the places I've worked, I've often been asked about how long I worked for some things. In many cases I'm also asked to give a rough estimate on how many hours I expect something to take (I hate that part)
@SimonAndréForsberg I just make stuff up when they ask for estimates. Usually the default answer is t = t + 1 or z = z^2 + c if I am feeling particularly froggy.
@SimonAndréForsberg I used the mandelbrot one on the president of the company, then I drew the formula on the board and the picture to go with it. Needless to say he doesn't ask me for much anymore. :)
This looks like a question for Code Review. Where they will probably point out that you've forgotten to do SQLConn.Dispose(). — Andrew Morton36 secs ago
Some time ago a posted a simple Python script: Triangled printing. It contained an example of the desired output, worked and was in my opinion fully on-topic. It still got two down votes, so what was wrong with that? Were the down votes just miss-clicks or maybe the question was just plain boring...
I'm learning on codeacademy and I was trying to print the following:
def trip_cost(p, d, m):
return rental_car_cost(d) + hotel_cost(d) + plane_ride_cost(p) + m
print "%s to %s for %s days with an extra %s dollars of spending mone" (trip_cost(p, d, m), p, d, m)
The porgram was telling me nothin...
I've read up quite a bit about the STV system, even implemented it myself and my suggestion is: Use all three choices. You have nothing to lose. The STV system is really clever.