In our usecase, we wanted to print large documents (1000-2000 pages) containing graphs, images etc.,
As drawing to Canvas on this single thread might take time so what could be the alternative to do this using multiple threads?
QPlainTextEdit does not support CSS/HTML line-height because it uses a low-level
QTextDocument + layout engine. So changing <p> styles or using setHtml() has no
effect on QPlainTextEdit.
To change the line spacing, you must modify the QTextBlockFormat of the
document, not the widget:
cursor = self.textCursor()
block = cursor.block()
fmt = block.blockFormat()
fmt.setLineHeight(150, QTextBlockFormat.ProportionalHeight)
cursor.setBlockFormat(fmt)
This applies a proportional line-height (e.g., 150% = 1.5x spacing) to each block.
If you want to apply it to all lines, you can loop through all blocks in the
document and apply the same format.
QPlainTextEdit simply does not support CSS line-height, so adjusting the
QTextBlockFormat is the correct Qt-based solution.
My brother in Christ, if everything failed (and when I say everything I mean e v e r y s i n g l e t h i n g) it may be that the Firebase have not generated correctly the google-services.json for some reason. That was just what happened to me. Removing and re-adding the keys on Firebase will solve it.
The secret to debug any of this mess is to get your phone with the app from the PlayStore installed, connect it to your PC and logcat the stuff with something like (substitute completely <ADBDEVICENAME> and <APPNAME> including <>):
adb -s <ADBDEVICENAME> logcat | grep <APPNAME>
and then look for:
[GetTokenResponseHandler] Server returned error: Invalid key value: <SOMEHASHHERE>
is what you're looking for to see what it is being doing wrong, because in this line the logcat will spew a hash that can be converted to HEX so you can actually compare within your code if it is a debug key or if it is a key coming from the Play Console that is on Firebase but not on the google-services.json and so on.
import time
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
options = Options()
srv = Service()
driver = webdriver.Chrome(service=srv, options=options)
driver.maximize_window()
link = "https://rapidtech1898.com/"
driver.get(link)
time.sleep(3)
# 1) Get total page height and width using JS
total_width = driver.execute_script("return document.body.scrollWidth")
total_height = driver.execute_script("return document.body.scrollHeight")
# 2) Resize window to match full page
driver.set_window_size(total_width, total_height)
time.sleep(1) # small wait to let resize apply
# 3) Take full page screenshot
driver.get_screenshot_as_file("fullpage.png")
driver.quit()
Remove the space between the class name and the pseudo-class:
/* CHANGE THIS */
.btn :hover { ... }
/* TO THIS */
.btn:hover {
background-color: red;
font-size: 19px;
color: white;
}
@Simon Mourier, Thanks for your thoughts. We confirmed that it gets back to iFlip mode after the ovelapping windows disappear. But we just don't know how many frames it takes to get back to iFlip mode. I was wondering if there is a solution to request/force/fool the DWM to re-evalulate the current state immediately and switch to iFlip mode sooner than it usually takes.
something like the following steps:
swapChain->SetFullscreenState(TRUE, nullptr);
swapChain->ResizeBuffers(...);
swapChain->Present(0, 0);
But I could not find any authentic source that gives a guranteed and safer solution.
I tried this for Azure's Open ID Connect based SSO login with AEM - https://stacknowledge.in/blogs/aem-oidc-based-custom-authentication-handler/
ffmpeg -f v4l2 -video_size 720x480 -framerate 30 -thread_queue_size 471040 -i /dev/video0 -f alsa -thread_queue_size 480000 -i default -c:v libx264 -preset medium -crf 11 -c:a ac3 -b:a 384k -y /media/me/test1.mp4 -f matroska -c copy - | ffplay -f matroska -x 1440 -y 1080 -
The recorded file is very good quality. My -crf over-rides the preset, and I prefer the AC3 audio. But after the Natroska recode and resize for ffplay the on-screen display is choppy. But it works. Is there a different format I could use for ffplay that would not be choppy?
This is extremely unclear. PS Which table(s) have the IDs as unique key & which table(s) have the IDs as foreign key? PS This site uses English.
Use:
p { margin-bottom: 0; }
Also, I recommend using a normalize stylesheet — it helps a lot. This is one of the most commonly used ones:
This also works:
cmake.exe --build buildDir --config Release
What do you mean by "autocad structure" and "grantts"?
Bluetooth GATT for the latter? Or something else?
Take a look at this open-source project (on GitHub) using ASP.NET Core, SignalR & WebRTC.
https://github.com/VeritasSoftware/WebRTC
It has a .NET Server library and Client libraries for Angular, React & Blazor.
These Client libraries provide high-level API for simplified WebRTC operations.
for me running tests like this worked:
yarn test ./filename.test.tsx ❌
yarn test filename.test.tsx ✅
similarly
npm run test ./filename.test.tsx ❌
npm run test filename.test.tsx ✅
For expo, I had to edit the ios/<app>/Info.plist file directly and add the NSCameraUsageDescription description with and that solve it
@Spectral Instance What about when B2 cell contain 100000?
U need to add output and define schemas ini datasource.
generator client {
provider = "prisma-client-js"
output = "../generated/prisma/client"
}
datasource db {
provider = "postgresql"
schemas = ["your-schemas"]
}
Then u need add @schema("") in your model. Example :
model sku {
a Int @id @default(autoincrement())
b String @unique @map("b") @db.VarChar(255)
c Int? @map("c")
createdAt DateTime @default(now()) @map("created_at") @db.Timestamp(6)
updatedAt DateTime @default(now()) @updatedAt @map("updated_at") @db.Timestamp(6)
@@index([b])
@@map("c")
@@schema("your-schemas")
}
u can make it global using :
import { PrismaClient } from '../generated/prisma/client/index.js';
import { PrismaPg } from '@prisma/adapter-pg';
const globalForPrisma = globalThis;
// adapter Postgres (Prisma Data Proxy / Accelerate style)
const adapter = new PrismaPg({
connectionString: process.env.DATABASE_URL
});
export const prisma =
globalForPrisma.prisma ??
new PrismaClient({
adapter
});
// simpan instance ke global supaya tidak recreate saat hot reload / nodemon
if (process.env.NODE_ENV !== 'production') {
globalForPrisma.prisma = prisma;
}
This behavior is standard in HTML/CSS; the background of
<body>is used as the background for the entire viewport when<html>has no background. This is explained here in detail: Why does styling the background of the body element affect the entire screen?George Christidis
I built a quick app to scan the images and pdf to extract the events information and used the info on this page to construct the google calendar links.
https://scaneventz.com/
<script src="mujScript.js" defer></script>
This seems to happen when navigating using Inertia (using the Link component for example) to a route that returns a normal blade view rather than an Inertia page.
I've seen this behavior by coincidence while playing with Inertia in Django when I tried to navigate to the Django admin panel using an Inertia Link component and it popped up on the screen like it did on your screenshot.
When I realized the reason, I tried to simulate the same behavior using Laravel, and sure enough, it did the same thing.
how would you get started on that kind of project
By starting small, learning the basics, and gradually developing an understanding of what tools/frameworks are appropriate for various situations.
Do you really expect to start using a new language/tool/framework and fully understand it immediately? That's not how "learning" works.
To first answer your question you need to understand the difference between a font-family and a actual font: A font family is a collection of related fonts, like sans-serif, and a font is a specific member of that family, such as Helvetica, Arial, Calibri and the font you are trying to use, Algerian. The font family is the overall design, while the font is the specific variation in weight, style, and size within that design.
Furthermore I spotted this errors in your code:
as said you shouldn't change the parameter 'font-family' because the default, sans-serif, aldo includes Algerian.
as of today by matplotlib docs the keyword argument to change the font in math formulas from the default ('dejavusans') is math_fontfamily not fontfamily like you use
With this corrections I was able to correct the code to get what I hope is the inted output (didn't understand perfectly the LaTeX issue):
import matplotlib.pyplot as plt
plt.rcParams['font.sans-serif'] = ['Algerian']
plt.rcParams['font.weight'] = 'bold'
plt.rcParams['font.size'] = 10
plt.figure()
plt.text(0.1, 0.5, r"$a*ln(x)*x^2+2$", math_fontfamily='custom')
plt.show()
I found that it needs to be told to use a custom family font to enable a esternal font to be used, the other accepted values are:
'dejavusans', 'dejavuserif', 'cm', 'stix', 'stixsans', 'custom'
this gives in output:enter image description here
which I understand is the one you need.
Some notes:
make sure to have installed in your system the Algerian font (in Windows 11 is preinstalled)
you can check the font asigned to a specific font family with
print(plt.rcParams["font.sans-serif"][0])
which should print Algerian in this case.
To further understand how to customise matplotlib refer to the text, labe and annotation docs.
New to this in terms of System design but here is what I gathered after watching a videos and tutorials
When to use MongoDB (NoSQL Database)?
When Availability is more important ( CAP Theorem )
When ACID properties is not a priority
When schema/table are not heavily related to each other
When the database design might change frequently OR not yet sure on what the different columns/keys would be.
On the other hand reverse the above for SQL Database
Please correct me if I am wrong. Thanks.
What it returns right now it's not really undefined but a promise.
Because it is an async function, you need to await:
const session = await getUserSession("abc123");
console.log(session); // → "{"userId":123,...}"
If you can't await:
getUserSession("abc123").then(session => { console.log(session); })
Just to clarify, this is taking user input and matching the first letter to the 'action' number? e.g. I enter "h" and it's mapped to the "help" action (3)?
If so, you might want to structure a dictionary like this:
input_map = {"a": "1", "b": "2", "c": "3"}
and then access it by just querying the key:
response = "a"
input_map[response] # "1"
This does not handle the default action, however. You might want to pass that in directly to the function somehow?
You my good sir, are the real mvp. Thank you, your solution was the only thing that worked.
The easy-to-use editing interface lets you creatively edit your video and add additional images, text, music, and transitions for a professional-looking video.
https://techsoft.pro/cleanmymac/
Make the sub-route you want to reuse an independent branch, so that its path starts with '/' (i.e don't define the reusable route on top of other routes). This will allow go_router to find the full route path even when using named routes. Then use push() or pushNamed() to add the re-usable sub-route to the stack from wherever it's needed.
To illustrate:

The entire subroute of "/Reusable-screen 1 -> reusable-screen 2" should now be reusable throughout the navigation tree.
around 97, initially was written in plain C and Perl (for the Enterprise Java Bean container EJB1 then EJB2).. Not in Java and Not in C++ and Not in PL/1 and Not in Smalltalk. Before being commercialized, v1 and v2 run on RS6000 AIX, and one had to customize the Makefile to compile the product... there is a mix up on the original product name.. some confusion (even on Wiki) as some think it was a continuation of IBM failing product "IBM San Francisco". Well, it is not... finally, the name "WEBSPHERE" I believe was used as an Apple product early 80's, but there is no trace of it on Google and anywhere else; don't recall if it was a product put by a third company to do backup...
perhaps with dictionaries
Yes, dictionaries would be great for this. Have you tried that?
I tried to install on differen server routes yet it didn't work. My node version is 22.18.0, so I still have same problems
Sorry for not providing a clear direct answer here, but this video helped me a lot to get up and running with Workload Identity Federation, so I'll definitely recommend watching this:
https://youtu.be/AH5DmYsKSTM?si=CXURPYcMIWyQx1iS
(He provides a script that automatically sets up everything you need to run terraform from github actions workflows)
https://github.com/amir-cloud-security/gcp-terraform-test-oidc
If anyone looking for a solution for this , check my website
In n8n, items coming from multiple input connections into a Filter node are merged into a single stream, so you lose information about which input they came from.
To count items per input, you need to tag them before the Filter. Add a Set (or Function) node on each input path and add a field like source: "inputA" / source: "inputB".
After the Filter node, you can count items by grouping on that field (using a Function node or other aggregation logic).
If you don’t want inputs to merge at all, keep the Filter and counting logic in separate branches or workflows.
n8n doesn’t provide a built-in “count per input connection” feature, so tagging items before merging is the usual workaround.
I have given Brian's approach a go today and it has worked out very well for me. The updated code is pushed to the repository. It still needs a lot of tidying up but the basic type structure is now present, the inventory works and processes can now start to be defined. For example `tryMakeSteel steelMill (recipe: Recipe) (materialList: MaterialList): Material option`, although I still need to add some test for this function actually does what I want it to.
Thank you to every one who contributed to answering my question.
I discovered an efficient solution using Python's zip function, which pairs corresponding elements from multiple sequences.
Example:
string_1 = 'ABC'
string_2 = '123'
result = list(zip(string_1, string_2))
# Output: [('A', '1'), ('B', '2'), ('C', '3')]
Removing XDP_FLAGS_UPDATE_IF_NOEXIST fixed the issue.
It seems I overthought it. So it's fine to enter the date directly into cell("H2").
Function strgen()
Dim dat As Variant
Dim datstring As Variant
dat = ThisWorkbook.Sheets("Sheet1").Range("H2").Value
datstring = Format(dat, "mm.dd.yy")
strgen = datstring & ".xlsm"
End Function
abcdefg's answer was the way thanks!
You can use this google sheets addon to encrypt cells: https://workspace.google.com/marketplace/app/cellencrypt/933661203390
just remove Microsoft.OpenApi refrence Package
it Will be ok !
dotnet add package Swashbuckle.AspNetCore.Swagger
dotnet add package Swashbuckle.AspNetCore.SwaggerGen
dotnet add package Swashbuckle.AspNetCore.SwaggerUI
/Project_Name
/Financials
/Budget
- Project_Budget.xlsx
- Budget_Summary.pdf
/Invoices
- Vendor_Invoices/
- VendorName_InvoiceNumber.pdf
/Receipts
- Receipts_Jan2025.pdf
- Receipts_Feb2025.pdf
/Expense_Reports
- Expense_Report_Template.xlsx
/Payroll (if applicable)
- Staff_Payroll.xlsx
/Financial_Reports
- Monthly_Financial_Report.xlsx
- Quarterly_Report.pdf
/Contracts & Agreements (Payment related)
- Supplier_Contracts.pdf
SetTraceLogLevel(LOG_NONE); in C and C++
@rzwitserloot for some reason (perhaps my lack of reputation points) StackOverflow won't let me post this as a reply to your answer. So..
I take your points and your concerns. Obviously one praftfall that can happen here is that if I create a proxy that makes assumptions about methods with identical method signatures, and the library authors enhance their library by introducing new methods of that signature that do not ADHERE to my assumptions, I will have problems.
I intend to create a PR for this library that formalizes this interface with an actual interface. And if they accept that, I think the tactic of a workaround UNTIL my changes are released (and I update my dependency) is a low risk, valid approach.
I'm nothing but grateful for the effort and thought you put into your answer.
What about logging? I see that worker threads are sharing logging resources randomly, cant see which thread is writing where
In Xcode 16.4 I went to my app target and typed "Icon" in the Filter box.
I had the "Primary App Icon Set Name" set to the name of my .icon file NOT AppIcon. I switched it back to "AppIcon" and it now it builds.
I don't have an Images.xcassets file. AFAIK Xcode isn't creating those now - and I didn't need to create one.
Could you use relative to parent box?
.onGloballyPositioned { coordinates ->
val rect = coordinates.boundsInParent()
updateChildFrames(i, rect)
}
I found the issue, earlier in the code I have added a comment, stating that the first 4 bytes of the message are the packet length and the packet number, so those must not participate in the message parsing.
const MYSQL_CLIENT_HANDSHAKE_USERNAME_START_POS = 36 // packet len + packet number + 32 bytes from the message(client caps and other fields)
Once I took this into account:
clientCaps := binary.LittleEndian.Uint32(input[4:8])
things started working properly.
well you can use device flag for eg:docker run --device=/dev/ttyUSB0 or docker run -it -v /dev:/dev --privileged
Is it possible a antivirus software deleted the file?
Starting with .NET 7 there is an Int32.Log2() and Int64.Log2()
its only working for one li
if multiple li is there not working
This error usually happens because `@stream-io/openai-realtime-api` is a server-only package and Next.js tries to install or use it in the client-side environment. It requires Node.js 18+ and won’t work inside client components.
Try using the package only in a server route (like `/app/api/...`) and make sure your Node version is 18 or higher. Installing it with a clean environment (`rm -rf node_modules && npm install`) also helps.
from PIL import Image, ImageDraw
# Load your wordsearch image
img = Image.open("image.jpg") # change to your file name
draw = ImageDraw.Draw(img)
# Approximate rectangles for each word
highlights = [
((10,10,210,40)), # CONVERTER
((10,50,40,210)), # ELECTOR
((60,60,260,260)), # INSPECTOR
((10,300,250,330)), # LEGISLATOR
((140,80,170,260)), # NOTICER
((100,10,300,40)), # SUGGESTER
((10,480,150,510)), # TELLER
((220,200,250,350)),# FARMER
((150,480,350,510)),# JUSTIFIER
((320,50,350,150)), # LOVER
((250,10,400,40)), #
Thank you for your suggestion on useReducer, I read something about it and I think it could make the code a little less cumbersome. I know there are some libraries like redux that simplifies the state management a lot, and, as you said, they will be a lot more efficient than a custom approach. If I'll be doing something for production I'll go that way for sure, but as in this case I'm exploring the framework I wanted to use as much as "pure react" as I can to understand how it works.
You can reverse a string in Python in multiple ways:
1. Using slicing (shortest and fastest)
s = "hello"
print(s[::-1])
2. Using reversed() with join
s = "hello"
print("".join(reversed(s)))
3. Using a loop
s = "hello"
res = ""
for ch in s:
res = ch + res
print(res)
All of these output: "olleh"
taher hamdy rtah er pop hfp .php h.c .vocm .d dpdg d.d d aye due ofp d copsi d.dpud .dphp d.d
. td ag f gd . dtafge rv. hadm c. hasss. gf jsgfywu. dfhb d rwurett. gdfa6v . fhh fhsjjm. sybagdb f. dy dya .
Test what Elham Azadfar suggests - make sure you are authenticated to remote PC (with admin rights) E. G. try opening \\remotepc\c$
( LocalAccountTokenFilterPolicy = 1 might be necessary, winrm quickconfig useful in general as well )
MP
The position has moved...
We have covered a article with all the fixes codes for this issue check it out if you are struck hope it helps Link : https://ultimateinfoguide.com/py4jjavaerror-saving-delta-table-fix/
Depends, the better way will be using .git
Which is more suitable and comfortable, overall secure. Even Github for mac is safe, but however it's kinda glitchy. So therfore it's makes errors sometimes, but anyway you could use Push button finding near the Commit section.
This warning is completely normal and expected after changing settings. It will go away automatically for the next deployment.
It simply means that the version of your app currently live (Production) was built using the previous settings (what is running), but your Vercel dashboard now has newer settings.
I think a more modern approach is to use scripts in programming languages, such as Python, so that it won't be limited to just one operating system. As far as I know, 7-zip can run on both Windows and MacOS/Linux. The steps to handle this issue are as follows:
Use the list of decompression file extensions supported by 7-zip to filter out all possible decompressible archive files in a certain directory (for example, tar, 7z, rar, etc.). Remember to use os.path.extsplit(path)[-1] to get the extensions of these files for filtering, because the following files may just coincidentally be named like "footar" and they are not archives; only those like "foo.tar" are.
Use the 7z t command to test these compressed archive files and filter out those that fail the test (because some files, although ending with these supported compressed archive suffixes, may be corrupted archives).
Use 7z x or 7z e to extract these valid compressed archive files. The specific command to use depends on the file directory format you expect to obtain.
Recursively execute the above steps, and end the recursion when no available compressed packages are found in the first step, so as to decompress the nested compressed package files within the compressed packages
This is just an implementation logic. I'm sorry, but I won't attach specific code because everyone's expected results are different, and there may be some additional customization requirements.
As a test - why did you ask this question here, and not consult an AI?
Because we're a better resource that can comprehend the question, and the bits that weren't asked. The collective-We can provide relevant context whereas an AI is just answering with "whichever word comes next".
Would an AI have flipped it over with a counter-example like this ? No.
I mean an ouput of a code cell in Jupyter Notebook file. PyCharm has got this, but mostly I work in Vs code. I selected a portion of a text and I want it to be copied by rmc copy/paste.
With recent changes to the AI Foundry and New Foundry features, it appears Microsoft has added Tool Approval support through the Playground. This issue should now be resolved.
<!doctype html>
<html lang="pt-BR">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>PDF → Excel (cliente) — Layout fiel</title>
<style>
body{font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial;margin:20px}
.card{border:1px solid #e3e3e3;padding:18px;border-radius:8px;max-width:980px}
label{display:block;margin-bottom:8px}
pre{white-space:pre-wrap;background:#f8f8f8;padding:10px;border-radius:6px; height:220px; overflow:auto}
button{padding:10px 14px;border-radius:6px;border:0;background:#2563eb;color:#fff}
input[type=number]{width:80px}
</style>
</head>
<body>
<div class="card">
<h2>PDF → Excel (cliente) — Layout mais fiel</h2>
<p>Escolha um PDF (texto, não escaneado). O script tenta manter posição X/Y criando uma grade mais parecida com o PDF.</p>
<label>Arquivo PDF: <input id="filePdf" type="file" accept="application/pdf"></label>
<label>Páginas (ex.: 1-3 ou 1,3,5; deixe vazio para todas): <input id="pages" type="text" placeholder="1-3 or 1,3,5"></label>
<label>Gap X (px) — quanto menor, mais colunas: <input id="xgap" type="number" value="8"/></label>
<label>Gap Y (px) — quanto maior, mais separação entre linhas: <input id="ygap" type="number" value="4"/></label>
<div style="margin-top:10px">
<button id="btn">Gerar Excel</button>
</div>
<h3>Status</h3>
<pre id="log">Aguardando arquivo...</pre>
</div>
<!-- PDF.js CDN -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.16.105/pdf.min.js"></script>
<!-- SheetJS (XLSX) CDN -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.18.5/xlsx.full.min.js"></script>
<script>
pdfjsLib.GlobalWorkerOptions.workerSrc = 'https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.16.105/pdf.worker.min.js';
const fileInput = document.getElementById('filePdf');
const btn = document.getElementById('btn');
const logEl = document.getElementById('log');
const pagesInput = document.getElementById('pages');
const xgapInput = document.getElementById('xgap');
const ygapInput = document.getElementById('ygap');
function log(msg){
logEl.textContent += '\\n' + msg;
logEl.scrollTop = logEl.scrollHeight;
}
function parsePagesSpec(spec, total){
if(!spec) return Array.from({length: total}, (_,i)=>i+1);
spec = spec.replace(/\\s+/g,'');
const parts = spec.split(',');
const out = new Set();
for(const p of parts){
if(p.includes('-')){
const [a,b] = p.split('-').map(x=>parseInt(x,10));
if(!isNaN(a) && !isNaN(b)) for(let i=a;i<=b;i++) if(i>=1 && i<=total) out.add(i);
} else {
const n = parseInt(p,10);
if(!isNaN(n) && n>=1 && n<=total) out.add(n);
}
}
return Array.from(out).sort((a,b)=>a-b);
}
// cria buckets X por proximidade (gap menor => mais colunas)
function makeXBuckets(xs, gap){
xs = Array.from(new Set(xs)).sort((a,b)=>a-b);
if(xs.length===0) return [];
const buckets = [{sum: xs[0], count: 1, center: xs[0]}];
for(let i=1;i<xs.length;i++){
const x = xs[i];
const last = buckets[buckets.length-1];
if(x - last.center > gap){
buckets.push({sum:x,count:1,center:x});
} else {
last.sum += x; last.count += 1; last.center = last.sum/last.count;
}
}
return buckets.map(b=>b.center);
}
btn.addEventListener('click', async ()=>{
logEl.textContent = '';
const f = fileInput.files[0];
if(!f){ alert('Escolha um arquivo PDF primeiro'); return; }
log('Lendo arquivo...');
const arrayBuffer = await f.arrayBuffer();
log('Abrindo PDF com pdf.js (scale=2)');
const loadingTask = pdfjsLib.getDocument({data: arrayBuffer});
const pdf = await loadingTask.promise;
log('Páginas no PDF: ' + pdf.numPages);
const pagesToProcess = parsePagesSpec(pagesInput.value, pdf.numPages);
log('Páginas a processar: ' + pagesToProcess.join(', '));
const allRows = []; // array de arrays (grid)
let globalMaxCols = 0;
const pageMetrics = []; // para col widths
for(const pnum of pagesToProcess){
log('Processando página ' + pnum);
// scale maior para melhor posição (posições menos inteiras)
const page = await pdf.getPage(pnum);
const viewport = page.getViewport({scale:2});
const textContent = await page.getTextContent();
const items = textContent.items.map(it => {
const t = it.transform;
const x = t[4];
const y = t[5];
return {str: it.str.replace(/\\s+$/,'').replace(/^\\s+/,'') , x: x, y: y};
}).filter(i => i.str && i.str.length>0);
if(items.length===0){ log(' => Sem texto nesta página'); continue; }
// Agrupa por Y arredondado (linha) usando ygap
const ygap = Number(ygapInput.value) || 4;
const groupedByY = new Map();
const allXs = [];
for(const it of items){
const yKey = Math.round(it.y / ygap) * ygap; // quantiza pelo ygap
if(!groupedByY.has(yKey)) groupedByY.set(yKey, []);
groupedByY.get(yKey).push(it);
allXs.push(Math.round(it.x));
}
// buckets X (mais finos)
const xgap = Number(xgapInput.value) || 8;
const bucketCenters = makeXBuckets(allXs, xgap);
bucketCenters.sort((a,b)=>a-b);
if(bucketCenters.length===0) continue;
// montar linhas ordenadas por Y (de cima para baixo: y maior -> topo)
const yKeys = Array.from(groupedByY.keys()).sort((a,b)=>b-a);
// converter cada linha para um array com número de colunas = bucketCenters.length
const pageRows = [];
// tambem vamos computar as alturas de linhas (diferenças de y)
const rowYs = [];
for(let i=0;i<yKeys.length;i++){
const yk = yKeys[i];
const rowItems = groupedByY.get(yk);
// inicializa com vazios
const row = new Array(bucketCenters.length).fill('');
for(const it of rowItems){
// encontra bucket mais próximo
let bestIdx = 0, bestDist = Infinity;
for(let bx=0; bx<bucketCenters.length; bx++){
const d = Math.abs(it.x - bucketCenters[bx]);
if(d < bestDist){ bestDist = d; bestIdx = bx; }
}
// Se já existir conteúdo, junta com quebra de linha (mantém visual)
if(row[bestIdx]) row[bestIdx] += '\\n' + it.str;
else row[bestIdx] = it.str;
}
// trim
for(let c=0;c<row.length;c++) if(row[c]) row[c] = row[c].trim();
pageRows.push(row);
rowYs.push(yk);
}
// salvar métricas da página para ajustar col widths
pageMetrics.push({centers: bucketCenters.slice(), rowYs: rowYs.slice(), viewportWidth: viewport.width});
// adicionar página ao allRows (mantendo separador de página)
for(const r of pageRows){
allRows.push(r.slice()); // copia
}
// linha em branco entre páginas
allRows.push(new Array(bucketCenters.length).fill(''));
globalMaxCols = Math.max(globalMaxCols, bucketCenters.length);
}
if(allRows.length===0){ log('Nenhuma linha extraída'); return; }
// Normalizar todas as linhas para ter globalMaxCols colunas
for(let i=0;i<allRows.length;i++){
const row = allRows[i];
if(row.length < globalMaxCols){
const more = new Array(globalMaxCols - row.length).fill('');
allRows[i] = row.concat(more);
}
}
log('Gerando planilha (mantendo layout)...');
// Criar worksheet a partir de AOA e depois ajustar col widths e row heights
const ws = XLSX.utils.aoa_to_sheet(allRows);
// Calcular larguras de colunas aproximadas com base na média das distâncias dos bucket centers
// usar métricas da primeira página que tenha dados
let cols = [];
if(pageMetrics.length){
const first = pageMetrics[0];
const centers = first.centers;
// distâncias entre centros
const dists = [];
for(let i=1;i<centers.length;i++) dists.push(Math.max(5, centers[i]-centers[i-1]));
// para n colunas, criar widths (em caracteres aproximados) proporcional a dists
const avgDist = dists.length ? (dists.reduce((a,b)=>a+b,0)/dists.length) : 20;
cols = new Array(globalMaxCols).fill({wpx: Math.max(40, avgDist)}); // fallback
// se tiver dists diferentes, mapear
for(let i=0;i<globalMaxCols;i++){
const w = (i<dists.length ? dists[i] : avgDist);
cols[i] = {wpx: Math.max(30, Math.round(w*1.1))};
}
} else {
cols = new Array(globalMaxCols).fill({wpx:80});
}
ws['!cols'] = cols;
// Estimar altura de linhas (proporcional às mudanças de Y). Aqui usamos valor fixo para simplicidade.
const estimatedRowHeight = 18;
const rowsMeta = new Array(allRows.length).fill({hpt: estimatedRowHeight});
ws['!rows'] = rowsMeta;
// Ativar wrapText para todas as células não vazias
const range = XLSX.utils.decode_range(ws['!ref']);
for(let R = range.s.r; R <= range.e.r; ++R) {
for(let C = range.s.c; C <= range.e.c; ++C) {
const cell_address = {c:C, r:R};
const cell_ref = XLSX.utils.encode_cell(cell_address);
const cell = ws[cell_ref];
if(cell && typeof cell.v === 'string' && cell.v.indexOf('\\n') !== -1){
// manter quebras de linha e wrapText
cell.s = cell.s || {};
cell.s.alignment = cell.s.alignment || {};
cell.s.alignment.wrapText = true;
}
}
}
const wb = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(wb, ws, 'Extraido');
const nome = (f.name.replace(/\\.pdf$/i,'') || 'saida') + '.xlsx';
log('Baixando ' + nome);
XLSX.writeFile(wb, nome);
log('Concluído — verifique colunas e ajuste XGap/YGap se necessário (valores menores de XGap => mais colunas).');
});
</script>
</body>
</html>
What I did was to ensure that all imported or used libraries appear inside dependencies in the package.json file. I made a mistake of installing them on the project path instead of cd functions, then install them which will make allow them to appear under dependencies on the .
What cell? Descrine the steps to reproduce, if you don't mind.
The demand for high -performance GPUs for commercial AI applications significantly outpaces the current supply, leading to scarcity despite the presence of large chip manufactures
1.Explosive Demand
2.Manufacturing constraints
3.Design specialization
4.Market dynamics
Your loop condition never becomes False -- This will print “Found” but keep looping, because you never told it to stop.
t = (3, 7, 10, 1)
i = 0
while i < len(t):
if t[i] == 10:
print("Found")
i += 1
This code works on my machine.
Make sure the html file and css file are both in the same folder and css file is named style.css.
What code editor do you use?
Use break to exit the loop as soon as the element is found
numbers = (2, 4, 6, 8, 10, 12)
x = int(input("Enter a number to search: "))
i = 0
while i < len(numbers):
if numbers[i] == x:
print("Number found at index", i)
break # stop the loop
i += 1
You have to specify in the loop that the element is found you can stop now, to solve the issue use break before incrementing the value of i
Think it is a thing that it is for a single one but it is probably masked
In large React/Next.js apps, Redux Toolkit starts to feel like an anti-pattern when most of your state is really server data. Libraries like React Query or SWR handle fetching, caching and syncing much better, so RTK just adds code you don’t need.
RTK still works great when you’ve got complex client-side logic — shared UI state, multi-step flows, or anything that has nothing to do with the backend.
Simple rule of thumb:
– server data → React Query/SWR
– complex UI logic → RTK
By the way, when I was working on a similar architecture, I got some help from a team at Red Rocket Software — here’s their main page: https://redrocket.software/. They also build custom React/Next.js solutions, so their input was actually pretty useful.
I get the same problems.
I also find a similar issues in https://github.com/google/adk-python/issues/3697 .
Did you find the solution of this?
I did it!
They support this by adding property:
trigger_conditions:
- trigger_condition: ON_CHANGE_AT_PATH
trigger_condition_paths:
- dataset/data.json
I think I'm spending more time in this that I need. Most of the posts/articles I read said to embrance eventual consistency.
When creating a new tenant I NEED consistency. I believe the "best" way to get the job done is to remove the shared transactions for now(since there're causing me these problems) and just use my usecases DELETE methods in case something goes south.
I'll get (PHP) Laravel-framework specific in my response and respond from that specific architectural view point.
"Controller" is what stands between the incoming request to your application and the business-logic operations it performs, while "Service" is what wraps around that same business-logic opeations and is called my the controller.
The following flow might be helpful in wrapping one's head around the concept:
client sends a request -> controller (validation, calling the necessary service to perform business logic and passing the request to it) -> service (computation, db checks, resource mutation, etc) -> response back to controller (formatting, view) -> client receives response.
When you declare api project(':shared'), Gradle should expose it to consumers, but the default Maven Publish configuration doesn't automatically include these dependencies in the POM. Here's the fix:
Add this to your :library's build.gradle.kts inside the MavenPublication block:
pom {
withXml {
val dependenciesNode = asNode().getAt("dependencies")?.get(0)
?: asNode().appendNode("dependencies")
configurations["releaseApiElements"].allDependencies
.filter { it.group != null && it.name != "unspecified" }
.forEach {
val dependencyNode = dependenciesNode.appendNode("dependency")
dependencyNode.appendNode("groupId", it.group)
dependencyNode.appendNode("artifactId", it.name)
dependencyNode.appendNode("version", it.version)
dependencyNode.appendNode("scope", "compile")
}
}
}
Make sure :shared is also published to the same repository (JitPack). Your project structure requires publishing all modules independently – JitPack will handle building the full dependency tree if all modules are in the same Git repo.
Sorry, forgot to add some details in the question:
Ex of repository:
type CoreUserRepository struct {
db *sqlx.DB
}
func NewCoreUserRepository(db *sqlx.DB) *CoreUserRepository {
return &CoreUserRepository{db: db}
}
func (repo *CoreUserRepository) Exists(idTenant int64, idUser int64) *int64 {
query := "SELECT id FROM core.users WHERE id_tenant=$1 AND id=$2;"
var id int64
err := repo.db.QueryRowx(query, idTenant, idUser).Scan(&id)
if err != nil {
log.Println("[CORE USERS - REPO] Could not find user: ", err)
return nil
}
return &id
}
I'm also thinking in creating Request Containers Dependency Injection for my Unit of Work. Each request creates a new container that's injects the necessary repos, usecases AND the request context. I create the UW, pass it to the context and inject the context in the usecases and repositories. With this, I'd not have the problem of having a "global transaction" in my whole application when declaring a Unit Of Work. You think that's too much? Sorry, first time with an application of this size/complexity ;-;
Good day. I got the same task today as part of Angela Yu's Python Bootcamp, and below is my solution.
Am a newbie therefore i wanted to avoid diving into complicated concepts which I havent learnt and wanted to make it as simple as possible.
import numpy as np
from random import choice
print("Let's play Tic Tac Toe!")
board = np.array([[None, None, None], [None, None, None], [None, None, None]])
def render_uiboard(board):
symbols = {None: " ", "X": "❌", "O": "⭕"}
rows = []
for i in range(3):
row = f"{symbols[board[i,0]]} | {symbols[board[i,1]]} | {symbols[board[i,2]]}"
rows.append(row)
separator = "\n-------------\n"
return separator.join(rows)
print(render_uiboard(board), "\n")
print("Am playing ❌, I move first!")
def check_win(board, player):
for row, col in zip(board, np.transpose(board)):
if np.all(row == player) or np.all(col == player):
print(f"Player {player} won!")
return True
main_diag = np.diagonal(board)
antidiagonal = np.diagonal(np.fliplr(board))
if np.all(main_diag == player) or np.all(antidiagonal == player):
print(f"Player {player} won!")
return True
def check_draw(board):
return np.all(board != None) # if no more empty cells
def get_user_coord(board):
valid_input = False
while not valid_input:
input_coords = input("Your turn! Enter coords (e.g. 1 0): ")
if input_coords in (
"0 0",
"0 1",
"0 2",
"1 0",
"1 1",
"1 2",
"2 0",
"2 1",
"2 2",
):
r, c = map(int, input_coords.split())
if board[r, c] == None:
valid_input = True
return r, c
else:
print("That cell is already occupied. Choose another.")
else:
print("Please enter valid coordinates for an empty cell.")
game_over = False
while not game_over:
empty_coords = [(r, c) for r in range(3) for c in range(3) if board[r, c] is None]
r, c = choice(empty_coords)
board[r, c] = "X"
print(render_uiboard(board))
print("\n")
if check_win(board, "X"):
game_over = True
break
if check_draw(board):
print("It's a draw!")
break
r, c = get_user_coord(board)
board[r, c] = "O"
print(render_uiboard(board))
print("\n")
if check_win(board, "O"):
game_over = True
break
if check_draw(board):
print("It's a draw!")
break
continue
@Reinderien My bad! Good catch. I edited the question accordingly. Thanks for pointing that out.
You can explicitly set the MaxLength property to any integer value less than or equal to **Int32.MaxValue (2,147,483,647) **
In my opinion, you’ll need to analyze your current system’s architecture, business rules, and integration requirements before choosing a specific communication pattern. Without understanding what responsibilities the legacy system must delegate to the new identity service, it's impossible to recommend REST, gRPC, or message queues.
Each option depends on concrete details:
1. What exactly needs to be moved out of the monolith?
2. Which operations are synchronous (e.g., login, token issuance) vs. asynchronous (e.g., KYC updates)?
The right solution isn't universal it must follow your business workflows and technical constraints.
import tkinter as tk
from tkinter import simpledialog, messagebox
import random
CORRECT_PATTERN = [1, 5, 9, 8]
CORRECT_PASSWORD = "universe123"
CORRECT_PIN = "4567"
jokes = [
"Why do programmers prefer dark mode? Because light attracts bugs!",
"Why was the computer cold? It forgot to close its Windows!",
"Why did the coder quit his job? Because he didn’t get arrays.",
"How many programmers does it take to change a light bulb? None, it's a hardware problem.",
"Why do Java developers wear glasses? Because they can't C#.",
"What do you call 8 hobbits? A hobbyte.",
"I told my computer I needed a break, and it said: No problem, I'll go to sleep."
]
pattern = []
def show_joke():
messagebox.showinfo("Joke", random.choice(jokes))
def ask_pin():
pin = simpledialog.askstring("PIN", "Enter PIN:", show="*")
if pin == CORRECT_PIN:
messagebox.showinfo("Success", "Unlocked")
show_joke()
window.destroy()
else:
messagebox.showerror("Error", "Wrong PIN")
def ask_password():
password = simpledialog.askstring("Password", "Enter Password:", show="*")
if password == CORRECT_PASSWORD:
ask_pin()
else:
messagebox.showerror("Error", "Wrong Password")
def press(num):
pattern.append(num)
if len(pattern) == len(CORRECT_PATTERN):
if pattern == CORRECT_PATTERN:
messagebox.showinfo("Pattern", "Correct Pattern")
pattern.clear()
ask_password()
else:
messagebox.showerror("Pattern", "Incorrect Pattern")
pattern.clear()
window = tk.Tk()
window.title("Multi-Lock System")
window.geometry("300x380")
title = tk.Label(window, text="Draw Pattern", font=("Arial", 18))
title.pack(pady=10)
frame = tk.Frame(window)
frame.pack()
num = 1
for r in range(3):
for c in range(3):
btn = tk.Button(frame, text=str(num), width=10, height=4,
command=lambda n=num: press(n))
btn.grid(row=r, column=c)
num += 1
window.mainloop()
@Jasper AI slop aside, this question is not nearly as complicated as you showed. It's a very simple interpolation.
Use the following commands
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1
With this code can send your instructions or shells to the terminal. (This worked directly on Ubuntu).
import subprocess
command = """conda activate your_env"""
process = subprocess.run(
command,
shell=True,
stdout=subprocess.PIPE,
sdterr=subprocess.PIPE,
shell=True
)
In MSYS2 you are using fzf's shell integration feature. You need to set it up again for your Linux and Mac.
It looks like the crash may be happening because the OCR result sometimes returns empty or unexpected values in release builds, and the overlay tries to read bounding boxes that aren’t actually there. This usually doesn’t show up in development because the error handling is more forgiving.
Just to understand better: have you checked whether the frame processor ever returns null or an empty array for the text blocks in your release build logs?
Could you share the part of your implementation where you process the text blocks and render the bounding boxes?
@ReX357 You need to edit your question: no, that's not a grid of parallelograms. It's a grid of trapezoids. It's pretty straightforward to do in Python + Numpy, but correcting your terminology will help toward accurately describing the problem.
My knowledge might be slightly outdated since I had this problems some 2 years ago. If I remember correctly, this was not possible using the Google Login Plugin because it is based on OAuth.
What you could do alternatively, is set up an authentication with Google Workspace using SAML. This way, you can configure a group attribute.
dotnet format is really slow, you can also try roslynator like in this command:
roslynator fix .\Lucene.Net.sln --supported-diagnostics NUnit2002 NUnit2003 NUnit2004
If you are using the same date even as the week changes, it would be useful to have a macro that stores the date calculated with +15 in the cell. There is no need to change +15 to +8.
<!DOCTYPE html>
<html>
<head>
<title>Rage Mode Game 😈</title>
<style>
body {
background: #fff3f3;
font-family: Arial;
overflow: hidden;
text-align: center;
}
h1 {
margin-top: 30px;
}
#btn {
position: absolute;
padding: 15px 25px;
background: #ff0000;
color: white;
border: none;
border-radius: 10px;
font-size: 18px;
}
#msg {
position: fixed;
bottom: 20px;
width: 100%;
font-size: 22px;
color: #ff0022;
}
</style>
</head>
<body>
<h1>Click the Button… if you can 😈</h1>
<button id="btn">CLICK!</button>
<div id="msg"></div>
<script>
const btn = document.getElementById("btn");
const msg = document.getElementById("msg");
const insults = [
"Bro missed 💀",
"Too slow 😂",
"My grandma is faster 😭",
"You almost had it… SIKE!",
"Skill issue detected 😹",
"Try harder lil bro 🤏",
];
function moveButton() {
const x = Math.random() * (window.innerWidth - 150);
const y = Math.random() * (window.innerHeight - 150);
btn.style.left = x + "px";
btn.style.top = y + "px";
// Random button size
const size = Math.random() * 40 + 20;
btn.style.fontSize = size + "px";
// Random message
msg.textContent = insults[Math.floor(Math.random() * insults.length)];
}
btn.addEventListener("mouseover", moveButton);
btn.addEventListener("click", () => {
alert("IMPOSSIBLE?? HOW DID YOU CLICK THAT 😨🔥");
});
</script>
</body>
</html>
Any Luck mate?
I got this error because I forgot to install dotenv
npm i dotenv
then I just imported and everything's working fine
import dotenv from "dotenv";
dotenv.config();