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.

In a single batch file running on Windows Cmd, how to display both stdin and sdout at the screen and in a text file?

16 April 2026 @ 12:27 pm

I run a single batch "mybatch.bat" file containing several echo and other commands like del and copy, running in Windows Cmd, how can I make it displays both stdout and stderr simultaneously* at the screen and in a text file (a log file) ? * : if not possible, at least real time display of the batch progression on the screen and a copy of that in a log file at the end of the script. Thanks in advance.

LaravelExcel export only single sheet

16 April 2026 @ 12:17 pm

I'm using maatwebsite/excel to generate an invoice in PDF. I'm having a template in XLS that I load, update some informations in it and then export as a PDF. $template = new InvoiceImport(); $template->setDetails($aInvoiceDetails); $template->setPrices($acampaignsPrices); Excel::import($template, 'contracts/simple-template.xls', 'local'); My InvoiceImport is implementing WithMultipleSheets and in the registerEvents function I am updating some specific columns this way : class InvoiceImport implements WithEvents, WithMultipleSheets, SkipsUnknownSheets { protected $aCampaignPrices; protected $invoiceDetails; protected $lineNumber = 24; /** * Define the details of the invoice * */ public function setDetails(array $details){ $this->invoiceDetails = $details; } /** * Define the lines of prices * */ public function setPrices(arra

Statefulset replicas mismatch for a rabbitmqcluster

16 April 2026 @ 12:14 pm

Context My team provisions rabbitmq clusters on several openshift platforms. We have several kuberentes stages: test,npr,prd. About a month ago we updated the rabbitmq container images running on the test platform (bumped image from 4.1.3 to 4.2.4). That platform has only 2 rabbitmq clusters ("rmq-test-a" and "rmq-test-b", each deployed in its own namesapce with 1 replica/1PVC). Everything ran fine for rmq-test-a, but something very strange happened for rmq-test-b. For rmq-test-a, the pods were restarted and got the new image version, as you would expect. But for rmq-test-b, we saw an extra (second) pod being created (despite replica=1) and a new PVC being created for that pod as well. According to the logs, that second pod (which should not exist) was started with the new image 4.2.4 (while the other one still was running on 4.1.3). After a while the first pod got th

What level of control does Android have over USB-C power direction and current between two devices?

16 April 2026 @ 12:10 pm

I’m trying to understand the system-level behavior of power transfer between two Android devices connected via USB-C. From what I understand, USB-C with Power Delivery allows devices to act as either a power source or sink depending on negotiation. However, I’m unclear about how much control is available at different layers of the system. Specifically: - Can an Android application or system service control or override power direction (source vs sink) between two connected phones? - Is it possible to programmatically limit or control the amount of current flowing between devices? - Which aspects of this behavior are handled strictly at the hardware / firmware / OEM level, versus being accessible through Android APIs or system configuration? I’m not trying to implement a specific solution yet — just trying to understand the architectural boundaries and limitations of power control between devices. Any insights into how this work

XSLFO: XSL Formatter - Position Watermark at Top of Page?

16 April 2026 @ 12:06 pm

I've reviewed the XSL Formatter documentation on extension properties that affect a watermark (see https://www.antenna.co.jp/AHF/help/en/ahf-optset.html#watermark-text ). I don't see any property that enables one to position the watermark other than the center of the page. For example, if I want to move the watermark to the top of the page. So I want to check here on SO whether I'm overlooking some property or setting that's relevant to this requirement. Thanks for any feedback.

Optional Koin injection parameter

16 April 2026 @ 12:05 pm

I could not find any good solution online, so I will post what I found to work here. In order to have an optional parameter for Koin injections you can use the following code: val someModule: Module = module { factory<SomeClass> { (type: SomeEnum) -> when(type) { SomeEnum.A -> SomeClass(SomeEnum.A) SomeEnum.B -> SomeClass(SomeEnum.B) else -> SomeClass(SomeEnum.Default) } } factory<SomeClass> { SomeClass(SomeEnum.Default) } } (The order of the factories matters here, if you put the one without the parameter above of the one with this will not work) This can then be used in these two ways: class SomeViewModel(someClass: SomeClass) ... factory { SomeViewModel(get()) } factory { SomeViewModel(get(parameters = SomeEnum.A)) }

Integrating Cursor AI into jetbrains IDE

16 April 2026 @ 11:56 am

I don't like leaving my webstorm IDE, but, I also like cursor more than the AI integrated in jetbrain. Is there a way I can integrate cursor into my jetbrains IDE ?

Passing long classpaths in the shebang of Single-File Source-Code Programs

16 April 2026 @ 10:57 am

If you have a Single-File Source-Code Program like this #!/usr/bin/env -S java --source 11 -cp foo.jar:bar.jar:baz.jar:[...]:andsoon.jar Obviously, if you pass a lot of arguments to the java command and a large class path you are going to exhaust the maximum length of the shebang on various systems. What is the best way to get around this?

Pagination in Azure Data Factory with page

16 April 2026 @ 10:16 am

I have an API with the below format: { data: [<some data>], metadata: { page: 1, size: 1000, total: 3128 } } URL: {baseurl}/result?page=page Max page should be 4 in this case. Page may vary based on the amount of data In copy data, I want to set QueryParameter in range and end condition but whenever the API page reach out of bound, i.e. 5 the API return invalid URL, which failed the copy data. Is there any way to get the pagination enabled here? Is it possible to let the pagination knows to stop when size < total or similar solution? I want to have one output file so until/loop is not a good way.

404 Not Found when calling transfers API with transfers.write scope in Banno Consumer API

16 April 2026 @ 9:28 am

I am trying to create a transfer using the Banno Consumer API, but I am consistently getting a 404 Not Found response. API Endpoint POST https://digital.garden-fi.com/a/consumer/api/v0/users/{userId}/transfers cURL Request curl --location 'https://digital.garden-fi.com/a/consumer/api/v0/users/f76ae791-effa-4258-b137-d09dfdee4946/transfers' \ --header 'client-id: <client-id>' \ --header 'client-secret: <client-secret>' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer <access-token>' \ --data '{ "fromAccountId": "423ae4e5-83a2-4102-8a1d-9620286491b2", "toAccountId": "d39e8cda-2d7e-40c4-9e43-0b3b98a992b6", "amount": "1.00", "memo": "RAF Referral Reward", "frequency": "OneTime" }' Scopes Added