Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

New answers tagged

2

Proposed Solution public static JObject ModifyDoubleIntegers(JObject source) { if (source == null) return null; var target = new JObject(source); var properties = target.DescendantsAndSelf().Where( x => x.Type == JTokenType.Float).Select(x => x.Parent).OfType<JProperty>(); foreach (var property in ...


2

I don't see a great deal to refine with this snippet -- good work. $ticker_stats["quote"], can be safely omitted from the isset() call because the subsequent checks on its subarrays will do the necessary work. Good work supplying multiple parameters to a single isset() call. I may be able to refine the following section, but would need realistic sample ...


3

The S3-functionality wraps the specific code, which does not change the variables. So how about a decorator? from functools import wraps def handle_s3_upload(fcn): @wraps(fcn) def inner(data_fp, data, *args, **kwargs): # handle S3 path s3 = False if data_fp.lower().startswith('s3://'): s3_data_fp = data_fp ...


8

This is how I see things... Throwing ArgumentException insinde a try/catch that at the same time swollows it is pointless. You use ArgumentException to inform the user that he called your API in a wrong way. This is not something one should hangle because he won't see it until he looks at the logs. The app should crash in this case. The message of the ...


2

The code can be slightly improved, but it won't make much of a difference overall. This whole approach seems a bit weird. Why does the JSON file exist in the first place? Here is the 'improved' version: <?php // read the json file on the server $txt = file_get_contents("json"); // get the id of the application $id = filter_input(INPUT_GET, "id", ...


1

Frame challenge I was trying to avoid "complexity", so get rid of 3rd part libs Although it's not strictly code review, I would like to start by challenging this goal. There are many many official Microsoft libraries with dependencies on Newtonsoft.Json. (See this answer on our software engineering sister site). Core code public static string ...


2

Review To be quick I will just add comments to the code with some alternatives // if you add to a built in prototype use Object.defineProperty or Object.defineProperties // using the default settings // Function.prototype.myCall = function(...args){ // use 2 parameters Function.prototype.myCall = function(name, ...args){ // var param = args.slice(1), /...


6

Welcome to Codereview, and welcome to Python! Your code looks good -- indentation is good, names are mostly good (but see below), docblock comments are mostly good (but see below). It seems like you need to "soak in" Python a bit, and you'll be up and running. Names Python's coding standard is PEP8 which for the purposes of naming can be simplified to: ...


Top 50 recent answers are included