Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »

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
Edit Post #288034 Initial revision over 1 year ago
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)
over 1 year ago
Edit Post #285350 Initial revision almost 3 years 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)
almost 3 years ago
Edit Post #284812 Initial revision about 3 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)
about 3 years ago
Edit Post #284708 Initial revision about 3 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)
about 3 years ago
Edit Post #284628 Initial revision about 3 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)
about 3 years ago
Comment Post #283672 `git show-branch master topic^` is how I eventually dealt with the case I was facing, but as you say, that has its own issues. I do use `git log --oneline --graph --boundary master...topic` a lot, and that's often good enough, but for nontrivial histories it's hard to visually pick out which commits ...
(more)
about 3 years ago
Edit Post #283670 Post edited:
about 3 years ago
Edit Post #283670 Post edited:
Add clarification
about 3 years ago
Comment Post #283672 After experimenting a bit, it looks like I only run into a problem if the tip of one branch is a merge of the other. e.g. consider a history like this: ``` master *---*---A---B---* \ \ topic a---b---c---* ``` If I then do `git show-branch master topic`, it do...
(more)
about 3 years ago
Comment Post #283672 I did see --more, but I don't think it suits this use case. I'm not looking for 10 or 30 or 100 additional commits; I'm looking for "however many are needed to cover all commits that differ between the branches."
(more)
about 3 years ago
Edit Post #283670 Initial revision about 3 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)
about 3 years ago
Edit Post #283247 Initial revision over 3 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 3 years ago
Edit Post #281596 Initial revision over 3 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)
over 3 years ago
Comment Post #281160 Thanks. Not quite the answer I *wanted*, but exactly what I asked for.
(more)
over 3 years ago
Edit Post #281159 Post edited:
over 3 years ago
Edit Post #281159 Post edited:
over 3 years ago
Comment Post #281159 Edited for clarity and I'll add an example in a moment.
(more)
over 3 years ago
Edit Post #281159 Post edited:
over 3 years ago
Edit Post #281159 Post edited:
over 3 years ago
Comment Post #281159 YAML is my favored format, yes, but an ideal solution would be file-format-agnostic. E.g. python's dictconfig doesn't care what kind of file (if any) your input dict came from, as long as it has the right keys.
(more)
over 3 years ago
Edit Post #281159 Initial revision over 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)
over 3 years ago
Edit Post #277862 Initial revision about 4 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)
about 4 years ago
Edit Post #277519 Initial revision about 4 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)
about 4 years ago
Comment Post #277485 Thanks. That makes sense, though the choice of method still seems crazy to me. I would think it would be simpler -- and definitely clearer -- to cast it to date and then cast back to DT. (or just...not cast it back and use the date as is. The difference wasn't important in-context)
(more)
about 4 years ago
Edit Post #277474 Initial revision about 4 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)
about 4 years ago
Edit Post #277211 Post edited:
over 4 years ago
Edit Post #277211 Initial revision over 4 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 4 years ago