Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Activity for ajv
Type | On... | Excerpt | Status | Date |
---|---|---|---|---|
Question | — |
How do I get something similar to dictionary views, but for sequences? The dictionary methods .keys(), .values(), and .items() all return view objects. Said objects reflect any changes to the underlying dictionary. This is often useful. Is there a way to get such a view on sequences such as lists? For example, a slice-like object that, instead of copying part of a se... (more) |
— | about 1 year ago |
Question | — |
What is malloc's standard-defined behavior with respect to the amount of memory it allocates? I recently told a friend that `malloc(n)` allocates and returns a pointer to a block of at least N bytes of memory, as opposed to exactly N; that it is allowed to allocate 'extra' memory to meet e.g. alignment requirements. He asked what the C standard had to say about this behaviour. I wasn't sur... (more) |
— | over 2 years ago |
Answer | — |
A: Fixing vertical discrepancies with CSS I'm not familiar with Drupal, but I would do this with CSS Grid. One possible example looks like this: ```html .menu-container { display: grid; grid-template-columns: repeat(3, 1fr); } .menu-container > { border: 1px; border-style: solid; } ... (more) |
— | over 2 years ago |
Question | — |
How do I support tab completion in a python CLI program? I spend a lot of time writing CLI tools in Python, and I would like to support tab-completion in a style similar to Git. For example, subcommands should be tab-completable, options should expand based on the valid choices, and filenames should complete based on the types of files the program supports... (more) |
— | over 2 years ago |
Question | — |
Is it dangerous to use json.loads on untrusted data? I manage a wsgi application that accepts JSON data via POST from potentially untrusted sources. Normally it is treated as a text blob and never parsed, but there is a value in the expected input that I would like to log. The obvious way to do it looks like this (where `payload` is the untrusted in... (more) |
— | over 2 years ago |
Question | — |
How do I ask git-show-branch to display a commit range? For some tasks, I find `git show-branch` easier to follow than `git log`. For example, inspecting the history on someone's PR before merging it. `git show-branch master topic` stops at the first common ancestor, which is usually not what I want. Usually I want to display the same commits that wo... (more) |
— | over 2 years ago |
Question | — |
How do I redact values when Save()ing a yaml structure with YamlDotNet? I handle several projects that use yaml files for configuration, and load them with YamlDotNet. It is sometimes useful to log the effective configuration when the program starts, to aid future debugging. The obvious way to do this is to call `Save()` right after `Load()`, but that leaves sensitive... (more) |
— | over 2 years ago |
Question | — |
How do I get the error message out of a requests exception? I'm trying to log error messages from Requests exceptions. Example: ```python try: makewebrequest() except RequestException as ex: logging.error(ex) ``` Example output: ``` ERROR : ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer')) ``` ...okay, t... (more) |
— | almost 3 years ago |
Question | — |
How do I configure log4net from an arbitrary data structure? I'm used to working in Python, but my current project is in C#/.NET and uses log4net for logging. Out of the box, log4net uses an XML file for configuration. I dislike XML and want to use something else -- possibly JSON or YAML. In Python I would do this by loading a dictionary with certain keys f... (more) |
— | about 3 years ago |
Question | — |
How do I customize merge behavior for a shared git repo? I often find it useful to arrange things so that each commit on master's first-parent is a discrete change. It allows `git log --first-parent --oneline` to be used as a concise, automatically-generated changelog. There are various ways this can get screwed up. The one I'm most aware of arises from... (more) |
— | over 3 years ago |
Question | — |
What options can be set via swing.properties? The default Swing look and feel can be set in `$JAVAHOME/conf/swing.properties` What else can be set in this file? I can't find any other documentation of it. (more) |
— | over 3 years ago |
Question | — |
How are integers interpreted in contexts that expect a date? I found a confusing construction in several stored procs in an MS SQL 2008 R2 database: ``` DATEADD(dd, 0, DATEDIFF(dd, 0, somedate)) ``` As I understand it, these are the relevant function signatures: ``` DATEDIFF(datepart, startdate, enddate) DATEADD(datepart, number, date) ``` Tha... (more) |
— | over 3 years ago |
Answer | — |
A: Different behavior with relative imports when using flask vs py I don't have a `py` command on my system; for purposes of this answer I assume it's an alias to the python executable. Running a script from a file is not quite the same as importing it. A script given on the command line doesn't know it's a package (`package` is not set). That's why relative impo... (more) |
— | over 3 years ago |