Free web resources everyday
Tag: WebDev
Web development news and tutorials
ReadWriteWeb.com
Web Apps, Web Technology Trends, Social Networking and Social Media
Nifty Corners Cube
Rounded corners the javascript way
Nifty Corners Cube
StackOverflow.com
Random snippets of all sorts of code, mixed with a selection of help and advice.
Use pattern matching to split array into sub-arrays
23 February 2025 @ 4:39 am
I have a Rust [i32; 6] that I'd like to split into three [i32; 2]. Can this be done by pattern matching, or do I explicitly have to reference all six elements?
I'd like to do something like this:
let arr6 = [0, 1, 2, 3, 4, 5];
let [sub1 @ [_; 2], sub2 @ [_; 2], sub3 @ [_; 2]] = arr6;
// or
let [sub1 @ [_, _], sub2 @ [_, _], sub3 @ [_, _]] = arr6;
Currently the only solution I see is
let sub1 = [arr6[0], arr6[1]];
let sub2 = [arr6[2], arr6[3]];
let sub3 = [arr6[3], arr6[4]]; // <-- whoops, that's wrong
How extract exact match from tabular huge tabular pdfs
23 February 2025 @ 4:32 am
I am using Python to read many PDFs, and they are quite large (some have 40 pages, others 3000). Therefore, I need some optimization.
As such, these PDFs have tabulated data and everything is well-structured. From these tables, I need to match a record and extract a row from each PDF, but since there are so many, my kernel crashes...
I was using Pdfplumber and also tried with LlamaReadMarkdown. Any suggestions?
Here is my code
with pdfplumber.open(pdf_path) as pdf:
for page in pdf.pages[1:]:
tables = page.extract_table()
if tables:
df = pd.DataFrame(tables[1:], columns=tables[0])
for index, row in df.iterrows():
if rut in row.values:
return df.loc[[index]]
return None
Im thinking to process it by batch but it will be viable?
Why is Find By Index on a LayeredPane not locating the Container to accept a label?
23 February 2025 @ 4:01 am
I had an error placing a label on a LayeredPane on my MovebyDrag screen, with a 2x1 table layout, placing a control container having a 6% height constraint in the first row, the field in the 2nd row. I have successfully placed the label on the LayeredPane on MovebyDrag (setup class) at Index 6, but when I Replay (viewing class) my activity movement I get the error: java.lang.IndexOutOfBoundsException: Index 6 out of bounds for length 0.
I am using the following block, which successfully reads the index location recorded in the db (142) and places the player on the Container field added to a Form named monitor on Replay with the same Container setup as MovebyDrag:
tlwloc = currentRow.getString(5); // location for LW label returned from pandr.db
tlwloci = Integer.parseInt(tlwloc);
((Container) field.getComponentAt(tlwloci)).add(lwlbl);
I am attempting to use the same logic for the ball location (Container with
Calling Items.Clear() causes a single recursive call to OnCreateControl()?
23 February 2025 @ 3:25 am
My class inherits from ComboBox, and it's having a weird issue.
The following code ends up populating the ComboBox dropdown list twice! That is, it ends up with a list twice as long as expected, and includes the expected list of items twice (despite my use of Items.Clear).
protected override void OnCreateControl()
{
base.OnCreateControl();
PopulatePayees();
}
// Populate list items
private void PopulatePayees()
{
Document document = Program.GetDocument();
Items.Clear();
foreach (ListItem listItem in document.Payees.GetListItems())
Items.Add(listItem);
}
Stepping through with the debugger, I see that as soon as I execute Items.Clear() in PopulatePayees(), it steps into OnCreateControl() a second time, which then calls PopulatePayees() a second time.
If I comment out Items.Clear(), it only populates the list
JAVA MCP SDK WebFlux Server Transport sendMessage is Broadcasts?
21 February 2025 @ 12:44 am
Why is this place broadcast to all sessions, if one MCPClient initiates the call, other McPclients will also receive the call results of other clients? thanks for help
/**
* Broadcasts a message to all connected clients through their SSE connections. The
* message is serialized to JSON and sent as an SSE event with type "message". If any
* errors occur during sending to a particular client, they are logged but don't
* prevent sending to other clients.
* @param message The JSON-RPC message to broadcast to all connected clients
* @return A Mono that completes when the broadcast attempt is finished
*/
@Override
public Mono<Void> sendMessage(McpSchema.JSONRPCMessage message) {
return Mono.fromRunnable(() -> {
if (sessions.isEmpty()) {
logger.debug("No active sessions to broadcast message to");
return;
}
try {
How do I bind my labels to my content pane?
20 February 2025 @ 3:37 am
I have added a layeredpane with a gridlayout to my field, and added my ball to the layeredpane. My players are added to the content pane. When I drag and drop the ball, it conforms to the layeredpane layout. When I drag the players, they also conform to the layeredpane layout. How can I bind the players to the content pane layout?
Using a multi-select cell to create a total Sum in Google Sheets formula
19 February 2025 @ 5:37 am
I've got a google sheet seen here
| Column A | Column B | Column C |
| -------- | -------- | -------- |
| Product | $100 ||
| Add-on 1 | $20 ||
| Add-on 2 | $10 ||
| Add-on 3 | $5 ||
||||
||||
|Customer. | Add-ons | Total Due |
| John Doe | Multi-select | Formula Needed here |
Google sheet:
I'm trying to write a formula in cell C8 that will allow me to multi-select in B8 and get a total in C8.
Here's what I have tried
=B1 + SUMPRODUCT(--(A2:A4=TRANSPOSE(B8)),B2:B4)
If I select one item in B8, it creates a sum as expected. But when I select 2 items, the value returns to just the value of B1. I suppose that is because once I select two values in B8 it becomes a list instead and this formula doesn't know how to deal with that.

PdfGoogleFonts to display Chinese characters on Flutter (both Simplified and Traditional Chinese)
6 February 2025 @ 12:44 am
I've been trying to display Chinese characters using PdfGoogleFonts on Flutter. I was able to find Japanese and Korean fonts that display their characters correctly, but having difficulty identifying Chinese fonts. Various language fonts are available in PdfGoogleFonts. Are Chinese fonts also available?
I am using the 'pdf' Flutter package to generate PDF files with localized text.
UPDATE:
On my Flutter project, I have the 'pdf' and 'printing' packages and both are the latest available on pub.dev.
pubspec.yaml
dependencies:
flutter:
sdk: flutter
pdf: ^3.11.3
printing: ^5.14.12
However, the PdfGoogleFonts in the project appears to contain a subset of what is available in
How to persist the response body of a HTTP request asynchronously in Spring WebClient
13 January 2025 @ 9:37 pm
I am working on a Java Spring Boot application, which implements a WebClient for handling rest HTTP request. GET requests are called to an endpoint and the response is received and mapped to a Mono, and then further processed in the application. A stripped down version of the original method looks similar to this:
Optional<Mono<MyEntity>> result = client.get()
.uri("/entities/{id}", id).accept(MediaType.APPLICATION_JSON)
.retrieve()
.bodyToMono(MyEntity.class)
.blockOptional();
Now, I want to 'intercept' the raw json response body and persist it with an asynchronous (or non-blocking) I/O operation, without blocking or hindering the flow of responses through the endpoint.
I have created a method to persist, and marked it with the @Async annotation. The body is first persisted to a string, passed to the method, and then the body is mapped to the MyEntity class.
Nuxt 3 in Docker: environment variables accessible everywhere but not in nuxt.config.ts
27 December 2024 @ 3:41 pm
I'm trying to move a nuxt 3 app to using docker-compose.
I read in the documentation that .env files are not read by nuxt in production.
So I'm trying to add them to the environment directive in my docker-compose.yml.
This works for most parts of my app, like on the server.
But specifically in my nuxt.config.ts where I need to specify my google client id for oauth, it does not work.
// nuxt.config.ts
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
devtools: { enabled: false },
ssr: true,
modules: ["nuxt-vue3-google-signin"],
compatibilityDate: "2024-09-04",
googleSignIn: {
clientId: process.env.NUXT_GOOGLE_CLIENT_ID,
// This is not recognized in production, the app fails to initialize with the 500 error that the clientID is missing
// I also tried leaving it as empty string and using "NUXT_GOOGLE
960.gs
CSS Grid System layout guide
960.gs
IconPot .com
Totally free icons
Interface.eyecon.ro
Interface elements for jQuery
Interface.eyecon.ro
ThemeForest.net
WordPress Themes, HTML Templates.
kuler.adobe.com
color / colour themes by design
webanalyticssolutionprofiler.com
Web Analytics::Free Resources from Immeria
webanalyticssolutionprofiler.com