StackOverflow.com

VN:F [1.9.22_1171]
Rating: 8.5/10 (13 votes cast)

Random snippets of all sorts of code, mixed with a selection of help and advice.

How to achieve the same effect as clearRect with fill?

23 January 2026 @ 6:17 pm

I have 2 canvases - 1 on top of the other, the top one overlaying some effects on the bottom one. If I want to clear what's on the top layer I can use clearRect and what's on the bottom canvas just shows through. But sometimes I need to achieve the same effect with a non-rectangular shape. Everywhere I look the info says that clearRect sets the pixels to transparent black. But it can't do. If I use fillStyle = "rgba(0 0 0 0)" it doesn't do anything. To be clear, in the real code I use beginPath(), lineTo() ... closePath(), fill() but the test below is just to illustrate the issue. What fillStyle do I use to achieve the same effect as clearRect? <!DOCTYPE html> <html> <body style="height:100%; display:block; overflow: hidden"> <canvas id="canv" style="width:100%; height:100%; position:absolute; z-index:1"></canvas> <canvas id="canv2" style="width:100%; h

AutoCad ObjectArx VB.Net sub-routine to Insert a Block Reference into ModelSpace is not working

23 January 2026 @ 6:13 pm

The following function is called as shown. The "CIRCUIT" Block exists. The returned Block Handle is a reasonable (4) digit Hex value and allows a move to new layer. The new Circuit does not appear on the page and when opened has no attributes. The actual "CIRCUIT" block has 29 attributes. It is Block gone when the DWG file is saved and reopened. 'Setup the Function Call Dim naInsPnt3D As New Point3d(0, 0, 0) 'set a location at the start of the polyline Dim sHandle As String = fInsertBlock("CIRCUIT", naInsPnt3D) 'go insert the new Circuit and return the new handle 'The Function Public Shared Function fInsertBlock(ByVal sBlockName As String, ByVal naInsPnt3D As Point3d) As String 'Block Name Is one of the custom blocks for PVcDes 'naInsPnt3D Is the location in ModelSpace to drop the block 'returns the block handle fInsertBlock = "

Flutter CarouselView.weighted empty space

23 January 2026 @ 6:07 pm

I am currently trying to replicate the look of the HorizontalCenteredHeroCarousel from native android jetpack compose. The problem that I am facing right now is, that when I scroll to the end of the flutter CarouselView.weighted (which is the recommended way to archive this), I get a dead space which would normally display another item. But since I am already at the end of the list it has nothing to display and leaves the space empty. Is there a way to resolve this? CarouselView.weighted( flexWeights: [5, 1, 1], enableSplash: false, itemSnapping: true, children: meal.images.map( (image) => Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(24), ), clipBehavior: Clip.antiAlias, child: _MealImage(image: image), ), ).toList(), ) How the ca

Pharmacode and ocr [closed]

23 January 2026 @ 6:03 pm

I need person make developed of any industrial camera to detect OCR,OCV and pharmacode and 21CFR I need person make developed of any industrial camera to detect OCR,OCV and pharmacode and 21CFR

Why is async code sometimes slower than synchronous code in Python / JavaScript?

23 January 2026 @ 6:00 pm

async / await is often described as a way to make applications faster or more scalable, especially for I/O-bound workloads. In theory this makes sense, but in real systems I’ve repeatedly observed cases where introducing async actually makes performance worse. For example, compared to a synchronous implementation, the async version can show higher CPU usage, lower throughput under load, and worse tail latency, even when there are no obvious blocking calls or mistakes like using time.sleep() or synchronous database drivers. This has happened in scenarios that are usually presented as good fits for async, such as web APIs handling many concurrent requests + background task processing or services that spend a lot of time waiting on external APIs. I’m trying to understand where the performance penalty comes from and how to reason about it before committing to an async design. Some specific points of confusion:

Howto execute ansible one host group at a time?

23 January 2026 @ 5:50 pm

I have a problem with Ansible 2.16.3(and can't perform upgrade to newer version in an easy way) I didn't expect to face. I have a playbook I need to execute on multiple host groups but only one host group(HG) at a time(dependencies between services). - Hosts in HG2(50 hosts) can be executed after all hosts in HG1(20) finished. - Hosts in HG3(600 hosts) can be executed after all hosts in HG2(50 hosts) finished. I have ANSIBLE_FORKS set to 300 (infra limit). It would be good keep it due to total number of hosts that must be handled. Problem: ANSIBLE_FORKS allows execution of HG1 and HG2 and part of HG3 in parallel to match total 300. Things explored: - keyword serial but see no option to limit to "one HG at a time up to limit ANSIBLE_FORKS". - --limit CLI parameter - doesn't seem to work. - keyword delegate - works for one host only - import_task but by the t

Django-axes seems to ignore ipware settings behind Nginx

23 January 2026 @ 5:50 pm

I'm struggling to set up my django-axes behind Nginx reverse proxy to take the HTTP_X_FORWARDED_FOR instead REMOTE_ADDR. I've tried all three variations as outlined here: https://django-axes.readthedocs.io/en/latest/4_configuration.html. I've tried setting the ipware fields in isolation as well as in combinations. Left-most and right-most also didn't make any difference., ip_address from Axes' attempts was always populated with REMOTE_ADDR. I'm 100% sure that request.META contains both HTTP_X_FORWARDED_FOR as well as REMOTE_ADDR. I checked this by inserting a debugging middleware in front of axes. My logs show that both values are valid and I can manipulate the IP logged by Axes by modifying REMOTE_ADDR in my middleware: class OverwriteRemoteAddrMiddleware: def __init__(self, get_response): self.get_response = get_response def __call__(self

How can I add a number only once, and not continually?

23 January 2026 @ 5:21 pm

I'm very new to coding, I'm creating a peggle style game and I want to make a score system that when I hit some balls, each ball has its respective score and those points are added to a general points, because it's round based and if I reach certain points in that round, I get an extra ball. Can someone help me? I would be very thankful - I don't know what to do. I need to say more things to post and I don't know how I can explain this in more detail; it looks like a very simple thing to do. void Update() { Ballcounter.text = Scriptholder.balls.ToString(); NewBall(); //if (ballcollision.roundpoints >= 750 && extraball = true) // { // Scriptholder.balls += 1; // extraball = false; // } } void NewBall() { if (Scriptholder.balls <= 2) { Ballcounter.color = Color.red; } else if (Scriptholder.balls >= 2) { Ballcounter.color = Color.green; } if (ballcollision.roundpoi

NamedEntityGraph with Graalvm

23 January 2026 @ 12:51 pm

Is it possible to use JPA named entity graphs with GraalVM? For example, I have an entity annotated with: @NamedEntityGraph(name = "user-all", attributeNodes = { @NamedAttributeNode("departments"), @NamedAttributeNode("dataAccessors"), @NamedAttributeNode("users"), }) that works fine when running with the JVM but produces java.lang.IllegalArgumentException: No EntityGraph with given name 'user-all' when attempting to run the application as a native executable.

Removing $null or Blanks from CSV Results [closed]

23 January 2026 @ 7:11 am

I have a CSV that contains this information: TEST1,TEST2,TEST3,TEST4 100,200,300,400 ,,, ,,, ,,, ,,, ,,, ,,, ,,, 101,202,303,404 If I run this script Tester Script It returns the following: Script Results It includes the $Null results from the empty rows, that only contain the , separators. If I use $TEST1 = $TESTCSV | Select-Object -ExpandProperty TEST1 For each header and then write host, this omits the $nulls and just returns: 100 101 instead of: 100 long gap 101